aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-09-29 19:42:55 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-09-29 19:42:55 +0000
commit24fab41057e4b67ed69a6b4027d5ae0f2f6934dc (patch)
treebb0bab5b1a518755eef42eee3dd72c87835aedc7 /lib/AST/ASTContext.cpp
parente3a535bb6b39ff721aa3a7177dc427974ca0ff42 (diff)
Introduce ObjCProtocolListType type subclass.
This is used only for keeping detailed type source information for protocol references, it should not participate in the semantics of the type system. Its protocol list is not canonicalized. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index e0223b009f..1fa492c874 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -551,6 +551,10 @@ ASTContext::getTypeInfo(const Type *T) {
assert(false && "Should not see dependent types");
break;
+ case Type::ObjCProtocolList:
+ assert(false && "Should not see protocol list types");
+ break;
+
case Type::FunctionNoProto:
case Type::FunctionProto:
// GCC extension: alignof(function) = 32 bits
@@ -1989,6 +1993,25 @@ QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
return QualType(QType, 0);
}
+QualType ASTContext::getObjCProtocolListType(QualType T,
+ ObjCProtocolDecl **Protocols,
+ unsigned NumProtocols) {
+ llvm::FoldingSetNodeID ID;
+ ObjCProtocolListType::Profile(ID, T, Protocols, NumProtocols);
+
+ void *InsertPos = 0;
+ if (ObjCProtocolListType *QT =
+ ObjCProtocolListTypes.FindNodeOrInsertPos(ID, InsertPos))
+ return QualType(QT, 0);
+
+ // No Match;
+ ObjCProtocolListType *QType = new (*this, TypeAlignment)
+ ObjCProtocolListType(T, Protocols, NumProtocols);
+ Types.push_back(QType);
+ ObjCProtocolListTypes.InsertNode(QType, InsertPos);
+ return QualType(QType, 0);
+}
+
/// getTypeOfExprType - Unlike many "get<Type>" functions, we can't unique
/// TypeOfExprType AST's (since expression's are never shared). For example,
/// multiple declarations that refer to "typeof(x)" all contain different