diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-12-16 21:30:33 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-12-16 21:30:33 +0000 |
commit | 4d87df5853ab4730f617a21747037ebcdde70745 (patch) | |
tree | 2339628b6677d8e1ecf8b3cdced7d7f86c2b8811 /clang/lib/Sema/SemaCXXScopeSpec.cpp | |
parent | 56b55387fcf8cd2b094c306eaa4955d2915643ae (diff) | |
download | bcm5719-llvm-4d87df5853ab4730f617a21747037ebcdde70745.tar.gz bcm5719-llvm-4d87df5853ab4730f617a21747037ebcdde70745.zip |
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.
llvm-svn: 61103
Diffstat (limited to 'clang/lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCXXScopeSpec.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index fe9ae07ebac..f023fbf2e2a 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/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());
}
|