summaryrefslogtreecommitdiff
path: root/lldb/source/Host/common/FileSystem.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2019-03-06 21:22:25 +0000
committerAdrian Prantl <aprantl@apple.com>2019-03-06 21:22:25 +0000
commit0e4c482124f098957fc13bcfbabc36775dd190ab (patch)
tree34ee130b6d6de0d41a229021c4b46ab66b891a08 /lldb/source/Host/common/FileSystem.cpp
parent480bce28ffc4640f443e262fa110af50b0d635df (diff)
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/Host/common/FileSystem.cpp')
-rw-r--r--lldb/source/Host/common/FileSystem.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp
index 33159626acc0..7ce86345b9cc 100644
--- a/lldb/source/Host/common/FileSystem.cpp
+++ b/lldb/source/Host/common/FileSystem.cpp
@@ -305,12 +305,12 @@ FileSystem::CreateDataBuffer(const FileSpec &file_spec, uint64_t size,
bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) {
// If the directory is set there's nothing to do.
- const ConstString &directory = file_spec.GetDirectory();
+ ConstString directory = file_spec.GetDirectory();
if (directory)
return false;
// We cannot look for a file if there's no file name.
- const ConstString &filename = file_spec.GetFilename();
+ ConstString filename = file_spec.GetFilename();
if (!filename)
return false;