summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangASTSource.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-11-16 18:20:47 +0000
committerSean Callanan <scallanan@apple.com>2011-11-16 18:20:47 +0000
commit686b2319e540050d5fec5c91f2cb7b972630ba26 (patch)
tree6b2690df47d07eeb7a946d22663efcb5213e71d0 /lldb/source/Expression/ClangASTSource.cpp
parent8855ff61cb4e554a7ca74ed47a97299c7b2a8b9e (diff)
downloadbcm5719-llvm-686b2319e540050d5fec5c91f2cb7b972630ba26.tar.gz
bcm5719-llvm-686b2319e540050d5fec5c91f2cb7b972630ba26.zip
I made the ClangASTImporter owned by the target
rather than individually on behalf of each ASTContext. This allows the ASTImporter to know about all containers of types, which will let it be smarter about forwarding information about type origins. That means that the following sequence of steps will be possible (after a few more changes): - Import a type from a Module's ASTContext into an expression parser ASTContext, tracking its origin information -- this works now. - Because the result of the expression uses that type, import it from the expression parser ASTContext into the Target's scratch AST context, forwarding the origin information -- this needs to be added. - For a later expression that uses the result, import the type from the Target's scratch AST context, still forwarding origin information -- this also needs to be added. - Use the intact origin information to complete the type as needed -- this works now if the origin information is present. To this end, I made the following changes: - ASTImporter top-level copy functions now require both a source and a destination AST context parameter. - The ASTImporter now knows how to purge records related to an ASTContext that is going away. - The Target now owns and creates the ASTImporter whenever the main executable changes or (in the absence of a main executable) on demand. llvm-svn: 144802
Diffstat (limited to 'lldb/source/Expression/ClangASTSource.cpp')
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index bfdab164ff9..678504646a6 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -24,6 +24,7 @@ using namespace lldb_private;
ClangASTSource::~ClangASTSource()
{
+ m_ast_importer->PurgeMaps(m_ast_context);
}
void
@@ -249,7 +250,7 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
log->Printf(" FELD[%d] Adding lexical decl %s", current_id, ast_dumper.GetCString());
}
- Decl *copied_decl = m_ast_importer->CopyDecl(original_ctx, decl);
+ Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, original_ctx, decl);
decls.push_back(copied_decl);
}
@@ -551,7 +552,7 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
if (found_interface_decl->getName() == interface_decl->getName())
{
- Decl *copied_decl = m_ast_importer->CopyDecl(&method_decl->getASTContext(), method_decl);
+ Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &method_decl->getASTContext(), method_decl);
if (!copied_decl)
continue;
@@ -610,7 +611,7 @@ ClangASTSource::FindObjCPropertyDecls (NameSearchContext &context)
if (!property_decl)
return;
- Decl *copied_decl = m_ast_importer->CopyDecl(orig_ast_ctx, property_decl);
+ Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, orig_ast_ctx, property_decl);
if (!copied_decl)
return;
@@ -734,7 +735,7 @@ ClangASTSource::AddNamespace (NameSearchContext &context, ClangASTImporter::Name
const ClangNamespaceDecl &namespace_decl = namespace_decls->begin()->second;
- Decl *copied_decl = m_ast_importer->CopyDecl(namespace_decl.GetASTContext(), namespace_decl.GetNamespaceDecl());
+ Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, namespace_decl.GetASTContext(), namespace_decl.GetNamespaceDecl());
NamespaceDecl *copied_namespace_decl = dyn_cast<NamespaceDecl>(copied_decl);
@@ -750,7 +751,7 @@ ClangASTSource::GuardedCopyType (ASTContext *dest_context,
{
SetImportInProgress(true);
- QualType ret_qual_type = m_ast_importer->CopyType (source_context, QualType::getFromOpaquePtr(clang_type));
+ QualType ret_qual_type = m_ast_importer->CopyType (m_ast_context, source_context, QualType::getFromOpaquePtr(clang_type));
void *ret = ret_qual_type.getAsOpaquePtr();
OpenPOWER on IntegriCloud