]> granicus.if.org Git - clang/commitdiff
Fix some diagnostic-related FIXMEs, from Nicola Gigante
authorDouglas Gregor <dgregor@apple.com>
Tue, 15 Dec 2009 16:44:32 +0000 (16:44 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 15 Dec 2009 16:44:32 +0000 (16:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91433 91177308-0d34-0410-b5e6-96231b3b80d8

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

index a890323e6c0d9f16cb2f9d9db9d40890dbe870fa..71fcb9326ebcc6e0ebe1272ca502aacddc08fa0f 100644 (file)
@@ -530,10 +530,9 @@ def err_invalid_initialization : Error<
 "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 @@ def err_init_list_bad_dest_type : Error<
   "%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 @@ def ext_sizeof_function_type : Extension<
   "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 err_out_of_line_declaration : Error<
 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<
index 228a716ca483b4efe3333581291c94ba2ce20a66..831d58dad5f978d7e87306beb76a739bd801a83a 100644 (file)
@@ -4462,7 +4462,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
   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 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
     // 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;
   }
index 358f4456bb0cc07e1e437f00f9f5f8355732cd7a..66af76d7369df1966346ab37d5359fb558fb5e4e 100644 (file)
@@ -1698,9 +1698,8 @@ bool Sema::CheckSizeOfAlignOfOperand(QualType exprType,
   }
 
   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 @@ QualType Sema::CheckIncrementDecrementOperand(Expr *Op, SourceLocation OpLoc,
       << 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.
index 896e30efb8866fd864dee2fd3b0ea6b34eac1e78..00e9c8f347fd4598df4ff688c089f818ad1880ec 100644 (file)
@@ -14,7 +14,7 @@ template struct X0<void>; // expected-note{{instantiation}}
 // 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);