Added a new class for Interfaces qualified by protocol list.
Protocols are now sorted and made unique in the list.
Enhanced pretty printer for @interface (So, I can see the protocol list).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42776 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index a52cd45..1ec2c72 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -74,8 +74,26 @@
}
static void PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID) {
- std::string S = OID->getName();
- fprintf(stderr, "@interface %s;\n", S.c_str());
+ std::string I = OID->getName();
+ ObjcInterfaceDecl *SID = OID->getSuperClass();
+ if (SID) {
+ std::string S = SID->getName();
+ fprintf(stderr, "@interface %s : %s", I.c_str(), S.c_str());
+ }
+ else
+ fprintf(stderr, "@interface %s", I.c_str());
+ // Protocols?
+ int count = OID->getNumIntfRefProtocols();
+ if (count > 0) {
+ ObjcProtocolDecl **refProtocols = OID->getReferencedProtocols();
+ for (int i = 0; i < count; i++)
+ fprintf(stderr, "%c%s", (i == 0 ? '<' : ','),
+ refProtocols[i]->getName());
+ }
+ if (count > 0)
+ fprintf(stderr, ">;\n");
+ else
+ fprintf(stderr, ";\n");
// FIXME: implement the rest...
}