mirror of
https://github.com/intel/llvm.git
synced 2026-01-19 09:31:59 +08:00
Implemented the reverse-lookup API in the AST
importer to avoid duplicate imports of anonymous structs. <rdar://problem/14421722> llvm-svn: 192327
This commit is contained in:
@@ -278,6 +278,8 @@ private:
|
||||
|
||||
clang::Decl *Imported (clang::Decl *from, clang::Decl *to);
|
||||
|
||||
clang::Decl *GetOriginalDecl (clang::Decl *To);
|
||||
|
||||
std::set<clang::NamedDecl *> *m_decls_to_deport;
|
||||
std::set<clang::NamedDecl *> *m_decls_already_deported;
|
||||
ClangASTImporter &m_master;
|
||||
|
||||
@@ -716,3 +716,18 @@ ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to)
|
||||
|
||||
return clang::ASTImporter::Imported(from, to);
|
||||
}
|
||||
|
||||
clang::Decl *ClangASTImporter::Minion::GetOriginalDecl (clang::Decl *To)
|
||||
{
|
||||
ASTContextMetadataSP to_context_md = m_master.GetContextMetadata(&To->getASTContext());
|
||||
|
||||
if (!to_context_md)
|
||||
return NULL;
|
||||
|
||||
OriginMap::iterator iter = to_context_md->m_origins.find(To);
|
||||
|
||||
if (iter == to_context_md->m_origins.end())
|
||||
return NULL;
|
||||
|
||||
return const_cast<clang::Decl*>(iter->second.decl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user