Added support to the ASTImporter for passing

completion information between different AST
contexts.  It works like this:

- If a Decl is imported from a context that
  has completion metadata, then that Decl
  is associated with the same completion
  information (possibly none) as the Decl
  it was imported from.

- If a Decl is imported from a context that
  does not have completion metadata, then it
  is marked as completable by consulting the
  Decl and context it was imported from.

llvm-svn: 144838
This commit is contained in:
Sean Callanan 2011-11-16 22:23:28 +00:00
parent bfe5c5c968
commit b0b87a5617
2 changed files with 39 additions and 3 deletions

View File

@ -211,6 +211,17 @@ private:
}
}
ASTContextMetadataSP
MaybeGetContextMetadata (clang::ASTContext *dst_ctx)
{
ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
if (context_md_iter != m_metadata_map.end())
return context_md_iter->second;
else
return ASTContextMetadataSP();
}
MinionSP
GetMinion (clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx)
{

View File

@ -194,10 +194,35 @@ clang::Decl
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
ASTContextMetadataSP context_md = m_master.GetContextMetadata(&to->getASTContext());
ASTContextMetadataSP to_context_md = m_master.GetContextMetadata(&to->getASTContext());
ASTContextMetadataSP from_context_md = m_master.MaybeGetContextMetadata(m_source_ctx);
context_md->m_origins[to] = DeclOrigin (m_source_ctx, from);
if (from_context_md)
{
OriginMap &origins = from_context_md->m_origins;
OriginMap::iterator origin_iter = origins.find(from);
if (origin_iter != origins.end())
to_context_md->m_origins[to] = origin_iter->second;
if (clang::NamespaceDecl *to_namespace = dyn_cast<clang::NamespaceDecl>(to))
{
clang::NamespaceDecl *from_namespace = dyn_cast<clang::NamespaceDecl>(from);
NamespaceMetaMap &namespace_maps = from_context_md->m_namespace_maps;
NamespaceMetaMap::iterator namespace_map_iter = namespace_maps.find(from_namespace);
if (namespace_map_iter != namespace_maps.end())
to_context_md->m_namespace_maps[to_namespace] = namespace_map_iter->second;
}
}
else
{
to_context_md->m_origins[to] = DeclOrigin (m_source_ctx, from);
}
if (TagDecl *from_tag_decl = dyn_cast<TagDecl>(from))
{
TagDecl *to_tag_decl = dyn_cast<TagDecl>(to);