[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
Tue Apr 18 08:20:39 PDT 2023


Manna created this revision.
Manna added reviewers: tahonermann, aaron.ballman.
Herald added subscribers: steakhal, manas, ASDenysPetrov, martong, dkrupp, donat.nagy, Szelethus, a.sidorin, baloghadamsoftware, kristof.beyls.
Herald added a reviewer: NoQ.
Herald added a project: All.
Manna requested review of this revision.
Herald added a project: clang.

Reported by Coverity:

AUTO_CAUSES_COPY
Unnecessary object copies can affect performance

1. Inside "SemaInit.cpp" file, in isVarOnPath(llvm::​SmallVectorImpl<<unnamed>::​IndirectLocalPathEntry> &, clang::​VarDecl *): Using the auto keyword without an & causes the copy of an object of type IndirectLocalPathEntry

2. Inside "ODRHash.cpp" file, in clang::​ODRHash::​AddCXXRecordDecl(clang::​CXXRecordDecl const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.

3. Inside "CGExpr.cpp" file, in clang::​CodeGen::​CodeGenFunction::​EmitCfiCheckFail(): Using the auto keyword without an & causes the copy of an object of type pair.

4. Inside "ASTReader.cpp" file, in clang::​ASTReader::​finishPendingActions(): Using the auto keyword without an & causes the copy of an object of type pair.

5. Inside "ExprEngine.cpp" file, in clang::​ento::​ExprEngine::​removeDead(clang::​ento::​ExplodedNode *, clang::​ento::​ExplodedNodeSet &, clang::​Stmt const *, clang::​LocationContext const *, clang::​Stmt const *, clang::​ProgramPoint::​Kind): Using the auto keyword without an & causes the copy of an object of type pair.

6. Inside "CGVTables.cpp" file, *in clang::​CodeGen::​CodeGenModule::​EmitVTableTypeMetadata(clang::​CXXRecordDecl const *, llvm::​GlobalVariable *, clang::​VTableLayout const &): Using the auto keyword without an & causes the copy of an object of type pair.

7. Inside "ExprConstant.cpp" file, in EvaluateArgs(llvm::​ArrayRef<clang::​Expr const *>, <unnamed>::​CallRef, <unnamed>::​EvalInfo &, clang::​FunctionDecl const *, bool): Using the auto keyword without an & causes the copy of an object of type ParamIdx.

8. Inside "ARM.cpp" file, in clang::​targets::​ARMTargetInfo::​initFeatureMap(llvm::​StringMap<bool, llvm::​MallocAllocator> &, clang::​DiagnosticsEngine &, llvm::​StringRef, std::​vector<std::​basic_string<char, std::​char_traits<char>, std::​allocator<char>>, std::​allocator<std::​basic_string<char, std::​char_traits<char>, std::​allocator<char>>>> const &): Using the auto keyword without an & causes the copy of an object of type StringRef.

9. Inside "Tokens.cpp" file, in clang::​syntax::​TokenBuffer::​dumpForTests[abi:cxx11](): Using the auto keyword without an & causes the copy of an object of type DenseMapPair.

10. Inside "TargetID.cpp" file, in clang::​getCanonicalTargetID[abi:cxx11](llvm::​StringRef, llvm::​StringMap<bool, llvm::​MallocAllocator> const &): Using the auto keyword without an & causes the copy of an object of type pair.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148639

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/ODRHash.cpp
  clang/lib/Basic/TargetID.cpp
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGVTables.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/Tooling/Syntax/Tokens.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148639.514643.patch
Type: text/x-patch
Size: 5048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230418/a8794dce/attachment.bin>


More information about the cfe-commits mailing list