diff options
author | Pavel Labath <pavel@labath.sk> | 2021-10-15 13:07:39 +0200 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2021-10-18 10:14:42 +0200 |
commit | a3939e159fc9528b097672794035a1cdfda520e8 (patch) | |
tree | 1551cdd6d6c2d8b97bf69b04742b4b4cf0ca07d4 /lldb/source | |
parent | de4d2f80b75e2a1e4b0ac5c25e20f20839633688 (diff) | |
download | llvm-a3939e159fc9528b097672794035a1cdfda520e8.zip llvm-a3939e159fc9528b097672794035a1cdfda520e8.tar.gz llvm-a3939e159fc9528b097672794035a1cdfda520e8.tar.bz2 |
[lldb] Return StringRef from PluginInterface::GetPluginName
There is no reason why this function should be returning a ConstString.
While modifying these files, I also fixed several instances where
GetPluginName and GetPluginNameStatic were returning different strings.
I am not changing the return type of GetPluginNameStatic in this patch, as that
would necessitate additional changes, and this patch is big enough as it is.
Differential Revision: https://reviews.llvm.org/D111877
Diffstat (limited to 'lldb/source')
192 files changed, 408 insertions, 627 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index a854c22..d044061 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -1133,8 +1133,7 @@ SBStructuredData SBDebugger::GetAvailablePlatformInfoAtIndex(uint32_t idx) { 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 index a965814..acdf75a 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -88,7 +88,7 @@ const char *SBProcess::GetPluginName() { ProcessSP process_sp(GetSP()); if (process_sp) { - return process_sp->GetPluginName().GetCString(); + return ConstString(process_sp->GetPluginName()).GetCString(); } return "<Unknown>"; } @@ -98,7 +98,7 @@ const char *SBProcess::GetShortPluginName() { ProcessSP process_sp(GetSP()); if (process_sp) { - return process_sp->GetPluginName().GetCString(); + return ConstString(process_sp->GetPluginName()).GetCString(); } return "<Unknown>"; } diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 6bfb4c8..188d853 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -211,7 +211,7 @@ protected: 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 @@ protected: 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 @@ protected: } } 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 @@ protected: 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 @@ protected: } } 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 index 1534959..7a476022 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -2199,9 +2199,8 @@ public: 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 index c55fed4..62ee48c 100644 --- a/lldb/source/Commands/CommandObjectTrace.cpp +++ b/lldb/source/Commands/CommandObjectTrace.cpp @@ -117,8 +117,8 @@ protected: 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 index 1ddd957..0c73bdd 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1423,10 +1423,9 @@ void Debugger::HandleProcessEvent(const EventSP &event_sp) { 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 index a97e6b6..56cb5b8 100644 --- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h +++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h @@ -76,8 +76,8 @@ public: 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.cpp b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp index d2ee080..3f77073 100644 --- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp +++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp @@ -850,7 +850,3 @@ lldb_private::ConstString ABISysV_arm64::GetPluginNameStatic() { static ConstString g_name("SysV-arm64"); return g_name; } - -// PluginInterface protocol - -ConstString ABISysV_arm64::GetPluginName() { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h index c01023b..6a68606 100644 --- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h +++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h @@ -81,7 +81,9 @@ public: // 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/ARC/ABISysV_arc.cpp b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp index b736917..73ad696 100644 --- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp +++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp @@ -604,11 +604,3 @@ ConstString ABISysV_arc::GetPluginNameStatic() { static ConstString g_name("sysv-arc"); return g_name; } - -//------------------------------------------------------------------ -// PluginInterface protocol -//------------------------------------------------------------------ - -ConstString ABISysV_arc::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h index 62aec7b5..c0e6828 100644 --- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h +++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.h @@ -86,7 +86,9 @@ public: // PluginInterface protocol //------------------------------------------------------------------ - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } private: lldb::ValueObjectSP diff --git a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp index 9393980..3ecee7b 100644 --- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp +++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp @@ -1926,9 +1926,3 @@ lldb_private::ConstString ABIMacOSX_arm::GetPluginNameStatic() { 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/ABIMacOSX_arm.h b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h index 37bda9e..6612d71 100644 --- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h +++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h @@ -75,7 +75,9 @@ public: // 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 index 43f277e..fb066bc 100644 --- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp +++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp @@ -2032,9 +2032,3 @@ lldb_private::ConstString ABISysV_arm::GetPluginNameStatic() { 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/ARM/ABISysV_arm.h b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.h index fe2d274..c86e0ac 100644 --- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.h +++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.h @@ -75,7 +75,9 @@ public: // PluginInterface protocol - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: lldb::ValueObjectSP diff --git a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp index 07ea8a6..51c2f2e 100644 --- a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp +++ b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp @@ -1198,12 +1198,6 @@ lldb_private::ConstString ABISysV_hexagon::GetPluginNameStatic() { 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/Hexagon/ABISysV_hexagon.h b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h index 6698f0c..af6f1d7 100644 --- a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h +++ b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h @@ -83,7 +83,9 @@ public: // 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 index ac0531a..bd25dea 100644 --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp @@ -1019,9 +1019,3 @@ lldb_private::ConstString ABISysV_mips::GetPluginNameStatic() { 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_mips.h b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.h index cd61139..ce4dba7 100644 --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.h +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.h @@ -73,7 +73,9 @@ public: // 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 index 9aa390c..229390a 100644 --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp @@ -1167,9 +1167,3 @@ lldb_private::ConstString ABISysV_mips64::GetPluginNameStatic() { 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/Mips/ABISysV_mips64.h b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h index 5f94be0..61d6a62 100644 --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h @@ -86,7 +86,9 @@ public: // 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 index 579eb08..e1e5c44 100644 --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp @@ -967,9 +967,3 @@ lldb_private::ConstString ABISysV_ppc::GetPluginNameStatic() { 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_ppc.h b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h index 128ed36..2e3be0a 100644 --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h @@ -82,7 +82,9 @@ public: // 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 index f8d63e8..e0e6a41 100644 --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp @@ -1079,9 +1079,3 @@ lldb_private::ConstString ABISysV_ppc64::GetPluginNameStatic() { 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/PowerPC/ABISysV_ppc64.h b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h index 5d52ece..1592332 100644 --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h @@ -82,7 +82,9 @@ public: // 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 index f202668..8b4989f 100644 --- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp +++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp @@ -721,9 +721,3 @@ lldb_private::ConstString ABISysV_s390x::GetPluginNameStatic() { 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/SystemZ/ABISysV_s390x.h b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h index 36efe1e..042f7709 100644 --- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h +++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h @@ -74,7 +74,9 @@ public: // 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/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp index 0a5d422..79267e0 100644 --- a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp +++ b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp @@ -465,9 +465,3 @@ lldb_private::ConstString ABIMacOSX_i386::GetPluginNameStatic() { 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/ABIMacOSX_i386.h b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h index 4c54645..062da54 100644 --- a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h +++ b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h @@ -77,7 +77,9 @@ public: 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 index 7d2f0a64..7b03bfa 100644 --- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp +++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp @@ -721,7 +721,3 @@ lldb_private::ConstString ABISysV_i386::GetPluginNameStatic() { 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_i386.h b/lldb/source/Plugins/ABI/X86/ABISysV_i386.h index c3a5843..a98359f 100644 --- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.h +++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.h @@ -85,7 +85,9 @@ public: 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_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp index f53cd9a..794747d 100644 --- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp +++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp @@ -957,9 +957,3 @@ lldb_private::ConstString ABISysV_x86_64::GetPluginNameStatic() { 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/ABISysV_x86_64.h b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h index eb17ed5..d762703 100644 --- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h +++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h @@ -79,8 +79,9 @@ public: 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/ABIWindows_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp index b2b5d5b..87e191a 100644 --- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp +++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp @@ -828,11 +828,3 @@ lldb_private::ConstString ABIWindows_x86_64::GetPluginNameStatic() { 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/ABI/X86/ABIWindows_x86_64.h b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h index e1737d9..b2a6d85 100644 --- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h +++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h @@ -73,7 +73,9 @@ public: // PluginInterface protocol //------------------------------------------------------------------ - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } protected: void CreateRegisterMapIfNeeded(); diff --git a/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp b/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp index a62a9a8..286dd01 100644 --- a/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp +++ b/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp @@ -38,7 +38,3 @@ ArchitectureAArch64::Create(const ArchSpec &arch) { } return std::unique_ptr<Architecture>(new ArchitectureAArch64()); } - -ConstString ArchitectureAArch64::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h b/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h index 686711d..1a9f816 100644 --- a/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h +++ b/lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h @@ -20,7 +20,9 @@ public: 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 index 765777a..c9b307e 100644 --- a/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp +++ b/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp @@ -39,8 +39,6 @@ std::unique_ptr<Architecture> ArchitectureArm::Create(const ArchSpec &arch) { return std::unique_ptr<Architecture>(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/Arm/ArchitectureArm.h b/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h index 33a7f8b..48bfdff 100644 --- a/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h +++ b/lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h @@ -19,7 +19,9 @@ public: 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 index c3de75f..a6977a2 100644 --- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp +++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp @@ -42,8 +42,6 @@ std::unique_ptr<Architecture> ArchitectureMips::Create(const ArchSpec &arch) { std::unique_ptr<Architecture>(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/Mips/ArchitectureMips.h b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h index eb6028c..5d5f164 100644 --- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h +++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h @@ -20,7 +20,9 @@ public: 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 index cf1567a..4b35947 100644 --- a/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp +++ b/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp @@ -43,8 +43,6 @@ std::unique_ptr<Architecture> ArchitecturePPC64::Create(const ArchSpec &arch) { 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/Architecture/PPC64/ArchitecturePPC64.h b/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h index e2ca827..5457ff5 100644 --- a/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h +++ b/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.h @@ -19,7 +19,9 @@ public: 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/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index bc61764..5b4f16d 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1461,6 +1461,3 @@ const char *DisassemblerLLVMC::SymbolLookup(uint64_t value, uint64_t *type_ptr, *name = nullptr; return nullptr; } - -// PluginInterface protocol -ConstString DisassemblerLLVMC::GetPluginName() { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h index 0b9fb78..a842b01 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h @@ -43,7 +43,9 @@ public: 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/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index fd4dd1d..b45a221 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -803,10 +803,9 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule( // 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 @@ const char *DynamicLoaderDarwinKernel::GetPluginDescriptionStatic() { "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/Darwin-Kernel/DynamicLoaderDarwinKernel.h b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h index 8bf6049..c1e8894 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h @@ -58,7 +58,9 @@ public: 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/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index 1ed83a3..86197ac 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -78,10 +78,6 @@ void DynamicLoaderHexagonDYLD::Initialize() { 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/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h index 2597d3d..f4594b0 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h @@ -47,7 +47,9 @@ public: 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/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index bedd100e..90a42c6 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -513,8 +513,3 @@ const char *DynamicLoaderMacOS::GetPluginDescriptionStatic() { 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/DynamicLoaderMacOS.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h index 03aa98b..b9f54f2 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h @@ -60,7 +60,9 @@ public: 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/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 4affa83..5ba238e 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -1146,11 +1146,6 @@ const char *DynamicLoaderMacOSXDYLD::GetPluginDescriptionStatic() { "in MacOSX user processes."; } -// PluginInterface protocol -lldb_private::ConstString DynamicLoaderMacOSXDYLD::GetPluginName() { - return GetPluginNameStatic(); -} - uint32_t DynamicLoaderMacOSXDYLD::AddrByteSize() { std::lock_guard<std::recursive_mutex> baseclass_guard(GetMutex()); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h index 2e83e5a..697c780 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h @@ -64,7 +64,9 @@ public: 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/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 7732f27..ecb5f76 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -38,10 +38,6 @@ void DynamicLoaderPOSIXDYLD::Initialize() { 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/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h index 678da1d..09ada32 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -53,7 +53,9 @@ public: 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/Static/DynamicLoaderStatic.cpp b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp index d4abad4..53a07fb 100644 --- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp +++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp @@ -161,8 +161,3 @@ const char *DynamicLoaderStatic::GetPluginDescriptionStatic() { 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/Static/DynamicLoaderStatic.h b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h index 8a6e31e..87973d1 100644 --- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h +++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h @@ -44,7 +44,9 @@ public: 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/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp index a32aa49..5c93cbc 100644 --- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp @@ -174,10 +174,6 @@ void DynamicLoaderWindowsDYLD::DidLaunch() { Status DynamicLoaderWindowsDYLD::CanLoadImage() { return Status(); } -ConstString DynamicLoaderWindowsDYLD::GetPluginName() { - return GetPluginNameStatic(); -} - ThreadPlanSP DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(Thread &thread, bool stop) { diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h index 9d1217d..8218e08 100644 --- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h @@ -39,7 +39,9 @@ public: 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/wasm-DYLD/DynamicLoaderWasmDYLD.h b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h index 91fd5b2b..f0ca265 100644 --- a/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h @@ -37,7 +37,9 @@ public: /// 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 index 31707f8..977a461 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp @@ -311,8 +311,7 @@ bool ClangExpressionSourceCode::GetText( } 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 index 824a1a1..a1b3a8c 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h @@ -83,8 +83,8 @@ public: 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.cpp b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp index ab5a5d0..2c6c22b 100644 --- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp +++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp @@ -122,11 +122,6 @@ ConstString EmulateInstructionARM64::GetPluginNameStatic() { 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/ARM64/EmulateInstructionARM64.h b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h index 10a54c3..c371927 100644 --- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h +++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h @@ -46,7 +46,9 @@ public: 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 index 6eb1aae..547befa 100644 --- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -198,11 +198,6 @@ ConstString EmulateInstructionMIPS::GetPluginNameStatic() { 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/MIPS/EmulateInstructionMIPS.h b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h index 60dc24e..c993de5 100644 --- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h +++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h @@ -55,7 +55,9 @@ public: 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 index 4a5c7ff..3c96ee7 100644 --- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -185,11 +185,6 @@ ConstString EmulateInstructionMIPS64::GetPluginNameStatic() { 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/MIPS64/EmulateInstructionMIPS64.h b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h index a4d4148..892402a 100644 --- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h +++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h @@ -53,7 +53,9 @@ public: 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/PPC64/EmulateInstructionPPC64.cpp b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp index 4e78c36..5f00746 100644 --- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp +++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp @@ -44,11 +44,6 @@ ConstString EmulateInstructionPPC64::GetPluginNameStatic() { 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/Instruction/PPC64/EmulateInstructionPPC64.h b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h index 8fdac1a2..2799ed7 100644 --- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h +++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h @@ -44,7 +44,9 @@ public: return false; } - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } bool SetTargetTriple(const ArchSpec &arch) override; diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h index c7145b0..53d13b5 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h +++ b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h @@ -31,8 +31,8 @@ public: 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 index 32e2a78..011ca9d 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h +++ b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h @@ -32,8 +32,8 @@ public: 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 index 0d2d5ac..97e174e 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h +++ b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h @@ -31,8 +31,8 @@ public: 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 index 4823ed6..6c9f47ec 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h +++ b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h @@ -32,8 +32,8 @@ public: 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.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp index 8cd6b92..b40b27c 100644 --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -432,10 +432,6 @@ const char *JITLoaderGDB::GetPluginDescriptionStatic() { "interface."; } -lldb_private::ConstString JITLoaderGDB::GetPluginName() { - return GetPluginNameStatic(); -} - void JITLoaderGDB::Initialize() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance, diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h index c094678..6091547 100644 --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h @@ -35,7 +35,9 @@ public: 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/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index bc3142f..6dd0a07 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -95,12 +95,6 @@ ConstString CPlusPlusLanguage::GetDemangledFunctionNameWithoutArguments( return mangled.GetMangledName(); } -// PluginInterface protocol - -lldb_private::ConstString CPlusPlusLanguage::GetPluginName() { - return GetPluginNameStatic(); -} - // Static Functions Language *CPlusPlusLanguage::CreateInstance(lldb::LanguageType language) { @@ -1095,7 +1089,8 @@ lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() { 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/CPlusPlus/CPlusPlusLanguage.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h index 855e330..eebb409 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h @@ -134,7 +134,9 @@ public: 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/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp index c5b7b12..7aeaf7a 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -53,12 +53,6 @@ lldb_private::ConstString ObjCLanguage::GetPluginNameStatic() { return g_name; } -// PluginInterface protocol - -lldb_private::ConstString ObjCLanguage::GetPluginName() { - return GetPluginNameStatic(); -} - // Static Functions Language *ObjCLanguage::CreateInstance(lldb::LanguageType language) { @@ -932,7 +926,8 @@ lldb::TypeCategoryImplSP ObjCLanguage::GetFormatters() { 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/ObjC/ObjCLanguage.h b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h index ea43ba5..bc35cbe 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h @@ -156,7 +156,9 @@ public: } // 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 index 614efbd..2aa49ad 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp @@ -39,11 +39,6 @@ lldb_private::ConstString ObjCPlusPlusLanguage::GetPluginNameStatic() { 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/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h index 63b3521..9d09372 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h @@ -43,7 +43,9 @@ public: 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/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 014fef3..d6048fb 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -410,11 +410,6 @@ lldb_private::ConstString ItaniumABILanguageRuntime::GetPluginNameStatic() { 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/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h index 988022d..7b37cf8 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h @@ -76,7 +76,9 @@ public: 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/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp index 05e7518..1fb872f 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -97,11 +97,6 @@ lldb_private::ConstString AppleObjCRuntimeV1::GetPluginNameStatic() { 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/AppleObjCRuntimeV1.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h index 9ccf3da..26449b5 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h @@ -107,7 +107,9 @@ public: 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/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 57de1fa..eaab24c 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1066,11 +1066,6 @@ lldb_private::ConstString AppleObjCRuntimeV2::GetPluginNameStatic() { 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 @@ static bool DoesProcessHaveSharedCache(Process &process) { 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/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h index e57519b..8ea4cf9 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -54,7 +54,9 @@ public: llvm::Expected<std::unique_ptr<UtilityFunction>> 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/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index ba52b8d..517d160e 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -1013,11 +1013,6 @@ void RenderScriptRuntime::ModulesDidLoad(const ModuleList &module_list) { } } -// 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/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h index f982e18..66553fd 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -410,7 +410,9 @@ public: 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/MemoryHistory/asan/MemoryHistoryASan.h b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h index ebce4af..cdeba88 100644 --- a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h +++ b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h @@ -29,8 +29,8 @@ public: 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.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index ea53089..529f384 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -433,11 +433,6 @@ ObjectFileSP ObjectContainerBSDArchive::GetObjectFile(const FileSpec *file) { 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/BSD-Archive/ObjectContainerBSDArchive.h b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h index 9d1a0c2..33b26b0 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h @@ -68,7 +68,9 @@ public: 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/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp index 4440bcc..1184c02 100644 --- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp +++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp @@ -205,11 +205,6 @@ ObjectContainerUniversalMachO::GetObjectFile(const FileSpec *file) { 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/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h index 128bf62..5946c95 100644 --- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h +++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h @@ -59,7 +59,9 @@ public: 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/ObjectFile/Breakpad/ObjectFileBreakpad.h b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h index 8f2091f..8181e93 100644 --- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h +++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h @@ -44,7 +44,9 @@ public: 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.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 8428978..f7e4441 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -633,11 +633,6 @@ size_t ObjectFileELF::GetModuleSpecifications( 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/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index 9afb8696..ff2bc5a 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -85,7 +85,9 @@ public: 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/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp index dcac63d..e19bd77 100644 --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -199,11 +199,6 @@ ArchSpec ObjectFileJIT::GetArchitecture() { 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/JIT/ObjectFileJIT.h b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h index f617788..c786adb 100644 --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h +++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h @@ -96,7 +96,9 @@ public: 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/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index b3892b0..05132de 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -6191,11 +6191,6 @@ bool ObjectFileMachO::AllowAssemblyEmulationUnwindPlans() { 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/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h index 8fd5737..b3e1d98 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h @@ -146,7 +146,9 @@ public: 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/Minidump/ObjectFileMinidump.h b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h index b7349e5..6c68b48 100644 --- a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h +++ b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h @@ -35,8 +35,8 @@ public: } // 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 index 578d64c..b9a3753 100644 --- a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h +++ b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h @@ -48,7 +48,9 @@ public: 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.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index fdc2b7b..d70b4eb 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -1205,6 +1205,3 @@ ObjectFile::Type ObjectFilePECOFF::CalculateType() { } ObjectFile::Strata ObjectFilePECOFF::CalculateStrata() { return eStrataUser; } - -// PluginInterface protocol -ConstString ObjectFilePECOFF::GetPluginName() { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h index 1b66d3f..aa3c523 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -130,7 +130,9 @@ public: 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/wasm/ObjectFileWasm.h b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h index 48cf313..d420858 100644 --- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h +++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h @@ -48,7 +48,9 @@ public: /// 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.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 40cf1d9..570c9aa 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -140,11 +140,6 @@ DynamicRegisterInfo *OperatingSystemPython::GetDynamicRegisterInfo() { 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/OperatingSystem/Python/OperatingSystemPython.h b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h index 743fb54..e343285 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h @@ -41,7 +41,9 @@ public: 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/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index f4642ba..1e66b86 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -146,17 +146,11 @@ const char *PlatformAndroid::GetPluginDescriptionStatic(bool is_host) { 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/Android/PlatformAndroid.h b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h index 913a609..dd1f0c0 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h @@ -34,7 +34,9 @@ public: 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/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 7b3d8a3..d44a910 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -93,10 +93,6 @@ const char *PlatformFreeBSD::GetPluginDescriptionStatic(bool is_host) { 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/FreeBSD/PlatformFreeBSD.h b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h index a8d7529..16a28da 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h @@ -29,7 +29,9 @@ public: 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 index 314730c..34a7df9 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -89,10 +89,6 @@ const char *PlatformLinux::GetPluginDescriptionStatic(bool is_host) { 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/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h index f343b24..71f5410 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -29,7 +29,9 @@ public: 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/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index 0919ba2..c9c275c 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -406,10 +406,10 @@ Status PlatformAppleSimulator::ResolveExecutable( 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 @@ Status PlatformAppleSimulator::GetSymbolFile(const FileSpec &platform_file, 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/PlatformAppleSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h index fc428ad..cdc3bed 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h @@ -46,7 +46,9 @@ public: 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/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 943b157..88ee161 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1619,7 +1619,7 @@ ConstString PlatformDarwin::GetFullNameForDylib(ConstString basename) { } 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 index a7a325d..60b7945 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -42,8 +42,8 @@ public: 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 index d16c25f..5201c56 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h @@ -28,8 +28,8 @@ public: 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 index 9da8bee..96546c6 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h @@ -34,8 +34,8 @@ public: 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 index d69590c..84c42a2 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h @@ -34,8 +34,8 @@ public: 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 index 43c1e08..d0eebc6 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h @@ -39,8 +39,8 @@ public: 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 index 79cbd1c..236eace 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -111,10 +111,10 @@ Status PlatformRemoteDarwinDevice::ResolveExecutable( 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 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file, 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 index 6b9880d..290a195 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h @@ -33,8 +33,8 @@ public: 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 index d3a8302..6b78768 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h @@ -37,8 +37,8 @@ public: 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.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp index e3682b4..a6972ff 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -82,10 +82,6 @@ const char *PlatformNetBSD::GetPluginDescriptionStatic(bool is_host) { 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/NetBSD/PlatformNetBSD.h b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h index 82fddd2..b25f5dc 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h @@ -29,7 +29,9 @@ public: 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 index 012b688..b5bb2ea 100644 --- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp @@ -88,10 +88,6 @@ const char *PlatformOpenBSD::GetPluginDescriptionStatic(bool is_host) { 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/OpenBSD/PlatformOpenBSD.h b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h index 0ac5552..8da2d75 100644 --- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h +++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h @@ -29,7 +29,9 @@ public: 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/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index 4a93e58..719109c8 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -300,9 +300,9 @@ const lldb::UnixSignalsSP &PlatformPOSIX::GetRemoteUnixSignals() { 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 PlatformPOSIX::DisconnectRemote() { 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.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp index 69fa94c..eaa381d 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -117,10 +117,6 @@ const char *PlatformWindows::GetPluginDescriptionStatic(bool is_host) { : "Remote Windows user platform plug-in."; } -lldb_private::ConstString PlatformWindows::GetPluginName() { - return GetPluginNameStatic(IsHost()); -} - void PlatformWindows::Initialize() { Platform::Initialize(); @@ -154,9 +150,9 @@ PlatformWindows::PlatformWindows(bool is_host) : RemoteAwarePlatform(is_host) {} 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 PlatformWindows::DisconnectRemote() { 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/Windows/PlatformWindows.h b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h index 9bff68f..2a0247d 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h @@ -29,7 +29,9 @@ public: 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/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 01a0ec5..667618b 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -145,10 +145,10 @@ Status PlatformRemoteGDBServer::ResolveExecutable( 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/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h index 4f0e3c2..0c8584a 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h @@ -37,7 +37,9 @@ public: ~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/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index 749d744..088a2ae 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -172,11 +172,6 @@ ProcessKDP::~ProcessKDP() { 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/MacOSX-Kernel/ProcessKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h index 35c5f57..4373141 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h @@ -85,7 +85,9 @@ public: 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/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp index 74efa35..0952e2d 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -142,12 +142,6 @@ size_t ProcessWindows::PutSTDIN(const char *buf, size_t buf_size, 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/Windows/Common/ProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h index 3a48a6de..5bd7056 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h @@ -45,8 +45,9 @@ public: 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/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index 5bbdc96..f7ae421 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -110,9 +110,6 @@ ProcessElfCore::~ProcessElfCore() { 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/elf-core/ProcessElfCore.h b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h index d2c0bf1..3e70e97 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h @@ -60,7 +60,9 @@ public: 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 @@ public: 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/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 1a5f4a2..79a3941 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -324,9 +324,6 @@ ProcessGDBRemote::~ProcessGDBRemote() { KillDebugserverProcess(); } -// PluginInterface -ConstString ProcessGDBRemote::GetPluginName() { return GetPluginNameStatic(); } - bool ProcessGDBRemote::ParsePythonTargetDefinition( const FileSpec &target_definition_fspec) { ScriptInterpreter *interpreter = diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index ce74b34..071e031 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -103,7 +103,9 @@ public: 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/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index 946f8de..71197fb 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -128,9 +128,6 @@ ProcessMachCore::~ProcessMachCore() { 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/mach-core/ProcessMachCore.h b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h index 1eec2e4..72f7ae3 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h @@ -49,7 +49,9 @@ public: 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/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index 0793fc2..c9e1350 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -63,7 +63,9 @@ public: 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 @@ Status ProcessMinidump::DoLoadCore() { return error; } -ConstString ProcessMinidump::GetPluginName() { return GetPluginNameStatic(); } - Status ProcessMinidump::DoDestroy() { return Status(); } void ProcessMinidump::RefreshStateAfterStop() { @@ -581,8 +581,9 @@ void ProcessMinidump::ReadModuleList() { // 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/minidump/ProcessMinidump.h b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h index d748c9d..99d4b3e 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.h +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.h @@ -55,7 +55,9 @@ public: DynamicLoader *GetDynamicLoader() override { return nullptr; } - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } SystemRuntime *GetSystemRuntime() override { return nullptr; } @@ -85,9 +87,8 @@ public: 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/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp index 5857625..5215123 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -145,8 +145,6 @@ void ScriptedProcess::Terminate() { PluginManager::UnregisterPlugin(ScriptedProcess::CreateInstance); } -ConstString ScriptedProcess::GetPluginName() { return GetPluginNameStatic(); } - Status ScriptedProcess::DoLoadCore() { ProcessLaunchInfo launch_info = GetTarget().GetProcessLaunchInfo(); diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h index e7a5147..c2ec371 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h @@ -63,7 +63,9 @@ public: 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/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp index 47fb12b..24b3674 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp @@ -396,8 +396,4 @@ const char *ScriptInterpreterLua::GetPluginDescriptionStatic() { return "Lua script interpreter"; } -lldb_private::ConstString ScriptInterpreterLua::GetPluginName() { - return GetPluginNameStatic(); -} - Lua &ScriptInterpreterLua::GetLua() { return *m_lua; } diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h index 447fce5..1cb0dcc 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h @@ -70,7 +70,9 @@ public: 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/None/ScriptInterpreterNone.cpp b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp index 6d7bef6..ace3ede 100644 --- a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp @@ -65,7 +65,3 @@ lldb_private::ConstString ScriptInterpreterNone::GetPluginNameStatic() { const char *ScriptInterpreterNone::GetPluginDescriptionStatic() { return "Null script interpreter"; } - -lldb_private::ConstString ScriptInterpreterNone::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h index cbfa019..e16d525 100644 --- a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h +++ b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h @@ -37,7 +37,9 @@ public: 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/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 6759506..5b1ffbc 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -590,10 +590,6 @@ ScriptInterpreterPythonImpl::~ScriptInterpreterPythonImpl() { 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 index b6926b6..443a65a 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h @@ -292,7 +292,9 @@ public: 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.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp index 5339c5b..0ee7660 100644 --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -800,8 +800,9 @@ protected: // 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"); } @@ -1055,15 +1056,6 @@ ConstString StructuredDataDarwinLog::GetStaticPluginName() { } #pragma mark - -#pragma mark PluginInterface API - -// PluginInterface API - -ConstString StructuredDataDarwinLog::GetPluginName() { - return GetStaticPluginName(); -} - -#pragma mark - #pragma mark StructuredDataPlugin API // StructuredDataPlugin API diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h index 6625154..f1be063 100644 --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h @@ -46,7 +46,9 @@ public: // PluginInterface API - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetStaticPluginName().GetStringRef(); + } // StructuredDataPlugin API diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h index b4faad5..1013f6e 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h @@ -146,7 +146,9 @@ public: 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.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 6085027..81c7305 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -3833,9 +3833,6 @@ SymbolFileDWARF::ParseCallEdgesInFunction(UserID func_id) { 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/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index d001742..e02ae13 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -218,7 +218,9 @@ public: 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/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 6453213..884260f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -528,8 +528,8 @@ SymbolFileDWARFDebugMap::GetSymbolFileByOSOIndex(uint32_t oso_idx) { 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<SymbolFileDWARF *>(sym_file); return nullptr; } @@ -1234,11 +1234,6 @@ void SymbolFileDWARFDebugMap::DumpClangAST(Stream &s) { }); } -// 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/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h index bd6c451..a55bb3a 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -140,7 +140,9 @@ public: 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/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp index 6b8281e..8f0adaf 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -1566,8 +1566,3 @@ SymbolFileNativePDB::GetTypeSystemForLanguage(lldb::LanguageType language) { } return type_system_or_err; } - -ConstString SymbolFileNativePDB::GetPluginName() { - static ConstString g_name("pdb"); - return g_name; -} diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h index 3636b97..acbf05f 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h @@ -151,7 +151,9 @@ public: 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/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp index be1c62c..9c98ce7 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -1713,11 +1713,6 @@ SymbolFilePDB::FindNamespace(lldb_private::ConstString name, 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/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h index 62ba8a2..67e309f 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h @@ -161,7 +161,9 @@ public: 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/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp index ce00d2e..e3358b2 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -260,8 +260,3 @@ uint32_t SymbolFileSymtab::ResolveSymbolContext(const Address &so_addr, } return resolved_flags; } - -// PluginInterface protocol -lldb_private::ConstString SymbolFileSymtab::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h index dff26bd..11475b0 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h @@ -85,7 +85,9 @@ public: 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/SymbolVendor/ELF/SymbolVendorELF.cpp b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp index 8354a40..a598bb0 100644 --- a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp +++ b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp @@ -144,6 +144,3 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp, symbol_vendor->AddSymbolFileRepresentation(dsym_objfile_sp); return symbol_vendor; } - -// PluginInterface protocol -ConstString SymbolVendorELF::GetPluginName() { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h index e264b23..60b5203 100644 --- a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h +++ b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h @@ -31,7 +31,9 @@ public: 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/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp index 23acce8..c3fe34a 100644 --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -310,8 +310,3 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp, } return symbol_vendor; } - -// PluginInterface protocol -ConstString SymbolVendorMacOSX::GetPluginName() { - return GetPluginNameStatic(); -} diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h index 3a7fbfa..11312a8 100644 --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h @@ -31,7 +31,9 @@ public: 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/wasm/SymbolVendorWasm.cpp b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp index 41d7117..6be717b 100644 --- a/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp +++ b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp @@ -139,6 +139,3 @@ SymbolVendorWasm::CreateInstance(const lldb::ModuleSP &module_sp, symbol_vendor->AddSymbolFileRepresentation(sym_objfile_sp); return symbol_vendor; } - -// PluginInterface protocol -ConstString SymbolVendorWasm::GetPluginName() { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h index 940492a..403bdb9 100644 --- a/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h +++ b/lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.h @@ -30,7 +30,9 @@ public: /// PluginInterface protocol. /// \{ - lldb_private::ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } /// \} }; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp index aa81eb2..262ec87 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -992,8 +992,3 @@ lldb_private::ConstString SystemRuntimeMacOSX::GetPluginNameStatic() { 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/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h index 8e128b6..1ac8569 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h @@ -98,7 +98,9 @@ public: 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/Trace/intel-pt/TraceIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp index 26c94ff..1b2a5b2 100644 --- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp +++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp @@ -58,12 +58,6 @@ StringRef TraceIntelPT::GetSchema() { 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 @@ Error TraceIntelPT::Start(size_t thread_buffer_size, 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 @@ llvm::Error TraceIntelPT::Start(llvm::ArrayRef<lldb::tid_t> tids, 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/Trace/intel-pt/TraceIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h index 851a04b..2962906 100644 --- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h +++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h @@ -28,7 +28,9 @@ public: /// PluginInterface protocol /// \{ - 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 index 91d2fe8..893a285 100644 --- a/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp +++ b/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp @@ -44,8 +44,6 @@ ConstString TraceExporterCTF::GetPluginNameStatic() { return g_name; } -ConstString TraceExporterCTF::GetPluginName() { return GetPluginNameStatic(); } - Expected<TraceExporterUP> TraceExporterCTF::CreateInstance() { return std::make_unique<TraceExporterCTF>(); } diff --git a/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h b/lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h index 5685682..7ead18b 100644 --- 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 @@ public: /// \{ static llvm::Expected<lldb::TraceExporterUP> CreateInstance(); - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } static void Initialize(); diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index f49ca04..6db0f5a 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -574,10 +574,6 @@ ConstString TypeSystemClang::GetPluginNameStatic() { 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/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index ec0335b..1c57440 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -138,7 +138,9 @@ public: void Finalize() override; // PluginInterface functions - ConstString GetPluginName() override; + llvm::StringRef GetPluginName() override { + return GetPluginNameStatic().GetStringRef(); + } static ConstString GetPluginNameStatic(); diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp index bd96d3c..f489dd2 100644 --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -333,11 +333,6 @@ UnwindAssemblyInstEmulation::CreateInstance(const ArchSpec &arch) { 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/InstEmulation/UnwindAssemblyInstEmulation.h b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h index 4e0f8a493..670be1b 100644 --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h @@ -56,7 +56,9 @@ public: 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/x86/UnwindAssembly-x86.cpp b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp index 2ae67db..f070008 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -239,12 +239,6 @@ UnwindAssembly *UnwindAssembly_x86::CreateInstance(const ArchSpec &arch) { 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/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h index 8bd8a73..16c7cf7 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h @@ -50,7 +50,9 @@ public: 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/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp index f50ee6c..d263631 100644 --- a/lldb/source/Symbol/SymbolVendor.cpp +++ b/lldb/source/Symbol/SymbolVendor.cpp @@ -69,9 +69,3 @@ void SymbolVendor::AddSymbolFileRepresentation(const ObjectFileSP &objfile_sp) { 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 index 07cbc11..9c57689 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -399,7 +399,7 @@ Platform::~Platform() = default; 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 @@ Status Platform::MakeDirectory(const FileSpec &file_spec, 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 @@ Status Platform::GetFilePermissions(const FileSpec &file_spec, 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 @@ Status Platform::SetFilePermissions(const FileSpec &file_spec, 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 @@ ArchSpec Platform::GetAugmentedArchSpec(llvm::StringRef triple) { 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 @@ lldb::ProcessSP Platform::DebugProcess(ProcessLaunchInfo &launch_info, 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 index c4f047a..bb719bc 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2939,13 +2939,11 @@ void Process::CompleteAttach() { 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() - : "<none>", - dyld->GetPluginName().AsCString("<unnamed>")); + 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 @@ void Process::CompleteAttach() { 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() - : "<none>", - system_runtime->GetPluginName().AsCString("<unnamed>")); + 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 @@ void Process::MapSupportedStructuredDataPlugins( 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 @@ llvm::Expected<const MemoryTagManager *> Process::GetMemoryTagManager() { 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 index 6ddb30a..9d0dece 100644 --- a/lldb/source/Target/ProcessTrace.cpp +++ b/lldb/source/Target/ProcessTrace.cpp @@ -57,8 +57,6 @@ ProcessTrace::~ProcessTrace() { 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 index b0c43ff..61a84e8 100644 --- a/lldb/source/Target/RemoteAwarePlatform.cpp +++ b/lldb/source/Target/RemoteAwarePlatform.cpp @@ -154,10 +154,10 @@ Status RemoteAwarePlatform::ResolveExecutable( 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 index 827f326..06dc05a 100644 --- a/lldb/source/Target/Trace.cpp +++ b/lldb/source/Target/Trace.cpp @@ -108,23 +108,21 @@ Error Trace::Stop() { 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<lldb::tid_t> 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<std::string> 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<size_t> Trace::GetLiveThreadBinaryDataSize(lldb::tid_t tid, @@ -158,7 +156,7 @@ Trace::GetLiveThreadBinaryData(lldb::tid_t tid, llvm::StringRef kind) { "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<int64_t>(tid), 0, static_cast<int64_t>(*size)}; return m_live_process->TraceGetBinaryData(request); @@ -175,8 +173,8 @@ Trace::GetLiveProcessBinaryData(llvm::StringRef kind) { inconvertibleErrorCode(), "Tracing data \"%s\" is not available for the process.", kind.data()); - TraceGetBinaryDataRequest request{GetPluginName().AsCString(), kind.str(), - None, 0, static_cast<int64_t>(*size)}; + TraceGetBinaryDataRequest request{GetPluginName().str(), kind.str(), None, 0, + static_cast<int64_t>(*size)}; return m_live_process->TraceGetBinaryData(request); } |