diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-17 18:09:05 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-17 18:09:05 +0000 |
commit | d53ae83516a1005f91e111ce309e17bfac540637 (patch) | |
tree | 5e89604c271ee44842663eb7947de3a07b2d0a21 /clang/lib/Sema/Sema.cpp | |
parent | 41b9ddeb7ab6e4e7166379c2518bd59edb4676ec (diff) | |
download | bcm5719-llvm-d53ae83516a1005f91e111ce309e17bfac540637.tar.gz bcm5719-llvm-d53ae83516a1005f91e111ce309e17bfac540637.zip |
Delay the creation of the built-in Objective-C class 'Protocol' by
moving it from a "special type" to a predefined declaration, as we do
for id, Class, and SEL.
llvm-svn: 148313
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 447ce43dc5a..0e4d22fc7f5 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -77,19 +77,6 @@ void Sema::ActOnTranslationUnitScope(Scope *S) { PushDeclContext(S, Context.getTranslationUnitDecl()); VAListTagName = PP.getIdentifierInfo("__va_list_tag"); - - if (PP.getLangOptions().ObjC1) { - // Synthesize "@class Protocol; - if (Context.getObjCProtoType().isNull()) { - ObjCInterfaceDecl *ProtocolDecl = - ObjCInterfaceDecl::Create(Context, CurContext, SourceLocation(), - &Context.Idents.get("Protocol"), - /*PrevDecl=*/0, - SourceLocation(), true); - Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl)); - PushOnScopeChains(ProtocolDecl, TUScope, false); - } - } } Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, @@ -174,6 +161,11 @@ void Sema::Initialize() { DeclarationName Class = &Context.Idents.get("Class"); if (IdResolver.begin(Class) == IdResolver.end()) PushOnScopeChains(Context.getObjCClassDecl(), TUScope); + + // Create the built-in forward declaratino for 'Protocol'. + DeclarationName Protocol = &Context.Idents.get("Protocol"); + if (IdResolver.begin(Protocol) == IdResolver.end()) + PushOnScopeChains(Context.getObjCProtocolDecl(), TUScope); } } |