[cfe-commits] r91433 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExpr.cpp test/CXX/temp/temp.spec/temp.explicit/p1.cpp

Douglas Gregor dgregor at apple.com
Tue Dec 15 08:44:32 PST 2009


Author: dgregor
Date: Tue Dec 15 10:44:32 2009
New Revision: 91433

URL: http://llvm.org/viewvc/llvm-project?rev=91433&view=rev
Log:
Fix some diagnostic-related FIXMEs, from Nicola Gigante

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p1.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=91433&r1=91432&r2=91433&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Dec 15 10:44:32 2009
@@ -530,10 +530,9 @@
 "invalid initialization of reference of type %0 from expression of type %1">;
 def err_lvalue_to_rvalue_ambig_ref : Error<"rvalue reference cannot bind to lvalue "
                                            "due to multiple conversion functions">;
-// FIXME: passing in an English string as %1!
 def err_not_reference_to_const_init : Error<
   "non-const lvalue reference to type %0 cannot be initialized "
-  "with a %1 of type %2">;
+  "with a %select{value|temporary}1 of type %2">;
 def err_lvalue_reference_bind_to_temporary : Error<
   "non-const lvalue reference to type %0 cannot bind to a temporary of type "
   "%1">;
@@ -551,9 +550,8 @@
   "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
   "list">;
 
-// FIXME: passing in an English string as %1!
 def err_reference_init_drops_quals : Error<
-  "initialization of reference to type %0 with a %1 of type %2 drops "
+  "initialization of reference to type %0 with a %select{value|temporary}1 of type %2 drops "
   "qualifiers">;
 def err_reference_bind_to_bitfield : Error<
   "%select{non-const|volatile}0 reference cannot bind to bit-field %1">;
@@ -1497,11 +1495,8 @@
   "invalid application of 'sizeof' to a function type">, InGroup<PointerArith>;
 def ext_sizeof_void_type : Extension<
   "invalid application of '%0' to a void type">, InGroup<PointerArith>;
-// FIXME: merge with %select
-def err_sizeof_incomplete_type : Error<
-  "invalid application of 'sizeof' to an incomplete type %0">;
-def err_alignof_incomplete_type : Error<
-  "invalid application of '__alignof' to an incomplete type %0">;
+def err_sizeof_alignof_incomplete_type : Error<
+  "invalid application of '%select{sizeof|__alignof}0' to an incomplete type %1">;
 def err_sizeof_alignof_bitfield : Error<
   "invalid application of '%select{sizeof|__alignof}0' to bit-field">;
 def err_offsetof_incomplete_type : Error<
@@ -1586,9 +1581,8 @@
 def note_member_def_close_match : Note<"member declaration nearly matches">;
 def err_typecheck_ivar_variable_size : Error<
   "instance variables must have a constant size">;
-// FIXME: Improve with %select
 def err_typecheck_illegal_increment_decrement : Error<
-  "cannot modify value of type %0">;
+  "cannot %select{decrement|increment}1 value of type %0">;
 def err_typecheck_arithmetic_incomplete_type : Error<
   "arithmetic on pointer to incomplete type %0">;
 def err_typecheck_pointer_arith_function_type : Error<

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=91433&r1=91432&r2=91433&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Dec 15 10:44:32 2009
@@ -4462,7 +4462,7 @@
   if (!isRValRef && T1.getCVRQualifiers() != Qualifiers::Const) {
     if (!ICS)
       Diag(DeclLoc, diag::err_not_reference_to_const_init)
-        << T1 << (InitLvalue != Expr::LV_Valid? "temporary" : "value")
+        << T1 << int(InitLvalue != Expr::LV_Valid)
         << T2 << Init->getSourceRange();
     return true;
   }
@@ -4528,7 +4528,7 @@
     // initialization fails.
     if (!ICS)
       Diag(DeclLoc, diag::err_reference_init_drops_quals)
-        << T1 << (InitLvalue != Expr::LV_Valid? "temporary" : "value")
+        << T1 << int(InitLvalue != Expr::LV_Valid)
         << T2 << Init->getSourceRange();
     return true;
   }

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=91433&r1=91432&r2=91433&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Dec 15 10:44:32 2009
@@ -1698,9 +1698,8 @@
   }
 
   if (RequireCompleteType(OpLoc, exprType,
-                          isSizeof ? diag::err_sizeof_incomplete_type :
-                          PDiag(diag::err_alignof_incomplete_type)
-                            << ExprRange))
+                          PDiag(diag::err_sizeof_alignof_incomplete_type)
+                          << int(!isSizeof) << ExprRange))
     return true;
 
   // Reject sizeof(interface) and sizeof(interface<proto>) in 64-bit mode.
@@ -5734,7 +5733,7 @@
       << ResType << Op->getSourceRange();
   } else {
     Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement)
-      << ResType << Op->getSourceRange();
+      << ResType << int(isInc) << Op->getSourceRange();
     return QualType();
   }
   // At this point, we know we have a real, complex or pointer type.

Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p1.cpp?rev=91433&r1=91432&r2=91433&view=diff

==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p1.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.explicit/p1.cpp Tue Dec 15 10:44:32 2009
@@ -14,7 +14,7 @@
 // Explicitly instantiate a function template specialization
 template<typename T>
 void f0(T t) {
-  ++t; // expected-error{{cannot modify}}
+  ++t; // expected-error{{cannot increment}}
 }
 
 template void f0(int);





More information about the cfe-commits mailing list