[Lldb-commits] [lldb] 9dfd4e2 - [lldb][NFC] Remove ConstString -> const char * -> StringRef conversions when calling Stream::Indent

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 11 04:52:39 PST 2020


Author: Raphael Isemann
Date: 2020-02-11T13:51:41+01:00
New Revision: 9dfd4e260bd4f9f1d9d0fce343ed645fdd331261

URL: https://github.com/llvm/llvm-project/commit/9dfd4e260bd4f9f1d9d0fce343ed645fdd331261
DIFF: https://github.com/llvm/llvm-project/commit/9dfd4e260bd4f9f1d9d0fce343ed645fdd331261.diff

LOG: [lldb][NFC] Remove ConstString -> const char * -> StringRef conversions when calling Stream::Indent

Let's just pass in a StringRef and save the strlen call when rebuilding the StringRef parameter.

Added: 
    

Modified: 
    lldb/source/Interpreter/OptionValueDictionary.cpp
    lldb/source/Interpreter/Options.cpp
    lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp
index 8a534fe6d752..caadccd04232 100644
--- a/lldb/source/Interpreter/OptionValueDictionary.cpp
+++ b/lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -45,7 +45,7 @@ void OptionValueDictionary::DumpValue(const ExecutionContext *exe_ctx,
       else
         strm.EOL();
 
-      strm.Indent(pos->first.GetCString());
+      strm.Indent(pos->first.GetStringRef());
 
       const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0;
       switch (dict_type) {

diff  --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index f0d24cd27030..fb13bd48e478 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -282,7 +282,7 @@ void Options::OutputFormattedUsageText(Stream &strm,
   if (static_cast<uint32_t>(actual_text.length() + strm.GetIndentLevel()) <
       output_max_columns) {
     // Output it as a single line.
-    strm.Indent(actual_text.c_str());
+    strm.Indent(actual_text);
     strm.EOL();
   } else {
     // We need to break it up into multiple lines.

diff  --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 78fec8e5c20a..9b81ba03148c 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -3131,7 +3131,7 @@ void RenderScriptRuntime::DumpKernels(Stream &strm) const {
     strm.Printf("Resource '%s':", module->m_resname.c_str());
     strm.EOL();
     for (const auto &kernel : module->m_kernels) {
-      strm.Indent(kernel.m_name.AsCString());
+      strm.Indent(kernel.m_name.GetStringRef());
       strm.EOL();
     }
   }
@@ -3941,7 +3941,7 @@ void RSModuleDescriptor::Dump(Stream &strm) const {
 }
 
 void RSGlobalDescriptor::Dump(Stream &strm) const {
-  strm.Indent(m_name.AsCString());
+  strm.Indent(m_name.GetStringRef());
   VariableList var_list;
   m_module->m_module->FindGlobalVariables(m_name, nullptr, 1U, var_list);
   if (var_list.GetSize() == 1) {
@@ -3966,12 +3966,12 @@ void RSGlobalDescriptor::Dump(Stream &strm) const {
 }
 
 void RSKernelDescriptor::Dump(Stream &strm) const {
-  strm.Indent(m_name.AsCString());
+  strm.Indent(m_name.GetStringRef());
   strm.EOL();
 }
 
 void RSReductionDescriptor::Dump(lldb_private::Stream &stream) const {
-  stream.Indent(m_reduce_name.AsCString());
+  stream.Indent(m_reduce_name.GetStringRef());
   stream.IndentMore();
   stream.EOL();
   stream.Indent();


        


More information about the lldb-commits mailing list