diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 9 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 17 |
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 9216b23d31..b5ce193521 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -735,9 +735,18 @@ void Parser::ParseLexedAttributes(ParsingClass &Class) { ParseScope ClassScope(this, ScopeFlags, !AlreadyHasClassScope); ParseScopeFlags ClassScopeFlags(this, ScopeFlags, AlreadyHasClassScope); + // Enter the scope of nested classes + if (!AlreadyHasClassScope) + Actions.ActOnStartDelayedMemberDeclarations(getCurScope(), + Class.TagOrTemplate); + for (unsigned i = 0, ni = Class.LateParsedDeclarations.size(); i < ni; ++i) { Class.LateParsedDeclarations[i]->ParseLexedAttributes(); } + + if (!AlreadyHasClassScope) + Actions.ActOnFinishDelayedMemberDeclarations(getCurScope(), + Class.TagOrTemplate); } diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 12b9a63025..f54f0fd942 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -872,7 +872,13 @@ void Sema::ActOnReenterFunctionContext(Scope* S, Decl *D) { if (!FD) return; - PushDeclContext(S, FD); + // Same implementation as PushDeclContext, but enters the context + // from the lexical parent, rather than the top-level class. + assert(CurContext == FD->getLexicalParent() && + "The next DeclContext should be lexically contained in the current one."); + CurContext = FD; + S->setEntity(CurContext); + for (unsigned P = 0, NumParams = FD->getNumParams(); P < NumParams; ++P) { ParmVarDecl *Param = FD->getParamDecl(P); // If the parameter has an identifier, then add it to the scope @@ -884,6 +890,15 @@ void Sema::ActOnReenterFunctionContext(Scope* S, Decl *D) { } +void Sema::ActOnExitFunctionContext() { + // Same implementation as PopDeclContext, but returns to the lexical parent, + // rather than the top-level class. + assert(CurContext && "DeclContext imbalance!"); + CurContext = CurContext->getLexicalParent(); + assert(CurContext && "Popped translation unit!"); +} + + /// \brief Determine whether we allow overloading of the function /// PrevDecl with another declaration. /// |