[PATCH] D140963: [Coverity] Auto Causes copy

Wang, Xin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 02:24:22 PST 2023


XinWang10 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
XinWang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Use variable without & cause the copy of an object


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140963

Files:
  llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp


Index: llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
===================================================================
--- llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
+++ llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
@@ -97,7 +97,7 @@
       S.split(BBIndexes, ' ');
       // Reset current cluster position.
       CurrentPosition = 0;
-      for (auto BBIndexStr : BBIndexes) {
+      for (auto &BBIndexStr : BBIndexes) {
         unsigned long long BBIndex;
         if (getAsUnsignedInteger(BBIndexStr, 10, BBIndex))
           return invalidProfileError(Twine("Unsigned integer expected: '") +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140963.486206.patch
Type: text/x-patch
Size: 624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230104/302eab4b/attachment.bin>


More information about the llvm-commits mailing list