[PATCH] D113804: [clang-tidy] Fix behavior of `modernize-use-using` with nested structs/unions
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 20 13:33:32 PDT 2022
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM aside from a nit.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp:39-48
+ Finder->addMatcher(
+ tagDecl(
+ anyOf(allOf(unless(anyOf(isImplicit(),
+ classTemplateSpecializationDecl())),
+ hasParent(decl().bind(ParentDeclName))),
+ // We want the parent of the ClassTemplateDecl, not the parent
+ // of the specialization.
----------------
I recall that using `hasParent()` and `hasAncestor()` tend to be expensive because they walk up the entire AST to the TU level, and so they can also match in surprising places. However, I can't seem to devise a test case that will fail, so I think this is probably okay.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-use-using.cpp:306
+
+// clang-format off
+
----------------
We don't typically use clang-format comments (especially not in tests; those are almost never formatted anyway). Same below.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113804/new/
https://reviews.llvm.org/D113804
More information about the cfe-commits
mailing list