[PATCH] D134929: [clang-tidy] Skip variadic ctors in use-equals-default

Alexander Shaposhnikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 29 17:43:22 PDT 2022


alexander-shaposhnikov created this revision.
alexander-shaposhnikov added reviewers: gribozavr2, njames93, alexfh.
alexander-shaposhnikov created this object with visibility "All Users".
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a project: All.
alexander-shaposhnikov requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Skip variadic constructors in modernize-use-equals-default (such constructors cannot be explicitly defaulted).

Test plan: ninja check-all


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134929

Files:
  clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default.cpp


Index: clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default.cpp
@@ -53,6 +53,11 @@
   };
 };
 
+// Skip variadic constructors.
+struct VA {
+  VA(...) {}
+};
+
 // Initializer or arguments.
 class IA {
 public:
Index: clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
@@ -235,7 +235,7 @@
           anyOf(
               // Default constructor.
               allOf(unless(hasAnyConstructorInitializer(isWritten())),
-                    parameterCountIs(0)),
+                    unless(isVariadic()), parameterCountIs(0)),
               // Copy constructor.
               allOf(isCopyConstructor(),
                     // Discard constructors that can be used as a copy


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134929.464115.patch
Type: text/x-patch
Size: 1143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220930/2821b389/attachment.bin>


More information about the cfe-commits mailing list