Author: labath Date: Tue Aug 6 02:12:42 2019 New Revision: 368001 URL: http://llvm.org/viewvc/llvm-project?rev=368001&view=rev Log: SymbolVendor: Remove passthrough methods
After the recent refactorings the SymbolVendor passthrough no longer serve any purpose. This patch removes those methods, and updates all callsites to go to the symbol file directly -- in most cases that just means calling GetSymbolFile()->foo() instead of GetSymbolVendor()->foo(). Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h lldb/trunk/source/API/SBCompileUnit.cpp lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/SearchFilter.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Symbol/Block.cpp lldb/trunk/source/Symbol/CompileUnit.cpp lldb/trunk/source/Symbol/Function.cpp lldb/trunk/source/Symbol/SymbolVendor.cpp lldb/trunk/tools/lldb-test/lldb-test.cpp lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Tue Aug 6 02:12:42 2019 @@ -39,89 +39,8 @@ public: void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp); - virtual void Dump(Stream *s); - - virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit); - - virtual size_t ParseFunctions(CompileUnit &comp_unit); - - virtual bool ParseLineTable(CompileUnit &comp_unit); - - virtual bool ParseDebugMacros(CompileUnit &comp_unit); - - virtual bool ParseSupportFiles(CompileUnit &comp_unit, - FileSpecList &support_files); - - virtual bool ParseIsOptimized(CompileUnit &comp_unit); - - virtual size_t ParseTypes(CompileUnit &comp_unit); - - virtual bool - ParseImportedModules(const SymbolContext &sc, - std::vector<SourceModule> &imported_modules); - - virtual size_t ParseBlocksRecursive(Function &func); - - virtual size_t ParseVariablesForContext(const SymbolContext &sc); - - virtual Type *ResolveTypeUID(lldb::user_id_t type_uid); - - virtual uint32_t ResolveSymbolContext(const Address &so_addr, - lldb::SymbolContextItem resolve_scope, - SymbolContext &sc); - - virtual uint32_t ResolveSymbolContext(const FileSpec &file_spec, - uint32_t line, bool check_inlines, - lldb::SymbolContextItem resolve_scope, - SymbolContextList &sc_list); - - virtual size_t FindGlobalVariables(ConstString name, - const CompilerDeclContext *parent_decl_ctx, - size_t max_matches, - VariableList &variables); - - virtual size_t FindGlobalVariables(const RegularExpression ®ex, - size_t max_matches, - VariableList &variables); - - virtual size_t FindFunctions(ConstString name, - const CompilerDeclContext *parent_decl_ctx, - lldb::FunctionNameType name_type_mask, - bool include_inlines, bool append, - SymbolContextList &sc_list); - - virtual size_t FindFunctions(const RegularExpression ®ex, - bool include_inlines, bool append, - SymbolContextList &sc_list); - - virtual size_t - FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx, - bool append, size_t max_matches, - llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, - TypeMap &types); - - virtual size_t FindTypes(const std::vector<CompilerContext> &context, - bool append, TypeMap &types); - - virtual CompilerDeclContext - FindNamespace(ConstString name, - const CompilerDeclContext *parent_decl_ctx); - - virtual size_t GetNumCompileUnits(); - - virtual lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx); - - virtual size_t GetTypes(SymbolContextScope *sc_scope, - lldb::TypeClass type_mask, TypeList &type_list); - SymbolFile *GetSymbolFile() { return m_sym_file_up.get(); } - FileSpec GetMainFileSpec() const; - - /// Notify the SymbolVendor that the file addresses in the Sections - /// for this module have been changed. - virtual void SectionFileAddressesChanged(); - // PluginInterface protocol ConstString GetPluginName() override; Modified: lldb/trunk/source/API/SBCompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/API/SBCompileUnit.cpp (original) +++ lldb/trunk/source/API/SBCompileUnit.cpp Tue Aug 6 02:12:42 2019 @@ -14,7 +14,7 @@ #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineEntry.h" #include "lldb/Symbol/LineTable.h" -#include "lldb/Symbol/SymbolVendor.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" @@ -138,13 +138,13 @@ lldb::SBTypeList SBCompileUnit::GetTypes if (!module_sp) return LLDB_RECORD_RESULT(sb_type_list); - SymbolVendor *vendor = module_sp->GetSymbolVendor(); - if (!vendor) + SymbolFile *symfile = module_sp->GetSymbolFile(); + if (!symfile) return LLDB_RECORD_RESULT(sb_type_list); TypeClass type_class = static_cast<TypeClass>(type_mask); TypeList type_list; - vendor->GetTypes(m_opaque_ptr, type_class, type_list); + symfile->GetTypes(m_opaque_ptr, type_class, type_list); sb_type_list.m_opaque_up->Append(type_list); return LLDB_RECORD_RESULT(sb_type_list); } Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Tue Aug 6 02:12:42 2019 @@ -20,7 +20,6 @@ #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolFile.h" -#include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/Symtab.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Symbol/VariableList.h" @@ -366,7 +365,7 @@ size_t SBModule::GetNumSections() { ModuleSP module_sp(GetSP()); if (module_sp) { // Give the symbol vendor a chance to add to the unified section list. - module_sp->GetSymbolVendor(); + module_sp->GetSymbolFile(); SectionList *section_list = module_sp->GetSectionList(); if (section_list) return section_list->GetSize(); @@ -382,7 +381,7 @@ SBSection SBModule::GetSectionAtIndex(si ModuleSP module_sp(GetSP()); if (module_sp) { // Give the symbol vendor a chance to add to the unified section list. - module_sp->GetSymbolVendor(); + module_sp->GetSymbolFile(); SectionList *section_list = module_sp->GetSectionList(); if (section_list) @@ -536,9 +535,8 @@ lldb::SBType SBModule::GetTypeByID(lldb: ModuleSP module_sp(GetSP()); if (module_sp) { - SymbolVendor *vendor = module_sp->GetSymbolVendor(); - if (vendor) { - Type *type_ptr = vendor->ResolveTypeUID(uid); + if (SymbolFile *symfile = module_sp->GetSymbolFile()) { + Type *type_ptr = symfile->ResolveTypeUID(uid); if (type_ptr) return LLDB_RECORD_RESULT(SBType(type_ptr->shared_from_this())); } @@ -555,13 +553,13 @@ lldb::SBTypeList SBModule::GetTypes(uint ModuleSP module_sp(GetSP()); if (!module_sp) return LLDB_RECORD_RESULT(sb_type_list); - SymbolVendor *vendor = module_sp->GetSymbolVendor(); - if (!vendor) + SymbolFile *symfile = module_sp->GetSymbolFile(); + if (!symfile) return LLDB_RECORD_RESULT(sb_type_list); TypeClass type_class = static_cast<TypeClass>(type_mask); TypeList type_list; - vendor->GetTypes(nullptr, type_class, type_list); + symfile->GetTypes(nullptr, type_class, type_list); sb_type_list.m_opaque_up->Append(type_list); return LLDB_RECORD_RESULT(sb_type_list); } @@ -575,7 +573,7 @@ SBSection SBModule::FindSection(const ch ModuleSP module_sp(GetSP()); if (sect_name && module_sp) { // Give the symbol vendor a chance to add to the unified section list. - module_sp->GetSymbolVendor(); + module_sp->GetSymbolFile(); SectionList *section_list = module_sp->GetSectionList(); if (section_list) { ConstString const_sect_name(sect_name); @@ -657,9 +655,8 @@ lldb::SBFileSpec SBModule::GetSymbolFile lldb::SBFileSpec sb_file_spec; ModuleSP module_sp(GetSP()); if (module_sp) { - SymbolVendor *symbol_vendor_ptr = module_sp->GetSymbolVendor(); - if (symbol_vendor_ptr) - sb_file_spec.SetFileSpec(symbol_vendor_ptr->GetMainFileSpec()); + if (SymbolFile *symfile = module_sp->GetSymbolFile()) + sb_file_spec.SetFileSpec(symfile->GetObjectFile()->GetFileSpec()); } return LLDB_RECORD_RESULT(sb_file_spec); } Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Aug 6 02:12:42 2019 @@ -37,7 +37,6 @@ #include "lldb/Symbol/LocateSymbolFile.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolFile.h" -#include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/UnwindPlan.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ABI.h" @@ -1471,11 +1470,10 @@ static void DumpModuleSections(CommandIn } } -static bool DumpModuleSymbolVendor(Stream &strm, Module *module) { +static bool DumpModuleSymbolFile(Stream &strm, Module *module) { if (module) { - SymbolVendor *symbol_vendor = module->GetSymbolVendor(true); - if (symbol_vendor) { - symbol_vendor->Dump(&strm); + if (SymbolFile *symbol_file = module->GetSymbolFile(true)) { + symbol_file->Dump(strm); return true; } } @@ -2330,7 +2328,7 @@ protected: for (uint32_t image_idx = 0; image_idx < num_modules; ++image_idx) { if (m_interpreter.WasInterrupted()) break; - if (DumpModuleSymbolVendor( + if (DumpModuleSymbolFile( result.GetOutputStream(), target_modules.GetModulePointerAtIndexUnlocked(image_idx))) num_dumped++; @@ -2355,7 +2353,7 @@ protected: break; Module *module = module_list.GetModulePointerAtIndex(i); if (module) { - if (DumpModuleSymbolVendor(result.GetOutputStream(), module)) + if (DumpModuleSymbolFile(result.GetOutputStream(), module)) num_dumped++; } } Modified: lldb/trunk/source/Core/SearchFilter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Core/SearchFilter.cpp (original) +++ lldb/trunk/source/Core/SearchFilter.cpp Tue Aug 6 02:12:42 2019 @@ -13,7 +13,7 @@ #include "lldb/Core/ModuleList.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/SymbolContext.h" -#include "lldb/Symbol/SymbolVendor.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Status.h" @@ -316,10 +316,10 @@ SearchFilter::DoCUIteration(const Module // First make sure this compile unit's functions are parsed // since CompUnit::ForeachFunction only iterates over already // parsed functions. - SymbolVendor *sym_vendor = module_sp->GetSymbolVendor(); - if (!sym_vendor) + SymbolFile *sym_file = module_sp->GetSymbolFile(); + if (!sym_file) continue; - if (!sym_vendor->ParseFunctions(*cu_sp)) + if (!sym_file->ParseFunctions(*cu_sp)) continue; // If we got any functions, use ForeachFunction to do the iteration. cu_sp->ForeachFunction([&](const FunctionSP &func_sp) { Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Tue Aug 6 02:12:42 2019 @@ -18,7 +18,6 @@ #include "lldb/Symbol/CompilerDeclContext.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SymbolFile.h" -#include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/Target.h" #include "lldb/Utility/Log.h" @@ -815,11 +814,8 @@ void ClangASTSource::FindExternalVisible if (module_sp && namespace_decl) { CompilerDeclContext found_namespace_decl; - SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(); - - if (symbol_vendor) { - found_namespace_decl = - symbol_vendor->FindNamespace(name, &namespace_decl); + if (SymbolFile *symbol_file = module_sp->GetSymbolFile()) { + found_namespace_decl = symbol_file->FindNamespace(name, &namespace_decl); if (found_namespace_decl) { context.m_namespace_map->push_back( @@ -843,13 +839,12 @@ void ClangASTSource::FindExternalVisible CompilerDeclContext found_namespace_decl; - SymbolVendor *symbol_vendor = image->GetSymbolVendor(); + SymbolFile *symbol_file = image->GetSymbolFile(); - if (!symbol_vendor) + if (!symbol_file) continue; - found_namespace_decl = - symbol_vendor->FindNamespace(name, &namespace_decl); + found_namespace_decl = symbol_file->FindNamespace(name, &namespace_decl); if (found_namespace_decl) { context.m_namespace_map->push_back( @@ -1885,13 +1880,13 @@ void ClangASTSource::CompleteNamespaceMa lldb::ModuleSP module_sp = i->first; CompilerDeclContext module_parent_namespace_decl = i->second; - SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(); + SymbolFile *symbol_file = module_sp->GetSymbolFile(); - if (!symbol_vendor) + if (!symbol_file) continue; found_namespace_decl = - symbol_vendor->FindNamespace(name, &module_parent_namespace_decl); + symbol_file->FindNamespace(name, &module_parent_namespace_decl); if (!found_namespace_decl) continue; @@ -1917,13 +1912,13 @@ void ClangASTSource::CompleteNamespaceMa CompilerDeclContext found_namespace_decl; - SymbolVendor *symbol_vendor = image->GetSymbolVendor(); + SymbolFile *symbol_file = image->GetSymbolFile(); - if (!symbol_vendor) + if (!symbol_file) continue; found_namespace_decl = - symbol_vendor->FindNamespace(name, &null_namespace_decl); + symbol_file->FindNamespace(name, &null_namespace_decl); if (!found_namespace_decl) continue; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Tue Aug 6 02:12:42 2019 @@ -28,7 +28,7 @@ #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" -#include "lldb/Symbol/SymbolVendor.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeMap.h" #include "lldb/Target/Language.h" @@ -148,8 +148,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro die.GetDeclContext(decl_context); TypeMap dwo_types; - if (!dwo_module_sp->GetSymbolVendor()->FindTypes(decl_context, true, - dwo_types)) { + if (!dwo_module_sp->GetSymbolFile()->FindTypes(decl_context, true, + dwo_types)) { if (!IsClangModuleFwdDecl(die)) return TypeSP(); @@ -159,8 +159,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro for (const auto &name_module : sym_file.getExternalTypeModules()) { if (!name_module.second) continue; - SymbolVendor *sym_vendor = name_module.second->GetSymbolVendor(); - if (sym_vendor->FindTypes(decl_context, true, dwo_types)) + if (name_module.second->GetSymbolFile()->FindTypes(decl_context, true, + dwo_types)) break; } } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Aug 6 02:12:42 2019 @@ -43,7 +43,7 @@ #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/LocateSymbolFile.h" #include "lldb/Symbol/ObjectFile.h" -#include "lldb/Symbol/SymbolVendor.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TypeMap.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Symbol/VariableList.h" @@ -2438,11 +2438,11 @@ uint32_t SymbolFileDWARF::FindTypes( for (const auto &pair : m_external_type_modules) { ModuleSP external_module_sp = pair.second; if (external_module_sp) { - SymbolVendor *sym_vendor = external_module_sp->GetSymbolVendor(); - if (sym_vendor) { + SymbolFile *sym_file = external_module_sp->GetSymbolFile(); + if (sym_file) { const uint32_t num_external_matches = - sym_vendor->FindTypes(name, parent_decl_ctx, append, max_matches, - searched_symbol_files, types); + sym_file->FindTypes(name, parent_decl_ctx, append, max_matches, + searched_symbol_files, types); if (num_external_matches) return num_external_matches; } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Tue Aug 6 02:12:42 2019 @@ -776,7 +776,7 @@ SymbolFileDWARFDebugMap::ResolveSymbolCo Address oso_so_addr; if (oso_module->ResolveFileAddress(oso_file_addr, oso_so_addr)) { resolved_flags |= - oso_module->GetSymbolVendor()->ResolveSymbolContext( + oso_module->GetSymbolFile()->ResolveSymbolContext( oso_so_addr, resolve_scope, sc); } } @@ -1405,8 +1405,8 @@ bool SymbolFileDWARFDebugMap::LinkOSOAdd if (addr_module == exe_module) return true; // Address is already in terms of the main executable module - CompileUnitInfo *cu_info = GetCompileUnitInfo(GetSymbolFileAsSymbolFileDWARF( - addr_module->GetSymbolVendor()->GetSymbolFile())); + CompileUnitInfo *cu_info = GetCompileUnitInfo( + GetSymbolFileAsSymbolFileDWARF(addr_module->GetSymbolFile())); if (cu_info) { const lldb::addr_t oso_file_addr = addr.GetFileAddress(); const FileRangeMap::Entry *oso_range_entry = Modified: lldb/trunk/source/Symbol/Block.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Block.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Symbol/Block.cpp (original) +++ lldb/trunk/source/Symbol/Block.cpp Tue Aug 6 02:12:42 2019 @@ -12,7 +12,6 @@ #include "lldb/Core/Section.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SymbolFile.h" -#include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Utility/Log.h" @@ -393,7 +392,7 @@ VariableListSP Block::GetBlockVariableLi SymbolContext sc; CalculateSymbolContext(&sc); assert(sc.module_sp); - sc.module_sp->GetSymbolVendor()->ParseVariablesForContext(sc); + sc.module_sp->GetSymbolFile()->ParseVariablesForContext(sc); } } return m_variable_list_sp; Modified: lldb/trunk/source/Symbol/CompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompileUnit.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Symbol/CompileUnit.cpp (original) +++ lldb/trunk/source/Symbol/CompileUnit.cpp Tue Aug 6 02:12:42 2019 @@ -9,7 +9,7 @@ #include "lldb/Symbol/CompileUnit.h" #include "lldb/Core/Module.h" #include "lldb/Symbol/LineTable.h" -#include "lldb/Symbol/SymbolVendor.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/Language.h" @@ -173,10 +173,8 @@ lldb::LanguageType CompileUnit::GetLangu if (m_language == eLanguageTypeUnknown) { if (m_flags.IsClear(flagsParsedLanguage)) { m_flags.Set(flagsParsedLanguage); - SymbolVendor *symbol_vendor = GetModule()->GetSymbolVendor(); - if (symbol_vendor) { - m_language = symbol_vendor->ParseLanguage(*this); - } + if (SymbolFile *symfile = GetModule()->GetSymbolFile()) + m_language = symfile->ParseLanguage(*this); } } return m_language; @@ -186,9 +184,8 @@ LineTable *CompileUnit::GetLineTable() { if (m_line_table_up == nullptr) { if (m_flags.IsClear(flagsParsedLineTable)) { m_flags.Set(flagsParsedLineTable); - SymbolVendor *symbol_vendor = GetModule()->GetSymbolVendor(); - if (symbol_vendor) - symbol_vendor->ParseLineTable(*this); + if (SymbolFile *symfile = GetModule()->GetSymbolFile()) + symfile->ParseLineTable(*this); } } return m_line_table_up.get(); @@ -206,10 +203,8 @@ DebugMacros *CompileUnit::GetDebugMacros if (m_debug_macros_sp.get() == nullptr) { if (m_flags.IsClear(flagsParsedDebugMacros)) { m_flags.Set(flagsParsedDebugMacros); - SymbolVendor *symbol_vendor = GetModule()->GetSymbolVendor(); - if (symbol_vendor) { - symbol_vendor->ParseDebugMacros(*this); - } + if (SymbolFile *symfile = GetModule()->GetSymbolFile()) + symfile->ParseDebugMacros(*this); } } @@ -229,7 +224,7 @@ VariableListSP CompileUnit::GetVariableL SymbolContext sc; CalculateSymbolContext(&sc); assert(sc.module_sp); - sc.module_sp->GetSymbolVendor()->ParseVariablesForContext(sc); + sc.module_sp->GetSymbolFile()->ParseVariablesForContext(sc); } return m_variables; @@ -372,8 +367,8 @@ uint32_t CompileUnit::ResolveSymbolConte bool CompileUnit::GetIsOptimized() { if (m_is_optimized == eLazyBoolCalculate) { m_is_optimized = eLazyBoolNo; - if (SymbolVendor *symbol_vendor = GetModule()->GetSymbolVendor()) { - if (symbol_vendor->ParseIsOptimized(*this)) + if (SymbolFile *symfile = GetModule()->GetSymbolFile()) { + if (symfile->ParseIsOptimized(*this)) m_is_optimized = eLazyBoolYes; } } @@ -388,10 +383,10 @@ const std::vector<SourceModule> &Compile if (m_imported_modules.empty() && m_flags.IsClear(flagsParsedImportedModules)) { m_flags.Set(flagsParsedImportedModules); - if (SymbolVendor *symbol_vendor = GetModule()->GetSymbolVendor()) { + if (SymbolFile *symfile = GetModule()->GetSymbolFile()) { SymbolContext sc; CalculateSymbolContext(&sc); - symbol_vendor->ParseImportedModules(sc, m_imported_modules); + symfile->ParseImportedModules(sc, m_imported_modules); } } return m_imported_modules; @@ -401,10 +396,8 @@ const FileSpecList &CompileUnit::GetSupp if (m_support_files.GetSize() == 0) { if (m_flags.IsClear(flagsParsedSupportFiles)) { m_flags.Set(flagsParsedSupportFiles); - SymbolVendor *symbol_vendor = GetModule()->GetSymbolVendor(); - if (symbol_vendor) { - symbol_vendor->ParseSupportFiles(*this, m_support_files); - } + if (SymbolFile *symfile = GetModule()->GetSymbolFile()) + symfile->ParseSupportFiles(*this, m_support_files); } } return m_support_files; Modified: lldb/trunk/source/Symbol/Function.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Symbol/Function.cpp (original) +++ lldb/trunk/source/Symbol/Function.cpp Tue Aug 6 02:12:42 2019 @@ -16,7 +16,6 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/SymbolFile.h" -#include "lldb/Symbol/SymbolVendor.h" #include "lldb/Target/Language.h" #include "lldb/Utility/Log.h" #include "llvm/Support/Casting.h" @@ -281,7 +280,7 @@ Block &Function::GetBlock(bool can_creat if (!m_block.BlockInfoHasBeenParsed() && can_create) { ModuleSP module_sp = CalculateSymbolContextModule(); if (module_sp) { - module_sp->GetSymbolVendor()->ParseBlocksRecursive(*this); + module_sp->GetSymbolFile()->ParseBlocksRecursive(*this); } else { Host::SystemLog(Host::eSystemLogError, "error: unable to find module " Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolVendor.cpp (original) +++ lldb/trunk/source/Symbol/SymbolVendor.cpp Tue Aug 6 02:12:42 2019 @@ -73,220 +73,6 @@ void SymbolVendor::AddSymbolFileRepresen } } -size_t SymbolVendor::GetNumCompileUnits() { - if (m_sym_file_up) - return m_sym_file_up->GetNumCompileUnits(); - return 0; -} - -lldb::LanguageType SymbolVendor::ParseLanguage(CompileUnit &comp_unit) { - if (m_sym_file_up) - return m_sym_file_up->ParseLanguage(comp_unit); - return eLanguageTypeUnknown; -} - -size_t SymbolVendor::ParseFunctions(CompileUnit &comp_unit) { - if (m_sym_file_up) - return m_sym_file_up->ParseFunctions(comp_unit); - return 0; -} - -bool SymbolVendor::ParseLineTable(CompileUnit &comp_unit) { - if (m_sym_file_up) - return m_sym_file_up->ParseLineTable(comp_unit); - return false; -} - -bool SymbolVendor::ParseDebugMacros(CompileUnit &comp_unit) { - if (m_sym_file_up) - return m_sym_file_up->ParseDebugMacros(comp_unit); - return false; -} -bool SymbolVendor::ParseSupportFiles(CompileUnit &comp_unit, - FileSpecList &support_files) { - if (m_sym_file_up) - return m_sym_file_up->ParseSupportFiles(comp_unit, support_files); - return false; -} - -bool SymbolVendor::ParseIsOptimized(CompileUnit &comp_unit) { - if (m_sym_file_up) - return m_sym_file_up->ParseIsOptimized(comp_unit); - return false; -} - -bool SymbolVendor::ParseImportedModules( - const SymbolContext &sc, std::vector<SourceModule> &imported_modules) { - if (m_sym_file_up) - return m_sym_file_up->ParseImportedModules(sc, imported_modules); - return false; -} - -size_t SymbolVendor::ParseBlocksRecursive(Function &func) { - if (m_sym_file_up) - return m_sym_file_up->ParseBlocksRecursive(func); - return 0; -} - -size_t SymbolVendor::ParseTypes(CompileUnit &comp_unit) { - if (m_sym_file_up) - return m_sym_file_up->ParseTypes(comp_unit); - return 0; -} - -size_t SymbolVendor::ParseVariablesForContext(const SymbolContext &sc) { - if (m_sym_file_up) - return m_sym_file_up->ParseVariablesForContext(sc); - return 0; -} - -Type *SymbolVendor::ResolveTypeUID(lldb::user_id_t type_uid) { - if (m_sym_file_up) - return m_sym_file_up->ResolveTypeUID(type_uid); - return nullptr; -} - -uint32_t SymbolVendor::ResolveSymbolContext(const Address &so_addr, - SymbolContextItem resolve_scope, - SymbolContext &sc) { - if (m_sym_file_up) - return m_sym_file_up->ResolveSymbolContext(so_addr, resolve_scope, sc); - return 0; -} - -uint32_t SymbolVendor::ResolveSymbolContext(const FileSpec &file_spec, - uint32_t line, bool check_inlines, - SymbolContextItem resolve_scope, - SymbolContextList &sc_list) { - if (m_sym_file_up) - return m_sym_file_up->ResolveSymbolContext(file_spec, line, check_inlines, - resolve_scope, sc_list); - return 0; -} - -size_t -SymbolVendor::FindGlobalVariables(ConstString name, - const CompilerDeclContext *parent_decl_ctx, - size_t max_matches, VariableList &variables) { - if (m_sym_file_up) - return m_sym_file_up->FindGlobalVariables(name, parent_decl_ctx, - max_matches, variables); - return 0; -} - -size_t SymbolVendor::FindGlobalVariables(const RegularExpression ®ex, - size_t max_matches, - VariableList &variables) { - if (m_sym_file_up) - return m_sym_file_up->FindGlobalVariables(regex, max_matches, variables); - return 0; -} - -size_t SymbolVendor::FindFunctions(ConstString name, - const CompilerDeclContext *parent_decl_ctx, - FunctionNameType name_type_mask, - bool include_inlines, bool append, - SymbolContextList &sc_list) { - if (m_sym_file_up) - return m_sym_file_up->FindFunctions(name, parent_decl_ctx, name_type_mask, - include_inlines, append, sc_list); - return 0; -} - -size_t SymbolVendor::FindFunctions(const RegularExpression ®ex, - bool include_inlines, bool append, - SymbolContextList &sc_list) { - if (m_sym_file_up) - return m_sym_file_up->FindFunctions(regex, include_inlines, append, - sc_list); - return 0; -} - -size_t SymbolVendor::FindTypes( - ConstString name, const CompilerDeclContext *parent_decl_ctx, - bool append, size_t max_matches, - llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, - TypeMap &types) { - if (m_sym_file_up) - return m_sym_file_up->FindTypes(name, parent_decl_ctx, append, max_matches, - searched_symbol_files, types); - if (!append) - types.Clear(); - return 0; -} - -size_t SymbolVendor::FindTypes(const std::vector<CompilerContext> &context, - bool append, TypeMap &types) { - if (m_sym_file_up) - return m_sym_file_up->FindTypes(context, append, types); - if (!append) - types.Clear(); - return 0; -} - -size_t SymbolVendor::GetTypes(SymbolContextScope *sc_scope, TypeClass type_mask, - lldb_private::TypeList &type_list) { - if (m_sym_file_up) - return m_sym_file_up->GetTypes(sc_scope, type_mask, type_list); - return 0; -} - -CompilerDeclContext -SymbolVendor::FindNamespace(ConstString name, - const CompilerDeclContext *parent_decl_ctx) { - CompilerDeclContext namespace_decl_ctx; - if (m_sym_file_up) - namespace_decl_ctx = m_sym_file_up->FindNamespace(name, parent_decl_ctx); - return namespace_decl_ctx; -} - -void SymbolVendor::Dump(Stream *s) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - - s->Printf("%p: ", static_cast<void *>(this)); - s->Indent(); - s->PutCString("SymbolVendor"); - if (m_sym_file_up) { - *s << " " << m_sym_file_up->GetPluginName(); - ObjectFile *objfile = m_sym_file_up->GetObjectFile(); - if (objfile) { - const FileSpec &objfile_file_spec = objfile->GetFileSpec(); - if (objfile_file_spec) { - s->PutCString(" ("); - objfile_file_spec.Dump(s); - s->PutChar(')'); - } - } - } - s->EOL(); - if (m_sym_file_up) - m_sym_file_up->Dump(*s); - } -} - -CompUnitSP SymbolVendor::GetCompileUnitAtIndex(size_t idx) { - if (m_sym_file_up) - return m_sym_file_up->GetCompileUnitAtIndex(idx); - return nullptr; -} - -FileSpec SymbolVendor::GetMainFileSpec() const { - if (m_sym_file_up) { - const ObjectFile *symfile_objfile = m_sym_file_up->GetObjectFile(); - if (symfile_objfile) - return symfile_objfile->GetFileSpec(); - } - - return FileSpec(); -} - -void SymbolVendor::SectionFileAddressesChanged() { - if (m_sym_file_up) - m_sym_file_up->SectionFileAddressesChanged(); -} - // PluginInterface protocol lldb_private::ConstString SymbolVendor::GetPluginName() { static ConstString g_name("vendor-default"); Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/tools/lldb-test/lldb-test.cpp (original) +++ lldb/trunk/tools/lldb-test/lldb-test.cpp Tue Aug 6 02:12:42 2019 @@ -22,8 +22,9 @@ #include "lldb/Symbol/ClangASTImporter.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" -#include "lldb/Symbol/SymbolVendor.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TypeList.h" +#include "lldb/Symbol/TypeMap.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -168,7 +169,7 @@ static cl::opt<std::string> File("file", static cl::opt<int> Line("line", cl::desc("Line to search."), cl::sub(SymbolsSubcommand)); -static Expected<CompilerDeclContext> getDeclContext(SymbolVendor &Vendor); +static Expected<CompilerDeclContext> getDeclContext(SymbolFile &Symfile); static Error findFunctions(lldb_private::Module &Module); static Error findBlocks(lldb_private::Module &Module); @@ -335,11 +336,11 @@ int opts::breakpoint::evaluateBreakpoint } Expected<CompilerDeclContext> -opts::symbols::getDeclContext(SymbolVendor &Vendor) { +opts::symbols::getDeclContext(SymbolFile &Symfile) { if (Context.empty()) return CompilerDeclContext(); VariableList List; - Vendor.FindGlobalVariables(ConstString(Context), nullptr, UINT32_MAX, List); + Symfile.FindGlobalVariables(ConstString(Context), nullptr, UINT32_MAX, List); if (List.Empty()) return make_string_error("Context search didn't find a match."); if (List.GetSize() > 1) @@ -348,7 +349,7 @@ opts::symbols::getDeclContext(SymbolVend } Error opts::symbols::findFunctions(lldb_private::Module &Module) { - SymbolVendor &Vendor = *Module.GetSymbolVendor(); + SymbolFile &Symfile = *Module.GetSymbolFile(); SymbolContextList List; if (!File.empty()) { assert(Line != 0); @@ -380,15 +381,15 @@ Error opts::symbols::findFunctions(lldb_ } else if (Regex) { RegularExpression RE(Name); assert(RE.IsValid()); - Vendor.FindFunctions(RE, true, false, List); + Symfile.FindFunctions(RE, true, false, List); } else { - Expected<CompilerDeclContext> ContextOr = getDeclContext(Vendor); + Expected<CompilerDeclContext> ContextOr = getDeclContext(Symfile); if (!ContextOr) return ContextOr.takeError(); CompilerDeclContext *ContextPtr = ContextOr->IsValid() ? &*ContextOr : nullptr; - Vendor.FindFunctions(ConstString(Name), ContextPtr, getFunctionNameFlags(), + Symfile.FindFunctions(ConstString(Name), ContextPtr, getFunctionNameFlags(), true, false, List); } outs() << formatv("Found {0} functions:\n", List.GetSize()); @@ -436,15 +437,15 @@ Error opts::symbols::findBlocks(lldb_pri } Error opts::symbols::findNamespaces(lldb_private::Module &Module) { - SymbolVendor &Vendor = *Module.GetSymbolVendor(); - Expected<CompilerDeclContext> ContextOr = getDeclContext(Vendor); + SymbolFile &Symfile = *Module.GetSymbolFile(); + Expected<CompilerDeclContext> ContextOr = getDeclContext(Symfile); if (!ContextOr) return ContextOr.takeError(); CompilerDeclContext *ContextPtr = ContextOr->IsValid() ? &*ContextOr : nullptr; CompilerDeclContext Result = - Vendor.FindNamespace(ConstString(Name), ContextPtr); + Symfile.FindNamespace(ConstString(Name), ContextPtr); if (Result) outs() << "Found namespace: " << Result.GetScopeQualifiedName().GetStringRef() << "\n"; @@ -454,8 +455,8 @@ Error opts::symbols::findNamespaces(lldb } Error opts::symbols::findTypes(lldb_private::Module &Module) { - SymbolVendor &Vendor = *Module.GetSymbolVendor(); - Expected<CompilerDeclContext> ContextOr = getDeclContext(Vendor); + SymbolFile &Symfile = *Module.GetSymbolFile(); + Expected<CompilerDeclContext> ContextOr = getDeclContext(Symfile); if (!ContextOr) return ContextOr.takeError(); CompilerDeclContext *ContextPtr = @@ -463,7 +464,7 @@ Error opts::symbols::findTypes(lldb_priv DenseSet<SymbolFile *> SearchedFiles; TypeMap Map; - Vendor.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX, + Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX, SearchedFiles, Map); outs() << formatv("Found {0} types:\n", Map.GetSize()); @@ -474,12 +475,12 @@ Error opts::symbols::findTypes(lldb_priv } Error opts::symbols::findVariables(lldb_private::Module &Module) { - SymbolVendor &Vendor = *Module.GetSymbolVendor(); + SymbolFile &Symfile = *Module.GetSymbolFile(); VariableList List; if (Regex) { RegularExpression RE(Name); assert(RE.IsValid()); - Vendor.FindGlobalVariables(RE, UINT32_MAX, List); + Symfile.FindGlobalVariables(RE, UINT32_MAX, List); } else if (!File.empty()) { CompUnitSP CU; for (size_t Ind = 0; !CU && Ind < Module.GetNumCompileUnits(); ++Ind) { @@ -497,13 +498,13 @@ Error opts::symbols::findVariables(lldb_ List.AddVariables(CU->GetVariableList(true).get()); } else { - Expected<CompilerDeclContext> ContextOr = getDeclContext(Vendor); + Expected<CompilerDeclContext> ContextOr = getDeclContext(Symfile); if (!ContextOr) return ContextOr.takeError(); CompilerDeclContext *ContextPtr = ContextOr->IsValid() ? &*ContextOr : nullptr; - Vendor.FindGlobalVariables(ConstString(Name), ContextPtr, UINT32_MAX, List); + Symfile.FindGlobalVariables(ConstString(Name), ContextPtr, UINT32_MAX, List); } outs() << formatv("Found {0} variables:\n", List.GetSize()); StreamString Stream; @@ -521,10 +522,9 @@ Error opts::symbols::dumpModule(lldb_pri } Error opts::symbols::dumpAST(lldb_private::Module &Module) { - SymbolVendor &plugin = *Module.GetSymbolVendor(); - Module.ParseAllDebugSymbols(); + Module.ParseAllDebugSymbols(); - auto symfile = plugin.GetSymbolFile(); + auto symfile = Module.GetSymbolFile(); if (!symfile) return make_string_error("Module has no symbol file."); @@ -552,9 +552,7 @@ Error opts::symbols::dumpAST(lldb_privat } Error opts::symbols::verify(lldb_private::Module &Module) { - SymbolVendor &plugin = *Module.GetSymbolVendor(); - - SymbolFile *symfile = plugin.GetSymbolFile(); + SymbolFile *symfile = Module.GetSymbolFile(); if (!symfile) return make_string_error("Module has no symbol file."); @@ -707,8 +705,8 @@ int opts::symbols::dumpSymbols(Debugger Spec.GetSymbolFileSpec().SetFile(Symbols, FileSpec::Style::native); auto ModulePtr = std::make_shared<lldb_private::Module>(Spec); - SymbolVendor *Vendor = ModulePtr->GetSymbolVendor(); - if (!Vendor) { + SymbolFile *Symfile = ModulePtr->GetSymbolFile(); + if (!Symfile) { WithColor::error() << "Module has no symbol vendor.\n"; return 1; } @@ -774,7 +772,7 @@ static int dumpObjectFiles(Debugger &Dbg // Fetch symbol vendor before we get the section list to give the symbol // vendor a chance to populate it. - ModulePtr->GetSymbolVendor(); + ModulePtr->GetSymbolFile(); SectionList *Sections = ModulePtr->GetSectionList(); if (!Sections) { llvm::errs() << "Could not load sections for module " << File << "\n"; Modified: lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp?rev=368001&r1=368000&r2=368001&view=diff ============================================================================== --- lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp (original) +++ lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp Tue Aug 6 02:12:42 2019 @@ -29,7 +29,6 @@ #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" -#include "lldb/Symbol/SymbolVendor.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/DataEncoder.h" #include "lldb/Utility/FileSpec.h" @@ -75,10 +74,8 @@ TEST_F(SymbolFileDWARFTests, TestAbiliti ArchSpec aspec("i686-pc-windows"); lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec); - SymbolVendor *plugin = module->GetSymbolVendor(); - EXPECT_NE(nullptr, plugin); - SymbolFile *symfile = plugin->GetSymbolFile(); - EXPECT_NE(nullptr, symfile); + SymbolFile *symfile = module->GetSymbolFile(); + ASSERT_NE(nullptr, symfile); EXPECT_EQ(symfile->GetPluginName(), SymbolFileDWARF::GetPluginNameStatic()); uint32_t expected_abilities = SymbolFile::kAllAbilities; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits