diff --git a/lldb/include/lldb/Core/PluginInterface.h b/lldb/include/lldb/Core/PluginInterface.h --- a/lldb/include/lldb/Core/PluginInterface.h +++ b/lldb/include/lldb/Core/PluginInterface.h @@ -9,7 +9,7 @@ #ifndef LLDB_CORE_PLUGININTERFACE_H #define LLDB_CORE_PLUGININTERFACE_H -#include "lldb/lldb-private.h" +#include "llvm/ADT/StringRef.h" namespace lldb_private { @@ -18,7 +18,7 @@ PluginInterface() = default; virtual ~PluginInterface() = default; - virtual ConstString GetPluginName() = 0; + virtual llvm::StringRef GetPluginName() = 0; PluginInterface(const PluginInterface &) = delete; PluginInterface &operator=(const PluginInterface &) = delete; diff --git a/lldb/include/lldb/Symbol/SymbolVendor.h b/lldb/include/lldb/Symbol/SymbolVendor.h --- a/lldb/include/lldb/Symbol/SymbolVendor.h +++ b/lldb/include/lldb/Symbol/SymbolVendor.h @@ -41,7 +41,7 @@ SymbolFile *GetSymbolFile() { return m_sym_file_up.get(); } // PluginInterface protocol - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { return "vendor-default"; } protected: std::unique_ptr m_sym_file_up; // A single symbol file. Subclasses diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -610,9 +610,8 @@ virtual Status DoLoadCore() { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support loading core files.", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support loading core files.", GetPluginName()); return error; } @@ -941,9 +940,9 @@ virtual Status DoAttachToProcessWithID(lldb::pid_t pid, const ProcessAttachInfo &attach_info) { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support attaching to a process by pid", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support attaching to a process by pid", + GetPluginName()); return error; } @@ -1026,9 +1025,8 @@ /// operation. virtual Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support launching processes", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support launching processes", GetPluginName()); return error; } @@ -1062,9 +1060,8 @@ /// \see Thread:Suspend() virtual Status DoResume() { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support resuming processes", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support resuming processes", GetPluginName()); return error; } @@ -1098,9 +1095,8 @@ /// otherwise. virtual Status DoHalt(bool &caused_stop) { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support halting processes", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support halting processes", GetPluginName()); return error; } @@ -1125,9 +1121,9 @@ /// false otherwise. virtual Status DoDetach(bool keep_stopped) { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support detaching from processes", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support detaching from processes", + GetPluginName()); return error; } @@ -1156,9 +1152,9 @@ /// Returns an error object. virtual Status DoSignal(int signal) { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support sending signals to processes", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support sending signals to processes", + GetPluginName()); return error; } @@ -1585,9 +1581,8 @@ /// The number of bytes that were actually written. virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error) { - error.SetErrorStringWithFormat( - "error: %s does not support writing to processes", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support writing to processes", GetPluginName()); return 0; } @@ -1669,9 +1664,9 @@ virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, Status &error) { - error.SetErrorStringWithFormat( - "error: %s does not support allocating in the debug process", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support allocating in the debug process", + GetPluginName()); return LLDB_INVALID_ADDRESS; } @@ -1924,9 +1919,9 @@ /// \btrue if the memory was deallocated, \bfalse otherwise. virtual Status DoDeallocateMemory(lldb::addr_t ptr) { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support deallocating in the debug process", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support deallocating in the debug process", + GetPluginName()); return error; } @@ -2044,17 +2039,15 @@ virtual Status EnableBreakpointSite(BreakpointSite *bp_site) { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support enabling breakpoints", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support enabling breakpoints", GetPluginName()); return error; } virtual Status DisableBreakpointSite(BreakpointSite *bp_site) { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support disabling breakpoints", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support disabling breakpoints", GetPluginName()); return error; } @@ -2813,9 +2806,10 @@ /// if the read failed. virtual llvm::Expected> DoReadMemoryTags(lldb::addr_t addr, size_t len, int32_t type) { - return llvm::createStringError(llvm::inconvertibleErrorCode(), - "%s does not support reading memory tags", - GetPluginName().GetCString()); + return llvm::createStringError( + llvm::inconvertibleErrorCode(), + llvm::formatv("{0} does not support reading memory tags", + GetPluginName())); } /// Does the final operation to write memory tags. E.g. sending a GDB packet. @@ -2838,8 +2832,10 @@ /// Status telling you whether the write succeeded. virtual Status DoWriteMemoryTags(lldb::addr_t addr, size_t len, int32_t type, const std::vector &tags) { - return Status("%s does not support writing memory tags", - GetPluginName().GetCString()); + Status status; + status.SetErrorStringWithFormatv("{0} does not support writing memory tags", + GetPluginName()); + return status; } // Type definitions diff --git a/lldb/include/lldb/Target/ProcessTrace.h b/lldb/include/lldb/Target/ProcessTrace.h --- a/lldb/include/lldb/Target/ProcessTrace.h +++ b/lldb/include/lldb/Target/ProcessTrace.h @@ -40,7 +40,9 @@ SystemRuntime *GetSystemRuntime() override { return nullptr; } - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } Status DoDestroy() override; @@ -48,9 +50,8 @@ Status WillResume() override { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support resuming processes", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support resuming processes", GetPluginName()); return error; } diff --git a/lldb/include/lldb/Target/TraceExporter.h b/lldb/include/lldb/Target/TraceExporter.h --- a/lldb/include/lldb/Target/TraceExporter.h +++ b/lldb/include/lldb/Target/TraceExporter.h @@ -10,6 +10,8 @@ #define LLDB_TARGET_TRACE_EXPORTER_H #include "lldb/Core/PluginInterface.h" +#include "lldb/lldb-forward.h" +#include "llvm/Support/Error.h" namespace lldb_private { diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -1133,8 +1133,7 @@ if (idx == 0) { PlatformSP host_platform_sp(Platform::GetHostPlatform()); - platform_dict->AddStringItem( - name_str, host_platform_sp->GetPluginName().GetStringRef()); + platform_dict->AddStringItem(name_str, host_platform_sp->GetPluginName()); platform_dict->AddStringItem( desc_str, llvm::StringRef(host_platform_sp->GetDescription())); } else if (idx > 0) { 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 @@ -88,7 +88,7 @@ ProcessSP process_sp(GetSP()); if (process_sp) { - return process_sp->GetPluginName().GetCString(); + return ConstString(process_sp->GetPluginName()).GetCString(); } return ""; } @@ -98,7 +98,7 @@ ProcessSP process_sp(GetSP()); if (process_sp) { - return process_sp->GetPluginName().GetCString(); + return ConstString(process_sp->GetPluginName()).GetCString(); } return ""; } diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -211,7 +211,7 @@ ostrm.Printf("Available platforms:\n"); PlatformSP host_platform_sp(Platform::GetHostPlatform()); - ostrm.Printf("%s: %s\n", host_platform_sp->GetPluginName().GetCString(), + ostrm.Format("{0}: {1}\n", host_platform_sp->GetPluginName(), host_platform_sp->GetDescription()); uint32_t idx; @@ -346,8 +346,8 @@ if (error.Success()) { Stream &ostrm = result.GetOutputStream(); if (hostname.empty()) - ostrm.Printf("Disconnected from \"%s\"\n", - platform_sp->GetPluginName().GetCString()); + ostrm.Format("Disconnected from \"{0}\"\n", + platform_sp->GetPluginName()); else ostrm.Printf("Disconnected from \"%s\"\n", hostname.c_str()); result.SetStatus(eReturnStatusSuccessFinishResult); @@ -356,9 +356,8 @@ } } else { // Not connected... - result.AppendErrorWithFormat( - "not connected to '%s'", - platform_sp->GetPluginName().GetCString()); + result.AppendErrorWithFormatv("not connected to '{0}'", + platform_sp->GetPluginName()); } } else { // Bad args @@ -1289,15 +1288,14 @@ if (matches == 0) { if (match_desc) - result.AppendErrorWithFormat( - "no processes were found that %s \"%s\" on the \"%s\" " + result.AppendErrorWithFormatv( + "no processes were found that {0} \"{1}\" on the \"{2}\" " "platform\n", - match_desc, match_name, - platform_sp->GetPluginName().GetCString()); + match_desc, match_name, platform_sp->GetPluginName()); else - result.AppendErrorWithFormat( - "no processes were found on the \"%s\" platform\n", - platform_sp->GetPluginName().GetCString()); + result.AppendErrorWithFormatv( + "no processes were found on the \"{0}\" platform\n", + platform_sp->GetPluginName()); } else { result.AppendMessageWithFormat( "%u matching process%s found on \"%s\"", matches, @@ -1543,9 +1541,8 @@ } } else { // Not connected... - result.AppendErrorWithFormat( - "not connected to '%s'", - platform_sp->GetPluginName().GetCString()); + result.AppendErrorWithFormatv("not connected to '{0}'", + platform_sp->GetPluginName()); } } else { // No args diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -2199,9 +2199,8 @@ bool DoExecute(Args &command, CommandReturnObject &result) override { Target &target = m_exe_ctx.GetTargetRef(); - result.GetOutputStream().Printf( - "Trace technology: %s\n", - target.GetTrace()->GetPluginName().AsCString()); + result.GetOutputStream().Format("Trace technology: {0}\n", + target.GetTrace()->GetPluginName()); return CommandObjectIterateOverThreads::DoExecute(command, result); } diff --git a/lldb/source/Commands/CommandObjectTrace.cpp b/lldb/source/Commands/CommandObjectTrace.cpp --- a/lldb/source/Commands/CommandObjectTrace.cpp +++ b/lldb/source/Commands/CommandObjectTrace.cpp @@ -117,8 +117,8 @@ json_file.GetDirectory().AsCString())) { lldb::TraceSP trace_sp = traceOrErr.get(); if (m_options.m_verbose && trace_sp) - result.AppendMessageWithFormat("loading trace with plugin %s\n", - trace_sp->GetPluginName().AsCString()); + result.AppendMessageWithFormatv("loading trace with plugin {0}\n", + trace_sp->GetPluginName()); } else return end_with_failure(traceOrErr.takeError()); diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1423,10 +1423,9 @@ output_stream_sp->PutCString(content_stream.GetString()); } } else { - error_stream_sp->Printf("Failed to print structured " - "data with plugin %s: %s", - plugin_sp->GetPluginName().AsCString(), - error.AsCString()); + error_stream_sp->Format("Failed to print structured " + "data with plugin {0}: {1}", + plugin_sp->GetPluginName(), error); } } } diff --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h --- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h +++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h @@ -76,8 +76,8 @@ static lldb_private::ConstString GetPluginNameStatic(); - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } lldb_private::Status diff --git a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h --- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h +++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h @@ -81,7 +81,9 @@ // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } lldb::addr_t FixCodeAddress(lldb::addr_t pc) override; lldb::addr_t FixDataAddress(lldb::addr_t pc) override; diff --git a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp --- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp +++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp @@ -850,7 +850,3 @@ static ConstString g_name("SysV-arm64"); return g_name; } - -// PluginInterface protocol - -ConstString ABISysV_arm64::GetPluginName() { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h --- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h +++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h @@ -86,7 +86,9 @@ // PluginInterface protocol //------------------------------------------------------------------ - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } private: lldb::ValueObjectSP diff --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp --- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp +++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp @@ -604,11 +604,3 @@ static ConstString g_name("sysv-arc"); return g_name; } - -//------------------------------------------------------------------ -// PluginInterface protocol -//------------------------------------------------------------------ - -ConstString ABISysV_arc::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h --- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h +++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h @@ -75,7 +75,9 @@ // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: lldb::ValueObjectSP diff --git a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp --- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp +++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp @@ -1926,9 +1926,3 @@ static ConstString g_name("macosx-arm"); return g_name; } - -// PluginInterface protocol - -lldb_private::ConstString ABIMacOSX_arm::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.h b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.h --- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.h +++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.h @@ -75,7 +75,9 @@ // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: lldb::ValueObjectSP diff --git a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp --- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp +++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp @@ -2032,9 +2032,3 @@ static ConstString g_name("SysV-arm"); return g_name; } - -// PluginInterface protocol - -lldb_private::ConstString ABISysV_arm::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h --- a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h +++ b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h @@ -83,7 +83,9 @@ // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void CreateRegisterMapIfNeeded(); diff --git a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp --- a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp +++ b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp @@ -1198,12 +1198,6 @@ return g_name; } -// PluginInterface protocol - -lldb_private::ConstString ABISysV_hexagon::GetPluginName() { - return GetPluginNameStatic(); -} - // get value object specialized to work with llvm IR types lldb::ValueObjectSP ABISysV_hexagon::GetReturnValueObjectImpl(lldb_private::Thread &thread, diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.h b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.h --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.h +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.h @@ -73,7 +73,9 @@ // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void CreateRegisterMapIfNeeded(); diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp @@ -1019,9 +1019,3 @@ static ConstString g_name("sysv-mips"); return g_name; } - -// PluginInterface protocol - -lldb_private::ConstString ABISysV_mips::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h @@ -86,7 +86,9 @@ // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void CreateRegisterMapIfNeeded(); diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp @@ -1167,9 +1167,3 @@ static ConstString g_name("sysv-mips64"); return g_name; } - -// PluginInterface protocol - -lldb_private::ConstString ABISysV_mips64::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h @@ -82,7 +82,9 @@ // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void CreateRegisterMapIfNeeded(); diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp @@ -967,9 +967,3 @@ static ConstString g_name("sysv-ppc"); return g_name; } - -// PluginInterface protocol - -lldb_private::ConstString ABISysV_ppc::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h @@ -82,7 +82,9 @@ // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void CreateRegisterMapIfNeeded(); diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp @@ -1079,9 +1079,3 @@ static ConstString g_name("sysv-ppc64"); return g_name; } - -// PluginInterface protocol - -lldb_private::ConstString ABISysV_ppc64::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h --- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h +++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h @@ -74,7 +74,9 @@ // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void CreateRegisterMapIfNeeded(); diff --git a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp --- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp +++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp @@ -721,9 +721,3 @@ static ConstString g_name("sysv-s390x"); return g_name; } - -// PluginInterface protocol - -lldb_private::ConstString ABISysV_s390x::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h --- a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h +++ b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h @@ -77,7 +77,9 @@ static lldb_private::ConstString GetPluginNameStatic(); - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: lldb::ValueObjectSP diff --git a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp --- a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp +++ b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp @@ -465,9 +465,3 @@ static ConstString g_short_name("abi.macosx-i386"); return g_short_name; } - -// PluginInterface protocol - -lldb_private::ConstString ABIMacOSX_i386::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_i386.h b/lldb/source/Plugins/ABI/X86/ABISysV_i386.h --- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.h +++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.h @@ -85,7 +85,9 @@ static lldb_private::ConstString GetPluginNameStatic(); - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: lldb::ValueObjectSP diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp --- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp +++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp @@ -721,7 +721,3 @@ static ConstString g_name("sysv-i386"); return g_name; } - -lldb_private::ConstString ABISysV_i386::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h --- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h +++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h @@ -79,8 +79,9 @@ static lldb_private::ConstString GetPluginNameStatic(); // PluginInterface protocol - - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void CreateRegisterMapIfNeeded(); diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp --- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp +++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp @@ -957,9 +957,3 @@ static ConstString g_name("sysv-x86_64"); return g_name; } - -// PluginInterface protocol - -lldb_private::ConstString ABISysV_x86_64::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h --- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h +++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h @@ -73,7 +73,9 @@ // PluginInterface protocol //------------------------------------------------------------------ - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void CreateRegisterMapIfNeeded(); diff --git a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp --- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp +++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp @@ -828,11 +828,3 @@ static ConstString g_name("windows-x86_64"); return g_name; } - -//------------------------------------------------------------------ -// PluginInterface protocol -//------------------------------------------------------------------ - -lldb_private::ConstString ABIWindows_x86_64::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h b/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h --- a/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h +++ b/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h @@ -20,7 +20,9 @@ static void Initialize(); static void Terminate(); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } void OverrideStopInfo(Thread &thread) const override{}; diff --git a/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp b/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp --- a/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp +++ b/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp @@ -38,7 +38,3 @@ } return std::unique_ptr(new ArchitectureAArch64()); } - -ConstString ArchitectureAArch64::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h b/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h --- a/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h +++ b/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h @@ -19,7 +19,9 @@ static void Initialize(); static void Terminate(); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } void OverrideStopInfo(Thread &thread) const override; diff --git a/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp b/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp --- a/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp +++ b/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp @@ -39,8 +39,6 @@ return std::unique_ptr(new ArchitectureArm()); } -ConstString ArchitectureArm::GetPluginName() { return GetPluginNameStatic(); } - void ArchitectureArm::OverrideStopInfo(Thread &thread) const { // We need to check if we are stopped in Thumb mode in a IT instruction and // detect if the condition doesn't pass. If this is the case it means we diff --git a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h --- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h +++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h @@ -20,7 +20,9 @@ static void Initialize(); static void Terminate(); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } void OverrideStopInfo(Thread &thread) const override {} diff --git a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp --- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp +++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp @@ -42,8 +42,6 @@ std::unique_ptr(new ArchitectureMips(arch)) : nullptr; } -ConstString ArchitectureMips::GetPluginName() { return GetPluginNameStatic(); } - addr_t ArchitectureMips::GetCallableLoadAddress(addr_t code_addr, AddressClass addr_class) const { bool is_alternate_isa = false; diff --git a/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h b/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h --- a/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h +++ b/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h @@ -19,7 +19,9 @@ static void Initialize(); static void Terminate(); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } void OverrideStopInfo(Thread &thread) const override {} diff --git a/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp b/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp --- a/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp +++ b/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp @@ -43,8 +43,6 @@ return nullptr; } -ConstString ArchitecturePPC64::GetPluginName() { return GetPluginNameStatic(); } - static int32_t GetLocalEntryOffset(const Symbol &sym) { unsigned char other = sym.GetFlags() >> 8 & 0xFF; return llvm::ELF::decodePPC64LocalEntryOffset(other); diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h @@ -43,7 +43,9 @@ bool append, bool data_from_file) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: friend class InstructionLLVMC; diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1461,6 +1461,3 @@ *name = nullptr; return nullptr; } - -// PluginInterface protocol -ConstString DisassemblerLLVMC::GetPluginName() { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h @@ -58,7 +58,9 @@ lldb_private::Status CanLoadImage() override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void PrivateInitialize(lldb_private::Process *process); diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -803,10 +803,9 @@ // system. PlatformSP platform_sp(target.GetPlatform()); if (!m_module_sp && platform_sp) { - ConstString platform_name(platform_sp->GetPluginName()); static ConstString g_platform_name( PlatformDarwinKernel::GetPluginNameStatic()); - if (platform_name == g_platform_name) { + if (platform_sp->GetPluginName() == g_platform_name.GetStringRef()) { ModuleSpec kext_bundle_module_spec(module_spec); FileSpec kext_filespec(m_name.c_str()); FileSpecList search_paths = target.GetExecutableSearchPaths(); @@ -1559,11 +1558,6 @@ "in the MacOSX kernel."; } -// PluginInterface protocol -lldb_private::ConstString DynamicLoaderDarwinKernel::GetPluginName() { - return GetPluginNameStatic(); -} - lldb::ByteOrder DynamicLoaderDarwinKernel::GetByteOrderFromMagic(uint32_t magic) { switch (magic) { diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h @@ -47,7 +47,9 @@ lldb::addr_t tls_file_addr) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: /// Runtime linker rendezvous structure. diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -78,10 +78,6 @@ void DynamicLoaderHexagonDYLD::Terminate() {} -lldb_private::ConstString DynamicLoaderHexagonDYLD::GetPluginName() { - return GetPluginNameStatic(); -} - lldb_private::ConstString DynamicLoaderHexagonDYLD::GetPluginNameStatic() { static ConstString g_name("hexagon-dyld"); return g_name; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h @@ -60,7 +60,9 @@ lldb_private::LazyBool &private_shared_cache) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void PutToLog(lldb_private::Log *log) const; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -513,8 +513,3 @@ return "Dynamic loader plug-in that watches for shared library loads/unloads " "in MacOSX user processes."; } - -// PluginInterface protocol -lldb_private::ConstString DynamicLoaderMacOS::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h @@ -64,7 +64,9 @@ lldb_private::LazyBool &private_shared_cache) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } bool IsFullyInitialized() override; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -1146,11 +1146,6 @@ "in MacOSX user processes."; } -// PluginInterface protocol -lldb_private::ConstString DynamicLoaderMacOSXDYLD::GetPluginName() { - return GetPluginNameStatic(); -} - uint32_t DynamicLoaderMacOSXDYLD::AddrByteSize() { std::lock_guard baseclass_guard(GetMutex()); diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -53,7 +53,9 @@ lldb::addr_t tls_file_addr) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: /// Runtime linker rendezvous structure. diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -38,10 +38,6 @@ void DynamicLoaderPOSIXDYLD::Terminate() {} -lldb_private::ConstString DynamicLoaderPOSIXDYLD::GetPluginName() { - return GetPluginNameStatic(); -} - lldb_private::ConstString DynamicLoaderPOSIXDYLD::GetPluginNameStatic() { static ConstString g_name("linux-dyld"); return g_name; diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h --- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h +++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h @@ -44,7 +44,9 @@ lldb_private::Status CanLoadImage() override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } private: void LoadAllImagesAtFileAddresses(); diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp --- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp +++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp @@ -161,8 +161,3 @@ return "Dynamic loader plug-in that will load any images at the static " "addresses contained in each image."; } - -// PluginInterface protocol -lldb_private::ConstString DynamicLoaderStatic::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h --- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h @@ -39,7 +39,9 @@ lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop) override; - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: lldb::addr_t GetLoadAddress(lldb::ModuleSP executable); diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp --- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp @@ -174,10 +174,6 @@ Status DynamicLoaderWindowsDYLD::CanLoadImage() { return Status(); } -ConstString DynamicLoaderWindowsDYLD::GetPluginName() { - return GetPluginNameStatic(); -} - ThreadPlanSP DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(Thread &thread, bool stop) { diff --git a/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h --- a/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h @@ -37,7 +37,9 @@ /// PluginInterface protocol. /// \{ - ConstString GetPluginName() override { return GetPluginNameStatic(); } + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } /// \} }; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp @@ -311,8 +311,7 @@ } if (target->GetArchitecture().GetMachine() == llvm::Triple::x86_64) { if (lldb::PlatformSP platform_sp = target->GetPlatform()) { - static ConstString g_platform_ios_simulator("ios-simulator"); - if (platform_sp->GetPluginName() == g_platform_ios_simulator) { + if (platform_sp->GetPluginName() == "ios-simulator") { target_specific_defines = "typedef bool BOOL;\n"; } } diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h @@ -83,8 +83,8 @@ return false; } - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } bool SetTargetTriple(const ArchSpec &arch) override; diff --git a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h --- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h +++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h @@ -46,7 +46,9 @@ return false; } - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } bool SetTargetTriple(const lldb_private::ArchSpec &arch) override; diff --git a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp --- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp +++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp @@ -122,11 +122,6 @@ return g_plugin_name; } -lldb_private::ConstString EmulateInstructionARM64::GetPluginName() { - static ConstString g_plugin_name("EmulateInstructionARM64"); - return g_plugin_name; -} - const char *EmulateInstructionARM64::GetPluginDescriptionStatic() { return "Emulate instructions for the ARM64 architecture."; } diff --git a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h --- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h +++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h @@ -55,7 +55,9 @@ return false; } - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } bool SetTargetTriple(const lldb_private::ArchSpec &arch) override; diff --git a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp --- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -198,11 +198,6 @@ return g_plugin_name; } -lldb_private::ConstString EmulateInstructionMIPS::GetPluginName() { - static ConstString g_plugin_name("EmulateInstructionMIPS"); - return g_plugin_name; -} - const char *EmulateInstructionMIPS::GetPluginDescriptionStatic() { return "Emulate instructions for the MIPS32 architecture."; } diff --git a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h --- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h +++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h @@ -53,7 +53,9 @@ return false; } - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } bool SetTargetTriple(const lldb_private::ArchSpec &arch) override; diff --git a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp --- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -185,11 +185,6 @@ return g_plugin_name; } -lldb_private::ConstString EmulateInstructionMIPS64::GetPluginName() { - static ConstString g_plugin_name("EmulateInstructionMIPS64"); - return g_plugin_name; -} - const char *EmulateInstructionMIPS64::GetPluginDescriptionStatic() { return "Emulate instructions for the MIPS64 architecture."; } diff --git a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h --- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h +++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h @@ -44,7 +44,9 @@ return false; } - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } bool SetTargetTriple(const ArchSpec &arch) override; diff --git a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp --- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp +++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp @@ -44,11 +44,6 @@ return g_plugin_name; } -ConstString EmulateInstructionPPC64::GetPluginName() { - static ConstString g_plugin_name("EmulateInstructionPPC64"); - return g_plugin_name; -} - const char *EmulateInstructionPPC64::GetPluginDescriptionStatic() { return "Emulate instructions for the PPC64 architecture."; } diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h --- a/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h +++ b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h @@ -31,8 +31,8 @@ static lldb::InstrumentationRuntimeType GetTypeStatic(); - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } diff --git a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h --- a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h +++ b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h @@ -32,8 +32,8 @@ static lldb::InstrumentationRuntimeType GetTypeStatic(); - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } diff --git a/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h --- a/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h +++ b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h @@ -31,8 +31,8 @@ static lldb::InstrumentationRuntimeType GetTypeStatic(); - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } diff --git a/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h --- a/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h +++ b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h @@ -32,8 +32,8 @@ static lldb::InstrumentationRuntimeType GetTypeStatic(); - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h @@ -35,7 +35,9 @@ static void DebuggerInitialize(lldb_private::Debugger &debugger); // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // JITLoader interface void DidAttach() override; diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -432,10 +432,6 @@ "interface."; } -lldb_private::ConstString JITLoaderGDB::GetPluginName() { - return GetPluginNameStatic(); -} - void JITLoaderGDB::Initialize() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance, diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h @@ -134,7 +134,9 @@ const Mangled mangled, const SymbolContext &sym_ctx) const override; // PluginInterface protocol - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } }; } // namespace lldb_private diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -95,12 +95,6 @@ return mangled.GetMangledName(); } -// PluginInterface protocol - -lldb_private::ConstString CPlusPlusLanguage::GetPluginName() { - return GetPluginNameStatic(); -} - // Static Functions Language *CPlusPlusLanguage::CreateInstance(lldb::LanguageType language) { @@ -1095,7 +1089,8 @@ static TypeCategoryImplSP g_category; llvm::call_once(g_initialize, [this]() -> void { - DataVisualization::Categories::GetCategory(GetPluginName(), g_category); + DataVisualization::Categories::GetCategory(ConstString(GetPluginName()), + g_category); if (g_category) { LoadLibStdcppFormatters(g_category); LoadLibCxxFormatters(g_category); diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h @@ -156,7 +156,9 @@ } // PluginInterface protocol - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } }; } // namespace lldb_private diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -53,12 +53,6 @@ return g_name; } -// PluginInterface protocol - -lldb_private::ConstString ObjCLanguage::GetPluginName() { - return GetPluginNameStatic(); -} - // Static Functions Language *ObjCLanguage::CreateInstance(lldb::LanguageType language) { @@ -932,7 +926,8 @@ static TypeCategoryImplSP g_category; llvm::call_once(g_initialize, [this]() -> void { - DataVisualization::Categories::GetCategory(GetPluginName(), g_category); + DataVisualization::Categories::GetCategory(ConstString(GetPluginName()), + g_category); if (g_category) { LoadCoreMediaFormatters(g_category); LoadObjCFormatters(g_category); diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h @@ -43,7 +43,9 @@ static lldb_private::ConstString GetPluginNameStatic(); // PluginInterface protocol - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } }; } // namespace lldb_private diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp @@ -39,11 +39,6 @@ return g_name; } -// PluginInterface protocol -lldb_private::ConstString ObjCPlusPlusLanguage::GetPluginName() { - return GetPluginNameStatic(); -} - // Static Functions Language *ObjCPlusPlusLanguage::CreateInstance(lldb::LanguageType language) { switch (language) { diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h @@ -76,7 +76,9 @@ lldb::ThreadSP thread_sp) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: lldb::BreakpointResolverSP diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -410,11 +410,6 @@ return g_name; } -// PluginInterface protocol -lldb_private::ConstString ItaniumABILanguageRuntime::GetPluginName() { - return GetPluginNameStatic(); -} - BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver( const BreakpointSP &bkpt, bool catch_bp, bool throw_bp) { return CreateExceptionResolver(bkpt, catch_bp, throw_bp, false); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h @@ -107,7 +107,9 @@ CreateObjectChecker(std::string, ExecutionContext &exe_ctx) override; // PluginInterface protocol - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } ObjCRuntimeVersions GetRuntimeVersion() const override { return ObjCRuntimeVersions::eAppleObjC_V1; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -97,11 +97,6 @@ return g_name; } -// PluginInterface protocol -ConstString AppleObjCRuntimeV1::GetPluginName() { - return GetPluginNameStatic(); -} - BreakpointResolverSP AppleObjCRuntimeV1::CreateExceptionResolver(const BreakpointSP &bkpt, bool catch_bp, bool throw_bp) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -54,7 +54,9 @@ llvm::Expected> CreateObjectChecker(std::string name, ExecutionContext &exe_ctx) override; - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } ObjCRuntimeVersions GetRuntimeVersion() const override { return ObjCRuntimeVersions::eAppleObjC_V2; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1066,11 +1066,6 @@ return g_name; } -// PluginInterface protocol -lldb_private::ConstString AppleObjCRuntimeV2::GetPluginName() { - return GetPluginNameStatic(); -} - BreakpointResolverSP AppleObjCRuntimeV2::CreateExceptionResolver(const BreakpointSP &bkpt, bool catch_bp, bool throw_bp) { @@ -2302,13 +2297,9 @@ if (!platform_sp) return true; // this should not happen - ConstString platform_plugin_name = platform_sp->GetPluginName(); - if (platform_plugin_name) { - llvm::StringRef platform_plugin_name_sr = - platform_plugin_name.GetStringRef(); - if (platform_plugin_name_sr.endswith("-simulator")) - return false; - } + llvm::StringRef platform_plugin_name_sr = platform_sp->GetPluginName(); + if (platform_plugin_name_sr.endswith("-simulator")) + return false; return true; } diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -410,7 +410,9 @@ bool GetOverrideExprOptions(clang::TargetOptions &prototype); // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } static bool GetKernelCoordinate(lldb_renderscript::RSCoordinate &coord, Thread *thread_ptr); diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -1013,11 +1013,6 @@ } } -// PluginInterface protocol -lldb_private::ConstString RenderScriptRuntime::GetPluginName() { - return GetPluginNameStatic(); -} - bool RenderScriptRuntime::GetDynamicTypeAndAddress( ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, diff --git a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h --- a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h +++ b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h @@ -29,8 +29,8 @@ static lldb_private::ConstString GetPluginNameStatic(); - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } lldb_private::HistoryThreads GetHistoryThreads(lldb::addr_t address) override; 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 @@ -68,7 +68,9 @@ lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } 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 @@ -433,11 +433,6 @@ return ObjectFileSP(); } -// PluginInterface protocol -lldb_private::ConstString ObjectContainerBSDArchive::GetPluginName() { - return GetPluginNameStatic(); -} - size_t ObjectContainerBSDArchive::GetModuleSpecifications( const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, 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 @@ -59,7 +59,9 @@ lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } 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 @@ -205,11 +205,6 @@ return ObjectFileSP(); } -// PluginInterface protocol -lldb_private::ConstString ObjectContainerUniversalMachO::GetPluginName() { - return GetPluginNameStatic(); -} - size_t ObjectContainerUniversalMachO::GetModuleSpecifications( const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, 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 @@ -44,7 +44,9 @@ ModuleSpecList &specs); // PluginInterface protocol - ConstString GetPluginName() override { return GetPluginNameStatic(); } + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // LLVM RTTI support static char ID; 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 @@ -85,7 +85,9 @@ lldb::addr_t length); // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // 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 @@ -633,11 +633,6 @@ return specs.GetSize() - initial_count; } -// PluginInterface protocol -lldb_private::ConstString ObjectFileELF::GetPluginName() { - return GetPluginNameStatic(); -} - // ObjectFile protocol ObjectFileELF::ObjectFileELF(const lldb::ModuleSP &module_sp, 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 @@ -96,7 +96,9 @@ ObjectFile::Strata CalculateStrata() override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } 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 @@ -199,11 +199,6 @@ return ArchSpec(); } -// PluginInterface protocol -lldb_private::ConstString ObjectFileJIT::GetPluginName() { - return GetPluginNameStatic(); -} - bool ObjectFileJIT::SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset) { size_t num_loaded_sections = 0; 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 @@ -146,7 +146,9 @@ bool AllowAssemblyEmulationUnwindPlans() override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } 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 @@ -6191,11 +6191,6 @@ return m_allow_assembly_emulation_unwind_plans; } -// PluginInterface protocol -lldb_private::ConstString ObjectFileMachO::GetPluginName() { - return GetPluginNameStatic(); -} - Section *ObjectFileMachO::GetMachHeaderSection() { // Find the first address of the mach header which is the first non-zero file // sized section whose file offset is zero. This is the base file address of 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 @@ -35,8 +35,8 @@ } // PluginInterface protocol - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } static lldb_private::ObjectFile * 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 @@ -48,7 +48,9 @@ ModuleSpecList &specs); // PluginInterface protocol - ConstString GetPluginName() override { return GetPluginNameStatic(); } + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // LLVM RTTI support static char ID; 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 @@ -130,7 +130,9 @@ ObjectFile::Strata CalculateStrata() override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } 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 @@ -1205,6 +1205,3 @@ } ObjectFile::Strata ObjectFilePECOFF::CalculateStrata() { return eStrataUser; } - -// PluginInterface protocol -ConstString ObjectFilePECOFF::GetPluginName() { return GetPluginNameStatic(); } 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 @@ -48,7 +48,9 @@ /// PluginInterface protocol. /// \{ - ConstString GetPluginName() override { return GetPluginNameStatic(); } + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } /// \} /// LLVM RTTI support 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 @@ -41,7 +41,9 @@ static const char *GetPluginDescriptionStatic(); // lldb_private::PluginInterface Methods - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // 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 @@ -140,11 +140,6 @@ return m_register_info_up.get(); } -// PluginInterface protocol -ConstString OperatingSystemPython::GetPluginName() { - return GetPluginNameStatic(); -} - bool OperatingSystemPython::UpdateThreadList(ThreadList &old_thread_list, ThreadList &core_thread_list, ThreadList &new_thread_list) { diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h @@ -34,7 +34,9 @@ static const char *GetPluginDescriptionStatic(bool is_host); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic(IsHost()).GetStringRef(); + } // lldb_private::Platform functions diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -146,17 +146,11 @@ return "Remote Android user platform plug-in."; } -ConstString PlatformAndroid::GetPluginName() { - return GetPluginNameStatic(IsHost()); -} - Status PlatformAndroid::ConnectRemote(Args &args) { m_device_id.clear(); - if (IsHost()) { - return Status("can't connect to the host platform '%s', always connected", - GetPluginName().GetCString()); - } + if (IsHost()) + return Status("can't connect to the host platform, always connected"); if (!m_remote_platform_sp) m_remote_platform_sp = PlatformSP(new PlatformAndroidRemoteGDBServer()); diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h @@ -29,7 +29,9 @@ static const char *GetPluginDescriptionStatic(bool is_host); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic(IsHost()).GetStringRef(); + } // lldb_private::Platform functions const char *GetDescription() override { diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -93,10 +93,6 @@ return "Remote FreeBSD user platform plug-in."; } -ConstString PlatformFreeBSD::GetPluginName() { - return GetPluginNameStatic(IsHost()); -} - void PlatformFreeBSD::Initialize() { Platform::Initialize(); diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -29,7 +29,9 @@ static const char *GetPluginDescriptionStatic(bool is_host); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic(IsHost()).GetStringRef(); + } // lldb_private::Platform functions const char *GetDescription() override { diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -89,10 +89,6 @@ return "Remote Linux user platform plug-in."; } -ConstString PlatformLinux::GetPluginName() { - return GetPluginNameStatic(IsHost()); -} - void PlatformLinux::Initialize() { PlatformPOSIX::Initialize(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h @@ -46,7 +46,9 @@ virtual ~PlatformAppleSimulator(); - lldb_private::ConstString GetPluginName() override { return m_plugin_name; } + llvm::StringRef GetPluginName() override { + return m_plugin_name.GetStringRef(); + } const char *GetDescription() override { return m_description; } lldb_private::Status diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -406,10 +406,10 @@ if (error.Fail() || !exe_module_sp) { if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) { - error.SetErrorStringWithFormat( - "'%s' doesn't contain any '%s' platform architectures: %s", - resolved_module_spec.GetFileSpec().GetPath().c_str(), - GetPluginName().GetCString(), arch_names.GetString().str().c_str()); + error.SetErrorStringWithFormatv( + "'{0}' doesn't contain any '{1}' platform architectures: {2}", + resolved_module_spec.GetFileSpec(), GetPluginName(), + arch_names.GetString()); } else { error.SetErrorStringWithFormat( "'%s' is not readable", @@ -448,9 +448,9 @@ if (FileSystem::Instance().Exists(local_file)) return error; } - error.SetErrorStringWithFormat( - "unable to locate a platform file for '%s' in platform '%s'", - platform_file_path, GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "unable to locate a platform file for '{0}' in platform '{1}'", + platform_file_path, GetPluginName()); } else { error.SetErrorString("invalid platform file argument"); } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1619,7 +1619,7 @@ } llvm::VersionTuple PlatformDarwin::GetOSVersion(Process *process) { - if (process && strstr(GetPluginName().GetCString(), "-simulator")) { + if (process && GetPluginName().contains("-simulator")) { lldb_private::ProcessInstanceInfo proc_info; if (Host::GetProcessInfo(process->GetID(), proc_info)) { const Environment &env = proc_info.GetEnvironment(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -42,8 +42,8 @@ virtual ~PlatformDarwinKernel(); // lldb_private::PluginInterface functions - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } // lldb_private::Platform functions diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h @@ -28,8 +28,8 @@ static const char *GetDescriptionStatic(); // lldb_private::PluginInterface functions - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } lldb_private::Status diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h @@ -34,8 +34,8 @@ static const char *GetDescriptionStatic(); // lldb_private::PluginInterface functions - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } // lldb_private::Platform functions diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h @@ -34,8 +34,8 @@ static const char *GetDescriptionStatic(); // lldb_private::PluginInterface functions - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } // lldb_private::Platform functions diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h @@ -39,8 +39,8 @@ const char *GetDescription() override { return GetDescriptionStatic(); } // lldb_private::PluginInterface functions - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } // lldb_private::Platform functions diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -111,10 +111,10 @@ if (error.Fail() || !exe_module_sp) { if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) { - error.SetErrorStringWithFormat( - "'%s' doesn't contain any '%s' platform architectures: %s", - resolved_module_spec.GetFileSpec().GetPath().c_str(), - GetPluginName().GetCString(), arch_names.GetData()); + error.SetErrorStringWithFormatv( + "'{0}' doesn't contain any '{1}' platform architectures: {2}", + resolved_module_spec.GetFileSpec(), GetPluginName(), + arch_names.GetData()); } else { error.SetErrorStringWithFormat( "'%s' is not readable", @@ -486,9 +486,9 @@ if (FileSystem::Instance().Exists(local_file)) return error; - error.SetErrorStringWithFormat( - "unable to locate a platform file for '%s' in platform '%s'", - platform_file_path, GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "unable to locate a platform file for '{0}' in platform '{1}'", + platform_file_path, GetPluginName()); } else { error.SetErrorString("invalid platform file argument"); } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h @@ -33,8 +33,8 @@ static const char *GetDescriptionStatic(); - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } const char *GetDescription() override { return GetDescriptionStatic(); } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h @@ -37,8 +37,8 @@ const char *GetDescription() override { return GetDescriptionStatic(); } // lldb_private::PluginInterface functions - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); } bool GetSupportedArchitectureAtIndex(uint32_t idx, diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h @@ -29,7 +29,9 @@ static const char *GetPluginDescriptionStatic(bool is_host); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic(IsHost()).GetStringRef(); + } // lldb_private::Platform functions const char *GetDescription() override { diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -82,10 +82,6 @@ return "Remote NetBSD user platform plug-in."; } -ConstString PlatformNetBSD::GetPluginName() { - return GetPluginNameStatic(IsHost()); -} - void PlatformNetBSD::Initialize() { PlatformPOSIX::Initialize(); diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h --- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h +++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h @@ -29,7 +29,9 @@ static const char *GetPluginDescriptionStatic(bool is_host); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic(IsHost()).GetStringRef(); + } // lldb_private::Platform functions const char *GetDescription() override { diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp --- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp @@ -88,10 +88,6 @@ return "Remote OpenBSD user platform plug-in."; } -ConstString PlatformOpenBSD::GetPluginName() { - return GetPluginNameStatic(IsHost()); -} - void PlatformOpenBSD::Initialize() { Platform::Initialize(); diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -300,9 +300,9 @@ Status PlatformPOSIX::ConnectRemote(Args &args) { Status error; if (IsHost()) { - error.SetErrorStringWithFormat( - "can't connect to the host platform '%s', always connected", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "can't connect to the host platform '{0}', always connected", + GetPluginName()); } else { if (!m_remote_platform_sp) m_remote_platform_sp = @@ -344,9 +344,9 @@ Status error; if (IsHost()) { - error.SetErrorStringWithFormat( - "can't disconnect from the host platform '%s', always connected", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "can't disconnect from the host platform '{0}', always connected", + GetPluginName()); } else { if (m_remote_platform_sp) error = m_remote_platform_sp->DisconnectRemote(); diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h @@ -29,7 +29,9 @@ static const char *GetPluginDescriptionStatic(bool is_host); - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic(IsHost()).GetStringRef(); + } // lldb_private::Platform functions const char *GetDescription() override { diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -117,10 +117,6 @@ : "Remote Windows user platform plug-in."; } -lldb_private::ConstString PlatformWindows::GetPluginName() { - return GetPluginNameStatic(IsHost()); -} - void PlatformWindows::Initialize() { Platform::Initialize(); @@ -154,9 +150,9 @@ Status PlatformWindows::ConnectRemote(Args &args) { Status error; if (IsHost()) { - error.SetErrorStringWithFormat( - "can't connect to the host platform '%s', always connected", - GetPluginName().AsCString()); + error.SetErrorStringWithFormatv( + "can't connect to the host platform '{0}', always connected", + GetPluginName()); } else { if (!m_remote_platform_sp) m_remote_platform_sp = @@ -185,9 +181,9 @@ Status error; if (IsHost()) { - error.SetErrorStringWithFormat( - "can't disconnect from the host platform '%s', always connected", - GetPluginName().AsCString()); + error.SetErrorStringWithFormatv( + "can't disconnect from the host platform '{0}', always connected", + GetPluginName()); } else { if (m_remote_platform_sp) error = m_remote_platform_sp->DisconnectRemote(); diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h @@ -37,7 +37,9 @@ ~PlatformRemoteGDBServer() override; // lldb_private::PluginInterface functions - ConstString GetPluginName() override { return GetPluginNameStatic(); } + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // lldb_private::Platform functions Status diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -145,10 +145,10 @@ if (error.Fail() || !exe_module_sp) { if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) { - error.SetErrorStringWithFormat( - "'%s' doesn't contain any '%s' platform architectures: %s", - resolved_module_spec.GetFileSpec().GetPath().c_str(), - GetPluginName().GetCString(), arch_names.GetData()); + error.SetErrorStringWithFormatv( + "'{0}' doesn't contain any '{1}' platform architectures: {2}", + resolved_module_spec.GetFileSpec(), GetPluginName(), + arch_names.GetData()); } else { error.SetErrorStringWithFormat( "'%s' is not readable", diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h @@ -85,7 +85,9 @@ lldb_private::DynamicLoader *GetDynamicLoader() override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // Process Control lldb_private::Status WillResume() override; diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -172,11 +172,6 @@ Finalize(); } -// PluginInterface -lldb_private::ConstString ProcessKDP::GetPluginName() { - return GetPluginNameStatic(); -} - Status ProcessKDP::WillLaunch(Module *module) { Status error; error.SetErrorString("launching not supported in kdp-remote plug-in"); diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h @@ -45,8 +45,9 @@ 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; - // lldb_private::Process overrides - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } Status EnableBreakpointSite(BreakpointSite *bp_site) override; Status DisableBreakpointSite(BreakpointSite *bp_site) override; diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -142,12 +142,6 @@ return 0; } -// ProcessInterface protocol. - -lldb_private::ConstString ProcessWindows::GetPluginName() { - return GetPluginNameStatic(); -} - Status ProcessWindows::EnableBreakpointSite(BreakpointSite *bp_site) { if (bp_site->HardwareRequired()) return Status("Hardware breakpoints are not supported."); diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h @@ -60,7 +60,9 @@ lldb_private::DynamicLoader *GetDynamicLoader() override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // Process Control lldb_private::Status DoDestroy() override; @@ -69,9 +71,8 @@ lldb_private::Status WillResume() override { lldb_private::Status error; - error.SetErrorStringWithFormat( - "error: %s does not support resuming processes", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support resuming processes", GetPluginName()); return error; } diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -110,9 +110,6 @@ Finalize(); } -// PluginInterface -ConstString ProcessElfCore::GetPluginName() { return GetPluginNameStatic(); } - lldb::addr_t ProcessElfCore::AddAddressRangeFromLoadSegment( const elf::ELFProgramHeader &header) { const lldb::addr_t addr = header.p_vaddr; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -103,7 +103,9 @@ void DidAttach(ArchSpec &process_arch) override; // PluginInterface protocol - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // Process Control Status WillResume() override; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -324,9 +324,6 @@ KillDebugserverProcess(); } -// PluginInterface -ConstString ProcessGDBRemote::GetPluginName() { return GetPluginNameStatic(); } - bool ProcessGDBRemote::ParsePythonTargetDefinition( const FileSpec &target_definition_fspec) { ScriptInterpreter *interpreter = diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h @@ -49,7 +49,9 @@ lldb_private::DynamicLoader *GetDynamicLoader() override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } // Process Control lldb_private::Status DoDestroy() override; diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -128,9 +128,6 @@ Finalize(); } -// PluginInterface -ConstString ProcessMachCore::GetPluginName() { return GetPluginNameStatic(); } - bool ProcessMachCore::GetDynamicLoaderAddress(lldb::addr_t addr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_PROCESS)); diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h @@ -55,7 +55,9 @@ DynamicLoader *GetDynamicLoader() override { return nullptr; } - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } SystemRuntime *GetSystemRuntime() override { return nullptr; } @@ -85,9 +87,8 @@ Status WillResume() override { Status error; - error.SetErrorStringWithFormat( - "error: %s does not support resuming processes", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "error: {0} does not support resuming processes", GetPluginName()); return error; } diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -63,7 +63,9 @@ static ConstString GetStaticPluginName() { return ConstString("placeholder"); } - ConstString GetPluginName() override { return GetStaticPluginName(); } + llvm::StringRef GetPluginName() override { + return GetStaticPluginName().GetStringRef(); + } bool ParseHeader() override { return true; } Type CalculateType() override { return eTypeUnknown; } Strata CalculateStrata() override { return eStrataUnknown; } @@ -304,8 +306,6 @@ return error; } -ConstString ProcessMinidump::GetPluginName() { return GetPluginNameStatic(); } - Status ProcessMinidump::DoDestroy() { return Status(); } void ProcessMinidump::RefreshStateAfterStop() { @@ -581,8 +581,9 @@ // we don't then we will end up setting the load address of a different // PlaceholderObjectFile and an assertion will fire. auto *objfile = module_sp->GetObjectFile(); - if (objfile && objfile->GetPluginName() == - PlaceholderObjectFile::GetStaticPluginName()) { + if (objfile && + objfile->GetPluginName() == + PlaceholderObjectFile::GetStaticPluginName().GetStringRef()) { if (((PlaceholderObjectFile *)objfile)->GetBaseImageAddress() != load_addr) module_sp.reset(); diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h @@ -63,7 +63,9 @@ DynamicLoader *GetDynamicLoader() override { return nullptr; } - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } SystemRuntime *GetSystemRuntime() override { return nullptr; } diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -145,8 +145,6 @@ PluginManager::UnregisterPlugin(ScriptedProcess::CreateInstance); } -ConstString ScriptedProcess::GetPluginName() { return GetPluginNameStatic(); } - Status ScriptedProcess::DoLoadCore() { ProcessLaunchInfo launch_info = GetTarget().GetProcessLaunchInfo(); diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h --- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h @@ -70,7 +70,9 @@ lldb::user_id_t watch_id); // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } Lua &GetLua(); diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp @@ -396,8 +396,4 @@ return "Lua script interpreter"; } -lldb_private::ConstString ScriptInterpreterLua::GetPluginName() { - return GetPluginNameStatic(); -} - Lua &ScriptInterpreterLua::GetLua() { return *m_lua; } diff --git a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h --- a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h +++ b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h @@ -37,7 +37,9 @@ static const char *GetPluginDescriptionStatic(); // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } }; } // namespace lldb_private diff --git a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp --- a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp @@ -65,7 +65,3 @@ const char *ScriptInterpreterNone::GetPluginDescriptionStatic() { return "Null script interpreter"; } - -lldb_private::ConstString ScriptInterpreterNone::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -590,10 +590,6 @@ PyGILState_Release(gil_state); } -lldb_private::ConstString ScriptInterpreterPythonImpl::GetPluginName() { - return GetPluginNameStatic(); -} - void ScriptInterpreterPythonImpl::IOHandlerActivated(IOHandler &io_handler, bool interactive) { const char *instructions = nullptr; diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h @@ -292,7 +292,9 @@ static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger); // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } class Locker : public ScriptInterpreterLocker { public: diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h @@ -46,7 +46,9 @@ // PluginInterface API - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetStaticPluginName().GetStringRef(); + } // StructuredDataPlugin API diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -800,8 +800,9 @@ // Get the plugin for the process. auto plugin_sp = process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName()); - if (!plugin_sp || (plugin_sp->GetPluginName() != - StructuredDataDarwinLog::GetStaticPluginName())) { + if (!plugin_sp || + (plugin_sp->GetPluginName() != + StructuredDataDarwinLog::GetStaticPluginName().GetStringRef())) { result.AppendError("failed to get StructuredDataPlugin for " "the process"); } @@ -1054,15 +1055,6 @@ return s_plugin_name; } -#pragma mark - -#pragma mark PluginInterface API - -// PluginInterface API - -ConstString StructuredDataDarwinLog::GetPluginName() { - return GetStaticPluginName(); -} - #pragma mark - #pragma mark StructuredDataPlugin API diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h @@ -146,7 +146,9 @@ GetUnwindPlan(const Address &address, const RegisterInfoResolver &resolver) override; - ConstString GetPluginName() override { return GetPluginNameStatic(); } + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } private: // A class representing a position in the breakpad file. Useful for diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -218,7 +218,9 @@ std::recursive_mutex &GetModuleMutex() const override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } DWARFDebugAbbrev *DebugAbbrev(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -3833,9 +3833,6 @@ return {}; } -// PluginInterface protocol -ConstString SymbolFileDWARF::GetPluginName() { return GetPluginNameStatic(); } - void SymbolFileDWARF::Dump(lldb_private::Stream &s) { SymbolFile::Dump(s); m_index->Dump(s); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -140,7 +140,9 @@ void DumpClangAST(lldb_private::Stream &s) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: enum { kHaveInitializedOSOs = (1 << 0), kNumFlags }; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -528,8 +528,8 @@ SymbolFileDWARF * SymbolFileDWARFDebugMap::GetSymbolFileAsSymbolFileDWARF(SymbolFile *sym_file) { - if (sym_file && - sym_file->GetPluginName() == SymbolFileDWARF::GetPluginNameStatic()) + if (sym_file && sym_file->GetPluginName() == + SymbolFileDWARF::GetPluginNameStatic().GetStringRef()) return static_cast(sym_file); return nullptr; } @@ -1234,11 +1234,6 @@ }); } -// PluginInterface protocol -lldb_private::ConstString SymbolFileDWARFDebugMap::GetPluginName() { - return GetPluginNameStatic(); -} - lldb::CompUnitSP SymbolFileDWARFDebugMap::GetCompileUnit(SymbolFileDWARF *oso_dwarf) { if (oso_dwarf) { diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h @@ -151,7 +151,9 @@ FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx) override; - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } llvm::pdb::PDBFile &GetPDBFile() { return m_index->pdb(); } const llvm::pdb::PDBFile &GetPDBFile() const { return m_index->pdb(); } diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -1566,8 +1566,3 @@ } return type_system_or_err; } - -ConstString SymbolFileNativePDB::GetPluginName() { - static ConstString g_name("pdb"); - return g_name; -} diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h @@ -161,7 +161,9 @@ lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx) override; - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } llvm::pdb::IPDBSession &GetPDBSession(); diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -1713,11 +1713,6 @@ return clang_type_system->CreateDeclContext(namespace_decl); } -lldb_private::ConstString SymbolFilePDB::GetPluginName() { - static ConstString g_name("pdb"); - return g_name; -} - IPDBSession &SymbolFilePDB::GetPDBSession() { return *m_session_up; } const IPDBSession &SymbolFilePDB::GetPDBSession() const { diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h @@ -85,7 +85,9 @@ lldb_private::TypeList &type_list) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: uint32_t CalculateNumCompileUnits() override; diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -260,8 +260,3 @@ } return resolved_flags; } - -// PluginInterface protocol -lldb_private::ConstString SymbolFileSymtab::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h --- a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h +++ b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h @@ -31,7 +31,9 @@ lldb_private::Stream *feedback_strm); // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } }; #endif // LLDB_SOURCE_PLUGINS_SYMBOLVENDOR_ELF_SYMBOLVENDORELF_H diff --git a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp --- a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp +++ b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp @@ -144,6 +144,3 @@ symbol_vendor->AddSymbolFileRepresentation(dsym_objfile_sp); return symbol_vendor; } - -// PluginInterface protocol -ConstString SymbolVendorELF::GetPluginName() { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h @@ -31,7 +31,9 @@ SymbolVendorMacOSX(const lldb::ModuleSP &module_sp); // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } }; #endif // LLDB_SOURCE_PLUGINS_SYMBOLVENDOR_MACOSX_SYMBOLVENDORMACOSX_H diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -310,8 +310,3 @@ } return symbol_vendor; } - -// PluginInterface protocol -ConstString SymbolVendorMacOSX::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h --- a/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h +++ b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h @@ -30,7 +30,9 @@ /// PluginInterface protocol. /// \{ - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } /// \} }; diff --git a/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp --- a/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp +++ b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp @@ -139,6 +139,3 @@ symbol_vendor->AddSymbolFileRepresentation(sym_objfile_sp); return symbol_vendor; } - -// PluginInterface protocol -ConstString SymbolVendorWasm::GetPluginName() { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h @@ -98,7 +98,9 @@ bool SafeToCallFunctionsOnThisThread(lldb::ThreadSP thread_sp) override; // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: lldb::user_id_t m_break_id; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -992,8 +992,3 @@ const char *SystemRuntimeMacOSX::GetPluginDescriptionStatic() { return "System runtime plugin for Mac OS X native libraries."; } - -// PluginInterface protocol -lldb_private::ConstString SystemRuntimeMacOSX::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h --- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h +++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h @@ -28,7 +28,9 @@ /// PluginInterface protocol /// \{ - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } static void Initialize(); diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp --- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp +++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp @@ -58,12 +58,6 @@ return TraceIntelPTSessionFileParser::GetSchema(); } -//------------------------------------------------------------------ -// PluginInterface protocol -//------------------------------------------------------------------ - -ConstString TraceIntelPT::GetPluginName() { return GetPluginNameStatic(); } - void TraceIntelPT::Dump(Stream *s) const {} llvm::Error TraceIntelPT::SaveLiveTraceToDisk(FileSpec directory) { @@ -284,7 +278,7 @@ request.processBufferSizeLimit = total_buffer_size_limit; request.enableTsc = enable_tsc; request.psbPeriod = psb_period.map([](size_t val) { return (int64_t)val; }); - request.type = GetPluginName().AsCString(); + request.type = GetPluginName().str(); return Trace::Start(toJSON(request)); } @@ -318,7 +312,7 @@ request.threadBufferSize = thread_buffer_size; request.enableTsc = enable_tsc; request.psbPeriod = psb_period.map([](size_t val) { return (int64_t)val; }); - request.type = GetPluginName().AsCString(); + request.type = GetPluginName().str(); request.tids.emplace(); for (lldb::tid_t tid : tids) request.tids->push_back(tid); diff --git a/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h b/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h --- a/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h +++ b/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h @@ -10,6 +10,7 @@ #define LLDB_SOURCE_PLUGINS_TRACE_EXPORTER_CTF_H #include "lldb/Target/TraceExporter.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { namespace ctf { @@ -24,7 +25,9 @@ /// \{ static llvm::Expected CreateInstance(); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } static void Initialize(); diff --git a/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp b/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp --- a/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp +++ b/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp @@ -44,8 +44,6 @@ return g_name; } -ConstString TraceExporterCTF::GetPluginName() { return GetPluginNameStatic(); } - Expected TraceExporterCTF::CreateInstance() { return std::make_unique(); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -138,7 +138,9 @@ void Finalize() override; // PluginInterface functions - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } static ConstString GetPluginNameStatic(); diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -574,10 +574,6 @@ return ConstString("clang"); } -ConstString TypeSystemClang::GetPluginName() { - return TypeSystemClang::GetPluginNameStatic(); -} - lldb::TypeSystemSP TypeSystemClang::CreateInstance(lldb::LanguageType language, lldb_private::Module *module, Target *target) { diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h @@ -56,7 +56,9 @@ static const char *GetPluginDescriptionStatic(); - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } private: // Call CreateInstance to get an instance of this class diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -333,11 +333,6 @@ return nullptr; } -// PluginInterface protocol in UnwindAssemblyParser_x86 -ConstString UnwindAssemblyInstEmulation::GetPluginName() { - return GetPluginNameStatic(); -} - void UnwindAssemblyInstEmulation::Initialize() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); diff --git a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h @@ -50,7 +50,9 @@ static const char *GetPluginDescriptionStatic(); - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } private: UnwindAssembly_x86(const lldb_private::ArchSpec &arch); diff --git a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -239,12 +239,6 @@ return nullptr; } -// PluginInterface protocol in UnwindAssemblyParser_x86 - -ConstString UnwindAssembly_x86::GetPluginName() { - return GetPluginNameStatic(); -} - void UnwindAssembly_x86::Initialize() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp --- a/lldb/source/Symbol/SymbolVendor.cpp +++ b/lldb/source/Symbol/SymbolVendor.cpp @@ -69,9 +69,3 @@ m_sym_file_up.reset(SymbolFile::FindPlugin(objfile_sp)); } } - -// PluginInterface protocol -lldb_private::ConstString SymbolVendor::GetPluginName() { - static ConstString g_name("vendor-default"); - return g_name; -} diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -399,7 +399,7 @@ void Platform::GetStatus(Stream &strm) { std::string s; - strm.Printf(" Platform: %s\n", GetPluginName().GetCString()); + strm.Format(" Platform: {0}\n", GetPluginName()); ArchSpec arch(GetSystemArchitecture()); if (arch.IsValid()) { @@ -752,9 +752,8 @@ return llvm::sys::fs::create_directory(file_spec.GetPath(), permissions); else { Status error; - error.SetErrorStringWithFormat("remote platform %s doesn't support %s", - GetPluginName().GetCString(), - LLVM_PRETTY_FUNCTION); + error.SetErrorStringWithFormatv("remote platform {0} doesn't support {1}", + GetPluginName(), LLVM_PRETTY_FUNCTION); return error; } } @@ -768,9 +767,8 @@ return Status(Value.getError()); } else { Status error; - error.SetErrorStringWithFormat("remote platform %s doesn't support %s", - GetPluginName().GetCString(), - LLVM_PRETTY_FUNCTION); + error.SetErrorStringWithFormatv("remote platform {0} doesn't support {1}", + GetPluginName(), LLVM_PRETTY_FUNCTION); return error; } } @@ -782,14 +780,13 @@ return llvm::sys::fs::setPermissions(file_spec.GetPath(), Perms); } else { Status error; - error.SetErrorStringWithFormat("remote platform %s doesn't support %s", - GetPluginName().GetCString(), - LLVM_PRETTY_FUNCTION); + error.SetErrorStringWithFormatv("remote platform {0} doesn't support {1}", + GetPluginName(), LLVM_PRETTY_FUNCTION); return error; } } -ConstString Platform::GetName() { return GetPluginName(); } +ConstString Platform::GetName() { return ConstString(GetPluginName()); } const char *Platform::GetHostname() { if (IsHost()) @@ -949,26 +946,27 @@ Status Platform::ConnectRemote(Args &args) { Status error; if (IsHost()) - error.SetErrorStringWithFormat("The currently selected platform (%s) is " - "the host platform and is always connected.", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "The currently selected platform ({0}) is " + "the host platform and is always connected.", + GetPluginName()); else - error.SetErrorStringWithFormat( - "Platform::ConnectRemote() is not supported by %s", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "Platform::ConnectRemote() is not supported by {0}", GetPluginName()); return error; } Status Platform::DisconnectRemote() { Status error; if (IsHost()) - error.SetErrorStringWithFormat("The currently selected platform (%s) is " - "the host platform and is always connected.", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "The currently selected platform ({0}) is " + "the host platform and is always connected.", + GetPluginName()); else - error.SetErrorStringWithFormat( - "Platform::DisconnectRemote() is not supported by %s", - GetPluginName().GetCString()); + error.SetErrorStringWithFormatv( + "Platform::DisconnectRemote() is not supported by {0}", + GetPluginName()); return error; } @@ -1117,8 +1115,8 @@ ProcessAttachInfo attach_info(launch_info); process_sp = Attach(attach_info, debugger, &target, error); if (process_sp) { - LLDB_LOGF(log, "Platform::%s Attach() succeeded, Process plugin: %s", - __FUNCTION__, process_sp->GetPluginName().AsCString()); + LLDB_LOG(log, "Attach() succeeded, Process plugin: {0}", + process_sp->GetPluginName()); launch_info.SetHijackListener(attach_info.GetHijackListener()); // Since we attached to the process, it will think it needs to detach diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2939,13 +2939,11 @@ dyld->DidAttach(); if (log) { ModuleSP exe_module_sp = GetTarget().GetExecutableModule(); - LLDB_LOGF(log, - "Process::%s after DynamicLoader::DidAttach(), target " - "executable is %s (using %s plugin)", - __FUNCTION__, - exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str() - : "", - dyld->GetPluginName().AsCString("")); + LLDB_LOG(log, + "after DynamicLoader::DidAttach(), target " + "executable is {0} (using {1} plugin)", + exe_module_sp ? exe_module_sp->GetFileSpec() : FileSpec(), + dyld->GetPluginName()); } } @@ -2956,13 +2954,11 @@ system_runtime->DidAttach(); if (log) { ModuleSP exe_module_sp = GetTarget().GetExecutableModule(); - LLDB_LOGF(log, - "Process::%s after SystemRuntime::DidAttach(), target " - "executable is %s (using %s plugin)", - __FUNCTION__, - exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str() - : "", - system_runtime->GetPluginName().AsCString("")); + LLDB_LOG(log, + "after SystemRuntime::DidAttach(), target " + "executable is {0} (using {1} plugin)", + exe_module_sp ? exe_module_sp->GetFileSpec() : FileSpec(), + system_runtime->GetPluginName()); } } @@ -5984,11 +5980,8 @@ m_structured_data_plugin_map.insert( std::make_pair(type_name, plugin_sp)); names_to_remove.push_back(type_name); - LLDB_LOGF(log, - "Process::%s(): using plugin %s for type name " - "%s", - __FUNCTION__, plugin_sp->GetPluginName().GetCString(), - type_name.GetCString()); + LLDB_LOG(log, "using plugin {0} for type name {1}", + plugin_sp->GetPluginName(), type_name); } } @@ -6112,8 +6105,7 @@ if (!arch || !tag_manager) { return llvm::createStringError( llvm::inconvertibleErrorCode(), - "This architecture does not support memory tagging", - GetPluginName().GetCString()); + "This architecture does not support memory tagging"); } if (!SupportsMemoryTagging()) { diff --git a/lldb/source/Target/ProcessTrace.cpp b/lldb/source/Target/ProcessTrace.cpp --- a/lldb/source/Target/ProcessTrace.cpp +++ b/lldb/source/Target/ProcessTrace.cpp @@ -57,8 +57,6 @@ Finalize(); } -ConstString ProcessTrace::GetPluginName() { return GetPluginNameStatic(); } - void ProcessTrace::DidAttach(ArchSpec &process_arch) { ListenerSP listener_sp( Listener::MakeListener("lldb.process_trace.did_attach_listener")); diff --git a/lldb/source/Target/RemoteAwarePlatform.cpp b/lldb/source/Target/RemoteAwarePlatform.cpp --- a/lldb/source/Target/RemoteAwarePlatform.cpp +++ b/lldb/source/Target/RemoteAwarePlatform.cpp @@ -154,10 +154,10 @@ if (error.Fail() || !exe_module_sp) { if (FileSystem::Instance().Readable( resolved_module_spec.GetFileSpec())) { - error.SetErrorStringWithFormat( - "'%s' doesn't contain any '%s' platform architectures: %s", - resolved_module_spec.GetFileSpec().GetPath().c_str(), - GetPluginName().GetCString(), arch_names.GetData()); + error.SetErrorStringWithFormatv( + "'{0}' doesn't contain any '{1}' platform architectures: {2}", + resolved_module_spec.GetFileSpec(), GetPluginName(), + arch_names.GetData()); } else { error.SetErrorStringWithFormat( "'%s' is not readable", diff --git a/lldb/source/Target/Trace.cpp b/lldb/source/Target/Trace.cpp --- a/lldb/source/Target/Trace.cpp +++ b/lldb/source/Target/Trace.cpp @@ -108,23 +108,21 @@ if (!m_live_process) return createStringError(inconvertibleErrorCode(), "Tracing requires a live process."); - return m_live_process->TraceStop( - TraceStopRequest(GetPluginName().AsCString())); + return m_live_process->TraceStop(TraceStopRequest(GetPluginName())); } Error Trace::Stop(llvm::ArrayRef tids) { if (!m_live_process) return createStringError(inconvertibleErrorCode(), "Tracing requires a live process."); - return m_live_process->TraceStop( - TraceStopRequest(GetPluginName().AsCString(), tids)); + return m_live_process->TraceStop(TraceStopRequest(GetPluginName(), tids)); } Expected Trace::GetLiveProcessState() { if (!m_live_process) return createStringError(inconvertibleErrorCode(), "Tracing requires a live process."); - return m_live_process->TraceGetState(GetPluginName().AsCString()); + return m_live_process->TraceGetState(GetPluginName()); } Optional Trace::GetLiveThreadBinaryDataSize(lldb::tid_t tid, @@ -158,7 +156,7 @@ "Tracing data \"%s\" is not available for thread %" PRIu64 ".", kind.data(), tid); - TraceGetBinaryDataRequest request{GetPluginName().AsCString(), kind.str(), + TraceGetBinaryDataRequest request{GetPluginName().str(), kind.str(), static_cast(tid), 0, static_cast(*size)}; return m_live_process->TraceGetBinaryData(request); @@ -175,8 +173,8 @@ inconvertibleErrorCode(), "Tracing data \"%s\" is not available for the process.", kind.data()); - TraceGetBinaryDataRequest request{GetPluginName().AsCString(), kind.str(), - None, 0, static_cast(*size)}; + TraceGetBinaryDataRequest request{GetPluginName().str(), kind.str(), None, 0, + static_cast(*size)}; return m_live_process->TraceGetBinaryData(request); } diff --git a/lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp b/lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp --- a/lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp +++ b/lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp @@ -31,4 +31,4 @@ // CHECK: (lldb) target modules dump symfile // CHECK: Dumping debug symbols for 1 modules. -// CHECK: SymbolFile pdb +// CHECK: SymbolFile native-pdb diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp b/lldb/unittests/Expression/DWARFExpressionTest.cpp --- a/lldb/unittests/Expression/DWARFExpressionTest.cpp +++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp @@ -309,7 +309,7 @@ struct MockProcess : Process { using Process::Process; - ConstString GetPluginName() override { return ConstString("mock process"); } + llvm::StringRef GetPluginName() override { return "mock process"; } bool CanDebug(lldb::TargetSP target, bool plugin_specified_by_name) override { return false; diff --git a/lldb/unittests/Language/CLanguages/CLanguagesTest.cpp b/lldb/unittests/Language/CLanguages/CLanguagesTest.cpp --- a/lldb/unittests/Language/CLanguages/CLanguagesTest.cpp +++ b/lldb/unittests/Language/CLanguages/CLanguagesTest.cpp @@ -17,13 +17,13 @@ using namespace lldb_private; -/// Returns the name of the LLDB plugin for the given language or a null -/// ConstString if there is no fitting plugin. -static ConstString GetPluginName(lldb::LanguageType language) { +/// Returns the name of the LLDB plugin for the given language or an empty +/// string if there is no fitting plugin. +static llvm::StringRef GetPluginName(lldb::LanguageType language) { Language *language_plugin = Language::FindPlugin(language); if (language_plugin) return language_plugin->GetPluginName(); - return ConstString(); + return ""; } TEST(CLanguages, LookupCLanguagesByLanguageType) { diff --git a/lldb/unittests/Process/ProcessEventDataTest.cpp b/lldb/unittests/Process/ProcessEventDataTest.cpp --- a/lldb/unittests/Process/ProcessEventDataTest.cpp +++ b/lldb/unittests/Process/ProcessEventDataTest.cpp @@ -57,7 +57,7 @@ ThreadList &new_thread_list) override { return false; } - ConstString GetPluginName() override { return ConstString("Dummy"); } + llvm::StringRef GetPluginName() override { return "Dummy"; } ProcessModID &GetModIDNonConstRef() { return m_mod_id; } }; diff --git a/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp --- a/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp +++ b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp @@ -62,7 +62,8 @@ SymbolFile *symfile = module->GetSymbolFile(); ASSERT_NE(nullptr, symfile); - EXPECT_EQ(symfile->GetPluginName(), SymbolFileDWARF::GetPluginNameStatic()); + EXPECT_EQ(symfile->GetPluginName(), + SymbolFileDWARF::GetPluginNameStatic().GetStringRef()); uint32_t expected_abilities = SymbolFile::kAllAbilities; EXPECT_EQ(expected_abilities, symfile->CalculateAbilities()); diff --git a/lldb/unittests/Target/ExecutionContextTest.cpp b/lldb/unittests/Target/ExecutionContextTest.cpp --- a/lldb/unittests/Target/ExecutionContextTest.cpp +++ b/lldb/unittests/Target/ExecutionContextTest.cpp @@ -62,7 +62,7 @@ ThreadList &new_thread_list) override { return false; } - ConstString GetPluginName() override { return ConstString("Dummy"); } + llvm::StringRef GetPluginName() override { return "Dummy"; } }; } // namespace diff --git a/lldb/unittests/Target/RemoteAwarePlatformTest.cpp b/lldb/unittests/Target/RemoteAwarePlatformTest.cpp --- a/lldb/unittests/Target/RemoteAwarePlatformTest.cpp +++ b/lldb/unittests/Target/RemoteAwarePlatformTest.cpp @@ -25,7 +25,7 @@ using RemoteAwarePlatform::RemoteAwarePlatform; MOCK_METHOD0(GetDescription, const char *()); - MOCK_METHOD0(GetPluginName, ConstString()); + MOCK_METHOD0(GetPluginName, llvm::StringRef()); MOCK_METHOD2(GetSupportedArchitectureAtIndex, bool(uint32_t, ArchSpec &)); MOCK_METHOD4(Attach, ProcessSP(ProcessAttachInfo &, Debugger &, Target *, Status &)); @@ -41,7 +41,7 @@ using Platform::Platform; MOCK_METHOD0(GetDescription, const char *()); - MOCK_METHOD0(GetPluginName, ConstString()); + MOCK_METHOD0(GetPluginName, llvm::StringRef()); MOCK_METHOD2(GetSupportedArchitectureAtIndex, bool(uint32_t, ArchSpec &)); MOCK_METHOD4(Attach, ProcessSP(ProcessAttachInfo &, Debugger &, Target *, Status &)); diff --git a/lldb/unittests/Thread/ThreadTest.cpp b/lldb/unittests/Thread/ThreadTest.cpp --- a/lldb/unittests/Thread/ThreadTest.cpp +++ b/lldb/unittests/Thread/ThreadTest.cpp @@ -55,7 +55,7 @@ ThreadList &new_thread_list) override { return false; } - ConstString GetPluginName() override { return ConstString("Dummy"); } + llvm::StringRef GetPluginName() override { return "Dummy"; } ProcessModID &GetModIDNonConstRef() { return m_mod_id; } };