[Lldb-commits] [lldb] adf5e9c - [lldb] Remove ConstString from TypeSystem and REPL plugin names

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 2 08:14:04 PDT 2021


Author: Pavel Labath
Date: 2021-11-02T16:13:52+01:00
New Revision: adf5e9c9b67a60727e02a4e83a3d7a9373579574

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

LOG: [lldb] Remove ConstString from TypeSystem and REPL plugin names

Added: 
    

Modified: 
    lldb/include/lldb/Core/PluginManager.h
    lldb/source/Core/PluginManager.cpp
    lldb/source/Plugins/REPL/Clang/ClangREPL.h
    lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
index cd720d5a9d0fc..7dc99bf3e7558 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -426,7 +426,7 @@ class PluginManager {
   GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx);
 
   // TypeSystem
-  static bool RegisterPlugin(ConstString name, const char *description,
+  static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
                              TypeSystemCreateInstance create_callback,
                              LanguageSet supported_languages_for_types,
                              LanguageSet supported_languages_for_expressions);
@@ -441,7 +441,7 @@ class PluginManager {
   static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
 
   // REPL
-  static bool RegisterPlugin(ConstString name, const char *description,
+  static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
                              REPLCreateInstance create_callback,
                              LanguageSet supported_languages);
 

diff  --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index 5ba427a24ed45..90b1a626bd1ae 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -1291,13 +1291,13 @@ static TypeSystemInstances &GetTypeSystemInstances() {
 }
 
 bool PluginManager::RegisterPlugin(
-    ConstString name, const char *description,
+    llvm::StringRef name, llvm::StringRef description,
     TypeSystemCreateInstance create_callback,
     LanguageSet supported_languages_for_types,
     LanguageSet supported_languages_for_expressions) {
   return GetTypeSystemInstances().RegisterPlugin(
-      name, description, create_callback, supported_languages_for_types,
-      supported_languages_for_expressions);
+      ConstString(name), description.str().c_str(), create_callback,
+      supported_languages_for_types, supported_languages_for_expressions);
 }
 
 bool PluginManager::UnregisterPlugin(TypeSystemCreateInstance create_callback) {
@@ -1344,11 +1344,12 @@ static REPLInstances &GetREPLInstances() {
   return g_instances;
 }
 
-bool PluginManager::RegisterPlugin(ConstString name, const char *description,
+bool PluginManager::RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
                                    REPLCreateInstance create_callback,
                                    LanguageSet supported_languages) {
-  return GetREPLInstances().RegisterPlugin(name, description, create_callback,
-                                           supported_languages);
+  return GetREPLInstances().RegisterPlugin(
+      ConstString(name), description.str().c_str(), create_callback,
+      supported_languages);
 }
 
 bool PluginManager::UnregisterPlugin(REPLCreateInstance create_callback) {

diff  --git a/lldb/source/Plugins/REPL/Clang/ClangREPL.h b/lldb/source/Plugins/REPL/Clang/ClangREPL.h
index 3666a53a2ce39..07b7f73b1fafb 100644
--- a/lldb/source/Plugins/REPL/Clang/ClangREPL.h
+++ b/lldb/source/Plugins/REPL/Clang/ClangREPL.h
@@ -28,9 +28,7 @@ class ClangREPL : public REPL {
                                      Debugger *debugger, Target *target,
                                      const char *repl_options);
 
-  static lldb_private::ConstString GetPluginNameStatic() {
-    return ConstString("ClangREPL");
-  }
+  static llvm::StringRef GetPluginNameStatic() { return "ClangREPL"; }
 
 protected:
   Status DoInitialization() override;

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 9beccf30f94be..72b47d04b9c48 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -570,10 +570,6 @@ TypeSystemClang::TypeSystemClang(llvm::StringRef name,
 // Destructor
 TypeSystemClang::~TypeSystemClang() { Finalize(); }
 
-ConstString TypeSystemClang::GetPluginNameStatic() {
-  return ConstString("clang");
-}
-
 lldb::TypeSystemSP TypeSystemClang::CreateInstance(lldb::LanguageType language,
                                                    lldb_private::Module *module,
                                                    Target *target) {

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 93300439806d4..e542e6f5face2 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -138,11 +138,9 @@ class TypeSystemClang : public TypeSystem {
   void Finalize() override;
 
   // PluginInterface functions
-  llvm::StringRef GetPluginName() override {
-    return GetPluginNameStatic().GetStringRef();
-  }
+  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
 
-  static ConstString GetPluginNameStatic();
+  static llvm::StringRef GetPluginNameStatic() { return "clang"; }
 
   static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
                                            Module *module, Target *target);


        


More information about the lldb-commits mailing list