summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 26d34c27495..d664b1e8587 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -472,6 +472,18 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
}
decls.push_back(copied_decl);
+
+ DeclContext *decl_context_non_const = const_cast<DeclContext *>(decl_context);
+
+ if (copied_decl->getDeclContext() != decl_context)
+ {
+ if (copied_decl->getDeclContext()->containsDecl(copied_decl))
+ copied_decl->getDeclContext()->removeDecl(copied_decl);
+ copied_decl->setDeclContext(decl_context_non_const);
+ }
+
+ if (!decl_context_non_const->containsDecl(copied_decl))
+ decl_context_non_const->addDeclInternal(copied_decl);
}
}
OpenPOWER on IntegriCloud