aboutsummaryrefslogtreecommitdiff
path: root/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
commita8cc8ce044e5d2589128f0c1a84e586cce743b27 (patch)
tree4adb92ceade9162327c38ca3335c964676b8357f /lib/AST/DeclBase.cpp
parent1b95a6546d1f3847da29da0d1e8dc5d77b1a7fbb (diff)
Make sure that ScopedDecls passed to DeclContext::addDecl are added into their lexical context
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61998 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r--lib/AST/DeclBase.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index f1ce3f3d0d..d9765ac4b4 100644
--- a/lib/AST/DeclBase.cpp
+++ b/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())