[Lldb-commits] [lldb] a458ef4 - [lldb] Remove ConstString from Platform plugin names
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 26 01:08:43 PDT 2021
Author: Pavel Labath
Date: 2021-10-26T10:04:35+02:00
New Revision: a458ef4f732b27312d8a5d20d2843d8bff35daeb
URL: https://github.com/llvm/llvm-project/commit/a458ef4f732b27312d8a5d20d2843d8bff35daeb
DIFF: https://github.com/llvm/llvm-project/commit/a458ef4f732b27312d8a5d20d2843d8bff35daeb.diff
LOG: [lldb] Remove ConstString from Platform plugin names
Added:
Modified:
lldb/include/lldb/Core/PluginManager.h
lldb/include/lldb/Target/Platform.h
lldb/source/API/SBDebugger.cpp
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Core/PluginManager.cpp
lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/source/Plugins/Platform/Android/PlatformAndroid.h
lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/source/Plugins/Platform/Windows/PlatformWindows.h
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Target/Platform.cpp
lldb/unittests/Target/RemoteAwarePlatformTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
index 97f8dae1bcfd2..aa51069cf4539 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -211,7 +211,7 @@ class PluginManager {
// Platform
static bool
- RegisterPlugin(ConstString name, const char *description,
+ RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
PlatformCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback = nullptr);
@@ -220,11 +220,11 @@ class PluginManager {
static PlatformCreateInstance GetPlatformCreateCallbackAtIndex(uint32_t idx);
static PlatformCreateInstance
- GetPlatformCreateCallbackForPluginName(ConstString name);
+ GetPlatformCreateCallbackForPluginName(llvm::StringRef name);
- static const char *GetPlatformPluginNameAtIndex(uint32_t idx);
+ static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx);
- static const char *GetPlatformPluginDescriptionAtIndex(uint32_t idx);
+ static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx);
static void AutoCompletePlatformName(llvm::StringRef partial_name,
CompletionRequest &request);
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index d1351d5c729b4..adf6d865ab184 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -223,7 +223,7 @@ class Platform : public PluginInterface {
virtual ConstString GetFullNameForDylib(ConstString basename);
- virtual const char *GetDescription() = 0;
+ virtual llvm::StringRef GetDescription() = 0;
/// Report the current status for this platform.
///
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index d044061fb0e40..c22662d764a7f 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -1114,7 +1114,7 @@ uint32_t SBDebugger::GetNumAvailablePlatforms() {
uint32_t idx = 0;
while (true) {
- if (!PluginManager::GetPlatformPluginNameAtIndex(idx)) {
+ if (PluginManager::GetPlatformPluginNameAtIndex(idx).empty()) {
break;
}
++idx;
@@ -1137,18 +1137,15 @@ SBStructuredData SBDebugger::GetAvailablePlatformInfoAtIndex(uint32_t idx) {
platform_dict->AddStringItem(
desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
} else if (idx > 0) {
- const char *plugin_name =
+ llvm::StringRef plugin_name =
PluginManager::GetPlatformPluginNameAtIndex(idx - 1);
- if (!plugin_name) {
+ if (plugin_name.empty()) {
return LLDB_RECORD_RESULT(data);
}
platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
- const char *plugin_desc =
+ llvm::StringRef plugin_desc =
PluginManager::GetPlatformPluginDescriptionAtIndex(idx - 1);
- if (!plugin_desc) {
- return LLDB_RECORD_RESULT(data);
- }
platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
}
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index 188d85389b7fa..10dd878249116 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -216,15 +216,13 @@ class CommandObjectPlatformList : public CommandObjectParsed {
uint32_t idx;
for (idx = 0; true; ++idx) {
- const char *plugin_name =
+ llvm::StringRef plugin_name =
PluginManager::GetPlatformPluginNameAtIndex(idx);
- if (plugin_name == nullptr)
+ if (plugin_name.empty())
break;
- const char *plugin_desc =
+ llvm::StringRef plugin_desc =
PluginManager::GetPlatformPluginDescriptionAtIndex(idx);
- if (plugin_desc == nullptr)
- break;
- ostrm.Printf("%s: %s\n", plugin_name, plugin_desc);
+ ostrm.Format("{0}: {1}\n", plugin_name, plugin_desc);
}
if (idx == 0) {
diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 71e8365e25118..054b75a3fed28 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1642,8 +1642,10 @@ class PlatformPluginFieldDelegate : public ChoicesFieldDelegate {
std::vector<std::string> GetPossiblePluginNames() {
std::vector<std::string> names;
size_t i = 0;
- while (auto name = PluginManager::GetPlatformPluginNameAtIndex(i++))
- names.push_back(name);
+ for (llvm::StringRef name =
+ PluginManager::GetPlatformPluginNameAtIndex(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 ad2987f311fc9..fdf2aa7da4b32 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -778,22 +778,24 @@ static PlatformInstances &GetPlatformInstances() {
}
bool PluginManager::RegisterPlugin(
- ConstString name, const char *description,
+ llvm::StringRef name, llvm::StringRef description,
PlatformCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback) {
return GetPlatformInstances().RegisterPlugin(
- name, description, create_callback, debugger_init_callback);
+ ConstString(name), description.str().c_str(), create_callback,
+ debugger_init_callback);
}
bool PluginManager::UnregisterPlugin(PlatformCreateInstance create_callback) {
return GetPlatformInstances().UnregisterPlugin(create_callback);
}
-const char *PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
+llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
return GetPlatformInstances().GetNameAtIndex(idx);
}
-const char *PluginManager::GetPlatformPluginDescriptionAtIndex(uint32_t idx) {
+llvm::StringRef
+PluginManager::GetPlatformPluginDescriptionAtIndex(uint32_t idx) {
return GetPlatformInstances().GetDescriptionAtIndex(idx);
}
@@ -803,8 +805,8 @@ PluginManager::GetPlatformCreateCallbackAtIndex(uint32_t idx) {
}
PlatformCreateInstance
-PluginManager::GetPlatformCreateCallbackForPluginName(ConstString name) {
- return GetPlatformInstances().GetCallbackForName(name);
+PluginManager::GetPlatformCreateCallbackForPluginName(llvm::StringRef name) {
+ return GetPlatformInstances().GetCallbackForName(ConstString(name));
}
void PluginManager::AutoCompletePlatformName(llvm::StringRef name,
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index 5c5eb60f4d402..a5abce7de3aef 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -510,8 +510,8 @@ DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel(Process *process,
m_kext_summary_header(), m_known_kexts(), m_mutex(),
m_break_id(LLDB_INVALID_BREAK_ID) {
Status error;
- PlatformSP platform_sp(
- Platform::Create(PlatformDarwinKernel::GetPluginNameStatic(), error));
+ PlatformSP platform_sp(Platform::Create(
+ ConstString(PlatformDarwinKernel::GetPluginNameStatic()), error));
if (platform_sp.get())
process->GetTarget().SetPlatform(platform_sp);
}
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index a9bae540cda7b..3d48bd10b6145 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -129,21 +129,10 @@ PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) {
PlatformAndroid::PlatformAndroid(bool is_host)
: PlatformLinux(is_host), m_sdk_version(0) {}
-ConstString PlatformAndroid::GetPluginNameStatic(bool is_host) {
- if (is_host) {
- static ConstString g_host_name(Platform::GetHostPlatformName());
- return g_host_name;
- } else {
- static ConstString g_remote_name("remote-android");
- return g_remote_name;
- }
-}
-
-const char *PlatformAndroid::GetPluginDescriptionStatic(bool is_host) {
+llvm::StringRef PlatformAndroid::GetPluginDescriptionStatic(bool is_host) {
if (is_host)
return "Local Android user platform plug-in.";
- else
- return "Remote Android user platform plug-in.";
+ return "Remote Android user platform plug-in.";
}
Status PlatformAndroid::ConnectRemote(Args &args) {
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h
index dd1f0c0427d7f..1a66ddebb2438 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h
@@ -30,12 +30,14 @@ class PlatformAndroid : public platform_linux::PlatformLinux {
// lldb_private::PluginInterface functions
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
- static ConstString GetPluginNameStatic(bool is_host);
+ static llvm::StringRef GetPluginNameStatic(bool is_host) {
+ return is_host ? Platform::GetHostPlatformName() : "remote-android";
+ }
- static const char *GetPluginDescriptionStatic(bool is_host);
+ static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic(IsHost()).GetStringRef();
+ return GetPluginNameStatic(IsHost());
}
// lldb_private::Platform functions
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
index d44a9108bb528..ffd92d4fb848d 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -76,21 +76,10 @@ PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) {
return PlatformSP();
}
-ConstString PlatformFreeBSD::GetPluginNameStatic(bool is_host) {
- if (is_host) {
- static ConstString g_host_name(Platform::GetHostPlatformName());
- return g_host_name;
- } else {
- static ConstString g_remote_name("remote-freebsd");
- return g_remote_name;
- }
-}
-
-const char *PlatformFreeBSD::GetPluginDescriptionStatic(bool is_host) {
+llvm::StringRef PlatformFreeBSD::GetPluginDescriptionStatic(bool is_host) {
if (is_host)
return "Local FreeBSD user platform plug-in.";
- else
- return "Remote FreeBSD user platform plug-in.";
+ return "Remote FreeBSD user platform plug-in.";
}
void PlatformFreeBSD::Initialize() {
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
index 16a28dacd26fa..b4d2f740bed9a 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
@@ -25,16 +25,18 @@ class PlatformFreeBSD : public PlatformPOSIX {
// lldb_private::PluginInterface functions
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
- static ConstString GetPluginNameStatic(bool is_host);
+ static llvm::StringRef GetPluginNameStatic(bool is_host) {
+ return is_host ? Platform::GetHostPlatformName() : "remote-freebsd";
+ }
- static const char *GetPluginDescriptionStatic(bool is_host);
+ static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic(IsHost()).GetStringRef();
+ return GetPluginNameStatic(IsHost());
}
// lldb_private::Platform functions
- const char *GetDescription() override {
+ llvm::StringRef GetDescription() override {
return GetPluginDescriptionStatic(IsHost());
}
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index 34a7df9cf0357..52c86d7a1328b 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -72,21 +72,10 @@ PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) {
return PlatformSP();
}
-ConstString PlatformLinux::GetPluginNameStatic(bool is_host) {
- if (is_host) {
- static ConstString g_host_name(Platform::GetHostPlatformName());
- return g_host_name;
- } else {
- static ConstString g_remote_name("remote-linux");
- return g_remote_name;
- }
-}
-
-const char *PlatformLinux::GetPluginDescriptionStatic(bool is_host) {
+llvm::StringRef PlatformLinux::GetPluginDescriptionStatic(bool is_host) {
if (is_host)
return "Local Linux user platform plug-in.";
- else
- return "Remote Linux user platform plug-in.";
+ return "Remote Linux user platform plug-in.";
}
void PlatformLinux::Initialize() {
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
index 71f54105be884..0dca31273fde0 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -25,16 +25,18 @@ class PlatformLinux : public PlatformPOSIX {
// lldb_private::PluginInterface functions
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
- static ConstString GetPluginNameStatic(bool is_host);
+ static llvm::StringRef GetPluginNameStatic(bool is_host) {
+ return is_host ? Platform::GetHostPlatformName() : "remote-linux";
+ }
- static const char *GetPluginDescriptionStatic(bool is_host);
+ static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic(IsHost()).GetStringRef();
+ return GetPluginNameStatic(IsHost());
}
// lldb_private::Platform functions
- const char *GetDescription() override {
+ llvm::StringRef GetDescription() override {
return GetPluginDescriptionStatic(IsHost());
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
index cdc3bed2c0bf3..583399073c580 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
@@ -49,7 +49,7 @@ class PlatformAppleSimulator : public PlatformDarwin {
llvm::StringRef GetPluginName() override {
return m_plugin_name.GetStringRef();
}
- const char *GetDescription() override { return m_description; }
+ llvm::StringRef GetDescription() override { return m_description; }
lldb_private::Status
LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 4bc95ff8425d7..823c5a2fd198b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -166,12 +166,7 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
return PlatformSP();
}
-lldb_private::ConstString PlatformDarwinKernel::GetPluginNameStatic() {
- static ConstString g_name("darwin-kernel");
- return g_name;
-}
-
-const char *PlatformDarwinKernel::GetDescriptionStatic() {
+llvm::StringRef PlatformDarwinKernel::GetDescriptionStatic() {
return "Darwin Kernel platform plug-in.";
}
@@ -943,19 +938,4 @@ void PlatformDarwinKernel::CalculateTrapHandlerSymbolNames() {
m_trap_handlers.push_back(ConstString("fleh_dec"));
}
-#else // __APPLE__
-
-// Since DynamicLoaderDarwinKernel is compiled in for all systems, and relies
-// on PlatformDarwinKernel for the plug-in name, we compile just the plug-in
-// name in here to avoid issues. We are tracking an internal bug to resolve
-// this issue by either not compiling in DynamicLoaderDarwinKernel for non-
-// apple builds, or to make PlatformDarwinKernel build on all systems.
-// PlatformDarwinKernel is currently not compiled on other platforms due to the
-// use of the Mac-specific source/Host/macosx/cfcpp utilities.
-
-lldb_private::ConstString PlatformDarwinKernel::GetPluginNameStatic() {
- static lldb_private::ConstString g_name("darwin-kernel");
- return g_name;
-}
-
#endif // __APPLE__
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
index 60b7945dae9c7..4cb6c10fb8334 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
@@ -32,9 +32,9 @@ class PlatformDarwinKernel : public PlatformDarwin {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "darwin-kernel"; }
- static const char *GetDescriptionStatic();
+ static llvm::StringRef GetDescriptionStatic();
// Class Methods
PlatformDarwinKernel(lldb_private::LazyBool is_ios_debug_session);
@@ -42,12 +42,10 @@ class PlatformDarwinKernel : public PlatformDarwin {
virtual ~PlatformDarwinKernel();
// lldb_private::PluginInterface functions
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// lldb_private::Platform functions
- const char *GetDescription() override { return GetDescriptionStatic(); }
+ llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
void GetStatus(lldb_private::Stream &strm) override;
@@ -221,7 +219,7 @@ class PlatformDarwinKernel : public PlatformDarwin {
class PlatformDarwinKernel {
public:
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "darwin-kernel"; }
};
#endif // __APPLE__
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index 24df03e18dda8..ac9604f681a09 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -85,12 +85,7 @@ void PlatformMacOSX::Terminate() {
PlatformDarwin::Terminate();
}
-lldb_private::ConstString PlatformMacOSX::GetPluginNameStatic() {
- static ConstString g_host_name(Platform::GetHostPlatformName());
- return g_host_name;
-}
-
-const char *PlatformMacOSX::GetDescriptionStatic() {
+llvm::StringRef PlatformMacOSX::GetDescriptionStatic() {
return "Local Mac OS X user platform plug-in.";
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
index 5201c5605945f..404f93348dfa9 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
@@ -23,14 +23,14 @@ class PlatformMacOSX : public PlatformDarwin {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() {
+ return Platform::GetHostPlatformName();
+ }
- static const char *GetDescriptionStatic();
+ static llvm::StringRef GetDescriptionStatic();
// lldb_private::PluginInterface functions
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
lldb_private::Status
GetSharedModule(const lldb_private::ModuleSpec &module_spec,
@@ -39,7 +39,7 @@ class PlatformMacOSX : public PlatformDarwin {
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
bool *did_create_ptr) override;
- const char *GetDescription() override { return GetDescriptionStatic(); }
+ llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
lldb_private::Status
GetFile(const lldb_private::FileSpec &source,
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
index f3ee92a9d27bc..b7ba2ea29bf68 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
@@ -133,12 +133,7 @@ PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force,
return lldb::PlatformSP();
}
-lldb_private::ConstString PlatformRemoteAppleBridge::GetPluginNameStatic() {
- static ConstString g_name("remote-bridgeos");
- return g_name;
-}
-
-const char *PlatformRemoteAppleBridge::GetDescriptionStatic() {
+llvm::StringRef PlatformRemoteAppleBridge::GetDescriptionStatic() {
return "Remote BridgeOS platform plug-in.";
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
index 96546c6238ce8..1f4a0b0b0d4dd 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
@@ -29,18 +29,16 @@ class PlatformRemoteAppleBridge : public PlatformRemoteDarwinDevice {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "remote-bridgeos"; }
- static const char *GetDescriptionStatic();
+ static llvm::StringRef GetDescriptionStatic();
// lldb_private::PluginInterface functions
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// lldb_private::Platform functions
- const char *GetDescription() override { return GetDescriptionStatic(); }
+ llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
bool GetSupportedArchitectureAtIndex(uint32_t idx,
lldb_private::ArchSpec &arch) override;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
index 15e91b239a35c..42d0de0e36c79 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
@@ -128,12 +128,7 @@ PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force,
return lldb::PlatformSP();
}
-lldb_private::ConstString PlatformRemoteAppleTV::GetPluginNameStatic() {
- static ConstString g_name("remote-tvos");
- return g_name;
-}
-
-const char *PlatformRemoteAppleTV::GetDescriptionStatic() {
+llvm::StringRef PlatformRemoteAppleTV::GetDescriptionStatic() {
return "Remote Apple TV platform plug-in.";
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
index 84c42a2f4917d..ce120082a74fe 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
@@ -29,18 +29,16 @@ class PlatformRemoteAppleTV : public PlatformRemoteDarwinDevice {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "remote-tvos"; }
- static const char *GetDescriptionStatic();
+ static llvm::StringRef GetDescriptionStatic();
// lldb_private::PluginInterface functions
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// lldb_private::Platform functions
- const char *GetDescription() override { return GetDescriptionStatic(); }
+ llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
bool GetSupportedArchitectureAtIndex(uint32_t idx,
lldb_private::ArchSpec &arch) override;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
index 29162e11ec597..849ff3a50486c 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
@@ -135,12 +135,7 @@ PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force,
return lldb::PlatformSP();
}
-lldb_private::ConstString PlatformRemoteAppleWatch::GetPluginNameStatic() {
- static ConstString g_name("remote-watchos");
- return g_name;
-}
-
-const char *PlatformRemoteAppleWatch::GetDescriptionStatic() {
+llvm::StringRef PlatformRemoteAppleWatch::GetDescriptionStatic() {
return "Remote Apple Watch platform plug-in.";
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
index d0eebc6761119..abecbd7335052 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
@@ -30,18 +30,16 @@ class PlatformRemoteAppleWatch : public PlatformRemoteDarwinDevice {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "remote-watchos"; }
- static const char *GetDescriptionStatic();
+ static llvm::StringRef GetDescriptionStatic();
// lldb_private::Platform functions
- const char *GetDescription() override { return GetDescriptionStatic(); }
+ llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
// lldb_private::PluginInterface functions
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// lldb_private::Platform functions
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
index c654f3c4264f9..72c3480da6615 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
@@ -201,12 +201,7 @@ lldb_private::Status PlatformRemoteMacOSX::GetFileWithUUID(
return Status();
}
-lldb_private::ConstString PlatformRemoteMacOSX::GetPluginNameStatic() {
- static ConstString g_name("remote-macosx");
- return g_name;
-}
-
-const char *PlatformRemoteMacOSX::GetDescriptionStatic() {
+llvm::StringRef PlatformRemoteMacOSX::GetDescriptionStatic() {
return "Remote Mac OS X user platform plug-in.";
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
index 290a1957be9db..83335cda1f807 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
@@ -29,15 +29,13 @@ class PlatformRemoteMacOSX : public virtual PlatformRemoteDarwinDevice {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "remote-macosx"; }
- static const char *GetDescriptionStatic();
+ static llvm::StringRef GetDescriptionStatic();
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
- const char *GetDescription() override { return GetDescriptionStatic(); }
+ llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
lldb_private::Status
GetFileWithUUID(const lldb_private::FileSpec &platform_file,
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index 3269345f3549e..8824cab2fff28 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -125,12 +125,7 @@ PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) {
return lldb::PlatformSP();
}
-lldb_private::ConstString PlatformRemoteiOS::GetPluginNameStatic() {
- static ConstString g_name("remote-ios");
- return g_name;
-}
-
-const char *PlatformRemoteiOS::GetDescriptionStatic() {
+llvm::StringRef PlatformRemoteiOS::GetDescriptionStatic() {
return "Remote iOS platform plug-in.";
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
index 6b78768e80fb3..302df33fc116b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
@@ -28,18 +28,16 @@ class PlatformRemoteiOS : public PlatformRemoteDarwinDevice {
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "remote-ios"; }
- static const char *GetDescriptionStatic();
+ static llvm::StringRef GetDescriptionStatic();
// lldb_private::Platform functions
- const char *GetDescription() override { return GetDescriptionStatic(); }
+ llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
// lldb_private::PluginInterface functions
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
bool GetSupportedArchitectureAtIndex(uint32_t idx,
lldb_private::ArchSpec &arch) override;
diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
index a6972ff37c9a5..3432dcec650d7 100644
--- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
+++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
@@ -65,21 +65,10 @@ PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) {
return PlatformSP();
}
-ConstString PlatformNetBSD::GetPluginNameStatic(bool is_host) {
- if (is_host) {
- static ConstString g_host_name(Platform::GetHostPlatformName());
- return g_host_name;
- } else {
- static ConstString g_remote_name("remote-netbsd");
- return g_remote_name;
- }
-}
-
-const char *PlatformNetBSD::GetPluginDescriptionStatic(bool is_host) {
+llvm::StringRef PlatformNetBSD::GetPluginDescriptionStatic(bool is_host) {
if (is_host)
return "Local NetBSD user platform plug-in.";
- else
- return "Remote NetBSD user platform plug-in.";
+ return "Remote NetBSD user platform plug-in.";
}
void PlatformNetBSD::Initialize() {
diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
index b25f5dcb967fc..383965a72c38b 100644
--- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
+++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
@@ -25,16 +25,18 @@ class PlatformNetBSD : public PlatformPOSIX {
// lldb_private::PluginInterface functions
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
- static ConstString GetPluginNameStatic(bool is_host);
+ static llvm::StringRef GetPluginNameStatic(bool is_host) {
+ return is_host ? Platform::GetHostPlatformName() : "remote-netbsd";
+ }
- static const char *GetPluginDescriptionStatic(bool is_host);
+ static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic(IsHost()).GetStringRef();
+ return GetPluginNameStatic(IsHost());
}
// lldb_private::Platform functions
- const char *GetDescription() override {
+ llvm::StringRef GetDescription() override {
return GetPluginDescriptionStatic(IsHost());
}
diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
index b5bb2ea9ef68a..7fcc30b92d295 100644
--- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
+++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
@@ -71,21 +71,10 @@ PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch) {
return PlatformSP();
}
-ConstString PlatformOpenBSD::GetPluginNameStatic(bool is_host) {
- if (is_host) {
- static ConstString g_host_name(Platform::GetHostPlatformName());
- return g_host_name;
- } else {
- static ConstString g_remote_name("remote-openbsd");
- return g_remote_name;
- }
-}
-
-const char *PlatformOpenBSD::GetPluginDescriptionStatic(bool is_host) {
+llvm::StringRef PlatformOpenBSD::GetPluginDescriptionStatic(bool is_host) {
if (is_host)
return "Local OpenBSD user platform plug-in.";
- else
- return "Remote OpenBSD user platform plug-in.";
+ return "Remote OpenBSD user platform plug-in.";
}
void PlatformOpenBSD::Initialize() {
diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
index 8da2d7506666e..81680fe81e6f5 100644
--- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
+++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
@@ -25,16 +25,18 @@ class PlatformOpenBSD : public PlatformPOSIX {
// lldb_private::PluginInterface functions
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
- static ConstString GetPluginNameStatic(bool is_host);
+ static llvm::StringRef GetPluginNameStatic(bool is_host) {
+ return is_host ? Platform::GetHostPlatformName() : "remote-openbsd";
+ }
- static const char *GetPluginDescriptionStatic(bool is_host);
+ static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic(IsHost()).GetStringRef();
+ return GetPluginNameStatic(IsHost());
}
// lldb_private::Platform functions
- const char *GetDescription() override {
+ llvm::StringRef GetDescription() override {
return GetPluginDescriptionStatic(IsHost());
}
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index b7beddf4e0576..f991e127d0e22 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -101,17 +101,7 @@ PlatformSP PlatformWindows::CreateInstance(bool force,
return PlatformSP();
}
-lldb_private::ConstString PlatformWindows::GetPluginNameStatic(bool is_host) {
- if (is_host) {
- static ConstString g_host_name(Platform::GetHostPlatformName());
- return g_host_name;
- } else {
- static ConstString g_remote_name("remote-windows");
- return g_remote_name;
- }
-}
-
-const char *PlatformWindows::GetPluginDescriptionStatic(bool is_host) {
+llvm::StringRef PlatformWindows::GetPluginDescriptionStatic(bool is_host) {
return is_host ? "Local Windows user platform plug-in."
: "Remote Windows user platform plug-in.";
}
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
index 2a0247d8c895e..672c94f0e7817 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
@@ -25,16 +25,18 @@ class PlatformWindows : public RemoteAwarePlatform {
static lldb::PlatformSP CreateInstance(bool force,
const lldb_private::ArchSpec *arch);
- static lldb_private::ConstString GetPluginNameStatic(bool is_host);
+ static llvm::StringRef GetPluginNameStatic(bool is_host) {
+ return is_host ? Platform::GetHostPlatformName() : "remote-windows";
+ }
- static const char *GetPluginDescriptionStatic(bool is_host);
+ static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic(IsHost()).GetStringRef();
+ return GetPluginNameStatic(IsHost());
}
// lldb_private::Platform functions
- const char *GetDescription() override {
+ llvm::StringRef GetDescription() override {
return GetPluginDescriptionStatic(IsHost());
}
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index cc3d79cef10c6..851d6291591a8 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -72,17 +72,12 @@ PlatformSP PlatformRemoteGDBServer::CreateInstance(bool force,
return PlatformSP();
}
-ConstString PlatformRemoteGDBServer::GetPluginNameStatic() {
- static ConstString g_name("remote-gdb-server");
- return g_name;
-}
-
-const char *PlatformRemoteGDBServer::GetDescriptionStatic() {
+llvm::StringRef PlatformRemoteGDBServer::GetDescriptionStatic() {
return "A platform that uses the GDB remote protocol as the communication "
"transport.";
}
-const char *PlatformRemoteGDBServer::GetDescription() {
+llvm::StringRef PlatformRemoteGDBServer::GetDescription() {
if (m_platform_description.empty()) {
if (IsConnected()) {
// Send the get description packet
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
index ff487b3d1064b..b5e52e0219828 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -28,18 +28,16 @@ class PlatformRemoteGDBServer : public Platform, private UserIDResolver {
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
- static ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "remote-gdb-server"; }
- static const char *GetDescriptionStatic();
+ static llvm::StringRef GetDescriptionStatic();
PlatformRemoteGDBServer();
~PlatformRemoteGDBServer() override;
// lldb_private::PluginInterface functions
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// lldb_private::Platform functions
Status
@@ -49,7 +47,7 @@ class PlatformRemoteGDBServer : public Platform, private UserIDResolver {
bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
ModuleSpec &module_spec) override;
- const char *GetDescription() override;
+ llvm::StringRef GetDescription() override;
Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid_ptr,
FileSpec &local_file) override;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index d128be3ab07bb..0edb356a5558f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2349,9 +2349,9 @@ Status ProcessGDBRemote::DoDestroy() {
m_public_state.GetValue() != eStateRunning) {
PlatformSP platform_sp = GetTarget().GetPlatform();
- // FIXME: These should be ConstStrings so we aren't doing strcmp'ing.
if (platform_sp && platform_sp->GetName() &&
- platform_sp->GetName() == PlatformRemoteiOS::GetPluginNameStatic()) {
+ platform_sp->GetName().GetStringRef() ==
+ PlatformRemoteiOS::GetPluginNameStatic()) {
if (m_destroy_tried_resuming) {
if (log)
log->PutCString("ProcessGDBRemote::DoDestroy() - Tried resuming to "
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 24ea8c47e0cb1..6dd091b5b31d0 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -294,8 +294,8 @@ PlatformSP Platform::Create(ConstString name, Status &error) {
if (name == g_host_platform_name)
return GetHostPlatform();
- create_callback =
- PluginManager::GetPlatformCreateCallbackForPluginName(name);
+ create_callback = PluginManager::GetPlatformCreateCallbackForPluginName(
+ name.GetStringRef());
if (create_callback)
platform_sp = create_callback(true, nullptr);
else
diff --git a/lldb/unittests/Target/RemoteAwarePlatformTest.cpp b/lldb/unittests/Target/RemoteAwarePlatformTest.cpp
index b96fbb8731cfd..e2851e669b45f 100644
--- a/lldb/unittests/Target/RemoteAwarePlatformTest.cpp
+++ b/lldb/unittests/Target/RemoteAwarePlatformTest.cpp
@@ -24,7 +24,7 @@ class RemoteAwarePlatformTester : public RemoteAwarePlatform {
public:
using RemoteAwarePlatform::RemoteAwarePlatform;
- MOCK_METHOD0(GetDescription, const char *());
+ MOCK_METHOD0(GetDescription, llvm::StringRef());
MOCK_METHOD0(GetPluginName, llvm::StringRef());
MOCK_METHOD2(GetSupportedArchitectureAtIndex, bool(uint32_t, ArchSpec &));
MOCK_METHOD4(Attach,
@@ -40,7 +40,7 @@ class TargetPlatformTester : public Platform {
public:
using Platform::Platform;
- MOCK_METHOD0(GetDescription, const char *());
+ MOCK_METHOD0(GetDescription, llvm::StringRef());
MOCK_METHOD0(GetPluginName, llvm::StringRef());
MOCK_METHOD2(GetSupportedArchitectureAtIndex, bool(uint32_t, ArchSpec &));
MOCK_METHOD4(Attach,
More information about the lldb-commits
mailing list