[cfe-commits] r59442 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaDeclCXX.cpp test/SemaCXX/overloaded-operator-decl.cpp
Douglas Gregor
doug.gregor at gmail.com
Mon Nov 17 07:03:34 PST 2008
Author: dgregor
Date: Mon Nov 17 09:03:30 2008
New Revision: 59442
URL: http://llvm.org/viewvc/llvm-project?rev=59442&view=rev
Log:
Simplify error messages for two-parameter overloaded increment/decrement operators
Modified:
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/overloaded-operator-decl.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=59442&r1=59441&r2=59442&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Mon Nov 17 09:03:30 2008
@@ -1346,12 +1346,8 @@
DIAG(err_operator_overload_must_be_member, ERROR,
"overloaded operator '%0' must be a non-static member function")
DIAG(err_operator_overload_post_inc_must_be_int, ERROR,
- "second parameter of overloaded post-increment operator must have type 'int' (not '%0')")
-DIAG(err_operator_overload_post_dec_must_be_int, ERROR,
- "second parameter of overloaded post-decrement operator must have type 'int' (not '%0')")
-DIAG(err_operator_overload_post_inc_must_be_int_member, ERROR,
"parameter of overloaded post-increment operator must have type 'int' (not '%0')")
-DIAG(err_operator_overload_post_dec_must_be_int_member, ERROR,
+DIAG(err_operator_overload_post_dec_must_be_int, ERROR,
"parameter of overloaded post-decrement operator must have type 'int' (not '%0')")
DIAG(err_operator_missing_type_specifier, ERROR,
"missing type specifier after 'operator'")
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=59442&r1=59441&r2=59442&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Nov 17 09:03:30 2008
@@ -1987,17 +1987,10 @@
if (!ParamIsInt) {
diag::kind DK;
- if (Op == OO_PlusPlus) {
- if (MethodDecl)
- DK = diag::err_operator_overload_post_inc_must_be_int_member;
- else
- DK = diag::err_operator_overload_post_inc_must_be_int;
- } else {
- if (MethodDecl)
- DK = diag::err_operator_overload_post_dec_must_be_int_member;
- else
- DK = diag::err_operator_overload_post_dec_must_be_int;
- }
+ if (Op == OO_PlusPlus)
+ DK = diag::err_operator_overload_post_inc_must_be_int;
+ else
+ DK = diag::err_operator_overload_post_dec_must_be_int;
Diag(LastParam->getLocation(), DK,
Context.getCanonicalType(LastParam->getType()).getAsString(),
SourceRange(FnDecl->getLocation()));
Modified: cfe/trunk/test/SemaCXX/overloaded-operator-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overloaded-operator-decl.cpp?rev=59442&r1=59441&r2=59442&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overloaded-operator-decl.cpp (original)
+++ cfe/trunk/test/SemaCXX/overloaded-operator-decl.cpp Mon Nov 17 09:03:30 2008
@@ -34,4 +34,4 @@
typedef float FLOAT;
Y& operator++(Y&);
Y operator++(Y&, INT);
-X operator++(X&, FLOAT); // expected-error{{second parameter of overloaded post-increment operator must have type 'int' (not 'float')}}
+X operator++(X&, FLOAT); // expected-error{{parameter of overloaded post-increment operator must have type 'int' (not 'float')}}
More information about the cfe-commits
mailing list