diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-24 06:25:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-24 06:25:27 +0000 |
commit | d162584991885ab004a02573a73ce06422b921fc (patch) | |
tree | 0d8c56d85205a22c6c06b712a468afcd10429c4b | |
parent | d9d22dd9c94618490dbffb0e2caf222530ca39d3 (diff) |
Change a whole lot of diagnostics to take QualType's directly
instead of converting them to strings first. This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59948 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticKinds.def | 186 | ||||
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 20 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 100 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 15 | ||||
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaInherit.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaNamedCast.cpp | 65 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 17 | ||||
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 16 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 23 | ||||
-rw-r--r-- | test/Parser/objc-forcollection-neg-2.m | 2 | ||||
-rw-r--r-- | test/Parser/objc-forcollection-neg.m | 8 | ||||
-rw-r--r-- | test/Sema/compound-literal.c | 2 | ||||
-rw-r--r-- | test/Sema/declspec.c | 4 | ||||
-rw-r--r-- | test/Sema/typecheck-binop.c | 2 | ||||
-rw-r--r-- | test/SemaCXX/dynamic-cast.cpp | 4 | ||||
-rw-r--r-- | test/SemaObjC/foreach-1.m | 4 |
21 files changed, 231 insertions, 266 deletions
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index b1c8bb22e4..6e7e58e61d 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -295,9 +295,9 @@ DIAG(ext_integer_complex, EXTENSION, DIAG(ext_thread_before, EXTENSION, "'__thread' before 'static'") DIAG(ext_integer_increment_complex, EXTENSION, - "ISO C does not support '++'/'--' on complex integer types") + "ISO C does not support '++'/'--' on complex integer type %0") DIAG(ext_integer_complement_complex, EXTENSION, - "ISO C does not support '~' for complex conjugation") + "ISO C does not support '~' for complex conjugation of %0") DIAG(ext_mixed_decls_code, EXTENSION, "ISO C90 forbids mixing declarations and code") @@ -428,7 +428,7 @@ DIAG(err_objc_missing_end, ERROR, DIAG(warn_objc_protocol_qualifier_missing_id, WARNING, "protocol qualifiers without 'id' is archaic") DIAG(warn_objc_array_of_interfaces, WARNING, - "array of interface '%0' should probably be an array of pointers") + "array of interface %0 should probably be an array of pointers") DIAG(err_invalid_receiver_to_message, ERROR, "invalid receiver to message expression") @@ -515,9 +515,9 @@ DIAG(warn_inst_method_not_found, WARNING, DIAG(warn_method_not_found_in_protocol, WARNING, "method %objcinstance0 not found in protocol (return type defaults to 'id')") DIAG(err_collection_expr_type, ERROR, - "collection expression type ('%0') is not a valid object") + "collection expression type %0 is not a valid object") DIAG(err_selector_element_type, ERROR, - "selector element type ('%0') is not a valid object") + "selector element type %0 is not a valid object") DIAG(err_selector_element_not_lvalue, ERROR, "selector element is not a valid lvalue") DIAG(err_toomany_element_decls, ERROR, @@ -527,7 +527,7 @@ DIAG(warn_expected_implementation, WARNING, DIAG(error_missing_method_context, ERROR, "missing context for method declaration") DIAG(error_bad_receiver_type, ERROR, - "bad receiver type '%0'") + "bad receiver type %0") DIAG(error_no_super_class, ERROR, "no super class declared in @interface for %0") DIAG(error_missing_property_context, ERROR, @@ -705,8 +705,7 @@ DIAG(err_not_integral_type_bitfield, ERROR, DIAG(err_member_initialization, ERROR, "'%0' can only be initialized if it is a static const integral data member") DIAG(err_implicit_object_parameter_init, ERROR, - "cannot initialize object parameter of type '%0' with an expression " - "of type '%1'") + "cannot initialize object parameter of type %0 with an expression of type %1") // C++ constructors DIAG(err_constructor_cannot_be, ERROR, @@ -739,16 +738,18 @@ DIAG(err_destructor_typedef_name, ERROR, "destructor cannot be declared using a typedef %0 of the class name") // C++ initialization +// FIXME: passing in an English string as %1! DIAG(err_not_reference_to_const_init, ERROR, - "non-const reference to type '%0' cannot be initialized with a %1 of type '%2'") + "non-const reference to type %0 cannot be initialized with a %1 of type %2") +// FIXME: passing in an English string as %1! DIAG(err_reference_init_drops_quals, ERROR, - "initialization of reference to type '%0' with a %1 of type '%2' drops qualifiers") + "initialization of reference to type %0 with a %1 of type %2 drops qualifiers") DIAG(err_reference_var_requires_init, ERROR, "declaration of reference variable %0 requires an initializer") DIAG(err_const_var_requires_init, ERROR, "declaration of const variable '%0' requires an initializer") DIAG(err_init_non_aggr_init_list, ERROR, - "initialization of non-aggregate type '%0' with an initializer list") + "initialization of non-aggregate type %0 with an initializer list") // Objective-C++ DIAG(err_objc_decls_may_only_appear_in_global_scope, ERROR, @@ -760,7 +761,7 @@ DIAG(err_attribute_wrong_number_arguments, ERROR, DIAG(err_attribute_missing_parameter_name, ERROR, "attribute requires unquoted parameter") DIAG(err_attribute_invalid_vector_type, ERROR, - "invalid vector type '%0'") + "invalid vector type %0") DIAG(err_attribute_argument_not_int, ERROR, "'%0' attribute requires integer constant") DIAG(err_attribute_argument_n_not_int, ERROR, @@ -782,13 +783,13 @@ DIAG(err_attribute_invalid_size, ERROR, DIAG(err_attribute_zero_size, ERROR, "zero vector size") DIAG(err_typecheck_vector_not_convertable, ERROR, - "can't convert between vector values of different size ('%0' and '%1')") + "can't convert between vector values of different size (%0 and %1)") DIAG(err_typecheck_ext_vector_not_typedef, ERROR, "ext_vector_type only applies to types, not variables") DIAG(err_ext_vector_component_exceeds_length, ERROR, - "vector component access exceeds type '%0'") + "vector component access exceeds type %0") DIAG(err_ext_vector_component_requires_even, ERROR, - "vector component access invalid for odd-sized type '%0'") + "vector component access invalid for odd-sized type %0") DIAG(err_ext_vector_component_name_illegal, ERROR, "illegal vector component name '%0'") DIAG(err_ext_vector_component_access, ERROR, @@ -894,7 +895,7 @@ DIAG(err_ovl_ambiguous_call, ERROR, DIAG(err_ovl_candidate, NOTE, "candidate function") DIAG(err_ovl_builtin_candidate, NOTE, - "built-in candidate function '%0'") + "built-in candidate function %0") DIAG(err_ovl_no_viable_function_in_init, ERROR, "no matching constructor for initialization of %0" "%plural{0:|1:; candidate is|:; candidates are:}1") @@ -905,12 +906,12 @@ DIAG(err_ovl_ambiguous_oper, ERROR, DIAG(err_ovl_no_viable_oper, ERROR, "no viable overloaded '%0'; candidate%plural{1: is|:s are}1:") DIAG(err_ovl_no_viable_object_call, ERROR, - "no matching function for call to object of type '%0'" + "no matching function for call to object of type %0" "%plural{0:|1:; candidate is|:; candidates are:}1") DIAG(err_ovl_ambiguous_object_call, ERROR, - "call to object of type '%0' is ambiguous; candidates are:") + "call to object of type %0 is ambiguous; candidates are:") DIAG(err_ovl_surrogate_cand, NOTE, - "conversion candidate of type '%0'") + "conversion candidate of type %0") DIAG(err_unexpected_typedef, ERROR, "unexpected type name %0: expected expression") @@ -933,7 +934,7 @@ DIAG(err_non_static_static, ERROR, DIAG(err_redefinition_different_kind, ERROR, "redefinition of %0 as different kind of symbol") DIAG(err_redefinition_different_typedef, ERROR, - "typedef redefinition with different types ('%0' vs '%1')") + "typedef redefinition with different types (%0 vs %1)") DIAG(err_conflicting_types, ERROR, "conflicting types for %0") DIAG(err_nested_redefinition, ERROR, @@ -963,17 +964,17 @@ DIAG(err_typecheck_field_variable_size, ERROR, DIAG(err_typecheck_negative_array_size, ERROR, "array size is negative") DIAG(warn_typecheck_function_qualifiers, WARNING, - "qualifier on function type '%0' has unspecified behavior") + "qualifier on function type %0 has unspecified behavior") DIAG(err_typecheck_invalid_restrict_not_pointer, ERROR, - "restrict requires a pointer or reference ('%0' is invalid)") + "restrict requires a pointer or reference (%0 is invalid)") DIAG(err_typecheck_invalid_restrict_invalid_pointee, ERROR, - "pointer to function type ('%0') may not be 'restrict' qualified") + "pointer to function type %0 may not be 'restrict' qualified") DIAG(ext_typecheck_zero_array_size, EXTENSION, "zero size arrays are an extension") DIAG(err_at_least_one_initializer_needed_to_size_array, ERROR, "at least one initializer value required to size array") DIAG(err_array_size_non_int, ERROR, - "size of array has non-integer type '%0'") + "size of array has non-integer type %0") DIAG(err_init_element_not_constant, ERROR, "initializer element is not a compile-time constant") DIAG(err_block_extern_cant_init, ERROR, @@ -999,7 +1000,7 @@ DIAG(err_empty_scalar_initializer, ERROR, DIAG(err_illegal_initializer, ERROR, "illegal initializer (only variables can be initialized)") DIAG(err_illegal_initializer_type, ERROR, - "illegal initializer type ('%0')") + "illegal initializer type %0") DIAG(err_implicit_empty_initializer, ERROR, "initializer for aggregate with no elements requires explicit braces") @@ -1014,7 +1015,7 @@ DIAG(ext_implicit_function_decl, EXTENSION, "implicit declaration of function %0 is invalid in C99") DIAG(err_func_returning_array_function, ERROR, - "function cannot return array or function type '%0'") + "function cannot return array or function type %0") DIAG(err_field_declared_as_function, ERROR, "field %0 declared as a function") DIAG(err_field_incomplete, ERROR, @@ -1026,11 +1027,11 @@ DIAG(err_flexible_array_empty_struct, ERROR, DIAG(ext_flexible_array_in_struct, EXTENSION, "%0 may not be nested in a struct due to flexible array member") DIAG(err_flexible_array_in_array, ERROR, - "'%0' may not be used as an array element due to flexible array member") + "%0 may not be used as an array element due to flexible array member") DIAG(err_illegal_decl_array_of_functions, ERROR, "'%0' declared as array of functions") DIAG(err_illegal_decl_array_incomplete_type, ERROR, - "array has incomplete element type '%0'") + "array has incomplete element type %0") DIAG(err_illegal_decl_array_of_references, ERROR, "'%0' declared as array of references") DIAG(err_illegal_decl_pointer_to_reference, ERROR, @@ -1057,14 +1058,15 @@ DIAG(ext_sizeof_function_type, EXTENSION, "invalid application of 'sizeof' to a function type") DIAG(ext_sizeof_void_type, EXTENSION, "invalid application of '%0' to a void type") +// FIXME: merge with %select DIAG(err_sizeof_incomplete_type, ERROR, - "invalid application of 'sizeof' to an incomplete type '%0'") + "invalid application of 'sizeof' to an incomplete type %0") DIAG(err_alignof_incomplete_type, ERROR, - "invalid application of '__alignof' to an incomplete type '%0'") + "invalid application of '__alignof' to an incomplete type %0") DIAG(err_offsetof_record_type, ERROR, - "offsetof requires struct, union, or class type, '%0' invalid") + "offsetof requires struct, union, or class type, %0 invalid") DIAG(err_offsetof_array_type, ERROR, - "offsetof requires array type, '%0' invalid") + "offsetof requires array type, %0 invalid") DIAG(ext_offsetof_extended_field_designator, EXTENSION, "using extended field designator is an extension") DIAG(err_expected_field_designator, ERROR, @@ -1099,25 +1101,27 @@ DIAG(err_typecheck_subscript_value, ERROR, DIAG(err_typecheck_subscript, ERROR, "array subscript is not an integer") DIAG(err_typecheck_subscript_not_object, ERROR, - "illegal subscript of non-object type '%0'") + "illegal subscript of non-object type %0") DIAG(err_typecheck_member_reference_struct_union, ERROR, - "member reference base type ('%0') is not a structure or union") + "member reference base type %0 is not a structure or union") DIAG(err_typecheck_member_reference_ivar, ERROR, "%0 does not have a member named %1") DIAG(err_typecheck_member_reference_arrow, ERROR, - "member reference type '%0' is not a pointer") + "member reference type %0 is not a pointer") DIAG(err_typecheck_incomplete_tag, ERROR, "incomplete definition of type %0") DIAG(err_typecheck_no_member, ERROR, "no member named %0") +// FIXME: Improve with %select DIAG(err_typecheck_illegal_increment_decrement, ERROR, - "cannot modify value of type '%0'") + "cannot modify value of type %0") DIAG(err_typecheck_arithmetic_incomplete_type, ERROR, - "arithmetic on pointer to incomplete type '%0'") + "arithmetic on pointer to incomplete type %0") DIAG(err_typecheck_decl_incomplete_type, ERROR, "variable has incomplete type %0") +// FIXME: Use %select DIAG(err_realimag_invalid_type, ERROR, - "invalid type '%0' to __real or __imag operator") + "invalid type %0 to __real or __imag operator") DIAG(err_typecheck_sclass_fscope, ERROR, "illegal storage class on file-scoped variable") DIAG(err_typecheck_sclass_func, ERROR, @@ -1127,19 +1131,19 @@ DIAG(err_typecheck_address_of, ERROR, DIAG(err_typecheck_invalid_lvalue_addrof, ERROR, "address expression must be an lvalue or a function designator") DIAG(err_typecheck_unary_expr, ERROR, - "invalid argument type to unary expression '%0'") + "invalid argument type %0 to unary expression") DIAG(err_typecheck_indirection_requires_pointer, ERROR, "indirection requires pointer operand (%0 invalid)") DIAG(err_typecheck_invalid_operands, ERROR, "invalid operands to binary expression (%0 and %1)") DIAG(err_typecheck_sub_ptr_object, ERROR, - "'%0' is not a complete object type") + "subtraction of pointer %0 requires pointee to be a complete object type") DIAG(err_typecheck_sub_ptr_compatible, ERROR, - "'%0' and '%1' are not pointers to compatible types") + "%0 and %1 are not pointers to compatible types") DIAG(ext_typecheck_comparison_of_pointer_integer, WARNING, - "comparison between pointer and integer ('%0' and '%1')") + "comparison between pointer and integer (%0 and %1)") DIAG(ext_typecheck_comparison_of_distinct_pointers, WARNING, - "comparison of distinct pointer types ('%0' and '%1')") + "comparison of distinct pointer types (%0 and %1)") DIAG(err_typecheck_assign_const, ERROR, "read-only variable is not assignable") @@ -1155,7 +1159,7 @@ DIAG(err_invalid_qualified_typedef_function_type_use, ERROR, DIAG(err_invalid_non_static_member_use, ERROR, "invalid use of nonstatic data member %0") DIAG(err_invalid_incomplete_type_use, ERROR, - "invalid use of incomplete type '%0'") + "invalid use of incomplete type %0") DIAG(err_builtin_func_cast_more_than_one_arg, ERROR, "function-style cast to a builtin type can only take one argument") DIAG(err_builtin_direct_init_more_than_one_arg, ERROR, @@ -1165,13 +1169,13 @@ DIAG(err_value_init_for_array_type, ERROR, // C++ casts DIAG(err_bad_cxx_cast_generic, ERROR, - "%0 from '%2' to '%1' is not allowed") + "%0 from %2 to %1 is not allowed") DIAG(err_bad_cxx_cast_rvalue, ERROR, - "%0 from rvalue to reference type '%1'") + "%0 from rvalue to reference type %1") DIAG(err_bad_cxx_cast_const_away, ERROR, - "%0 from '%2' to '%1' casts away constness") + "%0 from %2 to %1 casts away constness") DIAG(err_bad_const_cast_dest, ERROR, - "const_cast to '%0', which is not a reference, pointer-to-object, " + "const_cast to %0, which is not a reference, pointer-to-object, " "or pointer-to-data-member") DIAG(err_bad_reinterpret_cast_same_type, ERROR, "source and destination type of reinterpret_cast are not distinct") @@ -1179,39 +1183,41 @@ DIAG(ext_reinterpret_cast_fn_obj, EXTENSION, "reinterpret_cast between pointer-to-function and pointer-to-object is " "an extension") DIAG(err_bad_reinterpret_cast_small_int, ERROR, - "cast from pointer to smaller type '%0' loses information") + "cast from pointer to smaller type %0 loses information") DIAG(err_bad_dynamic_cast_not_ref_or_ptr, ERROR, - "'%0' is not a reference or pointer") + "%0 is not a reference or pointer") DIAG(err_bad_dynamic_cast_not_class, ERROR, - "'%0' is not a class") + "%0 is not a class") DIAG(err_bad_dynamic_cast_incomplete, ERROR, - "'%0' is incomplete") + "%0 is an incomplete type") DIAG(err_bad_dynamic_cast_not_ptr, ERROR, - "'%0' is not a pointer") + "%0 is not a pointer") DIAG(err_bad_dynamic_cast_not_polymorphic, ERROR, - "'%0' is not polymorphic") + "%0 is not polymorphic") +// FIXME: Display the path somehow better. DIAG(err_ambiguous_base_to_derived_cast, ERROR, - "ambiguous static_cast from base '%0' to derived '%1':%2") + "ambiguous static_cast from base %0 to derived %1:%2") DIAG(err_static_downcast_via_virtual, ERROR, - "cannot cast '%0' to '%1' via virtual base '%2'") + "cannot cast %0 to %1 via virtual base %2") // Other C++ expressions DIAG(err_need_header_before_typeid, ERROR, "you need to include <typeinfo> before using the 'typeid' operator") +// FIXME: merge with %select DIAG(err_new_function, ERROR, - "cannot allocate function type '%0' with new") + "cannot allocate function type %0 with new") DIAG(err_new_incomplete, ERROR, - "cannot allocate incomplete type '%0' with new") + "cannot allocate incomplete type %0 with new") DIAG(err_new_reference, ERROR, - "cannot allocate reference type '%0' with new") + "cannot allocate reference type %0 with new") DIAG(err_new_array_nonconst, ERROR, "only the first dimension of an allocated array may be non-const") DIAG(err_new_uninitialized_const, ERROR, "must provide an initializer if the allocated object is 'const'") DIAG(err_delete_operand, ERROR, - "cannot delete expression of type '%0'") + "cannot delete expression of type %0") DIAG(warn_delete_incomplete, WARNING, - "deleting pointer to incomplete type '%0' may cause undefined behaviour") + "deleting pointer to incomplete type %0 may cause undefined behaviour") DIAG(err_invalid_use_of_function_type, ERROR, "a function type is not allowed here") @@ -1220,7 +1226,7 @@ DIAG(err_invalid_use_of_array_type, ERROR, DIAG(err_type_defined_in_condition, ERROR, "types may not be defined in conditions") DIAG(err_typecheck_bool_condition, ERROR, - "expression must have bool type (or be convertible to bool) ('%0' invalid)") + "expression must have bool type (or be convertible to bool) (%0 invalid)") DIAG(err_expected_class_or_namespace, ERROR, "expected a class or namespace") DIAG(err_invalid_declarator_scope, ERROR, @@ -1252,20 +1258,20 @@ DIAG(ext_typecheck_convert_discards_qualifiers, EXTWARN, DIAG(err_int_to_block_pointer, ERROR, "invalid conversion %2 integer %1, expected block pointer %0") DIAG(err_typecheck_comparison_of_distinct_blocks, ERROR, - "comparison of distinct block types ('%0' and '%1')") + "comparison of distinct block types (%0 and %1)") DIAG(ext_typecheck_convert_incompatible_block_pointer, EXTWARN, "incompatible block pointer types %2 %1, expected %0") DIAG(ext_typecheck_convert_pointer_void_block, EXTENSION, "%2 %1 converts between void* and block pointer, expected %0") DIAG(err_typecheck_array_not_modifiable_lvalue, ERROR, - "array type '%0' is not assignable") + "array type %0 is not assignable") DIAG(err_typecheck_non_object_not_modifiable_lvalue, ERROR, - "non-object type '%0' is not assignable") + "non-object type %0 is not assignable") DIAG(err_typecheck_expression_not_modifiable_lvalue, ERROR, "expression is not assignable") DIAG(err_typecheck_incomplete_type_not_modifiable_lvalue, ERROR, - "incomplete type '%0' is not assignable") + "incomplete type %0 is not assignable") DIAG(err_typecheck_lvalue_casts_not_supported, ERROR, "assignment to cast is illegal, lvalue casts are not supported") @@ -1274,7 +1280,7 @@ DIAG(err_typecheck_duplicate_vector_components_not_mlvalue, ERROR, DIAG(err_block_decl_ref_not_modifiable_lvalue, ERROR, "variable is not assignable (missing __block type specifier)") DIAG(err_typecheck_call_not_function, ERROR, - "called object type '%0' is not a function or function pointer") + "called object type %0 is not a function or function pointer") DIAG(err_typecheck_call_too_few_args, ERROR, "too few arguments to %select{function|block|method}0 call") DIAG(err_typecheck_call_too_many_args, ERROR, @@ -1282,19 +1288,19 @@ DIAG(err_typecheck_call_too_many_args, ERROR, DIAG(err_typecheck_closure_too_many_args, ERROR, "too many arguments to closure call") DIAG(err_typecheck_call_invalid_ordered_compare, ERROR, - "ordered compare requires two args of floating point type ('%0' and '%1')") + "ordered compare requires two args of floating point type (%0 and %1)") DIAG(err_typecheck_cond_expect_scalar, ERROR, - "used type '%0' where arithmetic or pointer type is required") + "used type %0 where arithmetic or pointer type is required") DIAG(ext_typecheck_cond_one_void, EXTENSION, "C99 forbids conditional expressions with only one void side") DIAG(ext_typecheck_cast_nonscalar, EXTENSION, - "C99 forbids casting nonscalar to the same type") + "C99 forbids casting nonscalar type %0 to the same type") DIAG(err_typecheck_expect_scalar_operand, ERROR, - "operand of type '%0' where arithmetic or pointer type is required") + "operand of type %0 where arithmetic or pointer type is required") DIAG(err_typecheck_cond_incompatible_operands, ERROR, - "incompatible operand types ('%0' and '%1')") + "incompatible operand types (%0 and %1)") DIAG(warn_typecheck_cond_incompatible_pointers, WARNING, - "pointer type mismatch ('%0' and '%1')") + "pointer type mismatch (%0 and %1)") DIAG(err_typecheck_choose_expr_requires_constant, ERROR, "'__builtin_choose_expr' requires a constant expression") DIAG(ext_typecheck_expression_not_constant_but_accepted, EXTENSION, @@ -1312,20 +1318,22 @@ DIAG(err_asm_invalid_output_constraint, ERROR, DIAG(err_asm_invalid_input_constraint, ERROR, "invalid input constraint '%0' in asm") DIAG(err_asm_invalid_type_in_input, ERROR, - "invalid type '%0' in asm input for constraint '%1'") + "invalid type %0 in asm input for constraint '%1'") DIAG(err_asm_unknown_register_name, ERROR, "unknown register name '%0' in asm") DIAG(err_invalid_conversion_between_vectors, ERROR, - "invalid conversion between vector type '%0' and '%1' of different size") + "invalid conversion between vector type %0 and %1 of different size") DIAG(err_invalid_conversion_between_vector_and_integer, ERROR, - "invalid conversion between vector type '%0' and integer type '%1' " + "invalid conversion between vector type %0 and integer type %1 " "of different size") DIAG(err_invalid_conversion_between_vector_and_scalar, ERROR, - "invalid conversion between vector type '%0' and scalar type '%1'") + "invalid conversion between vector type %0 and scalar type %1") DIAG(err_overload_expr_requires_non_zero_constant, ERROR, "overload requires a non-zero constant expression as first argument") DIAG(err_overload_incorrect_fntype, ERROR, "argument is not a function, or has wrong number of parameters") + +// FIXME: PASSING TYPES AS STRING. DIAG(err_overload_no_match, ERROR, "no matching overload found for arguments of type '%0'") DIAG(err_overload_multiple_match, ERROR, @@ -1359,9 +1367,10 @@ DIAG(err_union_as_base_class, ERROR, DIAG(err_incomplete_base_class, ERROR, "base class has incomplete type") DIAG(err_duplicate_base_class, ERROR, - "base class '%0' specified more than once as a direct base class") + "base class %0 specified more than once as a direct base class") +// FIXME: better way to display derivation? Pass entire thing into diagclient? DIAG(err_ambiguous_derived_to_base_conv, ERROR, - "ambiguous conversion from derived class '%0' to base class '%1':%2") + "ambiguous conversion from derived class %0 to base class %1:%2") // C++ operator overloading DIAG(err_operator_overload_needs_class_or_enum, ERROR, @@ -1380,7 +1389,7 @@ 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, "parameter of overloaded post-%select{increment|decrement}1 operator must" - " have type 'int' (not '%0')") + " have type 'int' (not %0)") DIAG(err_operator_missing_type_specifier, ERROR, "missing type specifier after 'operator'") @@ -1400,12 +1409,11 @@ DIAG(err_conv_function_to_function, ERROR, DIAG(err_conv_function_redeclared, ERROR, "conversion function cannot be redeclared") DIAG(warn_conv_to_self_not_used, WARNING, - "conversion function converting '%0' to itself will never be used") + "conversion function converting %0 to itself will never be used") DIAG(warn_conv_to_base_not_used, WARNING, - "conversion function converting '%0' to its base class '%1' will never " - "be used") + "conversion function converting %0 to its base class %1 will never be used") DIAG(warn_conv_to_void_not_used, WARNING, - "conversion function converting '%0' to '%1' will never be used") + "conversion function converting %0 to %1 will never be used") DIAG(warn_not_compound_assign, WARNING, "use of unary operator that may be intended as compound assignment (%0=)") @@ -1434,9 +1442,9 @@ DIAG(warn_printf_asterisk_width_missing_arg, WARNING, DIAG(warn_printf_asterisk_precision_missing_arg, WARNING, "'.*' specified field precision is missing a matching 'int' argument") DIAG(warn_printf_asterisk_width_wrong_type, WARNING, - "field width should have type 'int', but argument has type '%0'") + "field width should have type 'int', but argument has type %0") DIAG(warn_printf_asterisk_precision_wrong_type, WARNING, - "field precision should have type 'int', but argument has type '%0'") + "field precision should have type 'int', but argument has type %0") // CHECK: returning address/reference of stack memory DIAG(warn_ret_stack_addr, WARNING, @@ -1491,9 +1499,9 @@ DIAG(err_duplicate_case, ERROR, DIAG(warn_case_empty_range, WARNING, "empty case range specified") DIAG(err_typecheck_statement_requires_scalar, ERROR, - "statement requires expression of scalar type ('%0' invalid)") + "statement requires expression of scalar type (%0 invalid)") DIAG(err_typecheck_statement_requires_integer, ERROR, - "statement requires expression of integer type ('%0' invalid)") + "statement requires expression of integer type (%0 invalid)") DIAG(err_multiple_default_labels_defined, ERROR, "multiple default labels in one switch") DIAG(warn_empty_if_body, WARNING, @@ -1503,7 +1511,7 @@ DIAG(err_va_start_used_in_non_variadic_function, ERROR, DIAG(warn_second_parameter_of_va_start_not_last_named_argument, WARNING, "second parameter of 'va_start' not last named argument") DIAG(err_first_argument_to_va_arg_not_of_type_va_list, ERROR, - "first argument to 'va_arg' is of type '%0' and not 'va_list'") + "first argument to 'va_arg' is of type %0 and not 'va_list'") DIAG(warn_return_missing_expr, WARNING, "non-void %select{function|method}1 %0 should return a value") diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 09f6efb097..bbc50d6bac 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -223,7 +223,7 @@ bool Sema::SemaBuiltinUnorderedCompare(CallExpr *TheCall) { if (!Res->isRealFloatingType()) return Diag(OrigArg0->getLocStart(), diag::err_typecheck_call_invalid_ordered_compare) - << OrigArg0->getType().getAsString() << OrigArg1->getType().getAsString() + << OrigArg0->getType() << OrigArg1->getType() << SourceRange(OrigArg0->getLocStart(), OrigArg1->getLocEnd()); return false; @@ -574,10 +574,10 @@ Sema::CheckPrintfArguments(CallExpr *TheCall, bool HasVAListArg, if (Str[StrIdx-1] == '.') Diag(Loc, diag::warn_printf_asterisk_precision_wrong_type) - << E->getType().getAsString() << E->getSourceRange(); + << E->getType() << E->getSourceRange(); else Diag(Loc, diag::warn_printf_asterisk_width_wrong_type) - << E->getType().getAsString() << E->getSourceRange(); + << E->getType() << E->getSourceRange(); break; } diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 4f71f068c5..1fc2c992e1 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -336,8 +336,7 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) { Context.getCanonicalType(Old->getUnderlyingType()) != Context.getCanonicalType(New->getUnderlyingType())) { Diag(New->getLocation(), diag::err_redefinition_different_typedef) - << New->getUnderlyingType().getAsString() - << Old->getUnderlyingType().getAsString(); + << New->getUnderlyingType() << Old->getUnderlyingType(); Diag(Old->getLocation(), diag::note_previous_definition); return Old; } @@ -757,7 +756,7 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType, const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(ClassRec->getDecl()); if (!ClassDecl->isAggregate()) return Diag(InitLoc, diag::err_init_non_aggr_init_list) - << DeclType.getAsString() << Init->getSourceRange(); + << DeclType << Init->getSourceRange(); } } @@ -906,8 +905,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { case DeclSpec::SCS_auto: case DeclSpec::SCS_register: case DeclSpec::SCS_mutable: - Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_func) - << R.getAsString(); + Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_func); InvalidDecl = true; break; case DeclSpec::SCS_unspecified: SC = FunctionDecl::None; break; @@ -1186,8 +1184,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { // C99 6.9p2: The storage-class specifiers auto and register shall not // appear in the declaration specifiers in an external declaration. if (SC == VarDecl::Auto || SC == VarDecl::Register) { - Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope) - << R.getAsString(); + Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope); InvalidDecl = true; } } diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index ce63d13b4d..2e6108cf0a 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -158,8 +158,7 @@ static void HandleExtVectorTypeAttr(Decl *d, const AttributeList &Attr, // unlike gcc's vector_size attribute, we do not allow vectors to be defined // in conjunction with complex types (pointers, arrays, functions, etc.). if (!curType->isIntegerType() && !curType->isRealFloatingType()) { - S.Diag(Attr.getLoc(), diag::err_attribute_invalid_vector_type) - << curType.getAsString(); + S.Diag(Attr.getLoc(), diag::err_attribute_invalid_vector_type) << curType; return; } // unlike gcc's vector_size attribute, the size is specified as the @@ -229,8 +228,7 @@ static void HandleVectorSizeAttr(Decl *D, const AttributeList &Attr, Sema &S) { } // the base type must be integer or float. if (!CurType->isIntegerType() && !CurType->isRealFloatingType()) { - S.Diag(Attr.getLoc(), diag::err_attribute_invalid_vector_type) - << CurType.getAsString(); + S.Diag(Attr.getLoc(), diag::err_attribute_invalid_vector_type) << CurType; return; } unsigned typeSize = static_cast<unsigned>(S.Context.getTypeSize(CurType)); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index b99f2e0dc1..ab8ae72427 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -351,7 +351,7 @@ void Sema::ActOnBaseSpecifiers(DeclTy *ClassDecl, BaseTy **Bases, // derived class more than once. Diag(BaseSpecs[idx]->getSourceRange().getBegin(), diag::err_duplicate_base_class) - << KnownBaseTypes[NewBaseType]->getType().getAsString() + << KnownBaseTypes[NewBaseType]->getType() << BaseSpecs[idx]->getSourceRange(); // Delete the duplicate base class specifier; we're going to @@ -1212,13 +1212,13 @@ Sema::DeclTy *Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) { ConvType = Context.getCanonicalType(ConvType).getUnqualifiedType(); if (ConvType == ClassType) Diag(Conversion->getLocation(), diag::warn_conv_to_self_not_used) - << ClassType.getAsString(); + << ClassType; else if (IsDerivedFrom(ClassType, ConvType)) Diag(Conversion->getLocation(), diag::warn_conv_to_base_not_used) - << ClassType.getAsString() << ConvType.getAsString(); + << ClassType << ConvType; } else if (ConvType->isVoidType()) { Diag(Conversion->getLocation(), diag::warn_conv_to_void_not_used) - << ClassType.getAsString() << ConvType.getAsString(); + << ClassType << ConvType; } ClassDecl->addConversionFunction(Context, Conversion); @@ -1691,9 +1691,8 @@ Sema::CheckReferenceInit(Expr *&Init, QualType &DeclType, if (!ICS) Diag(Init->getSourceRange().getBegin(), diag::err_not_reference_to_const_init) - << T1.getAsString() - << (InitLvalue != Expr::LV_Valid? "temporary" : "value") - << T2.getAsString() << Init->getSourceRange(); + << T1 << (InitLvalue != Expr::LV_Valid? "temporary" : "value") + << T2 << Init->getSourceRange(); return true; } @@ -1755,9 +1754,8 @@ Sema::CheckReferenceInit(Expr *&Init, QualType &DeclType, if (!ICS) Diag(Init->getSourceRange().getBegin(), diag::err_reference_init_drops_quals) - << T1.getAsString() - << (InitLvalue != Expr::LV_Valid? "temporary" : "value") - << T2.getAsString() << Init->getSourceRange(); + << T1 << (InitLvalue != Expr::LV_Valid? "temporary" : "value") + << T2 << Init->getSourceRange(); return true; } @@ -1915,7 +1913,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { if (!ParamIsInt) return Diag(LastParam->get |