[all-commits] [llvm/llvm-project] 33cf2a: [NFC][clang] Fix static analyzer tool remarks abou...

smanna12 via All-commits all-commits at lists.llvm.org
Fri Apr 7 13:40:19 PDT 2023


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

  Changed paths:
    M clang/lib/CodeGen/CodeGenAction.cpp
    M clang/lib/Sema/SemaCodeComplete.cpp
    M clang/lib/Sema/SemaConcept.cpp

  Log Message:
  -----------
  [NFC][clang] Fix static analyzer tool remarks about large copies by values

        Reported by Coverity:

        Big parameter passed by value
        Copying large values is inefficient, consider passing by reference; Low, medium, and high size thresholds for detection can be adjusted.

       1. Inside "SemaConcept.cpp" file, in subsumes<clang::Sema::MaybeEmitAmbiguousAtomicConstraintsDiagnostic(clang::NamedDecl *, llvm::ArrayRef<clang::Expr const *>, clang::NamedDecl *, llvm::ArrayRef<clang::Expr const *>)::[lambda(clang::AtomicConstraint const &, clang::AtomicConstraint const &) (instance 2)]>(llvm::SmallVector<llvm::SmallVector<clang::AtomicConstraint *, 2u>, 4u>, llvm::SmallVector<llvm::SmallVector<clang::AtomicConstraint *, 2u>, 4u>, T1): A large function call parameter exceeding the low threshold is passed by value.

        i. pass_by_value: Passing parameter PDNF of type NormalForm (size 144 bytes) by value, which exceeds the low threshold of 128 bytes.

        ii. pass_by_value: Passing parameter QCNF of type NormalForm (size 144 bytes) by value, which exceeds the low threshold of 128 bytes.

        2. Inside "CodeGenAction.cpp" file, in clang::reportOptRecordError(llvm::Error, clang::DiagnosticsEngine &, clang::CodeGenOptions): A very large function call parameter exceeding the high threshold is passed by value.

        i. pass_by_value: Passing parameter CodeGenOpts of type clang::CodeGenOptions const (size 1560 bytes) by value, which exceeds the high threshold of 512 bytes.

        3. Inside "SemaCodeComplete.cpp" file, in HandleCodeCompleteResults(clang::Sema *, clang::CodeCompleteConsumer *, clang::CodeCompletionContext, clang::CodeCompletionResult *, unsigned int): A large function call parameter exceeding the low threshold is passed by value.

        i. pass_by_value: Passing parameter Context of type clang::CodeCompletionContext (size 200 bytes) by value, which exceeds the low threshold of 128 bytes.

        4. Inside "SemaConcept.cpp" file, in <unnamed>::SatisfactionStackRAII::SatisfactionStackRAII(clang::Sema &, clang::NamedDecl const *, llvm::FoldingSetNodeID): A large function call parameter exceeding the low threshold is passed by value.

        i. pass_by_value: Passing parameter FSNID of type llvm::FoldingSetNodeID (size 144 bytes) by value, which exceeds the low threshold of 128 bytes.

        Reviewed By: erichkeane, aaron.ballman

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




More information about the All-commits mailing list