[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
This commit is contained in:
Pavel Labath 2021-10-15 13:07:39 +02:00
parent de4d2f80b7
commit a3939e159f
205 changed files with 468 additions and 687 deletions

View File

@ -9,7 +9,7 @@
#ifndef LLDB_CORE_PLUGININTERFACE_H
#define LLDB_CORE_PLUGININTERFACE_H
#include "lldb/lldb-private.h"
#include "llvm/ADT/StringRef.h"
namespace lldb_private {
@ -18,7 +18,7 @@ public:
PluginInterface() = default;
virtual ~PluginInterface() = default;
virtual ConstString GetPluginName() = 0;
virtual llvm::StringRef GetPluginName() = 0;
PluginInterface(const PluginInterface &) = delete;
PluginInterface &operator=(const PluginInterface &) = delete;

View File

@ -41,7 +41,7 @@ public:
SymbolFile *GetSymbolFile() { return m_sym_file_up.get(); }
// PluginInterface protocol
ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override { return "vendor-default"; }
protected:
std::unique_ptr<SymbolFile> m_sym_file_up; // A single symbol file. Subclasses

View File

@ -610,9 +610,8 @@ public:
virtual Status DoLoadCore() {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support loading core files.",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support loading core files.", GetPluginName());
return error;
}
@ -941,9 +940,9 @@ public:
virtual Status DoAttachToProcessWithID(lldb::pid_t pid,
const ProcessAttachInfo &attach_info) {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support attaching to a process by pid",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support attaching to a process by pid",
GetPluginName());
return error;
}
@ -1026,9 +1025,8 @@ public:
/// operation.
virtual Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support launching processes",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support launching processes", GetPluginName());
return error;
}
@ -1062,9 +1060,8 @@ public:
/// \see Thread:Suspend()
virtual Status DoResume() {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support resuming processes",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support resuming processes", GetPluginName());
return error;
}
@ -1098,9 +1095,8 @@ public:
/// otherwise.
virtual Status DoHalt(bool &caused_stop) {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support halting processes",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support halting processes", GetPluginName());
return error;
}
@ -1125,9 +1121,9 @@ public:
/// false otherwise.
virtual Status DoDetach(bool keep_stopped) {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support detaching from processes",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support detaching from processes",
GetPluginName());
return error;
}
@ -1156,9 +1152,9 @@ public:
/// Returns an error object.
virtual Status DoSignal(int signal) {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support sending signals to processes",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support sending signals to processes",
GetPluginName());
return error;
}
@ -1585,9 +1581,8 @@ public:
/// The number of bytes that were actually written.
virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf,
size_t size, Status &error) {
error.SetErrorStringWithFormat(
"error: %s does not support writing to processes",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support writing to processes", GetPluginName());
return 0;
}
@ -1669,9 +1664,9 @@ public:
virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions,
Status &error) {
error.SetErrorStringWithFormat(
"error: %s does not support allocating in the debug process",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support allocating in the debug process",
GetPluginName());
return LLDB_INVALID_ADDRESS;
}
@ -1924,9 +1919,9 @@ public:
/// \btrue if the memory was deallocated, \bfalse otherwise.
virtual Status DoDeallocateMemory(lldb::addr_t ptr) {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support deallocating in the debug process",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support deallocating in the debug process",
GetPluginName());
return error;
}
@ -2044,17 +2039,15 @@ public:
virtual Status EnableBreakpointSite(BreakpointSite *bp_site) {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support enabling breakpoints",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support enabling breakpoints", GetPluginName());
return error;
}
virtual Status DisableBreakpointSite(BreakpointSite *bp_site) {
Status error;
error.SetErrorStringWithFormat(
"error: %s does not support disabling breakpoints",
GetPluginName().GetCString());
error.SetErrorStringWithFormatv(
"error: {0} does not support disabling breakpoints", GetPluginName());
return error;
}
@ -2813,9 +2806,10 @@ protected:
/// if the read failed.
virtual llvm::Expected<std::vector<uint8_t>>
DoReadMemoryTags(lldb::addr_t addr, size_t len, int32_t type) {
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"%s does not support reading memory tags",
GetPluginName().GetCString());
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
llvm::formatv("{0} does not support reading memory tags",
GetPluginName()));
}
/// Does the final operation to write memory tags. E.g. sending a GDB packet.
@ -2838,8 +2832,10 @@ protected:
/// Status telling you whether the write succeeded.
virtual Status DoWriteMemoryTags(lldb::addr_t addr, size_t len, int32_t type,
const std::vector<uint8_t> &tags) {
return Status("%s does not support writing memory tags",
GetPluginName().GetCString());
Status status;
status.SetErrorStringWithFormatv("{0} does not support writing memory tags",
GetPluginName());
return status;
}
// Type definitions

View File

