aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDeclCXX.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-08-22 15:54:49 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-08-22 15:54:49 +0000
commita28948f34817476d02412fa204cae038e228c827 (patch)
tree3aab4757cbcd4cf2b320a93fec061b4f0497343a /lib/Parse/ParseDeclCXX.cpp
parentec5bc81fd55bfcc26fc4bde6d5e33113d94c2209 (diff)
Restore patch I reversed in r138040. Known buildbot
failures are resolved. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138234 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDeclCXX.cpp')
-rw-r--r--lib/Parse/ParseDeclCXX.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 7c38857f5a..f6a79e5967 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -52,7 +52,10 @@ Decl *Parser::ParseNamespace(unsigned Context,
SourceLocation InlineLoc) {
assert(Tok.is(tok::kw_namespace) && "Not a namespace!");
SourceLocation NamespaceLoc = ConsumeToken(); // eat the 'namespace'.
-
+ Decl *DC = getObjCDeclContext();
+ if (DC)
+ Actions.ActOnObjCContainerFinishDefinition(DC);
+
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteNamespaceDecl(getCurScope());
ConsumeCodeCompletionToken();
@@ -89,8 +92,10 @@ Decl *Parser::ParseNamespace(unsigned Context,
if (InlineLoc.isValid())
Diag(InlineLoc, diag::err_inline_namespace_alias)
<< FixItHint::CreateRemoval(InlineLoc);
-
- return ParseNamespaceAlias(NamespaceLoc, IdentLoc, Ident, DeclEnd);
+ Decl *Res = ParseNamespaceAlias(NamespaceLoc, IdentLoc, Ident, DeclEnd);
+ if (DC)
+ Actions.ActOnObjCContainerStartDefinition(DC);
+ return Res;
}
@@ -101,6 +106,8 @@ Decl *Parser::ParseNamespace(unsigned Context,
}
Diag(Tok, Ident ? diag::err_expected_lbrace :
diag::err_expected_ident_lbrace);
+ if (DC)
+ Actions.ActOnObjCContainerStartDefinition(DC);
return 0;
}
@@ -115,6 +122,8 @@ Decl *Parser::ParseNamespace(unsigned Context,
}
Diag(LBrace, diag::err_namespace_nonnamespace_scope);
SkipUntil(tok::r_brace, false);
+ if (DC)
+ Actions.ActOnObjCContainerStartDefinition(DC);
return 0;
}
@@ -173,6 +182,8 @@ Decl *Parser::ParseNamespace(unsigned Context,
Actions.ActOnFinishNamespaceDef(NamespcDecl, RBraceLoc);
DeclEnd = RBraceLoc;
+ if (DC)
+ Actions.ActOnObjCContainerStartDefinition(DC);
return NamespcDecl;
}
@@ -317,7 +328,9 @@ Decl *Parser::ParseUsingDirectiveOrDeclaration(unsigned Context,
ParsedAttributesWithRange &attrs,
Decl **OwnedType) {
assert(Tok.is(tok::kw_using) && "Not using token");
-
+ Decl *DC = getObjCDeclContext();
+ if (DC)
+ Actions.ActOnObjCContainerFinishDefinition(DC);
// Eat 'using'.
SourceLocation UsingLoc = ConsumeToken();
@@ -335,7 +348,10 @@ Decl *Parser::ParseUsingDirectiveOrDeclaration(unsigned Context,
<< R << FixItHint::CreateRemoval(R);
}
- return ParseUsingDirective(Context, UsingLoc, DeclEnd, attrs);
+ Decl *Res = ParseUsingDirective(Context, UsingLoc, DeclEnd, attrs);
+ if (DC)
+ Actions.ActOnObjCContainerStartDefinition(DC);
+ return Res;
}
// Otherwise, it must be a using-declaration or an alias-declaration.
@@ -343,8 +359,11 @@ Decl *Parser::ParseUsingDirectiveOrDeclaration(unsigned Context,
// Using declarations can't have attributes.
ProhibitAttributes(attrs);
- return ParseUsingDeclaration(Context, TemplateInfo, UsingLoc, DeclEnd,
- AS_none, OwnedType);
+ Decl *Res = ParseUsingDeclaration(Context, TemplateInfo, UsingLoc, DeclEnd,
+ AS_none, OwnedType);
+ if (DC)
+ Actions.ActOnObjCContainerStartDefinition(DC);
+ return Res;
}
/// ParseUsingDirective - Parse C++ using-directive, assumes