diff options
| -rw-r--r-- | lldb/include/lldb/Symbol/ClangASTContext.h | 7 | ||||
| -rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 21 |
2 files changed, 17 insertions, 11 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h index 59abe19eba1..c56a4975f53 100644 --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -943,7 +943,7 @@ public: clang::DeclarationName GetDeclarationName(const char *name, const CompilerType &function_clang_type); -protected: +private: const clang::ClassTemplateSpecializationDecl * GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type); @@ -962,7 +962,6 @@ protected: std::unique_ptr<clang::Builtin::Context> m_builtins_up; std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up; std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up; - std::unique_ptr<ClangASTSource> m_scratch_ast_source_up; std::unique_ptr<clang::MangleContext> m_mangle_ctx_up; uint32_t m_pointer_byte_size = 0; bool m_ast_owned = false; @@ -980,7 +979,6 @@ protected: /// ASTContext wasn't created by parsing source code. clang::Sema *m_sema = nullptr; -private: // For ClangASTContext only ClangASTContext(const ClangASTContext &); const ClangASTContext &operator=(const ClangASTContext &); @@ -995,6 +993,8 @@ public: ~ClangASTContextForExpressions() override = default; + void Finalize() override; + UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, @@ -1016,6 +1016,7 @@ private: std::unique_ptr<PersistentExpressionState> m_persistent_variables; // These are the persistent variables associated // with this process for the expression parser + std::unique_ptr<ClangASTSource> m_scratch_ast_source_up; }; } // namespace lldb_private diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index f98e0884819..937951c0608 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -569,12 +569,6 @@ lldb::TypeSystemSP ClangASTContext::CreateInstance(lldb::LanguageType language, } else if (target && target->IsValid()) { std::shared_ptr<ClangASTContextForExpressions> ast_sp( new ClangASTContextForExpressions(*target, fixed_arch)); - ast_sp->m_scratch_ast_source_up.reset(new ClangASTSource( - target->shared_from_this(), target->GetClangASTImporter())); - ast_sp->m_scratch_ast_source_up->InstallASTContext(*ast_sp); - llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> proxy_ast_source( - ast_sp->m_scratch_ast_source_up->CreateProxy()); - ast_sp->SetExternalSource(proxy_ast_source); return ast_sp; } return lldb::TypeSystemSP(); @@ -630,7 +624,6 @@ void ClangASTContext::Finalize() { m_diagnostics_engine_up.reset(); m_source_manager_up.reset(); m_language_options_up.reset(); - m_scratch_ast_source_up.reset(); } void ClangASTContext::setSema(Sema *s) { @@ -9381,7 +9374,19 @@ ClangASTContext::DeclContextGetClangASTContext(const CompilerDeclContext &dc) { ClangASTContextForExpressions::ClangASTContextForExpressions(Target &target, ArchSpec arch) : ClangASTContext(arch), m_target_wp(target.shared_from_this()), - m_persistent_variables(new ClangPersistentVariables) {} + m_persistent_variables(new ClangPersistentVariables) { + m_scratch_ast_source_up.reset(new ClangASTSource( + target.shared_from_this(), target.GetClangASTImporter())); + m_scratch_ast_source_up->InstallASTContext(*this); + llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> proxy_ast_source( + m_scratch_ast_source_up->CreateProxy()); + SetExternalSource(proxy_ast_source); +} + +void ClangASTContextForExpressions::Finalize() { + ClangASTContext::Finalize(); + m_scratch_ast_source_up.reset(); +} UserExpression *ClangASTContextForExpressions::GetUserExpression( llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, |

