[Lldb-commits] [lldb] r145342 - in /lldb/trunk: include/lldb/Symbol/ClangASTImporter.h source/Expression/ClangASTSource.cpp source/Symbol/ClangASTImporter.cpp
Sean Callanan
scallanan at apple.com
Mon Nov 28 16:42:02 PST 2011
Author: spyffe
Date: Mon Nov 28 18:42:02 2011
New Revision: 145342
URL: http://llvm.org/viewvc/llvm-project?rev=145342&view=rev
Log:
Changed ClangASTImporter to allow finer-grained
management of what allocations remain after an
expression finishes executing. This saves around
2.5KiB per expression for simple expressions.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Symbol/ClangASTImporter.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=145342&r1=145341&r2=145342&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Mon Nov 28 18:42:02 2011
@@ -106,7 +106,8 @@
void BuildNamespaceMap (const clang::NamespaceDecl *decl);
- void PurgeMaps (clang::ASTContext *dest_ast_ctx);
+ void ForgetDestination (clang::ASTContext *dst_ctx);
+ void ForgetSource (clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
private:
struct DeclOrigin
{
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=145342&r1=145341&r2=145342&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Mon Nov 28 18:42:02 2011
@@ -24,7 +24,20 @@
ClangASTSource::~ClangASTSource()
{
- m_ast_importer->PurgeMaps(m_ast_context);
+ m_ast_importer->ForgetDestination(m_ast_context);
+
+ ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext();
+
+ if (!scratch_clang_ast_context)
+ return;
+
+ clang::ASTContext *scratch_ast_context = scratch_clang_ast_context->getASTContext();
+
+ if (!scratch_ast_context)
+ return;
+
+ if (m_ast_context != scratch_ast_context)
+ m_ast_importer->ForgetSource(scratch_ast_context, m_ast_context);
}
void
Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=145342&r1=145341&r2=145342&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Mon Nov 28 18:42:02 2011
@@ -179,11 +179,32 @@
}
void
-ClangASTImporter::PurgeMaps (clang::ASTContext *dst_ast)
+ClangASTImporter::ForgetDestination (clang::ASTContext *dst_ast)
{
m_metadata_map.erase(dst_ast);
}
+void
+ClangASTImporter::ForgetSource (clang::ASTContext *dst_ast, clang::ASTContext *src_ast)
+{
+ ASTContextMetadataSP md = MaybeGetContextMetadata (dst_ast);
+
+ if (!md)
+ return;
+
+ md->m_minions.erase(src_ast);
+
+ for (OriginMap::iterator iter = md->m_origins.begin();
+ iter != md->m_origins.end();
+ )
+ {
+ if (iter->second.ctx == src_ast)
+ md->m_origins.erase(iter++);
+ else
+ ++iter;
+ }
+}
+
ClangASTImporter::NamespaceMapCompleter::~NamespaceMapCompleter ()
{
return;
More information about the lldb-commits
mailing list