llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.94k stars 11.53k forks source link

lldb/source/Core/Debugger.cpp:2069: Clumsy string resize ? #91209

Open dcb314 opened 4 months ago

dcb314 commented 4 months ago

Static analyser cppcheck says:

lldb/source/Core/Debugger.cpp:2069:15: performance: Ineffective call of function 'substr' because a prefix of the string is assigned to itself. Use resize() or pop_back() instead. [uselessCallsSubstr]

Source code is

message = message.substr(0, term_width - ellipsis);
llvmbot commented 4 months ago

@llvm/issue-subscribers-lldb

Author: None (dcb314)

Static analyser cppcheck says: lldb/source/Core/Debugger.cpp:2069:15: performance: Ineffective call of function 'substr' because a prefix of the string is assigned to itself. Use resize() or pop_back() instead. [uselessCallsSubstr] Source code is message = message.substr(0, term_width - ellipsis);
llvmbot commented 4 months ago

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Check that no other contributor has already been assigned to this issue. If you believe that no one is actually working on it despite an assignment, ping the person. After one week without a response, the assignee may be changed.
  2. In the comments of this issue, request for it to be assigned to you, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
  3. Fix the issue locally.
  4. Run the test suite locally. Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests.
  5. Create a Git commit.
  6. Run git clang-format HEAD~1 to format your changes.
  7. Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.

If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.

llvmbot commented 4 months ago

@llvm/issue-subscribers-good-first-issue

Author: None (dcb314)

Static analyser cppcheck says: lldb/source/Core/Debugger.cpp:2069:15: performance: Ineffective call of function 'substr' because a prefix of the string is assigned to itself. Use resize() or pop_back() instead. [uselessCallsSubstr] Source code is message = message.substr(0, term_width - ellipsis);
vedantbarve commented 4 months ago

@JOE1994 can you please assign this task to me?

JOE1994 commented 4 months ago

@vedantbarve I've assigned this to you.

aabhinavg commented 4 months ago

Hi @vedantbarve Are you currently working on it?

vedantbarve commented 3 months ago

I wanted to make my first contribution to LLVM through this PR. Since @aabhinavg had self-assigned it, I took up some other work. I will get free in 3-4 days. @JOE1994 @aabhinavg If you guys are okay with it, can I please complete this issue in a few days?

Extremely sorry for the late reply.

Dinistro commented 3 months ago

No idea what happened here. I did not actively interact with the linked PR, not is the linked commit there from me. either some weird GitHub issue or a hash collision?

bulbazord commented 3 months ago

No idea what happened here. I did not actively interact with the linked PR, not is the linked commit there from me. either some weird GitHub issue or a hash collision?

Github indicates that you merged the relevant PR.

Dinistro commented 3 months ago

No idea what happened here. I did not actively interact with the linked PR, not is the linked commit there from me. either some weird GitHub issue or a hash collision?

Github indicates that you merged the relevant PR.

I pushed a commit directly to master at that point in time. If you look at the referred commit in the linked PR, it's visible that someone else is the author. Odd.