diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-08-12 05:59:41 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-08-12 05:59:41 +0000 |
commit | 79d6726921897811232554ed94c5d77b5b7b3fc0 (patch) | |
tree | 9f6793546dea6bed492baddfe4607801b13e93d3 /lib/Sema/Sema.cpp | |
parent | ddddd48da72bc29d1c3f388ed91ea5549328129e (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r-- | lib/Sema/Sema.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index adc749dd70..2377d186ef 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -105,19 +105,6 @@ void Sema::ActOnTranslationUnitScope(Scope *S) { SourceLocation(), true); Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl)); PushOnScopeChains(ProtocolDecl, TUScope, false); - } - - // Create the built-in typedef for 'Class'. - if (Context.getObjCClassType().isNull()) { - QualType T = Context.getObjCObjectType(Context.ObjCBuiltinClassTy, 0, 0); - T = Context.getObjCObjectPointerType(T); - TypeSourceInfo *ClassInfo = Context.getTrivialTypeSourceInfo(T); - TypedefDecl *ClassTypedef - = TypedefDecl::Create(Context, CurContext, - SourceLocation(), SourceLocation(), - &Context.Idents.get("Class"), ClassInfo); - PushOnScopeChains(ClassTypedef, TUScope); - Context.setObjCClassType(Context.getTypeDeclType(ClassTypedef)); } } @@ -175,6 +162,11 @@ void Sema::Initialize() { DeclarationName Id = &Context.Idents.get("id"); if (IdentifierResolver::begin(Id) == IdentifierResolver::end()) PushOnScopeChains(Context.getObjCIdDecl(), TUScope); + + // Create the built-in typedef for 'Class'. + DeclarationName Class = &Context.Idents.get("Class"); + if (IdentifierResolver::begin(Class) == IdentifierResolver::end()) + PushOnScopeChains(Context.getObjCClassDecl(), TUScope); } } |