summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-02-21 20:17:11 +0000
committerSteve Naroff <snaroff@apple.com>2009-02-21 20:17:11 +0000
commit670e72ddc70143233caba09005193376ac93debf (patch)
treed96a83e8db8e1a6c5bc8c23864be9510846dc946 /clang/lib/AST/ASTContext.cpp
parent2ac40a9ff8b6480a1d299e7aee9b093eff982d27 (diff)
downloadbcm5719-llvm-670e72ddc70143233caba09005193376ac93debf.tar.gz
bcm5719-llvm-670e72ddc70143233caba09005193376ac93debf.zip
Add support for GCC ObjC extension "Class<protocol>". Sigh.
Found while researching <rdar://problem/6497631> Message lookup is sometimes different than gcc's. Will never be seen in user code. Needed to pass dejagnu testsuite. llvm-svn: 65244
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 830cc6a977e..cdd61cd3f4a 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1394,6 +1394,29 @@ QualType ASTContext::getObjCQualifiedIdType(ObjCProtocolDecl **Protocols,
return QualType(QType, 0);
}
+/// getObjCQualifiedClassType - Return an ObjCQualifiedIdType for the 'Class'
+/// decl and the conforming protocol list.
+QualType ASTContext::getObjCQualifiedClassType(ObjCProtocolDecl **Protocols,
+ unsigned NumProtocols) {
+ // Sort the protocol list alphabetically to canonicalize it.
+ SortAndUniqueProtocols(Protocols, NumProtocols);
+
+ llvm::FoldingSetNodeID ID;
+ ObjCQualifiedIdType::Profile(ID, Protocols, NumProtocols);
+
+ void *InsertPos = 0;
+ if (ObjCQualifiedClassType *QT =
+ ObjCQualifiedClassTypes.FindNodeOrInsertPos(ID, InsertPos))
+ return QualType(QT, 0);
+
+ // No Match;
+ ObjCQualifiedClassType *QType =
+ new (*this,8) ObjCQualifiedClassType(Protocols, NumProtocols);
+ Types.push_back(QType);
+ ObjCQualifiedClassTypes.InsertNode(QType, InsertPos);
+ return QualType(QType, 0);
+}
+
/// getTypeOfExpr - Unlike many "get<Type>" functions, we can't unique
/// TypeOfExpr AST's (since expression's are never shared). For example,
/// multiple declarations that refer to "typeof(x)" all contain different
OpenPOWER on IntegriCloud