Patch to implemented objective-c's dynamic object pointer qualified with
the protocol list (id<P,...> types).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45121 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Type.cpp b/AST/Type.cpp
index b1da04b..63f3589 100644
--- a/AST/Type.cpp
+++ b/AST/Type.cpp
@@ -539,6 +539,17 @@
Profile(ID, &Protocols[0], getNumProtocols());
}
+void ObjcQualifiedIdType::Profile(llvm::FoldingSetNodeID &ID,
+ ObjcProtocolDecl **protocols,
+ unsigned NumProtocols) {
+ for (unsigned i = 0; i != NumProtocols; i++)
+ ID.AddPointer(protocols[i]);
+}
+
+void ObjcQualifiedIdType::Profile(llvm::FoldingSetNodeID &ID) {
+ Profile(ID, &Protocols[0], getNumProtocols());
+}
+
/// LookThroughTypedefs - Return the ultimate type this typedef corresponds to
/// potentially looking through *all* consequtive typedefs. This returns the
/// sum of the type qualifiers, so if you have:
@@ -780,6 +791,22 @@
InnerString = ObjcQIString + InnerString;
}
+void ObjcQualifiedIdType::getAsStringInternal(
+ std::string &InnerString) const {
+ if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'.
+ InnerString = ' ' + InnerString;
+ std::string ObjcQIString = "id";
+ ObjcQIString += '<';
+ int num = getNumProtocols();
+ for (int i = 0; i < num; i++) {
+ ObjcQIString += getProtocols(i)->getName();
+ if (i < num-1)
+ ObjcQIString += ',';
+ }
+ ObjcQIString += '>';
+ InnerString = ObjcQIString + InnerString;
+}
+
void TagType::getAsStringInternal(std::string &InnerString) const {
if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'.
InnerString = ' ' + InnerString;