[PATCH] D148639: [NFC][clang] Fix static analyzer concerns about AUTO_CAUSES_COPY

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 28 18:59:25 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe52a8b89adda: [NFC][clang] Fix static analyzer concerns about AUTO_CAUSES_COPY (authored by Manna).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148639

Files:
  clang/lib/AST/ODRHash.cpp
  clang/lib/Basic/TargetID.cpp
  clang/lib/Tooling/Syntax/Tokens.cpp


Index: clang/lib/Tooling/Syntax/Tokens.cpp
===================================================================
--- clang/lib/Tooling/Syntax/Tokens.cpp
+++ clang/lib/Tooling/Syntax/Tokens.cpp
@@ -986,7 +986,7 @@
   OS << "\n";
 
   std::vector<FileID> Keys;
-  for (auto F : Files)
+  for (const auto &F : Files)
     Keys.push_back(F.first);
   llvm::sort(Keys);
 
Index: clang/lib/Basic/TargetID.cpp
===================================================================
--- clang/lib/Basic/TargetID.cpp
+++ clang/lib/Basic/TargetID.cpp
@@ -133,7 +133,7 @@
   std::map<const llvm::StringRef, bool> OrderedMap;
   for (const auto &F : Features)
     OrderedMap[F.first()] = F.second;
-  for (auto F : OrderedMap)
+  for (const auto &F : OrderedMap)
     TargetID = TargetID + ':' + F.first.str() + (F.second ? "+" : "-");
   return TargetID;
 }
Index: clang/lib/AST/ODRHash.cpp
===================================================================
--- clang/lib/AST/ODRHash.cpp
+++ clang/lib/AST/ODRHash.cpp
@@ -594,7 +594,7 @@
 
   ID.AddInteger(Record->getNumBases());
   auto Bases = Record->bases();
-  for (auto Base : Bases) {
+  for (const auto &Base : Bases) {
     AddQualType(Base.getType());
     ID.AddInteger(Base.isVirtual());
     ID.AddInteger(Base.getAccessSpecifierAsWritten());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148639.518117.patch
Type: text/x-patch
Size: 1292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230429/13fa3c00/attachment-0001.bin>


More information about the cfe-commits mailing list