[PATCH] D52727: [clang-tidy] White List Option for performance-unnecessary-value-param, performance-unnecessary-copy-initialization and performance-for-range-copy
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 1 09:48:02 PDT 2018
lebedev.ri added a comment.
Thanks, that looks much better.
Please clang-format the patch.
This pattern is repeated at least 4 times now, i think some abstraction is needed.
================
Comment at: clang-tidy/performance/ForRangeCopyCheck.cpp:49
+ // Skip whitelisted types
+ const auto VarType = Var->getType();
+ if (std::find_if(WhiteListTypes.begin(), WhiteListTypes.end(),
----------------
I'm not sure what is `auto` here, please spell `QualType`.
================
Comment at: clang-tidy/performance/ForRangeCopyCheck.cpp:50-53
+ if (std::find_if(WhiteListTypes.begin(), WhiteListTypes.end(),
+ [&](llvm::StringRef WhiteListType) {
+ return llvm::Regex(WhiteListType).match(VarType.getCanonicalType().getAsString(Result.Context->getPrintingPolicy()));
+ }) != WhiteListTypes.end())
----------------
`llvm::any_of()`
================
Comment at: clang-tidy/performance/UnnecessaryCopyInitialization.cpp:96
+ const auto VarType = NewVar->getType();
+ if (std::find_if(WhiteListTypes.begin(), WhiteListTypes.end(),
+ [&](llvm::StringRef WhiteListType) {
----------------
Same
================
Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:103
+ // Skip whitelisted types
+ const auto ParamType = Param->getType();
+ if (std::find_if(WhiteListTypes.begin(), WhiteListTypes.end(),
----------------
Same
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D52727
More information about the cfe-commits
mailing list