summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-08-12 05:59:41 +0000
committerDouglas Gregor <dgregor@apple.com>2011-08-12 05:59:41 +0000
commit0a58618a0909775658e4fe3966c0d27d89153feb (patch)
tree3ae8a36a162886d06887d4f26f06a1e48c0aa8cc /clang/lib/AST/ASTContext.cpp
parent9f8a02d34e0e52e953a1f8fff45aba306784c4ed (diff)
downloadbcm5719-llvm-0a58618a0909775658e4fe3966c0d27d89153feb.tar.gz
bcm5719-llvm-0a58618a0909775658e4fe3966c0d27d89153feb.zip
Switch the Objective-C 'Class' type over to a predefined type in the
AST file format, lazily generating the actual declaration in ASTContext as needed. llvm-svn: 137431
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index cf4535bd90c..5951fcfe0e0 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -222,7 +222,8 @@ ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM,
DependentTemplateSpecializationTypes(this_()),
SubstTemplateTemplateParmPacks(this_()),
GlobalNestedNameSpecifier(0), IsInt128Installed(false),
- ObjCIdDecl(0), CFConstantStringTypeDecl(0),
+ ObjCIdDecl(0), ObjCClassDecl(0),
+ CFConstantStringTypeDecl(0),
FILEDecl(0),
jmp_bufDecl(0), sigjmp_bufDecl(0), BlockDescriptorType(0),
BlockDescriptorExtendedType(0), cudaConfigureCallDecl(0),
@@ -430,7 +431,6 @@ void ASTContext::InitBuiltinTypes() {
BuiltinVaListType = QualType();
// "Builtin" typedefs set by Sema::ActOnTranslationUnitScope().
- ObjCClassTypedefType = QualType();
ObjCSelTypedefType = QualType();
// Builtin types for 'id', 'Class', and 'SEL'.
@@ -4640,8 +4640,18 @@ void ASTContext::setObjCProtoType(QualType QT) {
ObjCProtoType = QT;
}
-void ASTContext::setObjCClassType(QualType T) {
- ObjCClassTypedefType = T;
+TypedefDecl *ASTContext::getObjCClassDecl() const {
+ if (!ObjCClassDecl) {
+ QualType T = getObjCObjectType(ObjCBuiltinClassTy, 0, 0);
+ T = getObjCObjectPointerType(T);
+ TypeSourceInfo *ClassInfo = getTrivialTypeSourceInfo(T);
+ ObjCClassDecl = TypedefDecl::Create(const_cast<ASTContext &>(*this),
+ getTranslationUnitDecl(),
+ SourceLocation(), SourceLocation(),
+ &Idents.get("Class"), ClassInfo);
+ }
+
+ return ObjCClassDecl;
}
void ASTContext::setObjCConstantStringInterface(ObjCInterfaceDecl *Decl) {
OpenPOWER on IntegriCloud