[all-commits] [llvm/llvm-project] a18f45: [lldb] Fix string truncation method when substring...

Shivam Gupta via All-commits all-commits at lists.llvm.org
Thu Jul 11 00:28:11 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a18f45f556c781d711f82043bf451fcce8324163
      https://github.com/llvm/llvm-project/commit/a18f45f556c781d711f82043bf451fcce8324163
  Author: Shivam Gupta <shivam98.tkg at gmail.com>
  Date:   2024-07-11 (Thu, 11 Jul 2024)

  Changed paths:
    M lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp

  Log Message:
  -----------
  [lldb] Fix string truncation method when substring is the prefix of string (NFC) (#94785)

Correct the method used to truncate the source_file string when
substring is a prefix. The previous method used substr, which was
changed to resize for clarity and efficiency.

Caught by cppcheck - 
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp:290:19:
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 - 
source_file = source_file.substr(0, pos);

Fix #91211

---------

Co-authored-by: Shivam Gupta <shivma98.tkg at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list