summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-12-22 17:47:17 +0000
committerDouglas Gregor <dgregor@apple.com>2009-12-22 17:47:17 +0000
commit613bf10470f2957d6ab0c29a4f73a16979458e33 (patch)
treeba7a92e141ef425eff0e1cd0098b5a0d235343a7 /clang/lib/Parse/ParseDecl.cpp
parent8b858396d47b098f9f19327bc167cef5bb782abc (diff)
downloadbcm5719-llvm-613bf10470f2957d6ab0c29a4f73a16979458e33.tar.gz
bcm5719-llvm-613bf10470f2957d6ab0c29a4f73a16979458e33.zip
Enter the scope of an initializer for direct-initialization as well as
for copy-initialization. llvm-svn: 91909
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 43c92456d29..347d67a19ac 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -574,14 +574,30 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
ExprVector Exprs(Actions);
CommaLocsTy CommaLocs;
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
+ EnterScope(0);
+ Actions.ActOnCXXEnterDeclInitializer(CurScope, ThisDecl);
+ }
+
if (ParseExpressionList(Exprs, CommaLocs)) {
SkipUntil(tok::r_paren);
+
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
+ Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl);
+ ExitScope();
+ }
} else {
// Match the ')'.
SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
assert(!Exprs.empty() && Exprs.size()-1 == CommaLocs.size() &&
"Unexpected number of commas!");
+
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
+ Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl);
+ ExitScope();
+ }
+
Actions.AddCXXDirectInitializerToDecl(ThisDecl, LParenLoc,
move_arg(Exprs),
CommaLocs.data(), RParenLoc);
OpenPOWER on IntegriCloud