[Lldb-commits] [lldb] 5f4980f - [lldb] Remove ConstString from Process, ScriptInterpreter and StructuredData plugin names
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 28 01:15:19 PDT 2021
Author: Pavel Labath
Date: 2021-10-28T10:15:03+02:00
New Revision: 5f4980f004f052367b947ff3aa6cc142cea1c23f
URL: https://github.com/llvm/llvm-project/commit/5f4980f004f052367b947ff3aa6cc142cea1c23f
DIFF: https://github.com/llvm/llvm-project/commit/5f4980f004f052367b947ff3aa6cc142cea1c23f.diff
LOG: [lldb] Remove ConstString from Process, ScriptInterpreter and StructuredData plugin names
Added:
Modified:
lldb/include/lldb/Core/PluginManager.h
lldb/include/lldb/Target/ProcessTrace.h
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Core/PluginManager.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/source/Plugins/Process/mach-core/ProcessMachCore.h
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/source/Plugins/Process/minidump/ProcessMinidump.h
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/Process/scripted/ScriptedProcess.h
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h
lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h
lldb/source/Target/Process.cpp
lldb/source/Target/ProcessTrace.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
index e027968c1b4d4..dffceb93ebc63 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -230,7 +230,7 @@ class PluginManager {
CompletionRequest &request);
// Process
static bool
- RegisterPlugin(ConstString name, const char *description,
+ RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
ProcessCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback = nullptr);
@@ -239,17 +239,17 @@ class PluginManager {
static ProcessCreateInstance GetProcessCreateCallbackAtIndex(uint32_t idx);
static ProcessCreateInstance
- GetProcessCreateCallbackForPluginName(ConstString name);
+ GetProcessCreateCallbackForPluginName(llvm::StringRef name);
- static const char *GetProcessPluginNameAtIndex(uint32_t idx);
+ static llvm::StringRef GetProcessPluginNameAtIndex(uint32_t idx);
- static const char *GetProcessPluginDescriptionAtIndex(uint32_t idx);
+ static llvm::StringRef GetProcessPluginDescriptionAtIndex(uint32_t idx);
static void AutoCompleteProcessName(llvm::StringRef partial_name,
CompletionRequest &request);
// ScriptInterpreter
- static bool RegisterPlugin(ConstString name, const char *description,
+ static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
lldb::ScriptLanguage script_lang,
ScriptInterpreterCreateInstance create_callback);
@@ -297,7 +297,7 @@ class PluginManager {
/// \return
/// Returns true upon success; otherwise, false.
static bool
- RegisterPlugin(ConstString name, const char *description,
+ RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
StructuredDataPluginCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback = nullptr,
StructuredDataFilterLaunchInfo filter_callback = nullptr);
diff --git a/lldb/include/lldb/Target/ProcessTrace.h b/lldb/include/lldb/Target/ProcessTrace.h
index 8fa7928910d7d..037dea232cc02 100644
--- a/lldb/include/lldb/Target/ProcessTrace.h
+++ b/lldb/include/lldb/Target/ProcessTrace.h
@@ -23,9 +23,9 @@ class ProcessTrace : public PostMortemProcess {
static void Terminate();
- static ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "trace"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
@@ -40,9 +40,7 @@ class ProcessTrace : public PostMortemProcess {
SystemRuntime *GetSystemRuntime() override { return nullptr; }
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
Status DoDestroy() override;
diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 054b75a3fed28..9122117ef5ff1 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1665,8 +1665,9 @@ class ProcessPluginFieldDelegate : public ChoicesFieldDelegate {
names.push_back("<default>");
size_t i = 0;
- while (auto name = PluginManager::GetProcessPluginNameAtIndex(i++))
- names.push_back(name);
+ for (llvm::StringRef name = PluginManager::GetProcessPluginNameAtIndex(i++);
+ !name.empty(); name = PluginManager::GetProcessPluginNameAtIndex(i++))
+ names.push_back(name.str());
return names;
}
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index db603c1160902..7dfa565009f6f 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -830,22 +830,23 @@ static ProcessInstances &GetProcessInstances() {
}
bool PluginManager::RegisterPlugin(
- ConstString name, const char *description,
+ llvm::StringRef name, llvm::StringRef description,
ProcessCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback) {
return GetProcessInstances().RegisterPlugin(
- name, description, create_callback, debugger_init_callback);
+ ConstString(name), description.str().c_str(), create_callback,
+ debugger_init_callback);
}
bool PluginManager::UnregisterPlugin(ProcessCreateInstance create_callback) {
return GetProcessInstances().UnregisterPlugin(create_callback);
}
-const char *PluginManager::GetProcessPluginNameAtIndex(uint32_t idx) {
+llvm::StringRef PluginManager::GetProcessPluginNameAtIndex(uint32_t idx) {
return GetProcessInstances().GetNameAtIndex(idx);
}
-const char *PluginManager::GetProcessPluginDescriptionAtIndex(uint32_t idx) {
+llvm::StringRef PluginManager::GetProcessPluginDescriptionAtIndex(uint32_t idx) {
return GetProcessInstances().GetDescriptionAtIndex(idx);
}
@@ -855,8 +856,8 @@ PluginManager::GetProcessCreateCallbackAtIndex(uint32_t idx) {
}
ProcessCreateInstance
-PluginManager::GetProcessCreateCallbackForPluginName(ConstString name) {
- return GetProcessInstances().GetCallbackForName(name);
+PluginManager::GetProcessCreateCallbackForPluginName(llvm::StringRef name) {
+ return GetProcessInstances().GetCallbackForName(ConstString(name));
}
void PluginManager::AutoCompleteProcessName(llvm::StringRef name,
@@ -889,11 +890,12 @@ static ScriptInterpreterInstances &GetScriptInterpreterInstances() {
}
bool PluginManager::RegisterPlugin(
- ConstString name, const char *description,
+ llvm::StringRef name, llvm::StringRef description,
lldb::ScriptLanguage script_language,
ScriptInterpreterCreateInstance create_callback) {
return GetScriptInterpreterInstances().RegisterPlugin(
- name, description, create_callback, script_language);
+ ConstString(name), description.str().c_str(), create_callback,
+ script_language);
}
bool PluginManager::UnregisterPlugin(
@@ -949,13 +951,13 @@ static StructuredDataPluginInstances &GetStructuredDataPluginInstances() {
}
bool PluginManager::RegisterPlugin(
- ConstString name, const char *description,
+ llvm::StringRef name, llvm::StringRef description,
StructuredDataPluginCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback,
StructuredDataFilterLaunchInfo filter_callback) {
return GetStructuredDataPluginInstances().RegisterPlugin(
- name, description, create_callback, debugger_init_callback,
- filter_callback);
+ ConstString(name), description.str().c_str(), create_callback,
+ debugger_init_callback, filter_callback);
}
bool PluginManager::UnregisterPlugin(
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 62b1987d1f17f..df046bf1f0755 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -65,7 +65,7 @@ enum {
class PluginProperties : public Properties {
public:
static ConstString GetSettingName() {
- return ProcessKDP::GetPluginNameStatic();
+ return ConstString(ProcessKDP::GetPluginNameStatic());
}
PluginProperties() : Properties() {
@@ -91,12 +91,7 @@ static PluginProperties &GetGlobalPluginProperties() {
static const lldb::tid_t g_kernel_tid = 1;
-ConstString ProcessKDP::GetPluginNameStatic() {
- static ConstString g_name("kdp-remote");
- return g_name;
-}
-
-const char *ProcessKDP::GetPluginDescriptionStatic() {
+llvm::StringRef ProcessKDP::GetPluginDescriptionStatic() {
return "KDP Remote protocol based debugging plug-in for darwin kernel "
"debugging.";
}
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
index 73dc5c07f289d..3386354d0b4cb 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
@@ -41,9 +41,9 @@ class ProcessKDP : public lldb_private::Process {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "kdp-remote"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
// Constructors and Destructors
ProcessKDP(lldb::TargetSP target_sp, lldb::ListenerSP listener);
@@ -85,9 +85,7 @@ class ProcessKDP : public lldb_private::Process {
lldb_private::DynamicLoader *GetDynamicLoader() override;
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// Process Control
lldb_private::Status WillResume() override;
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 7990079170a61..97ba1bdc9ee9e 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -106,12 +106,7 @@ void ProcessWindows::Initialize() {
void ProcessWindows::Terminate() {}
-lldb_private::ConstString ProcessWindows::GetPluginNameStatic() {
- static ConstString g_name("windows");
- return g_name;
-}
-
-const char *ProcessWindows::GetPluginDescriptionStatic() {
+llvm::StringRef ProcessWindows::GetPluginDescriptionStatic() {
return "Process plugin for Windows";
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
index 5bd7056470ef9..fc83649818edd 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
@@ -32,9 +32,9 @@ class ProcessWindows : public Process, public ProcessDebugger {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "windows"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
// Constructors and destructors
ProcessWindows(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
@@ -45,9 +45,7 @@ class ProcessWindows : public Process, public ProcessDebugger {
size_t GetSTDERR(char *buf, size_t buf_size, Status &error) override;
size_t PutSTDIN(const char *buf, size_t buf_size, Status &error) override;
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
Status EnableBreakpointSite(BreakpointSite *bp_site) override;
Status DisableBreakpointSite(BreakpointSite *bp_site) override;
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 4f85b6dcd465a..b852a01643753 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -37,12 +37,7 @@ namespace ELF = llvm::ELF;
LLDB_PLUGIN_DEFINE(ProcessElfCore)
-ConstString ProcessElfCore::GetPluginNameStatic() {
- static ConstString g_name("elf-core");
- return g_name;
-}
-
-const char *ProcessElfCore::GetPluginDescriptionStatic() {
+llvm::StringRef ProcessElfCore::GetPluginDescriptionStatic() {
return "ELF core dump plug-in.";
}
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
index 3e70e9750f22c..67df3c5fac76a 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
@@ -40,9 +40,9 @@ class ProcessElfCore : public lldb_private::PostMortemProcess {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "elf-core"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
// Constructors and Destructors
ProcessElfCore(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
@@ -60,9 +60,7 @@ class ProcessElfCore : public lldb_private::PostMortemProcess {
lldb_private::DynamicLoader *GetDynamicLoader() override;
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// Process Control
lldb_private::Status DoDestroy() override;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 0edb356a5558f..a6f48b04d7db8 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -126,7 +126,7 @@ enum {
class PluginProperties : public Properties {
public:
static ConstString GetSettingName() {
- return ProcessGDBRemote::GetPluginNameStatic();
+ return ConstString(ProcessGDBRemote::GetPluginNameStatic());
}
PluginProperties() : Properties() {
@@ -184,12 +184,7 @@ static PluginProperties &GetGlobalPluginProperties() {
#define HIGH_PORT (49151u)
#endif
-ConstString ProcessGDBRemote::GetPluginNameStatic() {
- static ConstString g_name("gdb-remote");
- return g_name;
-}
-
-const char *ProcessGDBRemote::GetPluginDescriptionStatic() {
+llvm::StringRef ProcessGDBRemote::GetPluginDescriptionStatic() {
return "GDB Remote protocol based debugging plug-in.";
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 071e0315770a8..9e0583408e42a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -65,9 +65,9 @@ class ProcessGDBRemote : public Process,
static void Terminate();
- static ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "gdb-remote"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
static std::chrono::seconds GetPacketTimeout();
@@ -103,9 +103,7 @@ class ProcessGDBRemote : public Process,
void DidAttach(ArchSpec &process_arch) override;
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// Process Control
Status WillResume() override;
diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
index c2c60bc768ed7..6aed04565eb01 100644
--- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -48,12 +48,7 @@ using namespace lldb_private;
LLDB_PLUGIN_DEFINE(ProcessMachCore)
-ConstString ProcessMachCore::GetPluginNameStatic() {
- static ConstString g_name("mach-o-core");
- return g_name;
-}
-
-const char *ProcessMachCore::GetPluginDescriptionStatic() {
+llvm::StringRef ProcessMachCore::GetPluginDescriptionStatic() {
return "Mach-O core file debugging plug-in.";
}
diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h
index a5ea76d0de5d8..e55bfcfcc723b 100644
--- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h
+++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h
@@ -35,9 +35,9 @@ class ProcessMachCore : public lldb_private::PostMortemProcess {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "mach-o-core"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
// Check if a given Process
bool CanDebug(lldb::TargetSP target_sp,
@@ -49,9 +49,7 @@ class ProcessMachCore : public lldb_private::PostMortemProcess {
lldb_private::DynamicLoader *GetDynamicLoader() override;
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// Process Control
lldb_private::Status DoDestroy() override;
diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
index c9e1350283d05..08cf58b0a84a1 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -190,12 +190,7 @@ void HashElfTextSection(ModuleSP module_sp, std::vector<uint8_t> &breakpad_uuid,
} // namespace
-ConstString ProcessMinidump::GetPluginNameStatic() {
- static ConstString g_name("minidump");
- return g_name;
-}
-
-const char *ProcessMinidump::GetPluginDescriptionStatic() {
+llvm::StringRef ProcessMinidump::GetPluginDescriptionStatic() {
return "Minidump plug-in.";
}
diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
index 99d4b3e6081cf..3501d38a0f27e 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h
@@ -37,9 +37,9 @@ class ProcessMinidump : public PostMortemProcess {
static void Terminate();
- static ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "minidump"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
ProcessMinidump(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
const FileSpec &core_file, lldb::DataBufferSP code_data);
@@ -55,9 +55,7 @@ class ProcessMinidump : public PostMortemProcess {
DynamicLoader *GetDynamicLoader() override { return nullptr; }
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
SystemRuntime *GetSystemRuntime() override { return nullptr; }
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
index 521512317b368..c0eefbf60337c 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -30,12 +30,7 @@ LLDB_PLUGIN_DEFINE(ScriptedProcess)
using namespace lldb;
using namespace lldb_private;
-ConstString ScriptedProcess::GetPluginNameStatic() {
- static ConstString g_name("ScriptedProcess");
- return g_name;
-}
-
-const char *ScriptedProcess::GetPluginDescriptionStatic() {
+llvm::StringRef ScriptedProcess::GetPluginDescriptionStatic() {
return "Scripted Process plug-in.";
}
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
index c2ec371488ae1..68cc6aa372104 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
@@ -48,9 +48,9 @@ class ScriptedProcess : public Process {
static void Terminate();
- static ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "ScriptedProcess"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
ScriptedProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
const ScriptedProcess::ScriptedProcessInfo &launch_info,
@@ -63,9 +63,7 @@ class ScriptedProcess : public Process {
DynamicLoader *GetDynamicLoader() override { return nullptr; }
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
SystemRuntime *GetSystemRuntime() override { return nullptr; }
diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
index 24b36747cf229..7c821e5933823 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
@@ -387,12 +387,7 @@ ScriptInterpreterLua::CreateInstance(Debugger &debugger) {
return std::make_shared<ScriptInterpreterLua>(debugger);
}
-lldb_private::ConstString ScriptInterpreterLua::GetPluginNameStatic() {
- static ConstString g_name("script-lua");
- return g_name;
-}
-
-const char *ScriptInterpreterLua::GetPluginDescriptionStatic() {
+llvm::StringRef ScriptInterpreterLua::GetPluginDescriptionStatic() {
return "Lua script interpreter";
}
diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h
index 1cb0dcc7d3995..f3ca1e6b257d9 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h
@@ -56,9 +56,9 @@ class ScriptInterpreterLua : public ScriptInterpreter {
static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger);
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "script-lua"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
static bool BreakpointCallbackFunction(void *baton,
StoppointCallbackContext *context,
@@ -70,9 +70,7 @@ class ScriptInterpreterLua : public ScriptInterpreter {
lldb::user_id_t watch_id);
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
Lua &GetLua();
diff --git a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
index ace3ede38bd1d..bec90b2038e18 100644
--- a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
@@ -57,11 +57,6 @@ ScriptInterpreterNone::CreateInstance(Debugger &debugger) {
return std::make_shared<ScriptInterpreterNone>(debugger);
}
-lldb_private::ConstString ScriptInterpreterNone::GetPluginNameStatic() {
- static ConstString g_name("script-none");
- return g_name;
-}
-
-const char *ScriptInterpreterNone::GetPluginDescriptionStatic() {
+llvm::StringRef ScriptInterpreterNone::GetPluginDescriptionStatic() {
return "Null script interpreter";
}
diff --git a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h
index e16d525e78647..6d3ff251e3628 100644
--- a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h
+++ b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h
@@ -32,14 +32,12 @@ class ScriptInterpreterNone : public ScriptInterpreter {
static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger);
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "script-none"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
};
} // namespace lldb_private
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 5b1ffbc9f346f..74fb42ae03308 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -436,12 +436,7 @@ void ScriptInterpreterPython::SharedLibraryDirectoryHelper(
#endif
}
-lldb_private::ConstString ScriptInterpreterPython::GetPluginNameStatic() {
- static ConstString g_name("script-python");
- return g_name;
-}
-
-const char *ScriptInterpreterPython::GetPluginDescriptionStatic() {
+llvm::StringRef ScriptInterpreterPython::GetPluginDescriptionStatic() {
return "Embedded Python interpreter";
}
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
index 5a75c0a655e58..83cc15da56c94 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
@@ -48,8 +48,8 @@ class ScriptInterpreterPython : public ScriptInterpreter,
static void Initialize();
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "script-python"; }
+ static llvm::StringRef GetPluginDescriptionStatic();
static FileSpec GetPythonDir();
static void SharedLibraryDirectoryHelper(FileSpec &this_file);
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
index 65f5e34527140..a3f83b696ed49 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
@@ -292,9 +292,7 @@ class ScriptInterpreterPythonImpl : public ScriptInterpreterPython {
static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger);
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
class Locker : public ScriptInterpreterLocker {
public:
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index 0ee7660d714cb..b024854f3981e 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -800,9 +800,8 @@ class EnableCommand : public CommandObjectParsed {
// Get the plugin for the process.
auto plugin_sp =
process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName());
- if (!plugin_sp ||
- (plugin_sp->GetPluginName() !=
- StructuredDataDarwinLog::GetStaticPluginName().GetStringRef())) {
+ if (!plugin_sp || (plugin_sp->GetPluginName() !=
+ StructuredDataDarwinLog::GetStaticPluginName())) {
result.AppendError("failed to get StructuredDataPlugin for "
"the process");
}
@@ -875,9 +874,9 @@ class StatusCommand : public CommandObjectParsed {
process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName());
stream.Printf("Availability: %s\n",
plugin_sp ? "available" : "unavailable");
- ConstString plugin_name = StructuredDataDarwinLog::GetStaticPluginName();
+ llvm::StringRef plugin_name = StructuredDataDarwinLog::GetStaticPluginName();
const bool enabled =
- plugin_sp ? plugin_sp->GetEnabled(plugin_name) : false;
+ plugin_sp ? plugin_sp->GetEnabled(ConstString(plugin_name)) : false;
stream.Printf("Enabled: %s\n", enabled ? "true" : "false");
}
@@ -1050,11 +1049,6 @@ void StructuredDataDarwinLog::Terminate() {
PluginManager::UnregisterPlugin(&CreateInstance);
}
-ConstString StructuredDataDarwinLog::GetStaticPluginName() {
- static ConstString s_plugin_name("darwin-log");
- return s_plugin_name;
-}
-
#pragma mark -
#pragma mark StructuredDataPlugin API
@@ -1205,7 +1199,7 @@ Status StructuredDataDarwinLog::GetDescription(
}
bool StructuredDataDarwinLog::GetEnabled(ConstString type_name) const {
- if (type_name == GetStaticPluginName())
+ if (type_name.GetStringRef() == GetStaticPluginName())
return m_is_enabled;
else
return false;
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h
index f1be0637c6ab3..308fd82e9b12a 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h
@@ -30,7 +30,7 @@ class StructuredDataDarwinLog : public StructuredDataPlugin {
static void Terminate();
- static ConstString GetStaticPluginName();
+ static llvm::StringRef GetStaticPluginName() { return "darwin-log"; }
/// Return whether the DarwinLog functionality is enabled.
///
@@ -46,9 +46,7 @@ class StructuredDataDarwinLog : public StructuredDataPlugin {
// PluginInterface API
- llvm::StringRef GetPluginName() override {
- return GetStaticPluginName().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetStaticPluginName(); }
// StructuredDataPlugin API
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index f4813d1ee4df6..79ede760fb819 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -363,9 +363,8 @@ ProcessSP Process::FindPlugin(lldb::TargetSP target_sp,
ProcessSP process_sp;
ProcessCreateInstance create_callback = nullptr;
if (!plugin_name.empty()) {
- ConstString const_plugin_name(plugin_name);
create_callback =
- PluginManager::GetProcessCreateCallbackForPluginName(const_plugin_name);
+ PluginManager::GetProcessCreateCallbackForPluginName(plugin_name);
if (create_callback) {
process_sp = create_callback(target_sp, listener_sp, crash_file_path,
can_connect);
diff --git a/lldb/source/Target/ProcessTrace.cpp b/lldb/source/Target/ProcessTrace.cpp
index 9d0deced5398a..41d5b01b61d86 100644
--- a/lldb/source/Target/ProcessTrace.cpp
+++ b/lldb/source/Target/ProcessTrace.cpp
@@ -19,12 +19,7 @@
using namespace lldb;
using namespace lldb_private;
-ConstString ProcessTrace::GetPluginNameStatic() {
- static ConstString g_name("trace");
- return g_name;
-}
-
-const char *ProcessTrace::GetPluginDescriptionStatic() {
+llvm::StringRef ProcessTrace::GetPluginDescriptionStatic() {
return "Trace process plug-in.";
}
More information about the lldb-commits
mailing list