[PATCH] D136797: [clang-tidy] Skip template ctors in modernize-use-equals-default

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 15:09:47 PDT 2022


ymandel accepted this revision.
ymandel added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp:249
                     unless(isVariadic()), parameterCountIs(0),
+                    unless(hasParent(functionTemplateDecl())),
                     IsPublicOrOutOfLineUntilCPP20),
----------------
since this appears in both branches, can you place it above on line 244? that will also save a `hasParent` call (fwiw).
```
unless(hasParent(anyOf(IsUnionLikeClass, functionTemplateDecl())))
```


================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp:263
+      cxxMethodDecl(unless(hasParent(IsUnionLikeClass)),
+                    unless(hasParent(functionTemplateDecl())), isDefinition(),
                     isCopyAssignmentOperator(),
----------------
combine w/ previous line into a single `unless(hasParent(anyOf(...)))`




================
Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default.cpp:61
 
+// Skip template constructors.
+struct TA {
----------------
Please add test(s) for the copy-assignment operator case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136797



More information about the cfe-commits mailing list