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
This commit is contained in:
Chris Lattner 2008-11-24 06:25:27 +00:00
Родитель d9d22dd9c9
Коммит d162584991
21 изменённых файлов: 231 добавлений и 266 удалений

Просмотреть файл

@ -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")

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -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));

Просмотреть файл

@ -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->getLocation(),
diag::err_operator_overload_post_incdec_must_be_int)
<< LastParam->getType().getAsString() << (Op == OO_MinusMinus);
<< LastParam->getType() << (Op == OO_MinusMinus);
}
return false;

Просмотреть файл

@ -700,7 +700,7 @@ bool Sema::CheckSizeOfAlignOfOperand(QualType exprType,
else if (exprType->isIncompleteType())
return Diag(OpLoc, isSizeof ? diag::err_sizeof_incomplete_type :
diag::err_alignof_incomplete_type)
<< exprType.getAsString() << ExprRange;
<< exprType << ExprRange;
return false;
}
@ -747,7 +747,7 @@ QualType Sema::CheckRealImagOperand(Expr *&V, SourceLocation Loc) {
return V->getType();
// Reject anything else.
Diag(Loc, diag::err_realimag_invalid_type) << V->getType().getAsString();
Diag(Loc, diag::err_realimag_invalid_type) << V->getType();
return QualType();
}
@ -999,7 +999,7 @@ ActOnArraySubscriptExpr(Scope *S, ExprTy *Base, SourceLocation LLoc,
if (!ResultType->isObjectType())
return Diag(BaseExpr->getLocStart(),
diag::err_typecheck_subscript_not_object)
<< BaseExpr->getType().getAsString() << BaseExpr->getSourceRange();
<< BaseExpr->getType() << BaseExpr->getSourceRange();
return new ArraySubscriptExpr(LHSExp, RHSExp, ResultType, RLoc);
}
@ -1017,7 +1017,7 @@ CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
const char *compStr = CompName.getName();
if (strlen(compStr) > vecType->getNumElements()) {
Diag(OpLoc, diag::err_ext_vector_component_exceeds_length)
<< baseType.getAsString() << SourceRange(CompLoc);
<< baseType << SourceRange(CompLoc);
return QualType();
}
@ -1059,7 +1059,7 @@ CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
// We didn't get to the end of the string. This means a component accessor
// exceeds the number of elements in the vector.
Diag(OpLoc, diag::err_ext_vector_component_exceeds_length)
<< baseType.getAsString() << SourceRange(CompLoc);
<< baseType << SourceRange(CompLoc);
return QualType();
}
@ -1068,7 +1068,7 @@ CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
// the elements.
if (SpecialComponent && (vecType->getNumElements() & 1U)) {
Diag(OpLoc, diag::err_ext_vector_component_requires_even)
<< baseType.getAsString() << SourceRange(CompLoc);
<< baseType << SourceRange(CompLoc);
return QualType();
}
@ -1127,7 +1127,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
return BuildOverloadedArrowExpr(BaseExpr, OpLoc, MemberLoc, Member);
else
return Diag(MemberLoc, diag::err_typecheck_member_reference_arrow)
<< BaseType.getAsString() << BaseExpr->getSourceRange();
<< BaseType << BaseExpr->getSourceRange();
}
// Handle field access to simple records. This also handles access to fields
@ -1263,7 +1263,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
}
return Diag(MemberLoc, diag::err_typecheck_member_reference_struct_union)
<< BaseType.getAsString() << BaseExpr->getSourceRange();
<< BaseType << BaseExpr->getSourceRange();
}
/// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
@ -1347,7 +1347,7 @@ ActOnCallExpr(ExprTy *fn, SourceLocation LParenLoc,
const PointerType *PT = Fn->getType()->getAsPointerType();
if (PT == 0)
return Diag(LParenLoc, diag::err_typecheck_call_not_function)
<< Fn->getType().getAsString() << Fn->getSourceRange();
<< Fn->getType() << Fn->getSourceRange();
FuncT = PT->getPointeeType()->getAsFunctionType();
} else { // This is a block call.
FuncT = Fn->getType()->getAsBlockPointerType()->getPointeeType()->
@ -1355,7 +1355,7 @@ ActOnCallExpr(ExprTy *fn, SourceLocation LParenLoc,
}
if (FuncT == 0)
return Diag(LParenLoc, diag::err_typecheck_call_not_function)
<< Fn->getType().getAsString() << Fn->getSourceRange();
<< Fn->getType() << Fn->getSourceRange();
// We know the result type of the call, set it.
TheCall->setType(FuncT->getResultType().getNonReferenceType());
@ -1499,17 +1499,17 @@ bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr) {
(!castType->isStructureType() && !castType->isUnionType())) {
// Reject any other conversions to non-scalar types.
return Diag(TyR.getBegin(), diag::err_typecheck_cond_expect_scalar)
<< castType.getAsString() << castExpr->getSourceRange();
<< castType << castExpr->getSourceRange();
}
// accept this, but emit an ext-warn.
Diag(TyR.getBegin(), diag::ext_typecheck_cast_nonscalar)
<< castType.getAsString() << castExpr->getSourceRange();
<< castType << castExpr->getSourceRange();
} else if (!castExpr->getType()->isScalarType() &&
!castExpr->getType()->isVectorType()) {
return Diag(castExpr->getLocStart(),
diag::err_typecheck_expect_scalar_operand)
<< castExpr->getType().getAsString() << castExpr->getSourceRange();
<< castExpr->getType() << castExpr->getSourceRange();
} else if (castExpr->getType()->isVectorType()) {
if (CheckVectorCast(TyR, castExpr->getType(), castType))
return true;
@ -1529,11 +1529,11 @@ bool Sema::CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty) {
Ty->isVectorType() ?
diag::err_invalid_conversion_between_vectors :
diag::err_invalid_conversion_between_vector_and_integer)
<< VectorTy.getAsString() << Ty.getAsString() << R;
<< VectorTy << Ty << R;
} else
return Diag(R.getBegin(),
diag::err_invalid_conversion_between_vector_and_scalar)
<< VectorTy.getAsString() << Ty.getAsString() << R;
<< VectorTy << Ty << R;
return false;
}
@ -1564,8 +1564,7 @@ inline QualType Sema::CheckConditionalOperands( // C99 6.5.15
// first, check the condition.
if (!condT->isScalarType()) { // C99 6.5.15p2
Diag(cond->getLocStart(), diag::err_typecheck_cond_expect_scalar)
<< condT.getAsString();
Diag(cond->getLocStart(), diag::err_typecheck_cond_expect_scalar) << condT;
return QualType();
}
@ -1684,8 +1683,7 @@ inline QualType Sema::CheckConditionalOperands( // C99 6.5.15
} else if (!Context.typesAreCompatible(lhptee.getUnqualifiedType(),
rhptee.getUnqualifiedType())) {
Diag(questionLoc, diag::warn_typecheck_cond_incompatible_pointers)
<< lexT.getAsString() << rexT.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lexT << rexT << lex->getSourceRange() << rex->getSourceRange();
// In this situation, we assume void* type. No especially good
// reason, but this is what gcc does, and we do have to pick
// to get a consistent AST.
@ -1738,8 +1736,7 @@ inline QualType Sema::CheckConditionalOperands( // C99 6.5.15
// Otherwise, the operands are not compatible.
Diag(questionLoc, diag::err_typecheck_cond_incompatible_operands)
<< lexT.getAsString() << rexT.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lexT << rexT << lex->getSourceRange() << rex->getSourceRange();
return QualType();
}
@ -2110,7 +2107,7 @@ inline QualType Sema::CheckVectorOperands(SourceLocation Loc, Expr *&lex,
// You cannot convert between vector values of different size.
Diag(Loc, diag::err_typecheck_vector_not_convertable)
<< lex->getType().getAsString() << rex->getType().getAsString()
<< lex->getType() << rex->getType()
<< lex->getSourceRange() << rex->getSourceRange();
return QualType();
}
@ -2168,7 +2165,7 @@ inline QualType Sema::CheckAdditionOperands( // C99 6.5.6
<< lex->getSourceRange() << rex->getSourceRange();
} else {
Diag(Loc, diag::err_typecheck_arithmetic_incomplete_type)
<< lex->getType().getAsString() << lex->getSourceRange();
<< lex->getType() << lex->getSourceRange();
return QualType();
}
}
@ -2205,7 +2202,7 @@ QualType Sema::CheckSubtractionOperands(Expr *&lex, Expr *&rex,
<< lex->getSourceRange() << rex->getSourceRange();
} else {
Diag(Loc, diag::err_typecheck_sub_ptr_object)
<< lex->getType().getAsString() << lex->getSourceRange();
<< lex->getType() << lex->getSourceRange();
return QualType();
}
}
@ -2227,7 +2224,7 @@ QualType Sema::CheckSubtractionOperands(Expr *&lex, Expr *&rex,
<< lex->getSourceRange() << rex->getSourceRange();
} else {
Diag(Loc, diag::err_typecheck_sub_ptr_object)
<< rex->getType().getAsString() << rex->getSourceRange();
<< rex->getType() << rex->getSourceRange();
return QualType();
}
}
@ -2237,7 +2234,7 @@ QualType Sema::CheckSubtractionOperands(Expr *&lex, Expr *&rex,
Context.getCanonicalType(lpointee).getUnqualifiedType(),
Context.getCanonicalType(rpointee).getUnqualifiedType())) {
Diag(Loc, diag::err_typecheck_sub_ptr_compatible)
<< lex->getType().getAsString() << rex->getType().getAsString()
<< lex->getType() << rex->getType()
<< lex->getSourceRange() << rex->getSourceRange();
return QualType();
}
@ -2342,8 +2339,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
RCanPointeeTy.getUnqualifiedType()) &&
!areComparableObjCInterfaces(LCanPointeeTy, RCanPointeeTy, Context)) {
Diag(Loc, diag::ext_typecheck_comparison_of_distinct_pointers)
<< lType.getAsString() << rType.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
}
ImpCastExprToType(rex, lType); // promote the pointer to pointer
return ResultTy;
@ -2356,8 +2352,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
if (!LHSIsNull && !RHSIsNull &&
!Context.typesAreBlockCompatible(lpointee, rpointee)) {
Diag(Loc, diag::err_typecheck_comparison_of_distinct_blocks)
<< lType.getAsString() << rType.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
}
ImpCastExprToType(rex, lType); // promote the pointer to pointer
return ResultTy;
@ -2367,8 +2362,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
(lType->isPointerType() && rType->isBlockPointerType())) {
if (!LHSIsNull && !RHSIsNull) {
Diag(Loc, diag::err_typecheck_comparison_of_distinct_blocks)
<< lType.getAsString() << rType.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
}
ImpCastExprToType(rex, lType); // promote the pointer to pointer
return ResultTy;
@ -2386,8 +2380,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
if (!LPtrToVoid && !RPtrToVoid &&
!Context.typesAreCompatible(lType, rType)) {
Diag(Loc, diag::ext_typecheck_comparison_of_distinct_pointers)
<< lType.getAsString() << rType.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
ImpCastExprToType(rex, lType);
return ResultTy;
}
@ -2410,8 +2403,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
rType->isIntegerType()) {
if (!RHSIsNull)
Diag(Loc, diag::ext_typecheck_comparison_of_pointer_integer)
<< lType.getAsString() << rType.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
ImpCastExprToType(rex, lType); // promote the integer to pointer
return ResultTy;
}
@ -2419,8 +2411,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
(rType->isPointerType() || rType->isObjCQualifiedIdType())) {
if (!LHSIsNull)
Diag(Loc, diag::ext_typecheck_comparison_of_pointer_integer)
<< lType.getAsString() << rType.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
ImpCastExprToType(lex, rType); // promote the integer to pointer
return ResultTy;
}
@ -2428,16 +2419,14 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
if (lType->isBlockPointerType() && rType->isIntegerType()) {
if (!RHSIsNull)
Diag(Loc, diag::ext_typecheck_comparison_of_pointer_integer)
<< lType.getAsString() << rType.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
ImpCastExprToType(rex, lType); // promote the integer to pointer
return ResultTy;
}
if (lType->isIntegerType() && rType->isBlockPointerType()) {
if (!LHSIsNull)
Diag(Loc, diag::ext_typecheck_comparison_of_pointer_integer)
<< lType.getAsString() << rType.getAsString()
<< lex->getSourceRange() << rex->getSourceRange();
<< lType << rType << lex->getSourceRange() << rex->getSourceRange();
ImpCastExprToType(lex, rType); // promote the integer to pointer
return ResultTy;
}
@ -2563,7 +2552,7 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
}
if (NeedType)
S.Diag(Loc, Diag) << E->getType().getAsString() << E->getSourceRange();
S.Diag(Loc, Diag) << E->getType() << E->getSourceRange();
else
S.Diag(Loc, Diag) << E->getSourceRange();
return true;
@ -2649,16 +2638,16 @@ QualType Sema::CheckIncrementDecrementOperand(Expr *Op, SourceLocation OpLoc) {
Diag(OpLoc, diag::ext_gnu_void_ptr) << Op->getSourceRange();
} else {
Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type)
<< ResType.getAsString() << Op->getSourceRange();
<< ResType << Op->getSourceRange();
return QualType();
}
} else if (ResType->isComplexType()) {
// C99 does not support ++/-- on complex types, we allow as an extension.
Diag(OpLoc, diag::ext_integer_increment_complex)
<< ResType.getAsString() << Op->getSourceRange();
<< ResType << Op->getSourceRange();
} else {
Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement)
<< ResType.getAsString() << Op->getSourceRange();
<< ResType << Op->getSourceRange();
return QualType();
}
// At this point, we know we have a real, complex or pointer type.
@ -3196,7 +3185,6 @@ Action::ExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
// build a built-in operation.
}
QualType resultType;
switch (Opc) {
default:
@ -3227,7 +3215,7 @@ Action::ExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
break;
return Diag(OpLoc, diag::err_typecheck_unary_expr)
<< resultType.getAsString();
<< resultType << Input->getSourceRange();
case UnaryOperator::Not: // bitwise complement
UsualUnaryConversions(Input);
resultType = Input->getType();
@ -3235,10 +3223,10 @@ Action::ExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
if (resultType->isComplexType() || resultType->isComplexIntegerType())
// C99 does not support '~' for complex conjugation.
Diag(OpLoc, diag::ext_integer_complement_complex)
<< resultType.getAsString() << Input->getSourceRange();
<< resultType << Input->getSourceRange();
else if (!resultType->isIntegerType())
return Diag(OpLoc, diag::err_typecheck_unary_expr)
<< resultType.getAsString() << Input->getSourceRange();
<< resultType << Input->getSourceRange();
break;
case UnaryOperator::LNot: // logical negation
// Unlike +/-/~, integer promotions aren't done here (C99 6.5.3.3p5).
@ -3246,7 +3234,7 @@ Action::ExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
resultType = Input->getType();
if (!resultType->isScalarType()) // C99 6.5.3.3p1
return Diag(OpLoc, diag::err_typecheck_unary_expr)
<< resultType.getAsString();
<< resultType << Input->getSourceRange();
// LNot always has type int. C99 6.5.3.3p5.
resultType = Context.IntTy;
break;
@ -3323,7 +3311,7 @@ Sema::ExprResult Sema::ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc,
// one is known to be a field designator. Verify that the ArgTy represents
// a struct/union/class.
if (!ArgTy->isRecordType())
return Diag(TypeLoc, diag::err_offsetof_record_type) << ArgTy.getAsString();
return Diag(TypeLoc, diag::err_offsetof_record_type) << ArgTy;
// Otherwise, create a compound literal expression as the base, and
// iteratively process the offsetof designators.
@ -3342,8 +3330,7 @@ Sema::ExprResult Sema::ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc,
const ArrayType *AT = Context.getAsArrayType(Res->getType());
if (!AT) {
delete Res;
return Diag(OC.LocEnd, diag::err_offsetof_array_type)
<< Res->getType().getAsString();
return Diag(OC.LocEnd, diag::err_offsetof_array_type) << Res->getType();
}
// FIXME: C++: Verify that operator[] isn't overloaded.
@ -3361,8 +3348,7 @@ Sema::ExprResult Sema::ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc,
const RecordType *RC = Res->getType()->getAsRecordType();
if (!RC) {
delete Res;
return Diag(OC.LocEnd, diag::err_offsetof_record_type)
<< Res->getType().getAsString();
return Diag(OC.LocEnd, diag::err_offsetof_record_type) << Res->getType();
}
// Get the decl corresponding to this.
@ -3632,7 +3618,7 @@ Sema::ExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc,
if (CheckAssignmentConstraints(VaListType, E->getType()) != Compatible)
return Diag(E->getLocStart(),
diag::err_first_argument_to_va_arg_not_of_type_va_list)
<< E->getType().getAsString() << E->getSourceRange();
<< E->getType() << E->getSourceRange();
// FIXME: Warn if a non-POD type is passed in.

Просмотреть файл

@ -126,7 +126,7 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, TypeTy *TypeRep,
//
if (!RT->getDecl()->isDefinition())
return Diag(TyBeginLoc, diag::err_invalid_incomplete_type_use)
<< Ty.getAsString() << FullRange;
<< Ty << FullRange;
unsigned DiagID = PP.getDiagnostics().getCustomDiagID(Diagnostic::Error,
"class constructors are not supported yet");
@ -164,7 +164,7 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, TypeTy *TypeRep,
return Diag(TyBeginLoc, diag::err_value_init_for_array_type) << FullRange;
if (Ty->isIncompleteType() && !Ty->isVoidType())
return Diag(TyBeginLoc, diag::err_invalid_incomplete_type_use)
<< Ty.getAsString() << FullRange;
<< Ty << FullRange;
return new CXXZeroInitValueExpr(Ty, TyBeginLoc, RParenLoc);
}
@ -302,7 +302,7 @@ bool Sema::CheckAllocatedType(QualType AllocType, SourceLocation StartLoc,
assert(false && "Unexpected type class");
return true;
}
Diag(StartLoc, msg) << AllocType.getAsString() << TyR;
Diag(StartLoc, msg) << AllocType << TyR;
return true;
}
@ -340,18 +340,17 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
}
if (!Type->isPointerType()) {
Diag(StartLoc, diag::err_delete_operand)
<< Type.getAsString() << Ex->getSourceRange();
Diag(StartLoc, diag::err_delete_operand) << Type << Ex->getSourceRange();
return true;
}
QualType Pointee = Type->getAsPointerType()->getPointeeType();
if (Pointee->isIncompleteType() && !Pointee->isVoidType())
Diag(StartLoc, diag::warn_delete_incomplete)
<< Pointee.getAsString() << Ex->getSourceRange();
<< Pointee << Ex->getSourceRange();
else if (!Pointee->isObjectType()) {
Diag(StartLoc, diag::err_delete_operand)
<< Type.getAsString() << Ex->getSourceRange();
<< Type << Ex->getSourceRange();
return true;
}
@ -428,7 +427,7 @@ bool Sema::CheckCXXBooleanCondition(Expr *&CondExpr) {
ConvTy = CheckSingleAssignmentConstraints(Context.BoolTy, CondExpr);
if (ConvTy == Incompatible)
return Diag(CondExpr->getLocStart(), diag::err_typecheck_bool_condition)
<< Ty.getAsString() << CondExpr->getSourceRange();
<< Ty << CondExpr->getSourceRange();
return false;
}

