diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h --- a/lldb/include/lldb/Core/PluginManager.h +++ b/lldb/include/lldb/Core/PluginManager.h @@ -121,7 +121,7 @@ GetEmulateInstructionCreateCallbackForPluginName(ConstString name); // OperatingSystem - static bool RegisterPlugin(ConstString name, const char *description, + static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, OperatingSystemCreateInstance create_callback, DebuggerInitializeCallback debugger_init_callback); @@ -131,7 +131,7 @@ GetOperatingSystemCreateCallbackAtIndex(uint32_t idx); static OperatingSystemCreateInstance - GetOperatingSystemCreateCallbackForPluginName(ConstString name); + GetOperatingSystemCreateCallbackForPluginName(llvm::StringRef name); // Language static bool RegisterPlugin(ConstString name, const char *description, @@ -170,7 +170,7 @@ // ObjectFile static bool - RegisterPlugin(ConstString name, const char *description, + RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ObjectFileCreateInstance create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, @@ -188,16 +188,16 @@ GetObjectFileGetModuleSpecificationsCallbackAtIndex(uint32_t idx); static ObjectFileCreateMemoryInstance - GetObjectFileCreateMemoryCallbackForPluginName(ConstString name); + GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name); static Status SaveCore(const lldb::ProcessSP &process_sp, const FileSpec &outfile, lldb::SaveCoreStyle &core_style, - const ConstString plugin_name); + llvm::StringRef plugin_name); // ObjectContainer static bool - RegisterPlugin(ConstString name, const char *description, + RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ObjectContainerCreateInstance create_callback, ObjectFileGetModuleSpecifications get_module_specifications); diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -1228,8 +1228,7 @@ FileSpec core_file(file_name); SaveCoreStyle core_style = SaveCoreStyle::eSaveCoreFull; - error.ref() = - PluginManager::SaveCore(process_sp, core_file, core_style, ConstString()); + error.ref() = PluginManager::SaveCore(process_sp, core_file, core_style, ""); return LLDB_RECORD_RESULT(error); } diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -1216,7 +1216,7 @@ switch (short_option) { case 'p': - m_requested_plugin_name.SetString(option_arg); + m_requested_plugin_name = option_arg.str(); break; case 's': m_requested_save_core_style = @@ -1233,12 +1233,12 @@ void OptionParsingStarting(ExecutionContext *execution_context) override { m_requested_save_core_style = eSaveCoreUnspecified; - m_requested_plugin_name.Clear(); + m_requested_plugin_name.clear(); } // Instance variables to hold the values for command options. SaveCoreStyle m_requested_save_core_style; - ConstString m_requested_plugin_name; + std::string m_requested_plugin_name; }; protected: diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -473,11 +473,12 @@ } bool PluginManager::RegisterPlugin( - ConstString name, const char *description, + llvm::StringRef name, llvm::StringRef description, OperatingSystemCreateInstance create_callback, DebuggerInitializeCallback debugger_init_callback) { return GetOperatingSystemInstances().RegisterPlugin( - name, description, create_callback, debugger_init_callback); + ConstString(name), description.str().c_str(), create_callback, + debugger_init_callback); } bool PluginManager::UnregisterPlugin( @@ -491,8 +492,9 @@ } OperatingSystemCreateInstance -PluginManager::GetOperatingSystemCreateCallbackForPluginName(ConstString name) { - return GetOperatingSystemInstances().GetCallbackForName(name); +PluginManager::GetOperatingSystemCreateCallbackForPluginName( + llvm::StringRef name) { + return GetOperatingSystemInstances().GetCallbackForName(ConstString(name)); } #pragma mark Language @@ -635,14 +637,14 @@ } bool PluginManager::RegisterPlugin( - ConstString name, const char *description, + llvm::StringRef name, llvm::StringRef description, ObjectFileCreateInstance create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, ObjectFileSaveCore save_core) { return GetObjectFileInstances().RegisterPlugin( - name, description, create_callback, create_memory_callback, - get_module_specifications, save_core); + ConstString(name), description.str().c_str(), create_callback, + create_memory_callback, get_module_specifications, save_core); } bool PluginManager::UnregisterPlugin(ObjectFileCreateInstance create_callback) { @@ -673,12 +675,10 @@ ObjectFileCreateMemoryInstance PluginManager::GetObjectFileCreateMemoryCallbackForPluginName( - ConstString name) { - if (!name) - return nullptr; + llvm::StringRef name) { const auto &instances = GetObjectFileInstances().GetInstances(); for (auto &instance : instances) { - if (instance.name == name) + if (instance.name.GetStringRef() == name) return instance.create_memory_callback; } return nullptr; @@ -687,8 +687,8 @@ Status PluginManager::SaveCore(const lldb::ProcessSP &process_sp, const FileSpec &outfile, lldb::SaveCoreStyle &core_style, - const ConstString plugin_name) { - if (!plugin_name) { + llvm::StringRef plugin_name) { + if (plugin_name.empty()) { // Try saving core directly from the process plugin first. llvm::Expected ret = process_sp->SaveCore(outfile.GetPath()); if (!ret) @@ -701,7 +701,7 @@ Status error; auto &instances = GetObjectFileInstances().GetInstances(); for (auto &instance : instances) { - if (plugin_name && instance.name != plugin_name) + if (instance.name.GetStringRef() != plugin_name) continue; if (instance.save_core && instance.save_core(process_sp, outfile, core_style, error)) @@ -733,11 +733,12 @@ } bool PluginManager::RegisterPlugin( - ConstString name, const char *description, + llvm::StringRef name, llvm::StringRef description, ObjectContainerCreateInstance create_callback, ObjectFileGetModuleSpecifications get_module_specifications) { return GetObjectContainerInstances().RegisterPlugin( - name, description, create_callback, get_module_specifications); + ConstString(name), description.str().c_str(), create_callback, + get_module_specifications); } bool PluginManager::UnregisterPlugin( diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h @@ -36,9 +36,11 @@ static void Terminate(); - static lldb_private::ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "bsd-archive"; } - static const char *GetPluginDescriptionStatic(); + static llvm::StringRef GetPluginDescriptionStatic() { + return "BSD Archive object container reader."; + } static lldb_private::ObjectContainer * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, @@ -68,9 +70,7 @@ lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override; // PluginInterface protocol - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } protected: struct Object { diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -274,15 +274,6 @@ PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString ObjectContainerBSDArchive::GetPluginNameStatic() { - static ConstString g_name("bsd-archive"); - return g_name; -} - -const char *ObjectContainerBSDArchive::GetPluginDescriptionStatic() { - return "BSD Archive object container reader."; -} - ObjectContainer *ObjectContainerBSDArchive::CreateInstance( const lldb::ModuleSP &module_sp, DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h --- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h +++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h @@ -28,9 +28,11 @@ static void Terminate(); - static lldb_private::ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "mach-o"; } - static const char *GetPluginDescriptionStatic(); + static llvm::StringRef GetPluginDescriptionStatic() { + return "Universal mach-o object container reader."; + } static lldb_private::ObjectContainer * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, @@ -59,9 +61,7 @@ lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override; // PluginInterface protocol - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } protected: llvm::MachO::fat_header m_header; diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp --- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp +++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp @@ -33,15 +33,6 @@ PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString ObjectContainerUniversalMachO::GetPluginNameStatic() { - static ConstString g_name("mach-o"); - return g_name; -} - -const char *ObjectContainerUniversalMachO::GetPluginDescriptionStatic() { - return "Universal mach-o object container reader."; -} - ObjectContainer *ObjectContainerUniversalMachO::CreateInstance( const lldb::ModuleSP &module_sp, DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h --- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h +++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h @@ -21,7 +21,7 @@ static void Initialize(); static void Terminate(); - static ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "breakpad"; } static const char *GetPluginDescriptionStatic() { return "Breakpad object file reader."; } @@ -44,9 +44,7 @@ ModuleSpecList &specs); // PluginInterface protocol - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } // LLVM RTTI support static char ID; diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp --- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp +++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp @@ -56,11 +56,6 @@ PluginManager::UnregisterPlugin(CreateInstance); } -ConstString ObjectFileBreakpad::GetPluginNameStatic() { - static ConstString g_name("breakpad"); - return g_name; -} - ObjectFile *ObjectFileBreakpad::CreateInstance( const ModuleSP &module_sp, DataBufferSP &data_sp, offset_t data_offset, const FileSpec *file, offset_t file_offset, offset_t length) { diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -61,9 +61,11 @@ static void Terminate(); - static lldb_private::ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "elf"; } - static const char *GetPluginDescriptionStatic(); + static llvm::StringRef GetPluginDescriptionStatic() { + return "ELF object file reader."; + } static lldb_private::ObjectFile * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, @@ -85,9 +87,7 @@ lldb::addr_t length); // PluginInterface protocol - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } // LLVM RTTI support static char ID; diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -334,15 +334,6 @@ PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString ObjectFileELF::GetPluginNameStatic() { - static ConstString g_name("elf"); - return g_name; -} - -const char *ObjectFileELF::GetPluginDescriptionStatic() { - return "ELF object file reader."; -} - ObjectFile *ObjectFileELF::CreateInstance(const lldb::ModuleSP &module_sp, DataBufferSP &data_sp, lldb::offset_t data_offset, diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h +++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h @@ -26,9 +26,11 @@ static void Terminate(); - static lldb_private::ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "jit"; } - static const char *GetPluginDescriptionStatic(); + static llvm::StringRef GetPluginDescriptionStatic() { + return "JIT code object file"; + } static lldb_private::ObjectFile * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, @@ -96,9 +98,7 @@ ObjectFile::Strata CalculateStrata() override; // PluginInterface protocol - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } protected: lldb::ObjectFileJITDelegateWP m_delegate_wp; diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -53,15 +53,6 @@ PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString ObjectFileJIT::GetPluginNameStatic() { - static ConstString g_name("jit"); - return g_name; -} - -const char *ObjectFileJIT::GetPluginDescriptionStatic() { - return "JIT code object file"; -} - ObjectFile *ObjectFileJIT::CreateInstance(const lldb::ModuleSP &module_sp, DataBufferSP &data_sp, lldb::offset_t data_offset, diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h @@ -37,9 +37,11 @@ static void Terminate(); - static lldb_private::ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "mach-o"; } - static const char *GetPluginDescriptionStatic(); + static llvm::StringRef GetPluginDescriptionStatic() { + return "Mach-o object file reader (32 and 64 bit)"; + } static lldb_private::ObjectFile * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, @@ -146,9 +148,7 @@ bool AllowAssemblyEmulationUnwindPlans() override; // PluginInterface protocol - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } protected: static lldb_private::UUID diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -833,15 +833,6 @@ PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString ObjectFileMachO::GetPluginNameStatic() { - static ConstString g_name("mach-o"); - return g_name; -} - -const char *ObjectFileMachO::GetPluginDescriptionStatic() { - return "Mach-o object file reader (32 and 64 bit)"; -} - ObjectFile *ObjectFileMachO::CreateInstance(const lldb::ModuleSP &module_sp, DataBufferSP &data_sp, lldb::offset_t data_offset, diff --git a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h --- a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h +++ b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h @@ -29,15 +29,13 @@ static void Initialize(); static void Terminate(); - static lldb_private::ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "minidump"; } static const char *GetPluginDescriptionStatic() { return "Minidump object file."; } // PluginInterface protocol - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } static lldb_private::ObjectFile * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, diff --git a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp --- a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp +++ b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp @@ -32,11 +32,6 @@ PluginManager::UnregisterPlugin(CreateInstance); } -ConstString ObjectFileMinidump::GetPluginNameStatic() { - static ConstString g_name("minidump"); - return g_name; -} - ObjectFile *ObjectFileMinidump::CreateInstance( const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const lldb_private::FileSpec *file, diff --git a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h --- a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h +++ b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h @@ -22,7 +22,7 @@ static void Initialize(); static void Terminate(); - static ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "pdb"; } static const char *GetPluginDescriptionStatic() { return "PDB object file reader."; } @@ -48,9 +48,7 @@ ModuleSpecList &specs); // PluginInterface protocol - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } // LLVM RTTI support static char ID; diff --git a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp --- a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp +++ b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp @@ -46,11 +46,6 @@ PluginManager::UnregisterPlugin(CreateInstance); } -ConstString ObjectFilePDB::GetPluginNameStatic() { - static ConstString g_name("pdb"); - return g_name; -} - ArchSpec ObjectFilePDB::GetArchitecture() { auto dbi_stream = m_file_up->getPDBDbiStream(); if (!dbi_stream) { diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -57,9 +57,9 @@ static void Terminate(); - static lldb_private::ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "pe-coff"; } - static const char *GetPluginDescriptionStatic(); + static llvm::StringRef GetPluginDescriptionStatic(); static ObjectFile * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, @@ -130,9 +130,7 @@ ObjectFile::Strata CalculateStrata() override; // PluginInterface protocol - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } bool IsWindowsSubsystem(); diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -71,12 +71,7 @@ PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString ObjectFilePECOFF::GetPluginNameStatic() { - static ConstString g_name("pe-coff"); - return g_name; -} - -const char *ObjectFilePECOFF::GetPluginDescriptionStatic() { +llvm::StringRef ObjectFilePECOFF::GetPluginDescriptionStatic() { return "Portable Executable and Common Object File Format object file reader " "(32 and 64 bit)"; } diff --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h --- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h +++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h @@ -24,7 +24,7 @@ static void Initialize(); static void Terminate(); - static ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "wasm"; } static const char *GetPluginDescriptionStatic() { return "WebAssembly object file reader."; } @@ -48,9 +48,7 @@ /// PluginInterface protocol. /// \{ - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } /// \} /// LLVM RTTI support diff --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp --- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp +++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp @@ -86,11 +86,6 @@ PluginManager::UnregisterPlugin(CreateInstance); } -ConstString ObjectFileWasm::GetPluginNameStatic() { - static ConstString g_name("wasm"); - return g_name; -} - ObjectFile * ObjectFileWasm::CreateInstance(const ModuleSP &module_sp, DataBufferSP &data_sp, offset_t data_offset, const FileSpec *file, diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h @@ -36,14 +36,12 @@ static void Terminate(); - static lldb_private::ConstString GetPluginNameStatic(); + static llvm::StringRef GetPluginNameStatic() { return "python"; } - static const char *GetPluginDescriptionStatic(); + static llvm::StringRef GetPluginDescriptionStatic(); // lldb_private::PluginInterface Methods - llvm::StringRef GetPluginName() override { - return GetPluginNameStatic().GetStringRef(); - } + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } // lldb_private::OperatingSystem Methods bool UpdateThreadList(lldb_private::ThreadList &old_thread_list, diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -65,12 +65,7 @@ return nullptr; } -ConstString OperatingSystemPython::GetPluginNameStatic() { - static ConstString g_name("python"); - return g_name; -} - -const char *OperatingSystemPython::GetPluginDescriptionStatic() { +llvm::StringRef OperatingSystemPython::GetPluginDescriptionStatic() { return "Operating system plug-in that gathers OS information from a python " "class that implements the necessary OperatingSystem functionality."; } diff --git a/lldb/source/Target/OperatingSystem.cpp b/lldb/source/Target/OperatingSystem.cpp --- a/lldb/source/Target/OperatingSystem.cpp +++ b/lldb/source/Target/OperatingSystem.cpp @@ -17,10 +17,9 @@ const char *plugin_name) { OperatingSystemCreateInstance create_callback = nullptr; if (plugin_name) { - ConstString const_plugin_name(plugin_name); create_callback = PluginManager::GetOperatingSystemCreateCallbackForPluginName( - const_plugin_name); + plugin_name); if (create_callback) { std::unique_ptr instance_up( create_callback(process, true));