[all-commits] [llvm/llvm-project] 1e92ad: [lldb] Use const reference for range variables to ...

Shivam Gupta via All-commits all-commits at lists.llvm.org
Sat Jun 8 10:05:02 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1e92ad41d8ef46fa3c628b05ba8ed481fedc17bd
      https://github.com/llvm/llvm-project/commit/1e92ad41d8ef46fa3c628b05ba8ed481fedc17bd
  Author: Shivam Gupta <shivam98.tkg at gmail.com>
  Date:   2024-06-08 (Sat, 08 Jun 2024)

  Changed paths:
    M lldb/source/API/SBBreakpoint.cpp
    M lldb/source/API/SBTarget.cpp
    M lldb/source/Breakpoint/Breakpoint.cpp
    M lldb/source/Breakpoint/BreakpointIDList.cpp

  Log Message:
  -----------
  [lldb] Use const reference for range variables to improve performance (NFC) (#94840)

Cppcheck recommends using a const reference for range variables in a
for-each loop.
This avoids unnecessary copying of elements, improving performance.

Caught by cppcheck -
lldb/source/API/SBBreakpoint.cpp:717:22: performance: Range variable
'name' should be declared as const reference. [iterateByValue]
lldb/source/API/SBTarget.cpp:1150:15: performance: Range variable 'name'
should be declared as const reference. [iterateByValue]
lldb/source/Breakpoint/Breakpoint.cpp:888:26: performance: Range
variable 'name' should be declared as const reference. [iterateByValue]
lldb/source/Breakpoint/BreakpointIDList.cpp:262:26: performance: Range
variable 'name' should be declared as const reference. [iterateByValue]

Fix #91213
Fix #91217
Fix #91219
Fix #91220



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