llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Raphael Isemann (Teemperor)

<details>
<summary>Changes</summary>

`Stream::Printf` needs to call various other (variadic) functions, needs to 
parse the input string and potentially handle too-long format outputs. Calling 
in with a constant string is wasting a lot of instruction on doing nothing.

assisted-by: claude

---

Patch is 40.06 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/210294.diff


36 Files Affected:

- (modified) lldb/include/lldb/Core/ModuleSpec.h (+1-1) 
- (modified) lldb/source/API/SBAddressRangeList.cpp (+1-1) 
- (modified) lldb/source/API/SBMemoryRegionInfo.cpp (+1-1) 
- (modified) lldb/source/Breakpoint/Breakpoint.cpp (+5-5) 
- (modified) lldb/source/Breakpoint/BreakpointLocation.cpp (+3-3) 
- (modified) lldb/source/Breakpoint/BreakpointLocationList.cpp (+1-1) 
- (modified) lldb/source/Breakpoint/BreakpointOptions.cpp (+2-2) 
- (modified) lldb/source/Breakpoint/BreakpointResolverName.cpp (+2-2) 
- (modified) lldb/source/Breakpoint/Watchpoint.cpp (+4-4) 
- (modified) lldb/source/Breakpoint/WatchpointList.cpp (+1-1) 
- (modified) lldb/source/Core/Disassembler.cpp (+3-3) 
- (modified) lldb/source/Core/DumpDataExtractor.cpp (+14-14) 
- (modified) lldb/source/Core/DynamicLoader.cpp (+2-2) 
- (modified) lldb/source/Core/FormatEntity.cpp (+4-4) 
- (modified) lldb/source/Core/IOHandler.cpp (+3-3) 
- (modified) lldb/source/Core/IOHandlerCursesGUI.cpp (+1-1) 
- (modified) lldb/source/Core/Mangled.cpp (+1-1) 
- (modified) lldb/source/Core/SearchFilter.cpp (+2-2) 
- (modified) lldb/source/Core/SourceManager.cpp (+2-2) 
- (modified) lldb/source/DataFormatters/FormattersHelpers.cpp (+1-1) 
- (modified) lldb/source/DataFormatters/StringPrinter.cpp (+7-7) 
- (modified) lldb/source/DataFormatters/TypeCategory.cpp (+1-1) 
- (modified) lldb/source/DataFormatters/TypeSynthetic.cpp (+1-1) 
- (modified) lldb/source/DataFormatters/ValueObjectPrinter.cpp (+2-2) 
- (modified) lldb/source/DataFormatters/VectorType.cpp (+1-1) 
- (modified) lldb/source/Expression/IRInterpreter.cpp (+1-1) 
- (modified) lldb/source/Expression/Materializer.cpp (+21-21) 
- (modified) lldb/source/Expression/REPL.cpp (+3-3) 
- (modified) lldb/source/Host/common/ProcessLaunchInfo.cpp (+1-1) 
- (modified) lldb/source/Symbol/SymbolContext.cpp (+7-7) 
- (modified) lldb/source/Symbol/Type.cpp (+2-2) 
- (modified) lldb/source/Symbol/UnwindPlan.cpp (+14-14) 
- (modified) lldb/source/Utility/Event.cpp (+1-1) 
- (modified) lldb/source/Utility/ProcessInfo.cpp (+1-1) 
- (modified) lldb/source/Utility/StructuredData.cpp (+2-2) 
- (modified) lldb/source/ValueObject/ValueObject.cpp (+2-2) 


