[PATCH] D148812: [NFC][clang] Fix static analyzer concerns

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 20 09:42:20 PDT 2023


Manna created this revision.
Manna added a reviewer: tahonermann.
Herald added subscribers: luke, manas, frasercrmck, ASDenysPetrov, luismarques, apazos, sameer.abuasal, s.egerton, Jim, dkrupp, donat.nagy, jocewei, Szelethus, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, a.sidorin, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, baloghadamsoftware, arichardson.
Herald added a reviewer: aaron.ballman.
Herald added a project: All.
Manna requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay.
Herald added a project: clang.

Reported by Coverity:

AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.

1. Inside "SemaDeclCXX.cpp" file, in <unnamed>::​DiagnoseUninitializedFields(clang::​Sema &, clang::​CXXConstructorDecl const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.

2. Inside "ClangAttrEmitter.cpp" file, in clang::​EmitClangAttrParsedAttrImpl(llvm::​RecordKeeper &, llvm::​raw_ostream &): Using the auto keyword without an & causes the copy of an object of type pair.

3. Inside "Marshallers.h" file, in clang::​ast_matchers::​dynamic::​internal::​MapAnyOfBuilderDescriptor::​buildMatcherCtor(clang::​ast_matchers::​dynamic::​SourceRange, llvm::​ArrayRef<clang::​ast_matchers::​dynamic::​ParserValue>, clang::​ast_matchers::​dynamic::​Diagnostics *): Using the auto keyword without an & causes the copy of an object of type ParserValue.

4. Inside "CGVTables.cpp" file, in clang::​CodeGen::​CodeGenModule::​GetVCallVisibilityLevel(clang::​CXXRecordDecl const *, llvm::​DenseSet<clang::​CXXRecordDecl const *, llvm::​DenseMapInfo<clang::​CXXRecordDecl const *, void>> &): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.

5. Inside "ASTContext.cpp" file, in hasTemplateSpecializationInEncodedString(clang::​Type const *, bool): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.

6. Inside "RISCVVEmitter.cpp" file, in <unnamed>::​RVVEmitter::​createRVVIntrinsics(std::​vector<std::​unique_ptr<clang::​RISCV::​RVVIntrinsic, std::​default_delete<clang::​RISCV::​RVVIntrinsic>>, std::​allocator<std::​unique_ptr<clang::​RISCV::​RVVIntrinsic, std::​default_delete<clang::​RISCV::​RVVIntrinsic>>>> &, std::​vector<<unnamed>::​SemaRecord, std::​allocator<<unnamed>::​SemaRecord>> *): Using the auto keyword without an & causes the copy of an object of type Policy.

7. Inside "Pragma.cpp" file, in <unnamed>::​PragmaDebugHandler::​HandlePragma(clang::​Preprocessor &, clang::​PragmaIntroducer, clang::​Token &): Using the auto keyword without an & causes the copy of an object of type pair.

8. Inside "ComputeDependence.cpp" file, in clang::​computeDependence(clang::​DependentScopeDeclRefExpr *): Using the auto keyword without an & causes the copy of an object of type TemplateArgumentLoc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148812

Files:
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ComputeDependence.cpp
  clang/lib/ASTMatchers/Dynamic/Marshallers.h
  clang/lib/CodeGen/CGVTables.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/utils/TableGen/ClangAttrEmitter.cpp
  clang/utils/TableGen/RISCVVEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148812.515355.patch
Type: text/x-patch
Size: 4734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230420/3fe0be17/attachment-0001.bin>


More information about the cfe-commits mailing list