aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-17 18:09:05 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-17 18:09:05 +0000
commita6ea10e22b600d92e084f6b11b9b9a92d0eb2412 (patch)
treee9e55170c8ddcc34db5317d6591b7031a3381fb1 /lib/Sema/Sema.cpp
parentc8769460f1c03bc321b00f5611f9965e8385e64d (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148313 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r--lib/Sema/Sema.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 447ce43dc5..0e4d22fc7f 100644
--- a/lib/Sema/Sema.cpp
+++ b/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);
}
}