[PATCH] D149163: [NFC][CLANG] Fix coverity remarks about large copy by values
Soumi Manna via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 25 09:49:56 PDT 2023
Manna created this revision.
Manna added a reviewer: tahonermann.
Herald added a subscriber: arphaman.
Herald added a project: All.
Manna requested review of this revision.
Herald added a project: clang.
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 "CodeCompleteConsumer.cpp" file, in clang::PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(clang::Sema &, clang::CodeCompletionContext, clang::CodeCompletionResult *, unsigned int): A large function call parameter exceeding the low threshold is passed by value.
pass_by_value: Passing parameter Context of type clang::CodeCompletionContext (size 200 bytes) by value, which exceeds the low threshold of 128 bytes.
3. Inside "CodeCompleteConsumer.h" file, in clang::CodeCompleteConsumer::ProcessCodeCompleteResults(clang::Sema &, clang::CodeCompletionContext, clang::CodeCompletionResult *, unsigned int): A large function call parameter exceeding the low threshold is passed by value.
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 "ASTUnit.cpp" file, in <unnamed>::AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(clang::Sema &, clang::CodeCompletionContext, clang::CodeCompletionResult *, unsigned int): A large function call parameter exceeding the low threshold is passed by value.
pass_by_value: Passing parameter Context of type clang::CodeCompletionContext (size 200 bytes) by value, which exceeds the low threshold of 128 bytes.
5. 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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149163
Files:
clang/include/clang/Sema/CodeCompleteConsumer.h
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/Frontend/ASTUnit.cpp
clang/lib/Sema/CodeCompleteConsumer.cpp
clang/lib/Sema/SemaType.cpp
clang/tools/libclang/CIndexCodeCompletion.cpp
clang/unittests/Sema/CodeCompleteTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149163.516827.patch
Type: text/x-patch
Size: 6452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230425/b7f7748f/attachment-0001.bin>
More information about the cfe-commits
mailing list