[PATCH] D124066: [clang-tidy] Ignore macros defined within declarations in modernize-macro-to-enum

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 22 14:15:13 PDT 2022


LegalizeAdulthood marked an inline comment as done.
LegalizeAdulthood added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp:561-567
+  Finder->addMatcher(varDecl(TopLevelDecl).bind("top"), this);
+  Finder->addMatcher(functionDecl(TopLevelDecl).bind("top"), this);
+  Finder->addMatcher(recordDecl(TopLevelDecl).bind("top"), this);
+  Finder->addMatcher(typeAliasDecl(TopLevelDecl).bind("top"), this);
+  Finder->addMatcher(functionTemplateDecl(TopLevelDecl).bind("top"), this);
+  Finder->addMatcher(classTemplateDecl(TopLevelDecl).bind("top"), this);
+  Finder->addMatcher(typeAliasTemplateDecl(TopLevelDecl).bind("top"), this);
----------------
aaron.ballman wrote:
> Can we mix these together with `anyOf()` so we're not adding so many matchers? e.g.,
> ```
> Finder->addMatcher(anyOf(varDecl(TopLevelDecl), functionDecl(topLevelDecl()), ...).bind("top"), this);
> ```
Oh, good idea, yep can do that.


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

https://reviews.llvm.org/D124066



More information about the cfe-commits mailing list