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.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145342 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangASTSource.cpp b/source/Expression/ClangASTSource.cpp
index 4c6ba7e..5f3c8b1 100644
--- a/source/Expression/ClangASTSource.cpp
+++ b/source/Expression/ClangASTSource.cpp
@@ -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