``````````diff
diff --git a/lldb/include/lldb/Core/ModuleSpec.h 
b/lldb/include/lldb/Core/ModuleSpec.h
index f74641ef0cf9f..31a415b3caa75 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -224,7 +224,7 @@ class ModuleSpec {
     if (m_arch.IsValid()) {
       if (dumped_something)
         strm.PutCString(", ");
-      strm.Printf("arch = ");
+      strm.PutCString("arch = ");
       m_arch.DumpTriple(strm.AsRawOstream());
       dumped_something = true;
     }
diff --git a/lldb/source/API/SBAddressRangeList.cpp 
b/lldb/source/API/SBAddressRangeList.cpp
index 957155d5125ef..f4d19ea729743 100644
--- a/lldb/source/API/SBAddressRangeList.cpp
+++ b/lldb/source/API/SBAddressRangeList.cpp
@@ -85,7 +85,7 @@ bool SBAddressRangeList::GetDescription(SBStream &description,
     if (is_first) {
       is_first = false;
     } else {
-      stream.Printf(", ");
+      stream.PutCString(", ");
     }
     GetAddressRangeAtIndex(i).GetDescription(description, target);
   }
diff --git a/lldb/source/API/SBMemoryRegionInfo.cpp 
b/lldb/source/API/SBMemoryRegionInfo.cpp
index 175d073bd32ad..bff9a1b9ff462 100644
--- a/lldb/source/API/SBMemoryRegionInfo.cpp
+++ b/lldb/source/API/SBMemoryRegionInfo.cpp
@@ -169,7 +169,7 @@ bool SBMemoryRegionInfo::GetDescription(SBStream 
&description) {
   strm.Printf(m_opaque_up->GetReadable() ? "R" : "-");
   strm.Printf(m_opaque_up->GetWritable() ? "W" : "-");
   strm.Printf(m_opaque_up->GetExecutable() ? "X" : "-");
-  strm.Printf("]");
+  strm.PutCString("]");
 
   return true;
 }
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index 9bc014b86e2d6..ec8099fa3e94a 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -988,7 +988,7 @@ void Breakpoint::GetDescriptionForType(Stream *s, 
lldb::DescriptionLevel level,
       // don't generally know how to set them until the target is run.
       if (m_resolver_sp->getResolverID() !=
           BreakpointResolver::ExceptionResolver)
-        s->Printf(", locations = 0 (pending)");
+        s->PutCString(", locations = 0 (pending)");
     }
 
     m_options.GetDescription(s, level);
@@ -1000,7 +1000,7 @@ void Breakpoint::GetDescriptionForType(Stream *s, 
lldb::DescriptionLevel level,
       if (!m_name_list.empty()) {
         s->EOL();
         s->Indent();
-        s->Printf("Names:");
+        s->PutCString("Names:");
         s->EOL();
         s->IndentMore();
         for (llvm::StringRef name : m_name_list.keys()) {
@@ -1017,7 +1017,7 @@ void Breakpoint::GetDescriptionForType(Stream *s, 
lldb::DescriptionLevel level,
   case lldb::eDescriptionLevelInitial:
     s->Printf("Breakpoint %i: ", GetID());
     if (num_locations == 0) {
-      s->Printf("no locations (pending).");
+      s->PutCString("no locations (pending).");
     } else if (num_locations == 1 && !show_locations) {
       // There is only one location, so we'll just print that location
       // information.
@@ -1045,9 +1045,9 @@ void Breakpoint::GetDescriptionForType(Stream *s, 
lldb::DescriptionLevel level,
   if (show_locations && level != lldb::eDescriptionLevelBrief) {
     if ((display_type & eDisplayHeader) != 0) {
       if ((display_type & eDisplayFacade) != 0)
-        s->Printf("Facade locations:\n");
+        s->PutCString("Facade locations:\n");
       else
-        s->Printf("Implementation Locations\n");
+        s->PutCString("Implementation Locations\n");
     }
     s->IndentMore();
     for (size_t i = 0; i < num_locations; ++i) {
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp 
b/lldb/source/Breakpoint/BreakpointLocation.cpp
index b7f89bac1e448..fc679ffd662ea 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -653,8 +653,8 @@ void BreakpointLocation::GetDescription(Stream *s,
   if (!is_scripted_desc) {
     if (m_address.IsSectionOffset() &&
         (level == eDescriptionLevelFull || level == eDescriptionLevelInitial))
-      s->Printf(", ");
-    s->Printf("address = ");
+      s->PutCString(", ");
+    s->PutCString("address = ");
 
     ExecutionContextScope *exe_scope = nullptr;
     Target *target = &m_owner.GetTarget();
@@ -677,7 +677,7 @@ void BreakpointLocation::GetDescription(Stream *s,
           resolved_address.CalculateSymbolContextSymbol();
       if (resolved_symbol) {
         if (level == eDescriptionLevelFull || level == 
eDescriptionLevelInitial)
-          s->Printf(", ");
+          s->PutCString(", ");
         else if (level == lldb::eDescriptionLevelVerbose) {
           s->EOL();
           s->Indent();
diff --git a/lldb/source/Breakpoint/BreakpointLocationList.cpp 
b/lldb/source/Breakpoint/BreakpointLocationList.cpp
index ea431aa3bb953..345d583c7a871 100644
--- a/lldb/source/Breakpoint/BreakpointLocationList.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocationList.cpp
@@ -207,7 +207,7 @@ void BreakpointLocationList::GetDescription(Stream *s,
   collection::iterator pos, end = m_locations.end();
 
   for (pos = m_locations.begin(); pos != end; ++pos) {
-    s->Printf(" ");
+    s->PutCString(" ");
     (*pos)->GetDescription(s, level);
   }
 }
diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp 
b/lldb/source/Breakpoint/BreakpointOptions.cpp
index b0b794f0f93bf..cd456cd62936f 100644
--- a/lldb/source/Breakpoint/BreakpointOptions.cpp
+++ b/lldb/source/Breakpoint/BreakpointOptions.cpp
@@ -522,10 +522,10 @@ void BreakpointOptions::GetDescription(Stream *s,
     s->Printf("%sabled ", m_enabled ? "en" : "dis");
 
     if (m_one_shot)
-      s->Printf("one-shot ");
+      s->PutCString("one-shot ");
 
     if (m_auto_continue)
-      s->Printf("auto-continue ");
+      s->PutCString("auto-continue ");
 
     if (m_thread_spec_up)
       m_thread_spec_up->GetDescription(s, level);
diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp 
b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index 86dc65edd84a6..367cf60f08e14 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -405,12 +405,12 @@ void BreakpointResolverName::GetDescription(Stream *s) {
       s->Printf("name = '%s'", unique_lookups[0].GetCString());
     else {
       size_t num_names = unique_lookups.size();
-      s->Printf("names = {");
+      s->PutCString("names = {");
       for (size_t i = 0; i < num_names; i++) {
         s->Printf("%s'%s'", (i == 0 ? "" : ", "),
                   unique_lookups[i].GetCString());
       }
-      s->Printf("}");
+      s->PutCString("}");
     }
   }
   if (m_language != eLanguageTypeUnknown) {
diff --git a/lldb/source/Breakpoint/Watchpoint.cpp 
b/lldb/source/Breakpoint/Watchpoint.cpp
index 6fbe02d9161ab..ca03d54ffd0bf 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -279,7 +279,7 @@ bool Watchpoint::DumpSnapshots(Stream *s, const char 
*prefix) const {
   if (m_watch_read && !m_watch_modify && !m_watch_write)
     return printed_anything;
 
-  s->Printf("\n");
+  s->PutCString("\n");
   s->Printf("Watchpoint %u hit:\n", GetID());
 
   StreamString values_ss;
@@ -310,7 +310,7 @@ bool Watchpoint::DumpSnapshots(Stream *s, const char 
*prefix) const {
 
   if (m_new_value_sp) {
     if (values_ss.GetSize())
-      values_ss.Printf("\n");
+      values_ss.PutCString("\n");
 
     if (auto *new_value_cstr = m_new_value_sp->GetValueAsCString())
       values_ss.Printf("new value: %s", new_value_cstr);
@@ -334,7 +334,7 @@ bool Watchpoint::DumpSnapshots(Stream *s, const char 
*prefix) const {
   }
 
   if (values_ss.GetSize()) {
-    s->Printf("%s", values_ss.GetData());
+    s->PutCString(values_ss.GetData());
     printed_anything = true;
   }
 
@@ -364,7 +364,7 @@ void Watchpoint::DumpWithLevel(Stream *s,
       if (ProcessSP process_sp = m_target.GetProcessSP()) {
         auto &resourcelist = process_sp->GetWatchpointResourceList();
         size_t idx = 0;
-        s->Printf("\n    watchpoint resources:");
+        s->PutCString("\n    watchpoint resources:");
         for (WatchpointResourceSP &wpres : resourcelist.Sites()) {
           if (wpres->ConstituentsContains(this)) {
             s->Printf("\n       #%zu: ", idx);
diff --git a/lldb/source/Breakpoint/WatchpointList.cpp 
b/lldb/source/Breakpoint/WatchpointList.cpp
index 2542be88f4dc4..3b6c33fcc3b8d 100644
--- a/lldb/source/Breakpoint/WatchpointList.cpp
+++ b/lldb/source/Breakpoint/WatchpointList.cpp
@@ -213,7 +213,7 @@ void WatchpointList::GetDescription(Stream *s, 
lldb::DescriptionLevel level) {
   wp_collection::iterator pos, end = m_watchpoints.end();
 
   for (pos = m_watchpoints.begin(); pos != end; ++pos) {
-    s->Printf(" ");
+    s->PutCString(" ");
     (*pos)->Dump(s);
   }
 }
diff --git a/lldb/source/Core/Disassembler.cpp 
b/lldb/source/Core/Disassembler.cpp
index 544f20d7bc897..f9147cf0fa628 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -1085,7 +1085,7 @@ OptionValueSP Instruction::ReadDictionary(FILE *in_file, 
Stream &out_stream) {
 
 bool Instruction::TestEmulation(Stream &out_stream, const char *file_name) {
   if (!file_name) {
-    out_stream.Printf("Instruction::TestEmulation:  Missing file_name.");
+    out_stream.PutCString("Instruction::TestEmulation:  Missing file_name.");
     return false;
   }
   FILE *test_file = FileSystem::Instance().Fopen(file_name, "r");
@@ -1157,9 +1157,9 @@ bool Instruction::TestEmulation(Stream &out_stream, const 
char *file_name) {
         insn_emulator_up->TestEmulation(out_stream, arch, data_dictionary);
 
   if (success)
-    out_stream.Printf("Emulation test succeeded.");
+    out_stream.PutCString("Emulation test succeeded.");
   else
-    out_stream.Printf("Emulation test failed.");
+    out_stream.PutCString("Emulation test failed.");
 
   return success;
 }
diff --git a/lldb/source/Core/DumpDataExtractor.cpp 
b/lldb/source/Core/DumpDataExtractor.cpp
index 4e4e45b4f2f23..31aba83fbc585 100644
--- a/lldb/source/Core/DumpDataExtractor.cpp
+++ b/lldb/source/Core/DumpDataExtractor.cpp
@@ -161,7 +161,7 @@ static lldb::offset_t DumpInstructions(const DataExtractor 
&DE, Stream *s,
         s->Printf("failed to decode instructions at 0x%" PRIx64 ".", addr);
     }
   } else
-    s->Printf("invalid target");
+    s->PutCString("invalid target");
 
   return offset;
 }
@@ -174,31 +174,31 @@ static bool TryDumpSpecialEscapedChar(Stream &s, const 
char c) {
   switch (c) {
   case '\033':
     // Common non-standard escape code for 'escape'.
-    s.Printf("\\e");
+    s.PutCString("\\e");
     return true;
   case '\a':
-    s.Printf("\\a");
+    s.PutCString("\\a");
     return true;
   case '\b':
-    s.Printf("\\b");
+    s.PutCString("\\b");
     return true;
   case '\f':
-    s.Printf("\\f");
+    s.PutCString("\\f");
     return true;
   case '\n':
-    s.Printf("\\n");
+    s.PutCString("\\n");
     return true;
   case '\r':
-    s.Printf("\\r");
+    s.PutCString("\\r");
     return true;
   case '\t':
-    s.Printf("\\t");
+    s.PutCString("\\t");
     return true;
   case '\v':
-    s.Printf("\\v");
+    s.PutCString("\\v");
     return true;
   case '\0':
-    s.Printf("\\0");
+    s.PutCString("\\0");
     return true;
   default:
     return false;
@@ -484,7 +484,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
       const uint64_t ch = DE.GetMaxU64Bitfield(&offset, item_byte_size,
                                                item_bit_size, item_bit_offset);
       if (llvm::isPrint(ch))
-        s->Printf("%c", (char)ch);
+        s->PutChar((char)ch);
       else if (item_format != eFormatCharPrintable) {
         if (!TryDumpSpecialEscapedChar(*s, ch)) {
           if (item_byte_size == 1)
@@ -554,7 +554,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
       const char *cstr = DE.GetCStr(&offset);
 
       if (!cstr) {
-        s->Printf("NULL");
+        s->PutCString("NULL");
         offset = LLDB_INVALID_OFFSET;
       } else {
         s->PutChar('\"');
@@ -747,14 +747,14 @@ lldb::offset_t lldb_private::DumpDataExtractor(
         llvm::APFloat ap_float(DE.GetFloat(&offset));
         ap_float.convertToHexString(float_cstr, 0, false,
                                     llvm::APFloat::rmNearestTiesToEven);
-        s->Printf("%s", float_cstr);
+        s->PutCString(float_cstr);
         break;
       } else if (sizeof(double) == item_byte_size) {
         char float_cstr[256];
         llvm::APFloat ap_float(DE.GetDouble(&offset));
         ap_float.convertToHexString(float_cstr, 0, false,
                                     llvm::APFloat::rmNearestTiesToEven);
-        s->Printf("%s", float_cstr);
+        s->PutCString(float_cstr);
         break;
       } else {
         s->Printf("error: unsupported byte size (%" PRIu64
diff --git a/lldb/source/Core/DynamicLoader.cpp 
b/lldb/source/Core/DynamicLoader.cpp
index dd771a7a3a8ae..ac260607f6c86 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -356,7 +356,7 @@ ModuleSP DynamicLoader::LoadBinaryWithUUIDAndAddress(
   } else {
     if (force_symbol_search) {
       lldb::StreamUP s = target.GetDebugger().GetAsyncErrorStream();
-      s->Printf("Unable to find file");
+      s->PutCString("Unable to find file");
       if (!name.empty())
         s->Printf(" %s", name.str().c_str());
       if (uuid.IsValid())
@@ -367,7 +367,7 @@ ModuleSP DynamicLoader::LoadBinaryWithUUIDAndAddress(
         else
           s->Printf(" at address 0x%" PRIx64, value);
       }
-      s->Printf("\n");
+      s->PutCString("\n");
     }
     LLDB_LOGF(log,
               "Unable to find binary %s with UUID %s and load it at "
diff --git a/lldb/source/Core/FormatEntity.cpp 
b/lldb/source/Core/FormatEntity.cpp
index e7b1d9846fd20..50b05ab98c31c 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -437,7 +437,7 @@ void FormatEntity::Entry::Dump(Stream &s, int depth) const {
   if (number != 0)
     s.Printf("number = %" PRIu64 " (0x%" PRIx64 "), ", number, number);
   if (deref)
-    s.Printf("deref = true, ");
+    s.PutCString("deref = true, ");
   s.EOL();
   for (const auto &children : children_stack) {
     for (const auto &child : children)
@@ -461,7 +461,7 @@ static bool RunScriptFormatKeyword(Stream &s, const 
SymbolContext *sc,
       if (script_interpreter->RunScriptFormatKeyword(script_function_name, t,
                                                      script_output, error) &&
           error.Success()) {
-        s.Printf("%s", script_output.c_str());
+        s.PutCString(script_output.c_str());
         return true;
       } else {
         s.Printf("<error: %s>", error.AsCString());
@@ -2049,12 +2049,12 @@ bool FormatEntity::Formatter::Format(const Entry 
&entry, Stream &s,
           Address pc;
           pc.SetLoadAddress(pc_loadaddr, m_exe_ctx->GetTargetPtr());
           if (pc == *m_addr) {
-            s.Printf("-> ");
+            s.PutCString("-> ");
             return true;
           }
         }
       }
-      s.Printf("   ");
+      s.PutCString("   ");
       return true;
     }
     return false;
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index f19fe3204ddf5..0bb8b58f24bff 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -134,9 +134,9 @@ IOHandlerConfirm::IOHandlerConfirm(Debugger &debugger, 
llvm::StringRef prompt,
   StreamString prompt_stream;
   prompt_stream.PutCString(prompt);
   if (m_default_response)
-    prompt_stream.Printf(": [Y/n] ");
+    prompt_stream.PutCString(": [Y/n] ");
   else
-    prompt_stream.Printf(": [y/N] ");
+    prompt_stream.PutCString(": [y/N] ");
 
   SetPrompt(prompt_stream.GetString());
 }
@@ -359,7 +359,7 @@ bool IOHandlerEditline::GetLine(std::string &line, bool 
&interrupted) {
     if (prompt && prompt[0]) {
       if (m_output_sp) {
         LockedStreamFile locked_stream = m_output_sp->Lock();
-        locked_stream.Printf("%s", prompt);
+        locked_stream.PutCString(prompt);
       }
     }
   }
diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 805b87f1c5661..82abaeb2fba85 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -7254,7 +7254,7 @@ class SourceFileWindowDelegate : public WindowDelegate {
           else if (mnemonic != nullptr && operands != nullptr)
             strm.Printf("%-8s %s", mnemonic, operands);
           else if (mnemonic != nullptr)
-            strm.Printf("%s", mnemonic);
+            strm.PutCString(mnemonic);
 
           int right_pad = 1;
           window.PutCStringTruncated(
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index 62c4a9131a6f7..f58c8e63600c4 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -403,7 +403,7 @@ void Mangled::DumpDebug(Stream *s) const {
   s->Printf("%*p: Mangled mangled = ", static_cast<int>(sizeof(void *) * 2),
             static_cast<const void *>(this));
   m_mangled.DumpDebug(s);
-  s->Printf(", demangled = ");
+  s->PutCString(", demangled = ");
   m_demangled.DumpDebug(s);
 }
 
diff --git a/lldb/source/Core/SearchFilter.cpp 
b/lldb/source/Core/SearchFilter.cpp
index 8edbc4da2ffde..b44223312f722 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -555,7 +555,7 @@ void SearchFilterByModuleList::Search(Searcher &searcher) {
 void SearchFilterByModuleList::GetDescription(Stream *s) {
   size_t num_modules = m_module_spec_list.GetSize();
   if (num_modules == 1) {
-    s->Printf(", module = ");
+    s->PutCString(", module = ");
     s->PutCString(
         m_module_spec_list.GetFileSpecAtIndex(0).GetFilename().nonEmptyOr(
             "<Unknown>"));
@@ -775,7 +775,7 @@ void SearchFilterByModuleListAndCU::Search(Searcher 
&searcher) {
 void SearchFilterByModuleListAndCU::GetDescription(Stream *s) {
   size_t num_modules = m_module_spec_list.GetSize();
   if (num_modules == 1) {
-    s->Printf(", module = ");
+    s->PutCString(", module = ");
     s->PutCString(
         m_module_spec_list.GetFileSpecAtIndex(0).GetFilename().nonEmptyOr(
             "<Unknown>"));
diff --git a/lldb/source/Core/SourceManager.cpp 
b/lldb/source/Core/SourceManager.cpp
index d34d3c1cd8585..5ffedcc86ca1f 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -296,12 +296,12 @@ size_t 
SourceManager::DisplaySourceLinesWithLineNumbersUsingLastFile(
         // Display caret cursor.
         std::string src_line;
         last_file_sp->GetLine(line, src_line);
-        s->Printf("    \t");
+        s->PutCString("    \t");
         // Insert a space for every non-tab character in the source line.
         for (size_t i = 0; i + 1 < column && i < src_line.length(); ++i)
           s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
         // Now add the caret.
-        s->Printf("^\n");
+        s->PutCString("^\n");
       }
       if (this_line_size == 0) {
         m_last_line = UINT32_MAX;
diff --git a/lldb/source/DataFormatters/FormattersHelpers.cpp 
b/lldb/source/DataFormatters/FormattersHelpers.cpp
index ce65de05547e7..d219475e89fcc 100644
--- a/lldb/source/DataFormatters/FormattersHelpers.cpp
+++ b/lldb/source/DataFormatters/FormattersHelpers.cpp
@@ -131,7 +131,7 @@ 
lldb_private::formatters::GetArrayAddressOrPointerValue(ValueObject &valobj) {
 void lldb_private::formatters::DumpCxxSmartPtrPointerSummary(
     Stream &stream, ValueObject &ptr, const TypeSummaryOptions &options) {
   if (ptr.GetValueAsUnsigned(0) == 0) {
-    stream.Printf("nullptr");
+    stream.PutCString("nullptr");
     return;
   }
 
diff --git a/lldb/source/DataFormatters/StringPrinter.cpp 
b/lldb/source/DataFormatters/StringPrinter.cpp
index 3a6a55e9d4e02..05dfaca8bc1d9 100644
--- a/lldb/source/DataFormatters/StringPrinter.cpp
+++ b/lldb/source/DataFormatters/StringPrinter.cpp
@@ -263,9 +263,9 @@ static bool DumpEncodedBufferToStream(
   assert(dump_options.GetStream() && "need a Stream to print the string to");
   Stream &stream(*dump_options.GetStream());
   if (dump_options.GetPrefixToken() != nullptr)
-    stream.Printf("%s", dump_options.GetPrefixToken());
+    stream.PutCString(dump_options.GetPrefixToken());
   if (dump_options.GetQuote() != 0)
-    stream.Printf("%c", dump_options.GetQuote());
+    stream.PutChar(dump_options.GetQuote());
   auto data(d...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/210294
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to