[all-commits] [llvm/llvm-project] 4faf3f: [NFC][CLANG] Fix coverity remarks about large copy...

smanna12 via All-commits all-commits at lists.llvm.org
Fri Apr 28 12:17:32 PDT 2023


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

  Changed paths:
    M clang/lib/CodeGen/CGGPUBuiltin.cpp
    M clang/lib/CodeGen/CGNonTrivialStruct.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/CodeGenModule.h
    M clang/lib/Sema/SemaType.cpp

  Log Message:
  -----------
  [NFC][CLANG] Fix coverity remarks about large copy by values

Reported By Static Analyzer Tool, 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 "CodeGenModule.cpp" file, in clang::CodeGen::CodeGenModule::EmitBackendOptionsMetadata(clang::CodeGenOptions): A very large function call parameter exceeding the high threshold is passed by value.

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

2. Inside "SemaType.cpp" file, in IsNoDerefableChunk(clang::DeclaratorChunk): A large function call parameter exceeding the low threshold is passed by value.

pass_by_value: Passing parameter Chunk of type clang::DeclaratorChunk (size 176 bytes) by value, which exceeds the low threshold of 128 bytes.

3. Inside "CGNonTrivialStruct.cpp" file, in <unnamed>::getParamAddrs<1ull, <0ull...>>(std::integer_sequence<unsigned long long, T2...>, std::array<clang::CharUnits, T1>, clang::CodeGen::FunctionArgList, clang::CodeGen::CodeGenFunction *): A large function call parameter exceeding the low threshold is passed by value.

.i. pass_by_value: Passing parameter Args of type clang::CodeGen::FunctionArgList (size 144 bytes) by value, which exceeds the low threshold of 128 bytes.

4. Inside "CGGPUBuiltin.cpp" file, in <unnamed>::containsNonScalarVarargs(clang::CodeGen::CodeGenFunction *, clang::CodeGen::CallArgList): A very large function call parameter exceeding the high threshold is passed by value.

i. pass_by_value: Passing parameter Args of type clang::CodeGen::CallArgList (size 1176 bytes) by value, which exceeds the high threshold of 512 bytes.

Reviewed By: tahonermann

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




More information about the All-commits mailing list