[PATCH] D159474: [NFC][CLANG] Fix static analyzer bugs about unnecessary object copies with auto
Soumi Manna via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 8 09:17:47 PDT 2023
Manna updated this revision to Diff 556273.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159474/new/
https://reviews.llvm.org/D159474
Files:
clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
clang/lib/Analysis/UnsafeBufferUsage.cpp
clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
Index: clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
===================================================================
--- clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -900,7 +900,7 @@
return;
Symbols.emplace_back(std::move(*Class));
- for (const auto Base : Record.Bases)
+ for (const auto &Base : Record.Bases)
serializeRelationship(RelationshipKind::InheritsFrom, Record, Base);
if (!Record.ParentInformation.empty())
serializeRelationship(RelationshipKind::MemberOf, Record,
@@ -914,7 +914,7 @@
return;
Symbols.emplace_back(std::move(*Class));
- for (const auto Base : Record.Bases)
+ for (const auto &Base : Record.Bases)
serializeRelationship(RelationshipKind::InheritsFrom, Record, Base);
if (!Record.ParentInformation.empty())
serializeRelationship(RelationshipKind::MemberOf, Record,
@@ -929,7 +929,7 @@
Symbols.emplace_back(std::move(*Class));
- for (const auto Base : Record.Bases)
+ for (const auto &Base : Record.Bases)
serializeRelationship(RelationshipKind::InheritsFrom, Record, Base);
if (!Record.ParentInformation.empty())
serializeRelationship(RelationshipKind::MemberOf, Record,
@@ -944,7 +944,7 @@
Symbols.emplace_back(std::move(*Class));
- for (const auto Base : Record.Bases)
+ for (const auto &Base : Record.Bases)
serializeRelationship(RelationshipKind::InheritsFrom, Record, Base);
if (!Record.ParentInformation.empty())
serializeRelationship(RelationshipKind::MemberOf, Record,
Index: clang/lib/Analysis/UnsafeBufferUsage.cpp
===================================================================
--- clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -2253,7 +2253,7 @@
// Variables will be removed from `FixItsForVariable`:
SmallVector<const VarDecl *, 8> ToErase;
- for (auto [VD, Ignore] : FixItsForVariable) {
+ for (const auto &[VD, Ignore] : FixItsForVariable) {
VarGrpRef Grp = VarGrpMgr.getGroupOfVar(VD);
if (llvm::any_of(Grp,
[&FixItsForVariable](const VarDecl *GrpMember) -> bool {
Index: clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
===================================================================
--- clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
+++ clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
@@ -172,7 +172,7 @@
SmallVector<SymbolReference> getBases(const CXXRecordDecl *Decl) {
// FIXME: store AccessSpecifier given by inheritance
SmallVector<SymbolReference> Bases;
- for (const auto BaseSpecifier : Decl->bases()) {
+ for (const auto &BaseSpecifier : Decl->bases()) {
// skip classes not inherited as public
if (BaseSpecifier.getAccessSpecifier() != AccessSpecifier::AS_public)
continue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159474.556273.patch
Type: text/x-patch
Size: 2870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230908/9ce58342/attachment.bin>
More information about the cfe-commits
mailing list