-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Refactor string manipulation in Debugger.cpp #92565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: None (aabhinavg) ChangesSummary of Changes: Replaced the ineffective call to Full diff: https://github.com/llvm/llvm-project/pull/92565.diff 1 Files Affected:
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();
|
|
lldb/source/Core/Debugger.cpp
Outdated
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why term_width
does not appear in the new patch?
@aabhinavg Please let me know when you've changed the GitHub private e-mail address setting and I'd be happy to merge this for you. |
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: llvm#91209 --------- Co-authored-by: aabhinavg <[email protected]>
…7b956371e Local branch amd-gfx b797b95 Manual merge remote-tracking branch llvm-org/main into amd-gfx Remote branch main bf01bb8 [lldb] Refactor string manipulation in Debugger.cpp (llvm#92565)
Summary of Changes:
Replaced the ineffective call to
substr
with a more efficient use ofresize
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