diff options
| author | Adrian Prantl <aprantl@apple.com> | 2019-03-06 21:22:25 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2019-03-06 21:22:25 +0000 |
| commit | 0e4c482124f098957fc13bcfbabc36775dd190ab (patch) | |
| tree | 34ee130b6d6de0d41a229021c4b46ab66b891a08 /lldb/source/Target/Process.cpp | |
| parent | 480bce28ffc4640f443e262fa110af50b0d635df (diff) | |
| download | bcm5719-llvm-0e4c482124f098957fc13bcfbabc36775dd190ab.tar.gz bcm5719-llvm-0e4c482124f098957fc13bcfbabc36775dd190ab.zip | |
Pass ConstString by value (NFC)
My apologies for the large patch. With the exception of ConstString.h
itself it was entirely produced by sed.
ConstString has exactly one const char * data member, so passing a
ConstString by reference is not any more efficient than copying it by
value. In both cases a single pointer is passed. But passing it by
value makes it harder to accidentally return the address of a local
object.
(This fixes rdar://problem/48640859 for the Apple folks)
Differential Revision: https://reviews.llvm.org/D59030
llvm-svn: 355553
Diffstat (limited to 'lldb/source/Target/Process.cpp')
| -rw-r--r-- | lldb/source/Target/Process.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index d74aaf1e4e7..e76e4872d3a 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -84,7 +84,7 @@ using namespace std::chrono; class ProcessOptionValueProperties : public OptionValueProperties { public: - ProcessOptionValueProperties(const ConstString &name) + ProcessOptionValueProperties(ConstString name) : OptionValueProperties(name) {} // This constructor is used when creating ProcessOptionValueProperties when @@ -3915,12 +3915,12 @@ Process::ProcessEventData::ProcessEventData(const ProcessSP &process_sp, Process::ProcessEventData::~ProcessEventData() = default; -const ConstString &Process::ProcessEventData::GetFlavorString() { +ConstString Process::ProcessEventData::GetFlavorString() { static ConstString g_flavor("Process::ProcessEventData"); return g_flavor; } -const ConstString &Process::ProcessEventData::GetFlavor() const { +ConstString Process::ProcessEventData::GetFlavor() const { return ProcessEventData::GetFlavorString(); } @@ -4243,7 +4243,7 @@ void Process::BroadcastStructuredData(const StructuredData::ObjectSP &object_sp, } StructuredDataPluginSP -Process::GetStructuredDataPlugin(const ConstString &type_name) const { +Process::GetStructuredDataPlugin(ConstString type_name) const { auto find_it = m_structured_data_plugin_map.find(type_name); if (find_it != m_structured_data_plugin_map.end()) return find_it->second; @@ -5867,7 +5867,7 @@ Process::GetMemoryRegions(lldb_private::MemoryRegionInfos ®ion_list) { } Status -Process::ConfigureStructuredData(const ConstString &type_name, +Process::ConfigureStructuredData(ConstString type_name, const StructuredData::ObjectSP &config_sp) { // If you get this, the Process-derived class needs to implement a method to // enable an already-reported asynchronous structured data feature. See |