Просмотреть файл

@ -388,7 +388,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
<< Sel << SourceRange(lbrac, rbrac);
} else {
Diag(lbrac, diag::error_bad_receiver_type)
<< RExpr->getType().getAsString() << RExpr->getSourceRange();
<< RExpr->getType() << RExpr->getSourceRange();
return true;
}

Просмотреть файл

@ -205,7 +205,7 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
}
Diag(Loc, diag::err_ambiguous_derived_to_base_conv)
<< Derived.getAsString() << Base.getAsString() << PathDisplayStr << Range;
<< Derived << Base << PathDisplayStr << Range;
return true;
}

Просмотреть файл

@ -144,7 +144,7 @@ void InitListChecker::CheckListElementTypes(InitListExpr *IList,
// This type is invalid, issue a diagnostic.
Index++;
SemaRef->Diag(IList->getLocStart(), diag::err_illegal_initializer_type)
<< DeclType.getAsString();
<< DeclType;
hadError = true;
} else {
// In C, all types are either scalars or aggregates, but

Просмотреть файл

@ -109,8 +109,7 @@ CheckConstCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
if (SrcExpr->isLvalue(Self.Context) != Expr::LV_Valid) {
// Cannot cast non-lvalue to reference type.
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue)
<< "const_cast" << OrigDestType.getAsString()
<< SrcExpr->getSourceRange();
<< "const_cast" << OrigDestType << SrcExpr->getSourceRange();
return;
}
@ -131,7 +130,7 @@ CheckConstCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// was a reference type, we converted it to a pointer above.
// C++ 5.2.11p3: For two pointer types [...]
Self.Diag(OpRange.getBegin(), diag::err_bad_const_cast_dest)
<< OrigDestType.getAsString() << DestRange;
<< OrigDestType << DestRange;
return;
}
if (DestType->isFunctionPointerType()) {
@ -139,7 +138,7 @@ CheckConstCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// C++ 5.2.11p2: [...] where T is any object type or the void type [...]
// T is the ultimate pointee of source and target type.
Self.Diag(OpRange.getBegin(), diag::err_bad_const_cast_dest)
<< OrigDestType.getAsString() << DestRange;
<< OrigDestType << DestRange;
return;
}
SrcType = Self.Context.getCanonicalType(SrcType);
@ -171,8 +170,7 @@ CheckConstCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
if (SrcTypeArr->getSize() != DestTypeArr->getSize()) {
// Different array sizes.
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_generic)
<< "const_cast" << OrigDestType.getAsString()
<< OrigSrcType.getAsString() << OpRange;
<< "const_cast" << OrigDestType << OrigSrcType << OpRange;
return;
}
SrcType = SrcTypeArr->getElementType().getUnqualifiedType();
@ -184,8 +182,7 @@ CheckConstCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
if (SrcType != DestType) {
// Cast between unrelated types.
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_generic)
<< "const_cast" << OrigDestType.getAsString()
<< OrigSrcType.getAsString() << OpRange;
<< "const_cast" << OrigDestType << OrigSrcType << OpRange;
return;
}
}
@ -207,8 +204,7 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
if (SrcExpr->isLvalue(Self.Context) != Expr::LV_Valid) {
// Cannot cast non-lvalue to reference type.
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue)
<< "reinterpret_cast" << OrigDestType.getAsString()
<< SrcExpr->getSourceRange();
<< "reinterpret_cast" << OrigDestType << SrcExpr->getSourceRange();
return;
}
@ -236,8 +232,7 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// lvalue->reference, which is handled above, at least one of the two
// arguments must be a pointer.
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_generic)
<< "reinterpret_cast" << OrigDestType.getAsString()
<< OrigSrcType.getAsString() << OpRange;
<< "reinterpret_cast" << OrigDestType << OrigSrcType << OpRange;
return;
}
@ -260,7 +255,7 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
if (Self.Context.getTypeSize(SrcType) >
Self.Context.getTypeSize(DestType)) {
Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_small_int)
<< OrigDestType.getAsString() << DestRange;
<< OrigDestType << DestRange;
}
return;
}
@ -276,16 +271,14 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// With the valid non-pointer conversions out of the way, we can be even
// more stringent.
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_generic)
<< "reinterpret_cast" << OrigDestType.getAsString()
<< OrigSrcType.getAsString() << OpRange;
<< "reinterpret_cast" << OrigDestType << OrigSrcType << OpRange;
return;
}
// C++ 5.2.10p2: The reinterpret_cast operator shall not cast away constness.
if (CastsAwayConstness(Self, SrcType, DestType)) {
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_const_away)
<< "reinterpret_cast" << OrigDestType.getAsString()
<< OrigSrcType.getAsString() << OpRange;
<< "reinterpret_cast" << OrigDestType << OrigSrcType << OpRange;
return;
}
@ -467,8 +460,7 @@ CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// to a const violation.
if (!DestPointee.isAtLeastAsQualifiedAs(SrcPointee)) {
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_const_away)
<< "static_cast" << DestType.getAsString()
<< OrigSrcType.getAsString() << OpRange;
<< "static_cast" << DestType << OrigSrcType << OpRange;
}
return;
}
@ -481,7 +473,7 @@ CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// why every substep failed and, at the end, select the most specific and
// report that.
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_generic)
<< "static_cast" << DestType.getAsString() << OrigSrcType.getAsString()
<< "static_cast" << DestType << OrigSrcType
<< OpRange;
}
@ -581,8 +573,7 @@ TryStaticDowncast(Sema &Self, QualType SrcType, QualType DestType,
// Must preserve cv, as always.
if (!DestType.isAtLeastAsQualifiedAs(SrcType)) {
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_const_away)
<< "static_cast" << OrigDestType.getAsString()
<< OrigSrcType.getAsString() << OpRange;
<< "static_cast" << OrigDestType << OrigSrcType << OpRange;
return TSC_Failed;
}
@ -610,8 +601,7 @@ TryStaticDowncast(Sema &Self, QualType SrcType, QualType DestType,
}
Self.Diag(OpRange.getBegin(), diag::err_ambiguous_base_to_derived_cast)
<< SrcType.getUnqualifiedType().getAsString()
<< DestType.getUnqualifiedType().getAsString()
<< SrcType.getUnqualifiedType() << DestType.getUnqualifiedType()
<< PathDisplayStr << OpRange;
return TSC_Failed;
}
@ -619,8 +609,7 @@ TryStaticDowncast(Sema &Self, QualType SrcType, QualType DestType,
if (Paths.getDetectedVirtual() != 0) {
QualType VirtualBase(Paths.getDetectedVirtual(), 0);
Self.Diag(OpRange.getBegin(), diag::err_static_downcast_via_virtual)
<< OrigSrcType.getAsString() << OrigDestType.getAsString()
<< VirtualBase.getAsString() << OpRange;
<< OrigSrcType << OrigDestType << VirtualBase << OpRange;
return TSC_Failed;
}
@ -680,7 +669,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
DestPointee = DestReference->getPointeeType();
} else {
Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ref_or_ptr)
<< OrigDestType.getAsString() << DestRange;
<< OrigDestType << DestRange;
return;
}
@ -690,12 +679,12 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
} else if (DestRecord) {
if (!DestRecord->getDecl()->isDefinition()) {
Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_incomplete)
<< DestPointee.getUnqualifiedType().getAsString() << DestRange;
<< DestPointee.getUnqualifiedType() << DestRange;
return;
}
} else {
Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class)
<< DestPointee.getUnqualifiedType().getAsString() << DestRange;
<< DestPointee.getUnqualifiedType() << DestRange;
return;
}
@ -710,13 +699,13 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
SrcPointee = SrcPointer->getPointeeType();
} else {
Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ptr)
<< OrigSrcType.getAsString() << SrcExpr->getSourceRange();
<< OrigSrcType << SrcExpr->getSourceRange();
return;
}
} else {
if (SrcExpr->isLvalue(Self.Context) != Expr::LV_Valid) {
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue)
<< "dynamic_cast" << OrigDestType.getAsString() << OpRange;
<< "dynamic_cast" << OrigDestType << OpRange;
}
SrcPointee = SrcType;
}
@ -725,14 +714,12 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
if (SrcRecord) {
if (!SrcRecord->getDecl()->isDefinition()) {
Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_incomplete)
<< SrcPointee.getUnqualifiedType().getAsString()
<< SrcExpr->getSourceRange();
<< SrcPointee.getUnqualifiedType() << SrcExpr->getSourceRange();
return;
}
} else {
Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class)
<< SrcPointee.getUnqualifiedType().getAsString()
<< SrcExpr->getSourceRange();
<< SrcPointee.getUnqualifiedType() << SrcExpr->getSourceRange();
return;
}
@ -745,8 +732,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// C++ 5.2.7p1: The dynamic_cast operator shall not cast away constness.
if (!DestPointee.isAtLeastAsQualifiedAs(SrcPointee)) {
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_const_away)
<< "dynamic_cast" << OrigDestType.getAsString()
<< OrigSrcType.getAsString() << OpRange;
<< "dynamic_cast" << OrigDestType << OrigSrcType << OpRange;
return;
}
@ -760,7 +746,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// Upcasts are resolved statically.
if (DestRecord && Self.IsDerivedFrom(SrcPointee, DestPointee)) {
Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee,
OpRange.getBegin(), OpRange);
OpRange.getBegin(), OpRange);
// Diagnostic already emitted on error.
return;
}
@ -770,8 +756,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
assert(SrcDecl && "Definition missing");
if (!cast<CXXRecordDecl>(SrcDecl)->isPolymorphic()) {
Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic)
<< SrcPointee.getUnqualifiedType().getAsString()
<< SrcExpr->getSourceRange();
<< SrcPointee.getUnqualifiedType() << SrcExpr->getSourceRange();
}
// Done. Everything else is run-time checks.

