[Lldb-commits] [lldb] r181498 - Add all Decls found through FindExternalLexicalDecls
Sean Callanan
scallanan at apple.com
Wed May 8 18:09:49 PDT 2013
Author: spyffe
Date: Wed May 8 20:09:49 2013
New Revision: 181498
URL: http://llvm.org/viewvc/llvm-project?rev=181498&view=rev
Log:
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>
Modified:
lldb/trunk/source/Expression/ClangASTSource.cpp
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=181498&r1=181497&r2=181498&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Wed May 8 20:09:49 2013
@@ -472,6 +472,18 @@ ClangASTSource::FindExternalLexicalDecls
}
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);
}
}
More information about the lldb-commits
mailing list