diff options
author | Sean Callanan <scallanan@apple.com> | 2013-05-09 01:09:49 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2013-05-09 01:09:49 +0000 |
commit | 04b2bfa3a965a66d864e51bf388979a8d2955851 (patch) | |
tree | 0e84f8e8a03472a2ba6d70a9e872055fbf91452a | |
parent | da144dc216dd98885f4f9b9b5ac1376039033611 (diff) | |
download | bcm5719-llvm-04b2bfa3a965a66d864e51bf388979a8d2955851.tar.gz bcm5719-llvm-04b2bfa3a965a66d864e51bf388979a8d2955851.zip |
Add all Decls found through FindExternalLexicalDecls
to the DeclContext. This fulfils the contract that
we make with Clang by returning ELR_AlreadyLoaded.
This is a little aggressive in that it does not allow
the ASTImporter to import the child decls with any
lexical parent other than the Decl that reported them
as children.
<rdar://problem/13517713>
llvm-svn: 181498
-rw-r--r-- | lldb/source/Expression/ClangASTSource.cpp | 12 |
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); } } |