Просмотреть файл

@ -1481,8 +1481,7 @@ Sema::PerformObjectArgumentInitialization(Expr *&From, CXXMethodDecl *Method) {
if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion)
return Diag(From->getSourceRange().getBegin(),
diag::err_implicit_object_parameter_init)
<< ImplicitParamType.getAsString() << From->getType().getAsString()
<< From->getSourceRange();
<< ImplicitParamType << From->getType() << From->getSourceRange();
if (ICS.Standard.Second == ICK_Derived_To_Base &&
CheckDerivedToBaseConversion(From->getType(), ImplicitParamType,
@ -2874,7 +2873,7 @@ Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
if (isReference) FnType = Context.getReferenceType(FnType);
Diag(Cand->Surrogate->getLocation(), diag::err_ovl_surrogate_cand)
<< FnType.getAsString();
<< FnType;
} else {
// FIXME: We need to get the identifier in here
// FIXME: Do we want the error message to point at the
@ -2885,8 +2884,7 @@ Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
Cand->Conversions.size(),
false, 0);
Diag(SourceLocation(), diag::err_ovl_builtin_candidate)
<< FnType.getAsString();
Diag(SourceLocation(), diag::err_ovl_builtin_candidate) << FnType;
}
}
}
@ -3052,7 +3050,7 @@ Sema::BuildCallToObjectOfClassType(Expr *Object, SourceLocation LParenLoc,
case OR_No_Viable_Function:
Diag(Object->getSourceRange().getBegin(),
diag::err_ovl_no_viable_object_call)
<< Object->getType().getAsString() << (unsigned)CandidateSet.size()
<< Object->getType() << (unsigned)CandidateSet.size()
<< Object->getSourceRange();
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
break;
@ -3060,7 +3058,7 @@ Sema::BuildCallToObjectOfClassType(Expr *Object, SourceLocation LParenLoc,
case OR_Ambiguous:
Diag(Object->getSourceRange().getBegin(),
diag::err_ovl_ambiguous_object_call)
<< Object->getType().getAsString() << Object->getSourceRange();
<< Object->getType() << Object->getSourceRange();
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
break;
}
@ -3212,7 +3210,7 @@ Sema::BuildOverloadedArrowExpr(Expr *Base, SourceLocation OpLoc,
case OR_No_Viable_Function:
if (CandidateSet.empty())
Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
<< BasePtr->getType().getAsString() << BasePtr->getSourceRange();
<< BasePtr->getType() << BasePtr->getSourceRange();
else
Diag(OpLoc, diag::err_ovl_no_viable_oper)
<< "operator->" << (unsigned)CandidateSet.size()
@ -3222,8 +3220,7 @@ Sema::BuildOverloadedArrowExpr(Expr *Base, SourceLocation OpLoc,
case OR_Ambiguous:
Diag(OpLoc, diag::err_ovl_ambiguous_oper)
<< "operator->"
<< BasePtr->getSourceRange();
<< "operator->" << BasePtr->getSourceRange();
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
return true;
}

Просмотреть файл

@ -223,7 +223,7 @@ Sema::ActOnIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
return true;
} else if (!condType->isScalarType()) // C99 6.8.4.1p1
return Diag(IfLoc, diag::err_typecheck_statement_requires_scalar)
<< condType.getAsString() << condExpr->getSourceRange();
<< condType << condExpr->getSourceRange();
// Warn if the if block has a null body without an else value.
// this helps prevent bugs due to typos, such as
@ -362,7 +362,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch,
if (!CondType->isIntegerType()) { // C99 6.8.4.2p1
Diag(SwitchLoc, diag::err_typecheck_statement_requires_integer)
<< CondType.getAsString() << CondExpr->getSourceRange();
<< CondType << CondExpr->getSourceRange();
return true;
}
@ -549,7 +549,7 @@ Sema::ActOnWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body) {
return true;
} else if (!condType->isScalarType()) // C99 6.8.5p2
return Diag(WhileLoc, diag::err_typecheck_statement_requires_scalar)
<< condType.getAsString() << condExpr->getSourceRange();
<< condType << condExpr->getSourceRange();
return new WhileStmt(condExpr, (Stmt*)Body, WhileLoc);
}
@ -568,7 +568,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, StmtTy *Body,
return true;
} else if (!condType->isScalarType()) // C99 6.8.5p2
return Diag(DoLoc, diag::err_typecheck_statement_requires_scalar)
<< condType.getAsString() << condExpr->getSourceRange();
<< condType << condExpr->getSourceRange();
return new DoStmt((Stmt*)Body, condExpr, DoLoc);
}
@ -607,7 +607,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
return true;
} else if (!SecondType->isScalarType()) // C99 6.8.5p2
return Diag(ForLoc, diag::err_typecheck_statement_requires_scalar)
<< SecondType.getAsString() << Second->getSourceRange();
<< SecondType << Second->getSourceRange();
}
return new ForStmt(First, Second, Third, Body, ForLoc);
}
@ -646,14 +646,14 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
}
if (!Context.isObjCObjectPointerType(FirstType))
Diag(ForLoc, diag::err_selector_element_type)
<< FirstType.getAsString() << First->getSourceRange();
<< FirstType << First->getSourceRange();
}
if (Second) {
DefaultFunctionArrayConversion(Second);
QualType SecondType = Second->getType();
if (!Context.isObjCObjectPointerType(SecondType))
Diag(ForLoc, diag::err_collection_expr_type)
<< SecondType.getAsString() << Second->getSourceRange();
<< SecondType << Second->getSourceRange();
}
return new ObjCForCollectionStmt(First, Second, Body, ForLoc, RParenLoc);
}
@ -888,7 +888,7 @@ Sema::StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
// FIXME: We currently leak memory here.
return Diag(InputExpr->getSubExpr()->getLocStart(),
diag::err_asm_invalid_type_in_input)
<< InputExpr->getType().getAsString() << InputConstraint
<< InputExpr->getType() << InputConstraint
<< InputExpr->getSubExpr()->getSourceRange();
}
}

