[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
Thu Oct 4 06:30:29 PDT 2018


JonasToth added inline comments.


================
Comment at: clang-tidy/utils/Matchers.cpp:18-19
+
+Matcher<NamedDecl>
+matchesAnyListedName(const std::vector<std::string> &NameList) {
+  SmallString<256> NameRegEx;
----------------
lebedev.ri wrote:
> baloghadamsoftware wrote:
> > lebedev.ri wrote:
> > > Actually wait, what is this?
> > > It should be something like
> > > ```
> > > AST_MATCHER_P(NamedDecl, matchesAnyListedName, std::vector<std::string> &, NameList) {
> > > ...
> > > ```
> > Taken from `cppcoreguidelines-no-malloc` as @JonasToth suggested.
> Ok, but as you can see in `clang-tidy/utils/Matchers.h` (and `ASTMatchers.h`), it's not really correct prototype.
> 
> 
This is not a full matcher, but a utility function creating one. You can make a full matcher-class with the AST_MATCHER macros as well.
Given this now is a public (within clang-tidy) matcher, it should probably be a AST_MATCHER based matcher. The cppcoreguidelines-check can then be migrated.


https://reviews.llvm.org/D52727





More information about the cfe-commits mailing list