clang::DeclarationName
GetDeclarationName(const char *name, const CompilerType &function_clang_type);
-protected:
+private:
const clang::ClassTemplateSpecializationDecl *
GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type);
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;
/// 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 &);
~ClangASTContextForExpressions() override = default;
+ void Finalize() override;
+
UserExpression *
GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix,
lldb::LanguageType language,
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
} 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();
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) {
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,