aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCXXScopeSpec.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-12-16 21:30:33 +0000
committerDouglas Gregor <dgregor@apple.com>2008-12-16 21:30:33 +0000
commit72b505b7904b3c9320a1312998800ba76e4f5841 (patch)
treef42af0b9389fa6b9366de74a72faaf14b769496d /lib/Sema/SemaCXXScopeSpec.cpp
parent82b4e768d38c12ceba7db23a96e8d845e00fdeb7 (diff)
Delay parsing of default arguments of member functions until the class
is completely defined (C++ [class.mem]p2). Reverse the order in which we process the definitions of member functions specified inline. This way, we'll get diagnostics in the order in which the member functions were declared in the class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r--lib/Sema/SemaCXXScopeSpec.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index fe9ae07eba..f023fbf2e2 100644
--- a/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/lib/Sema/SemaCXXScopeSpec.cpp
@@ -134,7 +134,8 @@ void Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
assert(PreDeclaratorDC == 0 && "Previous declarator context not popped?");
PreDeclaratorDC = static_cast<DeclContext*>(S->getEntity());
- S->setEntity(static_cast<DeclContext*>(SS.getScopeRep()));
+ CurContext = static_cast<DeclContext*>(SS.getScopeRep());
+ S->setEntity(CurContext);
}
/// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
@@ -147,4 +148,9 @@ void Sema::ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
assert(S->getEntity() == SS.getScopeRep() && "Context imbalance!");
S->setEntity(PreDeclaratorDC);
PreDeclaratorDC = 0;
+
+ // Reset CurContext to the nearest enclosing context.
+ while (!S->getEntity() && S->getParent())
+ S = S->getParent();
+ CurContext = static_cast<DeclContext*>(S->getEntity());
}