@ -40,7 +40,9 @@ public:
SystemRuntime *GetSystemRuntime() override { return nullptr; }
ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
Status DoDestroy() override;
@ -48,9 +50,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;
}

View File

@ -10,6 +10,8 @@
#define LLDB_TARGET_TRACE_EXPORTER_H
#include "lldb/Core/PluginInterface.h"
#include "lldb/lldb-forward.h"
#include "llvm/Support/Error.h"
namespace lldb_private {

View File

@ -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) {

View File

@ -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>";
}

View File

@ -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

View File

@ -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);
}

View File

@ -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());

View File

@ -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);
}
}
}

View File

@ -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

View File

@ -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(); }

View File

@ -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;

View File

@ -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();
}

View File

@ -86,7 +86,9 @@ public:
// PluginInterface protocol
//------------------------------------------------------------------
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
private:
lldb::ValueObjectSP

View File

@ -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();
}

View File

@ -75,7 +75,9 @@ public:
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
protected:
lldb::ValueObjectSP

View File

@ -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();
}

View File

@ -75,7 +75,9 @@ public:
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
protected:
lldb::ValueObjectSP

View File

@ -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,

View File

@ -83,7 +83,9 @@ public:
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
protected:
void CreateRegisterMapIfNeeded();

View File

@ -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();
}

View File

@ -73,7 +73,9 @@ public:
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
protected:
void CreateRegisterMapIfNeeded();

View File

@ -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();
}

View File

@ -86,7 +86,9 @@ public:
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
protected:
void CreateRegisterMapIfNeeded();

View File

@ -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();
}

View File

@ -82,7 +82,9 @@ public:
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
protected:
void CreateRegisterMapIfNeeded();

View File

@ -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();
}

View File

@ -82,7 +82,9 @@ public:
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
protected:
void CreateRegisterMapIfNeeded();

View File

@ -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();
}

View File

@ -74,7 +74,9 @@ public:
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
protected:
void CreateRegisterMapIfNeeded();

View File

@ -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();
}

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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();
}

View File

@ -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();

View File

@ -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();
}

View File

@ -73,7 +73,9 @@ public:
// PluginInterface protocol
//------------------------------------------------------------------
lldb_private::ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
protected:
void CreateRegisterMapIfNeeded();

View File

@ -38,7 +38,3 @@ ArchitectureAArch64::Create(const ArchSpec &arch) {
}
return std::unique_ptr<Architecture>(new ArchitectureAArch64());
}
ConstString ArchitectureAArch64::GetPluginName() {
return GetPluginNameStatic();
}

View File

@ -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{};

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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 {}

View File

@ -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);

View File

@ -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 {}

View File

@ -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(); }

View File

@ -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;

View File

@ -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) {

View File

@ -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);

View File

@ -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;

View File

@ -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.

View File

@ -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();
}

View File

@ -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;

View File

@ -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());

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -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();
}

View File

@ -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();

View File

@ -174,10 +174,6 @@ void DynamicLoaderWindowsDYLD::DidLaunch() {
Status DynamicLoaderWindowsDYLD::CanLoadImage() { return Status(); }
ConstString DynamicLoaderWindowsDYLD::GetPluginName() {
return GetPluginNameStatic();
}
ThreadPlanSP
DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(Thread &thread,
bool stop) {

View File

@ -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);

View File

@ -37,7 +37,9 @@ public:
/// PluginInterface protocol.
/// \{
ConstString GetPluginName() override { return GetPluginNameStatic(); }
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
/// \}
};

View File

@ -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";
}
}

View File

@ -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;

View File

@ -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.";
}

View File

@ -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;

View File

@ -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.";
}

View File

@ -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;

View File

@ -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.";
}

View File

@ -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;

View File

@ -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.";
}

View File

@ -44,7 +44,9 @@ public:
return false;
}
ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
bool SetTargetTriple(const ArchSpec &arch) override;

View File

@ -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(); }

View File

@ -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(); }

View File

@ -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(); }

View File

@ -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(); }

View File

@ -432,10 +432,6 @@ const char *JITLoaderGDB::GetPluginDescriptionStatic() {
"interface.";
}
lldb_private::ConstString JITLoaderGDB::GetPluginName() {
return GetPluginNameStatic();
}
void JITLoaderGDB::Initialize() {
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(), CreateInstance,

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -156,7 +156,9 @@ public:
}
// PluginInterface protocol
ConstString GetPluginName() override;
llvm::StringRef GetPluginName() override {
return GetPluginNameStatic().GetStringRef();
}
};
} // namespace lldb_private

View File

@ -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) {

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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) {

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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,

View File

@ -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);

View File

@ -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;

View File

@ -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,

View File

@ -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 {

View File

@ -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,

View File

@ -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;

Some files were not shown because too many files have changed in this diff Show More