diff options
author | Steve Naroff <snaroff@apple.com> | 2009-02-21 20:17:11 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-02-21 20:17:11 +0000 |
commit | 15509f4fe73f0e11a8cec602bce4d99d9454b7f6 (patch) | |
tree | 70f1200764bd9bff972b8213bb5abb7c1913338e /lib/AST/ASTContext.cpp | |
parent | d6840002c37ba25effe5eb4bb89c4ae2e1d80945 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 830cc6a977..cdd61cd3f4 100644 --- a/lib/AST/ASTContext.cpp +++ b/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 |