[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
Thu Apr 20 07:14:25 PDT 2023
Manna updated this revision to Diff 515318.
Manna added a comment.
Thank you everyone for reviews and feedbacks. I misunderstood some of the False positive Coverity cases. Thanks for the explanation and suggestions. I will keep this in mind while investigating static analysis in future. This patch removes FP cases.
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.515318.patch
Type: text/x-patch
Size: 1292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230420/aa242ac7/attachment.bin>
More information about the cfe-commits
mailing list