[PATCH] D140963: [Coverity] Auto Causes copy

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 01:38:35 PST 2023


pengfei added inline comments.


================
Comment at: llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp:100
       CurrentPosition = 0;
-      for (auto BBIndexStr : BBIndexes) {
+      for (auto &BBIndexStr : BBIndexes) {
         unsigned long long BBIndex;
----------------
`StringRef` is a small class. It's common to use copy in LLVM code. I guess it may be better to use copy than reference in small size sturctures.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140963/new/

https://reviews.llvm.org/D140963



More information about the llvm-commits mailing list