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.
- 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.
- 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.
A lot of these changes look to be regressions, so I think Coverity is incorrect to flag these. The old code is passing an AvailabilitySet by value because it's doing a move operation on initialization: Availabilities(std::move(Availabilities)). Making this into a const reference defeats that optimization because you can't steal resources from a const object (so this turns a move into a copy).
You should look through the rest of the patch for similar problematic changes.