[Lldb-commits] [lldb] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #92565)
via lldb-commits
lldb-commits at lists.llvm.org
Fri May 17 08:55:37 PDT 2024
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
More information about the lldb-commits
mailing list