aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-19 09:28:58 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-19 09:28:58 +0000
commit731ad843b7bf1862f6547ac79539f0f5b4c539bd (patch)
tree97e3dae789dab6e85566c174aaa08aa02b818c44 /lib/Parse/ParseDecl.cpp
parentcfdc81a83467973b14e4ea5e9e9af1690f135415 (diff)
Just push a new scope when parsing an out-of-line variable definition.
Magically fixes all the terrible lookup problems associated with not pushing a new scope. Resolves an ancient xfail and an LLVM misparse. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 5dd78f7b54..43c92456d2 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -550,13 +550,17 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
SourceLocation DelLoc = ConsumeToken();
Actions.SetDeclDeleted(ThisDecl, DelLoc);
} else {
- if (getLang().CPlusPlus)
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
+ EnterScope(0);
Actions.ActOnCXXEnterDeclInitializer(CurScope, ThisDecl);
+ }
OwningExprResult Init(ParseInitializer());
- if (getLang().CPlusPlus)
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl);
+ ExitScope();
+ }
if (Init.isInvalid()) {
SkipUntil(tok::semi, true, true);