Просмотреть файл

@ -204,13 +204,13 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) {
if (!EltTy->isIncompleteOrObjectType()) {
Diag(DS.getRestrictSpecLoc(),
diag::err_typecheck_invalid_restrict_invalid_pointee)
<< EltTy.getAsString() << DS.getSourceRange();
<< EltTy << DS.getSourceRange();
TypeQuals &= ~QualType::Restrict; // Remove the restrict qualifier.
}
} else {
Diag(DS.getRestrictSpecLoc(),
diag::err_typecheck_invalid_restrict_not_pointer)
<< Result.getAsString() << DS.getSourceRange();
<< Result << DS.getSourceRange();
TypeQuals &= ~QualType::Restrict; // Remove the restrict qualifier.
}
}
@ -229,7 +229,7 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) {
Loc = DS.getVolatileSpecLoc();
}
Diag(Loc, diag::warn_typecheck_function_qualifiers)
<< Result.getAsString() << DS.getSourceRange();
<< Result << DS.getSourceRange();
}
// C++ [dcl.ref]p1:
@ -286,7 +286,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, bool CXXNewMode) {
if ((DeclType.Ptr.TypeQuals & QualType::Restrict) &&
!T->isIncompleteOrObjectType()) {
Diag(DeclType.Loc, diag::err_typecheck_invalid_restrict_invalid_pointee)
<< T.getAsString();
<< T;
DeclType.Ptr.TypeQuals &= QualType::Restrict;
}
@ -327,7 +327,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, bool CXXNewMode) {
if (DeclType.Ref.HasRestrict &&
!T->isIncompleteOrObjectType()) {
Diag(DeclType.Loc, diag::err_typecheck_invalid_restrict_invalid_pointee)
<< T.getAsString();
<< T;
DeclType.Ref.HasRestrict = false;
}
@ -356,7 +356,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, bool CXXNewMode) {
// reject it (e.g. void ary[7], struct foo ary[7], void ary[7]())
if (T->isIncompleteType()) {
Diag(D.getIdentifierLoc(), diag::err_illegal_decl_array_incomplete_type)
<< T.getAsString();
<< T;
T = Context.IntTy;
D.setInvalidType(true);
} else if (T->isFunctionType()) {
@ -374,20 +374,18 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, bool CXXNewMode) {
// If the element type is a struct or union that contains a variadic
// array, reject it: C99 6.7.2.1p2.
if (EltTy->getDecl()->hasFlexibleArrayMember()) {
Diag(DeclType.Loc, diag::err_flexible_array_in_array)
<< T.getAsString();
Diag(DeclType.Loc, diag::err_flexible_array_in_array) << T;
T = Context.IntTy;
D.setInvalidType(true);
}
} else if (T->isObjCInterfaceType()) {
Diag(DeclType.Loc, diag::warn_objc_array_of_interfaces)
<< T.getAsString();
Diag(DeclType.Loc, diag::warn_objc_array_of_interfaces) << T;
}
// C99 6.7.5.2p1: The size expression shall have integer type.
if (ArraySize && !ArraySize->getType()->isIntegerType()) {
Diag(ArraySize->getLocStart(), diag::err_array_size_non_int)
<< ArraySize->getType().getAsString() << ArraySize->getSourceRange();
<< ArraySize->getType() << ArraySize->getSourceRange();
D.setInvalidType(true);
delete ArraySize;
ATI.NumElts = ArraySize = 0;
@ -436,8 +434,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, bool CXXNewMode) {
// C99 6.7.5.3p1: The return type may not be a function or array type.
if (T->isArrayType() || T->isFunctionType()) {
Diag(DeclType.Loc, diag::err_func_returning_array_function)
<< T.getAsString();
Diag(DeclType.Loc, diag::err_func_returning_array_function) << T;
T = Context.IntTy;
D.setInvalidType(true);
}

Просмотреть файл

@ -30,7 +30,7 @@ typedef struct objc_object {
for (id el in self)
++i;
MyList<P> ***p;
for (p in self) // expected-error {{selector element type ('MyList<P> ***') is not a valid object type}}
for (p in self) // expected-error {{selector element type 'MyList<P> ***' is not a valid object type}}
++i;
}

Просмотреть файл

@ -24,13 +24,13 @@ typedef struct objc_object {
- (void)compilerTestAgainst {
int i=0;
for (int * elem in elem) // expected-error {{selector element type ('int *') is not a valid object}} \
expected-error {{collection expression type ('int *') is not a valid object}}
for (int * elem in elem) // expected-error {{selector element type 'int *' is not a valid object}} \
expected-error {{collection expression type 'int *' is not a valid object}}
++i;
for (i in elem) // expected-error {{use of undeclared identifier 'elem'}} \
expected-error {{selector element type ('int') is not a valid object}}
expected-error {{selector element type 'int' is not a valid object}}
++i;
for (id se in i) // expected-error {{collection expression type ('int') is not a valid object}}
for (id se in i) // expected-error {{collection expression type 'int' is not a valid object}}
++i;
}
@end

Просмотреть файл

@ -29,5 +29,5 @@ struct Incomplete* I1 = &(struct Incomplete){1, 2, 3}; // -expected-error {{vari
void IncompleteFunc(unsigned x) {
struct Incomplete* I2 = (struct foo[x]){1, 2, 3}; // -expected-error {{variable-sized object may not be initialized}}
(void){1,2,3}; // -expected-error {{variable has incomplete type}}
(void(void)) { 0 }; // -expected-error{{illegal initializer type ('void (void)')}}
(void(void)) { 0 }; // -expected-error{{illegal initializer type 'void (void)'}}
}

Просмотреть файл

@ -18,6 +18,6 @@ typedef int f(void);
typedef f* fptr;
const f* v1; // expected-warning {{qualifier on function type 'f' has unspecified behavior}}
__restrict__ f* v2; // expected-error {{restrict requires a pointer or reference ('f' is invalid)}}
__restrict__ fptr v3; // expected-error {{pointer to function type ('f') may not be 'restrict' qualified}}
f *__restrict__ v4; // expected-error {{pointer to function type ('f') may not be 'restrict' qualified}}
__restrict__ fptr v3; // expected-error {{pointer to function type 'f' may not be 'restrict' qualified}}
f *__restrict__ v4; // expected-error {{pointer to function type 'f' may not be 'restrict' qualified}}

Просмотреть файл

@ -7,7 +7,7 @@ int sub1(int *a, double *b) {
}
void *sub2(struct incomplete *P) {
return P-4; /* expected-error{{not a complete object type}} */
return P-4; /* expected-error{{subtraction of pointer 'struct incomplete *' requires pointee to be a complete object type}} */
}
void *sub3(void *P) {

Просмотреть файл

@ -34,9 +34,9 @@ void basic_bad()
// noncls -> ref
(void)dynamic_cast<A&>(*((int*)0)); // expected-error {{'int' is not a class}}
// ptr -> incomplete
(void)dynamic_cast<Incomplete*>((A*)0); // expected-error {{'struct Incomplete' is incomplete}}
(void)dynamic_cast<Incomplete*>((A*)0); // expected-error {{'struct Incomplete' is an incomplete type}}
// incomplete -> ptr
(void)dynamic_cast<A*>((Incomplete*)0); // expected-error {{'struct Incomplete' is incomplete}}
(void)dynamic_cast<A*>((Incomplete*)0); // expected-error {{'struct Incomplete' is an incomplete type}}
}
void same()

Просмотреть файл

@ -4,7 +4,7 @@
void f(NSArray *a)
{
for (int i in a); // expected-error{{selector element type ('int') is not a valid object}}
for (int i in a); // expected-error{{selector element type 'int' is not a valid object}}
for ((id)2 in a); // expected-error{{selector element is not a valid lvalue}}
for (2 in a); // expected-error{{selector element is not a valid lvalue}}
}
}