From 0e4c482124f098957fc13bcfbabc36775dd190ab Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 6 Mar 2019 21:22:25 +0000 Subject: 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 --- lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp') diff --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp index 660344c4f87..2fe042f4ffd 100644 --- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -127,7 +127,7 @@ public: bool MightHaveChildren() override { return m_impl.m_mode != Mode::Invalid; } - size_t GetIndexOfChildWithName(const ConstString &name) override { + size_t GetIndexOfChildWithName(ConstString name) override { const char *item_name = name.GetCString(); uint32_t idx = ExtractIndexFromString(item_name); if (idx < UINT32_MAX && idx >= CalculateNumChildren()) -- cgit v1.2.3