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 --- .../RenderScriptRuntime/RenderScriptRuntime.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp') diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 7dd3b87a3a04..81551e713aa5 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -592,7 +592,7 @@ struct RenderScriptRuntime::Element { array_size; // Number of items in array, only needed for structs ConstString type_name; // Name of type, only needed for structs - static const ConstString & + static ConstString GetFallbackStructName(); // Print this as the type name of a struct Element // If we can't resolve the actual struct name @@ -692,7 +692,7 @@ struct RenderScriptRuntime::AllocationDetails { } }; -const ConstString &RenderScriptRuntime::Element::GetFallbackStructName() { +ConstString RenderScriptRuntime::Element::GetFallbackStructName() { static const ConstString FallbackStructName("struct"); return FallbackStructName; } @@ -2363,7 +2363,7 @@ void RenderScriptRuntime::FindStructTypeName(Element &elem, size_diff); for (uint32_t i = 0; i < size_diff; ++i) { - const ConstString &name = elem.children[num_children + i].type_name; + ConstString name = elem.children[num_children + i].type_name; if (strcmp(name.AsCString(), "#rs_padding") < 0) found = false; } @@ -3594,7 +3594,7 @@ void RenderScriptRuntime::SetBreakAllKernels(bool do_break, TargetSP target) { // Given the name of a kernel this function creates a breakpoint using our own // breakpoint resolver, and returns the Breakpoint shared pointer. BreakpointSP -RenderScriptRuntime::CreateKernelBreakpoint(const ConstString &name) { +RenderScriptRuntime::CreateKernelBreakpoint(ConstString name) { Log *log( GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); @@ -3622,7 +3622,7 @@ RenderScriptRuntime::CreateKernelBreakpoint(const ConstString &name) { } BreakpointSP -RenderScriptRuntime::CreateReductionBreakpoint(const ConstString &name, +RenderScriptRuntime::CreateReductionBreakpoint(ConstString name, int kernel_types) { Log *log( GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); @@ -3863,7 +3863,7 @@ bool RenderScriptRuntime::PlaceBreakpointOnKernel(TargetSP target, } BreakpointSP -RenderScriptRuntime::CreateScriptGroupBreakpoint(const ConstString &name, +RenderScriptRuntime::CreateScriptGroupBreakpoint(ConstString name, bool stop_on_all) { Log *log( GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); @@ -3893,7 +3893,7 @@ RenderScriptRuntime::CreateScriptGroupBreakpoint(const ConstString &name, bool RenderScriptRuntime::PlaceBreakpointOnScriptGroup(TargetSP target, Stream &strm, - const ConstString &name, + ConstString name, bool multi) { InitSearchFilter(target); BreakpointSP bp = CreateScriptGroupBreakpoint(name, multi); -- cgit v1.2.3