[all-commits] [llvm/llvm-project] 38ecb9: [NFC][clang] Fix Coverity bugs with AUTO_CAUSES_COPY

smanna12 via All-commits all-commits at lists.llvm.org
Mon Apr 24 14:53:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 38ecb9767c1485abe0eb210ceeb827a884bc55c9
      https://github.com/llvm/llvm-project/commit/38ecb9767c1485abe0eb210ceeb827a884bc55c9
  Author: Manna, Soumi <soumi.manna at intel.com>
  Date:   2023-04-24 (Mon, 24 Apr 2023)

  Changed paths:
    M clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
    M clang/lib/AST/ComputeDependence.cpp
    M clang/lib/CodeGen/CGGPUBuiltin.cpp
    M clang/lib/CodeGen/MicrosoftCXXABI.cpp
    M clang/lib/Format/Format.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/utils/TableGen/NeonEmitter.cpp

  Log Message:
  -----------
  [NFC][clang] Fix Coverity bugs with AUTO_CAUSES_COPY

Reported by Coverity:
AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.

1. Inside "ExtractAPIVisitor.h" file, in clang::extractapi::impl::ExtractAPIVisitorBase<<unnamed>::BatchExtractAPIVisitor>::VisitFunctionDecl(clang::FunctionDecl const *): Using the auto keyword without an & causes the copy of an object of type DynTypedNode.

2. Inside "NeonEmitter.cpp" file, in <unnamed>::Intrinsic::Intrinsic(llvm::Record *, llvm::StringRef, llvm::StringRef, <unnamed>::TypeSpec, <unnamed>::TypeSpec, <unnamed>::ClassKind, llvm::ListInit *, <unnamed>::NeonEmitter &, llvm::StringRef, llvm::StringRef, bool, bool): Using the auto keyword without an & causes the copy of an object of type Type.

3. Inside "MicrosoftCXXABI.cpp" file, in <unnamed>::MSRTTIBuilder::getClassHierarchyDescriptor(): Using the auto keyword without an & causes the copy of an object of type MSRTTIClass.

4. Inside "CGGPUBuiltin.cpp" file, in clang::CodeGen::CodeGenFunction::EmitAMDGPUDevicePrintfCallExpr(clang::CallExpr const *): Using the auto keyword without an & causes the copy of an object of type CallArg.

5. Inside "SemaDeclAttr.cpp" file, in threadSafetyCheckIsSmartPointer(clang::Sema &, clang::RecordType const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.

6. Inside "ComputeDependence.cpp" file, in clang::computeDependence(clang::DesignatedInitExpr *): Using the auto keyword without an & causes the copy of an object of type Designator.

7. Inside "Format.cpp" file, In clang::format::affectsRange(llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int): Using the auto keyword without an & causes the copy of an object of type Range.

Reviewed By: tahonermann

Differential Revision: https://reviews.llvm.org/D149074




More information about the All-commits mailing list