[PATCH] D147901: [NFC][CLANG][API] Fix coverity remarks about large copies by values
Soumi Manna via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 9 17:47:35 PDT 2023
Manna created this revision.
Manna added reviewers: erichkeane, aaron.ballman.
Herald added a reviewer: ributzka.
Herald added a project: All.
Manna requested review of this revision.
Herald added a reviewer: dang.
Herald added a project: clang.
Reported by Coverity Static Analyzer Tool:
Big parameter passed by value (PASS_BY_VALUE)
Copying large values is inefficient, consider passing by reference; Low, medium, and high size thresholds for detection can be adjusted.
1. pass_by_value: Passing parameter Availabilities of type clang::extractapi::AvailabilitySet (size 320 bytes) by value, which exceeds the medium threshold of 256 bytes in "API.cpp" and "API.h" files.
This patch passes parameter as const AvailabilitySet &Availabilities instead of AvailabilitySet Availabilities.
2. Inside "APIIgnoresList.h" file, in clang::extractapi::APIIgnoresList::APIIgnoresList(llvm::SmallVector<llvm::StringRef, 32u>, llvm::SmallVector<std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, 13u>): A large function call parameter exceeding the medium threshold is passed by value.
pass_by_value: Passing parameter SymbolsToIgnore of type clang::extractapi::APIIgnoresList::SymbolNameList (size 268 bytes) by value, which exceeds the medium threshold of 256 bytes.
This patch passes parameter as const SymbolNameList &SymbolsToIgnore instead of SymbolNameList SymbolsToIgnore.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147901
Files:
clang/include/clang/ExtractAPI/API.h
clang/include/clang/ExtractAPI/APIIgnoresList.h
clang/lib/ExtractAPI/API.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147901.512057.patch
Type: text/x-patch
Size: 25979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230410/72db3e5b/attachment-0001.bin>
More information about the cfe-commits
mailing list