[PATCH] D52727: [clang-tidy] White List Option for performance-unnecessary-value-param, performance-unnecessary-copy-initialization and performance-for-range-copy
Jonas Toth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 9 06:41:34 PDT 2018
JonasToth added inline comments.
================
Comment at: clang-tidy/performance/UnnecessaryCopyInitialization.cpp:65-66
has(varDecl(hasLocalStorage(),
- hasType(matchers::isExpensiveToCopy()),
+ hasType(hasCanonicalType(
+ allOf(matchers::isExpensiveToCopy(),
+ unless(hasDeclaration(namedDecl(
----------------
baloghadamsoftware wrote:
> JonasToth wrote:
> > lebedev.ri wrote:
> > > Does it matter whether we are calling `matchers::isExpensiveToCopy()` on the type, or on the canonical type?
> > the canonical type does resolve all typedefs, which is what is desirable in this case.
> The real question is whether we want to match the canonical type to the list of allowed type names. I am not sure.
Well, very long template names are impractical, even for something "simple" as std::string the name gets very long without the typedef. I would say the typedefs should be respected
https://reviews.llvm.org/D52727
More information about the cfe-commits
mailing list