summaryrefslogtreecommitdiffstats
path: root/lib/Sema
diff options
context:
space:
mode:
authorDeLesley Hutchins <delesley@google.com>2012-04-06 15:10:17 +0000
committerDeLesley Hutchins <delesley@google.com>2012-04-06 15:10:17 +0000
commitcf2fa2f0c9d67adb98b282ec0eaa88f08df29804 (patch)
tree1bceca7c2b58a989bb6d6dafb7642895313423c7 /lib/Sema
parent7a521806831b8724364ff714c959b354bbf5a438 (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')
-rw-r--r--lib/Sema/SemaDecl.cpp17
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.
///