Index: include/lldb/Expression/ExpressionVariable.h =================================================================== --- include/lldb/Expression/ExpressionVariable.h +++ include/lldb/Expression/ExpressionVariable.h @@ -232,6 +232,9 @@ virtual void RemovePersistentVariable(lldb::ExpressionVariableSP variable) = 0; + virtual llvm::Optional + GetCompilerTypeFromPersistentDecl(ConstString type_name) = 0; + virtual lldb::addr_t LookupSymbol(ConstString name); void RegisterExecutionUnit(lldb::IRExecutionUnitSP &execution_unit_sp); Index: source/Commands/CMakeLists.txt =================================================================== --- source/Commands/CMakeLists.txt +++ source/Commands/CMakeLists.txt @@ -41,7 +41,6 @@ lldbSymbol lldbTarget lldbUtility - lldbPluginExpressionParserClang LINK_COMPONENTS Support Index: source/Commands/CommandObjectMemory.cpp =================================================================== --- source/Commands/CommandObjectMemory.cpp +++ source/Commands/CommandObjectMemory.cpp @@ -6,16 +6,14 @@ // //===----------------------------------------------------------------------===// -#include "clang/AST/Decl.h" - #include "CommandObjectMemory.h" -#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/DumpDataExtractor.h" #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" #include "lldb/Core/ValueObjectMemory.h" #include "lldb/DataFormatters/ValueObjectPrinter.h" +#include "lldb/Expression/ExpressionVariable.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" @@ -25,13 +23,14 @@ #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" #include "lldb/Interpreter/OptionValueString.h" #include "lldb/Interpreter/Options.h" -#include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TypeList.h" +#include "lldb/Target/Language.h" #include "lldb/Target/MemoryHistory.h" #include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" +#include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/DataBufferHeap.h" @@ -472,21 +471,16 @@ exact_match, 1, searched_symbol_files, type_list); - if (type_list.GetSize() == 0 && lookup_type_name.GetCString() && - *lookup_type_name.GetCString() == '$') { - if (ClangPersistentVariables *persistent_vars = - llvm::dyn_cast_or_null( - target->GetPersistentExpressionStateForLanguage( - lldb::eLanguageTypeC))) { - clang::TypeDecl *tdecl = llvm::dyn_cast_or_null( - persistent_vars->GetPersistentDecl( - ConstString(lookup_type_name))); - - if (tdecl) { - clang_ast_type.SetCompilerType( - ClangASTContext::GetASTContext(&tdecl->getASTContext()), - reinterpret_cast( - const_cast(tdecl->getTypeForDecl()))); + if (type_list.GetSize() == 0 && lookup_type_name.GetCString()) { + for (auto lang : Language::GetSupportedLanguages()) { + if (PersistentExpressionState *persistent_vars = + target->GetPersistentExpressionStateForLanguage(lang)) { + if (llvm::Optional type = + persistent_vars->GetCompilerTypeFromPersistentDecl( + lookup_type_name)) { + clang_ast_type = *type; + break; + } } } } Index: source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h +++ source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h @@ -50,6 +50,9 @@ return "$"; } + llvm::Optional + GetCompilerTypeFromPersistentDecl(ConstString type_name) override; + void RegisterPersistentDecl(ConstString name, clang::NamedDecl *decl); clang::NamedDecl *GetPersistentDecl(ConstString name); Index: source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp +++ source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp @@ -9,6 +9,7 @@ #include "ClangPersistentVariables.h" #include "lldb/Core/Value.h" +#include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Log.h" @@ -52,6 +53,21 @@ m_next_persistent_variable_id--; } +llvm::Optional +ClangPersistentVariables::GetCompilerTypeFromPersistentDecl( + ConstString type_name) { + CompilerType compiler_type; + if (clang::TypeDecl *tdecl = llvm::dyn_cast_or_null( + GetPersistentDecl(type_name))) { + compiler_type.SetCompilerType( + ClangASTContext::GetASTContext(&tdecl->getASTContext()), + reinterpret_cast( + const_cast(tdecl->getTypeForDecl()))); + return compiler_type; + } + return llvm::None; +} + void ClangPersistentVariables::RegisterPersistentDecl(ConstString name, clang::NamedDecl *decl) { m_persistent_decls.insert(