diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-11-19 18:01:13 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-11-19 18:01:13 +0000 |
commit | 0d09c4944e448958ab1ff1941948777805df95e7 (patch) | |
tree | 6b5c36f3ade69e225924258059cf95b0dfbc6615 /clang/lib/Sema/SemaDecl.cpp | |
parent | ef5e6934cb38f616938a448bd31868c19edafd71 (diff) | |
download | bcm5719-llvm-0d09c4944e448958ab1ff1941948777805df95e7.tar.gz bcm5719-llvm-0d09c4944e448958ab1ff1941948777805df95e7.zip |
Take care another assert:
struct A {
struct B;
};
struct A::B {
void m() {} // Assertion failed: getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one."
};
Introduce DeclContext::getLexicalParent which may be different from DeclContext::getParent when nested-names are involved, e.g:
namespace A {
struct S;
}
struct A::S {}; // getParent() == namespace 'A'
// getLexicalParent() == translation unit
llvm-svn: 59650
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d6d9845af79..941f40fa52a 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -53,10 +53,10 @@ DeclContext *Sema::getContainingDC(DeclContext *DC) { // A C++ inline method is parsed *after* the topmost class it was declared in // is fully parsed (it's "complete"). // The parsing of a C++ inline method happens at the declaration context of - // the topmost (non-nested) class it is declared in. + // the topmost (non-nested) class it is lexically declared in. assert(isa<CXXRecordDecl>(MD->getParent()) && "C++ method not in Record."); DC = MD->getParent(); - while (CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(DC->getParent())) + while (CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(DC->getLexicalParent())) DC = RD; // Return the declaration context of the topmost class the inline method is @@ -70,7 +70,7 @@ DeclContext *Sema::getContainingDC(DeclContext *DC) { if (ScopedDecl *SD = dyn_cast<ScopedDecl>(DC)) return SD->getLexicalDeclContext(); - return DC->getParent(); + return DC->getLexicalParent(); } void Sema::PushDeclContext(DeclContext *DC) { |