forked from OSchip/llvm-project
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
This commit is contained in:
parent
da144dc216
commit
04b2bfa3a9
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue