llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: None (aabhinavg)

<details>
<summary>Changes</summary>

Summary of Changes:

Replaced the ineffective call to `substr` with a more efficient use of `resize` 
to truncate the string.
Adjusted the code to use 'resize' instead of 'substr' for better performance 
and readability.
Removed unwanted file from the previous commit.
Fixes: #<!-- -->91209 

---
Full diff: https://github.com/llvm/llvm-project/pull/92565.diff


1 Files Affected:

- (modified) lldb/source/Core/Debugger.cpp (+1-1) 


``````````diff
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 9951fbcd3e7c3..70303173925e3 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -2067,7 +2067,7 @@ void Debugger::HandleProgressEvent(const lldb::EventSP 
&event_sp) {
   const uint32_t term_width = GetTerminalWidth();
   const uint32_t ellipsis = 3;
   if (message.size() + ellipsis >= term_width)
-    message = message.substr(0, term_width - ellipsis);
+    message.resize(message.size() - ellipsis);
 
   const bool use_color = GetUseColor();
   llvm::StringRef ansi_prefix = GetShowProgressAnsiPrefix();

``````````

</details>


https://github.com/llvm/llvm-project/pull/92565
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to