diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h b/lldb/include/lldb/Breakpoint/Breakpoint.h --- a/lldb/include/lldb/Breakpoint/Breakpoint.h +++ b/lldb/include/lldb/Breakpoint/Breakpoint.h @@ -105,11 +105,11 @@ ~BreakpointEventData() override; - static ConstString GetFlavorString(); - + static llvm::StringRef GetFlavorString(); + Log *GetLogChannel() override; - ConstString GetFlavor() const override; + llvm::StringRef GetFlavor() const override; lldb::BreakpointEventType GetBreakpointEventType() const; diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h b/lldb/include/lldb/Breakpoint/Watchpoint.h --- a/lldb/include/lldb/Breakpoint/Watchpoint.h +++ b/lldb/include/lldb/Breakpoint/Watchpoint.h @@ -31,9 +31,9 @@ ~WatchpointEventData() override; - static ConstString GetFlavorString(); + static llvm::StringRef GetFlavorString(); - ConstString GetFlavor() const override; + llvm::StringRef GetFlavor() const override; lldb::WatchpointEventType GetWatchpointEventType() const; diff --git a/lldb/include/lldb/Core/DebuggerEvents.h b/lldb/include/lldb/Core/DebuggerEvents.h --- a/lldb/include/lldb/Core/DebuggerEvents.h +++ b/lldb/include/lldb/Core/DebuggerEvents.h @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "lldb/Core/ModuleSpec.h" -#include "lldb/Utility/ConstString.h" #include "lldb/Utility/Event.h" #include "lldb/Utility/StructuredData.h" @@ -27,9 +26,9 @@ m_id(progress_id), m_completed(completed), m_total(total), m_debugger_specific(debugger_specific) {} - static ConstString GetFlavorString(); + static llvm::StringRef GetFlavorString(); - ConstString GetFlavor() const override; + llvm::StringRef GetFlavor() const override; void Dump(Stream *s) const override; @@ -93,8 +92,8 @@ void Dump(Stream *s) const override; - static ConstString GetFlavorString(); - ConstString GetFlavor() const override; + static llvm::StringRef GetFlavorString(); + llvm::StringRef GetFlavor() const override; static const DiagnosticEventData * GetEventDataFromEvent(const Event *event_ptr); @@ -116,8 +115,8 @@ SymbolChangeEventData(lldb::DebuggerWP debugger_wp, ModuleSpec module_spec) : m_debugger_wp(debugger_wp), m_module_spec(std::move(module_spec)) {} - static ConstString GetFlavorString(); - ConstString GetFlavor() const override; + static llvm::StringRef GetFlavorString(); + llvm::StringRef GetFlavor() const override; static const SymbolChangeEventData * GetEventDataFromEvent(const Event *event_ptr); diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -411,9 +411,9 @@ ~ProcessEventData() override; - static ConstString GetFlavorString(); + static llvm::StringRef GetFlavorString(); - ConstString GetFlavor() const override; + llvm::StringRef GetFlavor() const override; lldb::ProcessSP GetProcessSP() const { return m_process_wp.lock(); } diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -506,9 +506,9 @@ ~TargetEventData() override; - static ConstString GetFlavorString(); + static llvm::StringRef GetFlavorString(); - ConstString GetFlavor() const override { + llvm::StringRef GetFlavor() const override { return TargetEventData::GetFlavorString(); } diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -89,9 +89,9 @@ ~ThreadEventData() override; - static ConstString GetFlavorString(); + static llvm::StringRef GetFlavorString(); - ConstString GetFlavor() const override { + llvm::StringRef GetFlavor() const override { return ThreadEventData::GetFlavorString(); } diff --git a/lldb/include/lldb/Utility/Event.h b/lldb/include/lldb/Utility/Event.h --- a/lldb/include/lldb/Utility/Event.h +++ b/lldb/include/lldb/Utility/Event.h @@ -41,8 +41,8 @@ virtual ~EventData(); - virtual ConstString GetFlavor() const = 0; - + virtual llvm::StringRef GetFlavor() const = 0; + virtual Log *GetLogChannel() { return nullptr; } virtual void Dump(Stream *s) const; @@ -69,7 +69,7 @@ ~EventDataBytes() override; // Member functions - ConstString GetFlavor() const override; + llvm::StringRef GetFlavor() const override; void Dump(Stream *s) const override; @@ -90,7 +90,7 @@ static size_t GetByteSizeFromEvent(const Event *event_ptr); - static ConstString GetFlavorString(); + static llvm::StringRef GetFlavorString(); private: std::string m_bytes; @@ -105,12 +105,9 @@ ~EventDataReceipt() override = default; - static ConstString GetFlavorString() { - static ConstString g_flavor("Process::ProcessEventData"); - return g_flavor; - } + static llvm::StringRef GetFlavorString(); - ConstString GetFlavor() const override { return GetFlavorString(); } + llvm::StringRef GetFlavor() const override { return GetFlavorString(); } bool WaitForEventReceived(const Timeout &timeout = std::nullopt) { return m_predicate.WaitForValueEqualTo(true, timeout); @@ -139,7 +136,7 @@ ~EventDataStructuredData() override; // Member functions - ConstString GetFlavor() const override; + llvm::StringRef GetFlavor() const override; void Dump(Stream *s) const override; @@ -166,7 +163,7 @@ static lldb::StructuredDataPluginSP GetPluginFromEvent(const Event *event_ptr); - static ConstString GetFlavorString(); + static llvm::StringRef GetFlavorString(); private: lldb::ProcessSP m_process_sp; diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp --- a/lldb/source/API/SBEvent.cpp +++ b/lldb/source/API/SBEvent.cpp @@ -63,7 +63,7 @@ if (lldb_event) { EventData *event_data = lldb_event->GetData(); if (event_data) - return lldb_event->GetData()->GetFlavor().AsCString(); + return lldb_event->GetData()->GetFlavor().data(); } return nullptr; } diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -1039,12 +1039,11 @@ Breakpoint::BreakpointEventData::~BreakpointEventData() = default; -ConstString Breakpoint::BreakpointEventData::GetFlavorString() { - static ConstString g_flavor("Breakpoint::BreakpointEventData"); - return g_flavor; +llvm::StringRef Breakpoint::BreakpointEventData::GetFlavorString() { + return "Breakpoint::BreakpointEventData"; } -ConstString Breakpoint::BreakpointEventData::GetFlavor() const { +llvm::StringRef Breakpoint::BreakpointEventData::GetFlavor() const { return BreakpointEventData::GetFlavorString(); } diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -337,12 +337,11 @@ Watchpoint::WatchpointEventData::~WatchpointEventData() = default; -ConstString Watchpoint::WatchpointEventData::GetFlavorString() { - static ConstString g_flavor("Watchpoint::WatchpointEventData"); - return g_flavor; +llvm::StringRef Watchpoint::WatchpointEventData::GetFlavorString() { + return "Watchpoint::WatchpointEventData"; } -ConstString Watchpoint::WatchpointEventData::GetFlavor() const { +llvm::StringRef Watchpoint::WatchpointEventData::GetFlavor() const { return WatchpointEventData::GetFlavorString(); } diff --git a/lldb/source/Core/DebuggerEvents.cpp b/lldb/source/Core/DebuggerEvents.cpp --- a/lldb/source/Core/DebuggerEvents.cpp +++ b/lldb/source/Core/DebuggerEvents.cpp @@ -23,12 +23,11 @@ return nullptr; } -ConstString ProgressEventData::GetFlavorString() { - static ConstString g_flavor("ProgressEventData"); - return g_flavor; +llvm::StringRef ProgressEventData::GetFlavorString() { + return "ProgressEventData"; } -ConstString ProgressEventData::GetFlavor() const { +llvm::StringRef ProgressEventData::GetFlavor() const { return ProgressEventData::GetFlavorString(); } @@ -94,12 +93,11 @@ s->Flush(); } -ConstString DiagnosticEventData::GetFlavorString() { - static ConstString g_flavor("DiagnosticEventData"); - return g_flavor; +llvm::StringRef DiagnosticEventData::GetFlavorString() { + return "DiagnosticEventData"; } -ConstString DiagnosticEventData::GetFlavor() const { +llvm::StringRef DiagnosticEventData::GetFlavor() const { return DiagnosticEventData::GetFlavorString(); } @@ -124,12 +122,11 @@ return dictionary_sp; } -ConstString SymbolChangeEventData::GetFlavorString() { - static ConstString g_flavor("SymbolChangeEventData"); - return g_flavor; +llvm::StringRef SymbolChangeEventData::GetFlavorString() { + return "SymbolChangeEventData"; } -ConstString SymbolChangeEventData::GetFlavor() const { +llvm::StringRef SymbolChangeEventData::GetFlavor() const { return SymbolChangeEventData::GetFlavorString(); } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -3929,12 +3929,11 @@ Process::ProcessEventData::~ProcessEventData() = default; -ConstString Process::ProcessEventData::GetFlavorString() { - static ConstString g_flavor("Process::ProcessEventData"); - return g_flavor; +llvm::StringRef Process::ProcessEventData::GetFlavorString() { + return "Process::ProcessEventData"; } -ConstString Process::ProcessEventData::GetFlavor() const { +llvm::StringRef Process::ProcessEventData::GetFlavor() const { return ProcessEventData::GetFlavorString(); } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -4786,9 +4786,8 @@ Target::TargetEventData::~TargetEventData() = default; -ConstString Target::TargetEventData::GetFlavorString() { - static ConstString g_flavor("Target::TargetEventData"); - return g_flavor; +llvm::StringRef Target::TargetEventData::GetFlavorString() { + return "Target::TargetEventData"; } void Target::TargetEventData::Dump(Stream *s) const { diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -150,9 +150,8 @@ // Thread Event Data -ConstString Thread::ThreadEventData::GetFlavorString() { - static ConstString g_flavor("Thread::ThreadEventData"); - return g_flavor; +llvm::StringRef Thread::ThreadEventData::GetFlavorString() { + return "Thread::ThreadEventData"; } Thread::ThreadEventData::ThreadEventData(const lldb::ThreadSP thread_sp) diff --git a/lldb/source/Utility/Event.cpp b/lldb/source/Utility/Event.cpp --- a/lldb/source/Utility/Event.cpp +++ b/lldb/source/Utility/Event.cpp @@ -114,12 +114,9 @@ EventDataBytes::~EventDataBytes() = default; -ConstString EventDataBytes::GetFlavorString() { - static ConstString g_flavor("EventDataBytes"); - return g_flavor; -} +llvm::StringRef EventDataBytes::GetFlavorString() { return "EventDataBytes"; } -ConstString EventDataBytes::GetFlavor() const { +llvm::StringRef EventDataBytes::GetFlavor() const { return EventDataBytes::GetFlavorString(); } @@ -182,6 +179,10 @@ m_bytes.swap(new_bytes); } +llvm::StringRef EventDataReceipt::GetFlavorString() { + return "Process::ProcessEventData"; +} + #pragma mark - #pragma mark EventStructuredData @@ -200,7 +201,7 @@ // EventDataStructuredData member functions -ConstString EventDataStructuredData::GetFlavor() const { +llvm::StringRef EventDataStructuredData::GetFlavor() const { return EventDataStructuredData::GetFlavorString(); } @@ -280,7 +281,6 @@ return StructuredDataPluginSP(); } -ConstString EventDataStructuredData::GetFlavorString() { - static ConstString s_flavor("EventDataStructuredData"); - return s_flavor; +llvm::StringRef EventDataStructuredData::GetFlavorString() { + return "EventDataStructuredData"; }