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/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime | |
| parent | 480bce28ffc4640f443e262fa110af50b0d635df (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/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime')
2 files changed, 14 insertions, 14 deletions
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); diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h index 71d726097f89..d416b9232861 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -245,7 +245,7 @@ typedef std::vector<RSScriptGroupDescriptorSP> RSScriptGroupList; class RSScriptGroupBreakpointResolver : public BreakpointResolver { public: - RSScriptGroupBreakpointResolver(Breakpoint *bp, const ConstString &name, + RSScriptGroupBreakpointResolver(Breakpoint *bp, ConstString name, const RSScriptGroupList &groups, bool stop_on_all) : BreakpointResolver(bp, BreakpointResolver::NameResolver), @@ -275,7 +275,7 @@ public: protected: const RSScriptGroupDescriptorSP - FindScriptGroup(const ConstString &name) const { + FindScriptGroup(ConstString name) const { for (auto sg : m_script_groups) { if (ConstString::Compare(sg->m_name, name) == 0) return sg; @@ -365,7 +365,7 @@ public: int kernel_types = ~(0)); bool PlaceBreakpointOnScriptGroup(lldb::TargetSP target, Stream &strm, - const ConstString &name, bool stop_on_all); + ConstString name, bool stop_on_all); void SetBreakAllKernels(bool do_break, lldb::TargetSP target); @@ -387,7 +387,7 @@ public: return m_scriptGroups; }; - bool IsKnownKernel(const ConstString &name) { + bool IsKnownKernel(ConstString name) { for (const auto &module : m_rsmodules) for (const auto &kernel : module->m_kernels) if (kernel.m_name == name) @@ -428,12 +428,12 @@ protected: bool EvalRSExpression(const char *expression, StackFrame *frame_ptr, uint64_t *result); - lldb::BreakpointSP CreateScriptGroupBreakpoint(const ConstString &name, + lldb::BreakpointSP CreateScriptGroupBreakpoint(ConstString name, bool multi); - lldb::BreakpointSP CreateKernelBreakpoint(const ConstString &name); + lldb::BreakpointSP CreateKernelBreakpoint(ConstString name); - lldb::BreakpointSP CreateReductionBreakpoint(const ConstString &name, + lldb::BreakpointSP CreateReductionBreakpoint(ConstString name, int kernel_types); void BreakOnModuleKernels( |
