diff options
author | DeLesley Hutchins <delesley@google.com> | 2012-04-06 15:10:17 +0000 |
---|---|---|
committer | DeLesley Hutchins <delesley@google.com> | 2012-04-06 15:10:17 +0000 |
commit | cf2fa2f0c9d67adb98b282ec0eaa88f08df29804 (patch) | |
tree | 1bceca7c2b58a989bb6d6dafb7642895313423c7 /lib/Sema/SemaDecl.cpp | |
parent | 7a521806831b8724364ff714c959b354bbf5a438 (diff) |
Fixed scoping error for late parsed attributes in nested classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154173 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
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. /// |