================
@@ -3311,7 +3306,23 @@ FunctionDecl::getDefaultedFunctionKind() const {
       return CXXSpecialMemberKind::Destructor;
   }
 
-  switch (getDeclName().getCXXOverloadedOperator()) {
+  switch (OverloadedOperatorKind OO =
+              getDeclName().getCXXOverloadedOperator()) {
+  case OO_PlusPlus:
+  case OO_MinusMinus: {
+    // Only the postfix forms can be defaulted. They are distinguished from the
+    // prefix forms by their trailing 'int' parameter, so they have exactly two
+    // parameters once the implicit object parameter (if any) is counted.
+    unsigned NumParams = getNumParams();
+    if (const auto *MD = dyn_cast<CXXMethodDecl>(this);
+        MD && MD->isImplicitObjectMemberFunction())
+      ++NumParams;
----------------
bassiounix wrote:

If you find an existing util like this which I can use, please let me know!

https://github.com/llvm/llvm-project/pull/229560
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to