summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-09 18:51:29 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-09 18:51:29 +0000
commitc72e645fd6da47a5df13fcdc4d053d4e3a213377 (patch)
tree93b5824440819305843566b154d42b11d0f2418e /clang/lib/AST/DeclBase.cpp
parent5f54d50917d078ed09f5e8758c9c1d7e3fc05b76 (diff)
downloadbcm5719-llvm-c72e645fd6da47a5df13fcdc4d053d4e3a213377.tar.gz
bcm5719-llvm-c72e645fd6da47a5df13fcdc4d053d4e3a213377.zip
Make sure that ScopedDecls passed to DeclContext::addDecl are added into their lexical context
llvm-svn: 61998
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r--clang/lib/AST/DeclBase.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index f1ce3f3d0d9..d9765ac4b45 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -514,6 +514,7 @@ DeclContext *DeclContext::getNextContext() {
}
void DeclContext::addDecl(ASTContext &Context, ScopedDecl *D, bool AllowLookup) {
+ assert(D->getLexicalDeclContext() == this && "Decl inserted into wrong lexical context");
Decls.push_back(D);
if (AllowLookup)
D->getDeclContext()->insert(Context, D);
@@ -599,7 +600,6 @@ void DeclContext::insert(ASTContext &Context, ScopedDecl *D) {
if (LookupPtr.getPointer())
insertImpl(D);
-
// If we are a transparent context, insert into our parent context,
// too. This operation is recursive.
if (isTransparentContext())
OpenPOWER on IntegriCloud