Index: include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -487,7 +487,7 @@ def err_dup_implementation_category : Error< "reimplementation of category %1 for class %0">; def err_conflicting_ivar_type : Error< - "instance variable %0 has conflicting type: %1 vs %2">; + "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">; def err_duplicate_ivar_declaration : Error< "instance variable is already declared">; def warn_on_superclass_use : Warning< @@ -506,12 +506,12 @@ def warn_conflicting_overriding_ret_types : Warning< "conflicting return type in " - "declaration of %0: %1 vs %2">, + "declaration of %0%diff{: $ vs $|}1,2">, InGroup, DefaultIgnore; def warn_conflicting_ret_types : Warning< "conflicting return type in " - "implementation of %0: %1 vs %2">; + "implementation of %0%diff{: $ vs $|}1,2">; def warn_conflicting_overriding_ret_type_modifiers : Warning< "conflicting distributed object modifiers on return type " @@ -535,12 +535,12 @@ def warn_conflicting_overriding_param_types : Warning< "conflicting parameter types in " - "declaration of %0: %1 vs %2">, + "declaration of %0%diff{: $ vs $|}1,2">, InGroup, DefaultIgnore; def warn_conflicting_param_types : Warning< "conflicting parameter types in " - "implementation of %0: %1 vs %2">; + "implementation of %0%diff{: $ vs $|}1,2">; def warn_conflicting_param_modifiers : Warning< "conflicting distributed object modifiers on parameter type " "in implementation of %0">, @@ -1059,8 +1059,9 @@ "anonymous %select{struct|union}0 cannot be '%select{const|volatile|" "restrict}1'">; def err_different_return_type_for_overriding_virtual_function : Error< - "virtual function %0 has a different return type (%1) than the " - "function it overrides (which has return type %2)">; + "virtual function %0 has a different return type " + "%diff{($) than the function it overrides (which has return type $)|" + "than the function it overrides}1,2">; def note_overridden_virtual_function : Note< "overridden virtual function is here">; @@ -1138,12 +1139,13 @@ def err_init_conversion_failed : Error< "cannot initialize %select{a variable|a parameter|return object|an " "exception object|a member subobject|an array element|a new value|a value|a " - "base class|a constructor delegation|a vector element}0 of type %1 with an " - "%select{rvalue|lvalue}2 of type %3" - "%select{|: different classes (%5 vs %6)" + "base class|a constructor delegation|a vector element}0 " + "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|" + "with an %select{rvalue|lvalue} of incompatible type}1,3" + "%select{|: different classes%diff{ ($ vs $)|}5,6" "|: different number of parameters (%5 vs %6)" - "|: type mismatch at %ordinal5 parameter (%6 vs %7)" - "|: different return type (%5 vs %6)" + "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7" + "|: different return type%diff{ ($ vs $)|}5,6" "|: different qualifiers (" "%select{none|const|restrict|const and restrict|volatile|const and volatile|" "volatile and restrict|const, volatile, and restrict}5 vs " @@ -1820,37 +1822,46 @@ def warn_impcast_vector_scalar : Warning< - "implicit conversion turns vector to scalar: %0 to %1">, + "implicit conversion turns vector to scalar" + "%diff{: $ to $| when converting types}0,1">, InGroup>, DefaultIgnore; def warn_impcast_complex_scalar : Warning< - "implicit conversion discards imaginary component: %0 to %1">, + "implicit conversion discards imaginary component" + "%diff{: $ to $| when converting types}0,1">, InGroup>, DefaultIgnore; def warn_impcast_float_precision : Warning< - "implicit conversion loses floating-point precision: %0 to %1">, + "implicit conversion loses floating-point precision" + "%diff{: $ to $| when converting types}0,1">, InGroup>, DefaultIgnore; def warn_impcast_float_integer : Warning< - "implicit conversion turns floating-point number into integer: %0 to %1">, + "implicit conversion turns floating-point number into integer" + "%diff{: $ to $| when converting types}0,1">, InGroup>, DefaultIgnore; def warn_impcast_integer_sign : Warning< - "implicit conversion changes signedness: %0 to %1">, + "implicit conversion changes signedness" + "%diff{: $ to $| when converting types}0,1">, InGroup, DefaultIgnore; def warn_impcast_integer_sign_conditional : Warning< - "operand of ? changes signedness: %0 to %1">, + "operand of ? changes signedness%diff{: $ to $| when converting types}0,1">, InGroup, DefaultIgnore; def warn_impcast_integer_precision : Warning< - "implicit conversion loses integer precision: %0 to %1">, + "implicit conversion loses integer precision" + "%diff{: $ to $| when converting types}0,1">, InGroup>, DefaultIgnore; def warn_impcast_integer_64_32 : Warning< - "implicit conversion loses integer precision: %0 to %1">, + "implicit conversion loses integer precision" + "%diff{: $ to $| when converting types}0,1">, InGroup>, DefaultIgnore; def warn_impcast_integer_precision_constant : Warning< - "implicit conversion from %2 to %3 changes value from %0 to %1">, + "implicit conversion %diff{from $ to $| between types}2,3 " + "changes value from %0 to %1">, InGroup; def warn_impcast_bitfield_precision_constant : Warning< "implicit truncation from %2 to bitfield changes value from %0 to %1">, InGroup; def warn_impcast_literal_float_to_integer : Warning< - "implicit conversion from %0 to %1 changes value from %2 to %3">, + "implicit conversion %diff{from $ to $|between types}0,1 " + "changes value from %2 to %3">, InGroup; def warn_impcast_string_literal_to_bool : Warning< "implicit conversion turns string literal into bool: %0 to %1">, @@ -1873,7 +1884,8 @@ "suffix with parentheses to turn this into a function call">; def warn_cast_align : Warning< - "cast from %0 to %1 increases required alignment from %2 to %3">, + "cast %diff{from $ to $|between types}0,1 increases required alignment " + "from %2 to %3">, InGroup, DefaultIgnore; def warn_attribute_ignored_for_field_of_type : Warning< @@ -1928,8 +1940,8 @@ def err_attribute_cleanup_func_must_take_one_arg : Error< "'cleanup' function %0 must take 1 parameter">; def err_attribute_cleanup_func_arg_incompatible_type : Error< - "'cleanup' function %0 parameter has type %1 which is incompatible with " - "type %2">; + "'cleanup' function %0 parameter has " + "%diff{type $ which is incompatible with type $|incompatible type}1,2">; def err_attribute_regparm_wrong_platform : Error< "'regparm' is not valid on this platform">; def err_attribute_regparm_invalid_number : Error< @@ -2024,8 +2036,9 @@ "default argument declared here">; def ext_param_promoted_not_compatible_with_prototype : ExtWarn< - "promoted type %0 of K&R function parameter is not compatible with the " - "parameter type %1 declared in a previous prototype">, + "%diff{promoted type $ of K&R function parameter is not compatible with the " + "parameter type $|promoted type of K&R function parameter is not compatible " + "with parameter type}0,1 declared in a previous prototype">, InGroup; @@ -2060,10 +2073,11 @@ "is the implicit copy assignment operator|" "is the implicit move assignment operator|" "is an inherited constructor}0%1" - "%select{| has different class (expected %3 but has %4)" + "%select{| has different class%diff{ (expected $ but has $)|}3,4" "| has different number of parameters (expected %3 but has %4)" - "| has type mismatch at %ordinal3 parameter (expected %4 but has %5)" - "| has different return type (%3 expected but has %4)" + "| has type mismatch at %ordinal3 parameter" + "%diff{ (expected $ but has $)|}4,5" + "| has different return type%diff{ ($ expected but has $)|}3,4" "| has different qualifiers (expected " "%select{none|const|restrict|const and restrict|volatile|const and volatile" "|volatile and restrict|const, volatile, and restrict}3 but found " @@ -2077,7 +2091,7 @@ "couldn't infer template argument %0">; def note_ovl_candidate_inconsistent_deduction : Note< "candidate template ignored: deduced conflicting %select{types|values|" - "templates}0 for parameter %1 (%2 vs. %3)">; + "templates}0 for parameter %1%diff{ ($ vs. $)|}2,3">; def note_ovl_candidate_explicit_arg_mismatch_named : Note< "candidate template ignored: invalid explicitly-specified argument " "for template parameter %0">; @@ -2144,7 +2158,8 @@ "function (the implicit copy assignment operator)|" "function (the implicit move assignment operator)|" "constructor (inherited)}0%1 " - "not viable: cannot convert argument of incomplete type %2 to %3">; + "not viable: cannot convert argument of incomplete type " + "%diff{$ to $|to parameter type}2,3">; def note_ovl_candidate_bad_list_argument : Note<"candidate " "%select{function|function|constructor|" "function |function |constructor |" @@ -2190,7 +2205,8 @@ "function (the implicit copy assignment operator)|" "function (the implicit move assignment operator)|" "constructor (inherited)}0%1" - " not viable: cannot implicitly convert argument of type %2 to %3 for " + " not viable: cannot implicitly convert argument " + "%diff{of type $ to $|type to parameter type}2,3 for " "%select{%ordinal5 argument|object argument}4 under ARC">; def note_ovl_candidate_bad_lvalue : Note<"candidate " "%select{function|function|constructor|" @@ -2284,7 +2300,7 @@ " %select{__device__|__global__|__host__|__host__ __device__}2 function">; def note_ambiguous_type_conversion: Note< - "because of ambiguity in conversion of %0 to %1">; + "because of ambiguity in conversion %diff{of $ to $|between types}0,1">; def note_ovl_builtin_binary_candidate : Note< "built-in candidate %0">; def note_ovl_builtin_unary_candidate : Note< @@ -2292,19 +2308,23 @@ def err_ovl_no_viable_function_in_init : Error< "no matching constructor for initialization of %0">; def err_ovl_no_conversion_in_cast : Error< - "cannot convert %1 to %2 without a conversion operator">; + "cannot convert %diff{$ to $|types}1,2 without a conversion operator">; def err_ovl_no_viable_conversion_in_cast : Error< "no matching conversion for %select{|static_cast|reinterpret_cast|" - "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">; + "dynamic_cast|C-style cast|functional-style cast}0 " + "%diff{from $ to $|between types}1,2">; def err_ovl_ambiguous_conversion_in_cast : Error< "ambiguous conversion for %select{|static_cast|reinterpret_cast|" - "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">; + "dynamic_cast|C-style cast|functional-style cast}0 " + "%diff{from $ to $|between types}1,2">; def err_ovl_deleted_conversion_in_cast : Error< "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|" - "functional-style cast}0 from %1 to %2 uses deleted function">; + "functional-style cast}0 %diff{from $ to $|between types}1,2 " + "uses deleted function">; def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">; def err_ref_init_ambiguous : Error< - "reference initialization of type %0 with initializer of type %1 is ambiguous">; + "reference initialization %diff{of type $ with initializer of type $" + "|with initializer of different type}0,1 is ambiguous">; def err_ovl_deleted_init : Error< "call to %select{unavailable|deleted}0 constructor of %1">; def err_ovl_deleted_special_init : Error< @@ -2314,7 +2334,7 @@ def err_ovl_ambiguous_oper_unary : Error< "use of overloaded operator '%0' is ambiguous (operand type %1)">; def err_ovl_ambiguous_oper_binary : Error< - "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">; + "use of overloaded operator '%0' is ambiguous%diff{ (with operand types $ and $|)}1,2">; def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">; def err_ovl_deleted_oper : Error< "overload resolution selected %select{unavailable|deleted}0 operator '%1'%2">; @@ -2486,10 +2506,10 @@ "of type %1">; def err_deduced_non_type_template_arg_type_mismatch : Error< "deduced non-type template argument does not have the same type as the " - "its corresponding template parameter (%0 vs %1)">; + "its corresponding template parameter%diff{ ($ vs $)|}0,1">; def err_template_arg_not_convertible : Error< - "non-type template argument of type %0 cannot be converted to a value " - "of type %1">; + "non-type template argument %diff{of type $ cannot be converted to a value " + "of type $|cannot be converted between types}0,1">; def warn_template_arg_negative : Warning< "non-type template argument with value '%0' converted to '%1' for unsigned " "template parameter of type %2">, InGroup, DefaultIgnore; @@ -2497,11 +2517,13 @@ "non-type template argument value '%0' truncated to '%1' for " "template parameter of type %2">, InGroup, DefaultIgnore; def err_template_arg_no_ref_bind : Error< - "non-type template parameter of reference type %0 cannot bind to template " - "argument of type %1">; + "non-type template parameter of reference type " + "%diff{$ cannot bind to template argument of type $" + "|cannot bind to template of incompatible argument type}0,1">; def err_template_arg_ref_bind_ignores_quals : Error< - "reference binding of non-type template parameter of type %0 to template " - "argument of type %1 ignores qualifiers">; + "reference binding of non-type template parameter " + "%diff{of type $ to template argument of type $|to template argument}0,1 " + "ignores qualifiers">; def err_template_arg_not_decl_ref : Error< "non-type template argument does not refer to any declaration">; def err_template_arg_not_object_or_func_form : Error< @@ -3079,7 +3101,7 @@ "redefinition of forward class %0 of a typedef name of an object type is ignored">, InGroup>; def err_redefinition_different_typedef : Error< - "%select{typedef|type alias|type alias template}0 redefinition with different types (%1 vs %2)">; + "%select{typedef|type alias|type alias template}0 redefinition with different types%diff{ ($ vs $)|}1,2">; def err_tag_reference_non_tag : Error< "elaborated type refers to %select{a non-tag type|a typedef|a type alias|a template|a type alias template}0">; def err_tag_reference_conflict : Error< @@ -3227,15 +3249,17 @@ "illegal initializer (only variables can be initialized)">; def err_illegal_initializer_type : Error<"illegal initializer type %0">; def err_init_list_type_narrowing_sfinae : Error< - "type %0 cannot be narrowed to %1 in initializer list">; + "type %diff{$ cannot be narrowed to $|cannot be narrowed}0,1 " + "in initializer list">; def err_init_list_type_narrowing : ExtWarn< - "type %0 cannot be narrowed to %1 in initializer list">, + "type %diff{$ cannot be narrowed to $|cannot be narrowed}0,1 " + "in initializer list">, InGroup, DefaultError; def err_init_list_variable_narrowing_sfinae : Error< - "non-constant-expression cannot be narrowed from type %0 to %1 in " + "non-constant-expression cannot be narrowed %diff{from type $ to $|}0,1, in " "initializer list">; def err_init_list_variable_narrowing : ExtWarn< - "non-constant-expression cannot be narrowed from type %0 to %1 in " + "non-constant-expression cannot be narrowed %diff{from type $ to $|}0,1 in " "initializer list">, InGroup, DefaultError; def err_init_list_constant_narrowing_sfinae : Error< "constant expression evaluates to %0 which cannot be narrowed to type %1">; @@ -3243,10 +3267,10 @@ "constant expression evaluates to %0 which cannot be narrowed to type %1">, InGroup, DefaultError; def warn_init_list_type_narrowing : Warning< - "type %0 cannot be narrowed to %1 in initializer list in C++11">, + "type %0 cannot be narrowede to %1 in initializer list in C++11">, InGroup, DefaultIgnore; def warn_init_list_variable_narrowing : Warning< - "non-constant-expression cannot be narrowed from type %0 to %1 in " + "non-constant-expression cannot be narrowed %diff{from type $ to $|}0,1 in " "initializer list in C++11">, InGroup, DefaultIgnore; def warn_init_list_constant_narrowing : Warning< @@ -3426,8 +3450,8 @@ "synthesis of a weak-unavailable property is disallowed " "because it requires synthesis of an ivar of the __weak object">; def err_arc_convesion_of_weak_unavailable : Error< - "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to" - " a __weak object of type %2">; + "%select{implicit conversion|cast}0 of weak-unavailable object " + "%diff{of type $ to a __weak object of type $|to a __weak object}1,2">; } // end "ARC Weak References" category @@ -3439,10 +3463,13 @@ "the result of a delegate init call must be immediately returned " "or assigned to 'self'">; def err_arc_mismatched_cast : Error< - "%select{implicit conversion|cast}0 of " - "%select{%2|a non-Objective-C pointer type %2|a block pointer|" - "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1" - " to %3 is disallowed with ARC">; + "%select{implicit conversion|cast}0 " + "%select{%diff{of $ to $|}2,3|" + "of a non-Objective-C pointer%diff{ type $ to $}2,3|" + "of a block pointer to %3|" + "of an Objective-C pointer to %3|" + "of an indirect pointer to an Objective-C pointer to %3}1" + " is disallowed with ARC">; def err_arc_nolifetime_behavior : Error< "explicit ownership qualifier on cast result has no effect">; def err_arc_objc_object_in_struct : Error< @@ -3515,8 +3542,9 @@ def err_arc_array_param_no_ownership : Error< "must explicitly describe intended ownership of an object array parameter">; def err_arc_pseudo_dtor_inconstant_quals : Error< - "pseudo-destructor destroys object of type %0 with inconsistently-qualified " - "type %1">; + "pseudo-destructor destroys object " + "%diff{of type $ with inconsistently-qualified type $|" + "with inconsistently-qualified type}0,1">; def err_arc_init_method_unrelated_result_type : Error< "init methods must return a type related to the receiver type">; def err_arc_nonlocal_writeback : Error< @@ -3578,15 +3606,17 @@ let CategoryName = "ARC Casting Rules" in { def err_arc_bridge_cast_incompatible : Error< - "incompatible types casting %0 to %1 with a %select{__bridge|" + "incompatible types casting%diff{ $ to $|}0,1 with a %select{__bridge|" "__bridge_transfer|__bridge_retained}2 cast">; def err_arc_bridge_cast_wrong_kind : Error< - "cast of %select{Objective-C|block|C}0 pointer type %1 to " - "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|" - "__bridge_transfer|__bridge_retained}4">; + "cast of %select{Objective-C|block|C}0 pointer type " + "%diff{$ to %select{Objective-C|block|C}2 pointer type $|" + "to %select{Objective-C|block|C}2 pointer type}1,3 " + "cannot use %select{__bridge|__bridge_transfer|__bridge_retained}4">; def err_arc_cast_requires_bridge : Error< "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 " - "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 " + "pointer type %diff{$ to %select{Objective-C|block|C}3 pointer type $|" + "to %select{Objective-C|block|C}3 pointer type}2,4 " "requires a bridged cast">; def note_arc_bridge : Note< "use __bridge to convert directly (no change in ownership)">; @@ -3826,8 +3856,8 @@ "member declaration does not match because " "it %select{is|is not}0 const qualified">; def note_member_def_close_param_match : Note< - "type of %ordinal0 parameter of member declaration does not match " - "definition (%1 vs %2)">; + "type of %ordinal0 parameter of member declaration does not match definition" + "%diff{ ($ vs $)|}1,2">; def err_typecheck_ivar_variable_size : Error< "instance variables must have a constant size">; def err_ivar_reference_type : Error< @@ -3859,12 +3889,15 @@ "array initializer must be an initializer " "list%select{| or string literal}0">; def err_array_init_different_type : Error< - "cannot initialize array of type %0 with array of type %1">; + "cannot initialize array %diff{of type $ with array of type $|" + "with different type of array}0,1">; def err_array_init_non_constant_array : Error< - "cannot initialize array of type %0 with non-constant array of type %1">; + "cannot initialize array %diff{of type $ with non-constant array of type $|" + "with different type of array}0,1">; def ext_array_init_copy : Extension< - "initialization of an array of type %0 from a compound literal of type %1 is " - "a GNU extension">, InGroup; + "initialization of an array " + "%diff{of type $ from a compound literal of type $|" + "from a compound literal}0,1 is a GNU extension">, InGroup; // This is intentionally not disabled by -Wno-gnu. def ext_array_init_parens : ExtWarn< "parenthesized initialization of a member array is a GNU extension">, @@ -3906,46 +3939,51 @@ def note_indirection_through_null : Note< "consider using __builtin_trap() or qualifying pointer with 'volatile'">; def warn_pointer_indirection_from_incompatible_type : Warning< - "dereference of type %1 that was reinterpret_cast from type %0 has undefined " - "behavior">, + "dereference of type %diff{$ that was reinterpret_cast from type $|" + "that was reinterpret_cast}1,0 has undefined behavior">, InGroup>, DefaultIgnore; def err_objc_object_assignment : Error< "cannot assign to class object (%0 invalid)">; def err_typecheck_invalid_operands : Error< - "invalid operands to binary expression (%0 and %1)">; + "invalid operands to binary expression%diff{ ($ and $)|}0,1">; def err_typecheck_sub_ptr_compatible : Error< - "%0 and %1 are not pointers to compatible types">; + "%diff{$ and $ are not pointers to compatible types|" + "pointers to incompatible types}0,1">; def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn< - "ordered comparison between pointer and integer (%0 and %1)">; + "ordered comparison between pointer and integer%diff{ ($ and $)|}0,1">; def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension< - "ordered comparison between pointer and zero (%0 and %1) is an extension">; + "ordered comparison between pointer and zero%diff{ ($ and $)|}0,1 " + "is an extension">; def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn< - "ordered comparison of function pointers (%0 and %1)">; + "ordered comparison of function pointers%diff{ ($ and $)|}0,1">; def ext_typecheck_comparison_of_fptr_to_void : Extension< - "equality comparison between function pointer and void pointer (%0 and %1)">; + "equality comparison between function pointer and void pointer" + "%diff{ ($ and $)|}0,1">; def err_typecheck_comparison_of_fptr_to_void : Error< - "equality comparison between function pointer and void pointer (%0 and %1)">; + "equality comparison between function pointer and void pointer" + "%diff{ ($ and $)|}0,1">; def ext_typecheck_comparison_of_pointer_integer : ExtWarn< - "comparison between pointer and integer (%0 and %1)">; + "comparison between pointer and integer%diff{ ($ and $)|}0,1">; def err_typecheck_comparison_of_pointer_integer : Error< - "comparison between pointer and integer (%0 and %1)">; + "comparison between pointer and integer%diff{ ($ and $)|}0,1">; def ext_typecheck_comparison_of_distinct_pointers : ExtWarn< - "comparison of distinct pointer types (%0 and %1)">; + "comparison of distinct pointer types%diff{ ($ and $)|}0,1">; def ext_typecheck_cond_incompatible_operands : ExtWarn< - "incompatible operand types (%0 and %1)">; + "incompatible operand types%diff{ ($ and $)|}0,1">; def err_cond_voidptr_arc : Error < - "operands to conditional of types %0 and %1 are incompatible in ARC mode">; + "operands to conditional of types%diff{ $ and $|}0,1 are incompatible " + "in ARC mode">; def err_typecheck_comparison_of_distinct_pointers : Error< - "comparison of distinct pointer types (%0 and %1)">; + "comparison of distinct pointer types%diff{ ($ and $)|}0,1">; def ext_typecheck_comparison_of_distinct_pointers_nonstandard : ExtWarn< - "comparison of distinct pointer types (%0 and %1) uses non-standard " - "composite pointer type %2">; + "comparison of distinct pointer types%diff{ ($ and $)|}0,1 uses " + "non-standard composite pointer type %2">; def err_typecheck_assign_const : Error<"read-only variable is not assignable">; def err_stmtexpr_file_scope : Error< "statement expression not allowed at file scope">; def warn_mixed_sign_comparison : Warning< - "comparison of integers of different signs: %0 and %1">, + "comparison of integers of different signs%diff{: $ and $|}0,1">, InGroup, DefaultIgnore; def warn_lunsigned_always_true_comparison : Warning< "comparison of unsigned%select{| enum}2 expression %0 is always %1">, @@ -3954,7 +3992,7 @@ "comparison of %0 unsigned%select{| enum}2 expression is always %1">, InGroup; def warn_comparison_of_mixed_enum_types : Warning< - "comparison of two values with different enumeration types (%0 and %1)">, + "comparison of two values with different enumeration types%diff{ ($ and $)|}0,1">, InGroup>; def warn_null_in_arithmetic_operation : Warning< "use of NULL in arithmetic operation">, @@ -4177,13 +4215,13 @@ def err_bad_cxx_cast_generic : Error< "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|" - "functional-style cast}0 from %1 to %2 is not allowed">; + "functional-style cast}0%diff{ from $ to $|}1,2 is not allowed">; def err_bad_cxx_cast_rvalue : Error< "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|" "functional-style cast}0 from rvalue to reference type %2">; def err_bad_cxx_cast_qualifiers_away : Error< "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|" - "functional-style cast}0 from %1 to %2 casts away qualifiers">; + "functional-style cast}0 from%diff{ $ to $|}1,2 casts away qualifiers">; def err_bad_const_cast_dest : Error< "%select{const_cast||||C-style cast|functional-style cast}0 to %2, " "which is not a reference, pointer-to-object, or pointer-to-data-member">; @@ -4207,16 +4245,18 @@ "cannot cast from lvalue of type %1 to rvalue reference type %2; types are " "not compatible">; def err_bad_static_cast_pointer_nonpointer : Error< - "cannot cast from type %1 to pointer type %2">; + "cannot cast from type %diff{$ to pointer type $|to pointer type}1,2">; def err_bad_static_cast_member_pointer_nonmp : Error< - "cannot cast from type %1 to member pointer type %2">; + "cannot cast from type " + "$diff{$ to member pointer type $|to member pointer type}1,2">; def err_bad_cxx_cast_member_pointer_size : Error< "cannot %select{||reinterpret_cast||C-style cast|}0 from member pointer " - "type %1 to member pointer type %2 of different size">; + "%diff{type $ to member pointer type $|to member pointer}1,2 " + "of different size">; def err_bad_reinterpret_cast_reference : Error< "reinterpret_cast of a %0 to %1 needs its address which is not allowed">; def warn_undefined_reinterpret_cast : Warning< - "reinterpret_cast from %0 to %1 has undefined behavior">, + "reinterpret_cast %diff{from $ to $|}0,1 has undefined behavior">, InGroup>, DefaultIgnore; // These messages don't adhere to the pattern. @@ -4267,19 +4307,23 @@ def err_array_size_incomplete_type : Error< "array size expression has incomplete class type %0">; def err_array_size_explicit_conversion : Error< - "array size expression of type %0 requires explicit conversion to type %1">; + "array size expression " + "%diff{of type $ requires explicit conversion to type $|" + "requires explicit conversion}0,1">; def note_array_size_conversion : Note< "conversion to %select{integral|enumeration}0 type %1 declared here">; def err_array_size_ambiguous_conversion : Error< "ambiguous conversion of array size expression of type %0 to an integral or " "enumeration type">; def ext_array_size_conversion : Extension< - "implicit conversion from array size expression of type %0 to " - "%select{integral|enumeration}1 type %2 is a C++11 extension">, + "implicit conversion from array size expression " + "%diff{of type $ to %select{integral|enumeration}1 type $|" + "to %select{integral|enumeration}1 type}0,2 is a C++11 extension">, InGroup; def warn_cxx98_compat_array_size_conversion : Warning< - "implicit conversion from array size expression of type %0 to " - "%select{integral|enumeration}1 type %2 is incompatible with C++98">, + "implicit conversion from array size expression " + "%diff{of type $ to %select{integral|enumeration}1 type $|" + "to %select{integral|enumeration}1 type}0,2 is incompatible with C++98">, InGroup, DefaultIgnore; def err_address_space_qualified_new : Error< "'new' cannot allocate objects of type %0 in address space '%1'">; @@ -4357,11 +4401,12 @@ "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand " "is of type %0">; def err_conditional_ambiguous : Error< - "conditional expression is ambiguous; %0 can be converted to %1 " - "and vice versa">; + "conditional expression is ambiguous; " + "%diff{$ can be converted to $ and vice versa|" + "types can be convert to each other}0,1">; def err_conditional_ambiguous_ovl : Error< - "conditional expression is ambiguous; %0 and %1 can be converted to several " - "common types">; + "conditional expression is ambiguous; %diff{$ and $|types}0,1 " + "can be converted to several common types">; def err_throw_incomplete : Error< "cannot throw object of incomplete type %0">; @@ -4440,8 +4485,10 @@ "pseudo-destructors on type void are a Microsoft extension">, InGroup; def err_pseudo_dtor_type_mismatch : Error< - "the type of object expression (%0) does not match the type being destroyed " - "(%1) in pseudo-destructor expression">; + "the type of object expression " + "%diff{($) does not match the type being destroyed ($)|" + "does not match the type being destroyed}0,1 " + "in pseudo-destructor expression">; def err_pseudo_dtor_call_with_args : Error< "call to pseudo-destructor cannot have any arguments">; def err_dtor_expr_without_call : Error< @@ -4458,11 +4505,12 @@ def err_typecheck_bool_condition : Error< "value of type %0 is not contextually convertible to 'bool'">; def err_typecheck_ambiguous_condition : Error< - "conversion from %0 to %1 is ambiguous">; + "conversion %diff{from $ to $|between types}0,1 is ambiguous">; def err_typecheck_nonviable_condition : Error< - "no viable conversion from %0 to %1">; + "no viable conversion%diff{ from $ to $|}0,1">; def err_typecheck_deleted_function : Error< - "conversion function from %0 to %1 invokes a deleted function">; + "conversion function %diff{from $ to $|between types}0,1 " + "invokes a deleted function">; def err_expected_class_or_namespace : Error<"expected a class or namespace">; def err_expected_class : Error<"%0 is not a class%select{ or namespace|, " @@ -4509,42 +4557,66 @@ // In most of these diagnostics the %2 is a value from the // Sema::AssignmentAction enumeration def err_typecheck_convert_incompatible : Error< - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from incompatible type|to parameter of incompatible type|" - "from a function with incompatible result type|to incompatible type|" - "with an expression of incompatible type|to parameter of incompatible type|" - "to incompatible type}2 %1" + "%select{%diff{assigning to $ from incompatible type $|" + "assigning to type from incompatible type}0,1" + "|%diff{passing $ to parameter of incompatible type $|" + "passing type to parameter of incompatible type}0,1" + "|%diff{returning $ from a function with incompatible result type $|" + "returning type from a function with incompatible result type}0,1" + "|%diff{converting $ to incompatible type $|" + "converting type to incompatible type}" + "|%diff{initializing $ with an expression of incompatible type $|" + "initializing type with an expression of incompatible type}0,1" + "|%diff{sending $ to parameter of incompatible type $|" + "sending type to parameter of incompatible type}0,1" + "|%diff{casting $ to incompatible type $|" + "casting type to incompatible type}0,1}2" "%select{|; dereference with *|" "; take the address with &|" "; remove *|" "; remove &}3" - "%select{|: different classes (%5 vs %6)" + "%select{|: different classes%diff{ ($ vs $)|}5,6" "|: different number of parameters (%5 vs %6)" - "|: type mismatch at %ordinal5 parameter (%6 vs %7)" - "|: different return type (%5 vs %6)" + "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7" + "|: different return type%diff{ ($ vs $)|}5,6" "|: different qualifiers (" "%select{none|const|restrict|const and restrict|volatile|const and volatile|" "volatile and restrict|const, volatile, and restrict}5 vs " "%select{none|const|restrict|const and restrict|volatile|const and volatile|" "volatile and restrict|const, volatile, and restrict}6)}4">; def err_typecheck_missing_return_type_incompatible : Error< - "return type %0 must match previous return type %1 when %select{block " + "%diff{return type $ must match previous return type $|" + "return type must match previous return type}0,1 when %select{block " "literal|lambda expression}2 has unspecified explicit return type">; def warn_incompatible_qualified_id : Warning< - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from incompatible type|to parameter of incompatible type|" - "from a function with incompatible result type|to incompatible type|" - "with an expression of incompatible type|to parameter of incompatible type|" - "to incompatible type}2 %1">; + "%select{%diff{assigning to $ from incompatible type $|" + "assigning to type from incompatible type}0,1" + "|%diff{passing $ to parameter of incompatible type $|" + "passing type to parameter of incompatible type}0,1" + "|%diff{returning $ from a function with incompatible result type $|" + "returning type from a function with incompatible result type}0,1" + "|%diff{converting $ to incompatible type $|" + "converting type to incompatible type}" + "|%diff{initializing $ with an expression of incompatible type $|" + "initializing type with an expression of incompatible type}0,1" + "|%diff{sending $ to parameter of incompatible type $|" + "sending type to parameter of incompatible type}0,1" + "|%diff{casting $ to incompatible type $|" + "casting type to incompatible type}0,1}2">; def ext_typecheck_convert_pointer_int : ExtWarn< "incompatible pointer to integer conversion " - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1" + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2" "%select{|; dereference with *|" "; take the address with &|" "; remove *|" @@ -4552,92 +4624,163 @@ InGroup; def ext_typecheck_convert_int_pointer : ExtWarn< "incompatible integer to pointer conversion " - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1" + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2" "%select{|; dereference with *|" "; take the address with &|" "; remove *|" "; remove &}3">, InGroup; def ext_typecheck_convert_pointer_void_func : Extension< - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1 " - "converts between void pointer and function pointer">; + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2" + " converts between void pointer and function pointer">; def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn< - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1 " - "converts between pointers to integer types with different sign">, + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2" + " converts between pointers to integer types with different sign">, InGroup>; def ext_typecheck_convert_incompatible_pointer : ExtWarn< "incompatible pointer types " - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1" + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2" "%select{|; dereference with *|" "; take the address with &|" "; remove *|" "; remove &}3">, InGroup; def ext_typecheck_convert_discards_qualifiers : ExtWarn< - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1 discards " - "qualifiers">, + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2" + " discards qualifiers">, InGroup; def ext_nested_pointer_qualifier_mismatch : ExtWarn< - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1 discards " - "qualifiers in nested pointer types">, + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2" + " discards qualifiers in nested pointer types">, InGroup; def warn_incompatible_vectors : Warning< "incompatible vector types " - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1">, + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2">, InGroup, DefaultIgnore; def err_int_to_block_pointer : Error< "invalid block pointer conversion " - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1">; + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2">; def err_typecheck_convert_incompatible_block_pointer : Error< "incompatible block pointer types " - "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" - " %0 " - "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1">; + "%select{%diff{assigning to $ from $|assigning to different types}0,1" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2">; def err_typecheck_incompatible_address_space : Error< - "%select{assigning %1 to %0" - "|passing %0 to parameter of type %1" - "|returning %0 from a function with result type %1" - "|converting %0 to type %1" - "|initializing %0 with an expression of type %1" - "|sending %0 to parameter of type %1" - "|casting %0 to type %1}2" + "%select{%diff{assigning $ to $|assigning to different types}1,0" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2" " changes address space of pointer">; def err_typecheck_incompatible_ownership : Error< - "%select{assigning %1 to %0" - "|passing %0 to parameter of type %1" - "|returning %0 from a function with result type %1" - "|converting %0 to type %1" - "|initializing %0 with an expression of type %1" - "|sending %0 to parameter of type %1" - "|casting %0 to type %1}2" + "%select{%diff{assigning $ to $|assigning to different types}1,0" + "|%diff{passing $ to parameter of type $|" + "passing to parameter of different type}0,1" + "|%diff{returning $ from a function with result type $|" + "returning from function with different return type}0,1" + "|%diff{converting $ to type $|converting between types}0,1" + "|%diff{initializing $ with an expression of type $|" + "initializing with expression of different type}0,1" + "|%diff{sending $ to parameter of type $|" + "sending to parameter of different type}0,1" + "|%diff{casting $ to type $|casting between types}0,1}2" " changes retain/release properties of pointer">; def err_typecheck_comparison_of_distinct_blocks : Error< - "comparison of distinct block types (%0 and %1)">; + "comparison of distinct block types%diff{ ($ and $)|}0,1">; def err_typecheck_array_not_modifiable_lvalue : Error< "array type %0 is not assignable">; @@ -4759,7 +4902,8 @@ InGroup, DefaultIgnore; def 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" + "%diff{ ($ and $)|}0,1">; def err_typecheck_call_invalid_unary_fp : Error< "floating point classification requires argument of floating point type " "(passed in %0)">; @@ -4783,17 +4927,18 @@ def err_typecheck_expect_scalar_operand : Error< "operand of type %0 where arithmetic or pointer type is required">; def err_typecheck_cond_incompatible_operands : Error< - "incompatible operand types (%0 and %1)">; + "incompatible operand types%diff{ ($ and $)|}0,1">; def ext_typecheck_cond_incompatible_operands_nonstandard : ExtWarn< - "incompatible operand types (%0 and %1) use non-standard composite pointer " - "type %2">; + "incompatible operand types%diff{ ($ and $)|}0,1 use non-standard composite " + "pointer type %2">; def err_cast_selector_expr : Error< "cannot type cast @selector expression">; def warn_typecheck_cond_incompatible_pointers : ExtWarn< - "pointer type mismatch (%0 and %1)">, + "pointer type mismatch%diff{ ($ and $)|}0,1">, InGroup>; def warn_typecheck_cond_pointer_integer_mismatch : ExtWarn< - "pointer/integer type mismatch in conditional expression (%0 and %1)">, + "pointer/integer type mismatch in conditional expression" + "%diff{ ($ and $)|}0,1">, InGroup>; def err_typecheck_choose_expr_requires_constant : Error< "'__builtin_choose_expr' requires a constant expression">; @@ -4851,7 +4996,8 @@ def err_asm_invalid_type_in_input : Error< "invalid type %0 in asm input for constraint '%1'">; def err_asm_tying_incompatible_types : Error< - "unsupported inline asm: input with type %0 matching output with type %1">; + "unsupported inline asm: input with type " + "%diff{$ matching output with type $|}0,1">; def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">; def warn_asm_label_on_auto_decl : Warning< "ignored asm label '%0' on automatic variable">; @@ -4871,13 +5017,15 @@ let CategoryName = "Semantic Issue" in { def err_invalid_conversion_between_vectors : Error< - "invalid conversion between vector type %0 and %1 of different size">; + "invalid conversion between vector type%diff{ $ and $|}0,1 of different " + "size">; def err_invalid_conversion_between_vector_and_integer : Error< - "invalid conversion between vector type %0 and integer type %1 " - "of different size">; + "invalid conversion between vector type " + "%diff{$ and integer type $|and integer type}0,1 of different size">; def err_invalid_conversion_between_vector_and_scalar : Error< - "invalid conversion between vector type %0 and scalar type %1">; + "invalid conversion between vector type " + "%diff{$ and scalar type $|and scalar type}0,1">; // C++ member initializers. def err_only_constructors_take_base_inits : Error< @@ -5092,7 +5240,8 @@ def warn_conv_to_base_not_used : Warning< "conversion function converting %0 to its base class %1 will never be used">; def warn_conv_to_void_not_used : Warning< - "conversion function converting %0 to %1 will never be used">; + "conversion function converting %diff{$ to $|between types}0,1 will never be " + "used">; def warn_not_compound_assign : Warning< "use of unary operator that may be intended as compound assignment (%0=)">; @@ -5297,7 +5446,9 @@ def err_assoc_type_variably_modified : Error< "type %0 in generic association is a variably modified type">; def err_assoc_compatible_types : Error< - "type %0 in generic association compatible with previously specified type %1">; + "%diff{type $ in generic association compatible with previously specified " + "type $|type in generic association compatible with previously specified " + "type}0,1">; def note_compat_assoc : Note< "compatible type %0 specified here">; def err_generic_sel_no_match : Error< @@ -5413,7 +5564,8 @@ def note_switch_conversion : Note< "conversion to %select{integral|enumeration}0 type %1">; def err_switch_explicit_conversion : Error< - "switch condition type %0 requires explicit conversion to %1">; + "switch condition %diff{type $ requires explicit conversion to $|" + "requires explicit conversion between types}0,1">; def err_switch_incomplete_class_type : Error< "switch condition has incomplete class type %0">; @@ -5521,7 +5673,7 @@ "collection expression type %0 may not respond to %1">; def err_invalid_conversion_between_ext_vectors : Error< - "invalid conversion between ext-vector type %0 and %1">; + "invalid conversion between ext-vector type%diff{ $ and $|s}0,1">; def warn_duplicate_attribute : Warning< "attribute %0 is already applied with different parameters">; @@ -5578,8 +5730,10 @@ "attributes on method implementation and its declaration must match">, InGroup>; def ext_typecheck_base_super : Warning< - "method parameter type %0 does not match " - "super class method parameter type %1">, InGroup, DefaultIgnore; + "method parameter type " + "%diff{$ does not match super class method parameter type $|" + "does not match super class method parameter type}0,1">, + InGroup, DefaultIgnore; def warn_missing_method_return_type : Warning< "method has no return type specified; defaults to 'id'">, InGroup, DefaultIgnore; @@ -5660,7 +5814,7 @@ // OpenCL warnings and errors. def err_invalid_astype_of_different_size : Error< - "invalid reinterpretation: sizes of %0 and %1 must match">; + "invalid reinterpretation: sizes of %diff{$ and $|types}0,1 must match">; def err_static_kernel : Error< "kernel functions cannot be declared static">; def err_static_function_scope : Error< @@ -5671,8 +5825,9 @@ let CategoryName = "Related Result Type Issue" in { // Objective-C related result type compatibility def warn_related_result_type_compatibility_class : Warning< - "method is expected to return an instance of its class type %0, but " - "is declared to return %1">; + "method is expected to return an instance of its class type " + "%diff{$, but is declared to return $|" + ", but is declared to return different type}0,1">; def warn_related_result_type_compatibility_protocol : Warning< "protocol method is expected to return an instance of the implementing " "class, but is declared to return %0">; Index: test/Misc/template-type-diffing/1.cpp =================================================================== --- test/Misc/template-type-diffing/1.cpp +++ test/Misc/template-type-diffing/1.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//err_different_return_type_for_overriding_virtual_function + +template class map{}; + +class A { + public: + virtual map getmap(); // expected-note{{overridden virtual function is here}} +}; + +class B : public A { + public: + map getmap(); // expected-error{{virtual function 'getmap' has a different return type ('map') than the function it overrides (which has return type 'map')}} +}; + Index: test/Misc/template-type-diffing/1.mm =================================================================== --- test/Misc/template-type-diffing/1.mm +++ test/Misc/template-type-diffing/1.mm @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -fobjc-runtime=macosx-fragile-10.5 -fsyntax-only -verify +//err_conflicting_ivar_type + +template class map{}; + +@interface Base{ + map isa; // expected-note{{previous definition is here}} +} +@end + +@implementation Base { + map isa; // expected-error{{instance variable 'isa' has conflicting type: 'map' vs 'map'}} +} +@end + Index: test/Misc/template-type-diffing/10.cpp =================================================================== --- test/Misc/template-type-diffing/10.cpp +++ test/Misc/template-type-diffing/10.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//err_bad_cxx_cast_generic + +template class map {}; +void foo() { + (void)reinterpret_cast >(map()); // expected-error {{reinterpret_cast from 'map<[2 * ...]>' to 'map<[2 * ...]>' is not allowed}} + (void)reinterpret_cast >(map()); // expected-error {{reinterpret_cast from 'map<[...], void>' to 'map<[...], int>' is not allowed}} +} Index: test/Misc/template-type-diffing/11.cpp =================================================================== --- test/Misc/template-type-diffing/11.cpp +++ test/Misc/template-type-diffing/11.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//err_conditional_ambiguous_ovl +template class map { operator int&(); operator double&(); }; + +void foo(bool cond, map a, map b) { + (void) (cond ? a : b); // expected-error{{conditional expression is ambiguous; 'map' and 'map' can be converted to several common types}} +} + +//err_conditional_ambiguous +template class tri { operator tri(); }; + +void bar(bool cond, tri a, tri b) { + (void) (cond ? a : b); // expected-error{{conditional expression is ambiguous; 'tri' can be converted to 'tri' and vice versa}} +} Index: test/Misc/template-type-diffing/12.cpp =================================================================== --- test/Misc/template-type-diffing/12.cpp +++ test/Misc/template-type-diffing/12.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//err_typecheck_nonviable_condition + +template class map { }; // expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'map' to 'const map &' for 1st argument}} +template void foo(T a, T b = map()) {} // expected-error {{no viable conversion from 'map<[...], int>' to 'map<[...], void>'}} \ + // expected-note {{passing argument to parameter 'b' here}} + +void test1() { + foo(map()); // expected-note{{in instantiation of default function argument expression for 'foo >' required here}} +} + +//err_typecheck_ambiguous_condition +template struct tri { + operator tri() const; // expected-note {{candidate function}} + tri(const tri&); // expected-note {{candidate constructor}} + tri(); +}; + +void bar(tri); // expected-note {{passing argument to parameter here}} + +void test2() { + tri a; + bar(a); // expected-error {{conversion from 'tri' to 'tri' is ambiguous}} +} Index: test/Misc/template-type-diffing/13.cpp =================================================================== --- test/Misc/template-type-diffing/13.cpp +++ test/Misc/template-type-diffing/13.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++11 + +template struct map { + map(); + template map(map) = delete; // expected-note {{function has been explicitly marked deleted here}} +}; + +void foo() { + map m1; + map m2 = m1; // expected-error {{conversion function from 'map<[...], int>' to 'map<[...], double>' invokes a deleted function}} +} Index: test/Misc/template-type-diffing/14.cpp =================================================================== --- test/Misc/template-type-diffing/14.cpp +++ test/Misc/template-type-diffing/14.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//err_typecheck_convert_incompatible +template struct map { }; + +void foo() { + void (map::*A)(); + void (map::*B)(); + A = B; // expected-error{{assigning to 'void (map::*)()' from incompatible type 'void (map::*)()': different classes ('map' vs 'map')}} + + void (*C)(map); + void (*D)(map); + C = D; // expected-error{{assigning to 'void (*)(map)' from incompatible type 'void (*)(map)': type mismatch at 1st parameter ('map<[...], int>' vs 'map<[...], double>')}} + + map (*E)(); + map (*F)(); + E = F; // expected-error{{assigning to 'map (*)()' from incompatible type 'map (*)()': different return type ('map<[...], float>' vs 'map<[...], double>')}} +} Index: test/Misc/template-type-diffing/15.cpp =================================================================== --- test/Misc/template-type-diffing/15.cpp +++ test/Misc/template-type-diffing/15.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//err_typecheck_cond_incompatible_operands + +template struct map { }; + +void foo(bool cond, map a, map b) { + (void)(cond ? a : b); // expected-error {{incompatible operand types ('map<[...], int>' and 'map<[...], double>')}} +} Index: test/Misc/template-type-diffing/2.cpp =================================================================== --- test/Misc/template-type-diffing/2.cpp +++ test/Misc/template-type-diffing/2.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +// err_init_conversion_failed + +template class map{ public: void test(); }; + +map A() { return map(); } +map (*B)() = A; // expected-error{{cannot initialize a variable of type 'map (*)()' with an lvalue of type 'map ()': different return type ('map<[...], void>' vs 'map<[...], int>')}} + +void C(int, map) {} +void (*D)(int, map) = C; // expected-error{{cannot initialize a variable of type 'void (*)(int, map)' with an lvalue of type 'void (int, map)': type mismatch at 2nd parameter ('map<[...], double>' vs 'map<[...], float>')}} + +void (map::*E)() = &map::test; // expected-error{{cannot initialize a variable of type 'void (map::*)()' with an rvalue of type 'void (map::*)()': different classes ('map<[...], int>' vs 'map<[...], double>')}} Index: test/Misc/template-type-diffing/2.mm =================================================================== --- test/Misc/template-type-diffing/2.mm +++ test/Misc/template-type-diffing/2.mm @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 %s -Woverriding-method-mismatch -fsyntax-only -verify + +template class map{}; + +// warn_conflicting_overriding_ret_types +@protocol Bar +@required +- (map) f1; // expected-note {{previous declaration is here}} +@end + +@interface Bar +- (map) f1; // expected-warning {{conflicting return type in declaration of 'f1': 'map<[...], double>' vs 'map<[...], float>'}} +@end + +// warn_conflicting_overriding_param_types +@protocol Baz +- (void) bar : (map)arg; // expected-note {{previous declaration is here}} +@end + +@interface Foo +- (void) bar : (map)arg; // expected-warning {{conflicting parameter types in declaration of 'bar:': 'map' vs 'map'}} +@end + Index: test/Misc/template-type-diffing/3.cpp =================================================================== --- test/Misc/template-type-diffing/3.cpp +++ test/Misc/template-type-diffing/3.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +// err_lvalue_reference_bind_to_unrelated + +template class map{}; + +map A; +map &B = A; // expected-error{{non-const lvalue reference to type 'map' cannot bind to a value of unrelated type 'map'}} Index: test/Misc/template-type-diffing/3.mm =================================================================== --- test/Misc/template-type-diffing/3.mm +++ test/Misc/template-type-diffing/3.mm @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +// warn_conflicting_ret_types + +template class map{}; + +@interface Bar +- (map) f1; // expected-note{{previous definition is here}} +@end + +@implementation Bar +- (map) f1 { // expected-warning {{conflicting return type in implementation of 'f1': 'map<[...], double>' vs 'map<[...], float>'}} + return map(); + } +@end + +// warn_conflicting_param_types + +@interface A +@property map moo; // expected-note {{previous definition is here}} +@end + +@implementation A +-(map) moo { + return map(); +} +-(void) setMoo: (map) x { // expected-warning {{conflicting parameter types in implementation of 'setMoo:': 'map<[...], double>' vs 'map<[...], int>'}} +} +@end + Index: test/Misc/template-type-diffing/4.cpp =================================================================== --- test/Misc/template-type-diffing/4.cpp +++ test/Misc/template-type-diffing/4.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//note_ovl_candidate + +template class map {}; + +map foo(map); // expected-note {{candidate function has different return type ('map<[...], int>' expected but has 'map<[...], void>')}} +map foo(map); // expected-note {{candidate function has type mismatch at 1st parameter (expected 'map' but has 'map')}} + +map (*bar)(map) = foo; // expected-error {{address of overloaded function 'foo' does not match required type 'map (map)'}} Index: test/Misc/template-type-diffing/5.cpp =================================================================== --- test/Misc/template-type-diffing/5.cpp +++ test/Misc/template-type-diffing/5.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//note_ovl_candidate_inconsistent_deduction + +template class map {}; +template void foo(T, T); // expected-note{{candidate template ignored: deduced conflicting types for parameter 'T' ('map<[...], int>' vs. 'map<[...], double>')}} + +void test(map A, map B) { + foo(A, B); // expected-error{{no matching function for call to 'foo'}} +} + Index: test/Misc/template-type-diffing/6.cpp =================================================================== --- test/Misc/template-type-diffing/6.cpp +++ test/Misc/template-type-diffing/6.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +// err_ovl_no_viable_conversion_in_cast + +template class map { // expected-note 2{{candidate constructor}} + void foo(T t) { + (void)U(t); // expected-error {{no matching conversion for functional-style cast from 'map' to 'map'}} + } +}; +struct A {}; +template class map, map >; // expected-note {{in instantiation of member function}} Index: test/Misc/template-type-diffing/7.cpp =================================================================== --- test/Misc/template-type-diffing/7.cpp +++ test/Misc/template-type-diffing/7.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++11 +//err_redefinition_different_typedef + +template class map {}; +namespace foo { + using M = map; // expected-note {{previous definition is here}} + using M = map; // expected-error {{type alias redefinition with different types ('map<[...], double>' vs 'map<[...], int>')}} +} Index: test/Misc/template-type-diffing/8.cpp =================================================================== --- test/Misc/template-type-diffing/8.cpp +++ test/Misc/template-type-diffing/8.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//note_member_def_close_param_match + +template class map {}; +namespace foo { + void f(map F); // expected-note {{type of 1st parameter of member declaration does not match definition ('map<[...], double>' vs 'map<[...], float>')}} +} + +void foo::f(map F) { } // expected-error {{out-of-line definition of 'f' does not match any declaration in namespace 'foo'}} Index: test/Misc/template-type-diffing/9.cpp =================================================================== --- test/Misc/template-type-diffing/9.cpp +++ test/Misc/template-type-diffing/9.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +//err_typecheck_invalid_operands + +template class map {}; +void foo() { + map() + map(); // expected-error {{invalid operands to binary expression ('map' and 'map')}} + map() + map(); // expected-error {{invalid operands to binary expression ('map<[2 * ...]>' and 'map<[2 * ...]>')}} +}