[PATCH] D52727: [clang-tidy] White List Option for performance-unnecessary-value-param, performance-unnecessary-copy-initialization and performance-for-range-copy

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 07:17:56 PDT 2018


baloghadamsoftware added inline comments.


================
Comment at: clang-tidy/performance/ForRangeCopyCheck.cpp:50
+  const auto VarType = Var->getType();
+  if (std::find_if(WhiteListTypes.begin(), WhiteListTypes.end(),
+                   [&](llvm::StringRef WhiteListType) {
----------------
JonasToth wrote:
> lebedev.ri wrote:
> > `llvm::any_of()`
> This configuration should be used in the matchers. Please see `cppcoreguidelines-no-malloc` for an example on how to do it in the matchers. Having it there usually improves performance and is clearer.
`google-runtime-references` has this in the `check()` function. It seems there is no common agreement where to put this. `cppcoreguidelines-no-malloc` is not a good example since it simple compares strings instead of matching regular expressions. I think here we should allow regular expressions. Then we would need a new matcher called `matchesAnyName`. Should I create it?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52727





More information about the cfe-commits mailing list