[Lldb-commits] [lldb] bad1389 - [lldb/Core] Remove dead Get*PluginCreateCallbackForPluginName (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 18 17:36:33 PST 2020


Author: Jonas Devlieghere
Date: 2020-02-18T17:36:26-08:00
New Revision: bad1389f1252d1b77c5e31f0dadee92eb38d23a1

URL: https://github.com/llvm/llvm-project/commit/bad1389f1252d1b77c5e31f0dadee92eb38d23a1
DIFF: https://github.com/llvm/llvm-project/commit/bad1389f1252d1b77c5e31f0dadee92eb38d23a1.diff

LOG: [lldb/Core] Remove dead Get*PluginCreateCallbackForPluginName (NFC)

The plugin manager had dedicated Get*PluginCreateCallbackForPluginName
methods for each type of plugin, and only a small subset of those were
used. This removes the dead duplicated code.

Added: 
    

Modified: 
    lldb/include/lldb/Core/PluginManager.h
    lldb/source/Core/PluginManager.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
index 259f7162d896..90db9cee06ac 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -61,8 +61,6 @@ class PluginManager {
 
   static ABICreateInstance GetABICreateCallbackAtIndex(uint32_t idx);
 
-  static ABICreateInstance GetABICreateCallbackForPluginName(ConstString name);
-
   // Architecture
   using ArchitectureCreateInstance =
       std::unique_ptr<Architecture> (*)(const ArchSpec &);
@@ -112,9 +110,6 @@ class PluginManager {
   static JITLoaderCreateInstance
   GetJITLoaderCreateCallbackAtIndex(uint32_t idx);
 
-  static JITLoaderCreateInstance
-  GetJITLoaderCreateCallbackForPluginName(ConstString name);
-
   // EmulateInstruction
   static bool RegisterPlugin(ConstString name, const char *description,
                              EmulateInstructionCreateInstance create_callback);
@@ -149,9 +144,6 @@ class PluginManager {
 
   static LanguageCreateInstance GetLanguageCreateCallbackAtIndex(uint32_t idx);
 
-  static LanguageCreateInstance
-  GetLanguageCreateCallbackForPluginName(ConstString name);
-
   // LanguageRuntime
   static bool RegisterPlugin(
       ConstString name, const char *description,
@@ -170,9 +162,6 @@ class PluginManager {
   static LanguageRuntimeGetExceptionPrecondition
   GetLanguageRuntimeGetExceptionPreconditionAtIndex(uint32_t idx);
 
-  static LanguageRuntimeCreateInstance
-  GetLanguageRuntimeCreateCallbackForPluginName(ConstString name);
-
   // SystemRuntime
   static bool RegisterPlugin(ConstString name, const char *description,
                              SystemRuntimeCreateInstance create_callback);
@@ -182,9 +171,6 @@ class PluginManager {
   static SystemRuntimeCreateInstance
   GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx);
 
-  static SystemRuntimeCreateInstance
-  GetSystemRuntimeCreateCallbackForPluginName(ConstString name);
-
   // ObjectFile
   static bool
   RegisterPlugin(ConstString name, const char *description,
@@ -204,9 +190,6 @@ class PluginManager {
   static ObjectFileGetModuleSpecifications
   GetObjectFileGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
 
-  static ObjectFileCreateInstance
-  GetObjectFileCreateCallbackForPluginName(ConstString name);
-
   static ObjectFileCreateMemoryInstance
   GetObjectFileCreateMemoryCallbackForPluginName(ConstString name);
 
@@ -224,9 +207,6 @@ class PluginManager {
   static ObjectContainerCreateInstance
   GetObjectContainerCreateCallbackAtIndex(uint32_t idx);
 
-  static ObjectContainerCreateInstance
-  GetObjectContainerCreateCallbackForPluginName(ConstString name);
-
   static ObjectFileGetModuleSpecifications
   GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
 
@@ -326,9 +306,6 @@ class PluginManager {
   static StructuredDataPluginCreateInstance
   GetStructuredDataPluginCreateCallbackAtIndex(uint32_t idx);
 
-  static StructuredDataPluginCreateInstance
-  GetStructuredDataPluginCreateCallbackForPluginName(ConstString name);
-
   static StructuredDataFilterLaunchInfo
   GetStructuredDataFilterCallbackAtIndex(uint32_t idx,
                                          bool &iteration_complete);
@@ -344,9 +321,6 @@ class PluginManager {
   static SymbolFileCreateInstance
   GetSymbolFileCreateCallbackAtIndex(uint32_t idx);
 
-  static SymbolFileCreateInstance
-  GetSymbolFileCreateCallbackForPluginName(ConstString name);
-
   // SymbolVendor
   static bool RegisterPlugin(ConstString name, const char *description,
                              SymbolVendorCreateInstance create_callback);
@@ -356,9 +330,6 @@ class PluginManager {
   static SymbolVendorCreateInstance
   GetSymbolVendorCreateCallbackAtIndex(uint32_t idx);
 
-  static SymbolVendorCreateInstance
-  GetSymbolVendorCreateCallbackForPluginName(ConstString name);
-
   // UnwindAssembly
   static bool RegisterPlugin(ConstString name, const char *description,
                              UnwindAssemblyCreateInstance create_callback);
@@ -368,9 +339,6 @@ class PluginManager {
   static UnwindAssemblyCreateInstance
   GetUnwindAssemblyCreateCallbackAtIndex(uint32_t idx);
 
-  static UnwindAssemblyCreateInstance
-  GetUnwindAssemblyCreateCallbackForPluginName(ConstString name);
-
   // MemoryHistory
   static bool RegisterPlugin(ConstString name, const char *description,
                              MemoryHistoryCreateInstance create_callback);
@@ -380,9 +348,6 @@ class PluginManager {
   static MemoryHistoryCreateInstance
   GetMemoryHistoryCreateCallbackAtIndex(uint32_t idx);
 
-  static MemoryHistoryCreateInstance
-  GetMemoryHistoryCreateCallbackForPluginName(ConstString name);
-
   // InstrumentationRuntime
   static bool
   RegisterPlugin(ConstString name, const char *description,
@@ -398,9 +363,6 @@ class PluginManager {
   static InstrumentationRuntimeCreateInstance
   GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx);
 
-  static InstrumentationRuntimeCreateInstance
-  GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
-
   // TypeSystem
   static bool RegisterPlugin(ConstString name, const char *description,
                              TypeSystemCreateInstance create_callback,
@@ -412,9 +374,6 @@ class PluginManager {
   static TypeSystemCreateInstance
   GetTypeSystemCreateCallbackAtIndex(uint32_t idx);
 
-  static TypeSystemCreateInstance
-  GetTypeSystemCreateCallbackForPluginName(ConstString name);
-
   static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes();
 
   static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
@@ -428,9 +387,6 @@ class PluginManager {
 
   static REPLCreateInstance GetREPLCreateCallbackAtIndex(uint32_t idx);
 
-  static REPLCreateInstance
-  GetREPLCreateCallbackForPluginName(ConstString name);
-
   static LanguageSet GetREPLAllTypeSystemSupportedLanguages();
 
   // Some plug-ins might register a DebuggerInitializeCallback callback when

diff  --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index 556febcbfda9..e23afecbf13f 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -268,21 +268,6 @@ ABICreateInstance PluginManager::GetABICreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-ABICreateInstance
-PluginManager::GetABICreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetABIInstancesMutex());
-    ABIInstances &instances = GetABIInstances();
-
-    ABIInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 #pragma mark Architecture
 
 typedef PluginInstance<PluginManager::ArchitectureCreateInstance>
@@ -537,21 +522,6 @@ PluginManager::GetJITLoaderCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-JITLoaderCreateInstance
-PluginManager::GetJITLoaderCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetJITLoaderMutex());
-    JITLoaderInstances &instances = GetJITLoaderInstances();
-
-    JITLoaderInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 #pragma mark EmulateInstruction
 
 typedef PluginInstance<EmulateInstructionCreateInstance>
@@ -755,21 +725,6 @@ PluginManager::GetLanguageCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-LanguageCreateInstance
-PluginManager::GetLanguageCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetLanguageMutex());
-    LanguageInstances &instances = GetLanguageInstances();
-
-    LanguageInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 #pragma mark LanguageRuntime
 
 struct LanguageRuntimeInstance
@@ -854,21 +809,6 @@ PluginManager::GetLanguageRuntimeGetExceptionPreconditionAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-LanguageRuntimeCreateInstance
-PluginManager::GetLanguageRuntimeCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetLanguageRuntimeMutex());
-    LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances();
-
-    LanguageRuntimeInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 #pragma mark SystemRuntime
 
 typedef PluginInstance<SystemRuntimeCreateInstance> SystemRuntimeInstance;
@@ -926,21 +866,6 @@ PluginManager::GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-SystemRuntimeCreateInstance
-PluginManager::GetSystemRuntimeCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetSystemRuntimeMutex());
-    SystemRuntimeInstances &instances = GetSystemRuntimeInstances();
-
-    SystemRuntimeInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 #pragma mark ObjectFile
 
 struct ObjectFileInstance : public PluginInstance<ObjectFileCreateInstance> {
@@ -1027,21 +952,6 @@ PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex(
   return nullptr;
 }
 
-ObjectFileCreateInstance
-PluginManager::GetObjectFileCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
-    ObjectFileInstances &instances = GetObjectFileInstances();
-
-    ObjectFileInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 ObjectFileCreateMemoryInstance
 PluginManager::GetObjectFileCreateMemoryCallbackForPluginName(
     ConstString name) {
@@ -1136,21 +1046,6 @@ PluginManager::GetObjectContainerCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-ObjectContainerCreateInstance
-PluginManager::GetObjectContainerCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetObjectContainerMutex());
-    ObjectContainerInstances &instances = GetObjectContainerInstances();
-
-    ObjectContainerInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 ObjectFileGetModuleSpecifications
 PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex(
     uint32_t idx) {
@@ -1510,23 +1405,6 @@ PluginManager::GetStructuredDataPluginCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-StructuredDataPluginCreateInstance
-PluginManager::GetStructuredDataPluginCreateCallbackForPluginName(
-    ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetStructuredDataPluginMutex());
-    StructuredDataPluginInstances &instances =
-        GetStructuredDataPluginInstances();
-
-    StructuredDataPluginInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 StructuredDataFilterLaunchInfo
 PluginManager::GetStructuredDataFilterCallbackAtIndex(
     uint32_t idx, bool &iteration_complete) {
@@ -1599,21 +1477,6 @@ PluginManager::GetSymbolFileCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-SymbolFileCreateInstance
-PluginManager::GetSymbolFileCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetSymbolFileMutex());
-    SymbolFileInstances &instances = GetSymbolFileInstances();
-
-    SymbolFileInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 #pragma mark SymbolVendor
 
 typedef PluginInstance<SymbolVendorCreateInstance> SymbolVendorInstance;
@@ -1727,21 +1590,6 @@ PluginManager::GetUnwindAssemblyCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-UnwindAssemblyCreateInstance
-PluginManager::GetUnwindAssemblyCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetUnwindAssemblyMutex());
-    UnwindAssemblyInstances &instances = GetUnwindAssemblyInstances();
-
-    UnwindAssemblyInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 #pragma mark MemoryHistory
 
 typedef PluginInstance<MemoryHistoryCreateInstance> MemoryHistoryInstance;
@@ -1799,21 +1647,6 @@ PluginManager::GetMemoryHistoryCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-MemoryHistoryCreateInstance
-PluginManager::GetMemoryHistoryCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetMemoryHistoryMutex());
-    MemoryHistoryInstances &instances = GetMemoryHistoryInstances();
-
-    MemoryHistoryInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 #pragma mark InstrumentationRuntime
 
 struct InstrumentationRuntimeInstance
@@ -1892,24 +1725,6 @@ PluginManager::GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-InstrumentationRuntimeCreateInstance
-PluginManager::GetInstrumentationRuntimeCreateCallbackForPluginName(
-    ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(
-        GetInstrumentationRuntimeMutex());
-    InstrumentationRuntimeInstances &instances =
-        GetInstrumentationRuntimeInstances();
-
-    InstrumentationRuntimeInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 #pragma mark TypeSystem
 
 struct TypeSystemInstance : public PluginInstance<TypeSystemCreateInstance> {
@@ -1975,21 +1790,6 @@ PluginManager::GetTypeSystemCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-TypeSystemCreateInstance
-PluginManager::GetTypeSystemCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
-    TypeSystemInstances &instances = GetTypeSystemInstances();
-
-    TypeSystemInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 LanguageSet PluginManager::GetAllTypeSystemSupportedLanguagesForTypes() {
   std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
   LanguageSet all;
@@ -2067,21 +1867,6 @@ REPLCreateInstance PluginManager::GetREPLCreateCallbackAtIndex(uint32_t idx) {
   return nullptr;
 }
 
-REPLCreateInstance
-PluginManager::GetREPLCreateCallbackForPluginName(ConstString name) {
-  if (name) {
-    std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
-    REPLInstances &instances = GetREPLInstances();
-
-    REPLInstances::iterator pos, end = instances.end();
-    for (pos = instances.begin(); pos != end; ++pos) {
-      if (name == pos->name)
-        return pos->create_callback;
-    }
-  }
-  return nullptr;
-}
-
 LanguageSet PluginManager::GetREPLAllTypeSystemSupportedLanguages() {
   std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
   LanguageSet all;


        


More information about the lldb-commits mailing list