]> granicus.if.org Git - clang/commitdiff
merge 3 more diagnostics into 1.
authorChris Lattner <sabre@nondot.org>
Fri, 21 Nov 2008 07:57:12 +0000 (07:57 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 21 Nov 2008 07:57:12 +0000 (07:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59805 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticKinds.def
lib/Sema/SemaDeclCXX.cpp

index 99f24b9a4a4ab3fa61be4a4175d5aa5041e2942f..bb681e69865003b62fc74af6235e29b6fa89ce38 100644 (file)
@@ -1351,12 +1351,9 @@ DIAG(err_operator_overload_static, ERROR,
      "overloaded '%0' cannot be a static member function")
 DIAG(err_operator_overload_default_arg, ERROR,
      "parameter of overloaded '%0' cannot have a default argument")
-DIAG(err_operator_overload_must_be_unaryx, ERROR,
-     "overloaded '%0' must be a unary operator (has %1 parameter%s1)")
-DIAG(err_operator_overload_must_be_binaryx, ERROR,
-     "overloaded '%0' must be a binary operator (has %1 parameter%s1)")
-DIAG(err_operator_overload_must_be_unary_or_binaryx, ERROR,
-     "overloaded '%0' must be a unary or binary operator (has %1 parameter%s1)")
+DIAG(err_operator_overload_must_be, ERROR,
+     "overloaded '%0' must be a %select{unary|binary|unary or binary}2 operator"
+     " (has %1 parameter%s1)")
 DIAG(err_operator_overload_must_be_member, ERROR,
      "overloaded '%0' must be a non-static member function")
 DIAG(err_operator_overload_post_incdec_must_be_int, ERROR,
index f4a95f053194556667e64970f03839eae34d5ad3..cf1f01728d267d1c64f300513581aa3fa5b573a4 100644 (file)
@@ -1872,18 +1872,19 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
        (NumParams == 2 && !CanBeBinaryOperator) ||
        (NumParams < 1) || (NumParams > 2))) {
     // We have the wrong number of parameters.
-    diag::kind DK;
+    unsigned ErrorKind;
     if (CanBeUnaryOperator && CanBeBinaryOperator) {
-      DK = diag::err_operator_overload_must_be_unary_or_binaryx;
+      ErrorKind = 2;  // 2 -> unary or binary.
     } else if (CanBeUnaryOperator) {
-      DK = diag::err_operator_overload_must_be_unaryx;
+      ErrorKind = 0;  // 0 -> unary
     } else {
       assert(CanBeBinaryOperator &&
              "All non-call overloaded operators are unary or binary!");
-      DK = diag::err_operator_overload_must_be_binaryx;
+      ErrorKind = 1;  // 1 -> binary
     }
 
-    return Diag(FnDecl->getLocation(), DK) << FnDecl->getName() << NumParams;
+    return Diag(FnDecl->getLocation(), diag::err_operator_overload_must_be)
+      << FnDecl->getName() << NumParams << ErrorKind;
   }
       
   // Overloaded operators other than operator() cannot be variadic.