SymbolVendor: Remove passthrough methods
authorPavel Labath <pavel@labath.sk>
Tue, 6 Aug 2019 09:12:42 +0000 (09:12 +0000)
committerPavel Labath <pavel@labath.sk>
Tue, 6 Aug 2019 09:12:42 +0000 (09:12 +0000)
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().

llvm-svn: 368001

15 files changed:
lldb/include/lldb/Symbol/SymbolVendor.h
lldb/source/API/SBCompileUnit.cpp
lldb/source/API/SBModule.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/SearchFilter.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Symbol/Block.cpp
lldb/source/Symbol/CompileUnit.cpp
lldb/source/Symbol/Function.cpp
lldb/source/Symbol/SymbolVendor.cpp
lldb/tools/lldb-test/lldb-test.cpp
lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp

index cfa7c4b..96c6ea5 100644 (file)
@@ -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 &regex,
-                                     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 &regex,
-                               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;
 
index 341268f..581bda3 100644 (file)
@@ -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(uint32_t type_mask) {
   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);
 }
index 6f856de..253a539 100644 (file)
@@ -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(size_t idx) {
   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::user_id_t uid) {
 
   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(uint32_t type_mask) {
   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 char *sect_name) {
   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::GetSymbolFileSpec() const {
   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);
 }
index 5535a50..52a7731 100644 (file)
@@ -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(CommandInterpreter &interpreter, Stream &strm,
   }
 }
 
-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++;
               }
             }
index c9a6766..22c8997 100644 (file)
@@ -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 ModuleSP &module_sp,
           // 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) {
index 53e9c2c..3841b59 100644 (file)
@@ -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::FindExternalVisibleDecls(
   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::FindExternalVisibleDecls(
 
       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::CompleteNamespaceMap(
       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::CompleteNamespaceMap(
 
       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;
index 52f855b..8a4e40d 100644 (file)
@@ -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::ParseTypeFromDWO(const DWARFDIE &die, Log *log) {
   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::ParseTypeFromDWO(const DWARFDIE &die, Log *log) {
     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;
     }
   }
index 11e3fcc..765982e 100644 (file)
@@ -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;
         }
index 66303e4..af04d05 100644 (file)
@@ -776,7 +776,7 @@ SymbolFileDWARFDebugMap::ResolveSymbolContext(const Address &exe_so_addr,
             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::LinkOSOAddress(Address &addr) {
   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 =
index e904414..77a4830 100644 (file)
@@ -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::GetBlockVariableList(bool can_create) {
       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;
index 5fb9b6b..6ed2799 100644 (file)
@@ -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::GetLanguage() {
   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::GetVariableList(bool can_create) {
     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::ResolveSymbolContext(const FileSpec &file_spec,
 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> &CompileUnit::GetImportedModules() {
   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::GetSupportFiles() {
   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;
index 49b2c9b..28ce4fd 100644 (file)
@@ -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_create) {
   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 "
index 929cb3e..1e1dea7 100644 (file)
@@ -73,220 +73,6 @@ void SymbolVendor::AddSymbolFileRepresentation(const ObjectFileSP &objfile_sp) {
   }
 }
 
-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 &regex,
-                                         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 &regex,
-                                   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");
index d44b6fd..e522f94 100644 (file)
@@ -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::evaluateBreakpoints(Debugger &Dbg) {
 }
 
 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(SymbolVendor &Vendor) {
 }
 
 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_private::Module &Module) {
   } 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_private::Module &Module) {
 }
 
 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_private::Module &Module) {
 }
 
 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_private::Module &Module) {
 
   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_private::Module &Module) {
 }
 
 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_private::Module &Module) {
 
     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_private::Module &Module) {
 }
 
 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_private::Module &Module) {
 }
 
 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 &Dbg) {
   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";
index a1a0005..17c33f4 100644 (file)
@@ -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, TestAbilitiesForDWARF) {
   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;