[PATCH] D73090: [clang-tidy] Fix PR#44528 'modernize-use-using and enums'

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 25 11:20:28 PST 2020


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp:28
                      this);
-  // This matcher used to find structs defined in source code within typedefs.
+  // This matcher`s used to find structs/enums defined in source code within typedefs.
   // They appear in the AST just *prior* to the typedefs.
----------------
It looks like there's a backtick in the comment rather than a quotation mark, that should probably be `matcher's` instead. Also, instead of `struct/enums`, I think it should be `tag declarations` (unions count, for instance).


================
Comment at: clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp:30-31
   // They appear in the AST just *prior* to the typedefs.
-  Finder->addMatcher(cxxRecordDecl(unless(isImplicit())).bind("struct"), this);
+  Finder->addMatcher(cxxRecordDecl(unless(isImplicit())).bind("tagdecl"), this);
+  Finder->addMatcher(enumDecl(unless(isImplicit())).bind("tagdecl"), this);
 }
----------------
Rather than matching on these, I think it would make more sense to add a new matcher for `tagDecl()`. It can be local to the check for now, or you can add it to the AST matchers header as a separate patch and then base this patch off that work.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73090/new/

https://reviews.llvm.org/D73090





More information about the cfe-commits mailing list