1//==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Semantic Analysis
11//===----------------------------------------------------------------------===//
12
13let Component = "Sema" in {
14let CategoryName = "Semantic Issue" in {
15def note_previous_decl : Note<"%0 declared here">;
16def note_entity_declared_at : Note<"%0 declared here">;
17def note_callee_decl : Note<"%0 declared here">;
18def note_defined_here : Note<"%0 defined here">;
19
20// For loop analysis
21def warn_variables_not_in_loop_body : Warning<
22  "variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 "
23  "used in loop condition not modified in loop body">,
24  InGroup<ForLoopAnalysis>, DefaultIgnore;
25def warn_redundant_loop_iteration : Warning<
26  "variable %0 is %select{decremented|incremented}1 both in the loop header "
27  "and in the loop body">,
28  InGroup<ForLoopAnalysis>, DefaultIgnore;
29def note_loop_iteration_here : Note<"%select{decremented|incremented}0 here">;
30
31def warn_duplicate_enum_values : Warning<
32  "element %0 has been implicitly assigned %1 which another element has "
33  "been assigned">, InGroup<DiagGroup<"duplicate-enum">>, DefaultIgnore;
34def note_duplicate_element : Note<"element %0 also has value %1">;
35
36// Absolute value functions
37def warn_unsigned_abs : Warning<
38  "taking the absolute value of unsigned type %0 has no effect">,
39  InGroup<AbsoluteValue>;
40def note_remove_abs : Note<
41  "remove the call to '%0' since unsigned values cannot be negative">;
42def warn_abs_too_small : Warning<
43  "absolute value function %0 given an argument of type %1 but has parameter "
44  "of type %2 which may cause truncation of value">, InGroup<AbsoluteValue>;
45def warn_wrong_absolute_value_type : Warning<
46  "using %select{integer|floating point|complex}1 absolute value function %0 "
47  "when argument is of %select{integer|floating point|complex}2 type">,
48  InGroup<AbsoluteValue>;
49def note_replace_abs_function : Note<"use function '%0' instead">;
50def warn_pointer_abs : Warning<
51  "taking the absolute value of %select{pointer|function|array}0 type %1 is suspicious">,
52  InGroup<AbsoluteValue>;
53
54def warn_max_unsigned_zero : Warning<
55  "taking the max of "
56  "%select{a value and unsigned zero|unsigned zero and a value}0 "
57  "is always equal to the other value">,
58  InGroup<MaxUnsignedZero>;
59def note_remove_max_call : Note<
60  "remove call to max function and unsigned zero argument">;
61
62def warn_infinite_recursive_function : Warning<
63  "all paths through this function will call itself">,
64  InGroup<InfiniteRecursion>, DefaultIgnore;
65
66def warn_comma_operator : Warning<"possible misuse of comma operator here">,
67  InGroup<DiagGroup<"comma">>, DefaultIgnore;
68def note_cast_to_void : Note<"cast expression to void to silence warning">;
69
70// Constant expressions
71def err_expr_not_ice : Error<
72  "expression is not an %select{integer|integral}0 constant expression">;
73def ext_expr_not_ice : Extension<
74  "expression is not an %select{integer|integral}0 constant expression; "
75  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
76def err_typecheck_converted_constant_expression : Error<
77  "value of type %0 is not implicitly convertible to %1">;
78def err_typecheck_converted_constant_expression_disallowed : Error<
79  "conversion from %0 to %1 is not allowed in a converted constant expression">;
80def err_typecheck_converted_constant_expression_indirect : Error<
81  "conversion from %0 to %1 in converted constant expression would "
82  "bind reference to a temporary">;
83def err_expr_not_cce : Error<
84  "%select{case value|enumerator value|non-type template argument|"
85  "array size|constexpr if condition|explicit specifier argument}0 "
86  "is not a constant expression">;
87def ext_cce_narrowing : ExtWarn<
88  "%select{case value|enumerator value|non-type template argument|"
89  "array size|constexpr if condition|explicit specifier argument}0 "
90  "%select{cannot be narrowed from type %2 to %3|"
91  "evaluates to %2, which cannot be narrowed to type %3}1">,
92  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
93def err_ice_not_integral : Error<
94  "%select{integer|integral}1 constant expression must have "
95  "%select{integer|integral or unscoped enumeration}1 type, not %0">;
96def err_ice_incomplete_type : Error<
97  "integral constant expression has incomplete class type %0">;
98def err_ice_explicit_conversion : Error<
99  "integral constant expression requires explicit conversion from %0 to %1">;
100def note_ice_conversion_here : Note<
101  "conversion to %select{integral|enumeration}0 type %1 declared here">;
102def err_ice_ambiguous_conversion : Error<
103  "ambiguous conversion from type %0 to an integral or unscoped "
104  "enumeration type">;
105def err_ice_too_large : Error<
106  "integer constant expression evaluates to value %0 that cannot be "
107  "represented in a %1-bit %select{signed|unsigned}2 integer type">;
108def err_expr_not_string_literal : Error<"expression is not a string literal">;
109
110// Semantic analysis of constant literals.
111def ext_predef_outside_function : Warning<
112  "predefined identifier is only valid inside function">,
113  InGroup<DiagGroup<"predefined-identifier-outside-function">>;
114def warn_float_overflow : Warning<
115  "magnitude of floating-point constant too large for type %0; maximum is %1">,
116   InGroup<LiteralRange>;
117def warn_float_underflow : Warning<
118  "magnitude of floating-point constant too small for type %0; minimum is %1">,
119  InGroup<LiteralRange>;
120def warn_double_const_requires_fp64 : Warning<
121  "double precision constant requires cl_khr_fp64, casting to single precision">;
122def err_half_const_requires_fp16 : Error<
123  "half precision constant requires cl_khr_fp16">;
124
125// C99 variable-length arrays
126def ext_vla : Extension<"variable length arrays are a C99 feature">,
127  InGroup<VLAExtension>;
128def warn_vla_used : Warning<"variable length array used">,
129  InGroup<VLA>, DefaultIgnore;
130def err_vla_in_sfinae : Error<
131  "variable length array cannot be formed during template argument deduction">;
132def err_array_star_in_function_definition : Error<
133  "variable length array must be bound in function definition">;
134def err_vla_decl_in_file_scope : Error<
135  "variable length array declaration not allowed at file scope">;
136def err_vla_decl_has_static_storage : Error<
137  "variable length array declaration cannot have 'static' storage duration">;
138def err_vla_decl_has_extern_linkage : Error<
139  "variable length array declaration cannot have 'extern' linkage">;
140def ext_vla_folded_to_constant : ExtWarn<
141  "variable length array folded to constant array as an extension">,
142  InGroup<GNUFoldingConstant>;
143def err_vla_unsupported : Error<
144  "variable length arrays are not supported for the current target">;
145def note_vla_unsupported : Note<
146  "variable length arrays are not supported for the current target">;
147
148// C99 variably modified types
149def err_variably_modified_template_arg : Error<
150  "variably modified type %0 cannot be used as a template argument">;
151def err_variably_modified_nontype_template_param : Error<
152  "non-type template parameter of variably modified type %0">;
153def err_variably_modified_new_type : Error<
154  "'new' cannot allocate object of variably modified type %0">;
155
156// C99 Designated Initializers
157def ext_designated_init : Extension<
158  "designated initializers are a C99 feature">, InGroup<C99Designator>;
159def err_array_designator_negative : Error<
160  "array designator value '%0' is negative">;
161def err_array_designator_empty_range : Error<
162  "array designator range [%0, %1] is empty">;
163def err_array_designator_non_array : Error<
164  "array designator cannot initialize non-array type %0">;
165def err_array_designator_too_large : Error<
166  "array designator index (%0) exceeds array bounds (%1)">;
167def err_field_designator_non_aggr : Error<
168  "field designator cannot initialize a "
169  "%select{non-struct, non-union|non-class}0 type %1">;
170def err_field_designator_unknown : Error<
171  "field designator %0 does not refer to any field in type %1">;
172def err_field_designator_nonfield : Error<
173  "field designator %0 does not refer to a non-static data member">;
174def note_field_designator_found : Note<"field designator refers here">;
175def err_designator_for_scalar_or_sizeless_init : Error<
176  "designator in initializer for %select{scalar|indivisible sizeless}0 "
177  "type %1">;
178def warn_initializer_overrides : Warning<
179  "initializer %select{partially |}0overrides prior initialization of "
180  "this subobject">, InGroup<InitializerOverrides>;
181def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Text>,
182  InGroup<InitializerOverrides>, SFINAEFailure;
183def err_initializer_overrides_destructed : Error<
184  "initializer would partially override prior initialization of object of "
185  "type %1 with non-trivial destruction">;
186def note_previous_initializer : Note<
187  "previous initialization %select{|with side effects }0is here"
188  "%select{| (side effects will not occur at run time)}0">;
189def err_designator_into_flexible_array_member : Error<
190  "designator into flexible array member subobject">;
191def note_flexible_array_member : Note<
192  "initialized flexible array member %0 is here">;
193def ext_flexible_array_init : Extension<
194  "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
195
196// C++20 designated initializers
197def ext_cxx_designated_init : Extension<
198  "designated initializers are a C++20 extension">, InGroup<CXX20Designator>;
199def warn_cxx17_compat_designated_init : Warning<
200  "designated initializers are incompatible with C++ standards before C++20">,
201  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
202def ext_designated_init_mixed : ExtWarn<
203  "mixture of designated and non-designated initializers in the same "
204  "initializer list is a C99 extension">, InGroup<C99Designator>;
205def note_designated_init_mixed : Note<
206  "first non-designated initializer is here">;
207def ext_designated_init_array : ExtWarn<
208  "array designators are a C99 extension">, InGroup<C99Designator>;
209def ext_designated_init_nested : ExtWarn<
210  "nested designators are a C99 extension">, InGroup<C99Designator>;
211def ext_designated_init_reordered : ExtWarn<
212  "ISO C++ requires field designators to be specified in declaration order; "
213  "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
214  SFINAEFailure;
215def note_previous_field_init : Note<
216  "previous initialization for field %0 is here">;
217
218// Declarations.
219def ext_plain_complex : ExtWarn<
220  "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
221def ext_imaginary_constant : Extension<
222  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
223def ext_integer_complex : Extension<
224  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
225
226def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
227  "'_Fract' or '_Accum', not '%0'">;
228def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
229def err_invalid_width_spec : Error<
230  "'%select{|short|long|long long}0 %1' is invalid">;
231def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
232
233def ext_auto_type_specifier : ExtWarn<
234  "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
235def warn_auto_storage_class : Warning<
236  "'auto' storage class specifier is redundant and incompatible with C++11">,
237  InGroup<CXX11Compat>, DefaultIgnore;
238
239def warn_deprecated_register : Warning<
240  "'register' storage class specifier is deprecated "
241  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
242def ext_register_storage_class : ExtWarn<
243  "ISO C++17 does not allow 'register' storage class specifier">,
244  DefaultError, InGroup<Register>;
245
246def err_invalid_decl_spec_combination : Error<
247  "cannot combine with previous '%0' declaration specifier">;
248def err_invalid_vector_decl_spec_combination : Error<
249  "cannot combine with previous '%0' declaration specifier. "
250  "'__vector' must be first">;
251def err_invalid_pixel_decl_spec_combination : Error<
252  "'__pixel' must be preceded by '__vector'.  "
253  "'%0' declaration specifier not allowed here">;
254def err_invalid_vector_bool_decl_spec : Error<
255  "cannot use '%0' with '__vector bool'">;
256def err_invalid_vector_long_decl_spec : Error<
257  "cannot use 'long' with '__vector'">;
258def err_invalid_vector_float_decl_spec : Error<
259  "cannot use 'float' with '__vector'">;
260def err_invalid_vector_double_decl_spec : Error <
261  "use of 'double' with '__vector' requires VSX support to be enabled "
262  "(available on POWER7 or later)">;
263def err_invalid_vector_bool_int128_decl_spec : Error <
264  "use of '__int128' with '__vector bool' requires VSX support enabled (on "
265  "POWER10 or later)">;
266def err_invalid_vector_long_long_decl_spec : Error <
267  "use of 'long long' with '__vector bool' requires VSX support (available on "
268  "POWER7 or later) or extended Altivec support (available on POWER8 or later) "
269  "to be enabled">;
270def err_invalid_vector_long_double_decl_spec : Error<
271  "cannot use 'long double' with '__vector'">;
272def warn_vector_long_decl_spec_combination : Warning<
273  "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
274
275def err_redeclaration_different_type : Error<
276  "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
277def err_bad_variable_name : Error<
278  "%0 cannot be the name of a variable or data member">;
279def err_bad_parameter_name : Error<
280  "%0 cannot be the name of a parameter">;
281def err_bad_parameter_name_template_id : Error<
282  "parameter name cannot have template arguments">;
283def ext_parameter_name_omitted_c2x : ExtWarn<
284  "omitting the parameter name in a function definition is a C2x extension">,
285  InGroup<C2x>;
286def err_anyx86_interrupt_attribute : Error<
287  "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
288  "have %select{a 'void' return type|"
289  "only a pointer parameter optionally followed by an integer parameter|"
290  "a pointer as the first parameter|a %2 type as the second parameter}1">;
291def err_anyx86_interrupt_called : Error<
292  "interrupt service routine cannot be called directly">;
293def warn_arm_interrupt_calling_convention : Warning<
294   "call to function without interrupt attribute could clobber interruptee's VFP registers">,
295   InGroup<Extra>;
296def warn_interrupt_attribute_invalid : Warning<
297   "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
298   "functions that have %select{no parameters|a 'void' return type}1">,
299   InGroup<IgnoredAttributes>;
300def warn_riscv_repeated_interrupt_attribute : Warning<
301  "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
302def note_riscv_repeated_interrupt_attribute : Note<
303  "repeated RISC-V 'interrupt' attribute is here">;
304def warn_unused_parameter : Warning<"unused parameter %0">,
305  InGroup<UnusedParameter>, DefaultIgnore;
306def warn_unused_variable : Warning<"unused variable %0">,
307  InGroup<UnusedVariable>, DefaultIgnore;
308def warn_unused_local_typedef : Warning<
309  "unused %select{typedef|type alias}0 %1">,
310  InGroup<UnusedLocalTypedef>, DefaultIgnore;
311def warn_unused_property_backing_ivar :
312  Warning<"ivar %0 which backs the property is not "
313  "referenced in this property's accessor">,
314  InGroup<UnusedPropertyIvar>, DefaultIgnore;
315def warn_unused_const_variable : Warning<"unused variable %0">,
316  InGroup<UnusedConstVariable>, DefaultIgnore;
317def warn_unused_exception_param : Warning<"unused exception parameter %0">,
318  InGroup<UnusedExceptionParameter>, DefaultIgnore;
319def warn_decl_in_param_list : Warning<
320  "declaration of %0 will not be visible outside of this function">,
321  InGroup<Visibility>;
322def warn_redefinition_in_param_list : Warning<
323  "redefinition of %0 will not be visible outside of this function">,
324  InGroup<Visibility>;
325def warn_empty_parens_are_function_decl : Warning<
326  "empty parentheses interpreted as a function declaration">,
327  InGroup<VexingParse>;
328def warn_parens_disambiguated_as_function_declaration : Warning<
329  "parentheses were disambiguated as a function declaration">,
330  InGroup<VexingParse>;
331def warn_parens_disambiguated_as_variable_declaration : Warning<
332  "parentheses were disambiguated as redundant parentheses around declaration "
333  "of variable named %0">, InGroup<VexingParse>;
334def warn_redundant_parens_around_declarator : Warning<
335  "redundant parentheses surrounding declarator">,
336  InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
337def note_additional_parens_for_variable_declaration : Note<
338  "add a pair of parentheses to declare a variable">;
339def note_raii_guard_add_name : Note<
340  "add a variable name to declare a %0 initialized with %1">;
341def note_function_style_cast_add_parentheses : Note<
342  "add enclosing parentheses to perform a function-style cast">;
343def note_remove_parens_for_variable_declaration : Note<
344  "remove parentheses to silence this warning">;
345def note_empty_parens_function_call : Note<
346  "change this ',' to a ';' to call %0">;
347def note_empty_parens_default_ctor : Note<
348  "remove parentheses to declare a variable">;
349def note_empty_parens_zero_initialize : Note<
350  "replace parentheses with an initializer to declare a variable">;
351def warn_unused_function : Warning<"unused function %0">,
352  InGroup<UnusedFunction>, DefaultIgnore;
353def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
354  InGroup<UnusedTemplate>, DefaultIgnore;
355def warn_unused_member_function : Warning<"unused member function %0">,
356  InGroup<UnusedMemberFunction>, DefaultIgnore;
357def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
358  InGroup<UsedButMarkedUnused>, DefaultIgnore;
359def warn_unneeded_internal_decl : Warning<
360  "%select{function|variable}0 %1 is not needed and will not be emitted">,
361  InGroup<UnneededInternalDecl>, DefaultIgnore;
362def warn_unneeded_static_internal_decl : Warning<
363  "'static' function %0 declared in header file "
364  "should be declared 'static inline'">,
365  InGroup<UnneededInternalDecl>, DefaultIgnore;
366def warn_unneeded_member_function : Warning<
367  "member function %0 is not needed and will not be emitted">,
368  InGroup<UnneededMemberFunction>, DefaultIgnore;
369def warn_unused_private_field: Warning<"private field %0 is not used">,
370  InGroup<UnusedPrivateField>, DefaultIgnore;
371def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
372  "%select{used|required to be captured for this use}1">,
373  InGroup<UnusedLambdaCapture>, DefaultIgnore;
374
375def warn_parameter_size: Warning<
376  "%0 is a large (%1 bytes) pass-by-value argument; "
377  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
378def warn_return_value_size: Warning<
379  "return value of %0 is a large (%1 bytes) pass-by-value object; "
380  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
381def warn_return_value_udt: Warning<
382  "%0 has C-linkage specified, but returns user-defined type %1 which is "
383  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
384def warn_return_value_udt_incomplete: Warning<
385  "%0 has C-linkage specified, but returns incomplete type %1 which could be "
386  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
387def warn_implicit_function_decl : Warning<
388  "implicit declaration of function %0">,
389  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
390def ext_implicit_function_decl : ExtWarn<
391  "implicit declaration of function %0 is invalid in C99">,
392  InGroup<ImplicitFunctionDeclare>;
393def note_function_suggestion : Note<"did you mean %0?">;
394
395def err_ellipsis_first_param : Error<
396  "ISO C requires a named parameter before '...'">;
397def err_declarator_need_ident : Error<"declarator requires an identifier">;
398def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
399def err_language_linkage_spec_not_ascii : Error<
400  "string literal in language linkage specifier cannot have an "
401  "encoding-prefix">;
402def ext_use_out_of_scope_declaration : ExtWarn<
403  "use of out-of-scope declaration of %0%select{| whose type is not "
404  "compatible with that of an implicit declaration}1">,
405  InGroup<DiagGroup<"out-of-scope-function">>;
406def err_inline_non_function : Error<
407  "'inline' can only appear on functions%select{| and non-local variables}0">;
408def err_noreturn_non_function : Error<
409  "'_Noreturn' can only appear on functions">;
410def warn_qual_return_type : Warning<
411  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
412  InGroup<IgnoredQualifiers>, DefaultIgnore;
413def warn_deprecated_redundant_constexpr_static_def : Warning<
414  "out-of-line definition of constexpr static data member is redundant "
415  "in C++17 and is deprecated">,
416  InGroup<Deprecated>, DefaultIgnore;
417
418def warn_decl_shadow :
419  Warning<"declaration shadows a %select{"
420          "local variable|"
421          "variable in %2|"
422          "static data member of %2|"
423          "field of %2|"
424          "typedef in %2|"
425          "type alias in %2}1">,
426  InGroup<Shadow>, DefaultIgnore;
427def warn_decl_shadow_uncaptured_local :
428  Warning<warn_decl_shadow.Text>,
429  InGroup<ShadowUncapturedLocal>, DefaultIgnore;
430def warn_ctor_parm_shadows_field:
431  Warning<"constructor parameter %0 shadows the field %1 of %2">,
432  InGroup<ShadowFieldInConstructor>, DefaultIgnore;
433def warn_modifying_shadowing_decl :
434  Warning<"modifying constructor parameter %0 that shadows a "
435          "field of %1">,
436  InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
437
438// C++ decomposition declarations
439def err_decomp_decl_context : Error<
440  "decomposition declaration not permitted in this context">;
441def warn_cxx14_compat_decomp_decl : Warning<
442  "decomposition declarations are incompatible with "
443  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
444def ext_decomp_decl : ExtWarn<
445  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
446def ext_decomp_decl_cond : ExtWarn<
447  "ISO C++17 does not permit structured binding declaration in a condition">,
448  InGroup<DiagGroup<"binding-in-condition">>;
449def err_decomp_decl_spec : Error<
450  "decomposition declaration cannot be declared "
451  "%plural{1:'%1'|:with '%1' specifiers}0">;
452def ext_decomp_decl_spec : ExtWarn<
453  "decomposition declaration declared "
454  "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
455  InGroup<CXX20>;
456def warn_cxx17_compat_decomp_decl_spec : Warning<
457  "decomposition declaration declared "
458  "%plural{1:'%1'|:with '%1' specifiers}0 "
459  "is incompatible with C++ standards before C++20">,
460  InGroup<CXXPre20Compat>, DefaultIgnore;
461def err_decomp_decl_type : Error<
462  "decomposition declaration cannot be declared with type %0; "
463  "declared type must be 'auto' or reference to 'auto'">;
464def err_decomp_decl_parens : Error<
465  "decomposition declaration cannot be declared with parentheses">;
466def err_decomp_decl_template : Error<
467  "decomposition declaration template not supported">;
468def err_decomp_decl_not_alone : Error<
469  "decomposition declaration must be the only declaration in its group">;
470def err_decomp_decl_requires_init : Error<
471  "decomposition declaration %0 requires an initializer">;
472def err_decomp_decl_wrong_number_bindings : Error<
473  "type %0 decomposes into %2 elements, but %select{only |}3%1 "
474  "names were provided">;
475def err_decomp_decl_unbindable_type : Error<
476  "cannot decompose %select{union|non-class, non-array}1 type %2">;
477def err_decomp_decl_multiple_bases_with_members : Error<
478  "cannot decompose class type %1: "
479  "%select{its base classes %2 and|both it and its base class}0 %3 "
480  "have non-static data members">;
481def err_decomp_decl_ambiguous_base : Error<
482  "cannot decompose members of ambiguous base class %1 of %0:%2">;
483def err_decomp_decl_inaccessible_base : Error<
484  "cannot decompose members of inaccessible base class %1 of %0">,
485  AccessControl;
486def err_decomp_decl_inaccessible_field : Error<
487  "cannot decompose %select{private|protected}0 member %1 of %3">,
488  AccessControl;
489def err_decomp_decl_lambda : Error<
490  "cannot decompose lambda closure type">;
491def err_decomp_decl_anon_union_member : Error<
492  "cannot decompose class type %0 because it has an anonymous "
493  "%select{struct|union}1 member">;
494def err_decomp_decl_std_tuple_element_not_specialized : Error<
495  "cannot decompose this type; 'std::tuple_element<%0>::type' "
496  "does not name a type">;
497def err_decomp_decl_std_tuple_size_not_constant : Error<
498  "cannot decompose this type; 'std::tuple_size<%0>::value' "
499  "is not a valid integral constant expression">;
500def note_in_binding_decl_init : Note<
501  "in implicit initialization of binding declaration %0">;
502
503def err_std_type_trait_not_class_template : Error<
504  "unsupported standard library implementation: "
505  "'std::%0' is not a class template">;
506
507// C++ using declarations
508def err_using_requires_qualname : Error<
509  "using declaration requires a qualified name">;
510def err_using_typename_non_type : Error<
511  "'typename' keyword used on a non-type">;
512def err_using_dependent_value_is_type : Error<
513  "dependent using declaration resolved to type without 'typename'">;
514def err_using_decl_nested_name_specifier_is_not_class : Error<
515  "using declaration in class refers into '%0', which is not a class">;
516def err_using_decl_nested_name_specifier_is_current_class : Error<
517  "using declaration refers to its own class">;
518def err_using_decl_nested_name_specifier_is_not_base_class : Error<
519  "using declaration refers into '%0', which is not a base class of %1">;
520def err_using_decl_constructor_not_in_direct_base : Error<
521  "%0 is not a direct base of %1, cannot inherit constructors">;
522def err_using_decl_can_not_refer_to_class_member : Error<
523  "using declaration cannot refer to class member">;
524def err_ambiguous_inherited_constructor : Error<
525  "constructor of %0 inherited from multiple base class subobjects">;
526def note_ambiguous_inherited_constructor_using : Note<
527  "inherited from base class %0 here">;
528def note_using_decl_class_member_workaround : Note<
529  "use %select{an alias declaration|a typedef declaration|a reference|"
530  "a const variable|a constexpr variable}0 instead">;
531def err_using_decl_can_not_refer_to_namespace : Error<
532  "using declaration cannot refer to a namespace">;
533def err_using_decl_can_not_refer_to_scoped_enum : Error<
534  "using declaration cannot refer to a scoped enumerator">;
535def err_using_decl_constructor : Error<
536  "using declaration cannot refer to a constructor">;
537def warn_cxx98_compat_using_decl_constructor : Warning<
538  "inheriting constructors are incompatible with C++98">,
539  InGroup<CXX98Compat>, DefaultIgnore;
540def err_using_decl_destructor : Error<
541  "using declaration cannot refer to a destructor">;
542def err_using_decl_template_id : Error<
543  "using declaration cannot refer to a template specialization">;
544def note_using_decl_target : Note<"target of using declaration">;
545def note_using_decl_conflict : Note<"conflicting declaration">;
546def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
547def err_using_decl_conflict : Error<
548  "target of using declaration conflicts with declaration already in scope">;
549def err_using_decl_conflict_reverse : Error<
550  "declaration conflicts with target of using declaration already in scope">;
551def note_using_decl : Note<"%select{|previous }0using declaration">;
552def err_using_decl_redeclaration_expansion : Error<
553  "using declaration pack expansion at block scope produces multiple values">;
554
555def warn_access_decl_deprecated : Warning<
556  "access declarations are deprecated; use using declarations instead">,
557  InGroup<Deprecated>;
558def err_access_decl : Error<
559  "ISO C++11 does not allow access declarations; "
560  "use using declarations instead">;
561def warn_deprecated_copy_operation : Warning<
562  "definition of implicit copy %select{constructor|assignment operator}1 "
563  "for %0 is deprecated because it has a user-declared copy "
564  "%select{assignment operator|constructor}1">,
565  InGroup<DeprecatedCopy>, DefaultIgnore;
566def warn_deprecated_copy_dtor_operation : Warning<
567  "definition of implicit copy %select{constructor|assignment operator}1 "
568  "for %0 is deprecated because it has a user-declared destructor">,
569  InGroup<DeprecatedCopyDtor>, DefaultIgnore;
570def warn_cxx17_compat_exception_spec_in_signature : Warning<
571  "mangled name of %0 will change in C++17 due to non-throwing exception "
572  "specification in function signature">, InGroup<CXX17CompatMangling>;
573
574def warn_global_constructor : Warning<
575  "declaration requires a global constructor">,
576  InGroup<GlobalConstructors>, DefaultIgnore;
577def warn_global_destructor : Warning<
578  "declaration requires a global destructor">,
579   InGroup<GlobalConstructors>, DefaultIgnore;
580def warn_exit_time_destructor : Warning<
581  "declaration requires an exit-time destructor">,
582  InGroup<ExitTimeDestructors>, DefaultIgnore;
583
584def err_invalid_thread : Error<
585  "'%0' is only allowed on variable declarations">;
586def err_thread_non_global : Error<
587  "'%0' variables must have global storage">;
588def err_thread_unsupported : Error<
589  "thread-local storage is not supported for the current target">;
590
591// FIXME: Combine fallout warnings to just one warning.
592def warn_maybe_falloff_nonvoid_function : Warning<
593  "non-void function does not return a value in all control paths">,
594  InGroup<ReturnType>;
595def warn_falloff_nonvoid_function : Warning<
596  "non-void function does not return a value">,
597  InGroup<ReturnType>;
598def err_maybe_falloff_nonvoid_block : Error<
599  "non-void block does not return a value in all control paths">;
600def err_falloff_nonvoid_block : Error<
601  "non-void block does not return a value">;
602def warn_maybe_falloff_nonvoid_coroutine : Warning<
603  "non-void coroutine does not return a value in all control paths">,
604  InGroup<ReturnType>;
605def warn_falloff_nonvoid_coroutine : Warning<
606  "non-void coroutine does not return a value">,
607  InGroup<ReturnType>;
608def warn_suggest_noreturn_function : Warning<
609  "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
610  InGroup<MissingNoreturn>, DefaultIgnore;
611def warn_suggest_noreturn_block : Warning<
612  "block could be declared with attribute 'noreturn'">,
613  InGroup<MissingNoreturn>, DefaultIgnore;
614
615// Unreachable code.
616def warn_unreachable : Warning<
617  "code will never be executed">,
618  InGroup<UnreachableCode>, DefaultIgnore;
619def warn_unreachable_break : Warning<
620  "'break' will never be executed">,
621  InGroup<UnreachableCodeBreak>, DefaultIgnore;
622def warn_unreachable_return : Warning<
623  "'return' will never be executed">,
624  InGroup<UnreachableCodeReturn>, DefaultIgnore;
625def warn_unreachable_loop_increment : Warning<
626  "loop will run at most once (loop increment never executed)">,
627  InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
628def note_unreachable_silence : Note<
629  "silence by adding parentheses to mark code as explicitly dead">;
630
631/// Built-in functions.
632def ext_implicit_lib_function_decl : ExtWarn<
633  "implicitly declaring library function '%0' with type %1">,
634  InGroup<ImplicitFunctionDeclare>;
635def note_include_header_or_declare : Note<
636  "include the header <%0> or explicitly provide a declaration for '%1'">;
637def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
638def warn_implicit_decl_no_jmp_buf
639    : Warning<"declaration of built-in function '%0' requires the declaration"
640    " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
641      InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
642def warn_implicit_decl_requires_sysheader : Warning<
643  "declaration of built-in function '%1' requires inclusion of the header <%0>">,
644  InGroup<BuiltinRequiresHeader>;
645def warn_redecl_library_builtin : Warning<
646  "incompatible redeclaration of library function %0">,
647  InGroup<DiagGroup<"incompatible-library-redeclaration">>;
648def err_builtin_definition : Error<"definition of builtin function %0">;
649def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
650def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
651def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
652  "%select{GCP|CDE}1">;
653def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
654def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
655def err_invalid_cpu_specific_dispatch_value : Error<
656"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
657def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
658  InGroup<ImplicitFunctionDeclare>, DefaultError;
659def warn_cstruct_memaccess : Warning<
660  "%select{destination for|source of|first operand of|second operand of}0 this "
661  "%1 call is a pointer to record %2 that is not trivial to "
662  "%select{primitive-default-initialize|primitive-copy}3">,
663  InGroup<NonTrivialMemaccess>;
664def note_nontrivial_field : Note<
665  "field is non-trivial to %select{copy|default-initialize}0">;
666def err_non_trivial_c_union_in_invalid_context : Error<
667  "cannot %select{"
668  "use type %1 for a function/method parameter|"
669  "use type %1 for function/method return|"
670  "default-initialize an object of type %1|"
671  "declare an automatic variable of type %1|"
672  "copy-initialize an object of type %1|"
673  "assign to a variable of type %1|"
674  "construct an automatic compound literal of type %1|"
675  "capture a variable of type %1|"
676  "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
677  "}3 "
678  "since it %select{contains|is}2 a union that is non-trivial to "
679  "%select{default-initialize|destruct|copy}0">;
680def note_non_trivial_c_union : Note<
681  "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
682  "non-trivial to %select{default-initialize|destruct|copy}1">;
683def warn_dyn_class_memaccess : Warning<
684  "%select{destination for|source of|first operand of|second operand of}0 this "
685  "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
686  "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
687  InGroup<DynamicClassMemaccess>;
688def note_bad_memaccess_silence : Note<
689  "explicitly cast the pointer to silence this warning">;
690def warn_sizeof_pointer_expr_memaccess : Warning<
691  "'%0' call operates on objects of type %1 while the size is based on a "
692  "different type %2">,
693  InGroup<SizeofPointerMemaccess>;
694def warn_sizeof_pointer_expr_memaccess_note : Note<
695  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
696  "it by the number of elements)|remove the addressof in the argument to "
697  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
698  "length}0?">;
699def warn_sizeof_pointer_type_memaccess : Warning<
700  "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
701  "%select{destination|source}2; expected %3 or an explicit length">,
702  InGroup<SizeofPointerMemaccess>;
703def warn_strlcpycat_wrong_size : Warning<
704  "size argument in %0 call appears to be size of the source; "
705  "expected the size of the destination">,
706  InGroup<DiagGroup<"strlcpy-strlcat-size">>;
707def note_strlcpycat_wrong_size : Note<
708  "change size argument to be the size of the destination">;
709def warn_memsize_comparison : Warning<
710  "size argument in %0 call is a comparison">,
711  InGroup<DiagGroup<"memsize-comparison">>;
712def note_memsize_comparison_paren : Note<
713  "did you mean to compare the result of %0 instead?">;
714def note_memsize_comparison_cast_silence : Note<
715  "explicitly cast the argument to size_t to silence this warning">;
716def warn_suspicious_sizeof_memset : Warning<
717  "%select{'size' argument to memset is '0'|"
718  "setting buffer to a 'sizeof' expression}0"
719  "; did you mean to transpose the last two arguments?">,
720  InGroup<MemsetTransposedArgs>;
721def note_suspicious_sizeof_memset_silence : Note<
722  "%select{parenthesize the third argument|"
723  "cast the second argument to 'int'}0 to silence">;
724def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
725  InGroup<SuspiciousBzero>;
726def note_suspicious_bzero_size_silence : Note<
727  "parenthesize the second argument to silence">;
728
729def warn_strncat_large_size : Warning<
730  "the value of the size argument in 'strncat' is too large, might lead to a "
731  "buffer overflow">, InGroup<StrncatSize>;
732def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
733  "to be size of the source">, InGroup<StrncatSize>;
734def warn_strncat_wrong_size : Warning<
735  "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
736def note_strncat_wrong_size : Note<
737  "change the argument to be the free space in the destination buffer minus "
738  "the terminating null byte">;
739
740def warn_assume_side_effects : Warning<
741  "the argument to %0 has side effects that will be discarded">,
742  InGroup<DiagGroup<"assume">>;
743
744def warn_builtin_chk_overflow : Warning<
745  "'%0' will always overflow; destination buffer has size %1,"
746  " but size argument is %2">,
747  InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
748
749def warn_fortify_source_overflow
750  : Warning<warn_builtin_chk_overflow.Text>, InGroup<FortifySource>;
751def warn_fortify_source_size_mismatch : Warning<
752  "'%0' size argument is too large; destination buffer has size %1,"
753  " but size argument is %2">, InGroup<FortifySource>;
754
755def warn_fortify_source_format_overflow : Warning<
756  "'%0' will always overflow; destination buffer has size %1,"
757  " but format string expands to at least %2">,
758  InGroup<FortifySource>;
759
760
761/// main()
762// static main() is not an error in C, just in C++.
763def warn_static_main : Warning<"'main' should not be declared static">,
764    InGroup<Main>;
765def err_static_main : Error<"'main' is not allowed to be declared static">;
766def err_inline_main : Error<"'main' is not allowed to be declared inline">;
767def ext_variadic_main : ExtWarn<
768  "'main' is not allowed to be declared variadic">, InGroup<Main>;
769def ext_noreturn_main : ExtWarn<
770  "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
771def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
772def err_constexpr_main : Error<
773  "'main' is not allowed to be declared %select{constexpr|consteval}0">;
774def err_deleted_main : Error<"'main' is not allowed to be deleted">;
775def err_mainlike_template_decl : Error<"%0 cannot be a template">;
776def err_main_returns_nonint : Error<"'main' must return 'int'">;
777def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
778    InGroup<MainReturnType>;
779def note_main_change_return_type : Note<"change return type to 'int'">;
780def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
781    "must be 0, 2, or 3">;
782def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
783    InGroup<Main>;
784def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
785    "parameter of 'main' (%select{argument count|argument array|environment|"
786    "platform-specific data}0) must be of type %1">;
787def warn_main_returns_bool_literal : Warning<"bool literal returned from "
788    "'main'">, InGroup<Main>;
789def err_main_global_variable :
790    Error<"main cannot be declared as global variable">;
791def warn_main_redefined : Warning<"variable named 'main' with external linkage "
792    "has undefined behavior">, InGroup<Main>;
793def ext_main_used : Extension<
794  "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
795
796/// parser diagnostics
797def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
798  InGroup<MissingDeclarations>;
799def err_no_declarators : Error<"declaration does not declare anything">;
800def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
801  InGroup<MissingDeclarations>;
802def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
803
804def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
805  "anonymous non-C-compatible type given name for linkage purposes "
806  "by %select{typedef|alias}0 declaration; "
807  "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
808def err_non_c_like_anon_struct_in_typedef : Error<
809  "anonymous non-C-compatible type given name for linkage purposes "
810  "by %select{typedef|alias}0 declaration after its linkage was computed; "
811  "add a tag name here to establish linkage prior to definition">;
812def err_typedef_changes_linkage : Error<
813  "unsupported: anonymous type given name for linkage purposes "
814  "by %select{typedef|alias}0 declaration after its linkage was computed; "
815  "add a tag name here to establish linkage prior to definition">;
816def note_non_c_like_anon_struct : Note<
817  "type is not C-compatible due to this "
818  "%select{base class|default member initializer|lambda expression|"
819  "friend declaration|member declaration}0">;
820def note_typedef_for_linkage_here : Note<
821  "type is given name %0 for linkage purposes by this "
822  "%select{typedef|alias}1 declaration">;
823
824def err_statically_allocated_object : Error<
825  "interface type cannot be statically allocated">;
826def err_object_cannot_be_passed_returned_by_value : Error<
827  "interface type %1 cannot be %select{returned|passed}0 by value"
828  "; did you forget * in %1?">;
829def err_parameters_retval_cannot_have_fp16_type : Error<
830  "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
831def err_opencl_half_load_store : Error<
832  "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
833  "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
834def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
835def err_opencl_half_declaration : Error<
836  "declaring variable of type %0 is not allowed">;
837def err_opencl_invalid_param : Error<
838  "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
839def err_opencl_invalid_return : Error<
840  "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
841def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
842def warn_pragma_options_align_reset_failed : Warning<
843  "#pragma options align=reset failed: %0">,
844  InGroup<IgnoredPragmas>;
845def err_pragma_options_align_mac68k_target_unsupported : Error<
846  "mac68k alignment pragma is not supported on this target">;
847def warn_pragma_pack_invalid_alignment : Warning<
848  "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
849  InGroup<IgnoredPragmas>;
850def warn_pragma_pack_non_default_at_include : Warning<
851  "non-default #pragma pack value changes the alignment of struct or union "
852  "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
853  DefaultIgnore;
854def warn_pragma_pack_modified_after_include : Warning<
855  "the current #pragma pack alignment value is modified in the included "
856  "file">, InGroup<PragmaPack>;
857def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
858  "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
859def note_pragma_pack_here : Note<
860  "previous '#pragma pack' directive that modifies alignment is here">;
861def note_pragma_pack_pop_instead_reset : Note<
862  "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
863// Follow the Microsoft implementation.
864def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
865def warn_pragma_pack_pop_identifier_and_alignment : Warning<
866  "specifying both a name and alignment to 'pop' is undefined">;
867def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
868  InGroup<IgnoredPragmas>;
869def err_pragma_fc_pp_scope : Error<
870  "'#pragma float_control push/pop' can only appear at file scope or namespace scope">;
871def err_pragma_fc_noprecise_requires_nofenv : Error<
872  "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
873def err_pragma_fc_except_requires_precise : Error<
874  "'#pragma float_control(except, on)' is illegal when precise is disabled">;
875def err_pragma_fc_noprecise_requires_noexcept : Error<
876  "'#pragma float_control(precise, off)' is illegal when except is enabled">;
877def err_pragma_fenv_requires_precise : Error<
878  "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
879def warn_cxx_ms_struct :
880  Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
881          "with base classes or virtual functions">,
882  DefaultError, InGroup<IncompatibleMSStruct>;
883def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
884def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
885def err_invalid_super_scope : Error<"invalid use of '__super', "
886  "this keyword can only be used inside class or member function scope">;
887def err_super_in_lambda_unsupported : Error<
888  "use of '__super' inside a lambda is unsupported">;
889
890def warn_pragma_unused_undeclared_var : Warning<
891  "undeclared variable %0 used as an argument for '#pragma unused'">,
892  InGroup<IgnoredPragmas>;
893def warn_atl_uuid_deprecated : Warning<
894  "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
895  InGroup<DeprecatedDeclarations>;
896def warn_pragma_unused_expected_var_arg : Warning<
897  "only variables can be arguments to '#pragma unused'">,
898  InGroup<IgnoredPragmas>;
899def err_pragma_push_visibility_mismatch : Error<
900  "#pragma visibility push with no matching #pragma visibility pop">;
901def note_surrounding_namespace_ends_here : Note<
902  "surrounding namespace with visibility attribute ends here">;
903def err_pragma_pop_visibility_mismatch : Error<
904  "#pragma visibility pop with no matching #pragma visibility push">;
905def note_surrounding_namespace_starts_here : Note<
906  "surrounding namespace with visibility attribute starts here">;
907def err_pragma_loop_invalid_argument_type : Error<
908  "invalid argument of type %0; expected an integer type">;
909def err_pragma_loop_invalid_argument_value : Error<
910  "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
911def err_pragma_loop_compatibility : Error<
912  "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
913def err_pragma_loop_precedes_nonloop : Error<
914  "expected a for, while, or do-while loop to follow '%0'">;
915
916def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
917  "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
918  "those declarations">;
919def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
920  "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
921def err_pragma_attribute_invalid_matchers : Error<
922  "attribute %0 can't be applied to %1">;
923def err_pragma_attribute_stack_mismatch : Error<
924  "'#pragma clang attribute %select{%1.|}0pop' with no matching"
925  " '#pragma clang attribute %select{%1.|}0push'">;
926def warn_pragma_attribute_unused : Warning<
927  "unused attribute %0 in '#pragma clang attribute push' region">,
928  InGroup<PragmaClangAttribute>;
929def note_pragma_attribute_region_ends_here : Note<
930  "'#pragma clang attribute push' regions ends here">;
931def err_pragma_attribute_no_pop_eof : Error<"unterminated "
932  "'#pragma clang attribute push' at end of file">;
933def note_pragma_attribute_applied_decl_here : Note<
934  "when applied to this declaration">;
935def err_pragma_attr_attr_no_push : Error<
936  "'#pragma clang attribute' attribute with no matching "
937  "'#pragma clang attribute push'">;
938
939/// Objective-C parser diagnostics
940def err_duplicate_class_def : Error<
941  "duplicate interface definition for class %0">;
942def err_undef_superclass : Error<
943  "cannot find interface declaration for %0, superclass of %1">;
944def err_forward_superclass : Error<
945  "attempting to use the forward class %0 as superclass of %1">;
946def err_no_nsconstant_string_class : Error<
947  "cannot find interface declaration for %0">;
948def err_recursive_superclass : Error<
949  "trying to recursively use %0 as superclass of %1">;
950def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
951def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
952def warn_duplicate_protocol_def : Warning<
953  "duplicate protocol definition of %0 is ignored">,
954  InGroup<DiagGroup<"duplicate-protocol">>;
955def err_protocol_has_circular_dependency : Error<
956  "protocol has circular dependency">;
957def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
958def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
959def err_atprotocol_protocol : Error<
960  "@protocol is using a forward protocol declaration of %0">;
961def warn_readonly_property : Warning<
962  "attribute 'readonly' of property %0 restricts attribute "
963  "'readwrite' of property inherited from %1">,
964  InGroup<PropertyAttr>;
965
966def warn_property_attribute : Warning<
967  "'%1' attribute on property %0 does not match the property inherited from %2">,
968  InGroup<PropertyAttr>;
969def warn_property_types_are_incompatible : Warning<
970  "property type %0 is incompatible with type %1 inherited from %2">,
971  InGroup<DiagGroup<"incompatible-property-type">>;
972def warn_protocol_property_mismatch : Warning<
973  "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
974  "getter %1|with setter %1}0 was selected for synthesis">,
975  InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
976def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Text>;
977def err_undef_interface : Error<"cannot find interface declaration for %0">;
978def err_category_forward_interface : Error<
979  "cannot define %select{category|class extension}0 for undefined class %1">;
980def err_class_extension_after_impl : Error<
981  "cannot declare class extension for %0 after class implementation">;
982def note_implementation_declared : Note<
983  "class implementation is declared here">;
984def note_while_in_implementation : Note<
985  "detected while default synthesizing properties in class implementation">;
986def note_class_declared : Note<
987  "class is declared here">;
988def note_receiver_class_declared : Note<
989  "receiver is instance of class declared here">;
990def note_receiver_expr_here : Note<
991  "receiver expression is here">;
992def note_receiver_is_id : Note<
993  "receiver is treated with 'id' type for purpose of method lookup">;
994def note_suppressed_class_declare : Note<
995  "class with specified objc_requires_property_definitions attribute is declared here">;
996def err_objc_root_class_subclass : Error<
997  "objc_root_class attribute may only be specified on a root class declaration">;
998def err_restricted_superclass_mismatch : Error<
999  "cannot subclass a class that was declared with the "
1000  "'objc_subclassing_restricted' attribute">;
1001def err_class_stub_subclassing_mismatch : Error<
1002  "'objc_class_stub' attribute cannot be specified on a class that does not "
1003  "have the 'objc_subclassing_restricted' attribute">;
1004def err_implementation_of_class_stub : Error<
1005  "cannot declare implementation of a class declared with the "
1006  "'objc_class_stub' attribute">;
1007def warn_objc_root_class_missing : Warning<
1008  "class %0 defined without specifying a base class">,
1009  InGroup<ObjCRootClass>;
1010def err_objc_runtime_visible_category : Error<
1011  "cannot implement a category for class %0 that is only visible via the "
1012  "Objective-C runtime">;
1013def err_objc_runtime_visible_subclass : Error<
1014  "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1015  "Objective-C runtime">;
1016def note_objc_needs_superclass : Note<
1017  "add a super class to fix this problem">;
1018def err_conflicting_super_class : Error<"conflicting super class name %0">;
1019def err_dup_implementation_class : Error<"reimplementation of class %0">;
1020def err_dup_implementation_category : Error<
1021  "reimplementation of category %1 for class %0">;
1022def err_conflicting_ivar_type : Error<
1023  "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1024def err_duplicate_ivar_declaration : Error<
1025  "instance variable is already declared">;
1026def warn_on_superclass_use : Warning<
1027  "class implementation may not have super class">;
1028def err_conflicting_ivar_bitwidth : Error<
1029  "instance variable %0 has conflicting bit-field width">;
1030def err_conflicting_ivar_name : Error<
1031  "conflicting instance variable names: %0 vs %1">;
1032def err_inconsistent_ivar_count : Error<
1033  "inconsistent number of instance variables specified">;
1034def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1035  InGroup<DiagGroup<"incomplete-implementation">>;
1036def warn_objc_boxing_invalid_utf8_string : Warning<
1037  "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1038  InGroup<ObjCBoxing>;
1039
1040def err_objc_non_runtime_protocol_in_protocol_expr : Error<
1041  "cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression">;
1042def err_objc_direct_on_protocol : Error<
1043  "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1044  "declared in an Objective-C protocol">;
1045def err_objc_direct_duplicate_decl : Error<
1046  "%select{|direct }0%select{method|property}1 declaration conflicts "
1047  "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1048def err_objc_direct_impl_decl_mismatch : Error<
1049  "direct method was declared in %select{the primary interface|an extension|a category}0 "
1050  "but is implemented in %select{the primary interface|a category|a different category}1">;
1051def err_objc_direct_missing_on_decl : Error<
1052  "direct method implementation was previously declared not direct">;
1053def err_objc_direct_on_override : Error<
1054  "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1055def err_objc_override_direct_method : Error<
1056  "cannot override a method that is declared direct by a superclass">;
1057def warn_objc_direct_ignored : Warning<
1058  "%0 attribute isn't implemented by this Objective-C runtime">,
1059  InGroup<IgnoredAttributes>;
1060def warn_objc_direct_property_ignored : Warning<
1061  "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1062  InGroup<IgnoredAttributes>;
1063def err_objc_direct_dynamic_property : Error<
1064  "direct property cannot be @dynamic">;
1065
1066def warn_conflicting_overriding_ret_types : Warning<
1067  "conflicting return type in "
1068  "declaration of %0%diff{: $ vs $|}1,2">,
1069  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1070
1071def warn_conflicting_ret_types : Warning<
1072  "conflicting return type in "
1073  "implementation of %0%diff{: $ vs $|}1,2">,
1074  InGroup<MismatchedReturnTypes>;
1075
1076def warn_conflicting_overriding_ret_type_modifiers : Warning<
1077  "conflicting distributed object modifiers on return type "
1078  "in declaration of %0">,
1079  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1080
1081def warn_conflicting_ret_type_modifiers : Warning<
1082  "conflicting distributed object modifiers on return type "
1083  "in implementation of %0">,
1084  InGroup<DistributedObjectModifiers>;
1085
1086def warn_non_covariant_overriding_ret_types : Warning<
1087  "conflicting return type in "
1088  "declaration of %0: %1 vs %2">,
1089  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1090
1091def warn_non_covariant_ret_types : Warning<
1092  "conflicting return type in "
1093  "implementation of %0: %1 vs %2">,
1094  InGroup<MethodSignatures>, DefaultIgnore;
1095
1096def warn_conflicting_overriding_param_types : Warning<
1097  "conflicting parameter types in "
1098  "declaration of %0%diff{: $ vs $|}1,2">,
1099  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1100
1101def warn_conflicting_param_types : Warning<
1102  "conflicting parameter types in "
1103  "implementation of %0%diff{: $ vs $|}1,2">,
1104  InGroup<MismatchedParameterTypes>;
1105
1106def warn_conflicting_param_modifiers : Warning<
1107  "conflicting distributed object modifiers on parameter type "
1108  "in implementation of %0">,
1109  InGroup<DistributedObjectModifiers>;
1110
1111def warn_conflicting_overriding_param_modifiers : Warning<
1112  "conflicting distributed object modifiers on parameter type "
1113  "in declaration of %0">,
1114  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1115
1116def warn_non_contravariant_overriding_param_types : Warning<
1117  "conflicting parameter types in "
1118  "declaration of %0: %1 vs %2">,
1119  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1120
1121def warn_non_contravariant_param_types : Warning<
1122  "conflicting parameter types in "
1123  "implementation of %0: %1 vs %2">,
1124  InGroup<MethodSignatures>, DefaultIgnore;
1125
1126def warn_conflicting_overriding_variadic :Warning<
1127  "conflicting variadic declaration of method and its "
1128  "implementation">,
1129  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1130
1131def warn_conflicting_variadic :Warning<
1132  "conflicting variadic declaration of method and its "
1133  "implementation">;
1134
1135def warn_category_method_impl_match:Warning<
1136  "category is implementing a method which will also be implemented"
1137  " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1138
1139def warn_implements_nscopying : Warning<
1140"default assign attribute on property %0 which implements "
1141"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1142
1143def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1144  InGroup<ObjCMultipleMethodNames>;
1145def warn_strict_multiple_method_decl : Warning<
1146  "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1147def warn_accessor_property_type_mismatch : Warning<
1148  "type of property %0 does not match type of accessor %1">;
1149def note_conv_function_declared_at : Note<"type conversion function declared here">;
1150def note_method_declared_at : Note<"method %0 declared here">;
1151def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1152def note_property_attribute : Note<"property %0 is declared "
1153  "%select{deprecated|unavailable|partial}1 here">;
1154def err_setter_type_void : Error<"type of setter must be void">;
1155def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1156def warn_duplicate_method_decl :
1157  Warning<"multiple declarations of method %0 found and ignored">,
1158  InGroup<MethodDuplicate>, DefaultIgnore;
1159def warn_objc_cdirective_format_string :
1160  Warning<"using %0 directive in %select{NSString|CFString}1 "
1161          "which is being passed as a formatting argument to the formatting "
1162          "%select{method|CFfunction}2">,
1163  InGroup<ObjCCStringFormat>, DefaultIgnore;
1164def err_objc_var_decl_inclass :
1165    Error<"cannot declare variable inside @interface or @protocol">;
1166def err_missing_method_context : Error<
1167  "missing context for method declaration">;
1168def err_objc_property_attr_mutually_exclusive : Error<
1169  "property attributes '%0' and '%1' are mutually exclusive">;
1170def err_objc_property_requires_object : Error<
1171  "property with '%0' attribute must be of object type">;
1172def warn_objc_property_assign_on_object : Warning<
1173  "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1174  InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1175def warn_objc_property_no_assignment_attribute : Warning<
1176  "no 'assign', 'retain', or 'copy' attribute is specified - "
1177  "'assign' is assumed">,
1178  InGroup<ObjCPropertyNoAttribute>;
1179def warn_objc_isa_use : Warning<
1180  "direct access to Objective-C's isa is deprecated in favor of "
1181  "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1182def warn_objc_isa_assign : Warning<
1183  "assignment to Objective-C's isa is deprecated in favor of "
1184  "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1185def warn_objc_pointer_masking : Warning<
1186  "bitmasking for introspection of Objective-C object pointers is strongly "
1187  "discouraged">,
1188  InGroup<ObjCPointerIntrospect>;
1189def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
1190  InGroup<ObjCPointerIntrospectPerformSelector>;
1191def warn_objc_property_default_assign_on_object : Warning<
1192  "default property attribute 'assign' not appropriate for object">,
1193  InGroup<ObjCPropertyNoAttribute>;
1194def warn_property_attr_mismatch : Warning<
1195  "property attribute in class extension does not match the primary class">,
1196  InGroup<PropertyAttr>;
1197def warn_property_implicitly_mismatched : Warning <
1198  "primary property declaration is implicitly strong while redeclaration "
1199  "in class extension is weak">,
1200  InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1201def warn_objc_property_copy_missing_on_block : Warning<
1202    "'copy' attribute must be specified for the block property "
1203    "when -fobjc-gc-only is specified">;
1204def warn_objc_property_retain_of_block : Warning<
1205    "retain'ed block property does not copy the block "
1206    "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1207def warn_objc_readonly_property_has_setter : Warning<
1208    "setter cannot be specified for a readonly property">,
1209    InGroup<ObjCReadonlyPropertyHasSetter>;
1210def warn_atomic_property_rule : Warning<
1211  "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1212  "with a user defined %select{getter|setter}2">,
1213  InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1214def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1215  "synthesized, or both be user defined,or the property must be nonatomic">;
1216def err_atomic_property_nontrivial_assign_op : Error<
1217  "atomic property of reference type %0 cannot have non-trivial assignment"
1218  " operator">;
1219def warn_cocoa_naming_owned_rule : Warning<
1220  "property follows Cocoa naming"
1221  " convention for returning 'owned' objects">,
1222  InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1223def err_cocoa_naming_owned_rule : Error<
1224  "property follows Cocoa naming"
1225  " convention for returning 'owned' objects">;
1226def note_cocoa_naming_declare_family : Note<
1227  "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1228  "object">;
1229def warn_auto_synthesizing_protocol_property :Warning<
1230  "auto property synthesis will not synthesize property %0"
1231  " declared in protocol %1">,
1232  InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1233def note_add_synthesize_directive : Note<
1234  "add a '@synthesize' directive">;
1235def warn_no_autosynthesis_shared_ivar_property : Warning <
1236  "auto property synthesis will not synthesize property "
1237  "%0 because it cannot share an ivar with another synthesized property">,
1238  InGroup<ObjCNoPropertyAutoSynthesis>;
1239def warn_no_autosynthesis_property : Warning<
1240  "auto property synthesis will not synthesize property "
1241  "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1242  "via another property">,
1243  InGroup<ObjCNoPropertyAutoSynthesis>;
1244def warn_autosynthesis_property_in_superclass : Warning<
1245  "auto property synthesis will not synthesize property "
1246  "%0; it will be implemented by its superclass, use @dynamic to "
1247  "acknowledge intention">,
1248  InGroup<ObjCNoPropertyAutoSynthesis>;
1249def warn_autosynthesis_property_ivar_match :Warning<
1250  "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1251  "%2, not existing instance variable %3">,
1252  InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1253def warn_missing_explicit_synthesis : Warning <
1254  "auto property synthesis is synthesizing property not explicitly synthesized">,
1255  InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1256def warn_property_getter_owning_mismatch : Warning<
1257  "property declared as returning non-retained objects"
1258  "; getter returning retained objects">;
1259def warn_property_redecl_getter_mismatch : Warning<
1260  "getter name mismatch between property redeclaration (%1) and its original "
1261  "declaration (%0)">, InGroup<PropertyAttr>;
1262def err_property_setter_ambiguous_use : Error<
1263  "synthesized properties %0 and %1 both claim setter %2 -"
1264  " use of this setter will cause unexpected behavior">;
1265def warn_default_atomic_custom_getter_setter : Warning<
1266  "atomic by default property %0 has a user defined %select{getter|setter}1 "
1267  "(property should be marked 'atomic' if this is intended)">,
1268  InGroup<CustomAtomic>, DefaultIgnore;
1269def err_use_continuation_class : Error<
1270  "illegal redeclaration of property in class extension %0"
1271  " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1272def err_type_mismatch_continuation_class : Error<
1273  "type of property %0 in class extension does not match "
1274  "property type in primary class">;
1275def err_use_continuation_class_redeclaration_readwrite : Error<
1276  "illegal redeclaration of 'readwrite' property in class extension %0"
1277  " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1278  "'readonly' public property?)">;
1279def err_continuation_class : Error<"class extension has no primary class">;
1280def err_property_type : Error<"property cannot have array or function type %0">;
1281def err_missing_property_context : Error<
1282  "missing context for property implementation declaration">;
1283def err_bad_property_decl : Error<
1284  "property implementation must have its declaration in interface %0 or one of "
1285  "its extensions">;
1286def err_category_property : Error<
1287  "property declared in category %0 cannot be implemented in "
1288  "class implementation">;
1289def note_property_declare : Note<
1290  "property declared here">;
1291def note_protocol_property_declare : Note<
1292  "it could also be property "
1293  "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1294  "%1|with setter %1}0 declared here">;
1295def note_property_synthesize : Note<
1296  "property synthesized here">;
1297def err_synthesize_category_decl : Error<
1298  "@synthesize not allowed in a category's implementation">;
1299def err_synthesize_on_class_property : Error<
1300  "@synthesize not allowed on a class property %0">;
1301def err_missing_property_interface : Error<
1302  "property implementation in a category with no category declaration">;
1303def err_bad_category_property_decl : Error<
1304  "property implementation must have its declaration in the category %0">;
1305def err_bad_property_context : Error<
1306  "property implementation must be in a class or category implementation">;
1307def err_missing_property_ivar_decl : Error<
1308  "synthesized property %0 must either be named the same as a compatible"
1309  " instance variable or must explicitly name an instance variable">;
1310def err_arc_perform_selector_retains : Error<
1311  "performSelector names a selector which retains the object">;
1312def warn_arc_perform_selector_leaks : Warning<
1313  "performSelector may cause a leak because its selector is unknown">,
1314  InGroup<DiagGroup<"arc-performSelector-leaks">>;
1315def warn_dealloc_in_category : Warning<
1316"-dealloc is being overridden in a category">,
1317InGroup<DeallocInCategory>;
1318def err_gc_weak_property_strong_type : Error<
1319  "weak attribute declared on a __strong type property in GC mode">;
1320def warn_arc_repeated_use_of_weak : Warning <
1321  "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1322  "accessed multiple times in this %select{function|method|block|lambda}2 "
1323  "but may be unpredictably set to nil; assign to a strong variable to keep "
1324  "the object alive">,
1325  InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1326def warn_implicitly_retains_self : Warning <
1327  "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1328  "this is intended behavior">,
1329  InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1330def warn_arc_possible_repeated_use_of_weak : Warning <
1331  "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1332  "be accessed multiple times in this %select{function|method|block|lambda}2 "
1333  "and may be unpredictably set to nil; assign to a strong variable to keep "
1334  "the object alive">,
1335  InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1336def note_arc_weak_also_accessed_here : Note<
1337  "also accessed here">;
1338def err_incomplete_synthesized_property : Error<
1339  "cannot synthesize property %0 with incomplete type %1">;
1340
1341def err_property_ivar_type : Error<
1342  "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1343def err_property_accessor_type : Error<
1344  "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1345def err_ivar_in_superclass_use : Error<
1346  "property %0 attempting to use instance variable %1 declared in super class %2">;
1347def err_weak_property : Error<
1348  "existing instance variable %1 for __weak property %0 must be __weak">;
1349def err_strong_property : Error<
1350  "existing instance variable %1 for strong property %0 may not be __weak">;
1351def err_dynamic_property_ivar_decl : Error<
1352  "dynamic property cannot have instance variable specification">;
1353def err_duplicate_ivar_use : Error<
1354  "synthesized properties %0 and %1 both claim instance variable %2">;
1355def err_property_implemented : Error<"property %0 is already implemented">;
1356def warn_objc_missing_super_call : Warning<
1357  "method possibly missing a [super %0] call">,
1358  InGroup<ObjCMissingSuperCalls>;
1359def err_dealloc_bad_result_type : Error<
1360  "dealloc return type must be correctly specified as 'void' under ARC, "
1361  "instead of %0">;
1362def warn_undeclared_selector : Warning<
1363  "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1364def warn_undeclared_selector_with_typo : Warning<
1365  "undeclared selector %0; did you mean %1?">,
1366  InGroup<UndeclaredSelector>, DefaultIgnore;
1367def warn_implicit_atomic_property : Warning<
1368  "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1369def note_auto_readonly_iboutlet_fixup_suggest : Note<
1370  "property should be changed to be readwrite">;
1371def warn_auto_readonly_iboutlet_property : Warning<
1372  "readonly IBOutlet property %0 when auto-synthesized may "
1373  "not work correctly with 'nib' loader">,
1374  InGroup<DiagGroup<"readonly-iboutlet-property">>;
1375def warn_auto_implicit_atomic_property : Warning<
1376  "property is assumed atomic when auto-synthesizing the property">,
1377  InGroup<ImplicitAtomic>, DefaultIgnore;
1378def warn_unimplemented_selector:  Warning<
1379  "no method with selector %0 is implemented in this translation unit">,
1380  InGroup<Selector>, DefaultIgnore;
1381def warn_unimplemented_protocol_method : Warning<
1382  "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1383def warn_multiple_selectors: Warning<
1384  "several methods with selector %0 of mismatched types are found "
1385  "for the @selector expression">,
1386  InGroup<SelectorTypeMismatch>, DefaultIgnore;
1387def err_direct_selector_expression : Error<
1388  "@selector expression formed with direct selector %0">;
1389def warn_potentially_direct_selector_expression : Warning<
1390  "@selector expression formed with potentially direct selector %0">,
1391  InGroup<ObjCPotentiallyDirectSelector>;
1392def warn_strict_potentially_direct_selector_expression : Warning<
1393  warn_potentially_direct_selector_expression.Text>,
1394  InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1395
1396def err_objc_kindof_nonobject : Error<
1397  "'__kindof' specifier cannot be applied to non-object type %0">;
1398def err_objc_kindof_wrong_position : Error<
1399  "'__kindof' type specifier must precede the declarator">;
1400
1401def err_objc_method_unsupported_param_ret_type : Error<
1402  "%0 %select{parameter|return}1 type is unsupported; "
1403  "support for vector types for this target is introduced in %2">;
1404
1405def warn_messaging_unqualified_id : Warning<
1406  "messaging unqualified id">, DefaultIgnore,
1407  InGroup<DiagGroup<"objc-messaging-id">>;
1408def err_messaging_unqualified_id_with_direct_method : Error<
1409  "messaging unqualified id with a method that is possibly direct">;
1410def err_messaging_super_with_direct_method : Error<
1411  "messaging super with a direct method">;
1412def err_messaging_class_with_direct_method : Error<
1413  "messaging a Class with a method that is possibly direct">;
1414
1415// C++ declarations
1416def err_static_assert_expression_is_not_constant : Error<
1417  "static_assert expression is not an integral constant expression">;
1418def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
1419def err_static_assert_requirement_failed : Error<
1420  "static_assert failed due to requirement '%0'%select{ %2|}1">;
1421
1422def ext_inline_variable : ExtWarn<
1423  "inline variables are a C++17 extension">, InGroup<CXX17>;
1424def warn_cxx14_compat_inline_variable : Warning<
1425  "inline variables are incompatible with C++ standards before C++17">,
1426  DefaultIgnore, InGroup<CXXPre17Compat>;
1427
1428def warn_inline_namespace_reopened_noninline : Warning<
1429  "inline namespace reopened as a non-inline namespace">,
1430  InGroup<InlineNamespaceReopenedNoninline>;
1431def err_inline_namespace_mismatch : Error<
1432  "non-inline namespace cannot be reopened as inline">;
1433
1434def err_unexpected_friend : Error<
1435  "friends can only be classes or functions">;
1436def ext_enum_friend : ExtWarn<
1437  "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1438def warn_cxx98_compat_enum_friend : Warning<
1439  "befriending enumeration type %0 is incompatible with C++98">,
1440  InGroup<CXX98Compat>, DefaultIgnore;
1441def ext_nonclass_type_friend : ExtWarn<
1442  "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1443def warn_cxx98_compat_nonclass_type_friend : Warning<
1444  "non-class friend type %0 is incompatible with C++98">,
1445  InGroup<CXX98Compat>, DefaultIgnore;
1446def err_friend_is_member : Error<
1447  "friends cannot be members of the declaring class">;
1448def warn_cxx98_compat_friend_is_member : Warning<
1449  "friend declaration naming a member of the declaring class is incompatible "
1450  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1451def ext_unelaborated_friend_type : ExtWarn<
1452  "unelaborated friend declaration is a C++11 extension; specify "
1453  "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1454  InGroup<CXX11>;
1455def warn_cxx98_compat_unelaborated_friend_type : Warning<
1456  "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1457  "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1458def err_qualified_friend_no_match : Error<
1459  "friend declaration of %0 does not match any declaration in %1">;
1460def err_introducing_special_friend : Error<
1461  "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1462  " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1463  "as a friend">;
1464def err_tagless_friend_type_template : Error<
1465  "friend type templates must use an elaborated type">;
1466def err_no_matching_local_friend : Error<
1467  "no matching function found in local scope">;
1468def err_no_matching_local_friend_suggest : Error<
1469  "no matching function %0 found in local scope; did you mean %3?">;
1470def err_partial_specialization_friend : Error<
1471  "partial specialization cannot be declared as a friend">;
1472def err_qualified_friend_def : Error<
1473  "friend function definition cannot be qualified with '%0'">;
1474def err_friend_def_in_local_class : Error<
1475  "friend function cannot be defined in a local class">;
1476def err_friend_not_first_in_declaration : Error<
1477  "'friend' must appear first in a non-function declaration">;
1478def err_using_decl_friend : Error<
1479  "cannot befriend target of using declaration">;
1480def warn_template_qualified_friend_unsupported : Warning<
1481  "dependent nested name specifier '%0' for friend class declaration is "
1482  "not supported; turning off access control for %1">,
1483  InGroup<UnsupportedFriend>;
1484def warn_template_qualified_friend_ignored : Warning<
1485  "dependent nested name specifier '%0' for friend template declaration is "
1486  "not supported; ignoring this friend declaration">,
1487  InGroup<UnsupportedFriend>;
1488def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1489  "unqualified friend declaration referring to type outside of the nearest "
1490  "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1491  InGroup<MicrosoftUnqualifiedFriend>;
1492def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1493
1494def err_invalid_base_in_interface : Error<
1495  "interface type cannot inherit from "
1496  "%select{struct|non-public interface|class}0 %1">;
1497
1498def err_abstract_type_in_decl : Error<
1499  "%select{return|parameter|variable|field|instance variable|"
1500  "synthesized instance variable}0 type %1 is an abstract class">;
1501def err_allocation_of_abstract_type : Error<
1502  "allocating an object of abstract class type %0">;
1503def err_throw_abstract_type : Error<
1504  "cannot throw an object of abstract type %0">;
1505def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1506def err_capture_of_abstract_type : Error<
1507  "by-copy capture of value of abstract type %0">;
1508def err_capture_of_incomplete_or_sizeless_type : Error<
1509  "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1510def err_capture_default_non_local : Error<
1511  "non-local lambda expression cannot have a capture-default">;
1512
1513def err_multiple_final_overriders : Error<
1514  "virtual function %q0 has more than one final overrider in %1">;
1515def note_final_overrider : Note<"final overrider of %q0 in %1">;
1516
1517def err_type_defined_in_type_specifier : Error<
1518  "%0 cannot be defined in a type specifier">;
1519def err_type_defined_in_result_type : Error<
1520  "%0 cannot be defined in the result type of a function">;
1521def err_type_defined_in_param_type : Error<
1522  "%0 cannot be defined in a parameter type">;
1523def err_type_defined_in_alias_template : Error<
1524  "%0 cannot be defined in a type alias template">;
1525def err_type_defined_in_condition : Error<
1526  "%0 cannot be defined in a condition">;
1527def err_type_defined_in_enum : Error<
1528  "%0 cannot be defined in an enumeration">;
1529
1530def note_pure_virtual_function : Note<
1531  "unimplemented pure virtual method %0 in %1">;
1532
1533def note_pure_qualified_call_kext : Note<
1534  "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1535
1536def err_deleted_decl_not_first : Error<
1537  "deleted definition must be first declaration">;
1538
1539def err_deleted_override : Error<
1540  "deleted function %0 cannot override a non-deleted function">;
1541def err_non_deleted_override : Error<
1542  "non-deleted function %0 cannot override a deleted function">;
1543def err_consteval_override : Error<
1544  "consteval function %0 cannot override a non-consteval function">;
1545def err_non_consteval_override : Error<
1546  "non-consteval function %0 cannot override a consteval function">;
1547
1548def warn_weak_vtable : Warning<
1549  "%0 has no out-of-line virtual method definitions; its vtable will be "
1550  "emitted in every translation unit">,
1551  InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1552def warn_weak_template_vtable : Warning<
1553  "explicit template instantiation %0 will emit a vtable in every "
1554  "translation unit">,
1555  InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1556
1557def ext_using_undefined_std : ExtWarn<
1558  "using directive refers to implicitly-defined namespace 'std'">;
1559
1560// C++ exception specifications
1561def err_exception_spec_in_typedef : Error<
1562  "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1563def err_distant_exception_spec : Error<
1564  "exception specifications are not allowed beyond a single level "
1565  "of indirection">;
1566def err_incomplete_in_exception_spec : Error<
1567  "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1568  "in exception specification">;
1569def err_sizeless_in_exception_spec : Error<
1570  "%select{|reference to }0sizeless type %1 is not allowed "
1571  "in exception specification">;
1572def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Text>,
1573  InGroup<MicrosoftExceptionSpec>;
1574def err_rref_in_exception_spec : Error<
1575  "rvalue reference type %0 is not allowed in exception specification">;
1576def err_mismatched_exception_spec : Error<
1577  "exception specification in declaration does not match previous declaration">;
1578def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Text>,
1579  InGroup<MicrosoftExceptionSpec>;
1580def err_override_exception_spec : Error<
1581  "exception specification of overriding function is more lax than "
1582  "base version">;
1583def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Text>,
1584  InGroup<MicrosoftExceptionSpec>;
1585def err_incompatible_exception_specs : Error<
1586  "target exception specification is not superset of source">;
1587def warn_incompatible_exception_specs : Warning<
1588  err_incompatible_exception_specs.Text>, InGroup<IncompatibleExceptionSpec>;
1589def err_deep_exception_specs_differ : Error<
1590  "exception specifications of %select{return|argument}0 types differ">;
1591def warn_deep_exception_specs_differ : Warning<
1592  err_deep_exception_specs_differ.Text>, InGroup<IncompatibleExceptionSpec>;
1593def err_missing_exception_specification : Error<
1594  "%0 is missing exception specification '%1'">;
1595def ext_missing_exception_specification : ExtWarn<
1596  err_missing_exception_specification.Text>,
1597  InGroup<DiagGroup<"missing-exception-spec">>;
1598def ext_ms_missing_exception_specification : ExtWarn<
1599  err_missing_exception_specification.Text>,
1600  InGroup<MicrosoftExceptionSpec>;
1601def err_noexcept_needs_constant_expression : Error<
1602  "argument to noexcept specifier must be a constant expression">;
1603def err_exception_spec_not_parsed : Error<
1604  "exception specification is not available until end of class definition">;
1605def err_exception_spec_cycle : Error<
1606  "exception specification of %0 uses itself">;
1607def err_exception_spec_incomplete_type : Error<
1608  "exception specification needed for member of incomplete class %0">;
1609def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1610  "dynamic exception specifications with types are currently ignored in wasm">,
1611  InGroup<WebAssemblyExceptionSpec>;
1612
1613// C++ access checking
1614def err_class_redeclared_with_different_access : Error<
1615  "%0 redeclared with '%1' access">;
1616def err_access : Error<
1617  "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1618def ext_ms_using_declaration_inaccessible : ExtWarn<
1619  "using declaration referring to inaccessible member '%0' (which refers "
1620  "to accessible member '%1') is a Microsoft compatibility extension">,
1621    AccessControl, InGroup<MicrosoftUsingDecl>;
1622def err_access_ctor : Error<
1623  "calling a %select{private|protected}0 constructor of class %2">,
1624  AccessControl;
1625def ext_rvalue_to_reference_access_ctor : Extension<
1626  "C++98 requires an accessible copy constructor for class %2 when binding "
1627  "a reference to a temporary; was %select{private|protected}0">,
1628  AccessControl, InGroup<BindToTemporaryCopy>;
1629def err_access_base_ctor : Error<
1630  // The ERRORs represent other special members that aren't constructors, in
1631  // hopes that someone will bother noticing and reporting if they appear
1632  "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1633  "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1634  "|*ERROR*|}2constructor">, AccessControl;
1635def err_access_field_ctor : Error<
1636  // The ERRORs represent other special members that aren't constructors, in
1637  // hopes that someone will bother noticing and reporting if they appear
1638  "field of type %0 has %select{private|protected}2 "
1639  "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1640  AccessControl;
1641def err_access_friend_function : Error<
1642  "friend function %1 is a %select{private|protected}0 member of %3">,
1643  AccessControl;
1644
1645def err_access_dtor : Error<
1646  "calling a %select{private|protected}1 destructor of class %0">,
1647  AccessControl;
1648def err_access_dtor_base :
1649    Error<"base class %0 has %select{private|protected}1 destructor">,
1650    AccessControl;
1651def err_access_dtor_vbase :
1652    Error<"inherited virtual base class %1 has "
1653    "%select{private|protected}2 destructor">,
1654    AccessControl;
1655def err_access_dtor_temp :
1656    Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1657    AccessControl;
1658def err_access_dtor_exception :
1659    Error<"exception object of type %0 has %select{private|protected}1 "
1660          "destructor">, AccessControl;
1661def err_access_dtor_field :
1662    Error<"field of type %1 has %select{private|protected}2 destructor">,
1663    AccessControl;
1664def err_access_dtor_var :
1665    Error<"variable of type %1 has %select{private|protected}2 destructor">,
1666    AccessControl;
1667def err_access_dtor_ivar :
1668    Error<"instance variable of type %0 has %select{private|protected}1 "
1669          "destructor">,
1670    AccessControl;
1671def note_previous_access_declaration : Note<
1672  "previously declared '%1' here">;
1673def note_access_natural : Note<
1674  "%select{|implicitly }1declared %select{private|protected}0 here">;
1675def note_access_constrained_by_path : Note<
1676  "constrained by %select{|implicitly }1%select{private|protected}0"
1677  " inheritance here">;
1678def note_access_protected_restricted_noobject : Note<
1679  "must name member using the type of the current context %0">;
1680def note_access_protected_restricted_ctordtor : Note<
1681  "protected %select{constructor|destructor}0 can only be used to "
1682  "%select{construct|destroy}0 a base class subobject">;
1683def note_access_protected_restricted_object : Note<
1684  "can only access this member on an object of type %0">;
1685def warn_cxx98_compat_sfinae_access_control : Warning<
1686  "substitution failure due to access control is incompatible with C++98">,
1687  InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1688
1689// C++ name lookup
1690def err_incomplete_nested_name_spec : Error<
1691  "incomplete type %0 named in nested name specifier">;
1692def err_dependent_nested_name_spec : Error<
1693  "nested name specifier for a declaration cannot depend on a template "
1694  "parameter">;
1695def err_nested_name_member_ref_lookup_ambiguous : Error<
1696  "lookup of %0 in member access expression is ambiguous">;
1697def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1698  "lookup of %0 in member access expression is ambiguous; using member of %1">,
1699  InGroup<AmbigMemberTemplate>;
1700def note_ambig_member_ref_object_type : Note<
1701  "lookup in the object type %0 refers here">;
1702def note_ambig_member_ref_scope : Note<
1703  "lookup from the current scope refers here">;
1704def err_qualified_member_nonclass : Error<
1705  "qualified member access refers to a member in %0">;
1706def err_incomplete_member_access : Error<
1707  "member access into incomplete type %0">;
1708def err_incomplete_type : Error<
1709  "incomplete type %0 where a complete type is required">;
1710def warn_cxx98_compat_enum_nested_name_spec : Warning<
1711  "enumeration type in nested name specifier is incompatible with C++98">,
1712  InGroup<CXX98Compat>, DefaultIgnore;
1713def err_nested_name_spec_is_not_class : Error<
1714  "%0 cannot appear before '::' because it is not a class"
1715  "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1716def ext_nested_name_spec_is_enum : ExtWarn<
1717  "use of enumeration in a nested name specifier is a C++11 extension">,
1718  InGroup<CXX11>;
1719def err_out_of_line_qualified_id_type_names_constructor : Error<
1720  "qualified reference to %0 is a constructor name rather than a "
1721  "%select{template name|type}1 in this context">;
1722def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1723  "ISO C++ specifies that "
1724  "qualified reference to %0 is a constructor name rather than a "
1725  "%select{template name|type}1 in this context, despite preceding "
1726  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1727  InGroup<DiagGroup<"injected-class-name">>;
1728
1729// C++ class members
1730def err_storageclass_invalid_for_member : Error<
1731  "storage class specified for a member declaration">;
1732def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1733def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1734def ext_mutable_reference : ExtWarn<
1735  "'mutable' on a reference type is a Microsoft extension">,
1736  InGroup<MicrosoftMutableReference>;
1737def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1738def err_mutable_nonmember : Error<
1739  "'mutable' can only be applied to member variables">;
1740def err_virtual_in_union : Error<
1741  "unions cannot have virtual functions">;
1742def err_virtual_non_function : Error<
1743  "'virtual' can only appear on non-static member functions">;
1744def err_virtual_out_of_class : Error<
1745  "'virtual' can only be specified inside the class definition">;
1746def err_virtual_member_function_template : Error<
1747  "'virtual' cannot be specified on member function templates">;
1748def err_static_overrides_virtual : Error<
1749  "'static' member function %0 overrides a virtual function in a base class">;
1750def err_explicit_non_function : Error<
1751  "'explicit' can only appear on non-static member functions">;
1752def err_explicit_out_of_class : Error<
1753  "'explicit' can only be specified inside the class definition">;
1754def err_explicit_non_ctor_or_conv_function : Error<
1755  "'explicit' can only be applied to a constructor or conversion function">;
1756def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1757def err_static_out_of_line : Error<
1758  "'static' can only be specified inside the class definition">;
1759def ext_static_out_of_line : ExtWarn<
1760  err_static_out_of_line.Text>,
1761  InGroup<MicrosoftTemplate>;
1762def err_storage_class_for_static_member : Error<
1763  "static data member definition cannot specify a storage class">;
1764def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1765def err_not_integral_type_bitfield : Error<
1766  "bit-field %0 has non-integral type %1">;
1767def err_not_integral_type_anon_bitfield : Error<
1768  "anonymous bit-field has non-integral type %0">;
1769def err_anon_bitfield_qualifiers : Error<
1770  "anonymous bit-field cannot have qualifiers">;
1771def err_member_function_initialization : Error<
1772  "initializer on function does not look like a pure-specifier">;
1773def err_non_virtual_pure : Error<
1774  "%0 is not virtual and cannot be declared pure">;
1775def ext_pure_function_definition : ExtWarn<
1776  "function definition with pure-specifier is a Microsoft extension">,
1777  InGroup<MicrosoftPureDefinition>;
1778def err_qualified_member_of_unrelated : Error<
1779  "%q0 is not a member of class %1">;
1780
1781def err_member_function_call_bad_cvr : Error<
1782  "'this' argument to member function %0 has type %1, but function is not marked "
1783  "%select{const|restrict|const or restrict|volatile|const or volatile|"
1784  "volatile or restrict|const, volatile, or restrict}2">;
1785def err_member_function_call_bad_ref : Error<
1786  "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1787  "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1788def err_member_function_call_bad_type : Error<
1789  "cannot initialize object parameter of type %0 with an expression "
1790  "of type %1">;
1791
1792def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1793  "call to pure virtual member function %0 has undefined behavior; "
1794  "overrides of %0 in subclasses are not available in the "
1795  "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1796
1797def select_special_member_kind : TextSubstitution<
1798  "%select{default constructor|copy constructor|move constructor|"
1799  "copy assignment operator|move assignment operator|destructor}0">;
1800
1801def note_member_declared_at : Note<"member is declared here">;
1802def note_ivar_decl : Note<"instance variable is declared here">;
1803def note_bitfield_decl : Note<"bit-field is declared here">;
1804def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1805def note_member_synthesized_at : Note<
1806  "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
1807  "first required here">;
1808def note_comparison_synthesized_at : Note<
1809  "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
1810  "first required here">;
1811def err_missing_default_ctor : Error<
1812  "%select{constructor for %1 must explicitly initialize the|"
1813  "implicit default constructor for %1 must explicitly initialize the|"
1814  "cannot use constructor inherited from base class %4;}0 "
1815  "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1816  "does not have a default constructor">;
1817def note_due_to_dllexported_class : Note<
1818  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1819
1820def err_illegal_union_or_anon_struct_member : Error<
1821  "%select{anonymous struct|union}0 member %1 has a non-trivial "
1822  "%sub{select_special_member_kind}2">;
1823
1824def warn_frame_address : Warning<
1825  "calling '%0' with a nonzero argument is unsafe">,
1826  InGroup<FrameAddress>, DefaultIgnore;
1827
1828def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1829  "%select{anonymous struct|union}0 member %1 with a non-trivial "
1830  "%sub{select_special_member_kind}2 is incompatible with C++98">,
1831  InGroup<CXX98Compat>, DefaultIgnore;
1832
1833def note_nontrivial_virtual_dtor : Note<
1834  "destructor for %0 is not trivial because it is virtual">;
1835def note_nontrivial_has_virtual : Note<
1836  "because type %0 has a virtual %select{member function|base class}1">;
1837def note_nontrivial_no_def_ctor : Note<
1838  "because %select{base class of |field of |}0type %1 has no "
1839  "default constructor">;
1840def note_user_declared_ctor : Note<
1841  "implicit default constructor suppressed by user-declared constructor">;
1842def note_nontrivial_no_copy : Note<
1843  "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1844  "assignment operator|<<ERROR>>}2 can be used to "
1845  "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1846  "%select{base class|field|an object}0 of type %3">;
1847def note_nontrivial_user_provided : Note<
1848  "because %select{base class of |field of |}0type %1 has a user-provided "
1849  "%sub{select_special_member_kind}2">;
1850def note_nontrivial_default_member_init : Note<
1851  "because field %0 has an initializer">;
1852def note_nontrivial_param_type : Note<
1853  "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
1854def note_nontrivial_default_arg : Note<"because it has a default argument">;
1855def note_nontrivial_variadic : Note<"because it is a variadic function">;
1856def note_nontrivial_subobject : Note<
1857  "because the function selected to %select{construct|copy|move|copy|move|"
1858  "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
1859def note_nontrivial_objc_ownership : Note<
1860  "because type %0 has a member with %select{no|no|__strong|__weak|"
1861  "__autoreleasing}1 ownership">;
1862
1863/// Selector for a TagTypeKind value.
1864def select_tag_type_kind : TextSubstitution<
1865  "%select{struct|interface|union|class|enum}0">;
1866
1867def err_static_data_member_not_allowed_in_anon_struct : Error<
1868  "static data member %0 not allowed in anonymous "
1869  "%sub{select_tag_type_kind}1">;
1870def ext_static_data_member_in_union : ExtWarn<
1871  "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
1872def warn_cxx98_compat_static_data_member_in_union : Warning<
1873  "static data member %0 in union is incompatible with C++98">,
1874  InGroup<CXX98Compat>, DefaultIgnore;
1875def ext_union_member_of_reference_type : ExtWarn<
1876  "union member %0 has reference type %1, which is a Microsoft extension">,
1877  InGroup<MicrosoftUnionMemberReference>;
1878def err_union_member_of_reference_type : Error<
1879  "union member %0 has reference type %1">;
1880def ext_anonymous_struct_union_qualified : Extension<
1881  "anonymous %select{struct|union}0 cannot be '%1'">;
1882def err_different_return_type_for_overriding_virtual_function : Error<
1883  "virtual function %0 has a different return type "
1884  "%diff{($) than the function it overrides (which has return type $)|"
1885  "than the function it overrides}1,2">;
1886def note_overridden_virtual_function : Note<
1887  "overridden virtual function is here">;
1888def err_conflicting_overriding_cc_attributes : Error<
1889  "virtual function %0 has different calling convention attributes "
1890  "%diff{($) than the function it overrides (which has calling convention $)|"
1891  "than the function it overrides}1,2">;
1892def warn_overriding_method_missing_noescape : Warning<
1893  "parameter of overriding method should be annotated with "
1894  "__attribute__((noescape))">, InGroup<MissingNoEscape>;
1895def note_overridden_marked_noescape : Note<
1896  "parameter of overridden method is annotated with __attribute__((noescape))">;
1897def note_cat_conform_to_noescape_prot : Note<
1898  "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
1899
1900def err_covariant_return_inaccessible_base : Error<
1901  "invalid covariant return for virtual function: %1 is a "
1902  "%select{private|protected}2 base class of %0">, AccessControl;
1903def err_covariant_return_ambiguous_derived_to_base_conv : Error<
1904  "return type of virtual function %3 is not covariant with the return type of "
1905  "the function it overrides (ambiguous conversion from derived class "
1906  "%0 to base class %1:%2)">;
1907def err_covariant_return_not_derived : Error<
1908  "return type of virtual function %0 is not covariant with the return type of "
1909  "the function it overrides (%1 is not derived from %2)">;
1910def err_covariant_return_incomplete : Error<
1911  "return type of virtual function %0 is not covariant with the return type of "
1912  "the function it overrides (%1 is incomplete)">;
1913def err_covariant_return_type_different_qualifications : Error<
1914  "return type of virtual function %0 is not covariant with the return type of "
1915  "the function it overrides (%1 has different qualifiers than %2)">;
1916def err_covariant_return_type_class_type_more_qualified : Error<
1917  "return type of virtual function %0 is not covariant with the return type of "
1918  "the function it overrides (class type %1 is more qualified than class "
1919  "type %2">;
1920
1921// C++ implicit special member functions
1922def note_in_declaration_of_implicit_special_member : Note<
1923  "while declaring the implicit %sub{select_special_member_kind}1"
1924  " for %0">;
1925
1926// C++ constructors
1927def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
1928def err_invalid_qualified_constructor : Error<
1929  "'%0' qualifier is not allowed on a constructor">;
1930def err_ref_qualifier_constructor : Error<
1931  "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
1932
1933def err_constructor_return_type : Error<
1934  "constructor cannot have a return type">;
1935def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
1936def err_constructor_byvalue_arg : Error<
1937  "copy constructor must pass its first argument by reference">;
1938def warn_no_constructor_for_refconst : Warning<
1939  "%select{struct|interface|union|class|enum}0 %1 does not declare any "
1940  "constructor to initialize its non-modifiable members">;
1941def note_refconst_member_not_initialized : Note<
1942  "%select{const|reference}0 member %1 will never be initialized">;
1943def ext_ms_explicit_constructor_call : ExtWarn<
1944  "explicit constructor calls are a Microsoft extension">,
1945  InGroup<MicrosoftExplicitConstructorCall>;
1946
1947// C++ destructors
1948def err_destructor_not_member : Error<
1949  "destructor must be a non-static member function">;
1950def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
1951def err_invalid_qualified_destructor : Error<
1952  "'%0' qualifier is not allowed on a destructor">;
1953def err_ref_qualifier_destructor : Error<
1954  "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
1955def err_destructor_return_type : Error<"destructor cannot have a return type">;
1956def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
1957def err_destructor_with_params : Error<"destructor cannot have any parameters">;
1958def err_destructor_variadic : Error<"destructor cannot be variadic">;
1959def ext_destructor_typedef_name : ExtWarn<
1960  "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
1961  "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
1962def err_undeclared_destructor_name : Error<
1963  "undeclared identifier %0 in destructor name">;
1964def err_destructor_name : Error<
1965  "expected the class name after '~' to name the enclosing class">;
1966def err_destructor_name_nontype : Error<
1967  "identifier %0 after '~' in destructor name does not name a type">;
1968def err_destructor_expr_mismatch : Error<
1969  "identifier %0 in object destruction expression does not name the type "
1970  "%1 of the object being destroyed">;
1971def err_destructor_expr_nontype : Error<
1972  "identifier %0 in object destruction expression does not name a type">;
1973def err_destructor_expr_type_mismatch : Error<
1974  "destructor type %0 in object destruction expression does not match the "
1975  "type %1 of the object being destroyed">;
1976def note_destructor_type_here : Note<
1977  "type %0 found by destructor name lookup">;
1978def note_destructor_nontype_here : Note<
1979  "non-type declaration found by destructor name lookup">;
1980def ext_dtor_named_in_wrong_scope : Extension<
1981  "ISO C++ requires the name after '::~' to be found in the same scope as "
1982  "the name before '::~'">, InGroup<DtorName>;
1983def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
1984  "qualified destructor name only found in lexical scope; omit the qualifier "
1985  "to find this type name by unqualified lookup">, InGroup<DtorName>;
1986def ext_dtor_name_ambiguous : Extension<
1987  "ISO C++ considers this destructor name lookup to be ambiguous">,
1988  InGroup<DtorName>;
1989
1990def err_destroy_attr_on_non_static_var : Error<
1991  "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
1992  " variable with static or thread storage duration">;
1993
1994def err_destructor_template : Error<
1995  "destructor cannot be declared as a template">;
1996
1997// C++ initialization
1998def err_init_conversion_failed : Error<
1999  "cannot initialize %select{a variable|a parameter|template parameter|"
2000  "return object|statement expression result|an "
2001  "exception object|a member subobject|an array element|a new value|a value|a "
2002  "base class|a constructor delegation|a vector element|a block element|a "
2003  "block element|a complex element|a lambda capture|a compound literal "
2004  "initializer|a related result|a parameter of CF audited function}0 "
2005  "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2006  "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2007  "%select{|: different classes%diff{ ($ vs $)|}5,6"
2008  "|: different number of parameters (%5 vs %6)"
2009  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2010  "|: different return type%diff{ ($ vs $)|}5,6"
2011  "|: different qualifiers (%5 vs %6)"
2012  "|: different exception specifications}4">;
2013def note_forward_class_conversion : Note<"%0 is not defined, but forward "
2014  "declared here; conversion would be valid if it was derived from %1">;
2015
2016def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2017  "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2018def err_lvalue_reference_bind_to_initlist : Error<
2019  "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2020  "initializer list temporary">;
2021def err_lvalue_reference_bind_to_temporary : Error<
2022  "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2023  "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2024def err_lvalue_reference_bind_to_unrelated : Error<
2025  "%select{non-const|volatile}0 lvalue reference "
2026  "%diff{to type $ cannot bind to a value of unrelated type $|"
2027  "cannot bind to a value of unrelated type}1,2">;
2028def err_reference_bind_drops_quals : Error<
2029  "binding reference %diff{of type $ to value of type $|to value}0,1 "
2030  "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2031  "not permitted due to incompatible qualifiers}2">;
2032def err_reference_bind_failed : Error<
2033  "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2034  "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2035  "incompatible type}0,3">;
2036def err_reference_bind_temporary_addrspace : Error<
2037  "reference of type %0 cannot bind to a temporary object because of "
2038  "address space mismatch">;
2039def err_reference_bind_init_list : Error<
2040  "reference to type %0 cannot bind to an initializer list">;
2041def err_init_list_bad_dest_type : Error<
2042  "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2043  "list">;
2044def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2045  "aggregate initialization of type %0 with user-declared constructors "
2046  "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2047
2048def err_reference_bind_to_bitfield : Error<
2049  "%select{non-const|volatile}0 reference cannot bind to "
2050  "bit-field%select{| %1}2">;
2051def err_reference_bind_to_vector_element : Error<
2052  "%select{non-const|volatile}0 reference cannot bind to vector element">;
2053def err_reference_bind_to_matrix_element : Error<
2054  "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2055def err_reference_var_requires_init : Error<
2056  "declaration of reference variable %0 requires an initializer">;
2057def err_reference_without_init : Error<
2058  "reference to type %0 requires an initializer">;
2059def note_value_initialization_here : Note<
2060  "in value-initialization of type %0 here">;
2061def err_reference_has_multiple_inits : Error<
2062  "reference cannot be initialized with multiple values">;
2063def err_init_non_aggr_init_list : Error<
2064  "initialization of non-aggregate type %0 with an initializer list">;
2065def err_init_reference_member_uninitialized : Error<
2066  "reference member of type %0 uninitialized">;
2067def note_uninit_reference_member : Note<
2068  "uninitialized reference member is here">;
2069def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2070  InGroup<Uninitialized>;
2071def warn_base_class_is_uninit : Warning<
2072  "base class %0 is uninitialized when used here to access %q1">,
2073  InGroup<Uninitialized>;
2074def warn_reference_field_is_uninit : Warning<
2075  "reference %0 is not yet bound to a value when used here">,
2076  InGroup<Uninitialized>;
2077def note_uninit_in_this_constructor : Note<
2078  "during field initialization in %select{this|the implicit default}0 "
2079  "constructor">;
2080def warn_static_self_reference_in_init : Warning<
2081  "static variable %0 is suspiciously used within its own initialization">,
2082  InGroup<UninitializedStaticSelfInit>;
2083def warn_uninit_self_reference_in_init : Warning<
2084  "variable %0 is uninitialized when used within its own initialization">,
2085  InGroup<Uninitialized>;
2086def warn_uninit_self_reference_in_reference_init : Warning<
2087  "reference %0 is not yet bound to a value when used within its own"
2088  " initialization">,
2089  InGroup<Uninitialized>;
2090def warn_uninit_var : Warning<
2091  "variable %0 is uninitialized when %select{used here|captured by block}1">,
2092  InGroup<Uninitialized>, DefaultIgnore;
2093def warn_sometimes_uninit_var : Warning<
2094  "variable %0 is %select{used|captured}1 uninitialized whenever "
2095  "%select{'%3' condition is %select{true|false}4|"
2096  "'%3' loop %select{is entered|exits because its condition is false}4|"
2097  "'%3' loop %select{condition is true|exits because its condition is false}4|"
2098  "switch %3 is taken|"
2099  "its declaration is reached|"
2100  "%3 is called}2">,
2101  InGroup<UninitializedSometimes>, DefaultIgnore;
2102def warn_maybe_uninit_var : Warning<
2103  "variable %0 may be uninitialized when "
2104  "%select{used here|captured by block}1">,
2105  InGroup<UninitializedMaybe>, DefaultIgnore;
2106def note_var_declared_here : Note<"variable %0 is declared here">;
2107def note_uninit_var_use : Note<
2108  "%select{uninitialized use occurs|variable is captured by block}0 here">;
2109def warn_uninit_byref_blockvar_captured_by_block : Warning<
2110  "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2111  "block">, InGroup<Uninitialized>, DefaultIgnore;
2112def note_block_var_fixit_add_initialization : Note<
2113  "did you mean to use __block %0?">;
2114def note_in_omitted_aggregate_initializer : Note<
2115  "in implicit initialization of %select{"
2116  "array element %1 with omitted initializer|"
2117  "field %1 with omitted initializer|"
2118  "trailing array elements in runtime-sized array new}0">;
2119def note_in_reference_temporary_list_initializer : Note<
2120  "in initialization of temporary of type %0 created to "
2121  "list-initialize this reference">;
2122def note_var_fixit_add_initialization : Note<
2123  "initialize the variable %0 to silence this warning">;
2124def note_uninit_fixit_remove_cond : Note<
2125  "remove the %select{'%1' if its condition|condition if it}0 "
2126  "is always %select{false|true}2">;
2127def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2128def err_list_init_in_parens : Error<
2129  "cannot initialize %select{non-class|reference}0 type %1 with a "
2130  "parenthesized initializer list">;
2131
2132def warn_uninit_const_reference : Warning<
2133  "variable %0 is uninitialized when passed as a const reference argument "
2134  "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2135
2136def warn_unsequenced_mod_mod : Warning<
2137  "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2138def warn_unsequenced_mod_use : Warning<
2139  "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2140
2141def select_initialized_entity_kind : TextSubstitution<
2142  "%select{copying variable|copying parameter|initializing template parameter|"
2143  "returning object|initializing statement expression result|"
2144  "throwing object|copying member subobject|copying array element|"
2145  "allocating object|copying temporary|initializing base subobject|"
2146  "initializing vector element|capturing value}0">;
2147
2148def err_temp_copy_no_viable : Error<
2149  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2150def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2151  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2152  "C++98 requires a copy constructor when binding a reference to a temporary">,
2153  InGroup<BindToTemporaryCopy>;
2154def err_temp_copy_ambiguous : Error<
2155  "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2156  "of type %1">;
2157def err_temp_copy_deleted : Error<
2158  "%sub{select_initialized_entity_kind}0 of type %1 "
2159  "invokes deleted constructor">;
2160def err_temp_copy_incomplete : Error<
2161  "copying a temporary object of incomplete type %0">;
2162def warn_cxx98_compat_temp_copy : Warning<
2163  "%sub{select_initialized_entity_kind}1 "
2164  "of type %2 when binding a reference to a temporary would %select{invoke "
2165  "an inaccessible constructor|find no viable constructor|find ambiguous "
2166  "constructors|invoke a deleted constructor}0 in C++98">,
2167  InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2168def err_selected_explicit_constructor : Error<
2169  "chosen constructor is explicit in copy-initialization">;
2170def note_explicit_ctor_deduction_guide_here : Note<
2171  "explicit %select{constructor|deduction guide}0 declared here">;
2172
2173// C++11 decltype
2174def err_decltype_in_declarator : Error<
2175    "'decltype' cannot be used to name a declaration">;
2176
2177// C++11 auto
2178def warn_cxx98_compat_auto_type_specifier : Warning<
2179  "'auto' type specifier is incompatible with C++98">,
2180  InGroup<CXX98Compat>, DefaultIgnore;
2181def err_auto_variable_cannot_appear_in_own_initializer : Error<
2182  "variable %0 declared with deduced type %1 "
2183  "cannot appear in its own initializer">;
2184def err_binding_cannot_appear_in_own_initializer : Error<
2185  "binding %0 cannot appear in the initializer of its own "
2186  "decomposition declaration">;
2187def err_illegal_decl_array_of_auto : Error<
2188  "'%0' declared as array of %1">;
2189def err_new_array_of_auto : Error<
2190  "cannot allocate array of 'auto'">;
2191def err_auto_not_allowed : Error<
2192  "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2193  "use of "
2194  "%select{class template|function template|variable template|alias template|"
2195  "template template parameter|concept|template}2 %3 requires template "
2196  "arguments; argument deduction}0 not allowed "
2197  "%select{in function prototype"
2198  "|in non-static struct member|in struct member"
2199  "|in non-static union member|in union member"
2200  "|in non-static class member|in interface member"
2201  "|in exception declaration|in template parameter until C++17|in block literal"
2202  "|in template argument|in typedef|in type alias|in function return type"
2203  "|in conversion function type|here|in lambda parameter"
2204  "|in type allocated by 'new'|in K&R-style function parameter"
2205  "|in template parameter|in friend declaration|in function prototype that is "
2206  "not a function declaration|in requires expression parameter}1">;
2207def err_dependent_deduced_tst : Error<
2208  "typename specifier refers to "
2209  "%select{class template|function template|variable template|alias template|"
2210  "template template parameter|template}0 member in %1; "
2211  "argument deduction not allowed here">;
2212def err_deduced_tst : Error<
2213  "typename specifier refers to "
2214  "%select{class template|function template|variable template|alias template|"
2215  "template template parameter|template}0; argument deduction not allowed "
2216  "here">;
2217def err_auto_not_allowed_var_inst : Error<
2218  "'auto' variable template instantiation is not allowed">;
2219def err_auto_var_requires_init : Error<
2220  "declaration of variable %0 with deduced type %1 requires an initializer">;
2221def err_auto_new_requires_ctor_arg : Error<
2222  "new expression for type %0 requires a constructor argument">;
2223def ext_auto_new_list_init : Extension<
2224  "ISO C++ standards before C++17 do not allow new expression for "
2225  "type %0 to use list-initialization">, InGroup<CXX17>;
2226def err_auto_var_init_no_expression : Error<
2227  "initializer for variable %0 with type %1 is empty">;
2228def err_auto_var_init_multiple_expressions : Error<
2229  "initializer for variable %0 with type %1 contains multiple expressions">;
2230def err_auto_var_init_paren_braces : Error<
2231  "cannot deduce type for variable %1 with type %2 from "
2232  "%select{parenthesized|nested}0 initializer list">;
2233def err_auto_new_ctor_multiple_expressions : Error<
2234  "new expression for type %0 contains multiple constructor arguments">;
2235def err_auto_missing_trailing_return : Error<
2236  "'auto' return without trailing return type; deduced return types are a "
2237  "C++14 extension">;
2238def err_deduced_return_type : Error<
2239  "deduced return types are a C++14 extension">;
2240def err_trailing_return_without_auto : Error<
2241  "function with trailing return type must specify return type 'auto', not %0">;
2242def err_trailing_return_in_parens : Error<
2243  "trailing return type may not be nested within parentheses">;
2244def err_auto_var_deduction_failure : Error<
2245  "variable %0 with type %1 has incompatible initializer of type %2">;
2246def err_auto_var_deduction_failure_from_init_list : Error<
2247  "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2248def err_auto_new_deduction_failure : Error<
2249  "new expression for type %0 has incompatible constructor argument of type %1">;
2250def err_auto_inconsistent_deduction : Error<
2251  "deduced conflicting types %diff{($ vs $) |}0,1"
2252  "for initializer list element type">;
2253def err_auto_different_deductions : Error<
2254  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2255  "deduced as %1 in declaration of %2 and "
2256  "deduced as %3 in declaration of %4">;
2257def err_auto_non_deduced_not_alone : Error<
2258  "%select{function with deduced return type|"
2259  "declaration with trailing return type}0 "
2260  "must be the only declaration in its group">;
2261def err_implied_std_initializer_list_not_found : Error<
2262  "cannot deduce type of initializer list because std::initializer_list was "
2263  "not found; include <initializer_list>">;
2264def err_malformed_std_initializer_list : Error<
2265  "std::initializer_list must be a class template with a single type parameter">;
2266def err_auto_init_list_from_c : Error<
2267  "cannot use __auto_type with initializer list in C">;
2268def err_auto_bitfield : Error<
2269  "cannot pass bit-field as __auto_type initializer in C">;
2270
2271// C++1y decltype(auto) type
2272def err_decltype_auto_invalid : Error<
2273  "'decltype(auto)' not allowed here">;
2274def err_decltype_auto_cannot_be_combined : Error<
2275  "'decltype(auto)' cannot be combined with other type specifiers">;
2276def err_decltype_auto_function_declarator_not_declaration : Error<
2277  "'decltype(auto)' can only be used as a return type "
2278  "in a function declaration">;
2279def err_decltype_auto_compound_type : Error<
2280  "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2281def err_decltype_auto_initializer_list : Error<
2282  "cannot deduce 'decltype(auto)' from initializer list">;
2283
2284// C++17 deduced class template specialization types
2285def err_deduced_class_template_compound_type : Error<
2286  "cannot %select{form pointer to|form reference to|form array of|"
2287  "form function returning|use parentheses when declaring variable with}0 "
2288  "deduced class template specialization type">;
2289def err_deduced_non_class_template_specialization_type : Error<
2290  "%select{<error>|function template|variable template|alias template|"
2291  "template template parameter|concept|template}0 %1 requires template "
2292  "arguments; argument deduction only allowed for class templates">;
2293def err_deduced_class_template_ctor_ambiguous : Error<
2294  "ambiguous deduction for template arguments of %0">;
2295def err_deduced_class_template_ctor_no_viable : Error<
2296  "no viable constructor or deduction guide for deduction of "
2297  "template arguments of %0">;
2298def err_deduced_class_template_incomplete : Error<
2299  "template %0 has no definition and no %select{|viable }1deduction guides "
2300  "for deduction of template arguments">;
2301def err_deduced_class_template_deleted : Error<
2302  "class template argument deduction for %0 selected a deleted constructor">;
2303def err_deduced_class_template_explicit : Error<
2304  "class template argument deduction for %0 selected an explicit "
2305  "%select{constructor|deduction guide}1 for copy-list-initialization">;
2306def err_deduction_guide_no_trailing_return_type : Error<
2307  "deduction guide declaration without trailing return type">;
2308def err_deduction_guide_bad_trailing_return_type : Error<
2309  "deduced type %1 of deduction guide is not %select{|written as }2"
2310  "a specialization of template %0">;
2311def err_deduction_guide_with_complex_decl : Error<
2312  "cannot specify any part of a return type in the "
2313  "declaration of a deduction guide">;
2314def err_deduction_guide_invalid_specifier : Error<
2315  "deduction guide cannot be declared '%0'">;
2316def err_deduction_guide_name_not_class_template : Error<
2317  "cannot specify deduction guide for "
2318  "%select{<error>|function template|variable template|alias template|"
2319  "template template parameter|concept|dependent template name}0 %1">;
2320def err_deduction_guide_wrong_scope : Error<
2321  "deduction guide must be declared in the same scope as template %q0">;
2322def err_deduction_guide_defines_function : Error<
2323  "deduction guide cannot have a function definition">;
2324def err_deduction_guide_redeclared : Error<
2325  "redeclaration of deduction guide">;
2326def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2327  "%select{explicitly instantiated|explicitly specialized}0">;
2328def err_deduction_guide_template_not_deducible : Error<
2329  "deduction guide template contains "
2330  "%select{a template parameter|template parameters}0 that cannot be "
2331  "deduced">;
2332def err_deduction_guide_wrong_access : Error<
2333  "deduction guide has different access from the corresponding "
2334  "member template">;
2335def note_deduction_guide_template_access : Note<
2336  "member template declared %0 here">;
2337def note_deduction_guide_access : Note<
2338  "deduction guide declared %0 by intervening access specifier">;
2339def warn_cxx14_compat_class_template_argument_deduction : Warning<
2340  "class template argument deduction is incompatible with C++ standards "
2341  "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2342  InGroup<CXXPre17Compat>, DefaultIgnore;
2343def warn_ctad_maybe_unsupported : Warning<
2344  "%0 may not intend to support class template argument deduction">,
2345  InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2346def note_suppress_ctad_maybe_unsupported : Note<
2347  "add a deduction guide to suppress this warning">;
2348
2349
2350// C++14 deduced return types
2351def err_auto_fn_deduction_failure : Error<
2352  "cannot deduce return type %0 from returned value of type %1">;
2353def err_auto_fn_different_deductions : Error<
2354  "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2355  "deduced as %2 in earlier return statement">;
2356def err_auto_fn_used_before_defined : Error<
2357  "function %0 with deduced return type cannot be used before it is defined">;
2358def err_auto_fn_no_return_but_not_auto : Error<
2359  "cannot deduce return type %0 for function with no return statements">;
2360def err_auto_fn_return_void_but_not_auto : Error<
2361  "cannot deduce return type %0 from omitted return expression">;
2362def err_auto_fn_return_init_list : Error<
2363  "cannot deduce return type from initializer list">;
2364def err_auto_fn_virtual : Error<
2365  "function with deduced return type cannot be virtual">;
2366def warn_cxx11_compat_deduced_return_type : Warning<
2367  "return type deduction is incompatible with C++ standards before C++14">,
2368  InGroup<CXXPre14Compat>, DefaultIgnore;
2369
2370// C++11 override control
2371def override_keyword_only_allowed_on_virtual_member_functions : Error<
2372  "only virtual member functions can be marked '%0'">;
2373def override_keyword_hides_virtual_member_function : Error<
2374  "non-virtual member function marked '%0' hides virtual member "
2375  "%select{function|functions}1">;
2376def err_function_marked_override_not_overriding : Error<
2377  "%0 marked 'override' but does not override any member functions">;
2378def warn_destructor_marked_not_override_overriding : TextSubstitution <
2379  "%0 overrides a destructor but is not marked 'override'">;
2380def warn_function_marked_not_override_overriding : TextSubstitution <
2381  "%0 overrides a member function but is not marked 'override'">;
2382def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2383  "%sub{warn_destructor_marked_not_override_overriding}0">,
2384  InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2385def warn_inconsistent_function_marked_not_override_overriding : Warning <
2386  "%sub{warn_function_marked_not_override_overriding}0">,
2387  InGroup<CXX11WarnInconsistentOverrideMethod>;
2388def warn_suggest_destructor_marked_not_override_overriding : Warning <
2389  "%sub{warn_destructor_marked_not_override_overriding}0">,
2390  InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2391def warn_suggest_function_marked_not_override_overriding : Warning <
2392  "%sub{warn_function_marked_not_override_overriding}0">,
2393  InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2394def err_class_marked_final_used_as_base : Error<
2395  "base %0 is marked '%select{final|sealed}1'">;
2396def warn_abstract_final_class : Warning<
2397  "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2398def warn_final_dtor_non_final_class : Warning<
2399  "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2400  InGroup<FinalDtorNonFinalClass>;
2401def note_final_dtor_non_final_class_silence : Note<
2402  "mark %0 as '%select{final|sealed}1' to silence this warning">;
2403
2404// C++11 attributes
2405def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2406
2407// C++11 final
2408def err_final_function_overridden : Error<
2409  "declaration of %0 overrides a '%select{final|sealed}1' function">;
2410
2411// C++11 scoped enumerations
2412def err_enum_invalid_underlying : Error<
2413  "non-integral type %0 is an invalid underlying type">;
2414def err_enumerator_too_large : Error<
2415  "enumerator value is not representable in the underlying type %0">;
2416def ext_enumerator_too_large : Extension<
2417  "enumerator value is not representable in the underlying type %0">,
2418  InGroup<MicrosoftEnumValue>;
2419def err_enumerator_wrapped : Error<
2420  "enumerator value %0 is not representable in the underlying type %1">;
2421def err_enum_redeclare_type_mismatch : Error<
2422  "enumeration redeclared with different underlying type %0 (was %1)">;
2423def err_enum_redeclare_fixed_mismatch : Error<
2424  "enumeration previously declared with %select{non|}0fixed underlying type">;
2425def err_enum_redeclare_scoped_mismatch : Error<
2426  "enumeration previously declared as %select{un|}0scoped">;
2427def err_only_enums_have_underlying_types : Error<
2428  "only enumeration types have underlying types">;
2429def err_underlying_type_of_incomplete_enum : Error<
2430  "cannot determine underlying type of incomplete enumeration type %0">;
2431
2432// C++11 delegating constructors
2433def err_delegating_ctor : Error<
2434  "delegating constructors are permitted only in C++11">;
2435def warn_cxx98_compat_delegating_ctor : Warning<
2436  "delegating constructors are incompatible with C++98">,
2437  InGroup<CXX98Compat>, DefaultIgnore;
2438def err_delegating_initializer_alone : Error<
2439  "an initializer for a delegating constructor must appear alone">;
2440def warn_delegating_ctor_cycle : Warning<
2441  "constructor for %0 creates a delegation cycle">, DefaultError,
2442  InGroup<DelegatingCtorCycles>;
2443def note_it_delegates_to : Note<"it delegates to">;
2444def note_which_delegates_to : Note<"which delegates to">;
2445
2446// C++11 range-based for loop
2447def err_for_range_decl_must_be_var : Error<
2448  "for range declaration must declare a variable">;
2449def err_for_range_storage_class : Error<
2450  "loop variable %0 may not be declared %select{'extern'|'static'|"
2451  "'__private_extern__'|'auto'|'register'|'constexpr'}1">;
2452def err_type_defined_in_for_range : Error<
2453  "types may not be defined in a for range declaration">;
2454def err_for_range_deduction_failure : Error<
2455  "cannot use type %0 as a range">;
2456def err_for_range_incomplete_type : Error<
2457  "cannot use incomplete type %0 as a range">;
2458def err_for_range_iter_deduction_failure : Error<
2459  "cannot use type %0 as an iterator">;
2460def ext_for_range_begin_end_types_differ : ExtWarn<
2461  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2462  InGroup<CXX17>;
2463def warn_for_range_begin_end_types_differ : Warning<
2464  "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2465  "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2466def note_in_for_range: Note<
2467  "when looking up '%select{begin|end}0' function for range expression "
2468  "of type %1">;
2469def err_for_range_invalid: Error<
2470  "invalid range expression of type %0; no viable '%select{begin|end}1' "
2471  "function available">;
2472def note_for_range_member_begin_end_ignored : Note<
2473  "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2474def err_range_on_array_parameter : Error<
2475  "cannot build range expression with array function parameter %0 since "
2476  "parameter with array type %1 is treated as pointer type %2">;
2477def err_for_range_dereference : Error<
2478  "invalid range expression of type %0; did you mean to dereference it "
2479  "with '*'?">;
2480def note_for_range_invalid_iterator : Note <
2481  "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2482def note_for_range_begin_end : Note<
2483  "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2484def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2485  "loop variable %0 "
2486  "%diff{of type $ binds to a temporary constructed from type $"
2487  "|binds to a temporary constructed from a different type}1,2">,
2488  InGroup<RangeLoopConstruct>, DefaultIgnore;
2489def note_use_type_or_non_reference : Note<
2490  "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2491def warn_for_range_ref_binds_ret_temp : Warning<
2492  "loop variable %0 binds to a temporary value produced by a range of type %1">,
2493  InGroup<RangeLoopBindReference>, DefaultIgnore;
2494def note_use_non_reference_type : Note<"use non-reference type %0">;
2495def warn_for_range_copy : Warning<
2496  "loop variable %0 creates a copy from type %1">,
2497  InGroup<RangeLoopConstruct>, DefaultIgnore;
2498def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2499def err_objc_for_range_init_stmt : Error<
2500  "initialization statement is not supported when iterating over Objective-C "
2501  "collection">;
2502
2503// C++11 constexpr
2504def warn_cxx98_compat_constexpr : Warning<
2505  "'constexpr' specifier is incompatible with C++98">,
2506  InGroup<CXX98Compat>, DefaultIgnore;
2507// FIXME: Maybe this should also go in -Wc++14-compat?
2508def warn_cxx14_compat_constexpr_not_const : Warning<
2509  "'constexpr' non-static member function will not be implicitly 'const' "
2510  "in C++14; add 'const' to avoid a change in behavior">,
2511  InGroup<DiagGroup<"constexpr-not-const">>;
2512def err_invalid_consteval_take_address : Error<
2513  "cannot take address of consteval function %0 outside"
2514  " of an immediate invocation">;
2515def err_invalid_consteval_call : Error<
2516  "call to consteval function %q0 is not a constant expression">;
2517def err_invalid_consteval_decl_kind : Error<
2518  "%0 cannot be declared consteval">;
2519def err_invalid_constexpr : Error<
2520  "%select{function parameter|typedef}0 "
2521  "cannot be %sub{select_constexpr_spec_kind}1">;
2522def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2523  "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2524def err_constexpr_tag : Error<
2525  "%select{class|struct|interface|union|enum}0 "
2526  "cannot be marked %sub{select_constexpr_spec_kind}1">;
2527def err_constexpr_dtor : Error<
2528  "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2529def err_constexpr_dtor_subobject : Error<
2530  "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2531  "%select{data member %2|base class %3}1 does not have a "
2532  "constexpr destructor">;
2533def note_constexpr_dtor_subobject : Note<
2534  "%select{data member %1|base class %2}0 declared here">;
2535def err_constexpr_wrong_decl_kind : Error<
2536  "%sub{select_constexpr_spec_kind}0 can only be used "
2537  "in %select{|variable and function|function|variable}0 declarations">;
2538def err_invalid_constexpr_var_decl : Error<
2539  "constexpr variable declaration must be a definition">;
2540def err_constexpr_static_mem_var_requires_init : Error<
2541  "declaration of constexpr static data member %0 requires an initializer">;
2542def err_constexpr_var_non_literal : Error<
2543  "constexpr variable cannot have non-literal type %0">;
2544def err_constexpr_var_requires_const_init : Error<
2545  "constexpr variable %0 must be initialized by a constant expression">;
2546def err_constexpr_var_requires_const_destruction : Error<
2547  "constexpr variable %0 must have constant destruction">;
2548def err_constexpr_redecl_mismatch : Error<
2549  "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2550  " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2551def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2552def warn_cxx17_compat_constexpr_virtual : Warning<
2553  "virtual constexpr functions are incompatible with "
2554  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2555def err_constexpr_virtual_base : Error<
2556  "constexpr %select{member function|constructor}0 not allowed in "
2557  "%select{struct|interface|class}1 with virtual base "
2558  "%plural{1:class|:classes}2">;
2559def note_non_literal_incomplete : Note<
2560  "incomplete type %0 is not a literal type">;
2561def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2562  "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2563def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2564def err_constexpr_non_literal_return : Error<
2565  "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2566def err_constexpr_non_literal_param : Error<
2567  "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2568  "not a literal type">;
2569def err_constexpr_body_invalid_stmt : Error<
2570  "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2571def ext_constexpr_body_invalid_stmt : ExtWarn<
2572  "use of this statement in a constexpr %select{function|constructor}0 "
2573  "is a C++14 extension">, InGroup<CXX14>;
2574def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2575  "use of this statement in a constexpr %select{function|constructor}0 "
2576  "is incompatible with C++ standards before C++14">,
2577  InGroup<CXXPre14Compat>, DefaultIgnore;
2578def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2579  "use of this statement in a constexpr %select{function|constructor}0 "
2580  "is a C++20 extension">, InGroup<CXX20>;
2581def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2582  "use of this statement in a constexpr %select{function|constructor}0 "
2583  "is incompatible with C++ standards before C++20">,
2584  InGroup<CXXPre20Compat>, DefaultIgnore;
2585def ext_constexpr_type_definition : ExtWarn<
2586  "type definition in a constexpr %select{function|constructor}0 "
2587  "is a C++14 extension">, InGroup<CXX14>;
2588def warn_cxx11_compat_constexpr_type_definition : Warning<
2589  "type definition in a constexpr %select{function|constructor}0 "
2590  "is incompatible with C++ standards before C++14">,
2591  InGroup<CXXPre14Compat>, DefaultIgnore;
2592def err_constexpr_vla : Error<
2593  "variably-modified type %0 cannot be used in a constexpr "
2594  "%select{function|constructor}1">;
2595def ext_constexpr_local_var : ExtWarn<
2596  "variable declaration in a constexpr %select{function|constructor}0 "
2597  "is a C++14 extension">, InGroup<CXX14>;
2598def warn_cxx11_compat_constexpr_local_var : Warning<
2599  "variable declaration in a constexpr %select{function|constructor}0 "
2600  "is incompatible with C++ standards before C++14">,
2601  InGroup<CXXPre14Compat>, DefaultIgnore;
2602def err_constexpr_local_var_static : Error<
2603  "%select{static|thread_local}1 variable not permitted in a constexpr "
2604  "%select{function|constructor}0">;
2605def err_constexpr_local_var_non_literal_type : Error<
2606  "variable of non-literal type %1 cannot be defined in a constexpr "
2607  "%select{function|constructor}0">;
2608def ext_constexpr_local_var_no_init : ExtWarn<
2609  "uninitialized variable in a constexpr %select{function|constructor}0 "
2610  "is a C++20 extension">, InGroup<CXX20>;
2611def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2612  "uninitialized variable in a constexpr %select{function|constructor}0 "
2613  "is incompatible with C++ standards before C++20">,
2614  InGroup<CXXPre20Compat>, DefaultIgnore;
2615def ext_constexpr_function_never_constant_expr : ExtWarn<
2616  "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2617  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2618def err_attr_cond_never_constant_expr : Error<
2619  "%0 attribute expression never produces a constant expression">;
2620def err_diagnose_if_invalid_diagnostic_type : Error<
2621  "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2622  "instead">;
2623def err_constexpr_body_no_return : Error<
2624  "no return statement in %select{constexpr|consteval}0 function">;
2625def err_constexpr_return_missing_expr : Error<
2626  "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2627def warn_cxx11_compat_constexpr_body_no_return : Warning<
2628  "constexpr function with no return statements is incompatible with C++ "
2629  "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2630def ext_constexpr_body_multiple_return : ExtWarn<
2631  "multiple return statements in constexpr function is a C++14 extension">,
2632  InGroup<CXX14>;
2633def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2634  "multiple return statements in constexpr function "
2635  "is incompatible with C++ standards before C++14">,
2636  InGroup<CXXPre14Compat>, DefaultIgnore;
2637def note_constexpr_body_previous_return : Note<
2638  "previous return statement is here">;
2639
2640// C++20 function try blocks in constexpr
2641def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2642  "function try block in constexpr %select{function|constructor}0 is "
2643  "a C++20 extension">, InGroup<CXX20>;
2644def warn_cxx17_compat_constexpr_function_try_block : Warning<
2645  "function try block in constexpr %select{function|constructor}0 is "
2646  "incompatible with C++ standards before C++20">,
2647  InGroup<CXXPre20Compat>, DefaultIgnore;
2648
2649def ext_constexpr_union_ctor_no_init : ExtWarn<
2650  "constexpr union constructor that does not initialize any member "
2651  "is a C++20 extension">, InGroup<CXX20>;
2652def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2653  "constexpr union constructor that does not initialize any member "
2654  "is incompatible with C++ standards before C++20">,
2655  InGroup<CXXPre20Compat>, DefaultIgnore;
2656def ext_constexpr_ctor_missing_init : ExtWarn<
2657  "constexpr constructor that does not initialize all members "
2658  "is a C++20 extension">, InGroup<CXX20>;
2659def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2660  "constexpr constructor that does not initialize all members "
2661  "is incompatible with C++ standards before C++20">,
2662  InGroup<CXXPre20Compat>, DefaultIgnore;
2663def note_constexpr_ctor_missing_init : Note<
2664  "member not initialized by constructor">;
2665def note_non_literal_no_constexpr_ctors : Note<
2666  "%0 is not literal because it is not an aggregate and has no constexpr "
2667  "constructors other than copy or move constructors">;
2668def note_non_literal_base_class : Note<
2669  "%0 is not literal because it has base class %1 of non-literal type">;
2670def note_non_literal_field : Note<
2671  "%0 is not literal because it has data member %1 of "
2672  "%select{non-literal|volatile}3 type %2">;
2673def note_non_literal_user_provided_dtor : Note<
2674  "%0 is not literal because it has a user-provided destructor">;
2675def note_non_literal_nontrivial_dtor : Note<
2676  "%0 is not literal because it has a non-trivial destructor">;
2677def note_non_literal_non_constexpr_dtor : Note<
2678  "%0 is not literal because its destructor is not constexpr">;
2679def note_non_literal_lambda : Note<
2680  "lambda closure types are non-literal types before C++17">;
2681def warn_private_extern : Warning<
2682  "use of __private_extern__ on a declaration may not produce external symbol "
2683  "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2684def note_private_extern : Note<
2685  "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2686
2687// C++ Concepts
2688def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2689  "concept declarations may only appear in global or namespace scope">;
2690def err_concept_no_parameters : Error<
2691  "concept template parameter list must have at least one parameter; explicit "
2692  "specialization of concepts is not allowed">;
2693def err_concept_extra_headers : Error<
2694  "extraneous template parameter list in concept definition">;
2695def err_concept_no_associated_constraints : Error<
2696  "concept cannot have associated constraints">;
2697def err_non_constant_constraint_expression : Error<
2698  "substitution into constraint expression resulted in a non-constant "
2699  "expression">;
2700def err_non_bool_atomic_constraint : Error<
2701  "atomic constraint must be of type 'bool' (found %0)">;
2702def err_template_arg_list_constraints_not_satisfied : Error<
2703  "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2704  "template template parameter|template}0 %1%2">;
2705def note_substituted_constraint_expr_is_ill_formed : Note<
2706  "because substituted constraint expression is ill-formed%0">;
2707def note_atomic_constraint_evaluated_to_false : Note<
2708  "%select{and|because}0 '%1' evaluated to false">;
2709def note_concept_specialization_constraint_evaluated_to_false : Note<
2710  "%select{and|because}0 '%1' evaluated to false">;
2711def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2712  "%select{and|because}0 %1 does not satisfy %2">;
2713def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2714  "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2715def err_constrained_virtual_method : Error<
2716  "virtual function cannot have a requires clause">;
2717def err_trailing_requires_clause_on_deduction_guide : Error<
2718  "deduction guide cannot have a requires clause">;
2719def err_reference_to_function_with_unsatisfied_constraints : Error<
2720  "invalid reference to function %0: constraints not satisfied">;
2721def err_requires_expr_local_parameter_default_argument : Error<
2722  "default arguments not allowed for parameters of a requires expression">;
2723def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2724  "constraint variable %0 cannot be used in an evaluated context">;
2725def note_expr_requirement_expr_substitution_error : Note<
2726  "%select{and|because}0 '%1' would be invalid: %2">;
2727def note_expr_requirement_expr_unknown_substitution_error : Note<
2728  "%select{and|because}0 '%1' would be invalid">;
2729def note_expr_requirement_noexcept_not_met : Note<
2730  "%select{and|because}0 '%1' may throw an exception">;
2731def note_expr_requirement_type_requirement_substitution_error : Note<
2732  "%select{and|because}0 '%1' would be invalid: %2">;
2733def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
2734  "%select{and|because}0 '%1' would be invalid">;
2735def note_expr_requirement_constraints_not_satisfied : Note<
2736  "%select{and|because}0 type constraint '%1' was not satisfied:">;
2737def note_expr_requirement_constraints_not_satisfied_simple : Note<
2738  "%select{and|because}0 %1 does not satisfy %2:">;
2739def note_type_requirement_substitution_error : Note<
2740  "%select{and|because}0 '%1' would be invalid: %2">;
2741def note_type_requirement_unknown_substitution_error : Note<
2742  "%select{and|because}0 '%1' would be invalid">;
2743def note_nested_requirement_substitution_error : Note<
2744  "%select{and|because}0 '%1' would be invalid: %2">;
2745def note_nested_requirement_unknown_substitution_error : Note<
2746  "%select{and|because}0 '%1' would be invalid">;
2747def note_ambiguous_atomic_constraints : Note<
2748  "similar constraint expressions not considered equivalent; constraint "
2749  "expressions cannot be considered equivalent unless they originate from the "
2750  "same concept">;
2751def note_ambiguous_atomic_constraints_similar_expression : Note<
2752  "similar constraint expression here">;
2753def err_unsupported_placeholder_constraint : Error<
2754  "constrained placeholder types other than simple 'auto' on non-type template "
2755  "parameters not supported yet">;
2756
2757def err_template_different_requires_clause : Error<
2758  "requires clause differs in template redeclaration">;
2759def err_template_different_type_constraint : Error<
2760  "type constraint differs in template redeclaration">;
2761def err_template_template_parameter_not_at_least_as_constrained : Error<
2762  "template template argument %0 is more constrained than template template "
2763  "parameter %1">;
2764
2765def err_type_constraint_non_type_concept : Error<
2766  "concept named in type constraint is not a type concept">;
2767def err_type_constraint_missing_arguments : Error<
2768  "%0 requires more than 1 template argument; provide the remaining arguments "
2769  "explicitly to use it here">;
2770def err_placeholder_constraints_not_satisfied : Error<
2771  "deduced type %0 does not satisfy %1">;
2772
2773// C++11 char16_t/char32_t
2774def warn_cxx98_compat_unicode_type : Warning<
2775  "'%0' type specifier is incompatible with C++98">,
2776  InGroup<CXX98Compat>, DefaultIgnore;
2777def warn_cxx17_compat_unicode_type : Warning<
2778  "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2779  InGroup<CXXPre20Compat>, DefaultIgnore;
2780
2781// __make_integer_seq
2782def err_integer_sequence_negative_length : Error<
2783  "integer sequences must have non-negative sequence length">;
2784def err_integer_sequence_integral_element_type : Error<
2785  "integer sequences must have integral element type">;
2786
2787// __type_pack_element
2788def err_type_pack_element_out_of_bounds : Error<
2789  "a parameter pack may not be accessed at an out of bounds index">;
2790
2791// Objective-C++
2792def err_objc_decls_may_only_appear_in_global_scope : Error<
2793  "Objective-C declarations may only appear in global scope">;
2794def warn_auto_var_is_id : Warning<
2795  "'auto' deduced as 'id' in declaration of %0">,
2796  InGroup<DiagGroup<"auto-var-id">>;
2797
2798// Attributes
2799def warn_nomerge_attribute_ignored_in_stmt: Warning<
2800  "%0 attribute is ignored because there exists no call expression inside the "
2801  "statement">,
2802  InGroup<IgnoredAttributes>;
2803def err_nsobject_attribute : Error<
2804  "'NSObject' attribute is for pointer types only">;
2805def err_attributes_are_not_compatible : Error<
2806  "%0 and %1 attributes are not compatible">;
2807def err_attribute_invalid_argument : Error<
2808  "%select{a reference type|an array type|a non-vector or "
2809  "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
2810def err_attribute_wrong_number_arguments : Error<
2811  "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
2812  ":requires exactly %1 arguments}1">;
2813def err_attribute_too_many_arguments : Error<
2814  "%0 attribute takes no more than %1 argument%s1">;
2815def err_attribute_too_few_arguments : Error<
2816  "%0 attribute takes at least %1 argument%s1">;
2817def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
2818def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
2819def err_attribute_bad_neon_vector_size : Error<
2820  "Neon vector size must be 64 or 128 bits">;
2821def err_attribute_invalid_sve_type : Error<
2822  "%0 attribute applied to non-SVE type %1">;
2823def err_attribute_bad_sve_vector_size : Error<
2824  "invalid SVE vector size '%0', must match value set by "
2825  "'-msve-vector-bits' ('%1')">;
2826def err_attribute_arm_feature_sve_bits_unsupported : Error<
2827  "%0 is only supported when '-msve-vector-bits=<bits>' is specified with a "
2828  "value of 128, 256, 512, 1024 or 2048.">;
2829def err_attribute_requires_positive_integer : Error<
2830  "%0 attribute requires a %select{positive|non-negative}1 "
2831  "integral compile time constant expression">;
2832def err_attribute_requires_opencl_version : Error<
2833  "%0 attribute requires OpenCL version %1%select{| or above}2">;
2834def err_invalid_branch_protection_spec : Error<
2835  "invalid or misplaced branch protection specification '%0'">;
2836def warn_unsupported_target_attribute
2837    : Warning<"%select{unsupported|duplicate|unknown}0%select{| architecture|"
2838              " tune CPU}1 '%2' in the 'target' attribute string; 'target' "
2839              "attribute ignored">,
2840      InGroup<IgnoredAttributes>;
2841def err_attribute_unsupported
2842    : Error<"%0 attribute is not supported for this target">;
2843// The err_*_attribute_argument_not_int are separate because they're used by
2844// VerifyIntegerConstantExpression.
2845def err_aligned_attribute_argument_not_int : Error<
2846  "'aligned' attribute requires integer constant">;
2847def err_align_value_attribute_argument_not_int : Error<
2848  "'align_value' attribute requires integer constant">;
2849def err_alignas_attribute_wrong_decl_type : Error<
2850  "%0 attribute cannot be applied to a %select{function parameter|"
2851  "variable with 'register' storage class|'catch' variable|bit-field}1">;
2852def err_alignas_missing_on_definition : Error<
2853  "%0 must be specified on definition if it is specified on any declaration">;
2854def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
2855def err_alignas_mismatch : Error<
2856  "redeclaration has different alignment requirement (%1 vs %0)">;
2857def err_alignas_underaligned : Error<
2858  "requested alignment is less than minimum alignment of %1 for type %0">;
2859def err_attribute_sizeless_type : Error<
2860  "%0 attribute cannot be applied to sizeless type %1">;
2861def err_attribute_argument_n_type : Error<
2862  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
2863  "constant|a string|an identifier|a constant expression}2">;
2864def err_attribute_argument_type : Error<
2865  "%0 attribute requires %select{int or bool|an integer "
2866  "constant|a string|an identifier}1">;
2867def err_attribute_argument_out_of_range : Error<
2868  "%0 attribute requires integer constant between %1 and %2 inclusive">;
2869def err_init_priority_object_attr : Error<
2870  "can only use 'init_priority' attribute on file-scope definitions "
2871  "of objects of class type">;
2872def err_attribute_argument_out_of_bounds : Error<
2873  "%0 attribute parameter %1 is out of bounds">;
2874def err_attribute_only_once_per_parameter : Error<
2875  "%0 attribute can only be applied once per parameter">;
2876def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
2877def note_previous_uuid : Note<"previous uuid specified here">;
2878def warn_attribute_pointers_only : Warning<
2879  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
2880  InGroup<IgnoredAttributes>;
2881def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
2882def err_attribute_integers_only : Error<
2883  "%0 attribute argument may only refer to a function parameter of integer "
2884  "type">;
2885def warn_attribute_return_pointers_only : Warning<
2886  "%0 attribute only applies to return values that are pointers">,
2887  InGroup<IgnoredAttributes>;
2888def warn_attribute_return_pointers_refs_only : Warning<
2889  "%0 attribute only applies to return values that are pointers or references">,
2890  InGroup<IgnoredAttributes>;
2891def warn_attribute_pointer_or_reference_only : Warning<
2892  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
2893  InGroup<IgnoredAttributes>;
2894def err_attribute_no_member_pointers : Error<
2895  "%0 attribute cannot be used with pointers to members">;
2896def err_attribute_invalid_implicit_this_argument : Error<
2897  "%0 attribute is invalid for the implicit this argument">;
2898def err_ownership_type : Error<
2899  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
2900def err_ownership_returns_index_mismatch : Error<
2901  "'ownership_returns' attribute index does not match; here it is %0">;
2902def note_ownership_returns_index_mismatch : Note<
2903  "declared with index %0 here">;
2904def err_format_strftime_third_parameter : Error<
2905  "strftime format attribute requires 3rd parameter to be 0">;
2906def err_format_attribute_requires_variadic : Error<
2907  "format attribute requires variadic function">;
2908def err_format_attribute_not : Error<"format argument not %0">;
2909def err_format_attribute_result_not : Error<"function does not return %0">;
2910def err_format_attribute_implicit_this_format_string : Error<
2911  "format attribute cannot specify the implicit this argument as the format "
2912  "string">;
2913def err_callback_attribute_no_callee : Error<
2914  "'callback' attribute specifies no callback callee">;
2915def err_callback_attribute_invalid_callee : Error<
2916  "'callback' attribute specifies invalid callback callee">;
2917def err_callback_attribute_multiple : Error<
2918  "multiple 'callback' attributes specified">;
2919def err_callback_attribute_argument_unknown : Error<
2920  "'callback' attribute argument %0 is not a known function parameter">;
2921def err_callback_callee_no_function_type : Error<
2922  "'callback' attribute callee does not have function type">;
2923def err_callback_callee_is_variadic : Error<
2924  "'callback' attribute callee may not be variadic">;
2925def err_callback_implicit_this_not_available : Error<
2926  "'callback' argument at position %0 references unavailable implicit 'this'">;
2927def err_init_method_bad_return_type : Error<
2928  "init methods must return an object pointer type, not %0">;
2929def err_attribute_invalid_size : Error<
2930  "vector size not an integral multiple of component size">;
2931def err_attribute_zero_size : Error<"zero %0 size">;
2932def err_attribute_size_too_large : Error<"%0 size too large">;
2933def err_typecheck_sve_ambiguous : Error<
2934  "cannot combine fixed-length and sizeless SVE vectors in expression, result is ambiguous (%0 and %1)">;
2935def err_typecheck_sve_gnu_ambiguous : Error<
2936  "cannot combine GNU and SVE vectors in expression, result is ambiguous (%0 and %1)">;
2937def err_typecheck_vector_not_convertable_implict_truncation : Error<
2938   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
2939   " %2 as implicit conversion would cause truncation">;
2940def err_typecheck_vector_not_convertable : Error<
2941  "cannot convert between vector values of different size (%0 and %1)">;
2942def err_typecheck_vector_not_convertable_non_scalar : Error<
2943  "cannot convert between vector and non-scalar values (%0 and %1)">;
2944def err_typecheck_vector_lengths_not_equal : Error<
2945  "vector operands do not have the same number of elements (%0 and %1)">;
2946def warn_typecheck_vector_element_sizes_not_equal : Warning<
2947  "vector operands do not have the same elements sizes (%0 and %1)">,
2948  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
2949def err_ext_vector_component_exceeds_length : Error<
2950  "vector component access exceeds type %0">;
2951def err_ext_vector_component_name_illegal : Error<
2952  "illegal vector component name '%0'">;
2953def err_attribute_address_space_negative : Error<
2954  "address space is negative">;
2955def err_attribute_address_space_too_high : Error<
2956  "address space is larger than the maximum supported (%0)">;
2957def err_attribute_address_multiple_qualifiers : Error<
2958  "multiple address spaces specified for type">;
2959def warn_attribute_address_multiple_identical_qualifiers : Warning<
2960  "multiple identical address spaces specified for type">,
2961  InGroup<DuplicateDeclSpecifier>;
2962def err_attribute_not_clinkage : Error<
2963  "function type with %0 attribute must have C linkage">;
2964def err_function_decl_cmse_ns_call : Error<
2965  "functions may not be declared with 'cmse_nonsecure_call' attribute">;
2966def err_attribute_address_function_type : Error<
2967  "function type may not be qualified with an address space">;
2968def err_as_qualified_auto_decl : Error<
2969  "automatic variable qualified with an%select{| invalid}0 address space">;
2970def err_arg_with_address_space : Error<
2971  "parameter may not be qualified with an address space">;
2972def err_field_with_address_space : Error<
2973  "field may not be qualified with an address space">;
2974def err_compound_literal_with_address_space : Error<
2975  "compound literal in function scope may not be qualified with an address space">;
2976def err_address_space_mismatch_templ_inst : Error<
2977  "conflicting address space qualifiers are provided between types %0 and %1">;
2978def err_attr_objc_ownership_redundant : Error<
2979  "the type %0 is already explicitly ownership-qualified">;
2980def err_invalid_nsnumber_type : Error<
2981  "%0 is not a valid literal type for NSNumber">;
2982def err_objc_illegal_boxed_expression_type : Error<
2983  "illegal type %0 used in a boxed expression">;
2984def err_objc_non_trivially_copyable_boxed_expression_type : Error<
2985  "non-trivially copyable type %0 cannot be used in a boxed expression">;
2986def err_objc_incomplete_boxed_expression_type : Error<
2987  "incomplete type %0 used in a boxed expression">;
2988def err_undeclared_objc_literal_class : Error<
2989  "definition of class %0 must be available to use Objective-C "
2990  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
2991  "string literals}1">;
2992def err_undeclared_boxing_method : Error<
2993  "declaration of %0 is missing in %1 class">;
2994def err_objc_literal_method_sig : Error<
2995  "literal construction method %0 has incompatible signature">;
2996def note_objc_literal_method_param : Note<
2997  "%select{first|second|third}0 parameter has unexpected type %1 "
2998  "(should be %2)">;
2999def note_objc_literal_method_return : Note<
3000  "method returns unexpected type %0 (should be an object type)">;
3001def err_invalid_collection_element : Error<
3002  "collection element of type %0 is not an Objective-C object">;
3003def err_box_literal_collection : Error<
3004  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3005  "in a collection">;
3006def warn_objc_literal_comparison : Warning<
3007  "direct comparison of %select{an array literal|a dictionary literal|"
3008  "a numeric literal|a boxed expression|}0 has undefined behavior">,
3009  InGroup<ObjCLiteralComparison>;
3010def err_missing_atsign_prefix : Error<
3011  "%select{string|numeric}0 literal must be prefixed by '@'">;
3012def warn_objc_string_literal_comparison : Warning<
3013  "direct comparison of a string literal has undefined behavior">,
3014  InGroup<ObjCStringComparison>;
3015def warn_concatenated_literal_array_init : Warning<
3016  "suspicious concatenation of string literals in an array initialization; "
3017  "did you mean to separate the elements with a comma?">,
3018  InGroup<StringConcatation>, DefaultIgnore;
3019def warn_concatenated_nsarray_literal : Warning<
3020  "concatenated NSString literal for an NSArray expression - "
3021  "possibly missing a comma">,
3022  InGroup<ObjCStringConcatenation>;
3023def note_objc_literal_comparison_isequal : Note<
3024  "use 'isEqual:' instead">;
3025def warn_objc_collection_literal_element : Warning<
3026  "object of type %0 is not compatible with "
3027  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3028  InGroup<ObjCLiteralConversion>;
3029def warn_nsdictionary_duplicate_key : Warning<
3030  "duplicate key in dictionary literal">,
3031  InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3032def note_nsdictionary_duplicate_key_here : Note<
3033  "previous equal key is here">;
3034def err_swift_param_attr_not_swiftcall : Error<
3035  "'%0' parameter can only be used with swiftcall calling convention">;
3036def err_swift_indirect_result_not_first : Error<
3037  "'swift_indirect_result' parameters must be first parameters of function">;
3038def err_swift_error_result_not_after_swift_context : Error<
3039  "'swift_error_result' parameter must follow 'swift_context' parameter">;
3040def err_swift_abi_parameter_wrong_type : Error<
3041  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3042  "type here is %2">;
3043
3044def err_attribute_argument_invalid : Error<
3045  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3046  "min must not be greater than max}1">;
3047def err_attribute_argument_is_zero : Error<
3048  "%0 attribute must be greater than 0">;
3049def warn_attribute_argument_n_negative : Warning<
3050  "%0 attribute parameter %1 is negative and will be ignored">,
3051  InGroup<CudaCompat>;
3052def err_property_function_in_objc_container : Error<
3053  "use of Objective-C property in function nested in Objective-C "
3054  "container not supported, move function outside its container">;
3055
3056let CategoryName = "Cocoa API Issue" in {
3057def warn_objc_redundant_literal_use : Warning<
3058  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3059}
3060
3061def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3062  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3063
3064def err_tls_var_aligned_over_maximum : Error<
3065  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3066  "alignment (%2) for a thread-local variable on this target">;
3067
3068def err_only_annotate_after_access_spec : Error<
3069  "access specifier can only have annotation attributes">;
3070
3071def err_attribute_section_invalid_for_target : Error<
3072  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3073def warn_attribute_section_drectve : Warning<
3074  "#pragma %0(\".drectve\") has undefined behavior, "
3075  "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3076def warn_mismatched_section : Warning<
3077  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3078def warn_attribute_section_on_redeclaration : Warning<
3079  "section attribute is specified on redeclared variable">, InGroup<Section>;
3080def err_mismatched_code_seg_base : Error<
3081  "derived class must specify the same code segment as its base classes">;
3082def err_mismatched_code_seg_override : Error<
3083  "overriding virtual function must specify the same code segment as its overridden function">;
3084def err_conflicting_codeseg_attribute : Error<
3085  "conflicting code segment specifiers">;
3086def warn_duplicate_codeseg_attribute : Warning<
3087  "duplicate code segment specifiers">, InGroup<Section>;
3088
3089def err_anonymous_property: Error<
3090  "anonymous property is not supported">;
3091def err_property_is_variably_modified : Error<
3092  "property %0 has a variably modified type">;
3093def err_no_accessor_for_property : Error<
3094  "no %select{getter|setter}0 defined for property %1">;
3095def err_cannot_find_suitable_accessor : Error<
3096  "cannot find suitable %select{getter|setter}0 for property %1">;
3097
3098def warn_alloca : Warning<
3099  "use of function %0 is discouraged; there is no way to check for failure but "
3100  "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3101  InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3102
3103def warn_alloca_align_alignof : Warning<
3104  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3105  InGroup<DiagGroup<"alloca-with-align-alignof">>;
3106
3107def err_alignment_too_small : Error<
3108  "requested alignment must be %0 or greater">;
3109def err_alignment_too_big : Error<
3110  "requested alignment must be %0 or smaller">;
3111def err_alignment_not_power_of_two : Error<
3112  "requested alignment is not a power of 2">;
3113def warn_alignment_not_power_of_two : Warning<
3114  err_alignment_not_power_of_two.Text>,
3115  InGroup<DiagGroup<"non-power-of-two-alignment">>;
3116def err_alignment_dependent_typedef_name : Error<
3117  "requested alignment is dependent but declaration is not dependent">;
3118
3119def warn_alignment_builtin_useless : Warning<
3120  "%select{aligning a value|the result of checking whether a value is aligned}0"
3121  " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3122def err_attribute_aligned_too_great : Error<
3123  "requested alignment must be %0 bytes or smaller">;
3124def warn_assume_aligned_too_great
3125    : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3126              "alignment assumed">,
3127      InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3128def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3129  "%q0 redeclared without %1 attribute: previous %1 ignored">,
3130  InGroup<MicrosoftInconsistentDllImport>;
3131def warn_redeclaration_without_import_attribute : Warning<
3132  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3133  InGroup<MicrosoftInconsistentDllImport>;
3134def warn_dllimport_dropped_from_inline_function : Warning<
3135  "%q0 redeclared inline; %1 attribute ignored">,
3136  InGroup<IgnoredAttributes>;
3137def warn_attribute_ignored : Warning<"%0 attribute ignored">,
3138  InGroup<IgnoredAttributes>;
3139def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3140  " exception specification; attribute ignored">,
3141  InGroup<IgnoredAttributes>;
3142def warn_attribute_ignored_on_inline :
3143  Warning<"%0 attribute ignored on inline function">,
3144  InGroup<IgnoredAttributes>;
3145def warn_nocf_check_attribute_ignored :
3146  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3147  InGroup<IgnoredAttributes>;
3148def warn_attribute_after_definition_ignored : Warning<
3149  "attribute %0 after definition is ignored">,
3150   InGroup<IgnoredAttributes>;
3151def warn_attributes_likelihood_ifstmt_conflict
3152    : Warning<"conflicting attributes %0 are ignored">,
3153      InGroup<IgnoredAttributes>;
3154def warn_cxx11_gnu_attribute_on_type : Warning<
3155  "attribute %0 ignored, because it cannot be applied to a type">,
3156  InGroup<IgnoredAttributes>;
3157def warn_unhandled_ms_attribute_ignored : Warning<
3158  "__declspec attribute %0 is not supported">,
3159  InGroup<IgnoredAttributes>;
3160def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3161  "attribute %0 has no effect when annotating an infinite loop">,
3162   InGroup<IgnoredAttributes>;
3163def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3164  "annotating the infinite loop here">;
3165def warn_attribute_has_no_effect_on_if_constexpr : Warning<
3166  "attribute %0 has no effect when annotating an 'if constexpr' statement">,
3167   InGroup<IgnoredAttributes>;
3168def note_attribute_has_no_effect_on_if_constexpr_here : Note<
3169  "annotating the 'if constexpr' statement here">;
3170def err_decl_attribute_invalid_on_stmt : Error<
3171  "%0 attribute cannot be applied to a statement">;
3172def err_stmt_attribute_invalid_on_decl : Error<
3173  "%0 attribute cannot be applied to a declaration">;
3174def warn_declspec_attribute_ignored : Warning<
3175  "attribute %0 is ignored, place it after "
3176  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
3177  "type declaration">, InGroup<IgnoredAttributes>;
3178def warn_attribute_precede_definition : Warning<
3179  "attribute declaration must precede definition">,
3180  InGroup<IgnoredAttributes>;
3181def warn_attribute_void_function_method : Warning<
3182  "attribute %0 cannot be applied to "
3183  "%select{functions|Objective-C method}1 without return value">,
3184  InGroup<IgnoredAttributes>;
3185def warn_attribute_weak_on_field : Warning<
3186  "__weak attribute cannot be specified on a field declaration">,
3187  InGroup<IgnoredAttributes>;
3188def warn_gc_attribute_weak_on_local : Warning<
3189  "Objective-C GC does not allow weak variables on the stack">,
3190  InGroup<IgnoredAttributes>;
3191def warn_nsobject_attribute : Warning<
3192  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3193  InGroup<NSobjectAttribute>;
3194def warn_independentclass_attribute : Warning<
3195  "'objc_independent_class' attribute may be put on a typedef only; "
3196  "attribute is ignored">,
3197  InGroup<IndependentClassAttribute>;
3198def warn_ptr_independentclass_attribute : Warning<
3199  "'objc_independent_class' attribute may be put on Objective-C object "
3200  "pointer type only; attribute is ignored">,
3201  InGroup<IndependentClassAttribute>;
3202def warn_attribute_weak_on_local : Warning<
3203  "__weak attribute cannot be specified on an automatic variable when ARC "
3204  "is not enabled">,
3205  InGroup<IgnoredAttributes>;
3206def warn_weak_identifier_undeclared : Warning<
3207  "weak identifier %0 never declared">;
3208def warn_attribute_cmse_entry_static : Warning<
3209  "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3210  InGroup<IgnoredAttributes>;
3211def warn_cmse_nonsecure_union : Warning<
3212  "passing union across security boundary via %select{parameter %1|return value}0 "
3213  "may leak information">,
3214  InGroup<DiagGroup<"cmse-union-leak">>;
3215def err_attribute_weak_static : Error<
3216  "weak declaration cannot have internal linkage">;
3217def err_attribute_selectany_non_extern_data : Error<
3218  "'selectany' can only be applied to data items with external linkage">;
3219def err_declspec_thread_on_thread_variable : Error<
3220  "'__declspec(thread)' applied to variable that already has a "
3221  "thread-local storage specifier">;
3222def err_attribute_dll_not_extern : Error<
3223  "%q0 must have external linkage when declared %q1">;
3224def err_attribute_dll_thread_local : Error<
3225  "%q0 cannot be thread local when declared %q1">;
3226def err_attribute_dll_lambda : Error<
3227  "lambda cannot be declared %0">;
3228def warn_attribute_invalid_on_definition : Warning<
3229  "'%0' attribute cannot be specified on a definition">,
3230  InGroup<IgnoredAttributes>;
3231def err_attribute_dll_redeclaration : Error<
3232  "redeclaration of %q0 cannot add %q1 attribute">;
3233def warn_attribute_dll_redeclaration : Warning<
3234  "redeclaration of %q0 should not add %q1 attribute">,
3235  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3236def err_attribute_dllimport_function_definition : Error<
3237  "dllimport cannot be applied to non-inline function definition">;
3238def err_attribute_dll_deleted : Error<
3239  "attribute %q0 cannot be applied to a deleted function">;
3240def err_attribute_dllimport_data_definition : Error<
3241  "definition of dllimport data">;
3242def err_attribute_dllimport_static_field_definition : Error<
3243  "definition of dllimport static field not allowed">;
3244def warn_attribute_dllimport_static_field_definition : Warning<
3245  "definition of dllimport static field">,
3246  InGroup<DiagGroup<"dllimport-static-field-def">>;
3247def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3248  "explicit instantiation declaration should not be 'dllexport'">,
3249  InGroup<DiagGroup<"dllexport-explicit-instantiation-decl">>;
3250def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3251  "'dllexport' attribute ignored on explicit instantiation definition">,
3252  InGroup<IgnoredAttributes>;
3253def warn_invalid_initializer_from_system_header : Warning<
3254  "invalid constructor form class in system header, should not be explicit">,
3255  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3256def note_used_in_initialization_here : Note<"used in initialization here">;
3257def err_attribute_dll_member_of_dll_class : Error<
3258  "attribute %q0 cannot be applied to member of %q1 class">;
3259def warn_attribute_dll_instantiated_base_class : Warning<
3260  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3261  "base class template without dll attribute is not supported">,
3262  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3263def err_attribute_dll_ambiguous_default_ctor : Error<
3264  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3265def err_attribute_weakref_not_static : Error<
3266  "weakref declaration must have internal linkage">;
3267def err_attribute_weakref_not_global_context : Error<
3268  "weakref declaration of %0 must be in a global context">;
3269def err_attribute_weakref_without_alias : Error<
3270  "weakref declaration of %0 must also have an alias attribute">;
3271def err_alias_not_supported_on_darwin : Error <
3272  "aliases are not supported on darwin">;
3273def warn_attribute_wrong_decl_type_str : Warning<
3274  "%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
3275def err_attribute_wrong_decl_type_str : Error<
3276  warn_attribute_wrong_decl_type_str.Text>;
3277def warn_attribute_wrong_decl_type : Warning<
3278  "%0 attribute only applies to %select{"
3279  "functions"
3280  "|unions"
3281  "|variables and functions"
3282  "|functions and methods"
3283  "|functions, methods and blocks"
3284  "|functions, methods, and parameters"
3285  "|variables"
3286  "|variables and fields"
3287  "|variables, data members and tag types"
3288  "|types and namespaces"
3289  "|variables, functions and classes"
3290  "|kernel functions"
3291  "|non-K&R-style functions}1">,
3292  InGroup<IgnoredAttributes>;
3293def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
3294def warn_type_attribute_wrong_type : Warning<
3295  "'%0' only applies to %select{function|pointer|"
3296  "Objective-C object or block pointer}1 types; type here is %2">,
3297  InGroup<IgnoredAttributes>;
3298def warn_incomplete_encoded_type : Warning<
3299  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3300  InGroup<DiagGroup<"encode-type">>;
3301def warn_gnu_inline_attribute_requires_inline : Warning<
3302  "'gnu_inline' attribute requires function to be marked 'inline',"
3303  " attribute ignored">,
3304  InGroup<IgnoredAttributes>;
3305def warn_gnu_inline_cplusplus_without_extern : Warning<
3306  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3307  " available, this changed in Clang 10">,
3308  InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3309def err_attribute_vecreturn_only_vector_member : Error<
3310  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3311def err_attribute_vecreturn_only_pod_record : Error<
3312  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3313def err_cconv_change : Error<
3314  "function declared '%0' here was previously declared "
3315  "%select{'%2'|without calling convention}1">;
3316def warn_cconv_unsupported : Warning<
3317  "%0 calling convention is not supported %select{"
3318  // Use CallingConventionIgnoredReason Enum to specify these.
3319  "for this target"
3320  "|on variadic function"
3321  "|on constructor/destructor"
3322  "|on builtin function"
3323  "}1">,
3324  InGroup<IgnoredAttributes>;
3325def error_cconv_unsupported : Error<warn_cconv_unsupported.Text>;
3326def err_cconv_knr : Error<
3327  "function with no prototype cannot use the %0 calling convention">;
3328def warn_cconv_knr : Warning<
3329  err_cconv_knr.Text>,
3330  InGroup<DiagGroup<"missing-prototype-for-cc">>;
3331def err_cconv_varargs : Error<
3332  "variadic function cannot use %0 calling convention">;
3333def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3334  "attribute was previously declared "
3335  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3336def err_function_attribute_mismatch : Error<
3337  "function declared with %0 attribute "
3338  "was previously declared without the %0 attribute">;
3339def err_objc_precise_lifetime_bad_type : Error<
3340  "objc_precise_lifetime only applies to retainable types; type here is %0">;
3341def warn_objc_precise_lifetime_meaningless : Error<
3342  "objc_precise_lifetime is not meaningful for "
3343  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3344def err_invalid_pcs : Error<"invalid PCS type">;
3345def warn_attribute_not_on_decl : Warning<
3346  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3347def err_base_specifier_attribute : Error<
3348  "%0 attribute cannot be applied to a base specifier">;
3349def err_invalid_attribute_on_virtual_function : Error<
3350  "%0 attribute cannot be applied to virtual functions">;
3351def warn_declspec_allocator_nonpointer : Warning<
3352  "ignoring __declspec(allocator) because the function return type %0 is not "
3353  "a pointer or reference type">, InGroup<IgnoredAttributes>;
3354def err_cconv_incomplete_param_type : Error<
3355  "parameter %0 must have a complete type to use function %1 with the %2 "
3356  "calling convention">;
3357def err_attribute_output_parameter : Error<
3358  "attribute only applies to output parameters">;
3359
3360def ext_cannot_use_trivial_abi : ExtWarn<
3361  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3362def note_cannot_use_trivial_abi_reason : Note<
3363  "'trivial_abi' is disallowed on %0 because %select{"
3364  "its copy constructors and move constructors are all deleted|"
3365  "it is polymorphic|"
3366  "it has a base of a non-trivial class type|it has a virtual base|"
3367  "it has a __weak field|it has a field of a non-trivial class type}1">;
3368
3369// Availability attribute
3370def warn_availability_unknown_platform : Warning<
3371  "unknown platform %0 in availability macro">, InGroup<Availability>;
3372def warn_availability_version_ordering : Warning<
3373  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3374  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3375  "attribute ignored">, InGroup<Availability>;
3376def warn_mismatched_availability: Warning<
3377  "availability does not match previous declaration">, InGroup<Availability>;
3378def warn_mismatched_availability_override : Warning<
3379  "%select{|overriding }4method %select{introduced after|"
3380  "deprecated before|obsoleted before}0 "
3381  "%select{the protocol method it implements|overridden method}4 "
3382  "on %1 (%2 vs. %3)">, InGroup<Availability>;
3383def warn_mismatched_availability_override_unavail : Warning<
3384  "%select{|overriding }1method cannot be unavailable on %0 when "
3385  "%select{the protocol method it implements|its overridden method}1 is "
3386  "available">,
3387  InGroup<Availability>;
3388def warn_availability_on_static_initializer : Warning<
3389  "ignoring availability attribute %select{on '+load' method|"
3390  "with constructor attribute|with destructor attribute}0">,
3391  InGroup<Availability>;
3392def note_overridden_method : Note<
3393  "overridden method is here">;
3394def warn_availability_swift_unavailable_deprecated_only : Warning<
3395  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3396  InGroup<Availability>;
3397def note_protocol_method : Note<
3398  "protocol method is here">;
3399
3400def warn_unguarded_availability :
3401  Warning<"%0 is only available on %1 %2 or newer">,
3402  InGroup<UnguardedAvailability>, DefaultIgnore;
3403def warn_unguarded_availability_new :
3404  Warning<warn_unguarded_availability.Text>,
3405  InGroup<UnguardedAvailabilityNew>;
3406def note_decl_unguarded_availability_silence : Note<
3407  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3408def note_unguarded_available_silence : Note<
3409  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3410  " this warning">;
3411def warn_at_available_unchecked_use : Warning<
3412  "%select{@available|__builtin_available}0 does not guard availability here; "
3413  "use if (%select{@available|__builtin_available}0) instead">,
3414  InGroup<DiagGroup<"unsupported-availability-guard">>;
3415
3416// Thread Safety Attributes
3417def warn_thread_attribute_ignored : Warning<
3418  "ignoring %0 attribute because its argument is invalid">,
3419  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3420def warn_thread_attribute_not_on_non_static_member : Warning<
3421  "%0 attribute without capability arguments can only be applied to non-static "
3422  "methods of a class">,
3423  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3424def warn_thread_attribute_not_on_capability_member : Warning<
3425  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3426  "annotated with 'capability' or 'scoped_lockable' attribute">,
3427  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3428def warn_thread_attribute_argument_not_lockable : Warning<
3429  "%0 attribute requires arguments whose type is annotated "
3430  "with 'capability' attribute; type here is %1">,
3431  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3432def warn_thread_attribute_decl_not_lockable : Warning<
3433  "%0 attribute can only be applied in a context annotated "
3434  "with 'capability' attribute">,
3435  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3436def warn_thread_attribute_decl_not_pointer : Warning<
3437  "%0 only applies to pointer types; type here is %1">,
3438  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3439def err_attribute_argument_out_of_bounds_extra_info : Error<
3440  "%0 attribute parameter %1 is out of bounds: "
3441  "%plural{0:no parameters to index into|"
3442  "1:can only be 1, since there is one parameter|"
3443  ":must be between 1 and %2}2">;
3444
3445// Thread Safety Analysis
3446def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3447  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3448def warn_unlock_kind_mismatch : Warning<
3449  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3450  "%select{shared|exclusive}3 access">,
3451  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3452def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3453  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3454def warn_no_unlock : Warning<
3455  "%0 '%1' is still held at the end of function">,
3456  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3457def warn_expecting_locked : Warning<
3458  "expecting %0 '%1' to be held at the end of function">,
3459  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3460// FIXME: improve the error message about locks not in scope
3461def warn_lock_some_predecessors : Warning<
3462  "%0 '%1' is not held on every path through here">,
3463  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3464def warn_expecting_lock_held_on_loop : Warning<
3465  "expecting %0 '%1' to be held at start of each loop">,
3466  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3467def note_locked_here : Note<"%0 acquired here">;
3468def note_unlocked_here : Note<"%0 released here">;
3469def warn_lock_exclusive_and_shared : Warning<
3470  "%0 '%1' is acquired exclusively and shared in the same scope">,
3471  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3472def note_lock_exclusive_and_shared : Note<
3473  "the other acquisition of %0 '%1' is here">;
3474def warn_variable_requires_any_lock : Warning<
3475  "%select{reading|writing}1 variable %0 requires holding "
3476  "%select{any mutex|any mutex exclusively}1">,
3477  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3478def warn_var_deref_requires_any_lock : Warning<
3479  "%select{reading|writing}1 the value pointed to by %0 requires holding "
3480  "%select{any mutex|any mutex exclusively}1">,
3481  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3482def warn_fun_excludes_mutex : Warning<
3483  "cannot call function '%1' while %0 '%2' is held">,
3484  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3485def warn_cannot_resolve_lock : Warning<
3486  "cannot resolve lock expression">,
3487  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3488def warn_acquired_before : Warning<
3489  "%0 '%1' must be acquired before '%2'">,
3490  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3491def warn_acquired_before_after_cycle : Warning<
3492  "Cycle in acquired_before/after dependencies, starting with '%0'">,
3493  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3494
3495
3496// Thread safety warnings negative capabilities
3497def warn_acquire_requires_negative_cap : Warning<
3498  "acquiring %0 '%1' requires negative capability '%2'">,
3499  InGroup<ThreadSafetyNegative>, DefaultIgnore;
3500def warn_fun_requires_negative_cap : Warning<
3501  "calling function %0 requires negative capability '%1'">,
3502  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3503
3504// Thread safety warnings on pass by reference
3505def warn_guarded_pass_by_reference : Warning<
3506  "passing variable %1 by reference requires holding %0 "
3507  "%select{'%2'|'%2' exclusively}3">,
3508  InGroup<ThreadSafetyReference>, DefaultIgnore;
3509def warn_pt_guarded_pass_by_reference : Warning<
3510  "passing the value that %1 points to by reference requires holding %0 "
3511  "%select{'%2'|'%2' exclusively}3">,
3512  InGroup<ThreadSafetyReference>, DefaultIgnore;
3513
3514// Imprecise thread safety warnings
3515def warn_variable_requires_lock : Warning<
3516  "%select{reading|writing}3 variable %1 requires holding %0 "
3517  "%select{'%2'|'%2' exclusively}3">,
3518  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3519def warn_var_deref_requires_lock : Warning<
3520  "%select{reading|writing}3 the value pointed to by %1 requires "
3521  "holding %0 %select{'%2'|'%2' exclusively}3">,
3522  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3523def warn_fun_requires_lock : Warning<
3524  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3525  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3526
3527// Precise thread safety warnings
3528def warn_variable_requires_lock_precise :
3529  Warning<warn_variable_requires_lock.Text>,
3530  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3531def warn_var_deref_requires_lock_precise :
3532  Warning<warn_var_deref_requires_lock.Text>,
3533  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3534def warn_fun_requires_lock_precise :
3535  Warning<warn_fun_requires_lock.Text>,
3536  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3537def note_found_mutex_near_match : Note<"found near match '%0'">;
3538
3539// Verbose thread safety warnings
3540def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">,
3541  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3542def note_thread_warning_in_fun : Note<"Thread warning in function %0">;
3543def note_guarded_by_declared_here : Note<"Guarded_by declared here.">;
3544
3545// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3546def warn_thread_safety_beta : Warning<"Thread safety beta warning.">,
3547  InGroup<ThreadSafetyBeta>, DefaultIgnore;
3548
3549// Consumed warnings
3550def warn_use_in_invalid_state : Warning<
3551  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3552  "state">, InGroup<Consumed>, DefaultIgnore;
3553def warn_use_of_temp_in_invalid_state : Warning<
3554  "invalid invocation of method '%0' on a temporary object while it is in the "
3555  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3556def warn_attr_on_unconsumable_class : Warning<
3557  "consumed analysis attribute is attached to member of class %0 which isn't "
3558  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3559def warn_return_typestate_for_unconsumable_type : Warning<
3560  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3561  DefaultIgnore;
3562def warn_return_typestate_mismatch : Warning<
3563  "return value not in expected state; expected '%0', observed '%1'">,
3564  InGroup<Consumed>, DefaultIgnore;
3565def warn_loop_state_mismatch : Warning<
3566  "state of variable '%0' must match at the entry and exit of loop">,
3567  InGroup<Consumed>, DefaultIgnore;
3568def warn_param_return_typestate_mismatch : Warning<
3569  "parameter '%0' not in expected state when the function returns: expected "
3570  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3571def warn_param_typestate_mismatch : Warning<
3572  "argument not in expected state; expected '%0', observed '%1'">,
3573  InGroup<Consumed>, DefaultIgnore;
3574
3575// no_sanitize attribute
3576def warn_unknown_sanitizer_ignored : Warning<
3577  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3578
3579def warn_impcast_vector_scalar : Warning<
3580  "implicit conversion turns vector to scalar: %0 to %1">,
3581  InGroup<Conversion>, DefaultIgnore;
3582def warn_impcast_complex_scalar : Warning<
3583  "implicit conversion discards imaginary component: %0 to %1">,
3584  InGroup<Conversion>, DefaultIgnore;
3585def err_impcast_complex_scalar : Error<
3586  "implicit conversion from %0 to %1 is not permitted in C++">;
3587def warn_impcast_float_precision : Warning<
3588  "implicit conversion loses floating-point precision: %0 to %1">,
3589  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3590def warn_impcast_float_result_precision : Warning<
3591  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3592  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3593def warn_impcast_double_promotion : Warning<
3594  "implicit conversion increases floating-point precision: %0 to %1">,
3595  InGroup<DoublePromotion>, DefaultIgnore;
3596def warn_impcast_integer_sign : Warning<
3597  "implicit conversion changes signedness: %0 to %1">,
3598  InGroup<SignConversion>, DefaultIgnore;
3599def warn_impcast_integer_sign_conditional : Warning<
3600  "operand of ? changes signedness: %0 to %1">,
3601  InGroup<SignConversion>, DefaultIgnore;
3602def warn_impcast_integer_precision : Warning<
3603  "implicit conversion loses integer precision: %0 to %1">,
3604  InGroup<ImplicitIntConversion>, DefaultIgnore;
3605def warn_impcast_high_order_zero_bits : Warning<
3606  "higher order bits are zeroes after implicit conversion">,
3607  InGroup<ImplicitIntConversion>, DefaultIgnore;
3608def warn_impcast_nonnegative_result : Warning<
3609  "the resulting value is always non-negative after implicit conversion">,
3610  InGroup<SignConversion>, DefaultIgnore;
3611def warn_impcast_integer_64_32 : Warning<
3612  "implicit conversion loses integer precision: %0 to %1">,
3613  InGroup<Shorten64To32>, DefaultIgnore;
3614def warn_impcast_integer_precision_constant : Warning<
3615  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3616  InGroup<ConstantConversion>;
3617def warn_impcast_bitfield_precision_constant : Warning<
3618  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3619  InGroup<BitFieldConstantConversion>;
3620def warn_impcast_constant_value_to_objc_bool : Warning<
3621  "implicit conversion from constant value %0 to 'BOOL'; "
3622  "the only well defined values for 'BOOL' are YES and NO">,
3623  InGroup<ObjCBoolConstantConversion>;
3624
3625def warn_impcast_fixed_point_range : Warning<
3626  "implicit conversion from %0 cannot fit within the range of values for %1">,
3627  InGroup<ImplicitFixedPointConversion>;
3628
3629def warn_impcast_literal_float_to_integer : Warning<
3630  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3631  InGroup<LiteralConversion>;
3632def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3633  "implicit conversion of out of range value from %0 to %1 is undefined">,
3634  InGroup<LiteralConversion>;
3635def warn_impcast_float_integer : Warning<
3636  "implicit conversion turns floating-point number into integer: %0 to %1">,
3637  InGroup<FloatConversion>, DefaultIgnore;
3638def warn_impcast_float_to_objc_signed_char_bool : Warning<
3639  "implicit conversion from floating-point type %0 to 'BOOL'">,
3640  InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
3641def warn_impcast_int_to_objc_signed_char_bool : Warning<
3642  "implicit conversion from integral type %0 to 'BOOL'">,
3643  InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
3644
3645// Implicit int -> float conversion precision loss warnings.
3646def warn_impcast_integer_float_precision : Warning<
3647  "implicit conversion from %0 to %1 may lose precision">,
3648  InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
3649def warn_impcast_integer_float_precision_constant : Warning<
3650  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3651  InGroup<ImplicitConstIntFloatConversion>;
3652
3653def warn_impcast_float_to_integer : Warning<
3654  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3655  InGroup<FloatOverflowConversion>, DefaultIgnore;
3656def warn_impcast_float_to_integer_out_of_range : Warning<
3657  "implicit conversion of out of range value from %0 to %1 is undefined">,
3658  InGroup<FloatOverflowConversion>, DefaultIgnore;
3659def warn_impcast_float_to_integer_zero : Warning<
3660  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3661  InGroup<FloatZeroConversion>, DefaultIgnore;
3662
3663def warn_impcast_string_literal_to_bool : Warning<
3664  "implicit conversion turns string literal into bool: %0 to %1">,
3665  InGroup<StringConversion>, DefaultIgnore;
3666def warn_impcast_different_enum_types : Warning<
3667  "implicit conversion from enumeration type %0 to different enumeration type "
3668  "%1">, InGroup<EnumConversion>;
3669def warn_impcast_bool_to_null_pointer : Warning<
3670    "initialization of pointer of type %0 to null from a constant boolean "
3671    "expression">, InGroup<BoolConversion>;
3672def warn_non_literal_null_pointer : Warning<
3673    "expression which evaluates to zero treated as a null pointer constant of "
3674    "type %0">, InGroup<NonLiteralNullConversion>;
3675def warn_pointer_compare : Warning<
3676    "comparing a pointer to a null character constant; did you mean "
3677    "to compare to %select{NULL|(void *)0}0?">,
3678    InGroup<DiagGroup<"pointer-compare">>;
3679def warn_impcast_null_pointer_to_integer : Warning<
3680    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
3681    InGroup<NullConversion>;
3682def warn_impcast_floating_point_to_bool : Warning<
3683    "implicit conversion turns floating-point number into bool: %0 to %1">,
3684    InGroup<ImplicitConversionFloatingPointToBool>;
3685def ext_ms_impcast_fn_obj : ExtWarn<
3686  "implicit conversion between pointer-to-function and pointer-to-object is a "
3687  "Microsoft extension">, InGroup<MicrosoftCast>;
3688
3689def warn_impcast_pointer_to_bool : Warning<
3690    "address of%select{| function| array}0 '%1' will always evaluate to "
3691    "'true'">,
3692    InGroup<PointerBoolConversion>;
3693def warn_cast_nonnull_to_bool : Warning<
3694    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
3695    "'true' on first encounter">,
3696    InGroup<PointerBoolConversion>;
3697def warn_this_bool_conversion : Warning<
3698  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
3699  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
3700def warn_address_of_reference_bool_conversion : Warning<
3701  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3702  "code; pointer may be assumed to always convert to true">,
3703  InGroup<UndefinedBoolConversion>;
3704
3705def warn_xor_used_as_pow : Warning<
3706  "result of '%0' is %1; did you mean exponentiation?">,
3707  InGroup<XorUsedAsPow>;
3708def warn_xor_used_as_pow_base_extra : Warning<
3709  "result of '%0' is %1; did you mean '%2' (%3)?">,
3710  InGroup<XorUsedAsPow>;
3711def warn_xor_used_as_pow_base : Warning<
3712  "result of '%0' is %1; did you mean '%2'?">,
3713  InGroup<XorUsedAsPow>;
3714def note_xor_used_as_pow_silence : Note<
3715  "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
3716
3717def warn_null_pointer_compare : Warning<
3718    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
3719    "equal to a null pointer is always %select{true|false}2">,
3720    InGroup<TautologicalPointerCompare>;
3721def warn_nonnull_expr_compare : Warning<
3722    "comparison of nonnull %select{function call|parameter}0 '%1' "
3723    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
3724    "encounter">,
3725    InGroup<TautologicalPointerCompare>;
3726def warn_this_null_compare : Warning<
3727  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
3728  "assumed to always evaluate to %select{true|false}0">,
3729  InGroup<TautologicalUndefinedCompare>;
3730def warn_address_of_reference_null_compare : Warning<
3731  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3732  "code; comparison may be assumed to always evaluate to "
3733  "%select{true|false}0">,
3734  InGroup<TautologicalUndefinedCompare>;
3735def note_reference_is_return_value : Note<"%0 returns a reference">;
3736
3737def note_pointer_declared_here : Note<
3738  "pointer %0 declared here">;
3739def warn_division_sizeof_ptr : Warning<
3740  "'%0' will return the size of the pointer, not the array itself">,
3741  InGroup<DiagGroup<"sizeof-pointer-div">>;
3742def warn_division_sizeof_array : Warning<
3743  "expression does not compute the number of elements in this array; element "
3744  "type is %0, not %1">,
3745  InGroup<DiagGroup<"sizeof-array-div">>;
3746
3747def note_function_warning_silence : Note<
3748    "prefix with the address-of operator to silence this warning">;
3749def note_function_to_function_call : Note<
3750    "suffix with parentheses to turn this into a function call">;
3751def warn_impcast_objective_c_literal_to_bool : Warning<
3752    "implicit boolean conversion of Objective-C object literal always "
3753    "evaluates to true">,
3754    InGroup<ObjCLiteralConversion>;
3755
3756def warn_cast_align : Warning<
3757  "cast from %0 to %1 increases required alignment from %2 to %3">,
3758  InGroup<CastAlign>, DefaultIgnore;
3759def warn_old_style_cast : Warning<
3760  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore;
3761
3762// Separate between casts to void* and non-void* pointers.
3763// Some APIs use (abuse) void* for something like a user context,
3764// and often that value is an integer even if it isn't a pointer itself.
3765// Having a separate warning flag allows users to control the warning
3766// for their workflow.
3767def warn_int_to_pointer_cast : Warning<
3768  "cast to %1 from smaller integer type %0">,
3769  InGroup<IntToPointerCast>;
3770def warn_int_to_void_pointer_cast : Warning<
3771  "cast to %1 from smaller integer type %0">,
3772  InGroup<IntToVoidPointerCast>;
3773def warn_pointer_to_int_cast : Warning<
3774  "cast to smaller integer type %1 from %0">,
3775  InGroup<PointerToIntCast>;
3776def warn_pointer_to_enum_cast : Warning<
3777  warn_pointer_to_int_cast.Text>,
3778  InGroup<PointerToEnumCast>;
3779def warn_void_pointer_to_int_cast : Warning<
3780  "cast to smaller integer type %1 from %0">,
3781  InGroup<VoidPointerToIntCast>;
3782def warn_void_pointer_to_enum_cast : Warning<
3783  warn_void_pointer_to_int_cast.Text>,
3784  InGroup<VoidPointerToEnumCast>;
3785
3786def warn_attribute_ignored_for_field_of_type : Warning<
3787  "%0 attribute ignored for field of type %1">,
3788  InGroup<IgnoredAttributes>;
3789def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
3790  "enums in the Microsoft ABI are signed integers by default; consider giving "
3791  "the enum %0 an unsigned underlying type to make this code portable">,
3792  InGroup<SignedEnumBitfield>, DefaultIgnore;
3793def warn_attribute_packed_for_bitfield : Warning<
3794  "'packed' attribute was ignored on bit-fields with single-byte alignment "
3795  "in older versions of GCC and Clang">,
3796  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
3797def warn_transparent_union_attribute_field_size_align : Warning<
3798  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
3799  "%select{alignment|size}0 of the first field in transparent union; "
3800  "transparent_union attribute ignored">,
3801  InGroup<IgnoredAttributes>;
3802def note_transparent_union_first_field_size_align : Note<
3803  "%select{alignment|size}0 of first field is %1 bits">;
3804def warn_transparent_union_attribute_not_definition : Warning<
3805  "transparent_union attribute can only be applied to a union definition; "
3806  "attribute ignored">,
3807  InGroup<IgnoredAttributes>;
3808def warn_transparent_union_attribute_floating : Warning<
3809  "first field of a transparent union cannot have %select{floating point|"
3810  "vector}0 type %1; transparent_union attribute ignored">,
3811  InGroup<IgnoredAttributes>;
3812def warn_transparent_union_attribute_zero_fields : Warning<
3813  "transparent union definition must contain at least one field; "
3814  "transparent_union attribute ignored">,
3815  InGroup<IgnoredAttributes>;
3816def warn_attribute_type_not_supported : Warning<
3817  "%0 attribute argument not supported: %1">,
3818  InGroup<IgnoredAttributes>;
3819def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
3820  InGroup<IgnoredAttributes>;
3821def warn_attribute_protected_visibility :
3822  Warning<"target does not support 'protected' visibility; using 'default'">,
3823  InGroup<DiagGroup<"unsupported-visibility">>;
3824def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
3825def note_previous_attribute : Note<"previous attribute is here">;
3826def note_conflicting_attribute : Note<"conflicting attribute is here">;
3827def note_attribute : Note<"attribute is here">;
3828def err_mismatched_ms_inheritance : Error<
3829  "inheritance model does not match %select{definition|previous declaration}0">;
3830def warn_ignored_ms_inheritance : Warning<
3831  "inheritance model ignored on %select{primary template|partial specialization}0">,
3832  InGroup<IgnoredAttributes>;
3833def note_previous_ms_inheritance : Note<
3834  "previous inheritance model specified here">;
3835def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
3836def err_mode_not_primitive : Error<
3837  "mode attribute only supported for integer and floating-point types">;
3838def err_mode_wrong_type : Error<
3839  "type of machine mode does not match type of base type">;
3840def warn_vector_mode_deprecated : Warning<
3841  "specifying vector types with the 'mode' attribute is deprecated; "
3842  "use the 'vector_size' attribute instead">,
3843  InGroup<DeprecatedAttributes>;
3844def err_complex_mode_vector_type : Error<
3845  "type of machine mode does not support base vector types">;
3846def err_enum_mode_vector_type : Error<
3847  "mode %0 is not supported for enumeration types">;
3848def warn_attribute_nonnull_no_pointers : Warning<
3849  "'nonnull' attribute applied to function with no pointer arguments">,
3850  InGroup<IgnoredAttributes>;
3851def warn_attribute_nonnull_parm_no_args : Warning<
3852  "'nonnull' attribute when used on parameters takes no arguments">,
3853  InGroup<IgnoredAttributes>;
3854def note_declared_nonnull : Note<
3855  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
3856def warn_attribute_sentinel_named_arguments : Warning<
3857  "'sentinel' attribute requires named arguments">,
3858  InGroup<IgnoredAttributes>;
3859def warn_attribute_sentinel_not_variadic : Warning<
3860  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
3861  InGroup<IgnoredAttributes>;
3862def err_attribute_sentinel_less_than_zero : Error<
3863  "'sentinel' parameter 1 less than zero">;
3864def err_attribute_sentinel_not_zero_or_one : Error<
3865  "'sentinel' parameter 2 not 0 or 1">;
3866def warn_cleanup_ext : Warning<
3867  "GCC does not allow the 'cleanup' attribute argument to be anything other "
3868  "than a simple identifier">,
3869  InGroup<GccCompat>;
3870def err_attribute_cleanup_arg_not_function : Error<
3871  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
3872def err_attribute_cleanup_func_must_take_one_arg : Error<
3873  "'cleanup' function %0 must take 1 parameter">;
3874def err_attribute_cleanup_func_arg_incompatible_type : Error<
3875  "'cleanup' function %0 parameter has "
3876  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
3877def err_attribute_regparm_wrong_platform : Error<
3878  "'regparm' is not valid on this platform">;
3879def err_attribute_regparm_invalid_number : Error<
3880  "'regparm' parameter must be between 0 and %0 inclusive">;
3881def err_attribute_not_supported_in_lang : Error<
3882  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
3883def err_attribute_not_supported_on_arch
3884    : Error<"%0 attribute is not supported on '%1'">;
3885def warn_gcc_ignores_type_attr : Warning<
3886  "GCC does not allow the %0 attribute to be written on a type">,
3887  InGroup<GccCompat>;
3888
3889// Clang-Specific Attributes
3890def warn_attribute_iboutlet : Warning<
3891  "%0 attribute can only be applied to instance variables or properties">,
3892  InGroup<IgnoredAttributes>;
3893def err_iboutletcollection_type : Error<
3894  "invalid type %0 as argument of iboutletcollection attribute">;
3895def err_iboutletcollection_builtintype : Error<
3896  "type argument of iboutletcollection attribute cannot be a builtin type">;
3897def warn_iboutlet_object_type : Warning<
3898  "%select{instance variable|property}2 with %0 attribute must "
3899  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
3900def warn_iboutletcollection_property_assign : Warning<
3901  "IBOutletCollection properties should be copy/strong and not assign">,
3902  InGroup<ObjCInvalidIBOutletProperty>;
3903
3904def err_attribute_overloadable_mismatch : Error<
3905  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
3906def note_attribute_overloadable_prev_overload : Note<
3907  "previous %select{unmarked |}0overload of function is here">;
3908def err_attribute_overloadable_no_prototype : Error<
3909  "'overloadable' function %0 must have a prototype">;
3910def err_attribute_overloadable_multiple_unmarked_overloads : Error<
3911  "at most one overload for a given name may lack the 'overloadable' "
3912  "attribute">;
3913def warn_attribute_no_builtin_invalid_builtin_name : Warning<
3914  "'%0' is not a valid builtin name for %1">,
3915  InGroup<DiagGroup<"invalid-no-builtin-names">>;
3916def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
3917  "empty %0 cannot be composed with named ones">;
3918def err_attribute_no_builtin_on_non_definition : Error<
3919  "%0 attribute is permitted on definitions only">;
3920def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
3921  "%0 attribute has no effect on defaulted or deleted functions">;
3922def warn_ns_attribute_wrong_return_type : Warning<
3923  "%0 attribute only applies to %select{functions|methods|properties}1 that "
3924  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
3925  InGroup<IgnoredAttributes>;
3926def err_ns_attribute_wrong_parameter_type : Error<
3927  "%0 attribute only applies to "
3928  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
3929def warn_ns_attribute_wrong_parameter_type : Warning<
3930  "%0 attribute only applies to "
3931  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
3932  InGroup<IgnoredAttributes>;
3933def warn_objc_requires_super_protocol : Warning<
3934  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
3935  InGroup<DiagGroup<"requires-super-attribute">>;
3936def note_protocol_decl : Note<
3937  "protocol is declared here">;
3938def note_protocol_decl_undefined : Note<
3939  "protocol %0 has no definition">;
3940
3941// objc_designated_initializer attribute diagnostics.
3942def warn_objc_designated_init_missing_super_call : Warning<
3943  "designated initializer missing a 'super' call to a designated initializer of the super class">,
3944  InGroup<ObjCDesignatedInit>;
3945def note_objc_designated_init_marked_here : Note<
3946  "method marked as designated initializer of the class here">;
3947def warn_objc_designated_init_non_super_designated_init_call : Warning<
3948  "designated initializer should only invoke a designated initializer on 'super'">,
3949  InGroup<ObjCDesignatedInit>;
3950def warn_objc_designated_init_non_designated_init_call : Warning<
3951  "designated initializer invoked a non-designated initializer">,
3952  InGroup<ObjCDesignatedInit>;
3953def warn_objc_secondary_init_super_init_call : Warning<
3954  "convenience initializer should not invoke an initializer on 'super'">,
3955  InGroup<ObjCDesignatedInit>;
3956def warn_objc_secondary_init_missing_init_call : Warning<
3957  "convenience initializer missing a 'self' call to another initializer">,
3958  InGroup<ObjCDesignatedInit>;
3959def warn_objc_implementation_missing_designated_init_override : Warning<
3960  "method override for the designated initializer of the superclass %objcinstance0 not found">,
3961  InGroup<ObjCDesignatedInit>;
3962def err_designated_init_attr_non_init : Error<
3963  "'objc_designated_initializer' attribute only applies to init methods "
3964  "of interface or class extension declarations">;
3965
3966// objc_bridge attribute diagnostics.
3967def err_objc_attr_not_id : Error<
3968  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
3969def err_objc_attr_typedef_not_id : Error<
3970  "parameter of %0 attribute must be 'id' when used on a typedef">;
3971def err_objc_attr_typedef_not_void_pointer : Error<
3972  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
3973def err_objc_cf_bridged_not_interface : Error<
3974  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
3975def err_objc_ns_bridged_invalid_cfobject : Error<
3976  "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
3977def warn_objc_invalid_bridge : Warning<
3978  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
3979def warn_objc_invalid_bridge_to_cf : Warning<
3980  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
3981
3982// objc_bridge_related attribute diagnostics.
3983def err_objc_bridged_related_invalid_class : Error<
3984  "could not find Objective-C class %0 to convert %1 to %2">;
3985def err_objc_bridged_related_invalid_class_name : Error<
3986  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
3987def err_objc_bridged_related_known_method : Error<
3988 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
3989 "method for this conversion">;
3990
3991def err_objc_attr_protocol_requires_definition : Error<
3992  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
3993
3994// Swift attributes.
3995def warn_attr_swift_name_function
3996  : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
3997    InGroup<SwiftNameAttribute>;
3998def warn_attr_swift_name_invalid_identifier
3999  : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4000    InGroup<SwiftNameAttribute>;
4001def warn_attr_swift_name_decl_kind
4002  : Warning<"%0 attribute cannot be applied to this declaration">,
4003    InGroup<SwiftNameAttribute>;
4004def warn_attr_swift_name_subscript_invalid_parameter
4005  : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4006        "have at least one parameter|"
4007        "have a 'self:' parameter}1">,
4008    InGroup<SwiftNameAttribute>;
4009def warn_attr_swift_name_missing_parameters
4010  : Warning<"%0 attribute is missing parameter label clause">,
4011    InGroup<SwiftNameAttribute>;
4012def warn_attr_swift_name_setter_parameters
4013  : Warning<"%0 attribute for setter must have one parameter for new value">,
4014    InGroup<SwiftNameAttribute>;
4015def warn_attr_swift_name_multiple_selfs
4016  : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4017    InGroup<SwiftNameAttribute>;
4018def warn_attr_swift_name_getter_parameters
4019  : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4020    InGroup<SwiftNameAttribute>;
4021def warn_attr_swift_name_subscript_setter_no_newValue
4022  : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4023    InGroup<SwiftNameAttribute>;
4024def warn_attr_swift_name_subscript_setter_multiple_newValues
4025  : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4026    InGroup<SwiftNameAttribute>;
4027def warn_attr_swift_name_subscript_getter_newValue
4028  : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4029    InGroup<SwiftNameAttribute>;
4030def warn_attr_swift_name_num_params
4031  : Warning<"too %select{few|many}0 parameters in %1 attribute (expected %2; got %3)">,
4032    InGroup<SwiftNameAttribute>;
4033
4034def err_attr_swift_error_no_error_parameter : Error<
4035  "%0 attribute can only be applied to a %select{function|method}1 with an "
4036  "error parameter">;
4037def err_attr_swift_error_return_type : Error<
4038  "%0 attribute with '%1' convention can only be applied to a "
4039  "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4040
4041def warn_ignored_objc_externally_retained : Warning<
4042  "'objc_externally_retained' can only be applied to local variables "
4043  "%select{of retainable type|with strong ownership}0">,
4044  InGroup<IgnoredAttributes>;
4045
4046// Function Parameter Semantic Analysis.
4047def err_param_with_void_type : Error<"argument may not have 'void' type">;
4048def err_void_only_param : Error<
4049  "'void' must be the first and only parameter if specified">;
4050def err_void_param_qualified : Error<
4051  "'void' as parameter must not have type qualifiers">;
4052def err_ident_list_in_fn_declaration : Error<
4053  "a parameter list without types is only allowed in a function definition">;
4054def ext_param_not_declared : Extension<
4055  "parameter %0 was not declared, defaulting to type 'int'">;
4056def err_param_default_argument : Error<
4057  "C does not support default arguments">;
4058def err_param_default_argument_redefinition : Error<
4059  "redefinition of default argument">;
4060def ext_param_default_argument_redefinition : ExtWarn<
4061  err_param_default_argument_redefinition.Text>,
4062  InGroup<MicrosoftDefaultArgRedefinition>;
4063def err_param_default_argument_missing : Error<
4064  "missing default argument on parameter">;
4065def err_param_default_argument_missing_name : Error<
4066  "missing default argument on parameter %0">;
4067def err_param_default_argument_references_param : Error<
4068  "default argument references parameter %0">;
4069def err_param_default_argument_references_local : Error<
4070  "default argument references local variable %0 of enclosing function">;
4071def err_param_default_argument_references_this : Error<
4072  "default argument references 'this'">;
4073def err_param_default_argument_nonfunc : Error<
4074  "default arguments can only be specified for parameters in a function "
4075  "declaration">;
4076def err_param_default_argument_template_redecl : Error<
4077  "default arguments cannot be added to a function template that has already "
4078  "been declared">;
4079def err_param_default_argument_member_template_redecl : Error<
4080  "default arguments cannot be added to an out-of-line definition of a member "
4081  "of a %select{class template|class template partial specialization|nested "
4082  "class in a template}0">;
4083def err_param_default_argument_on_parameter_pack : Error<
4084  "parameter pack cannot have a default argument">;
4085def err_uninitialized_member_for_assign : Error<
4086  "cannot define the implicit copy assignment operator for %0, because "
4087  "non-static %select{reference|const}1 member %2 cannot use copy "
4088  "assignment operator">;
4089def err_uninitialized_member_in_ctor : Error<
4090  "%select{constructor for %1|"
4091  "implicit default constructor for %1|"
4092  "cannot use constructor inherited from %1:}0 must explicitly "
4093  "initialize the %select{reference|const}2 member %3">;
4094def err_default_arg_makes_ctor_special : Error<
4095  "addition of default argument on redeclaration makes this constructor a "
4096  "%select{default|copy|move}0 constructor">;
4097
4098def err_use_of_default_argument_to_function_declared_later : Error<
4099  "use of default argument to function %0 that is declared later in class %1">;
4100def note_default_argument_declared_here : Note<
4101  "default argument declared here">;
4102def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4103def note_recursive_default_argument_used_here : Note<
4104  "default argument used here">;
4105
4106def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4107  "%diff{promoted type $ of K&R function parameter is not compatible with the "
4108  "parameter type $|promoted type of K&R function parameter is not compatible "
4109  "with parameter type}0,1 declared in a previous prototype">,
4110  InGroup<KNRPromotedParameter>;
4111
4112
4113// C++ Overloading Semantic Analysis.
4114def err_ovl_diff_return_type : Error<
4115  "functions that differ only in their return type cannot be overloaded">;
4116def err_ovl_static_nonstatic_member : Error<
4117  "static and non-static member functions with the same parameter types "
4118  "cannot be overloaded">;
4119
4120let Deferrable = 1 in {
4121
4122def err_ovl_no_viable_function_in_call : Error<
4123  "no matching function for call to %0">;
4124def err_ovl_no_viable_member_function_in_call : Error<
4125  "no matching member function for call to %0">;
4126def err_ovl_ambiguous_call : Error<
4127  "call to %0 is ambiguous">;
4128def err_ovl_deleted_call : Error<"call to deleted function %0">;
4129def err_ovl_ambiguous_member_call : Error<
4130  "call to member function %0 is ambiguous">;
4131def err_ovl_deleted_member_call : Error<
4132  "call to deleted member function %0">;
4133def note_ovl_too_many_candidates : Note<
4134    "remaining %0 candidate%s0 omitted; "
4135    "pass -fshow-overloads=all to show them">;
4136
4137def select_ovl_candidate_kind : TextSubstitution<
4138  "%select{function|function|function (with reversed parameter order)|"
4139    "constructor|"
4140    "constructor (the implicit default constructor)|"
4141    "constructor (the implicit copy constructor)|"
4142    "constructor (the implicit move constructor)|"
4143    "function (the implicit copy assignment operator)|"
4144    "function (the implicit move assignment operator)|"
4145    "function (the implicit 'operator==' for this 'operator<=>)'|"
4146    "inherited constructor}0%select{| template| %2}1">;
4147
4148def note_ovl_candidate : Note<
4149    "candidate %sub{select_ovl_candidate_kind}0,1,3"
4150    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4151    "| has different number of parameters (expected %5 but has %6)"
4152    "| has type mismatch at %ordinal5 parameter"
4153    "%diff{ (expected $ but has $)|}6,7"
4154    "| has different return type%diff{ ($ expected but has $)|}5,6"
4155    "| has different qualifiers (expected %5 but found %6)"
4156    "| has different exception specification}4">;
4157
4158def note_ovl_candidate_explicit : Note<
4159    "explicit %select{constructor|conversion function|deduction guide}0 "
4160    "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4161def note_ovl_candidate_inherited_constructor : Note<
4162    "constructor from base class %0 inherited here">;
4163def note_ovl_candidate_inherited_constructor_slice : Note<
4164    "candidate %select{constructor|template}0 ignored: "
4165    "inherited constructor cannot be used to %select{copy|move}1 object">;
4166def note_ovl_candidate_illegal_constructor : Note<
4167    "candidate %select{constructor|template}0 ignored: "
4168    "instantiation %select{takes|would take}0 its own class type by value">;
4169def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4170    "candidate constructor ignored: cannot be used to construct an object "
4171    "in address space %0">;
4172def note_ovl_candidate_bad_deduction : Note<
4173    "candidate template ignored: failed template argument deduction">;
4174def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4175    "couldn't infer template argument %0">;
4176def note_ovl_candidate_incomplete_deduction_pack : Note<
4177    "candidate template ignored: "
4178    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4179    "expanded parameter in deduced argument pack %2">;
4180def note_ovl_candidate_inconsistent_deduction : Note<
4181    "candidate template ignored: deduced %select{conflicting types|"
4182    "conflicting values|conflicting templates|packs of different lengths}0 "
4183    "for parameter %1%diff{ ($ vs. $)|}2,3">;
4184def note_ovl_candidate_inconsistent_deduction_types : Note<
4185    "candidate template ignored: deduced values %diff{"
4186    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4187    "%1 and %3 of conflicting types for parameter %0}2,4">;
4188def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4189    "candidate template ignored: invalid explicitly-specified argument "
4190    "for template parameter %0">;
4191def note_ovl_candidate_unsatisfied_constraints : Note<
4192    "candidate template ignored: constraints not satisfied%0">;
4193def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4194    "candidate template ignored: invalid explicitly-specified argument "
4195    "for %ordinal0 template parameter">;
4196def note_ovl_candidate_instantiation_depth : Note<
4197    "candidate template ignored: substitution exceeded maximum template "
4198    "instantiation depth">;
4199def note_ovl_candidate_underqualified : Note<
4200    "candidate template ignored: cannot deduce a type for %0 that would "
4201    "make %2 equal %1">;
4202def note_ovl_candidate_substitution_failure : Note<
4203    "candidate template ignored: substitution failure%0%1">;
4204def note_ovl_candidate_disabled_by_enable_if : Note<
4205    "candidate template ignored: disabled by %0%1">;
4206def note_ovl_candidate_disabled_by_requirement : Note<
4207    "candidate template ignored: requirement '%0' was not satisfied%1">;
4208def note_ovl_candidate_has_pass_object_size_params: Note<
4209    "candidate address cannot be taken because parameter %0 has "
4210    "pass_object_size attribute">;
4211def err_diagnose_if_succeeded : Error<"%0">;
4212def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4213    ShowInSystemHeader;
4214def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4215    "candidate disabled: %0">;
4216def note_ovl_candidate_disabled_by_extension : Note<
4217    "candidate unavailable as it requires OpenCL extension '%0' to be enabled">;
4218def err_addrof_function_disabled_by_enable_if_attr : Error<
4219    "cannot take address of function %0 because it has one or more "
4220    "non-tautological enable_if conditions">;
4221def err_addrof_function_constraints_not_satisfied : Error<
4222    "cannot take address of function %0 because its constraints are not "
4223    "satisfied">;
4224def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4225    "candidate function made ineligible by enable_if">;
4226def note_ovl_candidate_deduced_mismatch : Note<
4227    "candidate template ignored: deduced type "
4228    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4229    "adjusted type $ of %select{|element of }4argument"
4230    "|of %select{|element of }4%ordinal0 parameter does not match "
4231    "adjusted type of %select{|element of }4argument}1,2%3">;
4232def note_ovl_candidate_non_deduced_mismatch : Note<
4233    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4234// This note is needed because the above note would sometimes print two
4235// different types with the same name.  Remove this note when the above note
4236// can handle that case properly.
4237def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4238    "candidate template ignored: could not match %q0 against %q1">;
4239
4240// Note that we don't treat templates differently for this diagnostic.
4241def note_ovl_candidate_arity : Note<"candidate "
4242    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4243    "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
4244    "%plural{1:was|:were}5 provided">;
4245
4246def note_ovl_candidate_arity_one : Note<"candidate "
4247    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4248    "%select{requires at least|allows at most single|requires single}3 "
4249    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4250
4251def note_ovl_candidate_deleted : Note<
4252    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4253    "%select{explicitly made unavailable|explicitly deleted|"
4254    "implicitly deleted}3">;
4255
4256// Giving the index of the bad argument really clutters this message, and
4257// it's relatively unimportant because 1) it's generally obvious which
4258// argument(s) are of the given object type and 2) the fix is usually
4259// to complete the type, which doesn't involve changes to the call line
4260// anyway.  If people complain, we can change it.
4261def note_ovl_candidate_bad_conv_incomplete : Note<
4262    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4263    "cannot convert argument of incomplete type "
4264    "%diff{$ to $|to parameter type}3,4 for "
4265    "%select{%ordinal6 argument|object argument}5"
4266    "%select{|; dereference the argument with *|"
4267    "; take the address of the argument with &|"
4268    "; remove *|"
4269    "; remove &}7">;
4270def note_ovl_candidate_bad_list_argument : Note<
4271    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4272    "cannot convert initializer list argument to %4">;
4273def note_ovl_candidate_bad_overload : Note<
4274    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4275    "no overload of %4 matching %3 for %ordinal5 argument">;
4276def note_ovl_candidate_bad_conv : Note<
4277    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4278    "no known conversion "
4279    "%diff{from $ to $|from argument type to parameter type}3,4 for "
4280    "%select{%ordinal6 argument|object argument}5"
4281    "%select{|; dereference the argument with *|"
4282    "; take the address of the argument with &|"
4283    "; remove *|"
4284    "; remove &}7">;
4285def note_ovl_candidate_bad_arc_conv : Note<
4286    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4287    "cannot implicitly convert argument "
4288    "%diff{of type $ to $|type to parameter type}3,4 for "
4289    "%select{%ordinal6 argument|object argument}5 under ARC">;
4290def note_ovl_candidate_bad_lvalue : Note<
4291    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4292    "expects an l-value for "
4293    "%select{%ordinal4 argument|object argument}3">;
4294def note_ovl_candidate_bad_addrspace : Note<
4295    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4296    "cannot %select{pass pointer to|bind reference in}5 %3 "
4297    "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4298    "argument">;
4299def note_ovl_candidate_bad_addrspace_this : Note<
4300    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4301    "'this' object is in %3, but method expects object in %4">;
4302def note_ovl_candidate_bad_gc : Note<
4303    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4304    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4305    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4306def note_ovl_candidate_bad_ownership : Note<
4307    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4308    "%select{%ordinal7|'this'}6 argument (%3) has "
4309    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4310    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4311    "__autoreleasing}5 ownership">;
4312def note_ovl_candidate_bad_cvr_this : Note<
4313    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4314    "'this' argument has type %3, but method is not marked "
4315    "%select{const|restrict|const or restrict|volatile|const or volatile|"
4316    "volatile or restrict|const, volatile, or restrict}4">;
4317def note_ovl_candidate_bad_cvr : Note<
4318    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4319    "%ordinal5 argument (%3) would lose "
4320    "%select{const|restrict|const and restrict|volatile|const and volatile|"
4321    "volatile and restrict|const, volatile, and restrict}4 qualifier"
4322    "%select{||s||s|s|s}4">;
4323def note_ovl_candidate_bad_unaligned : Note<
4324    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4325    "%ordinal5 argument (%3) would lose __unaligned qualifier">;
4326def note_ovl_candidate_bad_base_to_derived_conv : Note<
4327    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4328    "cannot %select{convert from|convert from|bind}3 "
4329    "%select{base class pointer|superclass|base class object of type}3 %4 to "
4330    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4331    "%ordinal6 argument">;
4332def note_ovl_candidate_bad_target : Note<
4333    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4334    "call to "
4335    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4336    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4337def note_ovl_candidate_constraints_not_satisfied : Note<
4338    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4339    "not satisfied">;
4340def note_implicit_member_target_infer_collision : Note<
4341    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4342    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4343    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4344
4345def note_ambiguous_type_conversion: Note<
4346    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4347def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4348def err_ovl_no_viable_function_in_init : Error<
4349  "no matching constructor for initialization of %0">;
4350def err_ovl_no_conversion_in_cast : Error<
4351  "cannot convert %1 to %2 without a conversion operator">;
4352def err_ovl_no_viable_conversion_in_cast : Error<
4353  "no matching conversion for %select{|static_cast|reinterpret_cast|"
4354  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4355def err_ovl_ambiguous_conversion_in_cast : Error<
4356  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4357  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4358def err_ovl_deleted_conversion_in_cast : Error<
4359  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4360  "functional-style cast|}0 from %1 to %2 uses deleted function">;
4361def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4362def err_ref_init_ambiguous : Error<
4363  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4364def err_ovl_deleted_init : Error<
4365  "call to deleted constructor of %0">;
4366def err_ovl_deleted_special_init : Error<
4367  "call to implicitly-deleted %select{default constructor|copy constructor|"
4368  "move constructor|copy assignment operator|move assignment operator|"
4369  "destructor|function}0 of %1">;
4370def err_ovl_ambiguous_oper_unary : Error<
4371  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4372def err_ovl_ambiguous_oper_binary : Error<
4373  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4374def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4375  "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4376  "and %2) to be ambiguous despite there being a unique best viable function"
4377  "%select{ with non-reversed arguments|}3">,
4378  InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4379def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4380  "ambiguity is between a regular call to this operator and a call with the "
4381  "argument order reversed">;
4382def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4383  "candidate function with non-reversed arguments">;
4384def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4385  "ambiguous candidate function with reversed arguments">;
4386def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4387def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4388def err_ovl_deleted_oper : Error<
4389  "overload resolution selected deleted operator '%0'">;
4390def err_ovl_deleted_special_oper : Error<
4391  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4392  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4393  "implicitly deleted">;
4394def err_ovl_deleted_comparison : Error<
4395  "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4396def err_ovl_rewrite_equalequal_not_bool : Error<
4397  "return type %0 of selected 'operator==' function for rewritten "
4398  "'%1' comparison is not 'bool'">;
4399def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4400  "ISO C++20 requires return type of selected 'operator==' function for "
4401  "rewritten '%1' comparison to be 'bool', not %0">,
4402  InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4403def err_ovl_no_viable_subscript :
4404    Error<"no viable overloaded operator[] for type %0">;
4405def err_ovl_no_oper :
4406    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4407def err_ovl_unresolvable : Error<
4408  "reference to %select{overloaded|multiversioned}1 function could not be "
4409  "resolved; did you mean to call it%select{| with no arguments}0?">;
4410def err_bound_member_function : Error<
4411  "reference to non-static member function must be called"
4412  "%select{|; did you mean to call it with no arguments?}0">;
4413def note_possible_target_of_call : Note<"possible target for call">;
4414
4415def err_ovl_no_viable_object_call : Error<
4416  "no matching function for call to object of type %0">;
4417def err_ovl_ambiguous_object_call : Error<
4418  "call to object of type %0 is ambiguous">;
4419def err_ovl_deleted_object_call : Error<
4420  "call to deleted function call operator in type %0">;
4421def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4422def err_member_call_without_object : Error<
4423  "call to non-static member function without an object argument">;
4424
4425// C++ Address of Overloaded Function
4426def err_addr_ovl_no_viable : Error<
4427  "address of overloaded function %0 does not match required type %1">;
4428def err_addr_ovl_ambiguous : Error<
4429  "address of overloaded function %0 is ambiguous">;
4430def err_addr_ovl_not_func_ptrref : Error<
4431  "address of overloaded function %0 cannot be converted to type %1">;
4432def err_addr_ovl_no_qualifier : Error<
4433  "cannot form member pointer of type %0 without '&' and class name">;
4434
4435} // let Deferrable
4436
4437// C++11 Literal Operators
4438def err_ovl_no_viable_literal_operator : Error<
4439  "no matching literal operator for call to %0"
4440  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4441  "%select{| or 'const char *'}4"
4442  "%select{|, and no matching literal operator template}5">;
4443
4444// C++ Template Declarations
4445def err_template_param_shadow : Error<
4446  "declaration of %0 shadows template parameter">;
4447def ext_template_param_shadow : ExtWarn<
4448  err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
4449def note_template_param_here : Note<"template parameter is declared here">;
4450def warn_template_export_unsupported : Warning<
4451  "exported templates are unsupported">;
4452def err_template_outside_namespace_or_class_scope : Error<
4453  "templates can only be declared in namespace or class scope">;
4454def err_template_inside_local_class : Error<
4455  "templates cannot be declared inside of a local class">;
4456def err_template_linkage : Error<"templates must have C++ linkage">;
4457def err_template_typedef : Error<"a typedef cannot be a template">;
4458def err_template_unnamed_class : Error<
4459  "cannot declare a class template with no name">;
4460def err_template_param_list_different_arity : Error<
4461  "%select{too few|too many}0 template parameters in template "
4462  "%select{|template parameter }1redeclaration">;
4463def note_template_param_list_different_arity : Note<
4464  "%select{too few|too many}0 template parameters in template template "
4465  "argument">;
4466def note_template_prev_declaration : Note<
4467  "previous template %select{declaration|template parameter}0 is here">;
4468def err_template_param_different_kind : Error<
4469  "template parameter has a different kind in template "
4470  "%select{|template parameter }0redeclaration">;
4471def note_template_param_different_kind : Note<
4472  "template parameter has a different kind in template argument">;
4473
4474def err_invalid_decl_specifier_in_nontype_parm : Error<
4475  "invalid declaration specifier in template non-type parameter">;
4476
4477def err_template_nontype_parm_different_type : Error<
4478  "template non-type parameter has a different type %0 in template "
4479  "%select{|template parameter }1redeclaration">;
4480
4481def note_template_nontype_parm_different_type : Note<
4482  "template non-type parameter has a different type %0 in template argument">;
4483def note_template_nontype_parm_prev_declaration : Note<
4484  "previous non-type template parameter with type %0 is here">;
4485def err_template_nontype_parm_bad_type : Error<
4486  "a non-type template parameter cannot have type %0">;
4487def err_template_nontype_parm_bad_structural_type : Error<
4488  "a non-type template parameter cannot have type %0 before C++20">;
4489def err_template_nontype_parm_incomplete : Error<
4490  "non-type template parameter has incomplete type %0">;
4491def err_template_nontype_parm_not_literal : Error<
4492  "non-type template parameter has non-literal type %0">;
4493def err_template_nontype_parm_rvalue_ref : Error<
4494  "non-type template parameter has rvalue reference type %0">;
4495def err_template_nontype_parm_not_structural : Error<
4496  "type %0 of non-type template parameter is not a structural type">;
4497def note_not_structural_non_public : Note<
4498  "%0 is not a structural type because it has a "
4499  "%select{non-static data member|base class}1 that is not public">;
4500def note_not_structural_mutable_field : Note<
4501  "%0 is not a structural type because it has a mutable "
4502  "non-static data member">;
4503def note_not_structural_rvalue_ref_field : Note<
4504  "%0 is not a structural type because it has a non-static data member "
4505  "of rvalue reference type">;
4506def note_not_structural_subobject : Note<
4507  "%0 is not a structural type because it has a "
4508  "%select{non-static data member|base class}1 of non-structural type %2">;
4509def warn_cxx17_compat_template_nontype_parm_type : Warning<
4510  "non-type template parameter of type %0 is incompatible with "
4511  "C++ standards before C++20">,
4512  DefaultIgnore, InGroup<CXXPre20Compat>;
4513def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
4514  "non-type template parameters declared with %0 are incompatible with C++ "
4515  "standards before C++17">,
4516  DefaultIgnore, InGroup<CXXPre17Compat>;
4517def err_template_param_default_arg_redefinition : Error<
4518  "template parameter redefines default argument">;
4519def note_template_param_prev_default_arg : Note<
4520  "previous default template argument defined here">;
4521def err_template_param_default_arg_missing : Error<
4522  "template parameter missing a default argument">;
4523def ext_template_parameter_default_in_function_template : ExtWarn<
4524  "default template arguments for a function template are a C++11 extension">,
4525  InGroup<CXX11>;
4526def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
4527  "default template arguments for a function template are incompatible with C++98">,
4528  InGroup<CXX98Compat>, DefaultIgnore;
4529def err_template_parameter_default_template_member : Error<
4530  "cannot add a default template argument to the definition of a member of a "
4531  "class template">;
4532def err_template_parameter_default_friend_template : Error<
4533  "default template argument not permitted on a friend template">;
4534def err_template_template_parm_no_parms : Error<
4535  "template template parameter must have its own template parameters">;
4536
4537def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
4538  InGroup<CXX14>;
4539def warn_cxx11_compat_variable_template : Warning<
4540  "variable templates are incompatible with C++ standards before C++14">,
4541  InGroup<CXXPre14Compat>, DefaultIgnore;
4542def err_template_variable_noparams : Error<
4543  "extraneous 'template<>' in declaration of variable %0">;
4544def err_template_member : Error<"member %0 declared as a template">;
4545def err_template_member_noparams : Error<
4546  "extraneous 'template<>' in declaration of member %0">;
4547def err_template_tag_noparams : Error<
4548  "extraneous 'template<>' in declaration of %0 %1">;
4549
4550def warn_cxx17_compat_adl_only_template_id : Warning<
4551  "use of function template name with no prior function template "
4552  "declaration in function call with explicit template arguments "
4553  "is incompatible with C++ standards before C++20">,
4554  InGroup<CXXPre20Compat>, DefaultIgnore;
4555def ext_adl_only_template_id : ExtWarn<
4556  "use of function template name with no prior declaration in function call "
4557  "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
4558
4559// C++ Template Argument Lists
4560def err_template_missing_args : Error<
4561  "use of "
4562  "%select{class template|function template|variable template|alias template|"
4563  "template template parameter|concept|template}0 %1 requires template "
4564  "arguments">;
4565def err_template_arg_list_different_arity : Error<
4566  "%select{too few|too many}0 template arguments for "
4567  "%select{class template|function template|variable template|alias template|"
4568  "template template parameter|concept|template}1 %2">;
4569def note_template_decl_here : Note<"template is declared here">;
4570def err_template_arg_must_be_type : Error<
4571  "template argument for template type parameter must be a type">;
4572def err_template_arg_must_be_type_suggest : Error<
4573  "template argument for template type parameter must be a type; "
4574  "did you forget 'typename'?">;
4575def ext_ms_template_type_arg_missing_typename : ExtWarn<
4576  "template argument for template type parameter must be a type; "
4577  "omitted 'typename' is a Microsoft extension">,
4578  InGroup<MicrosoftTemplate>;
4579def err_template_arg_must_be_expr : Error<
4580  "template argument for non-type template parameter must be an expression">;
4581def err_template_arg_nontype_ambig : Error<
4582  "template argument for non-type template parameter is treated as function type %0">;
4583def err_template_arg_must_be_template : Error<
4584  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
4585def ext_template_arg_local_type : ExtWarn<
4586  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
4587def ext_template_arg_unnamed_type : ExtWarn<
4588  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
4589def warn_cxx98_compat_template_arg_local_type : Warning<
4590  "local type %0 as template argument is incompatible with C++98">,
4591  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
4592def warn_cxx98_compat_template_arg_unnamed_type : Warning<
4593  "unnamed type as template argument is incompatible with C++98">,
4594  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
4595def note_template_unnamed_type_here : Note<
4596  "unnamed type used in template argument was declared here">;
4597def err_template_arg_overload_type : Error<
4598  "template argument is the type of an unresolved overloaded function">;
4599def err_template_arg_not_valid_template : Error<
4600  "template argument does not refer to a class or alias template, or template "
4601  "template parameter">;
4602def note_template_arg_refers_here_func : Note<
4603  "template argument refers to function template %0, here">;
4604def err_template_arg_template_params_mismatch : Error<
4605  "template template argument has different template parameters than its "
4606  "corresponding template template parameter">;
4607def err_template_arg_not_integral_or_enumeral : Error<
4608  "non-type template argument of type %0 must have an integral or enumeration"
4609  " type">;
4610def err_template_arg_not_ice : Error<
4611  "non-type template argument of type %0 is not an integral constant "
4612  "expression">;
4613def err_template_arg_not_address_constant : Error<
4614  "non-type template argument of type %0 is not a constant expression">;
4615def warn_cxx98_compat_template_arg_null : Warning<
4616  "use of null pointer as non-type template argument is incompatible with "
4617  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4618def err_template_arg_untyped_null_constant : Error<
4619  "null non-type template argument must be cast to template parameter type %0">;
4620def err_template_arg_wrongtype_null_constant : Error<
4621  "null non-type template argument of type %0 does not match template parameter "
4622  "of type %1">;
4623def err_non_type_template_parm_type_deduction_failure : Error<
4624  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
4625def err_deduced_non_type_template_arg_type_mismatch : Error<
4626  "deduced non-type template argument does not have the same type as the "
4627  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
4628def err_non_type_template_arg_subobject : Error<
4629  "non-type template argument refers to subobject '%0'">;
4630def err_non_type_template_arg_addr_label_diff : Error<
4631  "template argument / label address difference / what did you expect?">;
4632def err_non_type_template_arg_unsupported : Error<
4633  "sorry, non-type template argument of type %0 is not yet supported">;
4634def err_template_arg_not_convertible : Error<
4635  "non-type template argument of type %0 cannot be converted to a value "
4636  "of type %1">;
4637def warn_template_arg_negative : Warning<
4638  "non-type template argument with value '%0' converted to '%1' for unsigned "
4639  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4640def warn_template_arg_too_large : Warning<
4641  "non-type template argument value '%0' truncated to '%1' for "
4642  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4643def err_template_arg_no_ref_bind : Error<
4644  "non-type template parameter of reference type "
4645  "%diff{$ cannot bind to template argument of type $"
4646  "|cannot bind to template of incompatible argument type}0,1">;
4647def err_template_arg_ref_bind_ignores_quals : Error<
4648  "reference binding of non-type template parameter "
4649  "%diff{of type $ to template argument of type $|to template argument}0,1 "
4650  "ignores qualifiers">;
4651def err_template_arg_not_decl_ref : Error<
4652  "non-type template argument does not refer to any declaration">;
4653def err_template_arg_not_address_of : Error<
4654  "non-type template argument for template parameter of pointer type %0 must "
4655  "have its address taken">;
4656def err_template_arg_address_of_non_pointer : Error<
4657  "address taken in non-type template argument for template parameter of "
4658  "reference type %0">;
4659def err_template_arg_reference_var : Error<
4660  "non-type template argument of reference type %0 is not an object">;
4661def err_template_arg_field : Error<
4662  "non-type template argument refers to non-static data member %0">;
4663def err_template_arg_method : Error<
4664  "non-type template argument refers to non-static member function %0">;
4665def err_template_arg_object_no_linkage : Error<
4666  "non-type template argument refers to %select{function|object}0 %1 that "
4667  "does not have linkage">;
4668def warn_cxx98_compat_template_arg_object_internal : Warning<
4669  "non-type template argument referring to %select{function|object}0 %1 with "
4670  "internal linkage is incompatible with C++98">,
4671  InGroup<CXX98Compat>, DefaultIgnore;
4672def ext_template_arg_object_internal : ExtWarn<
4673  "non-type template argument referring to %select{function|object}0 %1 with "
4674  "internal linkage is a C++11 extension">, InGroup<CXX11>;
4675def err_template_arg_thread_local : Error<
4676  "non-type template argument refers to thread-local object">;
4677def note_template_arg_internal_object : Note<
4678  "non-type template argument refers to %select{function|object}0 here">;
4679def note_template_arg_refers_here : Note<
4680  "non-type template argument refers here">;
4681def err_template_arg_not_object_or_func : Error<
4682  "non-type template argument does not refer to an object or function">;
4683def err_template_arg_not_pointer_to_member_form : Error<
4684  "non-type template argument is not a pointer to member constant">;
4685def err_template_arg_member_ptr_base_derived_not_supported : Error<
4686  "sorry, non-type template argument of pointer-to-member type %1 that refers "
4687  "to member %q0 of a different class is not supported yet">;
4688def ext_template_arg_extra_parens : ExtWarn<
4689  "address non-type template argument cannot be surrounded by parentheses">;
4690def warn_cxx98_compat_template_arg_extra_parens : Warning<
4691  "redundant parentheses surrounding address non-type template argument are "
4692  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4693def err_pointer_to_member_type : Error<
4694  "invalid use of pointer to member type after %select{.*|->*}0">;
4695def err_pointer_to_member_call_drops_quals : Error<
4696  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
4697def err_pointer_to_member_oper_value_classify: Error<
4698  "pointer-to-member function type %0 can only be called on an "
4699  "%select{rvalue|lvalue}1">;
4700def ext_pointer_to_const_ref_member_on_rvalue : Extension<
4701  "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
4702  InGroup<CXX20>, SFINAEFailure;
4703def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
4704  "invoking a pointer to a 'const &' member function on an rvalue is "
4705  "incompatible with C++ standards before C++20">,
4706  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
4707def ext_ms_deref_template_argument: ExtWarn<
4708  "non-type template argument containing a dereference operation is a "
4709  "Microsoft extension">, InGroup<MicrosoftTemplate>;
4710def ext_ms_delayed_template_argument: ExtWarn<
4711  "using the undeclared type %0 as a default template argument is a "
4712  "Microsoft extension">, InGroup<MicrosoftTemplate>;
4713def err_template_arg_deduced_incomplete_pack : Error<
4714  "deduced incomplete pack %0 for template parameter %1">;
4715
4716// C++ template specialization
4717def err_template_spec_unknown_kind : Error<
4718  "can only provide an explicit specialization for a class template, function "
4719  "template, variable template, or a member function, static data member, "
4720  "%select{or member class|member class, or member enumeration}0 of a "
4721  "class template">;
4722def note_specialized_entity : Note<
4723  "explicitly specialized declaration is here">;
4724def note_explicit_specialization_declared_here : Note<
4725  "explicit specialization declared here">;
4726def err_template_spec_decl_function_scope : Error<
4727  "explicit specialization of %0 in function scope">;
4728def err_template_spec_decl_friend : Error<
4729  "cannot declare an explicit specialization in a friend">;
4730def err_template_spec_redecl_out_of_scope : Error<
4731  "%select{class template|class template partial|variable template|"
4732  "variable template partial|function template|member "
4733  "function|static data member|member class|member enumeration}0 "
4734  "specialization of %1 not in %select{a namespace enclosing %2|"
4735  "class %2 or an enclosing namespace}3">;
4736def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
4737  "%select{class template|class template partial|variable template|"
4738  "variable template partial|function template|member "
4739  "function|static data member|member class|member enumeration}0 "
4740  "specialization of %1 not in %select{a namespace enclosing %2|"
4741  "class %2 or an enclosing namespace}3 "
4742  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
4743def err_template_spec_redecl_global_scope : Error<
4744  "%select{class template|class template partial|variable template|"
4745  "variable template partial|function template|member "
4746  "function|static data member|member class|member enumeration}0 "
4747  "specialization of %1 must occur at global scope">;
4748def err_spec_member_not_instantiated : Error<
4749  "specialization of member %q0 does not specialize an instantiated member">;
4750def note_specialized_decl : Note<"attempt to specialize declaration here">;
4751def err_specialization_after_instantiation : Error<
4752  "explicit specialization of %0 after instantiation">;
4753def note_instantiation_required_here : Note<
4754  "%select{implicit|explicit}0 instantiation first required here">;
4755def err_template_spec_friend : Error<
4756  "template specialization declaration cannot be a friend">;
4757def err_template_spec_default_arg : Error<
4758  "default argument not permitted on an explicit "
4759  "%select{instantiation|specialization}0 of function %1">;
4760def err_not_class_template_specialization : Error<
4761  "cannot specialize a %select{dependent template|template template "
4762  "parameter}0">;
4763def ext_explicit_specialization_storage_class : ExtWarn<
4764  "explicit specialization cannot have a storage class">;
4765def err_explicit_specialization_inconsistent_storage_class : Error<
4766  "explicit specialization has extraneous, inconsistent storage class "
4767  "'%select{none|extern|static|__private_extern__|auto|register}0'">;
4768def err_dependent_function_template_spec_no_match : Error<
4769  "no candidate function template was found for dependent"
4770  " friend function template specialization">;
4771def note_dependent_function_template_spec_discard_reason : Note<
4772  "candidate ignored: %select{not a function template"
4773  "|not a member of the enclosing namespace;"
4774  " did you mean to explicitly qualify the specialization?}0">;
4775
4776// C++ class template specializations and out-of-line definitions
4777def err_template_spec_needs_header : Error<
4778  "template specialization requires 'template<>'">;
4779def err_template_spec_needs_template_parameters : Error<
4780  "template specialization or definition requires a template parameter list "
4781  "corresponding to the nested type %0">;
4782def err_template_param_list_matches_nontemplate : Error<
4783  "template parameter list matching the non-templated nested type %0 should "
4784  "be empty ('template<>')">;
4785def err_alias_template_extra_headers : Error<
4786  "extraneous template parameter list in alias template declaration">;
4787def err_template_spec_extra_headers : Error<
4788  "extraneous template parameter list in template specialization or "
4789  "out-of-line template definition">;
4790def warn_template_spec_extra_headers : Warning<
4791  "extraneous template parameter list in template specialization">;
4792def note_explicit_template_spec_does_not_need_header : Note<
4793  "'template<>' header not required for explicitly-specialized class %0 "
4794  "declared here">;
4795def err_template_qualified_declarator_no_match : Error<
4796  "nested name specifier '%0' for declaration does not refer into a class, "
4797  "class template or class template partial specialization">;
4798def err_specialize_member_of_template : Error<
4799  "cannot specialize %select{|(with 'template<>') }0a member of an "
4800  "unspecialized template">;
4801
4802// C++ Class Template Partial Specialization
4803def err_default_arg_in_partial_spec : Error<
4804    "default template argument in a class template partial specialization">;
4805def err_dependent_non_type_arg_in_partial_spec : Error<
4806    "type of specialized non-type template argument depends on a template "
4807    "parameter of the partial specialization">;
4808def note_dependent_non_type_default_arg_in_partial_spec : Note<
4809    "template parameter is used in default argument declared here">;
4810def err_dependent_typed_non_type_arg_in_partial_spec : Error<
4811    "non-type template argument specializes a template parameter with "
4812    "dependent type %0">;
4813def err_partial_spec_args_match_primary_template : Error<
4814    "%select{class|variable}0 template partial specialization does not "
4815    "specialize any template argument; to %select{declare|define}1 the "
4816    "primary template, remove the template argument list">;
4817def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
4818    "%select{class|variable}0 template partial specialization is not "
4819    "more specialized than the primary template">, DefaultError,
4820    InGroup<DiagGroup<"invalid-partial-specialization">>;
4821def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
4822def ext_partial_specs_not_deducible : ExtWarn<
4823    "%select{class|variable}0 template partial specialization contains "
4824    "%select{a template parameter|template parameters}1 that cannot be "
4825    "deduced; this partial specialization will never be used">,
4826    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
4827def note_non_deducible_parameter : Note<
4828    "non-deducible template parameter %0">;
4829def err_partial_spec_ordering_ambiguous : Error<
4830    "ambiguous partial specializations of %0">;
4831def note_partial_spec_match : Note<"partial specialization matches %0">;
4832def err_partial_spec_redeclared : Error<
4833  "class template partial specialization %0 cannot be redeclared">;
4834def note_partial_specialization_declared_here : Note<
4835  "explicit specialization declared here">;
4836def note_prev_partial_spec_here : Note<
4837  "previous declaration of class template partial specialization %0 is here">;
4838def err_partial_spec_fully_specialized : Error<
4839  "partial specialization of %0 does not use any of its template parameters">;
4840
4841// C++ Variable Template Partial Specialization
4842def err_var_partial_spec_redeclared : Error<
4843  "variable template partial specialization %0 cannot be redefined">;
4844def note_var_prev_partial_spec_here : Note<
4845  "previous declaration of variable template partial specialization is here">;
4846def err_var_spec_no_template : Error<
4847  "no variable template matches%select{| partial}0 specialization">;
4848def err_var_spec_no_template_but_method : Error<
4849  "no variable template matches specialization; "
4850  "did you mean to use %0 as function template instead?">;
4851
4852// C++ Function template specializations
4853def err_function_template_spec_no_match : Error<
4854    "no function template matches function template specialization %0">;
4855def err_function_template_spec_ambiguous : Error<
4856    "function template specialization %0 ambiguously refers to more than one "
4857    "function template; explicitly specify%select{| additional}1 template "
4858    "arguments to identify a particular function template">;
4859def note_function_template_spec_matched : Note<
4860    "function template %q0 matches specialization %1">;
4861def err_function_template_partial_spec : Error<
4862    "function template partial specialization is not allowed">;
4863
4864// C++ Template Instantiation
4865def err_template_recursion_depth_exceeded : Error<
4866  "recursive template instantiation exceeded maximum depth of %0">,
4867  DefaultFatal, NoSFINAE;
4868def note_template_recursion_depth : Note<
4869  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
4870
4871def err_template_instantiate_within_definition : Error<
4872  "%select{implicit|explicit}0 instantiation of template %1 within its"
4873  " own definition">;
4874def err_template_instantiate_undefined : Error<
4875  "%select{implicit|explicit}0 instantiation of undefined template %1">;
4876def err_implicit_instantiate_member_undefined : Error<
4877  "implicit instantiation of undefined member %0">;
4878def note_template_class_instantiation_was_here : Note<
4879  "class template %0 was instantiated here">;
4880def note_template_class_explicit_specialization_was_here : Note<
4881  "class template %0 was explicitly specialized here">;
4882def note_template_class_instantiation_here : Note<
4883  "in instantiation of template class %q0 requested here">;
4884def note_template_member_class_here : Note<
4885  "in instantiation of member class %q0 requested here">;
4886def note_template_member_function_here : Note<
4887  "in instantiation of member function %q0 requested here">;
4888def note_function_template_spec_here : Note<
4889  "in instantiation of function template specialization %q0 requested here">;
4890def note_template_static_data_member_def_here : Note<
4891  "in instantiation of static data member %q0 requested here">;
4892def note_template_variable_def_here : Note<
4893  "in instantiation of variable template specialization %q0 requested here">;
4894def note_template_enum_def_here : Note<
4895  "in instantiation of enumeration %q0 requested here">;
4896def note_template_nsdmi_here : Note<
4897  "in instantiation of default member initializer %q0 requested here">;
4898def note_template_type_alias_instantiation_here : Note<
4899  "in instantiation of template type alias %0 requested here">;
4900def note_template_exception_spec_instantiation_here : Note<
4901  "in instantiation of exception specification for %0 requested here">;
4902def note_template_requirement_instantiation_here : Note<
4903  "in instantiation of requirement here">;
4904def warn_var_template_missing : Warning<"instantiation of variable %q0 "
4905  "required here, but no definition is available">,
4906  InGroup<UndefinedVarTemplate>;
4907def warn_func_template_missing : Warning<"instantiation of function %q0 "
4908  "required here, but no definition is available">,
4909  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
4910def note_forward_template_decl : Note<
4911  "forward declaration of template entity is here">;
4912def note_inst_declaration_hint : Note<"add an explicit instantiation "
4913  "declaration to suppress this warning if %q0 is explicitly instantiated in "
4914  "another translation unit">;
4915def note_evaluating_exception_spec_here : Note<
4916  "in evaluation of exception specification for %q0 needed here">;
4917
4918def note_default_arg_instantiation_here : Note<
4919  "in instantiation of default argument for '%0' required here">;
4920def note_default_function_arg_instantiation_here : Note<
4921  "in instantiation of default function argument expression "
4922  "for '%0' required here">;
4923def note_explicit_template_arg_substitution_here : Note<
4924  "while substituting explicitly-specified template arguments into function "
4925  "template %0 %1">;
4926def note_function_template_deduction_instantiation_here : Note<
4927  "while substituting deduced template arguments into function template %0 "
4928  "%1">;
4929def note_deduced_template_arg_substitution_here : Note<
4930  "during template argument deduction for %select{class|variable}0 template "
4931  "%select{partial specialization |}1%2 %3">;
4932def note_prior_template_arg_substitution : Note<
4933  "while substituting prior template arguments into %select{non-type|template}0"
4934  " template parameter%1 %2">;
4935def note_template_default_arg_checking : Note<
4936  "while checking a default template argument used here">;
4937def note_concept_specialization_here : Note<
4938  "while checking the satisfaction of concept '%0' requested here">;
4939def note_nested_requirement_here : Note<
4940  "while checking the satisfaction of nested requirement requested here">;
4941def note_checking_constraints_for_template_id_here : Note<
4942  "while checking constraint satisfaction for template '%0' required here">;
4943def note_checking_constraints_for_var_spec_id_here : Note<
4944  "while checking constraint satisfaction for variable template "
4945  "partial specialization '%0' required here">;
4946def note_checking_constraints_for_class_spec_id_here : Note<
4947  "while checking constraint satisfaction for class template partial "
4948  "specialization '%0' required here">;
4949def note_checking_constraints_for_function_here : Note<
4950  "while checking constraint satisfaction for function '%0' required here">;
4951def note_constraint_substitution_here : Note<
4952  "while substituting template arguments into constraint expression here">;
4953def note_constraint_normalization_here : Note<
4954  "while calculating associated constraint of template '%0' here">;
4955def note_parameter_mapping_substitution_here : Note<
4956  "while substituting into concept arguments here; substitution failures not "
4957  "allowed in concept arguments">;
4958def note_instantiation_contexts_suppressed : Note<
4959  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
4960  "see all)">;
4961
4962def err_field_instantiates_to_function : Error<
4963  "data member instantiated with function type %0">;
4964def err_variable_instantiates_to_function : Error<
4965  "%select{variable|static data member}0 instantiated with function type %1">;
4966def err_nested_name_spec_non_tag : Error<
4967  "type %0 cannot be used prior to '::' because it has no members">;
4968
4969def err_using_pack_expansion_empty : Error<
4970  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
4971
4972// C++ Explicit Instantiation
4973def err_explicit_instantiation_duplicate : Error<
4974    "duplicate explicit instantiation of %0">;
4975def ext_explicit_instantiation_duplicate : ExtWarn<
4976    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
4977    InGroup<MicrosoftTemplate>;
4978def note_previous_explicit_instantiation : Note<
4979    "previous explicit instantiation is here">;
4980def warn_explicit_instantiation_after_specialization : Warning<
4981  "explicit instantiation of %0 that occurs after an explicit "
4982  "specialization has no effect">,
4983  InGroup<DiagGroup<"instantiation-after-specialization">>;
4984def note_previous_template_specialization : Note<
4985    "previous template specialization is here">;
4986def err_explicit_instantiation_nontemplate_type : Error<
4987    "explicit instantiation of non-templated type %0">;
4988def note_nontemplate_decl_here : Note<
4989    "non-templated declaration is here">;
4990def err_explicit_instantiation_in_class : Error<
4991  "explicit instantiation of %0 in class scope">;
4992def err_explicit_instantiation_out_of_scope : Error<
4993  "explicit instantiation of %0 not in a namespace enclosing %1">;
4994def err_explicit_instantiation_must_be_global : Error<
4995  "explicit instantiation of %0 must occur at global scope">;
4996def warn_explicit_instantiation_out_of_scope_0x : Warning<
4997  "explicit instantiation of %0 not in a namespace enclosing %1">,
4998  InGroup<CXX11Compat>, DefaultIgnore;
4999def warn_explicit_instantiation_must_be_global_0x : Warning<
5000  "explicit instantiation of %0 must occur at global scope">,
5001  InGroup<CXX11Compat>, DefaultIgnore;
5002
5003def err_explicit_instantiation_requires_name : Error<
5004  "explicit instantiation declaration requires a name">;
5005def err_explicit_instantiation_of_typedef : Error<
5006  "explicit instantiation of typedef %0">;
5007def err_explicit_instantiation_storage_class : Error<
5008  "explicit instantiation cannot have a storage class">;
5009def err_explicit_instantiation_internal_linkage : Error<
5010  "explicit instantiation declaration of %0 with internal linkage">;
5011def err_explicit_instantiation_not_known : Error<
5012  "explicit instantiation of %0 does not refer to a function template, "
5013  "variable template, member function, member class, or static data member">;
5014def note_explicit_instantiation_here : Note<
5015  "explicit instantiation refers here">;
5016def err_explicit_instantiation_data_member_not_instantiated : Error<
5017  "explicit instantiation refers to static data member %q0 that is not an "
5018  "instantiation">;
5019def err_explicit_instantiation_member_function_not_instantiated : Error<
5020  "explicit instantiation refers to member function %q0 that is not an "
5021  "instantiation">;
5022def err_explicit_instantiation_ambiguous : Error<
5023  "partial ordering for explicit instantiation of %0 is ambiguous">;
5024def note_explicit_instantiation_candidate : Note<
5025  "explicit instantiation candidate function %q0 template here %1">;
5026def err_explicit_instantiation_inline : Error<
5027  "explicit instantiation cannot be 'inline'">;
5028def warn_explicit_instantiation_inline_0x : Warning<
5029  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5030  DefaultIgnore;
5031def err_explicit_instantiation_constexpr : Error<
5032  "explicit instantiation cannot be 'constexpr'">;
5033def ext_explicit_instantiation_without_qualified_id : Extension<
5034  "qualifier in explicit instantiation of %q0 requires a template-id "
5035  "(a typedef is not permitted)">;
5036def err_explicit_instantiation_without_template_id : Error<
5037  "explicit instantiation of %q0 must specify a template argument list">;
5038def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5039  "explicit instantiation of %q0 must occur in namespace %1">;
5040def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5041  "explicit instantiation of %q0 must occur in namespace %1">,
5042  InGroup<CXX11Compat>, DefaultIgnore;
5043def err_explicit_instantiation_undefined_member : Error<
5044  "explicit instantiation of undefined %select{member class|member function|"
5045  "static data member}0 %1 of class template %2">;
5046def err_explicit_instantiation_undefined_func_template : Error<
5047  "explicit instantiation of undefined function template %0">;
5048def err_explicit_instantiation_undefined_var_template : Error<
5049  "explicit instantiation of undefined variable template %q0">;
5050def err_explicit_instantiation_declaration_after_definition : Error<
5051  "explicit instantiation declaration (with 'extern') follows explicit "
5052  "instantiation definition (without 'extern')">;
5053def note_explicit_instantiation_definition_here : Note<
5054  "explicit instantiation definition is here">;
5055def err_invalid_var_template_spec_type : Error<"type %2 "
5056  "of %select{explicit instantiation|explicit specialization|"
5057  "partial specialization|redeclaration}0 of %1 does not match"
5058  " expected type %3">;
5059def err_mismatched_exception_spec_explicit_instantiation : Error<
5060  "exception specification in explicit instantiation does not match "
5061  "instantiated one">;
5062def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5063  err_mismatched_exception_spec_explicit_instantiation.Text>,
5064  InGroup<MicrosoftExceptionSpec>;
5065def err_explicit_instantiation_dependent : Error<
5066  "explicit instantiation has dependent template arguments">;
5067
5068// C++ typename-specifiers
5069def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5070def err_typename_nested_not_found_enable_if : Error<
5071  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5072  "this declaration">;
5073def err_typename_nested_not_found_requirement : Error<
5074  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5075  "declaration">;
5076def err_typename_nested_not_type : Error<
5077    "typename specifier refers to non-type member %0 in %1">;
5078def err_typename_not_type : Error<
5079    "typename specifier refers to non-type %0">;
5080def note_typename_member_refers_here : Note<
5081    "referenced member %0 is declared here">;
5082def note_typename_refers_here : Note<
5083    "referenced %0 is declared here">;
5084def err_typename_missing : Error<
5085  "missing 'typename' prior to dependent type name '%0%1'">;
5086def err_typename_missing_template : Error<
5087  "missing 'typename' prior to dependent type template name '%0%1'">;
5088def ext_typename_missing : ExtWarn<
5089  "missing 'typename' prior to dependent type name '%0%1'">,
5090  InGroup<DiagGroup<"typename-missing">>;
5091def ext_typename_outside_of_template : ExtWarn<
5092  "'typename' occurs outside of a template">, InGroup<CXX11>;
5093def warn_cxx98_compat_typename_outside_of_template : Warning<
5094  "use of 'typename' outside of a template is incompatible with C++98">,
5095  InGroup<CXX98Compat>, DefaultIgnore;
5096def err_typename_refers_to_using_value_decl : Error<
5097  "typename specifier refers to a dependent using declaration for a value "
5098  "%0 in %1">;
5099def note_using_value_decl_missing_typename : Note<
5100  "add 'typename' to treat this using declaration as a type">;
5101
5102def err_template_kw_refers_to_non_template : Error<
5103  "%0%select{| following the 'template' keyword}1 "
5104  "does not refer to a template">;
5105def note_template_kw_refers_to_non_template : Note<
5106  "declared as a non-template here">;
5107def err_template_kw_refers_to_dependent_non_template : Error<
5108  "%0%select{| following the 'template' keyword}1 "
5109  "cannot refer to a dependent template">;
5110def err_template_kw_refers_to_class_template : Error<
5111  "'%0%1' instantiated to a class template, not a function template">;
5112def note_referenced_class_template : Note<
5113  "class template declared here">;
5114def err_template_kw_missing : Error<
5115  "missing 'template' keyword prior to dependent template name '%0%1'">;
5116def ext_template_outside_of_template : ExtWarn<
5117  "'template' keyword outside of a template">, InGroup<CXX11>;
5118def warn_cxx98_compat_template_outside_of_template : Warning<
5119  "use of 'template' keyword outside of a template is incompatible with C++98">,
5120  InGroup<CXX98Compat>, DefaultIgnore;
5121
5122def err_non_type_template_in_nested_name_specifier : Error<
5123  "qualified name refers into a specialization of %select{function|variable}0 "
5124  "template %1">;
5125def err_template_id_not_a_type : Error<
5126  "template name refers to non-type template %0">;
5127def note_template_declared_here : Note<
5128  "%select{function template|class template|variable template"
5129  "|type alias template|template template parameter}0 "
5130  "%1 declared here">;
5131def err_template_expansion_into_fixed_list : Error<
5132  "pack expansion used as argument for non-pack parameter of %select{alias "
5133  "template|concept}0">;
5134def note_parameter_type : Note<
5135  "parameter of type %0 is declared here">;
5136
5137// C++11 Variadic Templates
5138def err_template_param_pack_default_arg : Error<
5139  "template parameter pack cannot have a default argument">;
5140def err_template_param_pack_must_be_last_template_parameter : Error<
5141  "template parameter pack must be the last template parameter">;
5142
5143def err_template_parameter_pack_non_pack : Error<
5144  "%select{template type|non-type template|template template}0 parameter"
5145  "%select{| pack}1 conflicts with previous %select{template type|"
5146  "non-type template|template template}0 parameter%select{ pack|}1">;
5147def note_template_parameter_pack_non_pack : Note<
5148  "%select{template type|non-type template|template template}0 parameter"
5149  "%select{| pack}1 does not match %select{template type|non-type template"
5150  "|template template}0 parameter%select{ pack|}1 in template argument">;
5151def note_template_parameter_pack_here : Note<
5152  "previous %select{template type|non-type template|template template}0 "
5153  "parameter%select{| pack}1 declared here">;
5154
5155def err_unexpanded_parameter_pack : Error<
5156  "%select{expression|base type|declaration type|data member type|bit-field "
5157  "size|static assertion|fixed underlying type|enumerator value|"
5158  "using declaration|friend declaration|qualifier|initializer|default argument|"
5159  "non-type template parameter type|exception type|partial specialization|"
5160  "__if_exists name|__if_not_exists name|lambda|block|type constraint|"
5161  "requirement}0 contains%plural{0: an|:}1 unexpanded parameter pack"
5162  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5163
5164def err_pack_expansion_without_parameter_packs : Error<
5165  "pack expansion does not contain any unexpanded parameter packs">;
5166def err_pack_expansion_length_conflict : Error<
5167  "pack expansion contains parameter packs %0 and %1 that have different "
5168  "lengths (%2 vs. %3)">;
5169def err_pack_expansion_length_conflict_multilevel : Error<
5170  "pack expansion contains parameter pack %0 that has a different "
5171  "length (%1 vs. %2) from outer parameter packs">;
5172def err_pack_expansion_length_conflict_partial : Error<
5173  "pack expansion contains parameter pack %0 that has a different "
5174  "length (at least %1 vs. %2) from outer parameter packs">;
5175def err_pack_expansion_member_init : Error<
5176  "pack expansion for initialization of member %0">;
5177
5178def err_function_parameter_pack_without_parameter_packs : Error<
5179  "type %0 of function parameter pack does not contain any unexpanded "
5180  "parameter packs">;
5181def err_ellipsis_in_declarator_not_parameter : Error<
5182  "only function and template parameters can be parameter packs">;
5183
5184def err_sizeof_pack_no_pack_name : Error<
5185  "%0 does not refer to the name of a parameter pack">;
5186
5187def err_fold_expression_packs_both_sides : Error<
5188  "binary fold expression has unexpanded parameter packs in both operands">;
5189def err_fold_expression_empty : Error<
5190  "unary fold expression has empty expansion for operator '%0' "
5191  "with no fallback value">;
5192def err_fold_expression_bad_operand : Error<
5193  "expression not permitted as operand of fold expression">;
5194def err_fold_expression_limit_exceeded: Error<
5195  "instantiating fold expression with %0 arguments exceeded expression nesting "
5196  "limit of %1">, DefaultFatal, NoSFINAE;
5197
5198def err_unexpected_typedef : Error<
5199  "unexpected type name %0: expected expression">;
5200def err_unexpected_namespace : Error<
5201  "unexpected namespace name %0: expected expression">;
5202def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5203def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5204  "use of undeclared identifier %0; "
5205  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5206  InGroup<MicrosoftTemplate>;
5207def ext_found_via_dependent_bases_lookup : ExtWarn<"use of identifier %0 "
5208  "found via unqualified lookup into dependent bases of class templates is a "
5209  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5210def note_dependent_var_use : Note<"must qualify identifier to find this "
5211    "declaration in dependent base class">;
5212def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5213    "visible in the template definition nor found by argument-dependent lookup">;
5214def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5215    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5216def err_undeclared_use : Error<"use of undeclared %0">;
5217def warn_deprecated : Warning<"%0 is deprecated">,
5218    InGroup<DeprecatedDeclarations>;
5219def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5220def warn_property_method_deprecated :
5221    Warning<"property access is using %0 method which is deprecated">,
5222    InGroup<DeprecatedDeclarations>;
5223def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5224    InGroup<DeprecatedDeclarations>;
5225def warn_deprecated_anonymous_namespace : Warning<
5226  "'deprecated' attribute on anonymous namespace ignored">,
5227  InGroup<IgnoredAttributes>;
5228def warn_deprecated_fwdclass_message : Warning<
5229    "%0 may be deprecated because the receiver type is unknown">,
5230    InGroup<DeprecatedDeclarations>;
5231def warn_deprecated_def : Warning<
5232  "implementing deprecated %select{method|class|category}0">,
5233  InGroup<DeprecatedImplementations>, DefaultIgnore;
5234def warn_unavailable_def : Warning<
5235  "implementing unavailable method">,
5236  InGroup<DeprecatedImplementations>, DefaultIgnore;
5237def err_unavailable : Error<"%0 is unavailable">;
5238def err_property_method_unavailable :
5239    Error<"property access is using %0 method which is unavailable">;
5240def err_unavailable_message : Error<"%0 is unavailable: %1">;
5241def warn_unavailable_fwdclass_message : Warning<
5242    "%0 may be unavailable because the receiver type is unknown">,
5243    InGroup<UnavailableDeclarations>;
5244def note_availability_specified_here : Note<
5245  "%0 has been explicitly marked "
5246  "%select{unavailable|deleted|deprecated}1 here">;
5247def note_partial_availability_specified_here : Note<
5248  "%0 has been marked as being introduced in %1 %2 here, "
5249  "but the deployment target is %1 %3">;
5250def note_implicitly_deleted : Note<
5251  "explicitly defaulted function was implicitly deleted here">;
5252def warn_not_enough_argument : Warning<
5253  "not enough variable arguments in %0 declaration to fit a sentinel">,
5254  InGroup<Sentinel>;
5255def warn_missing_sentinel : Warning <
5256  "missing sentinel in %select{function call|method dispatch|block call}0">,
5257  InGroup<Sentinel>;
5258def note_sentinel_here : Note<
5259  "%select{function|method|block}0 has been explicitly marked sentinel here">;
5260def warn_missing_prototype : Warning<
5261  "no previous prototype for function %0">,
5262  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5263def note_declaration_not_a_prototype : Note<
5264  "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5265  "to make it %select{a prototype for a zero-parameter function|one}0">;
5266def warn_strict_prototypes : Warning<
5267  "this %select{function declaration is not|block declaration is not|"
5268  "old-style function definition is not preceded by}0 a prototype">,
5269  InGroup<DiagGroup<"strict-prototypes">>, DefaultIgnore;
5270def warn_missing_variable_declarations : Warning<
5271  "no previous extern declaration for non-static variable %0">,
5272  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5273def note_static_for_internal_linkage : Note<
5274  "declare 'static' if the %select{variable|function}0 is not intended to be "
5275  "used outside of this translation unit">;
5276def err_static_data_member_reinitialization :
5277  Error<"static data member %0 already has an initializer">;
5278def err_redefinition : Error<"redefinition of %0">;
5279def err_alias_after_tentative :
5280  Error<"alias definition of %0 after tentative definition">;
5281def err_alias_is_definition :
5282  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5283def err_definition_of_implicitly_declared_member : Error<
5284  "definition of implicitly declared %select{default constructor|copy "
5285  "constructor|move constructor|copy assignment operator|move assignment "
5286  "operator|destructor|function}1">;
5287def err_definition_of_explicitly_defaulted_member : Error<
5288  "definition of explicitly defaulted %select{default constructor|copy "
5289  "constructor|move constructor|copy assignment operator|move assignment "
5290  "operator|destructor|function}0">;
5291def err_redefinition_extern_inline : Error<
5292  "redefinition of a 'extern inline' function %0 is not supported in "
5293  "%select{C99 mode|C++}1">;
5294def warn_attr_abi_tag_namespace : Warning<
5295  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5296  InGroup<IgnoredAttributes>;
5297def err_abi_tag_on_redeclaration : Error<
5298  "cannot add 'abi_tag' attribute in a redeclaration">;
5299def err_new_abi_tag_on_redeclaration : Error<
5300  "'abi_tag' %0 missing in original declaration">;
5301def note_use_ifdef_guards : Note<
5302  "unguarded header; consider using #ifdef guards or #pragma once">;
5303
5304def note_deleted_dtor_no_operator_delete : Note<
5305  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5306def note_deleted_special_member_class_subobject : Note<
5307  "%select{default constructor of|copy constructor of|move constructor of|"
5308  "copy assignment operator of|move assignment operator of|destructor of|"
5309  "constructor inherited by}0 "
5310  "%1 is implicitly deleted because "
5311  "%select{base class %3|%select{||||variant }4field %3}2 "
5312  "%select{has "
5313  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5314  "%select{%select{default constructor|copy constructor|move constructor|copy "
5315  "assignment operator|move assignment operator|destructor|"
5316  "%select{default|corresponding|default|default|default}4 constructor}0|"
5317  "destructor}5"
5318  "%select{||s||}4"
5319  "|is an ObjC pointer}6">;
5320def note_deleted_default_ctor_uninit_field : Note<
5321  "%select{default constructor of|constructor inherited by}0 "
5322  "%1 is implicitly deleted because field %2 of "
5323  "%select{reference|const-qualified}4 type %3 would not be initialized">;
5324def note_deleted_default_ctor_all_const : Note<
5325  "%select{default constructor of|constructor inherited by}0 "
5326  "%1 is implicitly deleted because all "
5327  "%select{data members|data members of an anonymous union member}2"
5328  " are const-qualified">;
5329def note_deleted_copy_ctor_rvalue_reference : Note<
5330  "copy constructor of %0 is implicitly deleted because field %1 is of "
5331  "rvalue reference type %2">;
5332def note_deleted_copy_user_declared_move : Note<
5333  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5334  " %1 has a user-declared move %select{constructor|assignment operator}2">;
5335def note_deleted_assign_field : Note<
5336  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5337  "because field %2 is of %select{reference|const-qualified}4 type %3">;
5338
5339// These should be errors.
5340def warn_undefined_internal : Warning<
5341  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5342  InGroup<DiagGroup<"undefined-internal">>;
5343def err_undefined_internal_type : Error<
5344  "%select{function|variable}0 %q1 is used but not defined in this "
5345  "translation unit, and cannot be defined in any other translation unit "
5346  "because its type does not have linkage">;
5347def ext_undefined_internal_type : Extension<
5348  "ISO C++ requires a definition in this translation unit for "
5349  "%select{function|variable}0 %q1 because its type does not have linkage">,
5350  InGroup<DiagGroup<"undefined-internal-type">>;
5351def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5352  InGroup<DiagGroup<"undefined-inline">>;
5353def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5354def note_used_here : Note<"used here">;
5355
5356def err_internal_linkage_redeclaration : Error<
5357  "'internal_linkage' attribute does not appear on the first declaration of %0">;
5358def warn_internal_linkage_local_storage : Warning<
5359  "'internal_linkage' attribute on a non-static local variable is ignored">,
5360  InGroup<IgnoredAttributes>;
5361
5362def ext_internal_in_extern_inline : ExtWarn<
5363  "static %select{function|variable}0 %1 is used in an inline function with "
5364  "external linkage">, InGroup<StaticInInline>;
5365def ext_internal_in_extern_inline_quiet : Extension<
5366  "static %select{function|variable}0 %1 is used in an inline function with "
5367  "external linkage">, InGroup<StaticInInline>;
5368def warn_static_local_in_extern_inline : Warning<
5369  "non-constant static local variable in inline function may be different "
5370  "in different files">, InGroup<StaticLocalInInline>;
5371def note_convert_inline_to_static : Note<
5372  "use 'static' to give inline function %0 internal linkage">;
5373
5374def ext_redefinition_of_typedef : ExtWarn<
5375  "redefinition of typedef %0 is a C11 feature">,
5376  InGroup<DiagGroup<"typedef-redefinition"> >;
5377def err_redefinition_variably_modified_typedef : Error<
5378  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5379
5380def err_inline_decl_follows_def : Error<
5381  "inline declaration of %0 follows non-inline definition">;
5382def err_inline_declaration_block_scope : Error<
5383  "inline declaration of %0 not allowed in block scope">;
5384def err_static_non_static : Error<
5385  "static declaration of %0 follows non-static declaration">;
5386def err_different_language_linkage : Error<
5387  "declaration of %0 has a different language linkage">;
5388def ext_retained_language_linkage : Extension<
5389  "friend function %0 retaining previous language linkage is an extension">,
5390  InGroup<DiagGroup<"retained-language-linkage">>;
5391def err_extern_c_global_conflict : Error<
5392  "declaration of %1 %select{with C language linkage|in global scope}0 "
5393  "conflicts with declaration %select{in global scope|with C language linkage}0">;
5394def note_extern_c_global_conflict : Note<
5395  "declared %select{in global scope|with C language linkage}0 here">;
5396def note_extern_c_begins_here : Note<
5397  "extern \"C\" language linkage specification begins here">;
5398def warn_weak_import : Warning <
5399  "an already-declared variable is made a weak_import declaration %0">;
5400def ext_static_non_static : Extension<
5401  "redeclaring non-static %0 as static is a Microsoft extension">,
5402  InGroup<MicrosoftRedeclareStatic>;
5403def err_non_static_static : Error<
5404  "non-static declaration of %0 follows static declaration">;
5405def err_extern_non_extern : Error<
5406  "extern declaration of %0 follows non-extern declaration">;
5407def err_non_extern_extern : Error<
5408  "non-extern declaration of %0 follows extern declaration">;
5409def err_non_thread_thread : Error<
5410  "non-thread-local declaration of %0 follows thread-local declaration">;
5411def err_thread_non_thread : Error<
5412  "thread-local declaration of %0 follows non-thread-local declaration">;
5413def err_thread_thread_different_kind : Error<
5414  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5415  "follows declaration with %select{dynamic|static}1 initialization">;
5416def err_mismatched_owning_module : Error<
5417  "declaration of %0 in %select{the global module|module %2}1 follows "
5418  "declaration in %select{the global module|module %4}3">;
5419def err_redefinition_different_type : Error<
5420  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5421def err_redefinition_different_kind : Error<
5422  "redefinition of %0 as different kind of symbol">;
5423def err_redefinition_different_namespace_alias : Error<
5424  "redefinition of %0 as an alias for a different namespace">;
5425def note_previous_namespace_alias : Note<
5426  "previously defined as an alias for %0">;
5427def warn_forward_class_redefinition : Warning<
5428  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5429  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5430def err_redefinition_different_typedef : Error<
5431  "%select{typedef|type alias|type alias template}0 "
5432  "redefinition with different types%diff{ ($ vs $)|}1,2">;
5433def err_tag_reference_non_tag : Error<
5434  "%select{non-struct type|non-class type|non-union type|non-enum "
5435  "type|typedef|type alias|template|type alias template|template "
5436  "template argument}1 %0 cannot be referenced with a "
5437  "%select{struct|interface|union|class|enum}2 specifier">;
5438def err_tag_reference_conflict : Error<
5439  "implicit declaration introduced by elaborated type conflicts with a "
5440  "%select{non-struct type|non-class type|non-union type|non-enum "
5441  "type|typedef|type alias|template|type alias template|template "
5442  "template argument}0 of the same name">;
5443def err_dependent_tag_decl : Error<
5444  "%select{declaration|definition}0 of "
5445  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5446def err_tag_definition_of_typedef : Error<
5447  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
5448def err_conflicting_types : Error<"conflicting types for %0">;
5449def err_different_pass_object_size_params : Error<
5450  "conflicting pass_object_size attributes on parameters">;
5451def err_late_asm_label_name : Error<
5452  "cannot apply asm label to %select{variable|function}0 after its first use">;
5453def err_different_asm_label : Error<"conflicting asm label">;
5454def err_nested_redefinition : Error<"nested redefinition of %0">;
5455def err_use_with_wrong_tag : Error<
5456  "use of %0 with tag type that does not match previous declaration">;
5457def warn_struct_class_tag_mismatch : Warning<
5458  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
5459  "declared as a %select{struct|interface|class}3%select{| template}1; "
5460  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5461  InGroup<MismatchedTags>, DefaultIgnore;
5462def warn_struct_class_previous_tag_mismatch : Warning<
5463  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
5464  "here but previously declared as "
5465  "%select{a struct|an interface|a class}3%select{| template}1; "
5466  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5467  InGroup<MismatchedTags>, DefaultIgnore;
5468def note_struct_class_suggestion : Note<
5469  "did you mean %select{struct|interface|class}0 here?">;
5470def ext_forward_ref_enum : Extension<
5471  "ISO C forbids forward references to 'enum' types">;
5472def err_forward_ref_enum : Error<
5473  "ISO C++ forbids forward references to 'enum' types">;
5474def ext_ms_forward_ref_enum : ExtWarn<
5475  "forward references to 'enum' types are a Microsoft extension">,
5476  InGroup<MicrosoftEnumForwardReference>;
5477def ext_forward_ref_enum_def : Extension<
5478  "redeclaration of already-defined enum %0 is a GNU extension">,
5479  InGroup<GNURedeclaredEnum>;
5480
5481def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
5482def err_duplicate_member : Error<"duplicate member %0">;
5483def err_misplaced_ivar : Error<
5484  "instance variables may not be placed in %select{categories|class extension}0">;
5485def warn_ivars_in_interface : Warning<
5486  "declaration of instance variables in the interface is deprecated">,
5487  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
5488def ext_enum_value_not_int : Extension<
5489  "ISO C restricts enumerator values to range of 'int' (%0 is too "
5490  "%select{small|large}1)">;
5491def ext_enum_too_large : ExtWarn<
5492  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
5493def ext_enumerator_increment_too_large : ExtWarn<
5494  "incremented enumerator value %0 is not representable in the "
5495  "largest integer type">, InGroup<EnumTooLarge>;
5496def warn_flag_enum_constant_out_of_range : Warning<
5497  "enumeration value %0 is out of range of flags in enumeration type %1">,
5498  InGroup<FlagEnum>;
5499
5500def err_vm_decl_in_file_scope : Error<
5501  "variably modified type declaration not allowed at file scope">;
5502def err_vm_decl_has_extern_linkage : Error<
5503  "variably modified type declaration cannot have 'extern' linkage">;
5504def err_typecheck_field_variable_size : Error<
5505  "fields must have a constant size: 'variable length array in structure' "
5506  "extension will never be supported">;
5507def err_vm_func_decl : Error<
5508  "function declaration cannot have variably modified type">;
5509def err_array_too_large : Error<
5510  "array is too large (%0 elements)">;
5511
5512def err_typecheck_negative_array_size : Error<"array size is negative">;
5513def warn_typecheck_function_qualifiers_ignored : Warning<
5514  "'%0' qualifier on function type %1 has no effect">,
5515  InGroup<IgnoredQualifiers>;
5516def warn_typecheck_function_qualifiers_unspecified : Warning<
5517  "'%0' qualifier on function type %1 has unspecified behavior">;
5518def warn_typecheck_reference_qualifiers : Warning<
5519  "'%0' qualifier on reference type %1 has no effect">,
5520  InGroup<IgnoredQualifiers>;
5521def err_typecheck_invalid_restrict_not_pointer : Error<
5522  "restrict requires a pointer or reference (%0 is invalid)">;
5523def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
5524  "restrict requires a pointer or reference">;
5525def err_typecheck_invalid_restrict_invalid_pointee : Error<
5526  "pointer to function type %0 may not be 'restrict' qualified">;
5527def ext_typecheck_zero_array_size : Extension<
5528  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
5529def err_typecheck_zero_array_size : Error<
5530  "zero-length arrays are not permitted in C++">;
5531def err_array_size_non_int : Error<"size of array has non-integer type %0">;
5532def err_init_element_not_constant : Error<
5533  "initializer element is not a compile-time constant">;
5534def ext_aggregate_init_not_constant : Extension<
5535  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
5536def err_local_cant_init : Error<
5537  "'__local' variable cannot have an initializer">;
5538def err_loader_uninitialized_cant_init
5539    : Error<"variable with 'loader_uninitialized' attribute cannot have an "
5540            "initializer">;
5541def err_loader_uninitialized_trivial_ctor
5542    : Error<"variable with 'loader_uninitialized' attribute must have a "
5543            "trivial default constructor">;
5544def err_loader_uninitialized_redeclaration
5545    : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
5546def err_loader_uninitialized_extern_decl
5547    : Error<"variable %0 cannot be declared both 'extern' and with the "
5548            "'loader_uninitialized' attribute">;
5549def err_block_extern_cant_init : Error<
5550  "'extern' variable cannot have an initializer">;
5551def warn_extern_init : Warning<"'extern' variable has an initializer">,
5552  InGroup<DiagGroup<"extern-initializer">>;
5553def err_variable_object_no_init : Error<
5554  "variable-sized object may not be initialized">;
5555def err_excess_initializers : Error<
5556  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
5557def ext_excess_initializers : ExtWarn<
5558  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
5559  InGroup<ExcessInitializers>;
5560def err_excess_initializers_for_sizeless_type : Error<
5561  "excess elements in initializer for indivisible sizeless type %0">;
5562def ext_excess_initializers_for_sizeless_type : ExtWarn<
5563  "excess elements in initializer for indivisible sizeless type %0">,
5564  InGroup<ExcessInitializers>;
5565def err_excess_initializers_in_char_array_initializer : Error<
5566  "excess elements in char array initializer">;
5567def ext_excess_initializers_in_char_array_initializer : ExtWarn<
5568  "excess elements in char array initializer">,
5569  InGroup<ExcessInitializers>;
5570def err_initializer_string_for_char_array_too_long : Error<
5571  "initializer-string for char array is too long">;
5572def ext_initializer_string_for_char_array_too_long : ExtWarn<
5573  "initializer-string for char array is too long">,
5574  InGroup<ExcessInitializers>;
5575def warn_missing_field_initializers : Warning<
5576  "missing field %0 initializer">,
5577  InGroup<MissingFieldInitializers>, DefaultIgnore;
5578def warn_braces_around_init : Warning<
5579  "braces around %select{scalar |}0initializer">,
5580  InGroup<DiagGroup<"braced-scalar-init">>;
5581def ext_many_braces_around_init : ExtWarn<
5582  "too many braces around %select{scalar |}0initializer">,
5583  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
5584def ext_complex_component_init : Extension<
5585  "complex initialization specifying real and imaginary components "
5586  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
5587def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
5588def err_empty_sizeless_initializer : Error<
5589  "initializer for sizeless type %0 cannot be empty">;
5590def warn_cxx98_compat_empty_scalar_initializer : Warning<
5591  "scalar initialized from empty initializer list is incompatible with C++98">,
5592  InGroup<CXX98Compat>, DefaultIgnore;
5593def warn_cxx98_compat_empty_sizeless_initializer : Warning<
5594  "initializing %0 from an empty initializer list is incompatible with C++98">,
5595  InGroup<CXX98Compat>, DefaultIgnore;
5596def warn_cxx98_compat_reference_list_init : Warning<
5597  "reference initialized from initializer list is incompatible with C++98">,
5598  InGroup<CXX98Compat>, DefaultIgnore;
5599def warn_cxx98_compat_initializer_list_init : Warning<
5600  "initialization of initializer_list object is incompatible with C++98">,
5601  InGroup<CXX98Compat>, DefaultIgnore;
5602def warn_cxx98_compat_ctor_list_init : Warning<
5603  "constructor call from initializer list is incompatible with C++98">,
5604  InGroup<CXX98Compat>, DefaultIgnore;
5605def err_illegal_initializer : Error<
5606  "illegal initializer (only variables can be initialized)">;
5607def err_illegal_initializer_type : Error<"illegal initializer type %0">;
5608def ext_init_list_type_narrowing : ExtWarn<
5609  "type %0 cannot be narrowed to %1 in initializer list">,
5610  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5611def ext_init_list_variable_narrowing : ExtWarn<
5612  "non-constant-expression cannot be narrowed from type %0 to %1 in "
5613  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5614def ext_init_list_constant_narrowing : ExtWarn<
5615  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
5616  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5617def warn_init_list_type_narrowing : Warning<
5618  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
5619  InGroup<CXX11Narrowing>, DefaultIgnore;
5620def warn_init_list_variable_narrowing : Warning<
5621  "non-constant-expression cannot be narrowed from type %0 to %1 in "
5622  "initializer list in C++11">,
5623  InGroup<CXX11Narrowing>, DefaultIgnore;
5624def warn_init_list_constant_narrowing : Warning<
5625  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
5626  "C++11">,
5627  InGroup<CXX11Narrowing>, DefaultIgnore;
5628def note_init_list_narrowing_silence : Note<
5629  "insert an explicit cast to silence this issue">;
5630def err_init_objc_class : Error<
5631  "cannot initialize Objective-C class type %0">;
5632def err_implicit_empty_initializer : Error<
5633  "initializer for aggregate with no elements requires explicit braces">;
5634def err_bitfield_has_negative_width : Error<
5635  "bit-field %0 has negative width (%1)">;
5636def err_anon_bitfield_has_negative_width : Error<
5637  "anonymous bit-field has negative width (%0)">;
5638def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
5639def err_bitfield_width_exceeds_type_width : Error<
5640  "width of bit-field %0 (%1 bits) exceeds %select{width|size}2 "
5641  "of its type (%3 bit%s3)">;
5642def err_anon_bitfield_width_exceeds_type_width : Error<
5643  "width of anonymous bit-field (%0 bits) exceeds %select{width|size}1 "
5644  "of its type (%2 bit%s2)">;
5645def err_incorrect_number_of_vector_initializers : Error<
5646  "number of elements must be either one or match the size of the vector">;
5647
5648// Used by C++ which allows bit-fields that are wider than the type.
5649def warn_bitfield_width_exceeds_type_width: Warning<
5650  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
5651  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
5652def warn_anon_bitfield_width_exceeds_type_width : Warning<
5653  "width of anonymous bit-field (%0 bits) exceeds width of its type; value "
5654  "will be truncated to %1 bit%s1">, InGroup<BitFieldWidth>;
5655def warn_bitfield_too_small_for_enum : Warning<
5656  "bit-field %0 is not wide enough to store all enumerators of %1">,
5657  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5658def note_widen_bitfield : Note<
5659  "widen this field to %0 bits to store all values of %1">;
5660def warn_unsigned_bitfield_assigned_signed_enum : Warning<
5661  "assigning value of signed enum type %1 to unsigned bit-field %0; "
5662  "negative enumerators of enum %1 will be converted to positive values">,
5663  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5664def warn_signed_bitfield_enum_conversion : Warning<
5665  "signed bit-field %0 needs an extra bit to represent the largest positive "
5666  "enumerators of %1">,
5667  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5668def note_change_bitfield_sign : Note<
5669  "consider making the bitfield type %select{unsigned|signed}0">;
5670
5671def warn_missing_braces : Warning<
5672  "suggest braces around initialization of subobject">,
5673  InGroup<MissingBraces>, DefaultIgnore;
5674
5675def err_redefinition_of_label : Error<"redefinition of label %0">;
5676def err_undeclared_label_use : Error<"use of undeclared label %0">;
5677def err_goto_ms_asm_label : Error<
5678  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
5679def note_goto_ms_asm_label : Note<
5680  "inline assembly label %0 declared here">;
5681def warn_unused_label : Warning<"unused label %0">,
5682  InGroup<UnusedLabel>, DefaultIgnore;
5683
5684def err_goto_into_protected_scope : Error<
5685  "cannot jump from this goto statement to its label">;
5686def ext_goto_into_protected_scope : ExtWarn<
5687  "jump from this goto statement to its label is a Microsoft extension">,
5688  InGroup<MicrosoftGoto>;
5689def warn_cxx98_compat_goto_into_protected_scope : Warning<
5690  "jump from this goto statement to its label is incompatible with C++98">,
5691  InGroup<CXX98Compat>, DefaultIgnore;
5692def err_switch_into_protected_scope : Error<
5693  "cannot jump from switch statement to this case label">;
5694def warn_cxx98_compat_switch_into_protected_scope : Warning<
5695  "jump from switch statement to this case label is incompatible with C++98">,
5696  InGroup<CXX98Compat>, DefaultIgnore;
5697def err_indirect_goto_without_addrlabel : Error<
5698  "indirect goto in function with no address-of-label expressions">;
5699def err_indirect_goto_in_protected_scope : Error<
5700  "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
5701def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
5702  "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
5703  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5704def note_indirect_goto_target : Note<
5705  "possible target of %select{indirect|asm}0 goto statement">;
5706def note_protected_by_variable_init : Note<
5707  "jump bypasses variable initialization">;
5708def note_protected_by_variable_nontriv_destructor : Note<
5709  "jump bypasses variable with a non-trivial destructor">;
5710def note_protected_by_variable_non_pod : Note<
5711  "jump bypasses initialization of non-POD variable">;
5712def note_protected_by_cleanup : Note<
5713  "jump bypasses initialization of variable with __attribute__((cleanup))">;
5714def note_protected_by_vla_typedef : Note<
5715  "jump bypasses initialization of VLA typedef">;
5716def note_protected_by_vla_type_alias : Note<
5717  "jump bypasses initialization of VLA type alias">;
5718def note_protected_by_constexpr_if : Note<
5719  "jump enters controlled statement of constexpr if">;
5720def note_protected_by_if_available : Note<
5721  "jump enters controlled statement of if available">;
5722def note_protected_by_vla : Note<
5723  "jump bypasses initialization of variable length array">;
5724def note_protected_by_objc_fast_enumeration : Note<
5725  "jump enters Objective-C fast enumeration loop">;
5726def note_protected_by_objc_try : Note<
5727  "jump bypasses initialization of @try block">;
5728def note_protected_by_objc_catch : Note<
5729  "jump bypasses initialization of @catch block">;
5730def note_protected_by_objc_finally : Note<
5731  "jump bypasses initialization of @finally block">;
5732def note_protected_by_objc_synchronized : Note<
5733  "jump bypasses initialization of @synchronized block">;
5734def note_protected_by_objc_autoreleasepool : Note<
5735  "jump bypasses auto release push of @autoreleasepool block">;
5736def note_protected_by_cxx_try : Note<
5737  "jump bypasses initialization of try block">;
5738def note_protected_by_cxx_catch : Note<
5739  "jump bypasses initialization of catch block">;
5740def note_protected_by_seh_try : Note<
5741  "jump bypasses initialization of __try block">;
5742def note_protected_by_seh_except : Note<
5743  "jump bypasses initialization of __except block">;
5744def note_protected_by_seh_finally : Note<
5745  "jump bypasses initialization of __finally block">;
5746def note_protected_by___block : Note<
5747  "jump bypasses setup of __block variable">;
5748def note_protected_by_objc_strong_init : Note<
5749  "jump bypasses initialization of __strong variable">;
5750def note_protected_by_objc_weak_init : Note<
5751  "jump bypasses initialization of __weak variable">;
5752def note_protected_by_non_trivial_c_struct_init : Note<
5753  "jump bypasses initialization of variable of non-trivial C struct type">;
5754def note_enters_block_captures_cxx_obj : Note<
5755  "jump enters lifetime of block which captures a destructible C++ object">;
5756def note_enters_block_captures_strong : Note<
5757  "jump enters lifetime of block which strongly captures a variable">;
5758def note_enters_block_captures_weak : Note<
5759  "jump enters lifetime of block which weakly captures a variable">;
5760def note_enters_block_captures_non_trivial_c_struct : Note<
5761  "jump enters lifetime of block which captures a C struct that is non-trivial "
5762  "to destroy">;
5763def note_enters_compound_literal_scope : Note<
5764  "jump enters lifetime of a compound literal that is non-trivial to destruct">;
5765
5766def note_exits_cleanup : Note<
5767  "jump exits scope of variable with __attribute__((cleanup))">;
5768def note_exits_dtor : Note<
5769  "jump exits scope of variable with non-trivial destructor">;
5770def note_exits_temporary_dtor : Note<
5771  "jump exits scope of lifetime-extended temporary with non-trivial "
5772  "destructor">;
5773def note_exits___block : Note<
5774  "jump exits scope of __block variable">;
5775def note_exits_objc_try : Note<
5776  "jump exits @try block">;
5777def note_exits_objc_catch : Note<
5778  "jump exits @catch block">;
5779def note_exits_objc_finally : Note<
5780  "jump exits @finally block">;
5781def note_exits_objc_synchronized : Note<
5782  "jump exits @synchronized block">;
5783def note_exits_cxx_try : Note<
5784  "jump exits try block">;
5785def note_exits_cxx_catch : Note<
5786  "jump exits catch block">;
5787def note_exits_seh_try : Note<
5788  "jump exits __try block">;
5789def note_exits_seh_except : Note<
5790  "jump exits __except block">;
5791def note_exits_seh_finally : Note<
5792  "jump exits __finally block">;
5793def note_exits_objc_autoreleasepool : Note<
5794  "jump exits autoreleasepool block">;
5795def note_exits_objc_strong : Note<
5796  "jump exits scope of __strong variable">;
5797def note_exits_objc_weak : Note<
5798  "jump exits scope of __weak variable">;
5799def note_exits_block_captures_cxx_obj : Note<
5800  "jump exits lifetime of block which captures a destructible C++ object">;
5801def note_exits_block_captures_strong : Note<
5802  "jump exits lifetime of block which strongly captures a variable">;
5803def note_exits_block_captures_weak : Note<
5804  "jump exits lifetime of block which weakly captures a variable">;
5805def note_exits_block_captures_non_trivial_c_struct : Note<
5806  "jump exits lifetime of block which captures a C struct that is non-trivial "
5807  "to destroy">;
5808def note_exits_compound_literal_scope : Note<
5809  "jump exits lifetime of a compound literal that is non-trivial to destruct">;
5810
5811def err_func_returning_qualified_void : ExtWarn<
5812  "function cannot return qualified void type %0">,
5813  InGroup<DiagGroup<"qualified-void-return-type">>;
5814def err_func_returning_array_function : Error<
5815  "function cannot return %select{array|function}0 type %1">;
5816def err_field_declared_as_function : Error<"field %0 declared as a function">;
5817def err_field_incomplete_or_sizeless : Error<
5818  "field has %select{incomplete|sizeless}0 type %1">;
5819def ext_variable_sized_type_in_struct : ExtWarn<
5820  "field %0 with variable sized type %1 not at the end of a struct or class is"
5821  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
5822
5823def ext_c99_flexible_array_member : Extension<
5824  "flexible array members are a C99 feature">, InGroup<C99>;
5825def err_flexible_array_virtual_base : Error<
5826  "flexible array member %0 not allowed in "
5827  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
5828def err_flexible_array_empty_aggregate : Error<
5829  "flexible array member %0 not allowed in otherwise empty "
5830  "%select{struct|interface|union|class|enum}1">;
5831def err_flexible_array_has_nontrivial_dtor : Error<
5832  "flexible array member %0 of type %1 with non-trivial destruction">;
5833def ext_flexible_array_in_struct : Extension<
5834  "%0 may not be nested in a struct due to flexible array member">,
5835  InGroup<FlexibleArrayExtensions>;
5836def ext_flexible_array_in_array : Extension<
5837  "%0 may not be used as an array element due to flexible array member">,
5838  InGroup<FlexibleArrayExtensions>;
5839def err_flexible_array_init : Error<
5840  "initialization of flexible array member is not allowed">;
5841def ext_flexible_array_empty_aggregate_ms : Extension<
5842  "flexible array member %0 in otherwise empty "
5843  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
5844  InGroup<MicrosoftFlexibleArray>;
5845def err_flexible_array_union : Error<
5846  "flexible array member %0 in a union is not allowed">;
5847def ext_flexible_array_union_ms : Extension<
5848  "flexible array member %0 in a union is a Microsoft extension">,
5849  InGroup<MicrosoftFlexibleArray>;
5850def ext_flexible_array_empty_aggregate_gnu : Extension<
5851  "flexible array member %0 in otherwise empty "
5852  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
5853  InGroup<GNUEmptyStruct>;
5854def ext_flexible_array_union_gnu : Extension<
5855  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
5856
5857def err_flexible_array_not_at_end : Error<
5858  "flexible array member %0 with type %1 is not at the end of"
5859  " %select{struct|interface|union|class|enum}2">;
5860def err_objc_variable_sized_type_not_at_end : Error<
5861  "field %0 with variable sized type %1 is not at the end of class">;
5862def note_next_field_declaration : Note<
5863  "next field declaration is here">;
5864def note_next_ivar_declaration : Note<
5865  "next %select{instance variable declaration|synthesized instance variable}0"
5866  " is here">;
5867def err_synthesize_variable_sized_ivar : Error<
5868  "synthesized property with variable size type %0"
5869  " requires an existing instance variable">;
5870def err_flexible_array_arc_retainable : Error<
5871  "ARC forbids flexible array members with retainable object type">;
5872def warn_variable_sized_ivar_visibility : Warning<
5873  "field %0 with variable sized type %1 is not visible to subclasses and"
5874  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
5875def warn_superclass_variable_sized_type_not_at_end : Warning<
5876  "field %0 can overwrite instance variable %1 with variable sized type %2"
5877  " in superclass %3">, InGroup<ObjCFlexibleArray>;
5878
5879let CategoryName = "ARC Semantic Issue" in {
5880
5881// ARC-mode diagnostics.
5882
5883let CategoryName = "ARC Weak References" in {
5884
5885def err_arc_weak_no_runtime : Error<
5886  "cannot create __weak reference because the current deployment target "
5887  "does not support weak references">;
5888def err_arc_weak_disabled : Error<
5889  "cannot create __weak reference in file using manual reference counting">;
5890def err_synthesizing_arc_weak_property_disabled : Error<
5891  "cannot synthesize weak property in file using manual reference counting">;
5892def err_synthesizing_arc_weak_property_no_runtime : Error<
5893  "cannot synthesize weak property because the current deployment target "
5894  "does not support weak references">;
5895def err_arc_unsupported_weak_class : Error<
5896  "class is incompatible with __weak references">;
5897def err_arc_weak_unavailable_assign : Error<
5898  "assignment of a weak-unavailable object to a __weak object">;
5899def err_arc_weak_unavailable_property : Error<
5900  "synthesizing __weak instance variable of type %0, which does not "
5901  "support weak references">;
5902def note_implemented_by_class : Note<
5903  "when implemented by class %0">;
5904def err_arc_convesion_of_weak_unavailable : Error<
5905  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
5906  " a __weak object of type %2">;
5907
5908} // end "ARC Weak References" category
5909
5910let CategoryName = "ARC Restrictions" in {
5911
5912def err_unavailable_in_arc : Error<
5913  "%0 is unavailable in ARC">;
5914def note_arc_forbidden_type : Note<
5915  "declaration uses type that is ill-formed in ARC">;
5916def note_performs_forbidden_arc_conversion : Note<
5917  "inline function performs a conversion which is forbidden in ARC">;
5918def note_arc_init_returns_unrelated : Note<
5919  "init method must return a type related to its receiver type">;
5920def note_arc_weak_disabled : Note<
5921  "declaration uses __weak, but ARC is disabled">;
5922def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
5923  "the current deployment target does not support">;
5924def note_arc_field_with_ownership : Note<
5925  "field has non-trivial ownership qualification">;
5926
5927def err_arc_illegal_explicit_message : Error<
5928  "ARC forbids explicit message send of %0">;
5929def err_arc_unused_init_message : Error<
5930  "the result of a delegate init call must be immediately returned "
5931  "or assigned to 'self'">;
5932def err_arc_mismatched_cast : Error<
5933  "%select{implicit conversion|cast}0 of "
5934  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
5935  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
5936  " to %3 is disallowed with ARC">;
5937def err_arc_nolifetime_behavior : Error<
5938  "explicit ownership qualifier on cast result has no effect">;
5939def err_arc_objc_property_default_assign_on_object : Error<
5940  "ARC forbids synthesizing a property of an Objective-C object "
5941  "with unspecified ownership or storage attribute">;
5942def err_arc_illegal_selector : Error<
5943  "ARC forbids use of %0 in a @selector">;
5944def err_arc_illegal_method_def : Error<
5945  "ARC forbids %select{implementation|synthesis}0 of %1">;
5946def warn_arc_strong_pointer_objc_pointer : Warning<
5947  "method parameter of type %0 with no explicit ownership">,
5948  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
5949
5950} // end "ARC Restrictions" category
5951
5952def err_arc_lost_method_convention : Error<
5953  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
5954  "method, but its implementation doesn't match because %select{"
5955  "its result type is not an object pointer|"
5956  "its result type is unrelated to its receiver type}1">;
5957def note_arc_lost_method_convention : Note<"declaration in interface">;
5958def err_arc_gained_method_convention : Error<
5959  "method implementation does not match its declaration">;
5960def note_arc_gained_method_convention : Note<
5961  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
5962  "family because %select{its result type is not an object pointer|"
5963  "its result type is unrelated to its receiver type}1">;
5964def err_typecheck_arc_assign_self : Error<
5965  "cannot assign to 'self' outside of a method in the init family">;
5966def err_typecheck_arc_assign_self_class_method : Error<
5967  "cannot assign to 'self' in a class method">;
5968def err_typecheck_arr_assign_enumeration : Error<
5969  "fast enumeration variables cannot be modified in ARC by default; "
5970  "declare the variable __strong to allow this">;
5971def err_typecheck_arc_assign_externally_retained : Error<
5972  "variable declared with 'objc_externally_retained' "
5973  "cannot be modified in ARC">;
5974def warn_arc_retained_assign : Warning<
5975  "assigning retained object to %select{weak|unsafe_unretained}0 "
5976  "%select{property|variable}1"
5977  "; object will be released after assignment">,
5978  InGroup<ARCUnsafeRetainedAssign>;
5979def warn_arc_retained_property_assign : Warning<
5980  "assigning retained object to unsafe property"
5981  "; object will be released after assignment">,
5982  InGroup<ARCUnsafeRetainedAssign>;
5983def warn_arc_literal_assign : Warning<
5984  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
5985  " to a weak %select{property|variable}1"
5986  "; object will be released after assignment">,
5987  InGroup<ARCUnsafeRetainedAssign>;
5988def err_arc_new_array_without_ownership : Error<
5989  "'new' cannot allocate an array of %0 with no explicit ownership">;
5990def err_arc_autoreleasing_var : Error<
5991  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
5992  "__autoreleasing ownership">;
5993def err_arc_autoreleasing_capture : Error<
5994  "cannot capture __autoreleasing variable in a "
5995  "%select{block|lambda by copy}0">;
5996def err_arc_thread_ownership : Error<
5997  "thread-local variable has non-trivial ownership: type is %0">;
5998def err_arc_indirect_no_ownership : Error<
5999  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6000def err_arc_array_param_no_ownership : Error<
6001  "must explicitly describe intended ownership of an object array parameter">;
6002def err_arc_pseudo_dtor_inconstant_quals : Error<
6003  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6004  "type %1">;
6005def err_arc_init_method_unrelated_result_type : Error<
6006  "init methods must return a type related to the receiver type">;
6007def err_arc_nonlocal_writeback : Error<
6008  "passing address of %select{non-local|non-scalar}0 object to "
6009  "__autoreleasing parameter for write-back">;
6010def err_arc_method_not_found : Error<
6011  "no known %select{instance|class}1 method for selector %0">;
6012def err_arc_receiver_forward_class : Error<
6013  "receiver %0 for class message is a forward declaration">;
6014def err_arc_may_not_respond : Error<
6015  "no visible @interface for %0 declares the selector %1">;
6016def err_arc_receiver_forward_instance : Error<
6017  "receiver type %0 for instance message is a forward declaration">;
6018def warn_receiver_forward_instance : Warning<
6019  "receiver type %0 for instance message is a forward declaration">,
6020  InGroup<ForwardClassReceiver>, DefaultIgnore;
6021def err_arc_collection_forward : Error<
6022  "collection expression type %0 is a forward declaration">;
6023def err_arc_multiple_method_decl : Error<
6024  "multiple methods named %0 found with mismatched result, "
6025  "parameter type or attributes">;
6026def warn_arc_lifetime_result_type : Warning<
6027  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6028  "lifetime qualifier on return type is ignored">,
6029  InGroup<IgnoredQualifiers>;
6030
6031let CategoryName = "ARC Retain Cycle" in {
6032
6033def warn_arc_retain_cycle : Warning<
6034  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6035  InGroup<ARCRetainCycles>;
6036def note_arc_retain_cycle_owner : Note<
6037  "block will be retained by %select{the captured object|an object strongly "
6038  "retained by the captured object}0">;
6039
6040} // end "ARC Retain Cycle" category
6041
6042def warn_arc_object_memaccess : Warning<
6043  "%select{destination for|source of}0 this %1 call is a pointer to "
6044  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6045
6046let CategoryName = "ARC and @properties" in {
6047
6048def err_arc_strong_property_ownership : Error<
6049  "existing instance variable %1 for strong property %0 may not be "
6050  "%select{|__unsafe_unretained||__weak}2">;
6051def err_arc_assign_property_ownership : Error<
6052  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6053  "attribute must be __unsafe_unretained">;
6054def err_arc_inconsistent_property_ownership : Error<
6055  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6056  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6057
6058} // end "ARC and @properties" category
6059
6060def warn_block_capture_autoreleasing : Warning<
6061  "block captures an autoreleasing out-parameter, which may result in "
6062  "use-after-free bugs">,
6063  InGroup<BlockCaptureAutoReleasing>;
6064def note_declare_parameter_strong : Note<
6065  "declare the parameter __strong or capture a __block __strong variable to "
6066  "keep values alive across autorelease pools">;
6067
6068def err_arc_atomic_ownership : Error<
6069  "cannot perform atomic operation on a pointer to type %0: type has "
6070  "non-trivial ownership">;
6071
6072let CategoryName = "ARC Casting Rules" in {
6073
6074def err_arc_bridge_cast_incompatible : Error<
6075  "incompatible types casting %0 to %1 with a %select{__bridge|"
6076  "__bridge_transfer|__bridge_retained}2 cast">;
6077def err_arc_bridge_cast_wrong_kind : Error<
6078  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6079  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6080  "__bridge_transfer|__bridge_retained}4">;
6081def err_arc_cast_requires_bridge : Error<
6082  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6083  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6084  "requires a bridged cast">;
6085def note_arc_bridge : Note<
6086  "use __bridge to convert directly (no change in ownership)">;
6087def note_arc_cstyle_bridge : Note<
6088  "use __bridge with C-style cast to convert directly (no change in ownership)">;
6089def note_arc_bridge_transfer : Note<
6090  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6091  "ownership of a +1 %0 into ARC">;
6092def note_arc_cstyle_bridge_transfer : Note<
6093  "use __bridge_transfer with C-style cast to transfer "
6094  "ownership of a +1 %0 into ARC">;
6095def note_arc_bridge_retained : Note<
6096  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6097  "ARC object available as a +1 %0">;
6098def note_arc_cstyle_bridge_retained : Note<
6099  "use __bridge_retained with C-style cast to make an "
6100  "ARC object available as a +1 %0">;
6101
6102} // ARC Casting category
6103
6104} // ARC category name
6105
6106def err_flexible_array_init_needs_braces : Error<
6107  "flexible array requires brace-enclosed initializer">;
6108def err_illegal_decl_array_of_functions : Error<
6109  "'%0' declared as array of functions of type %1">;
6110def err_array_incomplete_or_sizeless_type : Error<
6111  "array has %select{incomplete|sizeless}0 element type %1">;
6112def err_illegal_message_expr_incomplete_type : Error<
6113  "Objective-C message has incomplete result type %0">;
6114def err_illegal_decl_array_of_references : Error<
6115  "'%0' declared as array of references of type %1">;
6116def err_decl_negative_array_size : Error<
6117  "'%0' declared as an array with a negative size">;
6118def err_array_static_outside_prototype : Error<
6119  "%0 used in array declarator outside of function prototype">;
6120def err_array_static_not_outermost : Error<
6121  "%0 used in non-outermost array type derivation">;
6122def err_array_star_outside_prototype : Error<
6123  "star modifier used outside of function prototype">;
6124def err_illegal_decl_pointer_to_reference : Error<
6125  "'%0' declared as a pointer to a reference of type %1">;
6126def err_illegal_decl_mempointer_to_reference : Error<
6127  "'%0' declared as a member pointer to a reference of type %1">;
6128def err_illegal_decl_mempointer_to_void : Error<
6129  "'%0' declared as a member pointer to void">;
6130def err_illegal_decl_mempointer_in_nonclass : Error<
6131  "'%0' does not point into a class">;
6132def err_mempointer_in_nonclass_type : Error<
6133  "member pointer refers into non-class type %0">;
6134def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6135def err_nonfunction_block_type : Error<
6136  "block pointer to non-function type is invalid">;
6137def err_return_block_has_expr : Error<"void block should not return a value">;
6138def err_block_return_missing_expr : Error<
6139  "non-void block should return a value">;
6140def err_func_def_incomplete_result : Error<
6141  "incomplete result type %0 in function definition">;
6142def err_atomic_specifier_bad_type
6143    : Error<"_Atomic cannot be applied to "
6144            "%select{incomplete |array |function |reference |atomic |qualified "
6145            "|sizeless ||integer }0type "
6146            "%1 %select{|||||||which is not trivially copyable|}0">;
6147
6148// Expressions.
6149def ext_sizeof_alignof_function_type : Extension<
6150  "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6151def ext_sizeof_alignof_void_type : Extension<
6152  "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6153def err_opencl_sizeof_alignof_type : Error<
6154  "invalid application of '%0' to a void type">;
6155def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6156  "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6157def err_sizeof_alignof_function_type : Error<
6158  "invalid application of '%0' to a function type">;
6159def err_openmp_default_simd_align_expr : Error<
6160  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6161def err_sizeof_alignof_typeof_bitfield : Error<
6162  "invalid application of '%select{sizeof|alignof|typeof}0' to bit-field">;
6163def err_alignof_member_of_incomplete_type : Error<
6164  "invalid application of 'alignof' to a field of a class still being defined">;
6165def err_vecstep_non_scalar_vector_type : Error<
6166  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6167def err_offsetof_incomplete_type : Error<
6168  "offsetof of incomplete type %0">;
6169def err_offsetof_record_type : Error<
6170  "offsetof requires struct, union, or class type, %0 invalid">;
6171def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6172def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6173  InGroup<InvalidOffsetof>;
6174def ext_offsetof_non_standardlayout_type : ExtWarn<
6175  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6176def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6177def err_offsetof_field_of_virtual_base : Error<
6178  "invalid application of 'offsetof' to a field of a virtual base">;
6179def warn_sub_ptr_zero_size_types : Warning<
6180  "subtraction of pointers to type %0 of zero size has undefined behavior">,
6181  InGroup<PointerArith>;
6182def warn_pointer_arith_null_ptr : Warning<
6183  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6184  InGroup<NullPointerArithmetic>, DefaultIgnore;
6185def warn_gnu_null_ptr_arith : Warning<
6186  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6187  InGroup<NullPointerArithmetic>, DefaultIgnore;
6188
6189def warn_floatingpoint_eq : Warning<
6190  "comparing floating point with == or != is unsafe">,
6191  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6192
6193def warn_remainder_division_by_zero : Warning<
6194  "%select{remainder|division}0 by zero is undefined">,
6195  InGroup<DivZero>;
6196def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6197  InGroup<DiagGroup<"shift-negative-value">>;
6198def warn_shift_negative : Warning<"shift count is negative">,
6199  InGroup<DiagGroup<"shift-count-negative">>;
6200def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6201  InGroup<DiagGroup<"shift-count-overflow">>;
6202def warn_shift_result_gt_typewidth : Warning<
6203  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6204  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6205def warn_shift_result_sets_sign_bit : Warning<
6206  "signed shift result (%0) sets the sign bit of the shift expression's "
6207  "type (%1) and becomes negative">,
6208  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6209
6210def warn_precedence_bitwise_rel : Warning<
6211  "%0 has lower precedence than %1; %1 will be evaluated first">,
6212  InGroup<Parentheses>;
6213def note_precedence_bitwise_first : Note<
6214  "place parentheses around the %0 expression to evaluate it first">;
6215def note_precedence_silence : Note<
6216  "place parentheses around the '%0' expression to silence this warning">;
6217
6218def warn_precedence_conditional : Warning<
6219  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6220  InGroup<Parentheses>;
6221def warn_precedence_bitwise_conditional : Warning<
6222  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6223  InGroup<BitwiseConditionalParentheses>;
6224def note_precedence_conditional_first : Note<
6225  "place parentheses around the '?:' expression to evaluate it first">;
6226
6227def warn_enum_constant_in_bool_context : Warning<
6228  "converting the enum constant to a boolean">,
6229  InGroup<IntInBoolContext>, DefaultIgnore;
6230def warn_left_shift_in_bool_context : Warning<
6231  "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6232  InGroup<IntInBoolContext>, DefaultIgnore;
6233def warn_logical_instead_of_bitwise : Warning<
6234  "use of logical '%0' with constant operand">,
6235  InGroup<DiagGroup<"constant-logical-operand">>;
6236def note_logical_instead_of_bitwise_change_operator : Note<
6237  "use '%0' for a bitwise operation">;
6238def note_logical_instead_of_bitwise_remove_constant : Note<
6239  "remove constant to silence this warning">;
6240
6241def warn_bitwise_op_in_bitwise_op : Warning<
6242  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6243
6244def warn_logical_and_in_logical_or : Warning<
6245  "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6246
6247def warn_overloaded_shift_in_comparison :Warning<
6248  "overloaded operator %select{>>|<<}0 has higher precedence than "
6249  "comparison operator">,
6250  InGroup<OverloadedShiftOpParentheses>;
6251def note_evaluate_comparison_first :Note<
6252  "place parentheses around comparison expression to evaluate it first">;
6253
6254def note_concatenated_string_literal_silence :Note<
6255  "place parentheses around the string literal to silence warning">;
6256
6257def warn_addition_in_bitshift : Warning<
6258  "operator '%0' has lower precedence than '%1'; "
6259  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6260
6261def warn_self_assignment_builtin : Warning<
6262  "explicitly assigning value of variable of type %0 to itself">,
6263  InGroup<SelfAssignment>, DefaultIgnore;
6264def warn_self_assignment_overloaded : Warning<
6265  "explicitly assigning value of variable of type %0 to itself">,
6266  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6267def warn_self_move : Warning<
6268  "explicitly moving variable of type %0 to itself">,
6269  InGroup<SelfMove>, DefaultIgnore;
6270
6271def warn_redundant_move_on_return : Warning<
6272  "redundant move in return statement">,
6273  InGroup<RedundantMove>, DefaultIgnore;
6274def warn_pessimizing_move_on_return : Warning<
6275  "moving a local object in a return statement prevents copy elision">,
6276  InGroup<PessimizingMove>, DefaultIgnore;
6277def warn_pessimizing_move_on_initialization : Warning<
6278  "moving a temporary object prevents copy elision">,
6279  InGroup<PessimizingMove>, DefaultIgnore;
6280def note_remove_move : Note<"remove std::move call here">;
6281
6282def warn_return_std_move : Warning<
6283  "local variable %0 will be copied despite being %select{returned|thrown}1 by name">,
6284  InGroup<ReturnStdMove>, DefaultIgnore;
6285def note_add_std_move : Note<
6286  "call 'std::move' explicitly to avoid copying">;
6287def warn_return_std_move_in_cxx11 : Warning<
6288  "prior to the resolution of a defect report against ISO C++11, "
6289  "local variable %0 would have been copied despite being returned by name, "
6290  "due to its not matching the function return type%diff{ ($ vs $)|}1,2">,
6291  InGroup<ReturnStdMoveInCXX11>, DefaultIgnore;
6292def note_add_std_move_in_cxx11 : Note<
6293  "call 'std::move' explicitly to avoid copying on older compilers">;
6294
6295def warn_string_plus_int : Warning<
6296  "adding %0 to a string does not append to the string">,
6297  InGroup<StringPlusInt>;
6298def warn_string_plus_char : Warning<
6299  "adding %0 to a string pointer does not append to the string">,
6300  InGroup<StringPlusChar>;
6301def note_string_plus_scalar_silence : Note<
6302  "use array indexing to silence this warning">;
6303
6304def warn_sizeof_array_param : Warning<
6305  "sizeof on array function parameter will return size of %0 instead of %1">,
6306  InGroup<SizeofArrayArgument>;
6307
6308def warn_sizeof_array_decay : Warning<
6309  "sizeof on pointer operation will return size of %0 instead of %1">,
6310  InGroup<SizeofArrayDecay>;
6311
6312def err_sizeof_nonfragile_interface : Error<
6313  "application of '%select{alignof|sizeof}1' to interface %0 is "
6314  "not supported on this architecture and platform">;
6315def err_atdef_nonfragile_interface : Error<
6316  "use of @defs is not supported on this architecture and platform">;
6317def err_subscript_nonfragile_interface : Error<
6318  "subscript requires size of interface %0, which is not constant for "
6319  "this architecture and platform">;
6320
6321def err_arithmetic_nonfragile_interface : Error<
6322  "arithmetic on pointer to interface %0, which is not a constant size for "
6323  "this architecture and platform">;
6324
6325def warn_deprecated_comma_subscript : Warning<
6326  "top-level comma expression in array subscript is deprecated">,
6327  InGroup<DeprecatedCommaSubscript>;
6328
6329def ext_subscript_non_lvalue : Extension<
6330  "ISO C90 does not allow subscripting non-lvalue array">;
6331def err_typecheck_subscript_value : Error<
6332  "subscripted value is not an array, pointer, or vector">;
6333def err_typecheck_subscript_not_integer : Error<
6334  "array subscript is not an integer">;
6335def err_subscript_function_type : Error<
6336  "subscript of pointer to function type %0">;
6337def err_subscript_incomplete_or_sizeless_type : Error<
6338  "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6339def err_dereference_incomplete_type : Error<
6340  "dereference of pointer to incomplete type %0">;
6341def ext_gnu_subscript_void_type : Extension<
6342  "subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
6343def err_typecheck_member_reference_struct_union : Error<
6344  "member reference base type %0 is not a structure or union">;
6345def err_typecheck_member_reference_ivar : Error<
6346  "%0 does not have a member named %1">;
6347def err_arc_weak_ivar_access : Error<
6348  "dereferencing a __weak pointer is not allowed due to possible "
6349  "null value caused by race condition, assign it to strong variable first">;
6350def err_typecheck_member_reference_arrow : Error<
6351  "member reference type %0 is not a pointer">;
6352def err_typecheck_member_reference_suggestion : Error<
6353  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6354def note_typecheck_member_reference_suggestion : Note<
6355  "did you mean to use '.' instead?">;
6356def note_member_reference_arrow_from_operator_arrow : Note<
6357  "'->' applied to return value of the operator->() declared here">;
6358def err_typecheck_member_reference_type : Error<
6359  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6360def err_typecheck_member_reference_unknown : Error<
6361  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6362def err_member_reference_needs_call : Error<
6363  "base of member reference is a function; perhaps you meant to call "
6364  "it%select{| with no arguments}0?">;
6365def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6366  InGroup<CharSubscript>, DefaultIgnore;
6367
6368def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6369def err_no_member : Error<"no member named %0 in %1">;
6370def err_no_member_overloaded_arrow : Error<
6371  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6372
6373def err_member_not_yet_instantiated : Error<
6374  "no member %0 in %1; it has not yet been instantiated">;
6375def note_non_instantiated_member_here : Note<
6376  "not-yet-instantiated member is declared here">;
6377
6378def err_enumerator_does_not_exist : Error<
6379  "enumerator %0 does not exist in instantiation of %1">;
6380def note_enum_specialized_here : Note<
6381  "enum %0 was explicitly specialized here">;
6382
6383def err_specialization_not_primary_template : Error<
6384  "cannot reference member of primary template because deduced class "
6385  "template specialization %0 is %select{instantiated from a partial|"
6386  "an explicit}1 specialization">;
6387
6388def err_member_redeclared : Error<"class member cannot be redeclared">;
6389def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6390  InGroup<RedeclaredClassMember>;
6391def err_member_redeclared_in_instantiation : Error<
6392  "multiple overloads of %0 instantiate to the same signature %1">;
6393def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6394def err_member_def_undefined_record : Error<
6395  "out-of-line definition of %0 from class %1 without definition">;
6396def err_member_decl_does_not_match : Error<
6397  "out-of-line %select{declaration|definition}2 of %0 "
6398  "does not match any declaration in %1">;
6399def err_friend_decl_with_def_arg_must_be_def : Error<
6400  "friend declaration specifying a default argument must be a definition">;
6401def err_friend_decl_with_def_arg_redeclared : Error<
6402  "friend declaration specifying a default argument must be the only declaration">;
6403def err_friend_decl_does_not_match : Error<
6404  "friend declaration of %0 does not match any declaration in %1">;
6405def err_member_decl_does_not_match_suggest : Error<
6406  "out-of-line %select{declaration|definition}2 of %0 "
6407  "does not match any declaration in %1; did you mean %3?">;
6408def err_member_def_does_not_match_ret_type : Error<
6409  "return type of out-of-line definition of %q0 differs from "
6410  "that in the declaration">;
6411def err_nonstatic_member_out_of_line : Error<
6412  "non-static data member defined out-of-line">;
6413def err_qualified_typedef_declarator : Error<
6414  "typedef declarator cannot be qualified">;
6415def err_qualified_param_declarator : Error<
6416  "parameter declarator cannot be qualified">;
6417def ext_out_of_line_declaration : ExtWarn<
6418  "out-of-line declaration of a member must be a definition">,
6419  InGroup<OutOfLineDeclaration>, DefaultError;
6420def err_member_extra_qualification : Error<
6421  "extra qualification on member %0">;
6422def warn_member_extra_qualification : Warning<
6423  err_member_extra_qualification.Text>, InGroup<MicrosoftExtraQualification>;
6424def warn_namespace_member_extra_qualification : Warning<
6425  "extra qualification on member %0">,
6426  InGroup<DiagGroup<"extra-qualification">>;
6427def err_member_qualification : Error<
6428  "non-friend class member %0 cannot have a qualified name">;
6429def note_member_def_close_match : Note<"member declaration nearly matches">;
6430def note_member_def_close_const_match : Note<
6431  "member declaration does not match because "
6432  "it %select{is|is not}0 const qualified">;
6433def note_member_def_close_param_match : Note<
6434  "type of %ordinal0 parameter of member declaration does not match definition"
6435  "%diff{ ($ vs $)|}1,2">;
6436def note_local_decl_close_match : Note<"local declaration nearly matches">;
6437def note_local_decl_close_param_match : Note<
6438  "type of %ordinal0 parameter of local declaration does not match definition"
6439  "%diff{ ($ vs $)|}1,2">;
6440def err_typecheck_ivar_variable_size : Error<
6441  "instance variables must have a constant size">;
6442def err_ivar_reference_type : Error<
6443  "instance variables cannot be of reference type">;
6444def err_typecheck_illegal_increment_decrement : Error<
6445  "cannot %select{decrement|increment}1 value of type %0">;
6446def err_typecheck_expect_int : Error<
6447  "used type %0 where integer is required">;
6448def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
6449  "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
6450def err_typecheck_pointer_arith_function_type : Error<
6451  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
6452  "function type%select{|s}2 %1%select{| and %3}2">;
6453def err_typecheck_pointer_arith_void_type : Error<
6454  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
6455def err_typecheck_decl_incomplete_type : Error<
6456  "variable has incomplete type %0">;
6457def ext_typecheck_decl_incomplete_type : ExtWarn<
6458  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
6459  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
6460def err_tentative_def_incomplete_type : Error<
6461  "tentative definition has type %0 that is never completed">;
6462def warn_tentative_incomplete_array : Warning<
6463  "tentative array definition assumed to have one element">;
6464def err_typecheck_incomplete_array_needs_initializer : Error<
6465  "definition of variable with array type needs an explicit size "
6466  "or an initializer">;
6467def err_array_init_not_init_list : Error<
6468  "array initializer must be an initializer "
6469  "list%select{| or string literal| or wide string literal}0">;
6470def err_array_init_narrow_string_into_wchar : Error<
6471  "initializing wide char array with non-wide string literal">;
6472def err_array_init_wide_string_into_char : Error<
6473  "initializing char array with wide string literal">;
6474def err_array_init_incompat_wide_string_into_wchar : Error<
6475  "initializing wide char array with incompatible wide string literal">;
6476def err_array_init_plain_string_into_char8_t : Error<
6477  "initializing 'char8_t' array with plain string literal">;
6478def note_array_init_plain_string_into_char8_t : Note<
6479  "add 'u8' prefix to form a 'char8_t' string literal">;
6480def err_array_init_utf8_string_into_char : Error<
6481  "%select{|ISO C++20 does not permit }0initialization of char array with "
6482  "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">;
6483def warn_cxx20_compat_utf8_string : Warning<
6484  "type of UTF-8 string literal will change from array of const char to "
6485  "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
6486def note_cxx20_compat_utf8_string_remove_u8 : Note<
6487  "remove 'u8' prefix to avoid a change of behavior; "
6488  "Clang encodes unprefixed narrow string literals as UTF-8">;
6489def err_array_init_different_type : Error<
6490  "cannot initialize array %diff{of type $ with array of type $|"
6491  "with different type of array}0,1">;
6492def err_array_init_non_constant_array : Error<
6493  "cannot initialize array %diff{of type $ with non-constant array of type $|"
6494  "with different type of array}0,1">;
6495def ext_array_init_copy : Extension<
6496  "initialization of an array "
6497  "%diff{of type $ from a compound literal of type $|"
6498  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
6499// This is intentionally not disabled by -Wno-gnu.
6500def ext_array_init_parens : ExtWarn<
6501  "parenthesized initialization of a member array is a GNU extension">,
6502  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
6503def warn_deprecated_string_literal_conversion : Warning<
6504  "conversion from string literal to %0 is deprecated">,
6505  InGroup<CXX11CompatDeprecatedWritableStr>;
6506def ext_deprecated_string_literal_conversion : ExtWarn<
6507  "ISO C++11 does not allow conversion from string literal to %0">,
6508  InGroup<WritableStrings>, SFINAEFailure;
6509def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
6510def err_typecheck_sclass_fscope : Error<
6511  "illegal storage class on file-scoped variable">;
6512def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
6513  InGroup<MissingDeclarations>;
6514def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
6515  "of a type">, InGroup<MissingDeclarations>;
6516def err_standalone_class_nested_name_specifier : Error<
6517  "forward declaration of %select{class|struct|interface|union|enum}0 cannot "
6518  "have a nested name specifier">;
6519def err_typecheck_sclass_func : Error<"illegal storage class on function">;
6520def err_static_block_func : Error<
6521  "function declared in block scope cannot have 'static' storage class">;
6522def err_typecheck_address_of : Error<"address of %select{bit-field"
6523  "|vector element|property expression|register variable|matrix element}0 requested">;
6524def ext_typecheck_addrof_void : Extension<
6525  "ISO C forbids taking the address of an expression of type 'void'">;
6526def err_unqualified_pointer_member_function : Error<
6527  "must explicitly qualify name of member function when taking its address">;
6528def err_invalid_form_pointer_member_function : Error<
6529  "cannot create a non-constant pointer to member function">;
6530def err_address_of_function_with_pass_object_size_params: Error<
6531  "cannot take address of function %0 because parameter %1 has "
6532  "pass_object_size attribute">;
6533def err_parens_pointer_member_function : Error<
6534  "cannot parenthesize the name of a method when forming a member pointer">;
6535def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
6536  "extra '&' taking address of overloaded function">;
6537def err_typecheck_invalid_lvalue_addrof : Error<
6538  "cannot take the address of an rvalue of type %0">;
6539def ext_typecheck_addrof_temporary : ExtWarn<
6540  "taking the address of a temporary object of type %0">,
6541  InGroup<AddressOfTemporary>, DefaultError;
6542def err_typecheck_addrof_temporary : Error<
6543  "taking the address of a temporary object of type %0">;
6544def err_typecheck_addrof_dtor : Error<
6545  "taking the address of a destructor">;
6546def err_typecheck_unary_expr : Error<
6547  "invalid argument type %0 to unary expression">;
6548def err_typecheck_indirection_requires_pointer : Error<
6549  "indirection requires pointer operand (%0 invalid)">;
6550def ext_typecheck_indirection_through_void_pointer : ExtWarn<
6551  "ISO C++ does not allow indirection on operand of type %0">,
6552  InGroup<DiagGroup<"void-ptr-dereference">>;
6553def warn_indirection_through_null : Warning<
6554  "indirection of non-volatile null pointer will be deleted, not trap">,
6555  InGroup<NullDereference>;
6556def warn_binding_null_to_reference : Warning<
6557  "binding dereferenced null pointer to reference has undefined behavior">,
6558  InGroup<NullDereference>;
6559def note_indirection_through_null : Note<
6560  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
6561def warn_pointer_indirection_from_incompatible_type : Warning<
6562  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
6563  "behavior">,
6564  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6565def warn_taking_address_of_packed_member : Warning<
6566  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
6567  InGroup<DiagGroup<"address-of-packed-member">>;
6568
6569def err_objc_object_assignment : Error<
6570  "cannot assign to class object (%0 invalid)">;
6571def err_typecheck_invalid_operands : Error<
6572  "invalid operands to binary expression (%0 and %1)">;
6573def note_typecheck_invalid_operands_converted : Note<
6574  "%select{first|second}0 operand was implicitly converted to type %1">;
6575def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
6576  "logical expression with vector %select{type %1 and non-vector type %2|types"
6577  " %1 and %2}0 is only supported in C++">;
6578def err_typecheck_sub_ptr_compatible : Error<
6579  "%diff{$ and $ are not pointers to compatible types|"
6580  "pointers to incompatible types}0,1">;
6581def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
6582  "ordered comparison between pointer and integer (%0 and %1)">;
6583def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
6584  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
6585def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
6586  "ordered comparison between pointer and zero (%0 and %1)">;
6587def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
6588  "three-way comparison between pointer and zero">;
6589def ext_typecheck_compare_complete_incomplete_pointers : Extension<
6590  "pointer comparisons before C11 "
6591  "need to be between two complete or two incomplete types; "
6592  "%0 is %select{|in}2complete and "
6593  "%1 is %select{|in}3complete">,
6594  InGroup<C11>;
6595def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
6596  "ordered comparison of function pointers (%0 and %1)">,
6597  InGroup<DiagGroup<"ordered-compare-function-pointers">>;
6598def ext_typecheck_comparison_of_fptr_to_void : Extension<
6599  "equality comparison between function pointer and void pointer (%0 and %1)">;
6600def err_typecheck_comparison_of_fptr_to_void : Error<
6601  "equality comparison between function pointer and void pointer (%0 and %1)">;
6602def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
6603  "comparison between pointer and integer (%0 and %1)">,
6604  InGroup<DiagGroup<"pointer-integer-compare">>;
6605def err_typecheck_comparison_of_pointer_integer : Error<
6606  "comparison between pointer and integer (%0 and %1)">;
6607def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
6608  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
6609  InGroup<CompareDistinctPointerType>;
6610def ext_typecheck_cond_incompatible_operands : ExtWarn<
6611  "incompatible operand types (%0 and %1)">;
6612def err_cond_voidptr_arc : Error <
6613  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
6614  "in ARC mode">;
6615def err_typecheck_comparison_of_distinct_pointers : Error<
6616  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
6617def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
6618  "%select{comparison between %diff{ ($ and $)|}0,1"
6619  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
6620  "|conditional operator with the second and third operands of type "
6621  "%diff{ ($ and $)|}0,1}2"
6622  " which are pointers to non-overlapping address spaces">;
6623
6624def select_arith_conv_kind : TextSubstitution<
6625  "%select{arithmetic between|bitwise operation between|comparison of|"
6626  "conditional expression between|compound assignment of}0">;
6627def warn_arith_conv_enum_float : Warning<
6628  "%sub{select_arith_conv_kind}0 "
6629  "%select{floating-point|enumeration}1 type %2 "
6630  "%plural{2:with|4:from|:and}0 "
6631  "%select{enumeration|floating-point}1 type %3">,
6632  InGroup<EnumFloatConversion>, DefaultIgnore;
6633def warn_arith_conv_enum_float_cxx20 : Warning<
6634  "%sub{select_arith_conv_kind}0 "
6635  "%select{floating-point|enumeration}1 type %2 "
6636  "%plural{2:with|4:from|:and}0 "
6637  "%select{enumeration|floating-point}1 type %3 is deprecated">,
6638  InGroup<DeprecatedEnumFloatConversion>;
6639def warn_arith_conv_mixed_enum_types : Warning<
6640  "%sub{select_arith_conv_kind}0 "
6641  "different enumeration types%diff{ ($ and $)|}1,2">,
6642  InGroup<EnumEnumConversion>, DefaultIgnore;
6643def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
6644  "%sub{select_arith_conv_kind}0 "
6645  "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
6646  InGroup<DeprecatedEnumEnumConversion>;
6647def warn_arith_conv_mixed_anon_enum_types : Warning<
6648  warn_arith_conv_mixed_enum_types.Text>,
6649  InGroup<AnonEnumEnumConversion>, DefaultIgnore;
6650def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
6651  warn_arith_conv_mixed_enum_types_cxx20.Text>,
6652  InGroup<DeprecatedAnonEnumEnumConversion>;
6653def warn_conditional_mixed_enum_types : Warning<
6654  warn_arith_conv_mixed_enum_types.Text>,
6655  InGroup<EnumCompareConditional>, DefaultIgnore;
6656def warn_conditional_mixed_enum_types_cxx20 : Warning<
6657  warn_arith_conv_mixed_enum_types_cxx20.Text>,
6658  InGroup<DeprecatedEnumCompareConditional>;
6659def warn_comparison_mixed_enum_types : Warning<
6660  warn_arith_conv_mixed_enum_types.Text>,
6661  InGroup<EnumCompare>;
6662def warn_comparison_mixed_enum_types_cxx20 : Warning<
6663  warn_arith_conv_mixed_enum_types_cxx20.Text>,
6664  InGroup<DeprecatedEnumCompare>;
6665def warn_comparison_of_mixed_enum_types_switch : Warning<
6666  "comparison of different enumeration types in switch statement"
6667  "%diff{ ($ and $)|}0,1">,
6668  InGroup<EnumCompareSwitch>;
6669
6670def err_typecheck_assign_const : Error<
6671  "%select{"
6672  "cannot assign to return value because function %1 returns a const value|"
6673  "cannot assign to variable %1 with const-qualified type %2|"
6674  "cannot assign to %select{non-|}1static data member %2 "
6675  "with const-qualified type %3|"
6676  "cannot assign to non-static data member within const member function %1|"
6677  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
6678  "with %select{|nested }3const-qualified data member %4|"
6679  "read-only variable is not assignable}0">;
6680
6681def note_typecheck_assign_const : Note<
6682  "%select{"
6683  "function %1 which returns const-qualified type %2 declared here|"
6684  "variable %1 declared const here|"
6685  "%select{non-|}1static data member %2 declared const here|"
6686  "member function %q1 is declared const here|"
6687  "%select{|nested }1data member %2 declared const here}0">;
6688
6689def warn_unsigned_always_true_comparison : Warning<
6690  "result of comparison of %select{%3|unsigned expression}0 %2 "
6691  "%select{unsigned expression|%3}0 is always %4">,
6692  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
6693def warn_unsigned_enum_always_true_comparison : Warning<
6694  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
6695  "%select{unsigned enum expression|%3}0 is always %4">,
6696  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
6697def warn_tautological_constant_compare : Warning<
6698  "result of comparison %select{%3|%1}0 %2 "
6699  "%select{%1|%3}0 is always %4">,
6700  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
6701def warn_tautological_compare_objc_bool : Warning<
6702  "result of comparison of constant %0 with expression of type 'BOOL'"
6703  " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
6704  InGroup<TautologicalObjCBoolCompare>;
6705def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
6706def warn_tautological_compare_value_range : Warning<
6707  "result of comparison of "
6708  "%select{%4|%sub{subst_int_range}1,2}0 %3 "
6709  "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
6710  InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
6711
6712def warn_mixed_sign_comparison : Warning<
6713  "comparison of integers of different signs: %0 and %1">,
6714  InGroup<SignCompare>, DefaultIgnore;
6715def warn_out_of_range_compare : Warning<
6716  "result of comparison of %select{constant %0|true|false}1 with "
6717  "%select{expression of type %2|boolean expression}3 is always %4">,
6718  InGroup<TautologicalOutOfRangeCompare>;
6719def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
6720  InGroup<TautologicalConstantCompare>;
6721def warn_integer_constants_in_conditional_always_true : Warning<
6722  "converting the result of '?:' with integer constants to a boolean always "
6723  "evaluates to 'true'">,
6724  InGroup<TautologicalConstantCompare>;
6725def warn_left_shift_always : Warning<
6726  "converting the result of '<<' to a boolean always evaluates "
6727  "to %select{false|true}0">,
6728  InGroup<TautologicalConstantCompare>;
6729def warn_null_in_arithmetic_operation : Warning<
6730  "use of NULL in arithmetic operation">,
6731  InGroup<NullArithmetic>;
6732def warn_null_in_comparison_operation : Warning<
6733  "comparison between NULL and non-pointer "
6734  "%select{(%1 and NULL)|(NULL and %1)}0">,
6735  InGroup<NullArithmetic>;
6736def err_shift_rhs_only_vector : Error<
6737  "requested shift is a vector of type %0 but the first operand is not a "
6738  "vector (%1)">;
6739
6740def warn_logical_not_on_lhs_of_check : Warning<
6741  "logical not is only applied to the left hand side of this "
6742  "%select{comparison|bitwise operator}0">,
6743  InGroup<LogicalNotParentheses>;
6744def note_logical_not_fix : Note<
6745  "add parentheses after the '!' to evaluate the "
6746  "%select{comparison|bitwise operator}0 first">;
6747def note_logical_not_silence_with_parens : Note<
6748  "add parentheses around left hand side expression to silence this warning">;
6749
6750def err_invalid_this_use : Error<
6751  "invalid use of 'this' outside of a non-static member function">;
6752def err_this_static_member_func : Error<
6753  "'this' cannot be%select{| implicitly}0 used in a static member function "
6754  "declaration">;
6755def err_invalid_member_use_in_static_method : Error<
6756  "invalid use of member %0 in static member function">;
6757def err_invalid_qualified_function_type : Error<
6758  "%select{non-member function|static member function|deduction guide}0 "
6759  "%select{of type %2 |}1cannot have '%3' qualifier">;
6760def err_compound_qualified_function_type : Error<
6761  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
6762  "cannot have '%3' qualifier">;
6763def err_qualified_function_typeid : Error<
6764  "type operand %0 of 'typeid' cannot have '%1' qualifier">;
6765
6766def err_ref_qualifier_overload : Error<
6767  "cannot overload a member function %select{without a ref-qualifier|with "
6768  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
6769  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
6770
6771def err_invalid_non_static_member_use : Error<
6772  "invalid use of non-static data member %0">;
6773def err_nested_non_static_member_use : Error<
6774  "%select{call to non-static member function|use of non-static data member}0 "
6775  "%2 of %1 from nested type %3">;
6776def warn_cxx98_compat_non_static_member_use : Warning<
6777  "use of non-static data member %0 in an unevaluated context is "
6778  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6779def err_invalid_incomplete_type_use : Error<
6780  "invalid use of incomplete type %0">;
6781def err_builtin_func_cast_more_than_one_arg : Error<
6782  "function-style cast to a builtin type can only take one argument">;
6783def err_value_init_for_array_type : Error<
6784  "array types cannot be value-initialized">;
6785def err_init_for_function_type : Error<
6786  "cannot create object of function type %0">;
6787def warn_format_nonliteral_noargs : Warning<
6788  "format string is not a string literal (potentially insecure)">,
6789  InGroup<FormatSecurity>;
6790def warn_format_nonliteral : Warning<
6791  "format string is not a string literal">,
6792  InGroup<FormatNonLiteral>, DefaultIgnore;
6793
6794def err_unexpected_interface : Error<
6795  "unexpected interface name %0: expected expression">;
6796def err_ref_non_value : Error<"%0 does not refer to a value">;
6797def err_ref_vm_type : Error<
6798  "cannot refer to declaration with a variably modified type inside block">;
6799def err_ref_flexarray_type : Error<
6800  "cannot refer to declaration of structure variable with flexible array member "
6801  "inside block">;
6802def err_ref_array_type : Error<
6803  "cannot refer to declaration with an array type inside block">;
6804def err_property_not_found : Error<
6805  "property %0 not found on object of type %1">;
6806def err_invalid_property_name : Error<
6807  "%0 is not a valid property name (accessing an object of type %1)">;
6808def err_getter_not_found : Error<
6809  "no getter method for read from property">;
6810def err_objc_subscript_method_not_found : Error<
6811  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
6812  "found on object of type %0">;
6813def err_objc_subscript_index_type : Error<
6814  "method index parameter type %0 is not integral type">;
6815def err_objc_subscript_key_type : Error<
6816  "method key parameter type %0 is not object type">;
6817def err_objc_subscript_dic_object_type : Error<
6818  "method object parameter type %0 is not object type">;
6819def err_objc_subscript_object_type : Error<
6820  "cannot assign to this %select{dictionary|array}1 because assigning method's "
6821  "2nd parameter of type %0 is not an Objective-C pointer type">;
6822def err_objc_subscript_base_type : Error<
6823  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
6824def err_objc_multiple_subscript_type_conversion : Error<
6825  "indexing expression is invalid because subscript type %0 has "
6826  "multiple type conversion functions">;
6827def err_objc_subscript_type_conversion : Error<
6828  "indexing expression is invalid because subscript type %0 is not an integral"
6829  " or Objective-C pointer type">;
6830def err_objc_subscript_pointer : Error<
6831  "indexing expression is invalid because subscript type %0 is not an"
6832  " Objective-C pointer">;
6833def err_objc_indexing_method_result_type : Error<
6834  "method for accessing %select{dictionary|array}1 element must have Objective-C"
6835  " object return type instead of %0">;
6836def err_objc_index_incomplete_class_type : Error<
6837  "Objective-C index expression has incomplete class type %0">;
6838def err_illegal_container_subscripting_op : Error<
6839  "illegal operation on Objective-C container subscripting">;
6840def err_property_not_found_forward_class : Error<
6841  "property %0 cannot be found in forward class object %1">;
6842def err_property_not_as_forward_class : Error<
6843  "property %0 refers to an incomplete Objective-C class %1 "
6844  "(with no @interface available)">;
6845def note_forward_class : Note<
6846  "forward declaration of class here">;
6847def err_duplicate_property : Error<
6848  "property has a previous declaration">;
6849def ext_gnu_void_ptr : Extension<
6850  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
6851  InGroup<PointerArith>;
6852def ext_gnu_ptr_func_arith : Extension<
6853  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
6854  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
6855  InGroup<PointerArith>;
6856def err_readonly_message_assignment : Error<
6857  "assigning to 'readonly' return result of an Objective-C message not allowed">;
6858def ext_integer_increment_complex : Extension<
6859  "ISO C does not support '++'/'--' on complex integer type %0">;
6860def ext_integer_complement_complex : Extension<
6861  "ISO C does not support '~' for complex conjugation of %0">;
6862def err_nosetter_property_assignment : Error<
6863  "%select{assignment to readonly property|"
6864  "no setter method %1 for assignment to property}0">;
6865def err_nosetter_property_incdec : Error<
6866  "%select{%select{increment|decrement}1 of readonly property|"
6867  "no setter method %2 for %select{increment|decrement}1 of property}0">;
6868def err_nogetter_property_compound_assignment : Error<
6869  "a getter method is needed to perform a compound assignment on a property">;
6870def err_nogetter_property_incdec : Error<
6871  "no getter method %1 for %select{increment|decrement}0 of property">;
6872def err_no_subobject_property_setting : Error<
6873  "expression is not assignable">;
6874def err_qualified_objc_access : Error<
6875  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
6876
6877def ext_freestanding_complex : Extension<
6878  "complex numbers are an extension in a freestanding C99 implementation">;
6879
6880// FIXME: Remove when we support imaginary.
6881def err_imaginary_not_supported : Error<"imaginary types are not supported">;
6882
6883// Obj-c expressions
6884def warn_root_inst_method_not_found : Warning<
6885  "instance method %0 is being used on 'Class' which is not in the root class">,
6886  InGroup<MethodAccess>;
6887def warn_class_method_not_found : Warning<
6888  "class method %objcclass0 not found (return type defaults to 'id')">,
6889  InGroup<MethodAccess>;
6890def warn_instance_method_on_class_found : Warning<
6891  "instance method %0 found instead of class method %1">,
6892  InGroup<MethodAccess>;
6893def warn_inst_method_not_found : Warning<
6894  "instance method %objcinstance0 not found (return type defaults to 'id')">,
6895  InGroup<MethodAccess>;
6896def warn_instance_method_not_found_with_typo : Warning<
6897  "instance method %objcinstance0 not found (return type defaults to 'id')"
6898  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
6899def warn_class_method_not_found_with_typo : Warning<
6900  "class method %objcclass0 not found (return type defaults to 'id')"
6901  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
6902def err_method_not_found_with_typo : Error<
6903  "%select{instance|class}1 method %0 not found "
6904  "; did you mean %2?">;
6905def err_no_super_class_message : Error<
6906  "no @interface declaration found in class messaging of %0">;
6907def err_root_class_cannot_use_super : Error<
6908  "%0 cannot use 'super' because it is a root class">;
6909def err_invalid_receiver_to_message_super : Error<
6910  "'super' is only valid in a method body">;
6911def err_invalid_receiver_class_message : Error<
6912  "receiver type %0 is not an Objective-C class">;
6913def err_missing_open_square_message_send : Error<
6914  "missing '[' at start of message send expression">;
6915def warn_bad_receiver_type : Warning<
6916  "receiver type %0 is not 'id' or interface pointer, consider "
6917  "casting it to 'id'">,InGroup<ObjCReceiver>;
6918def err_bad_receiver_type : Error<"bad receiver type %0">;
6919def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
6920def err_unknown_receiver_suggest : Error<
6921  "unknown receiver %0; did you mean %1?">;
6922def err_objc_throw_expects_object : Error<
6923  "@throw requires an Objective-C object type (%0 invalid)">;
6924def err_objc_synchronized_expects_object : Error<
6925  "@synchronized requires an Objective-C object type (%0 invalid)">;
6926def err_rethrow_used_outside_catch : Error<
6927  "@throw (rethrow) used outside of a @catch block">;
6928def err_attribute_multiple_objc_gc : Error<
6929  "multiple garbage collection attributes specified for type">;
6930def err_catch_param_not_objc_type : Error<
6931  "@catch parameter is not a pointer to an interface type">;
6932def err_illegal_qualifiers_on_catch_parm : Error<
6933  "illegal qualifiers on @catch parameter">;
6934def err_storage_spec_on_catch_parm : Error<
6935  "@catch parameter cannot have storage specifier '%0'">;
6936def warn_register_objc_catch_parm : Warning<
6937  "'register' storage specifier on @catch parameter will be ignored">;
6938def err_qualified_objc_catch_parm : Error<
6939  "@catch parameter declarator cannot be qualified">;
6940def warn_objc_pointer_cxx_catch_fragile : Warning<
6941  "cannot catch an exception thrown with @throw in C++ in the non-unified "
6942  "exception model">, InGroup<ObjCNonUnifiedException>;
6943def err_objc_object_catch : Error<
6944  "cannot catch an Objective-C object by value">;
6945def err_incomplete_type_objc_at_encode : Error<
6946  "'@encode' of incomplete type %0">;
6947def warn_objc_circular_container : Warning<
6948  "adding %0 to %1 might cause circular dependency in container">,
6949  InGroup<DiagGroup<"objc-circular-container">>;
6950def note_objc_circular_container_declared_here : Note<"%0 declared here">;
6951def warn_objc_unsafe_perform_selector : Warning<
6952  "%0 is incompatible with selectors that return a "
6953  "%select{struct|union|vector}1 type">,
6954  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
6955def note_objc_unsafe_perform_selector_method_declared_here :  Note<
6956  "method %0 that returns %1 declared here">;
6957def err_attribute_arm_builtin_alias : Error<
6958  "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
6959def err_attribute_arm_mve_polymorphism : Error<
6960  "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
6961
6962def warn_setter_getter_impl_required : Warning<
6963  "property %0 requires method %1 to be defined - "
6964  "use @synthesize, @dynamic or provide a method implementation "
6965  "in this class implementation">,
6966  InGroup<ObjCPropertyImpl>;
6967def warn_setter_getter_impl_required_in_category : Warning<
6968  "property %0 requires method %1 to be defined - "
6969  "use @dynamic or provide a method implementation in this category">,
6970  InGroup<ObjCPropertyImpl>;
6971def note_parameter_named_here : Note<
6972  "passing argument to parameter %0 here">;
6973def note_parameter_here : Note<
6974  "passing argument to parameter here">;
6975def note_method_return_type_change : Note<
6976  "compiler has implicitly changed method %0 return type">;
6977
6978def warn_impl_required_for_class_property : Warning<
6979  "class property %0 requires method %1 to be defined - "
6980  "use @dynamic or provide a method implementation "
6981  "in this class implementation">,
6982  InGroup<ObjCPropertyImpl>;
6983def warn_impl_required_in_category_for_class_property : Warning<
6984  "class property %0 requires method %1 to be defined - "
6985  "use @dynamic or provide a method implementation in this category">,
6986  InGroup<ObjCPropertyImpl>;
6987
6988// C++ casts
6989// These messages adhere to the TryCast pattern: %0 is an int specifying the
6990// cast type, %1 is the source type, %2 is the destination type.
6991def err_bad_reinterpret_cast_overload : Error<
6992  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
6993
6994def warn_reinterpret_different_from_static : Warning<
6995  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
6996  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
6997  "'static_cast'">, InGroup<ReinterpretBaseClass>;
6998def note_reinterpret_updowncast_use_static: Note<
6999  "use 'static_cast' to adjust the pointer correctly while "
7000  "%select{upcasting|downcasting}0">;
7001
7002def err_bad_static_cast_overload : Error<
7003  "address of overloaded function %0 cannot be static_cast to type %1">;
7004
7005def err_bad_cstyle_cast_overload : Error<
7006  "address of overloaded function %0 cannot be cast to type %1">;
7007
7008
7009def err_bad_cxx_cast_generic : Error<
7010  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7011  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7012def err_bad_cxx_cast_unrelated_class : Error<
7013  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7014  "functional-style cast|}0 from %1 to %2, which are not related by "
7015  "inheritance, is not allowed">;
7016def note_type_incomplete : Note<"%0 is incomplete">;
7017def err_bad_cxx_cast_rvalue : Error<
7018  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7019  "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7020def err_bad_cxx_cast_bitfield : Error<
7021  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7022  "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7023def err_bad_cxx_cast_qualifiers_away : Error<
7024  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7025  "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7026def err_bad_cxx_cast_addr_space_mismatch : Error<
7027  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7028  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7029  " spaces">;
7030def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7031  "ISO C++ does not allow "
7032  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7033  "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
7034  "even though the source and destination types are unrelated">,
7035  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
7036def err_bad_const_cast_dest : Error<
7037  "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
7038  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
7039def ext_cast_fn_obj : Extension<
7040  "cast between pointer-to-function and pointer-to-object is an extension">;
7041def ext_ms_cast_fn_obj : ExtWarn<
7042  "static_cast between pointer-to-function and pointer-to-object is a "
7043  "Microsoft extension">, InGroup<MicrosoftCast>;
7044def warn_cxx98_compat_cast_fn_obj : Warning<
7045  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
7046  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7047def err_bad_reinterpret_cast_small_int : Error<
7048  "cast from pointer to smaller type %2 loses information">;
7049def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
7050  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7051  "to scalar %2 of different size">;
7052def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
7053  "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
7054  "to vector %2 of different size">;
7055def err_bad_cxx_cast_vector_to_vector_different_size : Error<
7056  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7057  "to vector %2 of different size">;
7058def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
7059  "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
7060  "changes address space of nested pointers">,
7061  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7062def err_bad_lvalue_to_rvalue_cast : Error<
7063  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
7064  "not compatible">;
7065def err_bad_rvalue_to_rvalue_cast : Error<
7066  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
7067  "not compatible">;
7068def err_bad_static_cast_pointer_nonpointer : Error<
7069  "cannot cast from type %1 to pointer type %2">;
7070def err_bad_static_cast_member_pointer_nonmp : Error<
7071  "cannot cast from type %1 to member pointer type %2">;
7072def err_bad_cxx_cast_member_pointer_size : Error<
7073  "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
7074  "type %1 to member pointer type %2 of different size">;
7075def err_bad_reinterpret_cast_reference : Error<
7076  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
7077def warn_undefined_reinterpret_cast : Warning<
7078  "reinterpret_cast from %0 to %1 has undefined behavior">,
7079  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7080
7081// These messages don't adhere to the pattern.
7082// FIXME: Display the path somehow better.
7083def err_ambiguous_base_to_derived_cast : Error<
7084  "ambiguous cast from base %0 to derived %1:%2">;
7085def err_static_downcast_via_virtual : Error<
7086  "cannot cast %0 to %1 via virtual base %2">;
7087def err_downcast_from_inaccessible_base : Error<
7088  "cannot cast %select{private|protected}2 base class %1 to %0">;
7089def err_upcast_to_inaccessible_base : Error<
7090  "cannot cast %0 to its %select{private|protected}2 base class %1">;
7091def err_bad_dynamic_cast_not_ref_or_ptr : Error<
7092  "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
7093def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
7094def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
7095def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
7096def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
7097
7098// Other C++ expressions
7099def err_need_header_before_typeid : Error<
7100  "you need to include <typeinfo> before using the 'typeid' operator">;
7101def err_need_header_before_ms_uuidof : Error<
7102  "you need to include <guiddef.h> before using the '__uuidof' operator">;
7103def err_ms___leave_not_in___try : Error<
7104  "'__leave' statement not in __try block">;
7105def err_uuidof_without_guid : Error<
7106  "cannot call operator __uuidof on a type with no GUID">;
7107def err_uuidof_with_multiple_guids : Error<
7108  "cannot call operator __uuidof on a type with multiple GUIDs">;
7109def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
7110def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
7111def err_static_illegal_in_new : Error<
7112  "the 'static' modifier for the array size is not legal in new expressions">;
7113def err_array_new_needs_size : Error<
7114  "array size must be specified in new expression with no initializer">;
7115def err_bad_new_type : Error<
7116  "cannot allocate %select{function|reference}1 type %0 with new">;
7117def err_new_incomplete_or_sizeless_type : Error<
7118  "allocation of %select{incomplete|sizeless}0 type %1">;
7119def err_new_array_nonconst : Error<
7120  "only the first dimension of an allocated array may have dynamic size">;
7121def err_new_array_size_unknown_from_init : Error<
7122  "cannot determine allocated array size from initializer">;
7123def err_new_array_init_args : Error<
7124  "array 'new' cannot have initialization arguments">;
7125def ext_new_paren_array_nonconst : ExtWarn<
7126  "when type is in parentheses, array cannot have dynamic size">;
7127def err_placement_new_non_placement_delete : Error<
7128  "'new' expression with placement arguments refers to non-placement "
7129  "'operator delete'">;
7130def err_array_size_not_integral : Error<
7131  "array size expression must have integral or %select{|unscoped }0"
7132  "enumeration type, not %1">;
7133def err_array_size_incomplete_type : Error<
7134  "array size expression has incomplete class type %0">;
7135def err_array_size_explicit_conversion : Error<
7136  "array size expression of type %0 requires explicit conversion to type %1">;
7137def note_array_size_conversion : Note<
7138  "conversion to %select{integral|enumeration}0 type %1 declared here">;
7139def err_array_size_ambiguous_conversion : Error<
7140  "ambiguous conversion of array size expression of type %0 to an integral or "
7141  "enumeration type">;
7142def ext_array_size_conversion : Extension<
7143  "implicit conversion from array size expression of type %0 to "
7144  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7145  InGroup<CXX11>;
7146def warn_cxx98_compat_array_size_conversion : Warning<
7147  "implicit conversion from array size expression of type %0 to "
7148  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7149  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7150def err_address_space_qualified_new : Error<
7151  "'new' cannot allocate objects of type %0 in address space '%1'">;
7152def err_address_space_qualified_delete : Error<
7153  "'delete' cannot delete objects of type %0 in address space '%1'">;
7154
7155def err_default_init_const : Error<
7156  "default initialization of an object of const type %0"
7157  "%select{| without a user-provided default constructor}1">;
7158def ext_default_init_const : ExtWarn<
7159  "default initialization of an object of const type %0"
7160  "%select{| without a user-provided default constructor}1 "
7161  "is a Microsoft extension">,
7162  InGroup<MicrosoftConstInit>;
7163def err_delete_operand : Error<"cannot delete expression of type %0">;
7164def ext_delete_void_ptr_operand : ExtWarn<
7165  "cannot delete expression with pointer-to-'void' type %0">,
7166  InGroup<DeleteIncomplete>;
7167def err_ambiguous_delete_operand : Error<
7168  "ambiguous conversion of delete expression of type %0 to a pointer">;
7169def warn_delete_incomplete : Warning<
7170  "deleting pointer to incomplete type %0 may cause undefined behavior">,
7171  InGroup<DeleteIncomplete>;
7172def err_delete_incomplete_class_type : Error<
7173  "deleting incomplete class type %0; no conversions to pointer type">;
7174def err_delete_explicit_conversion : Error<
7175  "converting delete expression from type %0 to type %1 invokes an explicit "
7176  "conversion function">;
7177def note_delete_conversion : Note<"conversion to pointer type %0">;
7178def warn_delete_array_type : Warning<
7179  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7180def warn_mismatched_delete_new : Warning<
7181  "'delete%select{|[]}0' applied to a pointer that was allocated with "
7182  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7183  InGroup<DiagGroup<"mismatched-new-delete">>;
7184def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7185def err_no_suitable_delete_member_function_found : Error<
7186  "no suitable member %0 in %1">;
7187def err_ambiguous_suitable_delete_member_function_found : Error<
7188  "multiple suitable %0 functions in %1">;
7189def warn_ambiguous_suitable_delete_function_found : Warning<
7190  "multiple suitable %0 functions for %1; no 'operator delete' function "
7191  "will be invoked if initialization throws an exception">,
7192  InGroup<DiagGroup<"ambiguous-delete">>;
7193def note_member_declared_here : Note<
7194  "member %0 declared here">;
7195def note_member_first_declared_here : Note<
7196  "member %0 first declared here">;
7197def warn_bitwise_negation_bool : Warning<
7198  "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7199  "did you mean logical negation?">,
7200  InGroup<DiagGroup<"bool-operation">>;
7201def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7202def warn_increment_bool : Warning<
7203  "incrementing expression of type bool is deprecated and "
7204  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7205def ext_increment_bool : ExtWarn<
7206  "ISO C++17 does not allow incrementing expression of type bool">,
7207  DefaultError, InGroup<IncrementBool>;
7208def err_increment_decrement_enum : Error<
7209  "cannot %select{decrement|increment}0 expression of enum type %1">;
7210
7211def warn_deprecated_increment_decrement_volatile : Warning<
7212  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7213  "is deprecated">, InGroup<DeprecatedVolatile>;
7214def warn_deprecated_simple_assign_volatile : Warning<
7215  "use of result of assignment to object of volatile-qualified type %0 "
7216  "is deprecated">, InGroup<DeprecatedVolatile>;
7217def warn_deprecated_compound_assign_volatile : Warning<
7218  "compound assignment to object of volatile-qualified type %0 is deprecated">,
7219  InGroup<DeprecatedVolatile>;
7220def warn_deprecated_volatile_return : Warning<
7221  "volatile-qualified return type %0 is deprecated">,
7222  InGroup<DeprecatedVolatile>;
7223def warn_deprecated_volatile_param : Warning<
7224  "volatile-qualified parameter type %0 is deprecated">,
7225  InGroup<DeprecatedVolatile>;
7226def warn_deprecated_volatile_structured_binding : Warning<
7227  "volatile qualifier in structured binding declaration is deprecated">,
7228  InGroup<DeprecatedVolatile>;
7229
7230def err_catch_incomplete_ptr : Error<
7231  "cannot catch pointer to incomplete type %0">;
7232def err_catch_incomplete_ref : Error<
7233  "cannot catch reference to incomplete type %0">;
7234def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7235def err_catch_sizeless : Error<
7236  "cannot catch %select{|reference to }0sizeless type %1">;
7237def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7238def err_catch_variably_modified : Error<
7239  "cannot catch variably modified type %0">;
7240def err_qualified_catch_declarator : Error<
7241  "exception declarator cannot be qualified">;
7242def err_early_catch_all : Error<"catch-all handler must come last">;
7243def err_bad_memptr_rhs : Error<
7244  "right hand operand to %0 has non-pointer-to-member type %1">;
7245def err_bad_memptr_lhs : Error<
7246  "left hand operand to %0 must be a %select{|pointer to }1class "
7247  "compatible with the right hand operand, but is %2">;
7248def err_memptr_incomplete : Error<
7249  "member pointer has incomplete base type %0">;
7250def warn_exception_caught_by_earlier_handler : Warning<
7251  "exception of type %0 will be caught by earlier handler">,
7252  InGroup<Exceptions>;
7253def note_previous_exception_handler : Note<"for type %0">;
7254def err_exceptions_disabled : Error<
7255  "cannot use '%0' with exceptions disabled">;
7256def err_objc_exceptions_disabled : Error<
7257  "cannot use '%0' with Objective-C exceptions disabled">;
7258def warn_throw_in_noexcept_func : Warning<
7259  "%0 has a non-throwing exception specification but can still throw">,
7260  InGroup<Exceptions>;
7261def note_throw_in_dtor : Note<
7262  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7263  "non-throwing}1 exception specification">;
7264def note_throw_in_function : Note<"function declared non-throwing here">;
7265def err_seh_try_outside_functions : Error<
7266  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7267def err_mixing_cxx_try_seh_try : Error<
7268  "cannot use C++ 'try' in the same function as SEH '__try'">;
7269def err_seh_try_unsupported : Error<
7270  "SEH '__try' is not supported on this target">;
7271def note_conflicting_try_here : Note<
7272  "conflicting %0 here">;
7273def warn_jump_out_of_seh_finally : Warning<
7274  "jump out of __finally block has undefined behavior">,
7275  InGroup<DiagGroup<"jump-seh-finally">>;
7276def warn_non_virtual_dtor : Warning<
7277  "%0 has virtual functions but non-virtual destructor">,
7278  InGroup<NonVirtualDtor>, DefaultIgnore;
7279def warn_delete_non_virtual_dtor : Warning<
7280  "%select{delete|destructor}0 called on non-final %1 that has "
7281  "virtual functions but non-virtual destructor">,
7282  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7283def note_delete_non_virtual : Note<
7284  "qualify call to silence this warning">;
7285def warn_delete_abstract_non_virtual_dtor : Warning<
7286  "%select{delete|destructor}0 called on %1 that is abstract but has "
7287  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7288def warn_overloaded_virtual : Warning<
7289  "%q0 hides overloaded virtual %select{function|functions}1">,
7290  InGroup<OverloadedVirtual>, DefaultIgnore;
7291def note_hidden_overloaded_virtual_declared_here : Note<
7292  "hidden overloaded virtual function %q0 declared here"
7293  "%select{|: different classes%diff{ ($ vs $)|}2,3"
7294  "|: different number of parameters (%2 vs %3)"
7295  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7296  "|: different return type%diff{ ($ vs $)|}2,3"
7297  "|: different qualifiers (%2 vs %3)"
7298  "|: different exception specifications}1">;
7299def warn_using_directive_in_header : Warning<
7300  "using namespace directive in global context in header">,
7301  InGroup<HeaderHygiene>, DefaultIgnore;
7302def warn_overaligned_type : Warning<
7303  "type %0 requires %1 bytes of alignment and the default allocator only "
7304  "guarantees %2 bytes">,
7305  InGroup<OveralignedType>, DefaultIgnore;
7306def err_aligned_allocation_unavailable : Error<
7307  "aligned %select{allocation|deallocation}0 function of type '%1' is "
7308  "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
7309def note_silence_aligned_allocation_unavailable : Note<
7310  "if you supply your own aligned allocation functions, use "
7311  "-faligned-allocation to silence this diagnostic">;
7312
7313def err_conditional_void_nonvoid : Error<
7314  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7315  "is of type %0">;
7316def err_conditional_ambiguous : Error<
7317  "conditional expression is ambiguous; "
7318  "%diff{$ can be converted to $ and vice versa|"
7319  "types can be convert to each other}0,1">;
7320def err_conditional_ambiguous_ovl : Error<
7321  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7322  "can be converted to several common types">;
7323def err_conditional_vector_size : Error<
7324  "vector condition type %0 and result type %1 do not have the same number "
7325  "of elements">;
7326def err_conditional_vector_element_size : Error<
7327  "vector condition type %0 and result type %1 do not have elements of the "
7328  "same size">;
7329def err_conditional_vector_has_void : Error<
7330  "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7331def err_conditional_vector_operand_type
7332    : Error<"%select{enumeration|extended vector}0 type %1 is not allowed in a "
7333            "vector conditional">;
7334def err_conditional_vector_mismatched_vectors
7335    : Error<"vector operands to the vector conditional must be the same type "
7336            "%diff{($ and $)|}0,1}">;
7337
7338def err_throw_incomplete : Error<
7339  "cannot throw object of incomplete type %0">;
7340def err_throw_incomplete_ptr : Error<
7341  "cannot throw pointer to object of incomplete type %0">;
7342def err_throw_sizeless : Error<
7343  "cannot throw object of sizeless type %0">;
7344def warn_throw_underaligned_obj : Warning<
7345  "underaligned exception object thrown">,
7346  InGroup<UnderalignedExceptionObject>;
7347def note_throw_underaligned_obj : Note<
7348  "required alignment of type %0 (%1 bytes) is larger than the supported "
7349  "alignment of C++ exception objects on this target (%2 bytes)">;
7350def err_return_in_constructor_handler : Error<
7351  "return in the catch of a function try block of a constructor is illegal">;
7352def warn_cdtor_function_try_handler_mem_expr : Warning<
7353  "cannot refer to a non-static member from the handler of a "
7354  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
7355
7356let CategoryName = "Lambda Issue" in {
7357  def err_capture_more_than_once : Error<
7358    "%0 can appear only once in a capture list">;
7359  def err_reference_capture_with_reference_default : Error<
7360    "'&' cannot precede a capture when the capture default is '&'">;
7361  def err_copy_capture_with_copy_default : Error<
7362    "'&' must precede a capture when the capture default is '='">;
7363  def err_capture_does_not_name_variable : Error<
7364    "%0 in capture list does not name a variable">;
7365  def err_capture_non_automatic_variable : Error<
7366    "%0 cannot be captured because it does not have automatic storage "
7367    "duration">;
7368  def err_this_capture : Error<
7369    "'this' cannot be %select{implicitly |}0captured in this context">;
7370  def err_lambda_capture_anonymous_var : Error<
7371    "unnamed variable cannot be implicitly captured in a lambda expression">;
7372  def err_lambda_capture_flexarray_type : Error<
7373    "variable %0 with flexible array member cannot be captured in "
7374    "a lambda expression">;
7375  def err_lambda_impcap : Error<
7376    "variable %0 cannot be implicitly captured in a lambda with no "
7377    "capture-default specified">;
7378  def note_lambda_decl : Note<"lambda expression begins here">;
7379  def err_lambda_unevaluated_operand : Error<
7380    "lambda expression in an unevaluated operand">;
7381  def err_lambda_in_constant_expression : Error<
7382    "a lambda expression may not appear inside of a constant expression">;
7383  def err_lambda_in_invalid_context : Error<
7384    "a lambda expression cannot appear in this context">;
7385  def err_lambda_return_init_list : Error<
7386    "cannot deduce lambda return type from initializer list">;
7387  def err_lambda_capture_default_arg : Error<
7388    "lambda expression in default argument cannot capture any entity">;
7389  def err_lambda_incomplete_result : Error<
7390    "incomplete result type %0 in lambda expression">;
7391  def err_noreturn_lambda_has_return_expr : Error<
7392    "lambda declared 'noreturn' should not return">;
7393  def warn_maybe_falloff_nonvoid_lambda : Warning<
7394    "non-void lambda does not return a value in all control paths">,
7395    InGroup<ReturnType>;
7396  def warn_falloff_nonvoid_lambda : Warning<
7397    "non-void lambda does not return a value">,
7398    InGroup<ReturnType>;
7399  def err_access_lambda_capture : Error<
7400    // The ERRORs represent other special members that aren't constructors, in
7401    // hopes that someone will bother noticing and reporting if they appear
7402    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
7403    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
7404    AccessControl;
7405  def note_lambda_to_block_conv : Note<
7406    "implicit capture of lambda object due to conversion to block pointer "
7407    "here">;
7408  def note_var_explicitly_captured_here : Note<"variable %0 is"
7409    "%select{| explicitly}1 captured here">;
7410
7411  // C++14 lambda init-captures.
7412  def warn_cxx11_compat_init_capture : Warning<
7413    "initialized lambda captures are incompatible with C++ standards "
7414    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
7415  def ext_init_capture : ExtWarn<
7416    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
7417  def err_init_capture_no_expression : Error<
7418    "initializer missing for lambda capture %0">;
7419  def err_init_capture_multiple_expressions : Error<
7420    "initializer for lambda capture %0 contains multiple expressions">;
7421  def err_init_capture_paren_braces : Error<
7422    "cannot deduce type for lambda capture %1 from "
7423    "%select{parenthesized|nested}0 initializer list">;
7424  def err_init_capture_deduction_failure : Error<
7425    "cannot deduce type for lambda capture %0 from initializer of type %2">;
7426  def err_init_capture_deduction_failure_from_init_list : Error<
7427    "cannot deduce type for lambda capture %0 from initializer list">;
7428  def warn_cxx17_compat_init_capture_pack : Warning<
7429    "initialized lambda capture packs are incompatible with C++ standards "
7430    "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7431  def ext_init_capture_pack : ExtWarn<
7432    "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
7433
7434  // C++14 generic lambdas.
7435  def warn_cxx11_compat_generic_lambda : Warning<
7436    "generic lambdas are incompatible with C++11">,
7437    InGroup<CXXPre14Compat>, DefaultIgnore;
7438
7439  // C++17 '*this' captures.
7440  def warn_cxx14_compat_star_this_lambda_capture : Warning<
7441    "by value capture of '*this' is incompatible with C++ standards before C++17">,
7442     InGroup<CXXPre17Compat>, DefaultIgnore;
7443  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
7444    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
7445
7446  // C++17 parameter shadows capture
7447  def err_parameter_shadow_capture : Error<
7448    "a lambda parameter cannot shadow an explicitly captured entity">;
7449
7450  // C++20 [=, this] captures.
7451  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
7452    "explicit capture of 'this' with a capture default of '=' is incompatible "
7453    "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7454  def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
7455    "explicit capture of 'this' with a capture default of '=' "
7456    "is a C++20 extension">, InGroup<CXX20>;
7457  def warn_deprecated_this_capture : Warning<
7458    "implicit capture of 'this' with a capture default of '=' is deprecated">,
7459    InGroup<DeprecatedThisCapture>, DefaultIgnore;
7460  def note_deprecated_this_capture : Note<
7461    "add an explicit capture of 'this' to capture '*this' by reference">;
7462
7463  // C++20 default constructible / assignable lambdas.
7464  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
7465    "%select{default construction|assignment}0 of lambda is incompatible with "
7466    "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7467}
7468
7469def err_return_in_captured_stmt : Error<
7470  "cannot return from %0">;
7471def err_capture_block_variable : Error<
7472  "__block variable %0 cannot be captured in a "
7473  "%select{lambda expression|captured statement}1">;
7474
7475def err_operator_arrow_circular : Error<
7476  "circular pointer delegation detected">;
7477def err_operator_arrow_depth_exceeded : Error<
7478  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
7479  "'operator->' calls">;
7480def note_operator_arrow_here : Note<
7481  "'operator->' declared here produces an object of type %0">;
7482def note_operator_arrows_suppressed : Note<
7483  "(skipping %0 'operator->'%s0 in backtrace)">;
7484def note_operator_arrow_depth : Note<
7485  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
7486
7487def err_pseudo_dtor_base_not_scalar : Error<
7488  "object expression of non-scalar type %0 cannot be used in a "
7489  "pseudo-destructor expression">;
7490def ext_pseudo_dtor_on_void : ExtWarn<
7491  "pseudo-destructors on type void are a Microsoft extension">,
7492  InGroup<MicrosoftVoidPseudoDtor>;
7493def err_pseudo_dtor_type_mismatch : Error<
7494  "the type of object expression "
7495  "%diff{($) does not match the type being destroyed ($)|"
7496  "does not match the type being destroyed}0,1 "
7497  "in pseudo-destructor expression">;
7498def err_pseudo_dtor_call_with_args : Error<
7499  "call to pseudo-destructor cannot have any arguments">;
7500def err_dtor_expr_without_call : Error<
7501  "reference to %select{destructor|pseudo-destructor}0 must be called"
7502  "%select{|; did you mean to call it with no arguments?}1">;
7503def err_pseudo_dtor_destructor_non_type : Error<
7504  "%0 does not refer to a type name in pseudo-destructor expression; expected "
7505  "the name of type %1">;
7506def err_invalid_use_of_function_type : Error<
7507  "a function type is not allowed here">;
7508def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
7509def err_typecheck_bool_condition : Error<
7510  "value of type %0 is not contextually convertible to 'bool'">;
7511def err_typecheck_ambiguous_condition : Error<
7512  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
7513def err_typecheck_nonviable_condition : Error<
7514  "no viable conversion%select{%diff{ from $ to $|}1,2|"
7515  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
7516def err_typecheck_nonviable_condition_incomplete : Error<
7517  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
7518def err_typecheck_deleted_function : Error<
7519  "conversion function %diff{from $ to $|between types}0,1 "
7520  "invokes a deleted function">;
7521
7522def err_expected_class_or_namespace : Error<"%0 is not a class"
7523  "%select{ or namespace|, namespace, or enumeration}1">;
7524def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
7525  "because namespace %1 does not enclose namespace %2">;
7526def err_invalid_declarator_global_scope : Error<
7527  "definition or redeclaration of %0 cannot name the global scope">;
7528def err_invalid_declarator_in_function : Error<
7529  "definition or redeclaration of %0 not allowed inside a function">;
7530def err_invalid_declarator_in_block : Error<
7531  "definition or redeclaration of %0 not allowed inside a block">;
7532def err_not_tag_in_scope : Error<
7533  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
7534
7535def err_no_typeid_with_fno_rtti : Error<
7536  "use of typeid requires -frtti">;
7537def err_no_dynamic_cast_with_fno_rtti : Error<
7538  "use of dynamic_cast requires -frtti">;
7539def warn_no_dynamic_cast_with_rtti_disabled: Warning<
7540  "dynamic_cast will not work since RTTI data is disabled by "
7541  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7542def warn_no_typeid_with_rtti_disabled: Warning<
7543  "typeid will not work since RTTI data is disabled by "
7544  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7545
7546def err_cannot_form_pointer_to_member_of_reference_type : Error<
7547  "cannot form a pointer-to-member to member %0 of reference type %1">;
7548def err_incomplete_object_call : Error<
7549  "incomplete type in call to object of type %0">;
7550
7551def warn_condition_is_assignment : Warning<"using the result of an "
7552  "assignment as a condition without parentheses">,
7553  InGroup<Parentheses>;
7554def warn_free_nonheap_object
7555  : Warning<"attempt to call %0 on non-heap object %1">,
7556    InGroup<DiagGroup<"free-nonheap-object">>,
7557    DefaultIgnore; // FIXME: add to -Wall after sufficient testing
7558
7559// Completely identical except off by default.
7560def warn_condition_is_idiomatic_assignment : Warning<"using the result "
7561  "of an assignment as a condition without parentheses">,
7562  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
7563def note_condition_assign_to_comparison : Note<
7564  "use '==' to turn this assignment into an equality comparison">;
7565def note_condition_or_assign_to_comparison : Note<
7566  "use '!=' to turn this compound assignment into an inequality comparison">;
7567def note_condition_assign_silence : Note<
7568  "place parentheses around the assignment to silence this warning">;
7569
7570def warn_equality_with_extra_parens : Warning<"equality comparison with "
7571  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
7572def note_equality_comparison_to_assign : Note<
7573  "use '=' to turn this equality comparison into an assignment">;
7574def note_equality_comparison_silence : Note<
7575  "remove extraneous parentheses around the comparison to silence this warning">;
7576
7577// assignment related diagnostics (also for argument passing, returning, etc).
7578// In most of these diagnostics the %2 is a value from the
7579// Sema::AssignmentAction enumeration
7580def err_typecheck_convert_incompatible : Error<
7581  "%select{%diff{assigning to $ from incompatible type $|"
7582  "assigning to type from incompatible type}0,1"
7583  "|%diff{passing $ to parameter of incompatible type $|"
7584  "passing type to parameter of incompatible type}0,1"
7585  "|%diff{returning $ from a function with incompatible result type $|"
7586  "returning type from a function with incompatible result type}0,1"
7587  "|%diff{converting $ to incompatible type $|"
7588  "converting type to incompatible type}0,1"
7589  "|%diff{initializing $ with an expression of incompatible type $|"
7590  "initializing type with an expression of incompatible type}0,1"
7591  "|%diff{sending $ to parameter of incompatible type $|"
7592  "sending type to parameter of incompatible type}0,1"
7593  "|%diff{casting $ to incompatible type $|"
7594  "casting type to incompatible type}0,1}2"
7595  "%select{|; dereference with *|"
7596  "; take the address with &|"
7597  "; remove *|"
7598  "; remove &}3"
7599  "%select{|: different classes%diff{ ($ vs $)|}5,6"
7600  "|: different number of parameters (%5 vs %6)"
7601  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
7602  "|: different return type%diff{ ($ vs $)|}5,6"
7603  "|: different qualifiers (%5 vs %6)"
7604  "|: different exception specifications}4">;
7605def err_typecheck_missing_return_type_incompatible : Error<
7606  "%diff{return type $ must match previous return type $|"
7607  "return type must match previous return type}0,1 when %select{block "
7608  "literal|lambda expression}2 has unspecified explicit return type">;
7609
7610def note_incomplete_class_and_qualified_id : Note<
7611  "conformance of forward class %0 to protocol %1 can not be confirmed">;
7612def warn_incompatible_qualified_id : Warning<
7613  "%select{%diff{assigning to $ from incompatible type $|"
7614  "assigning to type from incompatible type}0,1"
7615  "|%diff{passing $ to parameter of incompatible type $|"
7616  "passing type to parameter of incompatible type}0,1"
7617  "|%diff{returning $ from a function with incompatible result type $|"
7618  "returning type from a function with incompatible result type}0,1"
7619  "|%diff{converting $ to incompatible type $|"
7620  "converting type to incompatible type}0,1"
7621  "|%diff{initializing $ with an expression of incompatible type $|"
7622  "initializing type with an expression of incompatible type}0,1"
7623  "|%diff{sending $ to parameter of incompatible type $|"
7624  "sending type to parameter of incompatible type}0,1"
7625  "|%diff{casting $ to incompatible type $|"
7626  "casting type to incompatible type}0,1}2">;
7627def err_incompatible_qualified_id : Error<
7628  "%select{%diff{assigning to $ from incompatible type $|"
7629  "assigning to type from incompatible type}0,1"
7630  "|%diff{passing $ to parameter of incompatible type $|"
7631  "passing type to parameter of incompatible type}0,1"
7632  "|%diff{returning $ from a function with incompatible result type $|"
7633  "returning type from a function with incompatible result type}0,1"
7634  "|%diff{converting $ to incompatible type $|"
7635  "converting type to incompatible type}0,1"
7636  "|%diff{initializing $ with an expression of incompatible type $|"
7637  "initializing type with an expression of incompatible type}0,1"
7638  "|%diff{sending $ to parameter of incompatible type $|"
7639  "sending type to parameter of incompatible type}0,1"
7640  "|%diff{casting $ to incompatible type $|"
7641  "casting type to incompatible type}0,1}2">;
7642def ext_typecheck_convert_pointer_int : ExtWarn<
7643  "incompatible pointer to integer conversion "
7644  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7645  "|%diff{passing $ to parameter of type $|"
7646  "passing to parameter of different type}0,1"
7647  "|%diff{returning $ from a function with result type $|"
7648  "returning from function with different return type}0,1"
7649  "|%diff{converting $ to type $|converting between types}0,1"
7650  "|%diff{initializing $ with an expression of type $|"
7651  "initializing with expression of different type}0,1"
7652  "|%diff{sending $ to parameter of type $|"
7653  "sending to parameter of different type}0,1"
7654  "|%diff{casting $ to type $|casting between types}0,1}2"
7655  "%select{|; dereference with *|"
7656  "; take the address with &|"
7657  "; remove *|"
7658  "; remove &}3">,
7659  InGroup<IntConversion>;
7660def err_typecheck_convert_pointer_int : Error<
7661  "incompatible pointer to integer conversion "
7662  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7663  "|%diff{passing $ to parameter of type $|"
7664  "passing to parameter of different type}0,1"
7665  "|%diff{returning $ from a function with result type $|"
7666  "returning from function with different return type}0,1"
7667  "|%diff{converting $ to type $|converting between types}0,1"
7668  "|%diff{initializing $ with an expression of type $|"
7669  "initializing with expression of different type}0,1"
7670  "|%diff{sending $ to parameter of type $|"
7671  "sending to parameter of different type}0,1"
7672  "|%diff{casting $ to type $|casting between types}0,1}2"
7673  "%select{|; dereference with *|"
7674  "; take the address with &|"
7675  "; remove *|"
7676  "; remove &}3">;
7677def ext_typecheck_convert_int_pointer : ExtWarn<
7678  "incompatible integer to pointer conversion "
7679  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7680  "|%diff{passing $ to parameter of type $|"
7681  "passing to parameter of different type}0,1"
7682  "|%diff{returning $ from a function with result type $|"
7683  "returning from function with different return type}0,1"
7684  "|%diff{converting $ to type $|converting between types}0,1"
7685  "|%diff{initializing $ with an expression of type $|"
7686  "initializing with expression of different type}0,1"
7687  "|%diff{sending $ to parameter of type $|"
7688  "sending to parameter of different type}0,1"
7689  "|%diff{casting $ to type $|casting between types}0,1}2"
7690  "%select{|; dereference with *|"
7691  "; take the address with &|"
7692  "; remove *|"
7693  "; remove &}3">,
7694  InGroup<IntConversion>, SFINAEFailure;
7695def err_typecheck_convert_int_pointer : Error<
7696  "incompatible integer to pointer conversion "
7697  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7698  "|%diff{passing $ to parameter of type $|"
7699  "passing to parameter of different type}0,1"
7700  "|%diff{returning $ from a function with result type $|"
7701  "returning from function with different return type}0,1"
7702  "|%diff{converting $ to type $|converting between types}0,1"
7703  "|%diff{initializing $ with an expression of type $|"
7704  "initializing with expression of different type}0,1"
7705  "|%diff{sending $ to parameter of type $|"
7706  "sending to parameter of different type}0,1"
7707  "|%diff{casting $ to type $|casting between types}0,1}2"
7708  "%select{|; dereference with *|"
7709  "; take the address with &|"
7710  "; remove *|"
7711  "; remove &}3">;
7712def ext_typecheck_convert_pointer_void_func : Extension<
7713  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7714  "|%diff{passing $ to parameter of type $|"
7715  "passing to parameter of different type}0,1"
7716  "|%diff{returning $ from a function with result type $|"
7717  "returning from function with different return type}0,1"
7718  "|%diff{converting $ to type $|converting between types}0,1"
7719  "|%diff{initializing $ with an expression of type $|"
7720  "initializing with expression of different type}0,1"
7721  "|%diff{sending $ to parameter of type $|"
7722  "sending to parameter of different type}0,1"
7723  "|%diff{casting $ to type $|casting between types}0,1}2"
7724  " converts between void pointer and function pointer">;
7725def err_typecheck_convert_pointer_void_func : Error<
7726  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7727  "|%diff{passing $ to parameter of type $|"
7728  "passing to parameter of different type}0,1"
7729  "|%diff{returning $ from a function with result type $|"
7730  "returning from function with different return type}0,1"
7731  "|%diff{converting $ to type $|converting between types}0,1"
7732  "|%diff{initializing $ with an expression of type $|"
7733  "initializing with expression of different type}0,1"
7734  "|%diff{sending $ to parameter of type $|"
7735  "sending to parameter of different type}0,1"
7736  "|%diff{casting $ to type $|casting between types}0,1}2"
7737  " converts between void pointer and function pointer">;
7738def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
7739  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7740  "|%diff{passing $ to parameter of type $|"
7741  "passing to parameter of different type}0,1"
7742  "|%diff{returning $ from a function with result type $|"
7743  "returning from function with different return type}0,1"
7744  "|%diff{converting $ to type $|converting between types}0,1"
7745  "|%diff{initializing $ with an expression of type $|"
7746  "initializing with expression of different type}0,1"
7747  "|%diff{sending $ to parameter of type $|"
7748  "sending to parameter of different type}0,1"
7749  "|%diff{casting $ to type $|casting between types}0,1}2"
7750  " converts between pointers to integer types with different sign">,
7751  InGroup<DiagGroup<"pointer-sign">>;
7752def err_typecheck_convert_incompatible_pointer_sign : Error<
7753  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7754  "|%diff{passing $ to parameter of type $|"
7755  "passing to parameter of different type}0,1"
7756  "|%diff{returning $ from a function with result type $|"
7757  "returning from function with different return type}0,1"
7758  "|%diff{converting $ to type $|converting between types}0,1"
7759  "|%diff{initializing $ with an expression of type $|"
7760  "initializing with expression of different type}0,1"
7761  "|%diff{sending $ to parameter of type $|"
7762  "sending to parameter of different type}0,1"
7763  "|%diff{casting $ to type $|casting between types}0,1}2"
7764  " converts between pointers to integer types with different sign">;
7765def ext_typecheck_convert_incompatible_pointer : ExtWarn<
7766  "incompatible pointer types "
7767  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7768  "|%diff{passing $ to parameter of type $|"
7769  "passing to parameter of different type}0,1"
7770  "|%diff{returning $ from a function with result type $|"
7771  "returning from function with different return type}0,1"
7772  "|%diff{converting $ to type $|converting between types}0,1"
7773  "|%diff{initializing $ with an expression of type $|"
7774  "initializing with expression of different type}0,1"
7775  "|%diff{sending $ to parameter of type $|"
7776  "sending to parameter of different type}0,1"
7777  "|%diff{casting $ to type $|casting between types}0,1}2"
7778  "%select{|; dereference with *|"
7779  "; take the address with &|"
7780  "; remove *|"
7781  "; remove &}3">,
7782  InGroup<IncompatiblePointerTypes>;
7783def err_typecheck_convert_incompatible_pointer : Error<
7784  "incompatible pointer types "
7785  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7786  "|%diff{passing $ to parameter of type $|"
7787  "passing to parameter of different type}0,1"
7788  "|%diff{returning $ from a function with result type $|"
7789  "returning from function with different return type}0,1"
7790  "|%diff{converting $ to type $|converting between types}0,1"
7791  "|%diff{initializing $ with an expression of type $|"
7792  "initializing with expression of different type}0,1"
7793  "|%diff{sending $ to parameter of type $|"
7794  "sending to parameter of different type}0,1"
7795  "|%diff{casting $ to type $|casting between types}0,1}2"
7796  "%select{|; dereference with *|"
7797  "; take the address with &|"
7798  "; remove *|"
7799  "; remove &}3">;
7800def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
7801  "incompatible function pointer types "
7802  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7803  "|%diff{passing $ to parameter of type $|"
7804  "passing to parameter of different type}0,1"
7805  "|%diff{returning $ from a function with result type $|"
7806  "returning from function with different return type}0,1"
7807  "|%diff{converting $ to type $|converting between types}0,1"
7808  "|%diff{initializing $ with an expression of type $|"
7809  "initializing with expression of different type}0,1"
7810  "|%diff{sending $ to parameter of type $|"
7811  "sending to parameter of different type}0,1"
7812  "|%diff{casting $ to type $|casting between types}0,1}2"
7813  "%select{|; dereference with *|"
7814  "; take the address with &|"
7815  "; remove *|"
7816  "; remove &}3">,
7817  InGroup<IncompatibleFunctionPointerTypes>;
7818def err_typecheck_convert_incompatible_function_pointer : Error<
7819  "incompatible function pointer types "
7820  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7821  "|%diff{passing $ to parameter of type $|"
7822  "passing to parameter of different type}0,1"
7823  "|%diff{returning $ from a function with result type $|"
7824  "returning from function with different return type}0,1"
7825  "|%diff{converting $ to type $|converting between types}0,1"
7826  "|%diff{initializing $ with an expression of type $|"
7827  "initializing with expression of different type}0,1"
7828  "|%diff{sending $ to parameter of type $|"
7829  "sending to parameter of different type}0,1"
7830  "|%diff{casting $ to type $|casting between types}0,1}2"
7831  "%select{|; dereference with *|"
7832  "; take the address with &|"
7833  "; remove *|"
7834  "; remove &}3">;
7835def ext_typecheck_convert_discards_qualifiers : ExtWarn<
7836  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7837  "|%diff{passing $ to parameter of type $|"
7838  "passing to parameter of different type}0,1"
7839  "|%diff{returning $ from a function with result type $|"
7840  "returning from function with different return type}0,1"
7841  "|%diff{converting $ to type $|converting between types}0,1"
7842  "|%diff{initializing $ with an expression of type $|"
7843  "initializing with expression of different type}0,1"
7844  "|%diff{sending $ to parameter of type $|"
7845  "sending to parameter of different type}0,1"
7846  "|%diff{casting $ to type $|casting between types}0,1}2"
7847  " discards qualifiers">,
7848  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7849def err_typecheck_convert_discards_qualifiers : Error<
7850  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7851  "|%diff{passing $ to parameter of type $|"
7852  "passing to parameter of different type}0,1"
7853  "|%diff{returning $ from a function with result type $|"
7854  "returning from function with different return type}0,1"
7855  "|%diff{converting $ to type $|converting between types}0,1"
7856  "|%diff{initializing $ with an expression of type $|"
7857  "initializing with expression of different type}0,1"
7858  "|%diff{sending $ to parameter of type $|"
7859  "sending to parameter of different type}0,1"
7860  "|%diff{casting $ to type $|casting between types}0,1}2"
7861  " discards qualifiers">;
7862def ext_nested_pointer_qualifier_mismatch : ExtWarn<
7863  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7864  "|%diff{passing $ to parameter of type $|"
7865  "passing to parameter of different type}0,1"
7866  "|%diff{returning $ from a function with result type $|"
7867  "returning from function with different return type}0,1"
7868  "|%diff{converting $ to type $|converting between types}0,1"
7869  "|%diff{initializing $ with an expression of type $|"
7870  "initializing with expression of different type}0,1"
7871  "|%diff{sending $ to parameter of type $|"
7872  "sending to parameter of different type}0,1"
7873  "|%diff{casting $ to type $|casting between types}0,1}2"
7874  " discards qualifiers in nested pointer types">,
7875  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7876def err_nested_pointer_qualifier_mismatch : Error<
7877  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7878  "|%diff{passing $ to parameter of type $|"
7879  "passing to parameter of different type}0,1"
7880  "|%diff{returning $ from a function with result type $|"
7881  "returning from function with different return type}0,1"
7882  "|%diff{converting $ to type $|converting between types}0,1"
7883  "|%diff{initializing $ with an expression of type $|"
7884  "initializing with expression of different type}0,1"
7885  "|%diff{sending $ to parameter of type $|"
7886  "sending to parameter of different type}0,1"
7887  "|%diff{casting $ to type $|casting between types}0,1}2"
7888  " discards qualifiers in nested pointer types">;
7889def warn_incompatible_vectors : Warning<
7890  "incompatible vector types "
7891  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7892  "|%diff{passing $ to parameter of type $|"
7893  "passing to parameter of different type}0,1"
7894  "|%diff{returning $ from a function with result type $|"
7895  "returning from function with different return type}0,1"
7896  "|%diff{converting $ to type $|converting between types}0,1"
7897  "|%diff{initializing $ with an expression of type $|"
7898  "initializing with expression of different type}0,1"
7899  "|%diff{sending $ to parameter of type $|"
7900  "sending to parameter of different type}0,1"
7901  "|%diff{casting $ to type $|casting between types}0,1}2">,
7902  InGroup<VectorConversion>, DefaultIgnore;
7903def err_incompatible_vectors : Error<
7904  "incompatible vector types "
7905  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7906  "|%diff{passing $ to parameter of type $|"
7907  "passing to parameter of different type}0,1"
7908  "|%diff{returning $ from a function with result type $|"
7909  "returning from function with different return type}0,1"
7910  "|%diff{converting $ to type $|converting between types}0,1"
7911  "|%diff{initializing $ with an expression of type $|"
7912  "initializing with expression of different type}0,1"
7913  "|%diff{sending $ to parameter of type $|"
7914  "sending to parameter of different type}0,1"
7915  "|%diff{casting $ to type $|casting between types}0,1}2">;
7916def err_int_to_block_pointer : Error<
7917  "invalid block pointer conversion "
7918  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7919  "|%diff{passing $ to parameter of type $|"
7920  "passing to parameter of different type}0,1"
7921  "|%diff{returning $ from a function with result type $|"
7922  "returning from function with different return type}0,1"
7923  "|%diff{converting $ to type $|converting between types}0,1"
7924  "|%diff{initializing $ with an expression of type $|"
7925  "initializing with expression of different type}0,1"
7926  "|%diff{sending $ to parameter of type $|"
7927  "sending to parameter of different type}0,1"
7928  "|%diff{casting $ to type $|casting between types}0,1}2">;
7929def err_typecheck_convert_incompatible_block_pointer : Error<
7930  "incompatible block pointer types "
7931  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7932  "|%diff{passing $ to parameter of type $|"
7933  "passing to parameter of different type}0,1"
7934  "|%diff{returning $ from a function with result type $|"
7935  "returning from function with different return type}0,1"
7936  "|%diff{converting $ to type $|converting between types}0,1"
7937  "|%diff{initializing $ with an expression of type $|"
7938  "initializing with expression of different type}0,1"
7939  "|%diff{sending $ to parameter of type $|"
7940  "sending to parameter of different type}0,1"
7941  "|%diff{casting $ to type $|casting between types}0,1}2">;
7942def err_typecheck_incompatible_address_space : Error<
7943  "%select{%diff{assigning $ to $|assigning to different types}1,0"
7944  "|%diff{passing $ to parameter of type $|"
7945  "passing to parameter of different type}0,1"
7946  "|%diff{returning $ from a function with result type $|"
7947  "returning from function with different return type}0,1"
7948  "|%diff{converting $ to type $|converting between types}0,1"
7949  "|%diff{initializing $ with an expression of type $|"
7950  "initializing with expression of different type}0,1"
7951  "|%diff{sending $ to parameter of type $|"
7952  "sending to parameter of different type}0,1"
7953  "|%diff{casting $ to type $|casting between types}0,1}2"
7954  " changes address space of pointer">;
7955def err_typecheck_incompatible_nested_address_space : Error<
7956  "%select{%diff{assigning $ to $|assigning to different types}1,0"
7957  "|%diff{passing $ to parameter of type $|"
7958  "passing to parameter of different type}0,1"
7959  "|%diff{returning $ from a function with result type $|"
7960  "returning from function with different return type}0,1"
7961  "|%diff{converting $ to type $|converting between types}0,1"
7962  "|%diff{initializing $ with an expression of type $|"
7963  "initializing with expression of different type}0,1"
7964  "|%diff{sending $ to parameter of type $|"
7965  "sending to parameter of different type}0,1"
7966  "|%diff{casting $ to type $|casting between types}0,1}2"
7967  " changes address space of nested pointer">;
7968def err_typecheck_incompatible_ownership : Error<
7969  "%select{%diff{assigning $ to $|assigning to different types}1,0"
7970  "|%diff{passing $ to parameter of type $|"
7971  "passing to parameter of different type}0,1"
7972  "|%diff{returning $ from a function with result type $|"
7973  "returning from function with different return type}0,1"
7974  "|%diff{converting $ to type $|converting between types}0,1"
7975  "|%diff{initializing $ with an expression of type $|"
7976  "initializing with expression of different type}0,1"
7977  "|%diff{sending $ to parameter of type $|"
7978  "sending to parameter of different type}0,1"
7979  "|%diff{casting $ to type $|casting between types}0,1}2"
7980  " changes retain/release properties of pointer">;
7981def err_typecheck_comparison_of_distinct_blocks : Error<
7982  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
7983
7984def err_typecheck_array_not_modifiable_lvalue : Error<
7985  "array type %0 is not assignable">;
7986def err_typecheck_non_object_not_modifiable_lvalue : Error<
7987  "non-object type %0 is not assignable">;
7988def err_typecheck_expression_not_modifiable_lvalue : Error<
7989  "expression is not assignable">;
7990def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
7991  "incomplete type %0 is not assignable">;
7992def err_typecheck_lvalue_casts_not_supported : Error<
7993  "assignment to cast is illegal, lvalue casts are not supported">;
7994
7995def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
7996  "vector is not assignable (contains duplicate components)">;
7997def err_block_decl_ref_not_modifiable_lvalue : Error<
7998  "variable is not assignable (missing __block type specifier)">;
7999def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8000  "cannot assign to a variable captured by copy in a non-mutable lambda">;
8001def err_typecheck_call_not_function : Error<
8002  "called object type %0 is not a function or function pointer">;
8003def err_call_incomplete_return : Error<
8004  "calling function with incomplete return type %0">;
8005def err_call_function_incomplete_return : Error<
8006  "calling %0 with incomplete return type %1">;
8007def err_call_incomplete_argument : Error<
8008  "argument type %0 is incomplete">;
8009def err_typecheck_call_too_few_args : Error<
8010  "too few %select{|||execution configuration }0arguments to "
8011  "%select{function|block|method|kernel function}0 call, "
8012  "expected %1, have %2">;
8013def err_typecheck_call_too_few_args_one : Error<
8014  "too few %select{|||execution configuration }0arguments to "
8015  "%select{function|block|method|kernel function}0 call, "
8016  "single argument %1 was not specified">;
8017def err_typecheck_call_too_few_args_at_least : Error<
8018  "too few %select{|||execution configuration }0arguments to "
8019  "%select{function|block|method|kernel function}0 call, "
8020  "expected at least %1, have %2">;
8021def err_typecheck_call_too_few_args_at_least_one : Error<
8022  "too few %select{|||execution configuration }0arguments to "
8023  "%select{function|block|method|kernel function}0 call, "
8024  "at least argument %1 must be specified">;
8025def err_typecheck_call_too_few_args_suggest : Error<
8026  "too few %select{|||execution configuration }0arguments to "
8027  "%select{function|block|method|kernel function}0 call, "
8028  "expected %1, have %2; did you mean %3?">;
8029def err_typecheck_call_too_few_args_at_least_suggest : Error<
8030  "too few %select{|||execution configuration }0arguments to "
8031  "%select{function|block|method|kernel function}0 call, "
8032  "expected at least %1, have %2; did you mean %3?">;
8033def err_typecheck_call_too_many_args : Error<
8034  "too many %select{|||execution configuration }0arguments to "
8035  "%select{function|block|method|kernel function}0 call, "
8036  "expected %1, have %2">;
8037def err_typecheck_call_too_many_args_one : Error<
8038  "too many %select{|||execution configuration }0arguments to "
8039  "%select{function|block|method|kernel function}0 call, "
8040  "expected single argument %1, have %2 arguments">;
8041def err_typecheck_call_too_many_args_at_most : Error<
8042  "too many %select{|||execution configuration }0arguments to "
8043  "%select{function|block|method|kernel function}0 call, "
8044  "expected at most %1, have %2">;
8045def err_typecheck_call_too_many_args_at_most_one : Error<
8046  "too many %select{|||execution configuration }0arguments to "
8047  "%select{function|block|method|kernel function}0 call, "
8048  "expected at most single argument %1, have %2 arguments">;
8049def err_typecheck_call_too_many_args_suggest : Error<
8050  "too many %select{|||execution configuration }0arguments to "
8051  "%select{function|block|method|kernel function}0 call, "
8052  "expected %1, have %2; did you mean %3?">;
8053def err_typecheck_call_too_many_args_at_most_suggest : Error<
8054  "too many %select{|||execution configuration }0arguments to "
8055  "%select{function|block|method|kernel function}0 call, "
8056  "expected at most %1, have %2; did you mean %3?">;
8057
8058def err_arc_typecheck_convert_incompatible_pointer : Error<
8059  "incompatible pointer types passing retainable parameter of type %0"
8060  "to a CF function expecting %1 type">;
8061
8062def err_builtin_fn_use : Error<"builtin functions must be directly called">;
8063
8064def warn_call_wrong_number_of_arguments : Warning<
8065  "too %select{few|many}0 arguments in call to %1">;
8066def err_atomic_builtin_must_be_pointer : Error<
8067  "address argument to atomic builtin must be a pointer (%0 invalid)">;
8068def err_atomic_builtin_must_be_pointer_intptr : Error<
8069  "address argument to atomic builtin must be a pointer to integer or pointer"
8070  " (%0 invalid)">;
8071def err_atomic_builtin_cannot_be_const : Error<
8072  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
8073def err_atomic_builtin_must_be_pointer_intfltptr : Error<
8074  "address argument to atomic builtin must be a pointer to integer,"
8075  " floating-point or pointer (%0 invalid)">;
8076def err_atomic_builtin_pointer_size : Error<
8077  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
8078  "type (%0 invalid)">;
8079def err_atomic_exclusive_builtin_pointer_size : Error<
8080  "address argument to load or store exclusive builtin must be a pointer to"
8081  " 1,2,4 or 8 byte type (%0 invalid)">;
8082def err_atomic_builtin_ext_int_size : Error<
8083  "Atomic memory operand must have a power-of-two size">;
8084def err_atomic_builtin_ext_int_prohibit : Error<
8085  "argument to atomic builtin of type '_ExtInt' is not supported">;
8086def err_atomic_op_needs_atomic : Error<
8087  "address argument to atomic operation must be a pointer to _Atomic "
8088  "type (%0 invalid)">;
8089def err_atomic_op_needs_non_const_atomic : Error<
8090  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
8091  "type (%1 invalid)">;
8092def err_atomic_op_needs_non_const_pointer : Error<
8093  "address argument to atomic operation must be a pointer to non-const "
8094  "type (%0 invalid)">;
8095def err_atomic_op_needs_trivial_copy : Error<
8096  "address argument to atomic operation must be a pointer to a "
8097  "trivially-copyable type (%0 invalid)">;
8098def err_atomic_op_needs_atomic_int_or_ptr : Error<
8099  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8100  "integer or pointer (%1 invalid)">;
8101def err_atomic_op_needs_atomic_int : Error<
8102  "address argument to atomic operation must be a pointer to "
8103  "%select{|atomic }0integer (%1 invalid)">;
8104def warn_atomic_op_has_invalid_memory_order : Warning<
8105  "memory order argument to atomic operation is invalid">,
8106  InGroup<DiagGroup<"atomic-memory-ordering">>;
8107def err_atomic_op_has_invalid_synch_scope : Error<
8108  "synchronization scope argument to atomic operation is invalid">;
8109def warn_atomic_implicit_seq_cst : Warning<
8110  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
8111  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
8112
8113def err_overflow_builtin_must_be_int : Error<
8114  "operand argument to overflow builtin must be an integer (%0 invalid)">;
8115def err_overflow_builtin_must_be_ptr_int : Error<
8116  "result argument to overflow builtin must be a pointer "
8117  "to a non-const integer (%0 invalid)">;
8118def err_overflow_builtin_ext_int_max_size : Error<
8119  "__builtin_mul_overflow does not support signed _ExtInt operands of more "
8120  "than %0 bits">;
8121
8122def err_atomic_load_store_uses_lib : Error<
8123  "atomic %select{load|store}0 requires runtime support that is not "
8124  "available for this target">;
8125
8126def err_nontemporal_builtin_must_be_pointer : Error<
8127  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
8128def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
8129  "address argument to nontemporal builtin must be a pointer to integer, float, "
8130  "pointer, or a vector of such types (%0 invalid)">;
8131
8132def err_deleted_function_use : Error<"attempt to use a deleted function">;
8133def err_deleted_inherited_ctor_use : Error<
8134  "constructor inherited by %0 from base class %1 is implicitly deleted">;
8135
8136def note_called_by : Note<"called by %0">;
8137def err_kern_type_not_void_return : Error<
8138  "kernel function type %0 must have void return type">;
8139def err_kern_is_nonstatic_method : Error<
8140  "kernel function %0 must be a free function or static member function">;
8141def err_config_scalar_return : Error<
8142  "CUDA special function '%0' must have scalar return type">;
8143def err_kern_call_not_global_function : Error<
8144  "kernel call to non-global function %0">;
8145def err_global_call_not_config : Error<
8146  "call to global function %0 not configured">;
8147def err_ref_bad_target : Error<
8148  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8149  "function %1 in %select{__device__|__global__|__host__|__host__ __device__}2 function">;
8150def err_ref_bad_target_global_initializer : Error<
8151  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8152  "function %1 in global initializer">;
8153def err_capture_bad_target : Error<
8154  "capture host variable %0 by reference in device or host device lambda function">;
8155def err_capture_bad_target_this_ptr : Error<
8156  "capture host side class data member by this pointer in device or host device lambda function">;
8157def warn_kern_is_method : Extension<
8158  "kernel function %0 is a member function; this may not be accepted by nvcc">,
8159  InGroup<CudaCompat>;
8160def warn_kern_is_inline : Warning<
8161  "ignored 'inline' attribute on kernel function %0">,
8162  InGroup<CudaCompat>;
8163def err_variadic_device_fn : Error<
8164  "CUDA device code does not support variadic functions">;
8165def err_va_arg_in_device : Error<
8166  "CUDA device code does not support va_arg">;
8167def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
8168def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8169  "constexpr function %0 without __host__ or __device__ attributes cannot "
8170  "overload __device__ function with same signature.  Add a __host__ "
8171  "attribute, or build with -fno-cuda-host-device-constexpr.">;
8172def note_cuda_conflicting_device_function_declared_here : Note<
8173  "conflicting __device__ function declared here">;
8174def err_cuda_device_exceptions : Error<
8175  "cannot use '%0' in "
8176  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8177def err_dynamic_var_init : Error<
8178    "dynamic initialization is not supported for "
8179    "__device__, __constant__, and __shared__ variables.">;
8180def err_shared_var_init : Error<
8181    "initialization is not supported for __shared__ variables.">;
8182def err_cuda_vla : Error<
8183    "cannot use variable-length arrays in "
8184    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8185def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8186def err_cuda_host_shared : Error<
8187    "__shared__ local variables not allowed in "
8188    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8189def err_cuda_nonstatic_constdev: Error<"__constant__ and __device__ are not allowed on non-static local variables">;
8190def err_cuda_ovl_target : Error<
8191  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8192  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8193def note_cuda_ovl_candidate_target_mismatch : Note<
8194    "candidate template ignored: target attributes do not match">;
8195
8196def err_cuda_device_builtin_surftex_cls_template : Error<
8197    "illegal device builtin %select{surface|texture}0 reference "
8198    "class template %1 declared here">;
8199def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8200    "%0 needs to have exactly %1 template parameters">;
8201def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8202    "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8203    "%select{a type|an integer or enum value}2">;
8204
8205def err_cuda_device_builtin_surftex_ref_decl : Error<
8206    "illegal device builtin %select{surface|texture}0 reference "
8207    "type %1 declared here">;
8208def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8209    "%0 needs to be instantiated from a class template with proper "
8210    "template arguments">;
8211
8212def warn_non_pod_vararg_with_format_string : Warning<
8213  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8214  "%select{function|block|method|constructor}2; expected type from format "
8215  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8216// The arguments to this diagnostic should match the warning above.
8217def err_cannot_pass_objc_interface_to_vararg_format : Error<
8218  "cannot pass object with interface type %1 by value to variadic "
8219  "%select{function|block|method|constructor}2; expected type from format "
8220  "string was %3">;
8221def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8222  "cannot pass non-trivial C object of type %0 by value to variadic "
8223  "%select{function|block|method|constructor}1">;
8224
8225
8226def err_cannot_pass_objc_interface_to_vararg : Error<
8227  "cannot pass object with interface type %0 by value through variadic "
8228  "%select{function|block|method|constructor}1">;
8229def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8230  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8231  " %select{function|block|method|constructor}2; call will abort at runtime">,
8232  InGroup<NonPODVarargs>, DefaultError;
8233def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8234  "passing object of trivial but non-POD type %0 through variadic"
8235  " %select{function|block|method|constructor}1 is incompatible with C++98">,
8236  InGroup<CXX98Compat>, DefaultIgnore;
8237def warn_pass_class_arg_to_vararg : Warning<
8238  "passing object of class type %0 through variadic "
8239  "%select{function|block|method|constructor}1"
8240  "%select{|; did you mean to call '%3'?}2">,
8241  InGroup<ClassVarargs>, DefaultIgnore;
8242def err_cannot_pass_to_vararg : Error<
8243  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8244  "%select{function|block|method|constructor}2">;
8245def err_cannot_pass_to_vararg_format : Error<
8246  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8247  "%select{function|block|method|constructor}2; expected type from format "
8248  "string was %3">;
8249
8250def err_typecheck_call_invalid_ordered_compare : Error<
8251  "ordered compare requires two args of floating point type"
8252  "%diff{ ($ and $)|}0,1">;
8253def err_typecheck_call_invalid_unary_fp : Error<
8254  "floating point classification requires argument of floating point type "
8255  "(passed in %0)">;
8256def err_typecheck_cond_expect_int_float : Error<
8257  "used type %0 where integer or floating point type is required">;
8258def err_typecheck_cond_expect_scalar : Error<
8259  "used type %0 where arithmetic or pointer type is required">;
8260def err_typecheck_cond_expect_nonfloat : Error<
8261  "used type %0 where floating point type is not allowed">;
8262def ext_typecheck_cond_one_void : Extension<
8263  "C99 forbids conditional expressions with only one void side">;
8264def err_typecheck_cast_to_incomplete : Error<
8265  "cast to incomplete type %0">;
8266def ext_typecheck_cast_nonscalar : Extension<
8267  "C99 forbids casting nonscalar type %0 to the same type">;
8268def ext_typecheck_cast_to_union : Extension<
8269  "cast to union type is a GNU extension">,
8270  InGroup<GNUUnionCast>;
8271def err_typecheck_cast_to_union_no_type : Error<
8272  "cast to union type from type %0 not present in union">;
8273def err_cast_pointer_from_non_pointer_int : Error<
8274  "operand of type %0 cannot be cast to a pointer type">;
8275def warn_cast_pointer_from_sel : Warning<
8276  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8277  InGroup<SelTypeCast>;
8278def warn_function_def_in_objc_container : Warning<
8279  "function definition inside an Objective-C container is deprecated">,
8280  InGroup<FunctionDefInObjCContainer>;
8281def err_typecheck_call_requires_real_fp : Error<
8282  "argument type %0 is not a real floating point type">;
8283def err_typecheck_call_different_arg_types : Error<
8284  "arguments are of different types%diff{ ($ vs $)|}0,1">;
8285
8286def warn_cast_calling_conv : Warning<
8287  "cast between incompatible calling conventions '%0' and '%1'; "
8288  "calls through this pointer may abort at runtime">,
8289  InGroup<DiagGroup<"cast-calling-convention">>;
8290def note_change_calling_conv_fixit : Note<
8291  "consider defining %0 with the '%1' calling convention">;
8292def warn_bad_function_cast : Warning<
8293  "cast from function call of type %0 to non-matching type %1">,
8294  InGroup<BadFunctionCast>, DefaultIgnore;
8295def err_cast_pointer_to_non_pointer_int : Error<
8296  "pointer cannot be cast to type %0">;
8297def err_cast_to_bfloat16 : Error<"cannot type-cast to __bf16">;
8298def err_cast_from_bfloat16 : Error<"cannot type-cast from __bf16">;
8299def err_typecheck_expect_scalar_operand : Error<
8300  "operand of type %0 where arithmetic or pointer type is required">;
8301def err_typecheck_cond_incompatible_operands : Error<
8302  "incompatible operand types%diff{ ($ and $)|}0,1">;
8303def err_cast_selector_expr : Error<
8304  "cannot type cast @selector expression">;
8305def ext_typecheck_cond_incompatible_pointers : ExtWarn<
8306  "pointer type mismatch%diff{ ($ and $)|}0,1">,
8307  InGroup<DiagGroup<"pointer-type-mismatch">>;
8308def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
8309  "pointer/integer type mismatch in conditional expression"
8310  "%diff{ ($ and $)|}0,1">,
8311  InGroup<DiagGroup<"conditional-type-mismatch">>;
8312def err_typecheck_choose_expr_requires_constant : Error<
8313  "'__builtin_choose_expr' requires a constant expression">;
8314def warn_unused_expr : Warning<"expression result unused">,
8315  InGroup<UnusedValue>;
8316def warn_unused_voidptr : Warning<
8317  "expression result unused; should this cast be to 'void'?">,
8318  InGroup<UnusedValue>;
8319def warn_unused_property_expr : Warning<
8320 "property access result unused - getters should not be used for side effects">,
8321  InGroup<UnusedGetterReturnValue>;
8322def warn_unused_container_subscript_expr : Warning<
8323 "container access result unused - container access should not be used for side effects">,
8324  InGroup<UnusedValue>;
8325def warn_unused_call : Warning<
8326  "ignoring return value of function declared with %0 attribute">,
8327  InGroup<UnusedValue>;
8328def warn_unused_constructor : Warning<
8329  "ignoring temporary created by a constructor declared with %0 attribute">,
8330  InGroup<UnusedValue>;
8331def warn_unused_constructor_msg : Warning<
8332  "ignoring temporary created by a constructor declared with %0 attribute: %1">,
8333  InGroup<UnusedValue>;
8334def warn_side_effects_unevaluated_context : Warning<
8335  "expression with side effects has no effect in an unevaluated context">,
8336  InGroup<UnevaluatedExpression>;
8337def warn_side_effects_typeid : Warning<
8338  "expression with side effects will be evaluated despite being used as an "
8339  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
8340def warn_unused_result : Warning<
8341  "ignoring return value of function declared with %0 attribute">,
8342  InGroup<UnusedResult>;
8343def warn_unused_result_msg : Warning<
8344  "ignoring return value of function declared with %0 attribute: %1">,
8345  InGroup<UnusedResult>;
8346def warn_unused_volatile : Warning<
8347  "expression result unused; assign into a variable to force a volatile load">,
8348  InGroup<DiagGroup<"unused-volatile-lvalue">>;
8349
8350def ext_cxx14_attr : Extension<
8351  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
8352def ext_cxx17_attr : Extension<
8353  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17>;
8354def ext_cxx20_attr : Extension<
8355  "use of the %0 attribute is a C++20 extension">, InGroup<CXX20>;
8356
8357def warn_unused_comparison : Warning<
8358  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
8359  InGroup<UnusedComparison>;
8360def note_inequality_comparison_to_or_assign : Note<
8361  "use '|=' to turn this inequality comparison into an or-assignment">;
8362
8363def err_incomplete_type_used_in_type_trait_expr : Error<
8364  "incomplete type %0 used in type trait expression">;
8365
8366// C++20 constinit and require_constant_initialization attribute
8367def warn_cxx20_compat_constinit : Warning<
8368  "'constinit' specifier is incompatible with C++ standards before C++20">,
8369  InGroup<CXX20Compat>, DefaultIgnore;
8370def err_constinit_local_variable : Error<
8371  "local variable cannot be declared 'constinit'">;
8372def err_require_constant_init_failed : Error<
8373  "variable does not have a constant initializer">;
8374def note_declared_required_constant_init_here : Note<
8375  "required by %select{'require_constant_initialization' attribute|"
8376  "'constinit' specifier}0 here">;
8377def ext_constinit_missing : ExtWarn<
8378  "'constinit' specifier missing on initializing declaration of %0">,
8379  InGroup<DiagGroup<"missing-constinit">>;
8380def note_constinit_specified_here : Note<"variable declared constinit here">;
8381def err_constinit_added_too_late : Error<
8382  "'constinit' specifier added after initialization of variable">;
8383def warn_require_const_init_added_too_late : Warning<
8384  "'require_constant_initialization' attribute added after initialization "
8385  "of variable">, InGroup<IgnoredAttributes>;
8386def note_constinit_missing_here : Note<
8387  "add the "
8388  "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
8389  "to the initializing declaration here">;
8390
8391def err_dimension_expr_not_constant_integer : Error<
8392  "dimension expression does not evaluate to a constant unsigned int">;
8393
8394def err_typecheck_cond_incompatible_operands_null : Error<
8395  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
8396def ext_empty_struct_union : Extension<
8397  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
8398def ext_no_named_members_in_struct_union : Extension<
8399  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
8400def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
8401  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8402  InGroup<CXXCompat>, DefaultIgnore;
8403def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
8404  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8405  InGroup<ExternCCompat>;
8406def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
8407  "volatile qualifiers|const qualifier|volatile qualifier}2">,
8408  InGroup<CastQual>, DefaultIgnore;
8409def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
8410  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
8411def warn_redefine_extname_not_applied : Warning<
8412  "#pragma redefine_extname is applicable to external C declarations only; "
8413  "not applied to %select{function|variable}0 %1">,
8414  InGroup<Pragmas>;
8415} // End of general sema category.
8416
8417// inline asm.
8418let CategoryName = "Inline Assembly Issue" in {
8419  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
8420  def err_asm_invalid_output_constraint : Error<
8421    "invalid output constraint '%0' in asm">;
8422  def err_asm_invalid_lvalue_in_input : Error<
8423    "invalid lvalue in asm input for constraint '%0'">;
8424  def err_asm_invalid_input_constraint : Error<
8425    "invalid input constraint '%0' in asm">;
8426  def err_asm_tying_incompatible_types : Error<
8427    "unsupported inline asm: input with type "
8428    "%diff{$ matching output with type $|}0,1">;
8429  def err_asm_unexpected_constraint_alternatives : Error<
8430    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
8431  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
8432  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
8433  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
8434    "global register variables on this target">;
8435  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
8436    "match variable size">;
8437  def err_asm_bad_register_type : Error<"bad type for named register variable">;
8438  def err_asm_invalid_input_size : Error<
8439    "invalid input size for constraint '%0'">;
8440  def err_asm_invalid_output_size : Error<
8441    "invalid output size for constraint '%0'">;
8442  def err_invalid_asm_cast_lvalue : Error<
8443    "invalid use of a cast in a inline asm context requiring an l-value: "
8444    "remove the cast or build with -fheinous-gnu-extensions">;
8445  def err_invalid_asm_value_for_constraint
8446      : Error <"value '%0' out of range for constraint '%1'">;
8447  def err_asm_non_addr_value_in_memory_constraint : Error <
8448    "reference to a %select{bit-field|vector element|global register variable}0"
8449    " in asm %select{input|output}1 with a memory constraint '%2'">;
8450  def err_asm_input_duplicate_match : Error<
8451    "more than one input constraint matches the same output '%0'">;
8452
8453  def warn_asm_label_on_auto_decl : Warning<
8454    "ignored asm label '%0' on automatic variable">;
8455  def warn_invalid_asm_cast_lvalue : Warning<
8456    "invalid use of a cast in an inline asm context requiring an l-value: "
8457    "accepted due to -fheinous-gnu-extensions, but clang may remove support "
8458    "for this in the future">;
8459  def warn_asm_mismatched_size_modifier : Warning<
8460    "value size does not match register size specified by the constraint "
8461    "and modifier">,
8462    InGroup<ASMOperandWidths>;
8463
8464  def note_asm_missing_constraint_modifier : Note<
8465    "use constraint modifier \"%0\"">;
8466  def note_asm_input_duplicate_first : Note<
8467    "constraint '%0' is already present here">;
8468 def error_duplicate_asm_operand_name : Error<
8469    "duplicate use of asm operand name \"%0\"">;
8470 def note_duplicate_asm_operand_name : Note<
8471    "asm operand name \"%0\" first referenced here">;
8472}
8473
8474  def error_inoutput_conflict_with_clobber : Error<
8475    "asm-specifier for input or output variable conflicts with asm"
8476    " clobber list">;
8477
8478let CategoryName = "Semantic Issue" in {
8479
8480def err_invalid_conversion_between_vectors : Error<
8481  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
8482  "size">;
8483def err_invalid_conversion_between_vector_and_integer : Error<
8484  "invalid conversion between vector type %0 and integer type %1 "
8485  "of different size">;
8486
8487def err_opencl_function_pointer : Error<
8488  "pointers to functions are not allowed">;
8489
8490def err_opencl_taking_address_capture : Error<
8491  "taking address of a capture is not allowed">;
8492
8493def err_invalid_conversion_between_vector_and_scalar : Error<
8494  "invalid conversion between vector type %0 and scalar type %1">;
8495
8496// C++ member initializers.
8497def err_only_constructors_take_base_inits : Error<
8498  "only constructors take base initializers">;
8499
8500def err_multiple_mem_initialization : Error <
8501  "multiple initializations given for non-static member %0">;
8502def err_multiple_mem_union_initialization : Error <
8503  "initializing multiple members of union">;
8504def err_multiple_base_initialization : Error <
8505  "multiple initializations given for base %0">;
8506
8507def err_mem_init_not_member_or_class : Error<
8508  "member initializer %0 does not name a non-static data member or base "
8509  "class">;
8510
8511def warn_initializer_out_of_order : Warning<
8512  "%select{field|base class}0 %1 will be initialized after "
8513  "%select{field|base}2 %3">,
8514  InGroup<ReorderCtor>, DefaultIgnore;
8515def warn_abstract_vbase_init_ignored : Warning<
8516  "initializer for virtual base class %0 of abstract class %1 "
8517  "will never be used">,
8518  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
8519
8520def err_base_init_does_not_name_class : Error<
8521  "constructor initializer %0 does not name a class">;
8522def err_base_init_direct_and_virtual : Error<
8523  "base class initializer %0 names both a direct base class and an "
8524  "inherited virtual base class">;
8525def err_not_direct_base_or_virtual : Error<
8526  "type %0 is not a direct or virtual base of %1">;
8527
8528def err_in_class_initializer_non_const : Error<
8529  "non-const static data member must be initialized out of line">;
8530def err_in_class_initializer_volatile : Error<
8531  "static const volatile data member must be initialized out of line">;
8532def err_in_class_initializer_bad_type : Error<
8533  "static data member of type %0 must be initialized out of line">;
8534def ext_in_class_initializer_float_type : ExtWarn<
8535  "in-class initializer for static data member of type %0 is a GNU extension">,
8536  InGroup<GNUStaticFloatInit>;
8537def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
8538  "in-class initializer for static data member of type %0 requires "
8539  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
8540def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
8541def err_in_class_initializer_literal_type : Error<
8542  "in-class initializer for static data member of type %0 requires "
8543  "'constexpr' specifier">;
8544def err_in_class_initializer_non_constant : Error<
8545  "in-class initializer for static data member is not a constant expression">;
8546def err_default_member_initializer_not_yet_parsed : Error<
8547  "default member initializer for %1 needed within definition of enclosing "
8548  "class %0 outside of member functions">;
8549def note_default_member_initializer_not_yet_parsed : Note<
8550  "default member initializer declared here">;
8551def err_default_member_initializer_cycle
8552    : Error<"default member initializer for %0 uses itself">;
8553
8554def ext_in_class_initializer_non_constant : Extension<
8555  "in-class initializer for static data member is not a constant expression; "
8556  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
8557
8558def err_thread_dynamic_init : Error<
8559  "initializer for thread-local variable must be a constant expression">;
8560def err_thread_nontrivial_dtor : Error<
8561  "type of thread-local variable has non-trivial destruction">;
8562def note_use_thread_local : Note<
8563  "use 'thread_local' to allow this">;
8564
8565// C++ anonymous unions and GNU anonymous structs/unions
8566def ext_anonymous_union : Extension<
8567  "anonymous unions are a C11 extension">, InGroup<C11>;
8568def ext_gnu_anonymous_struct : Extension<
8569  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
8570def ext_c11_anonymous_struct : Extension<
8571  "anonymous structs are a C11 extension">, InGroup<C11>;
8572def err_anonymous_union_not_static : Error<
8573  "anonymous unions at namespace or global scope must be declared 'static'">;
8574def err_anonymous_union_with_storage_spec : Error<
8575  "anonymous union at class scope must not have a storage specifier">;
8576def err_anonymous_struct_not_member : Error<
8577  "anonymous %select{structs|structs and classes}0 must be "
8578  "%select{struct or union|class}0 members">;
8579def err_anonymous_record_member_redecl : Error<
8580  "member of anonymous %select{struct|union}0 redeclares %1">;
8581def err_anonymous_record_with_type : Error<
8582  "types cannot be declared in an anonymous %select{struct|union}0">;
8583def ext_anonymous_record_with_type : Extension<
8584  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
8585  "extension">, InGroup<MicrosoftAnonTag>;
8586def ext_anonymous_record_with_anonymous_type : Extension<
8587  "anonymous types declared in an anonymous %select{struct|union}0 "
8588  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
8589def err_anonymous_record_with_function : Error<
8590  "functions cannot be declared in an anonymous %select{struct|union}0">;
8591def err_anonymous_record_with_static : Error<
8592  "static members cannot be declared in an anonymous %select{struct|union}0">;
8593def err_anonymous_record_bad_member : Error<
8594  "anonymous %select{struct|union}0 can only contain non-static data members">;
8595def err_anonymous_record_nonpublic_member : Error<
8596  "anonymous %select{struct|union}0 cannot contain a "
8597  "%select{private|protected}1 data member">;
8598def ext_ms_anonymous_record : ExtWarn<
8599  "anonymous %select{structs|unions}0 are a Microsoft extension">,
8600  InGroup<MicrosoftAnonTag>;
8601
8602// C++ local classes
8603def err_reference_to_local_in_enclosing_context : Error<
8604  "reference to local %select{variable|binding}1 %0 declared in enclosing "
8605  "%select{%3|block literal|lambda expression|context}2">;
8606
8607def err_static_data_member_not_allowed_in_local_class : Error<
8608  "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
8609
8610// C++ derived classes
8611def err_base_clause_on_union : Error<"unions cannot have base classes">;
8612def err_base_must_be_class : Error<"base specifier must name a class">;
8613def err_union_as_base_class : Error<"unions cannot be base classes">;
8614def err_circular_inheritance : Error<
8615  "circular inheritance between %0 and %1">;
8616def err_base_class_has_flexible_array_member : Error<
8617  "base class %0 has a flexible array member">;
8618def err_incomplete_base_class : Error<"base class has incomplete type">;
8619def err_duplicate_base_class : Error<
8620  "base class %0 specified more than once as a direct base class">;
8621def warn_inaccessible_base_class : Warning<
8622  "direct base %0 is inaccessible due to ambiguity:%1">,
8623  InGroup<DiagGroup<"inaccessible-base">>;
8624// FIXME: better way to display derivation?  Pass entire thing into diagclient?
8625def err_ambiguous_derived_to_base_conv : Error<
8626  "ambiguous conversion from derived class %0 to base class %1:%2">;
8627def err_ambiguous_memptr_conv : Error<
8628  "ambiguous conversion from pointer to member of %select{base|derived}0 "
8629  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
8630def ext_ms_ambiguous_direct_base : ExtWarn<
8631  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
8632  InGroup<MicrosoftInaccessibleBase>;
8633
8634def err_memptr_conv_via_virtual : Error<
8635  "conversion from pointer to member of class %0 to pointer to member "
8636  "of class %1 via virtual base %2 is not allowed">;
8637
8638// C++ member name lookup
8639def err_ambiguous_member_multiple_subobjects : Error<
8640  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
8641def err_ambiguous_member_multiple_subobject_types : Error<
8642  "member %0 found in multiple base classes of different types">;
8643def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
8644def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
8645def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
8646def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
8647  "declaration in a different namespace">;
8648def note_hidden_tag : Note<"type declaration hidden">;
8649def note_hiding_object : Note<"declaration hides type">;
8650
8651// C++ operator overloading
8652def err_operator_overload_needs_class_or_enum : Error<
8653  "overloaded %0 must have at least one parameter of class "
8654  "or enumeration type">;
8655
8656def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
8657def err_operator_overload_static : Error<
8658  "overloaded %0 cannot be a static member function">;
8659def err_operator_overload_default_arg : Error<
8660  "parameter of overloaded %0 cannot have a default argument">;
8661def err_operator_overload_must_be : Error<
8662  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
8663  "(has %1 parameter%s1)">;
8664
8665def err_operator_overload_must_be_member : Error<
8666  "overloaded %0 must be a non-static member function">;
8667def err_operator_overload_post_incdec_must_be_int : Error<
8668  "parameter of overloaded post-%select{increment|decrement}1 operator must "
8669  "have type 'int' (not %0)">;
8670
8671// C++ allocation and deallocation functions.
8672def err_operator_new_delete_declared_in_namespace : Error<
8673  "%0 cannot be declared inside a namespace">;
8674def err_operator_new_delete_declared_static : Error<
8675  "%0 cannot be declared static in global scope">;
8676def ext_operator_new_delete_declared_inline : ExtWarn<
8677  "replacement function %0 cannot be declared 'inline'">,
8678  InGroup<DiagGroup<"inline-new-delete">>;
8679def err_operator_new_delete_invalid_result_type : Error<
8680  "%0 must return type %1">;
8681def err_operator_new_delete_dependent_result_type : Error<
8682  "%0 cannot have a dependent return type; use %1 instead">;
8683def err_operator_new_delete_too_few_parameters : Error<
8684  "%0 must have at least one parameter">;
8685def err_operator_new_delete_template_too_few_parameters : Error<
8686  "%0 template must have at least two parameters">;
8687def warn_operator_new_returns_null : Warning<
8688  "%0 should not return a null pointer unless it is declared 'throw()'"
8689  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
8690
8691def err_operator_new_dependent_param_type : Error<
8692  "%0 cannot take a dependent type as first parameter; "
8693  "use size_t (%1) instead">;
8694def err_operator_new_param_type : Error<
8695  "%0 takes type size_t (%1) as first parameter">;
8696def err_operator_new_default_arg: Error<
8697  "parameter of %0 cannot have a default argument">;
8698def err_operator_delete_dependent_param_type : Error<
8699  "%0 cannot take a dependent type as first parameter; use %1 instead">;
8700def err_operator_delete_param_type : Error<
8701  "first parameter of %0 must have type %1">;
8702def err_destroying_operator_delete_not_usual : Error<
8703  "destroying operator delete can have only an optional size and optional "
8704  "alignment parameter">;
8705def note_implicit_delete_this_in_destructor_here : Note<
8706  "while checking implicit 'delete this' for virtual destructor">;
8707def err_builtin_operator_new_delete_not_usual : Error<
8708  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
8709  "selects non-usual %select{allocation|deallocation}0 function">;
8710def note_non_usual_function_declared_here : Note<
8711  "non-usual %0 declared here">;
8712
8713// C++ literal operators
8714def err_literal_operator_outside_namespace : Error<
8715  "literal operator %0 must be in a namespace or global scope">;
8716def err_literal_operator_id_outside_namespace : Error<
8717  "non-namespace scope '%0' cannot have a literal operator member">;
8718def err_literal_operator_default_argument : Error<
8719  "literal operator cannot have a default argument">;
8720def err_literal_operator_bad_param_count : Error<
8721  "non-template literal operator must have one or two parameters">;
8722def err_literal_operator_invalid_param : Error<
8723  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
8724def err_literal_operator_param : Error<
8725  "invalid literal operator parameter type %0, did you mean %1?">;
8726def err_literal_operator_template_with_params : Error<
8727  "literal operator template cannot have any parameters">;
8728def err_literal_operator_template : Error<
8729  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
8730def err_literal_operator_extern_c : Error<
8731  "literal operator must have C++ linkage">;
8732def ext_string_literal_operator_template : ExtWarn<
8733  "string literal operator templates are a GNU extension">,
8734  InGroup<GNUStringLiteralOperatorTemplate>;
8735def warn_user_literal_reserved : Warning<
8736  "user-defined literal suffixes not starting with '_' are reserved"
8737  "%select{; no literal will invoke this operator|}0">,
8738  InGroup<UserDefinedLiterals>;
8739
8740// C++ conversion functions
8741def err_conv_function_not_member : Error<
8742  "conversion function must be a non-static member function">;
8743def err_conv_function_return_type : Error<
8744  "conversion function cannot have a return type">;
8745def err_conv_function_with_params : Error<
8746  "conversion function cannot have any parameters">;
8747def err_conv_function_variadic : Error<
8748  "conversion function cannot be variadic">;
8749def err_conv_function_to_array : Error<
8750  "conversion function cannot convert to an array type">;
8751def err_conv_function_to_function : Error<
8752  "conversion function cannot convert to a function type">;
8753def err_conv_function_with_complex_decl : Error<
8754  "cannot specify any part of a return type in the "
8755  "declaration of a conversion function"
8756  "%select{"
8757  "; put the complete type after 'operator'|"
8758  "; use a typedef to declare a conversion to %1|"
8759  "; use an alias template to declare a conversion to %1|"
8760  "}0">;
8761def err_conv_function_redeclared : Error<
8762  "conversion function cannot be redeclared">;
8763def warn_conv_to_self_not_used : Warning<
8764  "conversion function converting %0 to itself will never be used">,
8765  InGroup<ClassConversion>;
8766def warn_conv_to_base_not_used : Warning<
8767  "conversion function converting %0 to its base class %1 will never be used">,
8768  InGroup<ClassConversion>;
8769def warn_conv_to_void_not_used : Warning<
8770  "conversion function converting %0 to %1 will never be used">,
8771  InGroup<ClassConversion>;
8772
8773def warn_not_compound_assign : Warning<
8774  "use of unary operator that may be intended as compound assignment (%0=)">;
8775
8776// C++11 explicit conversion operators
8777def ext_explicit_conversion_functions : ExtWarn<
8778  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
8779def warn_cxx98_compat_explicit_conversion_functions : Warning<
8780  "explicit conversion functions are incompatible with C++98">,
8781  InGroup<CXX98Compat>, DefaultIgnore;
8782
8783// C++11 defaulted functions
8784def err_defaulted_special_member_params : Error<
8785  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8786  "have default arguments">;
8787def err_defaulted_special_member_variadic : Error<
8788  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8789  "be variadic">;
8790def err_defaulted_special_member_return_type : Error<
8791  "explicitly-defaulted %select{copy|move}0 assignment operator must "
8792  "return %1">;
8793def err_defaulted_special_member_quals : Error<
8794  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
8795  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
8796def err_defaulted_special_member_volatile_param : Error<
8797  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
8798  "may not be volatile">;
8799def err_defaulted_special_member_move_const_param : Error<
8800  "the parameter for an explicitly-defaulted move "
8801  "%select{constructor|assignment operator}0 may not be const">;
8802def err_defaulted_special_member_copy_const_param : Error<
8803  "the parameter for this explicitly-defaulted copy "
8804  "%select{constructor|assignment operator}0 is const, but a member or base "
8805  "requires it to be non-const">;
8806def err_defaulted_copy_assign_not_ref : Error<
8807  "the parameter for an explicitly-defaulted copy assignment operator must be an "
8808  "lvalue reference type">;
8809def err_incorrect_defaulted_constexpr : Error<
8810  "defaulted definition of %sub{select_special_member_kind}0 "
8811  "is not constexpr">;
8812def err_incorrect_defaulted_consteval : Error<
8813  "defaulted declaration of %sub{select_special_member_kind}0 "
8814  "cannot be consteval because implicit definition is not constexpr">;
8815def warn_defaulted_method_deleted : Warning<
8816  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
8817  "deleted">, InGroup<DefaultedFunctionDeleted>;
8818def err_out_of_line_default_deletes : Error<
8819  "defaulting this %sub{select_special_member_kind}0 "
8820  "would delete it after its first declaration">;
8821def note_deleted_type_mismatch : Note<
8822  "function is implicitly deleted because its declared type does not match "
8823  "the type of an implicit %sub{select_special_member_kind}0">;
8824def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
8825  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
8826  "different from the implicit type is incompatible with C++ standards before "
8827  "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8828def warn_vbase_moved_multiple_times : Warning<
8829  "defaulted move assignment operator of %0 will move assign virtual base "
8830  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
8831def note_vbase_moved_here : Note<
8832  "%select{%1 is a virtual base class of base class %2 declared here|"
8833  "virtual base class %1 declared here}0">;
8834
8835// C++20 defaulted comparisons
8836// This corresponds to values of Sema::DefaultedComparisonKind.
8837def select_defaulted_comparison_kind : TextSubstitution<
8838  "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
8839  "operator">;
8840def ext_defaulted_comparison : ExtWarn<
8841  "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
8842def warn_cxx17_compat_defaulted_comparison : Warning<
8843  "defaulted comparison operators are incompatible with C++ standards "
8844  "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8845def err_defaulted_comparison_template : Error<
8846  "comparison operator template cannot be defaulted">;
8847def err_defaulted_comparison_out_of_class : Error<
8848  "%sub{select_defaulted_comparison_kind}0 can only be defaulted in a class "
8849  "definition">;
8850def err_defaulted_comparison_param : Error<
8851  "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
8852  "; found %1, expected %2%select{| or %4}3">;
8853def err_defaulted_comparison_param_mismatch : Error<
8854  "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
8855  "must have the same type%diff{ (found $ vs $)|}1,2">;
8856def err_defaulted_comparison_non_const : Error<
8857  "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
8858  "const-qualified">;
8859def err_defaulted_comparison_return_type_not_bool : Error<
8860  "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
8861  "must be 'bool', not %1">;
8862def err_defaulted_comparison_deduced_return_type_not_auto : Error<
8863  "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
8864  "must be 'auto', not %1">;
8865def warn_defaulted_comparison_deleted : Warning<
8866  "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
8867  "deleted">, InGroup<DefaultedFunctionDeleted>;
8868def err_non_first_default_compare_deletes : Error<
8869  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
8870  "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
8871  "would delete it after its first declaration">;
8872def note_defaulted_comparison_union : Note<
8873  "defaulted %0 is implicitly deleted because "
8874  "%2 is a %select{union-like class|union}1 with variant members">;
8875def note_defaulted_comparison_reference_member : Note<
8876  "defaulted %0 is implicitly deleted because "
8877  "class %1 has a reference member">;
8878def note_defaulted_comparison_ambiguous : Note<
8879  "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
8880  "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
8881def note_defaulted_comparison_inaccessible : Note<
8882  "defaulted %0 is implicitly deleted because it would invoke a "
8883  "%select{private|protected}3 %4%select{ member of %6|"
8884  " member of %6 to compare member %2| to compare base class %2}1">;
8885def note_defaulted_comparison_calls_deleted : Note<
8886  "defaulted %0 is implicitly deleted because it would invoke a deleted "
8887  "comparison function%select{| for member %2| for base class %2}1">;
8888def note_defaulted_comparison_no_viable_function : Note<
8889  "defaulted %0 is implicitly deleted because there is no viable comparison "
8890  "function%select{| for member %2| for base class %2}1">;
8891def note_defaulted_comparison_no_viable_function_synthesized : Note<
8892  "three-way comparison cannot be synthesized because there is no viable "
8893  "function for %select{'=='|'<'}0 comparison">;
8894def note_defaulted_comparison_not_rewritten_callee : Note<
8895  "defaulted %0 is implicitly deleted because this non-rewritten comparison "
8896  "function would be the best match for the comparison">;
8897def note_defaulted_comparison_cannot_deduce : Note<
8898  "return type of defaulted 'operator<=>' cannot be deduced because "
8899  "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
8900  "is not a standard comparison category type">;
8901def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
8902  "return type of defaulted 'operator<=>' cannot be deduced because "
8903  "three-way comparison for %select{|member|base class}0 %1 "
8904  "has a deduced return type and is not yet defined">;
8905def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
8906  "%select{|member|base class}0 %1 declared here">;
8907def note_defaulted_comparison_cannot_deduce_callee : Note<
8908  "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
8909def err_incorrect_defaulted_comparison_constexpr : Error<
8910  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
8911  "three-way comparison operator}0 "
8912  "cannot be declared %select{constexpr|consteval}2 because "
8913  "%select{it|the corresponding implicit 'operator=='}0 "
8914  "invokes a non-constexpr comparison function">;
8915def note_defaulted_comparison_not_constexpr : Note<
8916  "non-constexpr comparison function would be used to compare "
8917  "%select{|member %1|base class %1}0">;
8918def note_defaulted_comparison_not_constexpr_here : Note<
8919  "non-constexpr comparison function declared here">;
8920def note_in_declaration_of_implicit_equality_comparison : Note<
8921  "while declaring the corresponding implicit 'operator==' "
8922  "for this defaulted 'operator<=>'">;
8923
8924def ext_implicit_exception_spec_mismatch : ExtWarn<
8925  "function previously declared with an %select{explicit|implicit}0 exception "
8926  "specification redeclared with an %select{implicit|explicit}0 exception "
8927  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
8928
8929def warn_ptr_arith_precedes_bounds : Warning<
8930  "the pointer decremented by %0 refers before the beginning of the array">,
8931  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
8932def warn_ptr_arith_exceeds_bounds : Warning<
8933  "the pointer incremented by %0 refers past the end of the array (that "
8934  "contains %1 element%s2)">,
8935  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
8936def warn_array_index_precedes_bounds : Warning<
8937  "array index %0 is before the beginning of the array">,
8938  InGroup<ArrayBounds>;
8939def warn_array_index_exceeds_bounds : Warning<
8940  "array index %0 is past the end of the array (which contains %1 "
8941  "element%s2)">, InGroup<ArrayBounds>;
8942def note_array_declared_here : Note<
8943  "array %0 declared here">;
8944
8945def warn_printf_insufficient_data_args : Warning<
8946  "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
8947def warn_printf_data_arg_not_used : Warning<
8948  "data argument not used by format string">, InGroup<FormatExtraArgs>;
8949def warn_format_invalid_conversion : Warning<
8950  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
8951def warn_printf_incomplete_specifier : Warning<
8952  "incomplete format specifier">, InGroup<Format>;
8953def warn_missing_format_string : Warning<
8954  "format string missing">, InGroup<Format>;
8955def warn_scanf_nonzero_width : Warning<
8956  "zero field width in scanf format string is unused">,
8957  InGroup<Format>;
8958def warn_format_conversion_argument_type_mismatch : Warning<
8959  "format specifies type %0 but the argument has "
8960  "%select{type|underlying type}2 %1">,
8961  InGroup<Format>;
8962def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
8963  warn_format_conversion_argument_type_mismatch.Text>,
8964  InGroup<FormatPedantic>;
8965def warn_format_conversion_argument_type_mismatch_confusion : Warning<
8966  warn_format_conversion_argument_type_mismatch.Text>,
8967  InGroup<FormatTypeConfusion>, DefaultIgnore;
8968def warn_format_argument_needs_cast : Warning<
8969  "%select{values of type|enum values with underlying type}2 '%0' should not "
8970  "be used as format arguments; add an explicit cast to %1 instead">,
8971  InGroup<Format>;
8972def warn_format_argument_needs_cast_pedantic : Warning<
8973  warn_format_argument_needs_cast.Text>,
8974  InGroup<FormatPedantic>, DefaultIgnore;
8975def warn_printf_positional_arg_exceeds_data_args : Warning <
8976  "data argument position '%0' exceeds the number of data arguments (%1)">,
8977  InGroup<Format>;
8978def warn_format_zero_positional_specifier : Warning<
8979  "position arguments in format strings start counting at 1 (not 0)">,
8980  InGroup<Format>;
8981def warn_format_invalid_positional_specifier : Warning<
8982  "invalid position specified for %select{field width|field precision}0">,
8983  InGroup<Format>;
8984def warn_format_mix_positional_nonpositional_args : Warning<
8985  "cannot mix positional and non-positional arguments in format string">,
8986  InGroup<Format>;
8987def warn_static_array_too_small : Warning<
8988  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
8989  " callee requires at least %1">,
8990  InGroup<ArrayBounds>;
8991def note_callee_static_array : Note<
8992  "callee declares array parameter as static here">;
8993def warn_empty_format_string : Warning<
8994  "format string is empty">, InGroup<FormatZeroLength>;
8995def warn_format_string_is_wide_literal : Warning<
8996  "format string should not be a wide string">, InGroup<Format>;
8997def warn_printf_format_string_contains_null_char : Warning<
8998  "format string contains '\\0' within the string body">, InGroup<Format>;
8999def warn_printf_format_string_not_null_terminated : Warning<
9000  "format string is not null-terminated">, InGroup<Format>;
9001def warn_printf_asterisk_missing_arg : Warning<
9002  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
9003  InGroup<Format>;
9004def warn_printf_asterisk_wrong_type : Warning<
9005  "field %select{width|precision}0 should have type %1, but argument has type %2">,
9006  InGroup<Format>;
9007def warn_printf_nonsensical_optional_amount: Warning<
9008  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
9009  InGroup<Format>;
9010def warn_printf_nonsensical_flag: Warning<
9011  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
9012  InGroup<Format>;
9013def warn_format_nonsensical_length: Warning<
9014  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
9015  InGroup<Format>;
9016def warn_format_non_standard_positional_arg: Warning<
9017  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
9018def warn_format_non_standard: Warning<
9019  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
9020  InGroup<FormatNonStandard>, DefaultIgnore;
9021def warn_format_non_standard_conversion_spec: Warning<
9022  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
9023  InGroup<FormatNonStandard>, DefaultIgnore;
9024def err_invalid_mask_type_size : Error<
9025  "mask type size must be between 1-byte and 8-bytes">;
9026def warn_format_invalid_annotation : Warning<
9027  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
9028  InGroup<Format>;
9029def warn_format_P_no_precision : Warning<
9030  "using '%%P' format specifier without precision">,
9031  InGroup<Format>;
9032def warn_printf_ignored_flag: Warning<
9033  "flag '%0' is ignored when flag '%1' is present">,
9034  InGroup<Format>;
9035def warn_printf_empty_objc_flag: Warning<
9036  "missing object format flag">,
9037  InGroup<Format>;
9038def warn_printf_ObjCflags_without_ObjCConversion: Warning<
9039  "object format flags cannot be used with '%0' conversion specifier">,
9040  InGroup<Format>;
9041def warn_printf_invalid_objc_flag: Warning<
9042    "'%0' is not a valid object format flag">,
9043    InGroup<Format>;
9044def warn_scanf_scanlist_incomplete : Warning<
9045  "no closing ']' for '%%[' in scanf format string">,
9046  InGroup<Format>;
9047def warn_format_bool_as_character : Warning<
9048  "using '%0' format specifier, but argument has boolean value">,
9049  InGroup<Format>;
9050def note_format_string_defined : Note<"format string is defined here">;
9051def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
9052def note_printf_c_str: Note<"did you mean to call the %0 method?">;
9053def note_format_security_fixit: Note<
9054  "treat the string as an argument to avoid this">;
9055
9056def warn_null_arg : Warning<
9057  "null passed to a callee that requires a non-null argument">,
9058  InGroup<NonNull>;
9059def warn_null_ret : Warning<
9060  "null returned from %select{function|method}0 that requires a non-null return value">,
9061  InGroup<NonNull>;
9062
9063def err_lifetimebound_no_object_param : Error<
9064  "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
9065  "function has no implicit object parameter">;
9066def err_lifetimebound_ctor_dtor : Error<
9067  "'lifetimebound' attribute cannot be applied to a "
9068  "%select{constructor|destructor}0">;
9069
9070// CHECK: returning address/reference of stack memory
9071def warn_ret_stack_addr_ref : Warning<
9072  "%select{address of|reference to}0 stack memory associated with "
9073  "%select{local variable|parameter}2 %1 returned">,
9074  InGroup<ReturnStackAddress>;
9075def warn_ret_local_temp_addr_ref : Warning<
9076  "returning %select{address of|reference to}0 local temporary object">,
9077  InGroup<ReturnStackAddress>;
9078def warn_ret_addr_label : Warning<
9079  "returning address of label, which is local">,
9080  InGroup<ReturnStackAddress>;
9081def err_ret_local_block : Error<
9082  "returning block that lives on the local stack">;
9083def note_local_var_initializer : Note<
9084  "%select{via initialization of|binding reference}0 variable "
9085  "%select{%2 |}1here">;
9086def note_lambda_capture_initializer : Note<
9087  "%select{implicitly |}2captured%select{| by reference}3"
9088  "%select{%select{ due to use|}2 here|"
9089  " via initialization of lambda capture %0}1">;
9090def note_init_with_default_member_initalizer : Note<
9091  "initializing field %0 with default member initializer">;
9092
9093// Check for initializing a member variable with the address or a reference to
9094// a constructor parameter.
9095def warn_bind_ref_member_to_parameter : Warning<
9096  "binding reference member %0 to stack allocated "
9097  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9098def warn_init_ptr_member_to_parameter_addr : Warning<
9099  "initializing pointer member %0 with the stack address of "
9100  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9101def note_ref_or_ptr_member_declared_here : Note<
9102  "%select{reference|pointer}0 member declared here">;
9103
9104def err_dangling_member : Error<
9105  "%select{reference|backing array for 'std::initializer_list'}2 "
9106  "%select{|subobject of }1member %0 "
9107  "%select{binds to|is}2 a temporary object "
9108  "whose lifetime would be shorter than the lifetime of "
9109  "the constructed object">;
9110def warn_dangling_member : Warning<
9111  "%select{reference|backing array for 'std::initializer_list'}2 "
9112  "%select{|subobject of }1member %0 "
9113  "%select{binds to|is}2 a temporary object "
9114  "whose lifetime is shorter than the lifetime of the constructed object">,
9115  InGroup<DanglingField>;
9116def warn_dangling_lifetime_pointer_member : Warning<
9117  "initializing pointer member %0 to point to a temporary object "
9118  "whose lifetime is shorter than the lifetime of the constructed object">,
9119  InGroup<DanglingGsl>;
9120def note_lifetime_extending_member_declared_here : Note<
9121  "%select{%select{reference|'std::initializer_list'}0 member|"
9122  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
9123  "declared here">;
9124def warn_dangling_variable : Warning<
9125  "%select{temporary %select{whose address is used as value of|"
9126  "%select{|implicitly }2bound to}4 "
9127  "%select{%select{|reference }4member of local variable|"
9128  "local %select{variable|reference}4}1|"
9129  "array backing "
9130  "%select{initializer list subobject of local variable|"
9131  "local initializer list}1}0 "
9132  "%select{%3 |}2will be destroyed at the end of the full-expression">,
9133  InGroup<Dangling>;
9134def warn_new_dangling_reference : Warning<
9135  "temporary bound to reference member of allocated object "
9136  "will be destroyed at the end of the full-expression">,
9137  InGroup<DanglingField>;
9138def warn_dangling_lifetime_pointer : Warning<
9139  "object backing the pointer "
9140  "will be destroyed at the end of the full-expression">,
9141  InGroup<DanglingGsl>;
9142def warn_new_dangling_initializer_list : Warning<
9143  "array backing "
9144  "%select{initializer list subobject of the allocated object|"
9145  "the allocated initializer list}0 "
9146  "will be destroyed at the end of the full-expression">,
9147  InGroup<DanglingInitializerList>;
9148def warn_unsupported_lifetime_extension : Warning<
9149  "sorry, lifetime extension of "
9150  "%select{temporary|backing array of initializer list}0 created "
9151  "by aggregate initialization using default member initializer "
9152  "is not supported; lifetime of %select{temporary|backing array}0 "
9153  "will end at the end of the full-expression">, InGroup<Dangling>;
9154
9155// For non-floating point, expressions of the form x == x or x != x
9156// should result in a warning, since these always evaluate to a constant.
9157// Array comparisons have similar warnings
9158def warn_comparison_always : Warning<
9159  "%select{self-|array }0comparison always evaluates to "
9160  "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9161  InGroup<TautologicalCompare>;
9162def warn_comparison_bitwise_always : Warning<
9163  "bitwise comparison always evaluates to %select{false|true}0">,
9164  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9165def warn_comparison_bitwise_or : Warning<
9166  "bitwise or with non-zero value always evaluates to true">,
9167  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9168def warn_tautological_overlap_comparison : Warning<
9169  "overlapping comparisons always evaluate to %select{false|true}0">,
9170  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9171def warn_depr_array_comparison : Warning<
9172  "comparison between two arrays is deprecated; "
9173  "to compare array addresses, use unary '+' to decay operands to pointers">,
9174  InGroup<DeprecatedArrayCompare>;
9175
9176def warn_stringcompare : Warning<
9177  "result of comparison against %select{a string literal|@encode}0 is "
9178  "unspecified (use an explicit string comparison function instead)">,
9179  InGroup<StringCompare>;
9180
9181def warn_identity_field_assign : Warning<
9182  "assigning %select{field|instance variable}0 to itself">,
9183  InGroup<SelfAssignmentField>;
9184
9185// Type safety attributes
9186def err_type_tag_for_datatype_not_ice : Error<
9187  "'type_tag_for_datatype' attribute requires the initializer to be "
9188  "an %select{integer|integral}0 constant expression">;
9189def err_type_tag_for_datatype_too_large : Error<
9190  "'type_tag_for_datatype' attribute requires the initializer to be "
9191  "an %select{integer|integral}0 constant expression "
9192  "that can be represented by a 64 bit integer">;
9193def err_tag_index_out_of_range : Error<
9194  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
9195def warn_type_tag_for_datatype_wrong_kind : Warning<
9196  "this type tag was not designed to be used with this function">,
9197  InGroup<TypeSafety>;
9198def warn_type_safety_type_mismatch : Warning<
9199  "argument type %0 doesn't match specified %1 type tag "
9200  "%select{that requires %3|}2">, InGroup<TypeSafety>;
9201def warn_type_safety_null_pointer_required : Warning<
9202  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
9203
9204// Generic selections.
9205def err_assoc_type_incomplete : Error<
9206  "type %0 in generic association incomplete">;
9207def err_assoc_type_nonobject : Error<
9208  "type %0 in generic association not an object type">;
9209def err_assoc_type_variably_modified : Error<
9210  "type %0 in generic association is a variably modified type">;
9211def err_assoc_compatible_types : Error<
9212  "type %0 in generic association compatible with previously specified type %1">;
9213def note_compat_assoc : Note<
9214  "compatible type %0 specified here">;
9215def err_generic_sel_no_match : Error<
9216  "controlling expression type %0 not compatible with any generic association type">;
9217def err_generic_sel_multi_match : Error<
9218  "controlling expression type %0 compatible with %1 generic association types">;
9219
9220
9221// Blocks
9222def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
9223  " or %select{pick a deployment target that supports them|for OpenCL 2.0}0">;
9224def err_block_returning_array_function : Error<
9225  "block cannot return %select{array|function}0 type %1">;
9226
9227// Builtin annotation
9228def err_builtin_annotation_first_arg : Error<
9229  "first argument to __builtin_annotation must be an integer">;
9230def err_builtin_annotation_second_arg : Error<
9231  "second argument to __builtin_annotation must be a non-wide string constant">;
9232def err_msvc_annotation_wide_str : Error<
9233  "arguments to __annotation must be wide string constants">;
9234
9235// CFString checking
9236def err_cfstring_literal_not_string_constant : Error<
9237  "CFString literal is not a string constant">;
9238def warn_cfstring_truncated : Warning<
9239  "input conversion stopped due to an input byte that does not "
9240  "belong to the input codeset UTF-8">,
9241  InGroup<DiagGroup<"CFString-literal">>;
9242
9243// os_log checking
9244// TODO: separate diagnostic for os_trace()
9245def err_os_log_format_not_string_constant : Error<
9246  "os_log() format argument is not a string constant">;
9247def err_os_log_argument_too_big : Error<
9248  "os_log() argument %0 is too big (%1 bytes, max %2)">;
9249def warn_os_log_format_narg : Error<
9250 "os_log() '%%n' format specifier is not allowed">, DefaultError;
9251
9252// Statements.
9253def err_continue_not_in_loop : Error<
9254  "'continue' statement not in loop statement">;
9255def err_break_not_in_loop_or_switch : Error<
9256  "'break' statement not in loop or switch statement">;
9257def warn_loop_ctrl_binds_to_inner : Warning<
9258  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
9259  InGroup<GccCompat>;
9260def warn_break_binds_to_switch : Warning<
9261  "'break' is bound to loop, GCC binds it to switch">,
9262  InGroup<GccCompat>;
9263def err_default_not_in_switch : Error<
9264  "'default' statement not in switch statement">;
9265def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
9266def warn_bool_switch_condition : Warning<
9267  "switch condition has boolean value">, InGroup<SwitchBool>;
9268def warn_case_value_overflow : Warning<
9269  "overflow converting case value to switch condition type (%0 to %1)">,
9270  InGroup<Switch>;
9271def err_duplicate_case : Error<"duplicate case value '%0'">;
9272def err_duplicate_case_differing_expr : Error<
9273  "duplicate case value: '%0' and '%1' both equal '%2'">;
9274def warn_case_empty_range : Warning<"empty case range specified">;
9275def warn_missing_case_for_condition :
9276  Warning<"no case matching constant switch condition '%0'">;
9277
9278def warn_def_missing_case : Warning<"%plural{"
9279  "1:enumeration value %1 not explicitly handled in switch|"
9280  "2:enumeration values %1 and %2 not explicitly handled in switch|"
9281  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
9282  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
9283  InGroup<SwitchEnum>, DefaultIgnore;
9284
9285def warn_missing_case : Warning<"%plural{"
9286  "1:enumeration value %1 not handled in switch|"
9287  "2:enumeration values %1 and %2 not handled in switch|"
9288  "3:enumeration values %1, %2, and %3 not handled in switch|"
9289  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
9290  InGroup<Switch>;
9291
9292def warn_unannotated_fallthrough : Warning<
9293  "unannotated fall-through between switch labels">,
9294  InGroup<ImplicitFallthrough>, DefaultIgnore;
9295def warn_unannotated_fallthrough_per_function : Warning<
9296  "unannotated fall-through between switch labels in partly-annotated "
9297  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
9298def note_insert_fallthrough_fixit : Note<
9299  "insert '%0;' to silence this warning">;
9300def note_insert_break_fixit : Note<
9301  "insert 'break;' to avoid fall-through">;
9302def err_fallthrough_attr_wrong_target : Error<
9303  "%0 attribute is only allowed on empty statements">;
9304def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
9305def err_fallthrough_attr_outside_switch : Error<
9306  "fallthrough annotation is outside switch statement">;
9307def err_fallthrough_attr_invalid_placement : Error<
9308  "fallthrough annotation does not directly precede switch label">;
9309def warn_fallthrough_attr_unreachable : Warning<
9310  "fallthrough annotation in unreachable code">,
9311  InGroup<ImplicitFallthrough>, DefaultIgnore;
9312
9313def warn_unreachable_default : Warning<
9314  "default label in switch which covers all enumeration values">,
9315  InGroup<CoveredSwitchDefault>, DefaultIgnore;
9316def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
9317  InGroup<Switch>;
9318def warn_not_in_enum_assignment : Warning<"integer constant not in range "
9319  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
9320def err_typecheck_statement_requires_scalar : Error<
9321  "statement requires expression of scalar type (%0 invalid)">;
9322def err_typecheck_statement_requires_integer : Error<
9323  "statement requires expression of integer type (%0 invalid)">;
9324def err_multiple_default_labels_defined : Error<
9325  "multiple default labels in one switch">;
9326def err_switch_multiple_conversions : Error<
9327  "multiple conversions from switch condition type %0 to an integral or "
9328  "enumeration type">;
9329def note_switch_conversion : Note<
9330  "conversion to %select{integral|enumeration}0 type %1">;
9331def err_switch_explicit_conversion : Error<
9332  "switch condition type %0 requires explicit conversion to %1">;
9333def err_switch_incomplete_class_type : Error<
9334  "switch condition has incomplete class type %0">;
9335
9336def warn_empty_if_body : Warning<
9337  "if statement has empty body">, InGroup<EmptyBody>;
9338def warn_empty_for_body : Warning<
9339  "for loop has empty body">, InGroup<EmptyBody>;
9340def warn_empty_range_based_for_body : Warning<
9341  "range-based for loop has empty body">, InGroup<EmptyBody>;
9342def warn_empty_while_body : Warning<
9343  "while loop has empty body">, InGroup<EmptyBody>;
9344def warn_empty_switch_body : Warning<
9345  "switch statement has empty body">, InGroup<EmptyBody>;
9346def note_empty_body_on_separate_line : Note<
9347  "put the semicolon on a separate line to silence this warning">;
9348
9349def err_va_start_captured_stmt : Error<
9350  "'va_start' cannot be used in a captured statement">;
9351def err_va_start_outside_function : Error<
9352  "'va_start' cannot be used outside a function">;
9353def err_va_start_fixed_function : Error<
9354  "'va_start' used in function with fixed args">;
9355def err_va_start_used_in_wrong_abi_function : Error<
9356  "'va_start' used in %select{System V|Win64}0 ABI function">;
9357def err_ms_va_start_used_in_sysv_function : Error<
9358  "'__builtin_ms_va_start' used in System V ABI function">;
9359def warn_second_arg_of_va_start_not_last_named_param : Warning<
9360  "second argument to 'va_start' is not the last named parameter">,
9361  InGroup<Varargs>;
9362def warn_va_start_type_is_undefined : Warning<
9363  "passing %select{an object that undergoes default argument promotion|"
9364  "an object of reference type|a parameter declared with the 'register' "
9365  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
9366def err_first_argument_to_va_arg_not_of_type_va_list : Error<
9367  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
9368def err_second_parameter_to_va_arg_incomplete: Error<
9369  "second argument to 'va_arg' is of incomplete type %0">;
9370def err_second_parameter_to_va_arg_abstract: Error<
9371  "second argument to 'va_arg' is of abstract type %0">;
9372def warn_second_parameter_to_va_arg_not_pod : Warning<
9373  "second argument to 'va_arg' is of non-POD type %0">,
9374  InGroup<NonPODVarargs>, DefaultError;
9375def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
9376  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
9377  InGroup<NonPODVarargs>, DefaultError;
9378def warn_second_parameter_to_va_arg_never_compatible : Warning<
9379  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
9380  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
9381
9382def warn_return_missing_expr : Warning<
9383  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9384  InGroup<ReturnType>;
9385def ext_return_missing_expr : ExtWarn<
9386  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9387  InGroup<ReturnType>;
9388def ext_return_has_expr : ExtWarn<
9389  "%select{void function|void method|constructor|destructor}1 %0 "
9390  "should not return a value">,
9391  DefaultError, InGroup<ReturnType>;
9392def ext_return_has_void_expr : Extension<
9393  "void %select{function|method|block}1 %0 should not return void expression">;
9394def err_return_init_list : Error<
9395  "%select{void function|void method|constructor|destructor}1 %0 "
9396  "must not return a value">;
9397def err_ctor_dtor_returns_void : Error<
9398  "%select{constructor|destructor}1 %0 must not return void expression">;
9399def warn_noreturn_function_has_return_expr : Warning<
9400  "function %0 declared 'noreturn' should not return">,
9401  InGroup<InvalidNoreturn>;
9402def warn_falloff_noreturn_function : Warning<
9403  "function declared 'noreturn' should not return">,
9404  InGroup<InvalidNoreturn>;
9405def err_noreturn_block_has_return_expr : Error<
9406  "block declared 'noreturn' should not return">;
9407def err_noreturn_missing_on_first_decl : Error<
9408  "function declared '[[noreturn]]' after its first declaration">;
9409def note_noreturn_missing_first_decl : Note<
9410  "declaration missing '[[noreturn]]' attribute is here">;
9411def err_carries_dependency_missing_on_first_decl : Error<
9412  "%select{function|parameter}0 declared '[[carries_dependency]]' "
9413  "after its first declaration">;
9414def note_carries_dependency_missing_first_decl : Note<
9415  "declaration missing '[[carries_dependency]]' attribute is here">;
9416def err_carries_dependency_param_not_function_decl : Error<
9417  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
9418  "declaration or lambda">;
9419def err_block_on_nonlocal : Error<
9420  "__block attribute not allowed, only allowed on local variables">;
9421def err_block_on_vm : Error<
9422  "__block attribute not allowed on declaration with a variably modified type">;
9423def err_sizeless_nonlocal : Error<
9424  "non-local variable with sizeless type %0">;
9425
9426def err_vec_builtin_non_vector : Error<
9427 "first two arguments to %0 must be vectors">;
9428def err_vec_builtin_incompatible_vector : Error<
9429  "first two arguments to %0 must have the same type">;
9430def err_vsx_builtin_nonconstant_argument : Error<
9431  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
9432
9433def err_shufflevector_nonconstant_argument : Error<
9434  "index for __builtin_shufflevector must be a constant integer">;
9435def err_shufflevector_argument_too_large : Error<
9436  "index for __builtin_shufflevector must be less than the total number "
9437  "of vector elements">;
9438
9439def err_convertvector_non_vector : Error<
9440  "first argument to __builtin_convertvector must be a vector">;
9441def err_convertvector_non_vector_type : Error<
9442  "second argument to __builtin_convertvector must be a vector type">;
9443def err_convertvector_incompatible_vector : Error<
9444  "first two arguments to __builtin_convertvector must have the same number of elements">;
9445
9446def err_first_argument_to_cwsc_not_call : Error<
9447  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
9448def err_first_argument_to_cwsc_block_call : Error<
9449  "first argument to __builtin_call_with_static_chain must not be a block call">;
9450def err_first_argument_to_cwsc_builtin_call : Error<
9451  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
9452def err_first_argument_to_cwsc_pdtor_call : Error<
9453  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
9454def err_second_argument_to_cwsc_not_pointer : Error<
9455  "second argument to __builtin_call_with_static_chain must be of pointer type">;
9456
9457def err_vector_incorrect_num_initializers : Error<
9458  "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
9459def err_altivec_empty_initializer : Error<"expected initializer">;
9460
9461def err_invalid_neon_type_code : Error<
9462  "incompatible constant for this __builtin_neon function">;
9463def err_argument_invalid_range : Error<
9464  "argument value %0 is outside the valid range [%1, %2]">;
9465def warn_argument_invalid_range : Warning<
9466  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
9467  InGroup<DiagGroup<"argument-outside-range">>;
9468def err_argument_not_multiple : Error<
9469  "argument should be a multiple of %0">;
9470def err_argument_not_power_of_2 : Error<
9471  "argument should be a power of 2">;
9472def err_argument_not_shifted_byte : Error<
9473  "argument should be an 8-bit value shifted by a multiple of 8 bits">;
9474def err_argument_not_shifted_byte_or_xxff : Error<
9475  "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
9476def err_rotation_argument_to_cadd
9477    : Error<"argument should be the value 90 or 270">;
9478def err_rotation_argument_to_cmla
9479    : Error<"argument should be the value 0, 90, 180 or 270">;
9480def warn_neon_vector_initializer_non_portable : Warning<
9481  "vector initializers are not compatible with NEON intrinsics in big endian "
9482  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
9483def note_neon_vector_initializer_non_portable : Note<
9484  "consider using vld1_%0%1() to initialize a vector from memory, or "
9485  "vcreate_%0%1() to initialize from an integer constant">;
9486def note_neon_vector_initializer_non_portable_q : Note<
9487  "consider using vld1q_%0%1() to initialize a vector from memory, or "
9488  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
9489  "constants">;
9490def err_systemz_invalid_tabort_code : Error<
9491  "invalid transaction abort code">;
9492def err_64_bit_builtin_32_bit_tgt : Error<
9493  "this builtin is only available on 64-bit targets">;
9494def err_32_bit_builtin_64_bit_tgt : Error<
9495  "this builtin is only available on 32-bit targets">;
9496def err_builtin_x64_aarch64_only : Error<
9497  "this builtin is only available on x86-64 and aarch64 targets">;
9498def err_mips_builtin_requires_dsp : Error<
9499  "this builtin requires 'dsp' ASE, please use -mdsp">;
9500def err_mips_builtin_requires_dspr2 : Error<
9501  "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
9502def err_mips_builtin_requires_msa : Error<
9503  "this builtin requires 'msa' ASE, please use -mmsa">;
9504def err_ppc_builtin_only_on_pwr7 : Error<
9505  "this builtin is only valid on POWER7 or later CPUs">;
9506def err_ppc_invalid_use_mma_type : Error<
9507  "invalid use of PPC MMA type">;
9508def err_x86_builtin_invalid_rounding : Error<
9509  "invalid rounding argument">;
9510def err_x86_builtin_invalid_scale : Error<
9511  "scale argument must be 1, 2, 4, or 8">;
9512def err_x86_builtin_tile_arg_duplicate : Error<
9513  "tile arguments must refer to different tiles">;
9514
9515def err_builtin_target_unsupported : Error<
9516  "builtin is not supported on this target">;
9517def err_builtin_longjmp_unsupported : Error<
9518  "__builtin_longjmp is not supported for the current target">;
9519def err_builtin_setjmp_unsupported : Error<
9520  "__builtin_setjmp is not supported for the current target">;
9521
9522def err_builtin_longjmp_invalid_val : Error<
9523  "argument to __builtin_longjmp must be a constant 1">;
9524def err_builtin_requires_language : Error<"'%0' is only available in %1">;
9525
9526def err_constant_integer_arg_type : Error<
9527  "argument to %0 must be a constant integer">;
9528
9529def ext_mixed_decls_code : Extension<
9530  "ISO C90 forbids mixing declarations and code">,
9531  InGroup<DiagGroup<"declaration-after-statement">>;
9532
9533def err_non_local_variable_decl_in_for : Error<
9534  "declaration of non-local variable in 'for' loop">;
9535def err_non_variable_decl_in_for : Error<
9536  "non-variable declaration in 'for' loop">;
9537def err_toomany_element_decls : Error<
9538  "only one element declaration is allowed">;
9539def err_selector_element_not_lvalue : Error<
9540  "selector element is not a valid lvalue">;
9541def err_selector_element_type : Error<
9542  "selector element type %0 is not a valid object">;
9543def err_selector_element_const_type : Error<
9544  "selector element of type %0 cannot be a constant l-value expression">;
9545def err_collection_expr_type : Error<
9546  "the type %0 is not a pointer to a fast-enumerable object">;
9547def warn_collection_expr_type : Warning<
9548  "collection expression type %0 may not respond to %1">;
9549
9550def err_invalid_conversion_between_ext_vectors : Error<
9551  "invalid conversion between ext-vector type %0 and %1">;
9552
9553def warn_duplicate_attribute_exact : Warning<
9554  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
9555
9556def warn_duplicate_attribute : Warning<
9557  "attribute %0 is already applied with different parameters">,
9558  InGroup<IgnoredAttributes>;
9559
9560def warn_sync_fetch_and_nand_semantics_change : Warning<
9561  "the semantics of this intrinsic changed with GCC "
9562  "version 4.4 - the newer semantics are provided here">,
9563  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
9564
9565// Type
9566def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
9567  InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
9568def warn_receiver_forward_class : Warning<
9569  "receiver %0 is a forward class and corresponding @interface may not exist">,
9570  InGroup<ForwardClassReceiver>;
9571def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
9572def ext_missing_declspec : ExtWarn<
9573  "declaration specifier missing, defaulting to 'int'">;
9574def ext_missing_type_specifier : ExtWarn<
9575  "type specifier missing, defaults to 'int'">,
9576  InGroup<ImplicitInt>;
9577def err_decimal_unsupported : Error<
9578  "GNU decimal type extension not supported">;
9579def err_missing_type_specifier : Error<
9580  "C++ requires a type specifier for all declarations">;
9581def err_objc_array_of_interfaces : Error<
9582  "array of interface %0 is invalid (probably should be an array of pointers)">;
9583def ext_c99_array_usage : Extension<
9584  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9585  "feature">, InGroup<C99>;
9586def err_c99_array_usage_cxx : Error<
9587  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9588  "feature, not permitted in C++">;
9589def err_type_unsupported : Error<
9590  "%0 is not supported on this target">;
9591def err_nsconsumed_attribute_mismatch : Error<
9592  "overriding method has mismatched ns_consumed attribute on its"
9593  " parameter">;
9594def err_nsreturns_retained_attribute_mismatch : Error<
9595  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
9596  " attributes">;
9597def err_nserrordomain_invalid_decl : Error<
9598  "domain argument %select{|%1 }0does not refer to global constant">;
9599def err_nserrordomain_wrong_type : Error<
9600  "domain argument %0 does not point to an NSString constant">;
9601
9602def warn_nsconsumed_attribute_mismatch : Warning<
9603  err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
9604def warn_nsreturns_retained_attribute_mismatch : Warning<
9605  err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
9606
9607def note_getter_unavailable : Note<
9608  "or because setter is declared here, but no getter method %0 is found">;
9609def err_invalid_protocol_qualifiers : Error<
9610  "invalid protocol qualifiers on non-ObjC type">;
9611def warn_ivar_use_hidden : Warning<
9612  "local declaration of %0 hides instance variable">,
9613   InGroup<ShadowIvar>;
9614def warn_direct_initialize_call : Warning<
9615  "explicit call to +initialize results in duplicate call to +initialize">,
9616   InGroup<ExplicitInitializeCall>;
9617def warn_direct_super_initialize_call : Warning<
9618  "explicit call to [super initialize] should only be in implementation "
9619  "of +initialize">,
9620   InGroup<ExplicitInitializeCall>;
9621def err_ivar_use_in_class_method : Error<
9622  "instance variable %0 accessed in class method">;
9623def err_private_ivar_access : Error<"instance variable %0 is private">,
9624  AccessControl;
9625def err_protected_ivar_access : Error<"instance variable %0 is protected">,
9626  AccessControl;
9627def warn_maynot_respond : Warning<"%0 may not respond to %1">;
9628def ext_typecheck_base_super : Warning<
9629  "method parameter type "
9630  "%diff{$ does not match super class method parameter type $|"
9631  "does not match super class method parameter type}0,1">,
9632   InGroup<SuperSubClassMismatch>, DefaultIgnore;
9633def warn_missing_method_return_type : Warning<
9634  "method has no return type specified; defaults to 'id'">,
9635  InGroup<MissingMethodReturnType>, DefaultIgnore;
9636def warn_direct_ivar_access : Warning<"instance variable %0 is being "
9637  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
9638
9639// Spell-checking diagnostics
9640def err_unknown_typename : Error<
9641  "unknown type name %0">;
9642def err_unknown_type_or_class_name_suggest : Error<
9643  "unknown %select{type|class}1 name %0; did you mean %2?">;
9644def err_unknown_typename_suggest : Error<
9645  "unknown type name %0; did you mean %1?">;
9646def err_unknown_nested_typename_suggest : Error<
9647  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
9648def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
9649def err_undeclared_use_suggest : Error<
9650  "use of undeclared %0; did you mean %1?">;
9651def err_undeclared_var_use_suggest : Error<
9652  "use of undeclared identifier %0; did you mean %1?">;
9653def err_no_template : Error<"no template named %0">;
9654def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
9655def err_no_member_template : Error<"no template named %0 in %1">;
9656def err_no_member_template_suggest : Error<
9657  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
9658def err_non_template_in_template_id : Error<
9659  "%0 does not name a template but is followed by template arguments">;
9660def err_non_template_in_template_id_suggest : Error<
9661  "%0 does not name a template but is followed by template arguments; "
9662  "did you mean %1?">;
9663def err_non_template_in_member_template_id_suggest : Error<
9664  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
9665def note_non_template_in_template_id_found : Note<
9666  "non-template declaration found by name lookup">;
9667def err_mem_init_not_member_or_class_suggest : Error<
9668  "initializer %0 does not name a non-static data member or base "
9669  "class; did you mean the %select{base class|member}1 %2?">;
9670def err_field_designator_unknown_suggest : Error<
9671  "field designator %0 does not refer to any field in type %1; did you mean "
9672  "%2?">;
9673def err_typecheck_member_reference_ivar_suggest : Error<
9674  "%0 does not have a member named %1; did you mean %2?">;
9675def err_property_not_found_suggest : Error<
9676  "property %0 not found on object of type %1; did you mean %2?">;
9677def err_class_property_found : Error<
9678  "property %0 is a class property; did you mean to access it with class '%1'?">;
9679def err_ivar_access_using_property_syntax_suggest : Error<
9680  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
9681def warn_property_access_suggest : Warning<
9682"property %0 not found on object of type %1; did you mean to access property %2?">,
9683InGroup<PropertyAccessDotSyntax>;
9684def err_property_found_suggest : Error<
9685  "property %0 found on object of type %1; did you mean to access "
9686  "it with the \".\" operator?">;
9687def err_undef_interface_suggest : Error<
9688  "cannot find interface declaration for %0; did you mean %1?">;
9689def warn_undef_interface_suggest : Warning<
9690  "cannot find interface declaration for %0; did you mean %1?">;
9691def err_undef_superclass_suggest : Error<
9692  "cannot find interface declaration for %0, superclass of %1; did you mean "
9693  "%2?">;
9694def err_undeclared_protocol_suggest : Error<
9695  "cannot find protocol declaration for %0; did you mean %1?">;
9696def note_base_class_specified_here : Note<
9697  "base class %0 specified here">;
9698def err_using_directive_suggest : Error<
9699  "no namespace named %0; did you mean %1?">;
9700def err_using_directive_member_suggest : Error<
9701  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
9702def note_namespace_defined_here : Note<"namespace %0 defined here">;
9703def err_sizeof_pack_no_pack_name_suggest : Error<
9704  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
9705def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
9706
9707def err_uncasted_use_of_unknown_any : Error<
9708  "%0 has unknown type; cast it to its declared type to use it">;
9709def err_uncasted_call_of_unknown_any : Error<
9710  "%0 has unknown return type; cast the call to its declared return type">;
9711def err_uncasted_send_to_unknown_any_method : Error<
9712  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
9713  "message send to the method's return type">;
9714def err_unsupported_unknown_any_decl : Error<
9715  "%0 has unknown type, which is not supported for this kind of declaration">;
9716def err_unsupported_unknown_any_expr : Error<
9717  "unsupported expression with unknown type">;
9718def err_unsupported_unknown_any_call : Error<
9719  "call to unsupported expression with unknown type">;
9720def err_unknown_any_addrof : Error<
9721  "the address of a declaration with unknown type "
9722  "can only be cast to a pointer type">;
9723def err_unknown_any_addrof_call : Error<
9724  "address-of operator cannot be applied to a call to a function with "
9725  "unknown return type">;
9726def err_unknown_any_var_function_type : Error<
9727  "variable %0 with unknown type cannot be given a function type">;
9728def err_unknown_any_function : Error<
9729  "function %0 with unknown type must be given a function type">;
9730
9731def err_filter_expression_integral : Error<
9732  "filter expression has non-integral type %0">;
9733
9734def err_non_asm_stmt_in_naked_function : Error<
9735  "non-ASM statement in naked function is not supported">;
9736def err_asm_naked_this_ref : Error<
9737  "'this' pointer references not allowed in naked functions">;
9738def err_asm_naked_parm_ref : Error<
9739  "parameter references not allowed in naked functions">;
9740
9741// OpenCL warnings and errors.
9742def err_invalid_astype_of_different_size : Error<
9743  "invalid reinterpretation: sizes of %0 and %1 must match">;
9744def err_static_kernel : Error<
9745  "kernel functions cannot be declared static">;
9746def err_method_kernel : Error<
9747  "kernel functions cannot be class members">;
9748def err_template_kernel : Error<
9749  "kernel functions cannot be used in a template declaration, instantiation or specialization">;
9750def err_opencl_ptrptr_kernel_param : Error<
9751  "kernel parameter cannot be declared as a pointer to a pointer">;
9752def err_kernel_arg_address_space : Error<
9753  "pointer arguments to kernel functions must reside in '__global', "
9754  "'__constant' or '__local' address space">;
9755def err_opencl_ext_vector_component_invalid_length : Error<
9756  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
9757def err_opencl_function_variable : Error<
9758  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
9759def err_opencl_addrspace_scope : Error<
9760  "variables in the %0 address space can only be declared in the outermost "
9761  "scope of a kernel function">;
9762def err_static_function_scope : Error<
9763  "variables in function scope cannot be declared static">;
9764def err_opencl_bitfields : Error<
9765  "bit-fields are not supported in OpenCL">;
9766def err_opencl_vla : Error<
9767  "variable length arrays are not supported in OpenCL">;
9768def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
9769    "scalar operand type has greater rank than the type of the vector "
9770    "element. (%0 and %1)">;
9771def err_bad_kernel_param_type : Error<
9772  "%0 cannot be used as the type of a kernel parameter">;
9773def err_opencl_implicit_function_decl : Error<
9774  "implicit declaration of function %0 is invalid in OpenCL">;
9775def err_record_with_pointers_kernel_param : Error<
9776  "%select{struct|union}0 kernel parameters may not contain pointers">;
9777def note_within_field_of_type : Note<
9778  "within field of type %0 declared here">;
9779def note_illegal_field_declared_here : Note<
9780  "field of illegal %select{type|pointer type}0 %1 declared here">;
9781def err_opencl_type_struct_or_union_field : Error<
9782  "the %0 type cannot be used to declare a structure or union field">;
9783def err_event_t_addr_space_qual : Error<
9784  "the event_t type can only be used with __private address space qualifier">;
9785def err_expected_kernel_void_return_type : Error<
9786  "kernel must have void return type">;
9787def err_sampler_initializer_not_integer : Error<
9788  "sampler_t initialization requires 32-bit integer, not %0">;
9789def warn_sampler_initializer_invalid_bits : Warning<
9790  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
9791def err_sampler_argument_required : Error<
9792  "sampler_t variable required - got %0">;
9793def err_wrong_sampler_addressspace: Error<
9794  "sampler type cannot be used with the __local and __global address space qualifiers">;
9795def err_opencl_nonconst_global_sampler : Error<
9796  "global sampler requires a const or constant address space qualifier">;
9797def err_opencl_cast_non_zero_to_event_t : Error<
9798  "cannot cast non-zero value '%0' to 'event_t'">;
9799def err_opencl_global_invalid_addr_space : Error<
9800  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
9801def err_missing_actual_pipe_type : Error<
9802  "missing actual type specifier for pipe">;
9803def err_reference_pipe_type : Error <
9804  "pipes packet types cannot be of reference type">;
9805def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
9806def err_opencl_kernel_attr :
9807  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
9808def err_opencl_return_value_with_address_space : Error<
9809  "return value cannot be qualified with address space">;
9810def err_opencl_constant_no_init : Error<
9811  "variable in constant address space must be initialized">;
9812def err_opencl_atomic_init: Error<
9813  "atomic variable can be %select{assigned|initialized}0 to a variable only "
9814  "in global address space">;
9815def err_opencl_implicit_vector_conversion : Error<
9816  "implicit conversions between vector types (%0 and %1) are not permitted">;
9817def err_opencl_invalid_type_array : Error<
9818  "array of %0 type is invalid in OpenCL">;
9819def err_opencl_ternary_with_block : Error<
9820  "block type cannot be used as expression in ternary expression in OpenCL">;
9821def err_opencl_pointer_to_type : Error<
9822  "pointer to type %0 is invalid in OpenCL">;
9823def err_opencl_type_can_only_be_used_as_function_parameter : Error <
9824  "type %0 can only be used as a function parameter in OpenCL">;
9825def warn_opencl_attr_deprecated_ignored : Warning <
9826  "%0 attribute is deprecated and ignored in OpenCL version %1">,
9827  InGroup<IgnoredAttributes>;
9828def err_opencl_variadic_function : Error<
9829  "invalid prototype, variadic arguments are not allowed in OpenCL">;
9830def err_opencl_requires_extension : Error<
9831  "use of %select{type|declaration}0 %1 requires %2 extension to be enabled">;
9832def warn_opencl_generic_address_space_arg : Warning<
9833  "passing non-generic address space pointer to %0"
9834  " may cause dynamic conversion affecting performance">,
9835  InGroup<Conversion>, DefaultIgnore;
9836
9837// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
9838def err_opencl_builtin_pipe_first_arg : Error<
9839  "first argument to %0 must be a pipe type">;
9840def err_opencl_builtin_pipe_arg_num : Error<
9841  "invalid number of arguments to function: %0">;
9842def err_opencl_builtin_pipe_invalid_arg : Error<
9843  "invalid argument type to function %0 (expecting %1 having %2)">;
9844def err_opencl_builtin_pipe_invalid_access_modifier : Error<
9845  "invalid pipe access modifier (expecting %0)">;
9846
9847// OpenCL access qualifier
9848def err_opencl_invalid_access_qualifier : Error<
9849  "access qualifier can only be used for pipe and image type">;
9850def err_opencl_invalid_read_write : Error<
9851  "access qualifier %0 can not be used for %1 %select{|prior to OpenCL version 2.0}2">;
9852def err_opencl_multiple_access_qualifiers : Error<
9853  "multiple access qualifiers">;
9854def note_opencl_typedef_access_qualifier : Note<
9855  "previously declared '%0' here">;
9856
9857// OpenCL v2.0 s6.12.5 Blocks restrictions
9858def err_opencl_block_storage_type : Error<
9859  "the __block storage type is not permitted">;
9860def err_opencl_invalid_block_declaration : Error<
9861  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
9862def err_opencl_extern_block_declaration : Error<
9863  "invalid block variable declaration - using 'extern' storage class is disallowed">;
9864def err_opencl_block_ref_block : Error<
9865  "cannot refer to a block inside block">;
9866
9867// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
9868def err_opencl_builtin_to_addr_invalid_arg : Error<
9869  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
9870
9871// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
9872def err_opencl_enqueue_kernel_incorrect_args : Error<
9873  "illegal call to enqueue_kernel, incorrect argument types">;
9874def err_opencl_enqueue_kernel_local_size_args : Error<
9875  "mismatch in number of block parameters and local size arguments passed">;
9876def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
9877  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
9878def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
9879  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
9880def err_opencl_enqueue_kernel_blocks_no_args : Error<
9881  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
9882
9883def err_opencl_builtin_expected_type : Error<
9884  "illegal call to %0, expected %1 argument type">;
9885
9886// OpenCL v2.2 s2.1.2.3 - Vector Component Access
9887def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
9888  "vector component name '%0' is an OpenCL version 2.2 feature">,
9889  InGroup<OpenCLUnsupportedRGBA>;
9890
9891def err_openclcxx_placement_new : Error<
9892  "use of placement new requires explicit declaration">;
9893
9894// MIG routine annotations.
9895def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
9896  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
9897  InGroup<IgnoredAttributes>;
9898} // end of sema category
9899
9900let CategoryName = "OpenMP Issue" in {
9901// OpenMP support.
9902def err_omp_expected_var_arg : Error<
9903  "%0 is not a global variable, static local variable or static data member">;
9904def err_omp_expected_var_arg_suggest : Error<
9905  "%0 is not a global variable, static local variable or static data member; "
9906  "did you mean %1">;
9907def err_omp_global_var_arg : Error<
9908  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
9909def err_omp_ref_type_arg : Error<
9910  "arguments of '#pragma omp %0' cannot be of reference type %1">;
9911def err_omp_region_not_file_context : Error<
9912  "directive must be at file or namespace scope">;
9913def err_omp_var_scope : Error<
9914  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
9915def err_omp_var_used : Error<
9916  "'#pragma omp %0' must precede all references to variable %q1">;
9917def err_omp_var_thread_local : Error<
9918  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
9919def err_omp_private_incomplete_type : Error<
9920  "a private variable with incomplete type %0">;
9921def err_omp_firstprivate_incomplete_type : Error<
9922  "a firstprivate variable with incomplete type %0">;
9923def err_omp_lastprivate_incomplete_type : Error<
9924  "a lastprivate variable with incomplete type %0">;
9925def err_omp_reduction_incomplete_type : Error<
9926  "a reduction list item with incomplete type %0">;
9927def err_omp_unexpected_clause_value : Error<
9928  "expected %0 in OpenMP clause '%1'">;
9929def err_omp_expected_var_name_member_expr : Error<
9930  "expected variable name%select{| or data member of current class}0">;
9931def err_omp_expected_var_name_member_expr_or_array_item : Error<
9932  "expected variable name%select{|, data member of current class}0, array element or array section">;
9933def err_omp_expected_addressable_lvalue_or_array_item : Error<
9934  "expected addressable lvalue expression, array element%select{ or array section|, array section or array shaping expression}0%select{| of non 'omp_depend_t' type}1">;
9935def err_omp_expected_named_var_member_or_array_expression: Error<
9936  "expected expression containing only member accesses and/or array sections based on named variables">;
9937def err_omp_bit_fields_forbidden_in_clause : Error<
9938  "bit fields cannot be used to specify storage in a '%0' clause">;
9939def err_array_section_does_not_specify_contiguous_storage : Error<
9940  "array section does not specify contiguous storage">;
9941def err_array_section_does_not_specify_length : Error<
9942  "array section does not specify length for outermost dimension">;
9943def err_omp_union_type_not_allowed : Error<
9944  "mapping of union members is not allowed">;
9945def err_omp_expected_access_to_data_field : Error<
9946  "expected access to data field">;
9947def err_omp_multiple_array_items_in_map_clause : Error<
9948  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
9949def err_omp_duplicate_map_type_modifier : Error<
9950  "same map type modifier has been specified more than once">;
9951def err_omp_duplicate_motion_modifier : Error<
9952  "same motion modifier has been specified more than once">;
9953def err_omp_pointer_mapped_along_with_derived_section : Error<
9954  "pointer cannot be mapped along with a section derived from itself">;
9955def err_omp_original_storage_is_shared_and_does_not_contain : Error<
9956  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
9957def err_omp_same_pointer_dereferenced : Error<
9958  "same pointer dereferenced in multiple different ways in map clause expressions">;
9959def note_omp_task_predetermined_firstprivate_here : Note<
9960  "predetermined as a firstprivate in a task construct here">;
9961def err_omp_threadprivate_incomplete_type : Error<
9962  "threadprivate variable with incomplete type %0">;
9963def err_omp_no_dsa_for_variable : Error<
9964  "variable %0 must have explicitly specified data sharing attributes">;
9965def err_omp_defaultmap_no_attr_for_variable : Error<
9966  "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
9967def note_omp_default_dsa_none : Note<
9968  "explicit data sharing attribute requested here">;
9969def note_omp_defaultmap_attr_none : Note<
9970  "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
9971def err_omp_wrong_dsa : Error<
9972  "%0 variable cannot be %1">;
9973def err_omp_variably_modified_type_not_supported : Error<
9974  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
9975def note_omp_explicit_dsa : Note<
9976  "defined as %0">;
9977def note_omp_predetermined_dsa : Note<
9978  "%select{static data member is predetermined as shared|"
9979  "variable with static storage duration is predetermined as shared|"
9980  "loop iteration variable is predetermined as private|"
9981  "loop iteration variable is predetermined as linear|"
9982  "loop iteration variable is predetermined as lastprivate|"
9983  "constant variable is predetermined as shared|"
9984  "global variable is predetermined as shared|"
9985  "non-shared variable in a task construct is predetermined as firstprivate|"
9986  "variable with automatic storage duration is predetermined as private}0"
9987  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
9988def note_omp_implicit_dsa : Note<
9989  "implicitly determined as %0">;
9990def err_omp_loop_var_dsa : Error<
9991  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
9992def err_omp_not_for : Error<
9993  "%select{statement after '#pragma omp %1' must be a for loop|"
9994  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
9995def note_omp_collapse_ordered_expr : Note<
9996  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
9997def err_omp_negative_expression_in_clause : Error<
9998  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
9999def err_omp_not_integral : Error<
10000  "expression must have integral or unscoped enumeration "
10001  "type, not %0">;
10002def err_omp_threadprivate_in_target : Error<
10003  "threadprivate variables cannot be used in target constructs">;
10004def err_omp_incomplete_type : Error<
10005  "expression has incomplete class type %0">;
10006def err_omp_explicit_conversion : Error<
10007  "expression requires explicit conversion from %0 to %1">;
10008def note_omp_conversion_here : Note<
10009  "conversion to %select{integral|enumeration}0 type %1 declared here">;
10010def err_omp_ambiguous_conversion : Error<
10011  "ambiguous conversion from type %0 to an integral or unscoped "
10012  "enumeration type">;
10013def err_omp_iterator_not_integral_or_pointer : Error<
10014  "expected integral or pointer type as the iterator-type, not %0">;
10015def err_omp_iterator_step_not_integral : Error<
10016  "iterator step expression %0 is not the integral expression">;
10017def err_omp_iterator_step_constant_zero : Error<
10018  "iterator step expression %0 evaluates to 0">;
10019def err_omp_required_access : Error<
10020  "%0 variable must be %1">;
10021def err_omp_const_variable : Error<
10022  "const-qualified variable cannot be %0">;
10023def err_omp_const_not_mutable_variable : Error<
10024  "const-qualified variable without mutable fields cannot be %0">;
10025def err_omp_const_list_item : Error<
10026  "const-qualified list item cannot be %0">;
10027def err_omp_linear_incomplete_type : Error<
10028  "a linear variable with incomplete type %0">;
10029def err_omp_linear_expected_int_or_ptr : Error<
10030  "argument of a linear clause should be of integral or pointer "
10031  "type, not %0">;
10032def warn_omp_linear_step_zero : Warning<
10033  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
10034  InGroup<OpenMPClauses>;
10035def warn_omp_alignment_not_power_of_two : Warning<
10036  "aligned clause will be ignored because the requested alignment is not a power of 2">,
10037  InGroup<OpenMPClauses>;
10038def err_omp_invalid_target_decl : Error<
10039  "%0 used in declare target directive is not a variable or a function name">;
10040def err_omp_declare_target_multiple : Error<
10041  "%0 appears multiple times in clauses on the same declare target directive">;
10042def err_omp_declare_target_to_and_link : Error<
10043  "%0 must not appear in both clauses 'to' and 'link'">;
10044def warn_omp_not_in_target_context : Warning<
10045  "declaration is not declared in any declare target region">,
10046  InGroup<OpenMPTarget>;
10047def err_omp_function_in_link_clause : Error<
10048  "function name is not allowed in 'link' clause">;
10049def err_omp_aligned_expected_array_or_ptr : Error<
10050  "argument of aligned clause should be array"
10051  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
10052  ", not %0">;
10053def err_omp_used_in_clause_twice : Error<
10054  "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
10055def err_omp_local_var_in_threadprivate_init : Error<
10056  "variable with local storage in initial value of threadprivate variable">;
10057def err_omp_loop_not_canonical_init : Error<
10058  "initialization clause of OpenMP for loop is not in canonical form "
10059  "('var = init' or 'T var = init')">;
10060def ext_omp_loop_not_canonical_init : ExtWarn<
10061  "initialization clause of OpenMP for loop is not in canonical form "
10062  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
10063def err_omp_loop_not_canonical_cond : Error<
10064  "condition of OpenMP for loop must be a relational comparison "
10065  "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
10066def err_omp_loop_not_canonical_incr : Error<
10067  "increment clause of OpenMP for loop must perform simple addition "
10068  "or subtraction on loop variable %0">;
10069def err_omp_loop_variable_type : Error<
10070  "variable must be of integer or %select{pointer|random access iterator}0 type">;
10071def err_omp_loop_incr_not_compatible : Error<
10072  "increment expression must cause %0 to %select{decrease|increase}1 "
10073  "on each iteration of OpenMP for loop">;
10074def note_omp_loop_cond_requres_compatible_incr : Note<
10075  "loop step is expected to be %select{negative|positive}0 due to this condition">;
10076def err_omp_loop_diff_cxx : Error<
10077  "could not calculate number of iterations calling 'operator-' with "
10078  "upper and lower loop bounds">;
10079def err_omp_loop_cannot_use_stmt : Error<
10080  "'%0' statement cannot be used in OpenMP for loop">;
10081def err_omp_simd_region_cannot_use_stmt : Error<
10082  "'%0' statement cannot be used in OpenMP simd region">;
10083def warn_omp_loop_64_bit_var : Warning<
10084  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
10085  InGroup<OpenMPLoopForm>;
10086def err_omp_unknown_reduction_identifier : Error<
10087  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
10088  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10089def err_omp_not_resolved_reduction_identifier : Error<
10090  "unable to resolve declare reduction construct for type %0">;
10091def err_omp_reduction_ref_type_arg : Error<
10092  "argument of OpenMP clause '%0' must reference the same object in all threads">;
10093def err_omp_clause_not_arithmetic_type_arg : Error<
10094  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
10095def err_omp_clause_floating_type_arg : Error<
10096  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
10097def err_omp_once_referenced : Error<
10098  "variable can appear only once in OpenMP '%0' clause">;
10099def err_omp_once_referenced_in_target_update : Error<
10100  "variable can appear only once in OpenMP 'target update' construct">;
10101def note_omp_referenced : Note<
10102  "previously referenced here">;
10103def err_omp_reduction_in_task : Error<
10104  "reduction variables may not be accessed in an explicit task">;
10105def err_omp_reduction_id_not_compatible : Error<
10106  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
10107def err_omp_reduction_identifier_mismatch : Error<
10108  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
10109def note_omp_previous_reduction_identifier : Note<
10110  "previously marked as task_reduction with different reduction operation">;
10111def err_omp_prohibited_region : Error<
10112  "region cannot be%select{| closely}0 nested inside '%1' region"
10113  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
10114  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
10115  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
10116  "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
10117  "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
10118def err_omp_prohibited_region_simd : Error<
10119  "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
10120def err_omp_prohibited_region_atomic : Error<
10121  "OpenMP constructs may not be nested inside an atomic region">;
10122def err_omp_prohibited_region_critical_same_name : Error<
10123  "cannot nest 'critical' regions having the same name %0">;
10124def note_omp_previous_critical_region : Note<
10125  "previous 'critical' region starts here">;
10126def err_omp_several_directives_in_region : Error<
10127  "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
10128def note_omp_previous_directive : Note<
10129  "previous '%0' directive used here">;
10130def err_omp_sections_not_compound_stmt : Error<
10131  "the statement for '#pragma omp sections' must be a compound statement">;
10132def err_omp_parallel_sections_not_compound_stmt : Error<
10133  "the statement for '#pragma omp parallel sections' must be a compound statement">;
10134def err_omp_orphaned_section_directive : Error<
10135  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
10136  " must be closely nested to a sections region%select{|, not a %1 region}0">;
10137def err_omp_sections_substmt_not_section : Error<
10138  "statement in 'omp sections' directive must be enclosed into a section region">;
10139def err_omp_parallel_sections_substmt_not_section : Error<
10140  "statement in 'omp parallel sections' directive must be enclosed into a section region">;
10141def err_omp_parallel_reduction_in_task_firstprivate : Error<
10142  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
10143def err_omp_atomic_read_not_expression_statement : Error<
10144  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
10145  " where v and x are both lvalue expressions with scalar type">;
10146def note_omp_atomic_read_write: Note<
10147  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
10148def err_omp_atomic_write_not_expression_statement : Error<
10149  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
10150  " where x is a lvalue expression with scalar type">;
10151def err_omp_atomic_update_not_expression_statement : Error<
10152  "the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x',"
10153  " where x is an l-value expression with scalar type">;
10154def err_omp_atomic_not_expression_statement : Error<
10155  "the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x',"
10156  " where x is an l-value expression with scalar type">;
10157def note_omp_atomic_update: Note<
10158  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
10159  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
10160  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
10161def err_omp_atomic_capture_not_expression_statement : Error<
10162  "the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x',"
10163  " where x and v are both l-value expressions with scalar type">;
10164def err_omp_atomic_capture_not_compound_statement : Error<
10165  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
10166  " '{v = x; x = x binop expr;}', '{v = x; x = expr binop x;}', '{x = x binop expr; v = x;}', '{x = expr binop x; v = x;}' or '{v = x; x = expr;}',"
10167  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
10168  " where x is an l-value expression with scalar type">;
10169def note_omp_atomic_capture: Note<
10170  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
10171def err_omp_atomic_several_clauses : Error<
10172  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">;
10173def err_omp_several_mem_order_clauses : Error<
10174  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
10175def err_omp_atomic_incompatible_mem_order_clause : Error<
10176  "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
10177def note_omp_previous_mem_order_clause : Note<
10178  "'%0' clause used here">;
10179def err_omp_target_contains_not_only_teams : Error<
10180  "target construct with nested teams region contains statements outside of the teams construct">;
10181def note_omp_nested_teams_construct_here : Note<
10182  "nested teams construct here">;
10183def note_omp_nested_statement_here : Note<
10184  "%select{statement|directive}0 outside teams construct here">;
10185def err_omp_single_copyprivate_with_nowait : Error<
10186  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
10187def note_omp_nowait_clause_here : Note<
10188  "'nowait' clause is here">;
10189def err_omp_single_decl_in_declare_simd_variant : Error<
10190  "single declaration is expected after 'declare %select{simd|variant}0' directive">;
10191def err_omp_function_expected : Error<
10192  "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
10193def err_omp_wrong_cancel_region : Error<
10194  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
10195def err_omp_parent_cancel_region_nowait : Error<
10196  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
10197def err_omp_parent_cancel_region_ordered : Error<
10198  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
10199def err_omp_reduction_wrong_type : Error<"reduction type cannot be %select{qualified with 'const', 'volatile' or 'restrict'|a function|a reference|an array}0 type">;
10200def err_omp_wrong_var_in_declare_reduction : Error<"only %select{'omp_priv' or 'omp_orig'|'omp_in' or 'omp_out'}0 variables are allowed in %select{initializer|combiner}0 expression">;
10201def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
10202def err_omp_mapper_wrong_type : Error<
10203  "mapper type must be of struct, union or class type">;
10204def err_omp_declare_mapper_wrong_var : Error<
10205  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
10206def err_omp_declare_mapper_redefinition : Error<
10207  "redefinition of user-defined mapper for type %0 with name %1">;
10208def err_omp_invalid_mapper: Error<
10209  "cannot find a valid user-defined mapper for type %0 with name %1">;
10210def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
10211def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
10212def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
10213def err_omp_typecheck_section_value : Error<
10214  "subscripted value is not an array or pointer">;
10215def err_omp_typecheck_section_not_integer : Error<
10216  "array section %select{lower bound|length}0 is not an integer">;
10217def err_omp_typecheck_shaping_not_integer : Error<
10218  "array shaping operation dimension is not an integer">;
10219def err_omp_shaping_dimension_not_positive : Error<
10220  "array shaping dimension is evaluated to a non-positive value %0">;
10221def err_omp_section_function_type : Error<
10222  "section of pointer to function type %0">;
10223def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
10224  InGroup<CharSubscript>, DefaultIgnore;
10225def err_omp_section_incomplete_type : Error<
10226  "section of pointer to incomplete type %0">;
10227def err_omp_section_not_subset_of_array : Error<
10228  "array section must be a subset of the original array">;
10229def err_omp_section_length_negative : Error<
10230  "section length is evaluated to a negative value %0">;
10231def err_omp_section_stride_non_positive : Error<
10232  "section stride is evaluated to a non-positive value %0">;
10233def err_omp_section_length_undefined : Error<
10234  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
10235def err_omp_wrong_linear_modifier : Error<
10236  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
10237def err_omp_wrong_linear_modifier_non_reference : Error<
10238  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
10239def err_omp_wrong_simdlen_safelen_values : Error<
10240  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
10241def err_omp_wrong_if_directive_name_modifier : Error<
10242  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
10243def err_omp_no_more_if_clause : Error<
10244  "no more 'if' clause is allowed">;
10245def err_omp_unnamed_if_clause : Error<
10246  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
10247def note_omp_previous_named_if_clause : Note<
10248  "previous clause with directive name modifier specified here">;
10249def err_omp_ordered_directive_with_param : Error<
10250  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
10251def err_omp_ordered_directive_without_param : Error<
10252  "'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter">;
10253def note_omp_ordered_param : Note<
10254  "'ordered' clause%select{| with specified parameter}0">;
10255def err_omp_expected_base_var_name : Error<
10256  "expected variable name as a base of the array %select{subscript|section}0">;
10257def err_omp_map_shared_storage : Error<
10258  "variable already marked as mapped in current construct">;
10259def err_omp_invalid_map_type_for_directive : Error<
10260  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
10261def err_omp_no_clause_for_directive : Error<
10262  "expected at least one %0 clause for '#pragma omp %1'">;
10263def err_omp_threadprivate_in_clause : Error<
10264  "threadprivate variables are not allowed in '%0' clause">;
10265def err_omp_wrong_ordered_loop_count : Error<
10266  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
10267def note_collapse_loop_count : Note<
10268  "parameter of the 'collapse' clause">;
10269def err_omp_clauses_mutually_exclusive : Error<
10270  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
10271def note_omp_previous_clause : Note<
10272  "'%0' clause is specified here">;
10273def err_omp_hint_clause_no_name : Error<
10274  "the name of the construct must be specified in presence of 'hint' clause">;
10275def err_omp_critical_with_hint : Error<
10276  "constructs with the same name must have a 'hint' clause with the same value">;
10277def note_omp_critical_hint_here : Note<
10278  "%select{|previous }0'hint' clause with value '%1'">;
10279def note_omp_critical_no_hint : Note<
10280  "%select{|previous }0directive with no 'hint' clause specified">;
10281def err_omp_depend_clause_thread_simd : Error<
10282  "'depend' clauses cannot be mixed with '%0' clause">;
10283def err_omp_depend_sink_expected_loop_iteration : Error<
10284  "expected%select{| %1}0 loop iteration variable">;
10285def err_omp_depend_sink_unexpected_expr : Error<
10286  "unexpected expression: number of expressions is larger than the number of associated loops">;
10287def err_omp_depend_sink_expected_plus_minus : Error<
10288  "expected '+' or '-' operation">;
10289def err_omp_depend_sink_source_not_allowed : Error<
10290  "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
10291def err_omp_depend_zero_length_array_section_not_allowed : Error<
10292  "zero-length array section is not allowed in 'depend' clause">;
10293def err_omp_depend_sink_source_with_modifier : Error<
10294  "depend modifier cannot be used with 'sink' or 'source' depend type">;
10295def err_omp_depend_modifier_not_iterator : Error<
10296  "expected iterator specification as depend modifier">;
10297def err_omp_linear_ordered : Error<
10298  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
10299def err_omp_unexpected_schedule_modifier : Error<
10300  "modifier '%0' cannot be used along with modifier '%1'">;
10301def err_omp_schedule_nonmonotonic_static : Error<
10302  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
10303def err_omp_simple_clause_incompatible_with_ordered : Error<
10304  "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
10305def err_omp_ordered_simd : Error<
10306  "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
10307def err_omp_variable_in_given_clause_and_dsa : Error<
10308  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
10309def err_omp_param_or_this_in_clause : Error<
10310  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
10311def err_omp_expected_uniform_param : Error<
10312  "expected a reference to a parameter specified in a 'uniform' clause">;
10313def err_omp_expected_int_param : Error<
10314  "expected a reference to an integer-typed parameter">;
10315def err_omp_at_least_one_motion_clause_required : Error<
10316  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
10317def err_omp_usedeviceptr_not_a_pointer : Error<
10318  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
10319def err_omp_argument_type_isdeviceptr : Error <
10320  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
10321def warn_omp_nesting_simd : Warning<
10322  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
10323  InGroup<SourceUsesOpenMP>;
10324def err_omp_orphaned_device_directive : Error<
10325  "orphaned 'omp %0' directives are prohibited"
10326  "; perhaps you forget to enclose the directive into a "
10327  "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
10328def err_omp_reduction_non_addressable_expression : Error<
10329  "expected addressable reduction item for the task-based directives">;
10330def err_omp_reduction_with_nogroup : Error<
10331  "'reduction' clause cannot be used with 'nogroup' clause">;
10332def err_omp_reduction_vla_unsupported : Error<
10333  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
10334def err_omp_linear_distribute_var_non_loop_iteration : Error<
10335  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
10336def warn_omp_non_trivial_type_mapped : Warning<
10337  "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
10338  InGroup<OpenMPMapping>;
10339def err_omp_requires_clause_redeclaration : Error <
10340  "Only one %0 clause can appear on a requires directive in a single translation unit">;
10341def note_omp_requires_previous_clause : Note <
10342  "%0 clause previously used here">;
10343def err_omp_directive_before_requires : Error <
10344  "'%0' region encountered before requires directive with '%1' clause">;
10345def note_omp_requires_encountered_directive : Note <
10346  "'%0' previously encountered here">;
10347def err_omp_invalid_scope : Error <
10348  "'#pragma omp %0' directive must appear only in file scope">;
10349def note_omp_invalid_length_on_this_ptr_mapping : Note <
10350  "expected length on mapping of 'this' array section expression to be '1'">;
10351def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
10352  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
10353def note_omp_invalid_subscript_on_this_ptr_map : Note <
10354  "expected 'this' subscript expression on map clause to be 'this[0]'">;
10355def err_omp_invalid_map_this_expr : Error <
10356  "invalid 'this' expression on 'map' clause">;
10357def err_omp_implied_type_not_found : Error<
10358  "'%0' type not found; include <omp.h>">;
10359def err_omp_expected_omp_depend_t_lvalue : Error<
10360  "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
10361def err_omp_depobj_expected : Error<
10362  "expected depobj expression">;
10363def err_omp_depobj_single_clause_expected : Error<
10364  "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
10365def err_omp_scan_single_clause_expected : Error<
10366  "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
10367def err_omp_inclusive_exclusive_not_reduction : Error<
10368  "the list item must appear in 'reduction' clause with the 'inscan' modifier "
10369  "of the parent directive">;
10370def err_omp_reduction_not_inclusive_exclusive : Error<
10371  "the inscan reduction list item must appear as a list item in an 'inclusive' or"
10372  " 'exclusive' clause on an inner 'omp scan' directive">;
10373def err_omp_wrong_inscan_reduction : Error<
10374  "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
10375  " 'omp parallel for', or 'omp parallel for simd' directive">;
10376def err_omp_inscan_reduction_expected : Error<
10377  "expected 'reduction' clause with the 'inscan' modifier">;
10378def note_omp_previous_inscan_reduction : Note<
10379  "'reduction' clause with 'inscan' modifier is used here">;
10380def err_omp_expected_predefined_allocator : Error<
10381  "expected one of the predefined allocators for the variables with the static "
10382  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
10383  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
10384  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
10385def warn_omp_used_different_allocator : Warning<
10386  "allocate directive specifies %select{default|'%1'}0 allocator while "
10387  "previously used %select{default|'%3'}2">,
10388  InGroup<OpenMPClauses>;
10389def note_omp_previous_allocator : Note<
10390  "previous allocator is specified here">;
10391def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
10392  "inside of the target region; provide an 'allocator' clause or use 'requires'"
10393  " directive with the 'dynamic_allocators' clause">;
10394def err_expected_allocator_expression : Error<"expected an allocator expression "
10395  "inside of the target region; provide an allocator expression or use 'requires'"
10396  " directive with the 'dynamic_allocators' clause">;
10397def warn_omp_allocate_thread_on_task_target_directive : Warning<
10398  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
10399  InGroup<OpenMPClauses>;
10400def err_omp_expected_private_copy_for_allocate : Error<
10401  "the referenced item is not found in any private clause on the same directive">;
10402def err_omp_stmt_depends_on_loop_counter : Error<
10403  "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
10404def err_omp_invariant_or_linear_dependency : Error<
10405  "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
10406def err_omp_wrong_dependency_iterator_type : Error<
10407  "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
10408def err_device_unsupported_type : Error <
10409  "%0 requires %1 bit size %2 type support, but device '%3' does not support it">;
10410def err_omp_lambda_capture_in_declare_target_not_to : Error<
10411  "variable captured in declare target region must appear in a to clause">;
10412def err_omp_device_type_mismatch : Error<
10413  "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
10414def err_omp_wrong_device_function_call : Error<
10415  "function with 'device_type(%0)' is not available on %select{device|host}1">;
10416def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
10417def warn_omp_declare_target_after_first_use : Warning<
10418  "declaration marked as declare target after first use, it may lead to incorrect results">,
10419  InGroup<OpenMPTarget>;
10420def err_omp_declare_variant_incompat_attributes : Error<
10421  "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
10422def warn_omp_declare_variant_score_not_constant
10423    : Warning<"score expressions in the OpenMP context selector need to be "
10424              "constant; %0 is not and will be ignored">,
10425      InGroup<SourceUsesOpenMP>;
10426def err_omp_declare_variant_user_condition_not_constant
10427    : Error<"the user condition in the OpenMP context selector needs to be "
10428            "constant; %0 is not">;
10429def warn_omp_declare_variant_after_used : Warning<
10430  "'#pragma omp declare variant' cannot be applied for function after first "
10431  "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
10432def warn_omp_declare_variant_after_emitted : Warning<
10433  "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
10434  " the original function might be used">, InGroup<SourceUsesOpenMP>;
10435def err_omp_declare_variant_doesnt_support : Error<
10436  "'#pragma omp declare variant' does not "
10437  "support %select{function templates|virtual functions|"
10438  "deduced return types|constructors|destructors|deleted functions|"
10439  "defaulted functions|constexpr functions|consteval function}0">;
10440def err_omp_declare_variant_diff : Error<
10441  "function with '#pragma omp declare variant' has a different %select{calling convention"
10442  "|return type|constexpr specification|inline specification|storage class|"
10443  "linkage}0">;
10444def err_omp_declare_variant_incompat_types : Error<
10445  "variant in '#pragma omp declare variant' with type %0 is incompatible with type %1"
10446  >;
10447def warn_omp_declare_variant_marked_as_declare_variant : Warning<
10448  "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
10449  >, InGroup<SourceUsesOpenMP>;
10450def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
10451def err_omp_one_defaultmap_each_category: Error<
10452  "at most one defaultmap clause for each variable-category can appear on the directive">;
10453def err_omp_lastprivate_conditional_non_scalar : Error<
10454  "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
10455  >;
10456def err_omp_flush_order_clause_and_list : Error<
10457  "'flush' directive with memory order clause '%0' cannot have the list">;
10458def note_omp_flush_order_clause_here : Note<
10459  "memory order clause '%0' is specified here">;
10460def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
10461  "expected addressable lvalue in '%0' clause">;
10462def err_omp_var_expected : Error<
10463  "expected variable of the '%0' type%select{|, not %2}1">;
10464def warn_unknown_declare_variant_isa_trait
10465    : Warning<"isa trait '%0' is not known to the current target; verify the "
10466              "spelling or consider restricting the context selector with the "
10467              "'arch' selector further">,
10468      InGroup<SourceUsesOpenMP>;
10469def err_omp_non_pointer_type_array_shaping_base : Error<
10470  "expected expression with a pointer to a complete type as a base of an array "
10471  "shaping operation">;
10472def err_omp_reduction_task_not_parallel_or_worksharing : Error<
10473  "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
10474  " worksharing constructs">;
10475def err_omp_expected_array_alloctraits : Error<
10476  "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
10477def err_omp_predefined_allocator_with_traits : Error<
10478  "predefined allocator cannot have traits specified">;
10479def note_omp_predefined_allocator : Note<
10480  "predefined trait '%0' used here">;
10481def err_omp_nonpredefined_allocator_without_traits : Error<
10482  "non-predefined allocator must have traits specified">;
10483def err_omp_allocator_used_in_clauses : Error<
10484  "allocators used in 'uses_allocators' clause cannot appear in other "
10485  "data-sharing or data-mapping attribute clauses">;
10486def err_omp_allocator_not_in_uses_allocators : Error<
10487  "allocator must be specified in the 'uses_allocators' clause">;
10488def note_omp_protected_structured_block
10489    : Note<"jump bypasses OpenMP structured block">;
10490def note_omp_exits_structured_block
10491    : Note<"jump exits scope of OpenMP structured block">;
10492} // end of OpenMP category
10493
10494let CategoryName = "Related Result Type Issue" in {
10495// Objective-C related result type compatibility
10496def warn_related_result_type_compatibility_class : Warning<
10497  "method is expected to return an instance of its class type "
10498  "%diff{$, but is declared to return $|"
10499  ", but is declared to return different type}0,1">;
10500def warn_related_result_type_compatibility_protocol : Warning<
10501  "protocol method is expected to return an instance of the implementing "
10502  "class, but is declared to return %0">;
10503def note_related_result_type_family : Note<
10504  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
10505  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
10506  "self}1' method family%select{| and is expected to return an instance of its "
10507  "class type}0">;
10508def note_related_result_type_overridden : Note<
10509  "overridden method returns an instance of its class type">;
10510def note_related_result_type_inferred : Note<
10511  "%select{class|instance}0 method %1 is assumed to return an instance of "
10512  "its receiver type (%2)">;
10513def note_related_result_type_explicit : Note<
10514  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
10515  "%select{| and is expected to return an instance of its class type}0">;
10516def err_invalid_type_for_program_scope_var : Error<
10517  "the %0 type cannot be used to declare a program scope variable">;
10518
10519}
10520
10521let CategoryName = "Modules Issue" in {
10522def err_module_decl_in_module_map_module : Error<
10523  "'module' declaration found while building module from module map">;
10524def err_module_decl_in_header_module : Error<
10525  "'module' declaration found while building header unit">;
10526def err_module_interface_implementation_mismatch : Error<
10527  "missing 'export' specifier in module declaration while "
10528  "building module interface">;
10529def err_current_module_name_mismatch : Error<
10530  "module name '%0' specified on command line does not match name of module">;
10531def err_module_redefinition : Error<
10532  "redefinition of module '%0'">;
10533def note_prev_module_definition : Note<"previously defined here">;
10534def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
10535def err_module_not_defined : Error<
10536  "definition of module '%0' is not available; use -fmodule-file= to specify "
10537  "path to precompiled module interface">;
10538def err_module_redeclaration : Error<
10539  "translation unit contains multiple module declarations">;
10540def note_prev_module_declaration : Note<"previous module declaration is here">;
10541def err_module_declaration_missing : Error<
10542  "missing 'export module' declaration in module interface unit">;
10543def err_module_declaration_missing_after_global_module_introducer : Error<
10544  "missing 'module' declaration at end of global module fragment "
10545  "introduced here">;
10546def err_module_private_specialization : Error<
10547  "%select{template|partial|member}0 specialization cannot be "
10548  "declared __module_private__">;
10549def err_module_private_local : Error<
10550  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
10551  "__module_private__">;
10552def err_module_private_local_class : Error<
10553  "local %select{struct|interface|union|class|enum}0 cannot be declared "
10554  "__module_private__">;
10555def err_module_unimported_use : Error<
10556  "%select{declaration|definition|default argument|"
10557  "explicit specialization|partial specialization}0 of %1 must be imported "
10558  "from module '%2' before it is required">;
10559def err_module_unimported_use_header : Error<
10560  "%select{missing '#include'|missing '#include %3'}2; "
10561  "%select{||default argument of |explicit specialization of |"
10562  "partial specialization of }0%1 must be "
10563  "%select{declared|defined|defined|declared|declared}0 "
10564  "before it is used">;
10565def err_module_unimported_use_multiple : Error<
10566  "%select{declaration|definition|default argument|"
10567  "explicit specialization|partial specialization}0 of %1 must be imported "
10568  "from one of the following modules before it is required:%2">;
10569def note_unreachable_entity : Note<
10570  "%select{declaration|definition|default argument declared|"
10571  "explicit specialization declared|partial specialization declared}0 here "
10572  "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
10573def ext_module_import_in_extern_c : ExtWarn<
10574  "import of C++ module '%0' appears within extern \"C\" language linkage "
10575  "specification">, DefaultError,
10576  InGroup<DiagGroup<"module-import-in-extern-c">>;
10577def err_module_import_not_at_top_level_fatal : Error<
10578  "import of module '%0' appears within %1">, DefaultFatal;
10579def ext_module_import_not_at_top_level_noop : ExtWarn<
10580  "redundant #include of module '%0' appears within %1">, DefaultError,
10581  InGroup<DiagGroup<"modules-import-nested-redundant">>;
10582def note_module_import_not_at_top_level : Note<"%0 begins here">;
10583def err_module_self_import : Error<
10584  "import of module '%0' appears within same top-level module '%1'">;
10585def err_module_import_in_implementation : Error<
10586  "@import of module '%0' in implementation of '%1'; use #import">;
10587
10588// C++ Modules
10589def err_module_decl_not_at_start : Error<
10590  "module declaration must occur at the start of the translation unit">;
10591def note_global_module_introducer_missing : Note<
10592  "add 'module;' to the start of the file to introduce a "
10593  "global module fragment">;
10594def err_export_within_anonymous_namespace : Error<
10595  "export declaration appears within anonymous namespace">;
10596def note_anonymous_namespace : Note<"anonymous namespace begins here">;
10597def ext_export_no_name_block : ExtWarn<
10598  "ISO C++20 does not permit %select{an empty|a static_assert}0 declaration "
10599  "to appear in an export block">, InGroup<ExportUnnamed>;
10600def ext_export_no_names : ExtWarn<
10601  "ISO C++20 does not permit a declaration that does not introduce any names "
10602  "to be exported">, InGroup<ExportUnnamed>;
10603def note_export : Note<"export block begins here">;
10604def err_export_no_name : Error<
10605  "%select{empty|static_assert|asm}0 declaration cannot be exported">;
10606def ext_export_using_directive : ExtWarn<
10607  "ISO C++20 does not permit using directive to be exported">,
10608  InGroup<DiagGroup<"export-using-directive">>;
10609def err_export_within_export : Error<
10610  "export declaration appears within another export declaration">;
10611def err_export_internal : Error<
10612  "declaration of %0 with internal linkage cannot be exported">;
10613def err_export_using_internal : Error<
10614  "using declaration referring to %0 with internal linkage cannot be exported">;
10615def err_export_not_in_module_interface : Error<
10616  "export declaration can only be used within a module interface unit"
10617  "%select{ after the module declaration|}0">;
10618def err_export_in_private_module_fragment : Error<
10619  "export declaration cannot be used in a private module fragment">;
10620def note_private_module_fragment : Note<
10621  "private module fragment begins here">;
10622def err_private_module_fragment_not_module : Error<
10623  "private module fragment declaration with no preceding module declaration">;
10624def err_private_module_fragment_redefined : Error<
10625  "private module fragment redefined">;
10626def err_private_module_fragment_not_module_interface : Error<
10627  "private module fragment in module implementation unit">;
10628def note_not_module_interface_add_export : Note<
10629  "add 'export' here if this is intended to be a module interface unit">;
10630
10631def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
10632  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
10633  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
10634def note_equivalent_internal_linkage_decl : Note<
10635  "declared here%select{ in module '%1'|}0">;
10636
10637def note_redefinition_modules_same_file : Note<
10638  "'%0' included multiple times, additional include site in header from module '%1'">;
10639def note_redefinition_include_same_file : Note<
10640  "'%0' included multiple times, additional include site here">;
10641}
10642
10643let CategoryName = "Coroutines Issue" in {
10644def err_return_in_coroutine : Error<
10645  "return statement not allowed in coroutine; did you mean 'co_return'?">;
10646def note_declared_coroutine_here : Note<
10647  "function is a coroutine due to use of '%0' here">;
10648def err_coroutine_objc_method : Error<
10649  "Objective-C methods as coroutines are not yet supported">;
10650def err_coroutine_unevaluated_context : Error<
10651  "'%0' cannot be used in an unevaluated context">;
10652def err_coroutine_within_handler : Error<
10653  "'%0' cannot be used in the handler of a try block">;
10654def err_coroutine_outside_function : Error<
10655  "'%0' cannot be used outside a function">;
10656def err_coroutine_invalid_func_context : Error<
10657  "'%1' cannot be used in %select{a constructor|a destructor"
10658  "|the 'main' function|a constexpr function"
10659  "|a function with a deduced return type|a varargs function"
10660  "|a consteval function}0">;
10661def err_implied_coroutine_type_not_found : Error<
10662  "%0 type was not found; include <experimental/coroutine> before defining "
10663  "a coroutine">;
10664def err_implicit_coroutine_std_nothrow_type_not_found : Error<
10665  "std::nothrow was not found; include <new> before defining a coroutine which "
10666  "uses get_return_object_on_allocation_failure()">;
10667def err_malformed_std_nothrow : Error<
10668  "std::nothrow must be a valid variable declaration">;
10669def err_malformed_std_coroutine_handle : Error<
10670  "std::experimental::coroutine_handle must be a class template">;
10671def err_coroutine_handle_missing_member : Error<
10672  "std::experimental::coroutine_handle missing a member named '%0'">;
10673def err_malformed_std_coroutine_traits : Error<
10674  "'std::experimental::coroutine_traits' must be a class template">;
10675def err_implied_std_coroutine_traits_promise_type_not_found : Error<
10676  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
10677def err_implied_std_coroutine_traits_promise_type_not_class : Error<
10678  "this function cannot be a coroutine: %0 is not a class">;
10679def err_coroutine_promise_type_incomplete : Error<
10680  "this function cannot be a coroutine: %0 is an incomplete type">;
10681def err_coroutine_type_missing_specialization : Error<
10682  "this function cannot be a coroutine: missing definition of "
10683  "specialization %0">;
10684def err_coroutine_promise_incompatible_return_functions : Error<
10685  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
10686def err_coroutine_promise_requires_return_function : Error<
10687  "the coroutine promise type %0 must declare either 'return_value' or 'return_void'">;
10688def note_coroutine_promise_implicit_await_transform_required_here : Note<
10689  "call to 'await_transform' implicitly required by 'co_await' here">;
10690def note_coroutine_promise_suspend_implicitly_required : Note<
10691  "call to '%select{initial_suspend|final_suspend}0' implicitly "
10692  "required by the %select{initial suspend point|final suspend point}0">;
10693def err_coroutine_promise_unhandled_exception_required : Error<
10694  "%0 is required to declare the member 'unhandled_exception()'">;
10695def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
10696  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
10697  InGroup<CoroutineMissingUnhandledException>;
10698def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
10699  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
10700def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
10701  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
10702def err_coroutine_promise_new_requires_nothrow : Error<
10703  "%0 is required to have a non-throwing noexcept specification when the promise "
10704   "type declares 'get_return_object_on_allocation_failure()'">;
10705def note_coroutine_promise_call_implicitly_required : Note<
10706  "call to %0 implicitly required by coroutine function here">;
10707def err_await_suspend_invalid_return_type : Error<
10708  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
10709>;
10710def note_await_ready_no_bool_conversion : Note<
10711  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
10712>;
10713def warn_coroutine_handle_address_invalid_return_type : Warning <
10714  "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">,
10715  InGroup<Coroutine>;
10716def err_coroutine_promise_final_suspend_requires_nothrow : Error<
10717  "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
10718>;
10719def note_coroutine_function_declare_noexcept : Note<
10720  "must be declared with 'noexcept'"
10721>;
10722} // end of coroutines issue category
10723
10724let CategoryName = "Documentation Issue" in {
10725def warn_not_a_doxygen_trailing_member_comment : Warning<
10726  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
10727} // end of documentation issue category
10728
10729let CategoryName = "Nullability Issue" in {
10730
10731def warn_mismatched_nullability_attr : Warning<
10732  "nullability specifier %0 conflicts with existing specifier %1">,
10733  InGroup<Nullability>;
10734
10735def warn_nullability_declspec : Warning<
10736  "nullability specifier %0 cannot be applied "
10737  "to non-pointer type %1; did you mean to apply the specifier to the "
10738  "%select{pointer|block pointer|member pointer|function pointer|"
10739  "member function pointer}2?">,
10740  InGroup<NullabilityDeclSpec>,
10741  DefaultError;
10742
10743def note_nullability_here : Note<"%0 specified here">;
10744
10745def err_nullability_nonpointer : Error<
10746  "nullability specifier %0 cannot be applied to non-pointer type %1">;
10747
10748def warn_nullability_lost : Warning<
10749  "implicit conversion from nullable pointer %0 to non-nullable pointer "
10750  "type %1">,
10751  InGroup<NullableToNonNullConversion>, DefaultIgnore;
10752def warn_zero_as_null_pointer_constant : Warning<
10753  "zero as null pointer constant">,
10754  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
10755
10756def err_nullability_cs_multilevel : Error<
10757  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
10758def note_nullability_type_specifier : Note<
10759  "use nullability type specifier %0 to affect the innermost "
10760  "pointer type of %1">;
10761
10762def warn_null_resettable_setter : Warning<
10763  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
10764  InGroup<Nullability>;
10765
10766def warn_nullability_missing : Warning<
10767  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
10768  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
10769  InGroup<NullabilityCompleteness>;
10770def warn_nullability_missing_array : Warning<
10771  "array parameter is missing a nullability type specifier (_Nonnull, "
10772  "_Nullable, or _Null_unspecified)">,
10773  InGroup<NullabilityCompletenessOnArrays>;
10774def note_nullability_fix_it : Note<
10775  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
10776  "%select{pointer|block pointer|member pointer|array parameter}1 "
10777  "%select{should never be null|may be null|should not declare nullability}0">;
10778
10779def warn_nullability_inferred_on_nested_type : Warning<
10780  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
10781  "deprecated">,
10782  InGroup<NullabilityInferredOnNestedType>;
10783
10784def err_objc_type_arg_explicit_nullability : Error<
10785  "type argument %0 cannot explicitly specify nullability">;
10786
10787def err_objc_type_param_bound_explicit_nullability : Error<
10788  "type parameter %0 bound %1 cannot explicitly specify nullability">;
10789
10790}
10791
10792let CategoryName = "Generics Issue" in {
10793
10794def err_objc_type_param_bound_nonobject : Error<
10795  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
10796
10797def err_objc_type_param_bound_missing_pointer : Error<
10798  "missing '*' in type bound %0 for type parameter %1">;
10799def err_objc_type_param_bound_qualified : Error<
10800  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
10801
10802def err_objc_type_param_redecl : Error<
10803  "redeclaration of type parameter %0">;
10804
10805def err_objc_type_param_arity_mismatch : Error<
10806  "%select{forward class declaration|class definition|category|extension}0 has "
10807  "too %select{few|many}1 type parameters (expected %2, have %3)">;
10808
10809def err_objc_type_param_bound_conflict : Error<
10810  "type bound %0 for type parameter %1 conflicts with "
10811  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
10812
10813def err_objc_type_param_variance_conflict : Error<
10814  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
10815  "%select{in|co|contra}2variant type parameter %3">;
10816
10817def note_objc_type_param_here : Note<"type parameter %0 declared here">;
10818
10819def err_objc_type_param_bound_missing : Error<
10820  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
10821
10822def err_objc_parameterized_category_nonclass : Error<
10823  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
10824  "parameters">;
10825
10826def err_objc_parameterized_forward_class : Error<
10827  "forward declaration of non-parameterized class %0 cannot have type "
10828  "parameters">;
10829
10830def err_objc_parameterized_forward_class_first : Error<
10831  "class %0 previously declared with type parameters">;
10832
10833def err_objc_type_arg_missing_star : Error<
10834  "type argument %0 must be a pointer (requires a '*')">;
10835def err_objc_type_arg_qualified : Error<
10836  "type argument %0 cannot be qualified with '%1'">;
10837
10838def err_objc_type_arg_missing : Error<
10839  "no type or protocol named %0">;
10840
10841def err_objc_type_args_and_protocols : Error<
10842  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
10843  "%select{protocol|type}0 (%2)">;
10844
10845def err_objc_type_args_non_class : Error<
10846  "type arguments cannot be applied to non-class type %0">;
10847
10848def err_objc_type_args_non_parameterized_class : Error<
10849  "type arguments cannot be applied to non-parameterized class %0">;
10850
10851def err_objc_type_args_specialized_class : Error<
10852  "type arguments cannot be applied to already-specialized class type %0">;
10853
10854def err_objc_type_args_wrong_arity : Error<
10855  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
10856}
10857
10858def err_objc_type_arg_not_id_compatible : Error<
10859  "type argument %0 is neither an Objective-C object nor a block type">;
10860
10861def err_objc_type_arg_does_not_match_bound : Error<
10862  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
10863
10864def warn_objc_redundant_qualified_class_type : Warning<
10865  "parameterized class %0 already conforms to the protocols listed; did you "
10866  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
10867
10868def warn_block_literal_attributes_on_omitted_return_type : Warning<
10869  "attribute %0 ignored, because it cannot be applied to omitted return type">,
10870  InGroup<IgnoredAttributes>;
10871
10872def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
10873  "'%0' qualifier on omitted return type %1 has no effect">,
10874  InGroup<IgnoredQualifiers>;
10875
10876def warn_shadow_field : Warning<
10877  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
10878  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
10879def note_shadow_field : Note<"declared here">;
10880
10881def err_multiversion_required_in_redecl : Error<
10882  "function declaration is missing %select{'target'|'cpu_specific' or "
10883  "'cpu_dispatch'}0 attribute in a multiversioned function">;
10884def note_multiversioning_caused_here : Note<
10885  "function multiversioning caused by this declaration">;
10886def err_multiversion_after_used : Error<
10887  "function declaration cannot become a multiversioned function after first "
10888  "usage">;
10889def err_bad_multiversion_option : Error<
10890  "function multiversioning doesn't support %select{feature|architecture}0 "
10891  "'%1'">;
10892def err_multiversion_duplicate : Error<
10893  "multiversioned function redeclarations require identical target attributes">;
10894def err_multiversion_noproto : Error<
10895  "multiversioned function must have a prototype">;
10896def err_multiversion_disallowed_other_attr : Error<
10897  "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioning cannot be combined"
10898  " with attribute %1">;
10899def err_multiversion_mismatched_attrs
10900    : Error<"attributes on multiversioned functions must all match, attribute "
10901            "%0 %select{is missing|has different arguments}1">;
10902def err_multiversion_diff : Error<
10903  "multiversioned function declaration has a different %select{calling convention"
10904  "|return type|constexpr specification|inline specification|storage class|"
10905  "linkage}0">;
10906def err_multiversion_doesnt_support : Error<
10907  "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioned functions do not "
10908  "yet support %select{function templates|virtual functions|"
10909  "deduced return types|constructors|destructors|deleted functions|"
10910  "defaulted functions|constexpr functions|consteval function}1">;
10911def err_multiversion_not_allowed_on_main : Error<
10912  "'main' cannot be a multiversioned function">;
10913def err_multiversion_not_supported : Error<
10914 "function multiversioning is not supported on the current target">;
10915def err_multiversion_types_mixed : Error<
10916  "multiversioning attributes cannot be combined">;
10917def err_cpu_dispatch_mismatch : Error<
10918 "'cpu_dispatch' function redeclared with different CPUs">;
10919def err_cpu_specific_multiple_defs : Error<
10920 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
10921def warn_multiversion_duplicate_entries : Warning<
10922 "CPU list contains duplicate entries; attribute ignored">,
10923  InGroup<FunctionMultiVersioning>;
10924def warn_dispatch_body_ignored : Warning<
10925  "body of cpu_dispatch function will be ignored">,
10926  InGroup<FunctionMultiVersioning>;
10927
10928// three-way comparison operator diagnostics
10929def err_implied_comparison_category_type_not_found : Error<
10930  "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
10931  "because type '%0' was not found; include <compare>">;
10932def err_spaceship_argument_narrowing : Error<
10933  "argument to 'operator<=>' "
10934  "%select{cannot be narrowed from type %1 to %2|"
10935  "evaluates to %1, which cannot be narrowed to type %2}0">;
10936def err_std_compare_type_not_supported : Error<
10937  "standard library implementation of %0 is not supported; "
10938   "%select{member '%2' does not have expected form|"
10939   "member '%2' is missing|"
10940   "the type is not trivially copyable|"
10941   "the type does not have the expected form}1">;
10942def note_rewriting_operator_as_spaceship : Note<
10943  "while rewriting comparison as call to 'operator<=>' declared here">;
10944def err_three_way_vector_comparison : Error<
10945  "three-way comparison between vectors is not supported">;
10946
10947// Memory Tagging Extensions (MTE) diagnostics
10948def err_memtag_arg_null_or_pointer : Error<
10949  "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
10950def err_memtag_any2arg_pointer : Error<
10951  "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
10952def err_memtag_arg_must_be_pointer : Error<
10953  "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
10954def err_memtag_arg_must_be_integer : Error<
10955  "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
10956
10957def warn_dereference_of_noderef_type : Warning<
10958  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
10959def warn_dereference_of_noderef_type_no_decl : Warning<
10960  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
10961def warn_noderef_on_non_pointer_or_array : Warning<
10962  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
10963def warn_noderef_to_dereferenceable_pointer : Warning<
10964  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
10965
10966def err_builtin_launder_invalid_arg : Error<
10967  "%select{non-pointer|function pointer|void pointer}0 argument to "
10968  "'__builtin_launder' is not allowed">;
10969
10970def err_builtin_matrix_disabled: Error<
10971  "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
10972def err_matrix_index_not_integer: Error<
10973  "matrix %select{row|column}0 index is not an integer">;
10974def err_matrix_index_outside_range: Error<
10975  "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
10976def err_matrix_incomplete_index: Error<
10977  "single subscript expressions are not allowed for matrix values">;
10978def err_matrix_separate_incomplete_index: Error<
10979  "matrix row and column subscripts cannot be separated by any expression">;
10980def err_matrix_subscript_comma: Error<
10981  "comma expressions are not allowed as indices in matrix subscript expressions">;
10982def err_builtin_matrix_arg: Error<"1st argument must be a matrix">;
10983def err_builtin_matrix_scalar_unsigned_arg: Error<
10984  "%0 argument must be a constant unsigned integer expression">;
10985def err_builtin_matrix_pointer_arg: Error<
10986  "%ordinal0 argument must be a pointer to a valid matrix element type">;
10987def err_builtin_matrix_pointer_arg_mismatch: Error<
10988  "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
10989def err_builtin_matrix_store_to_const: Error<
10990  "cannot store matrix to read-only pointer">;
10991def err_builtin_matrix_stride_too_small: Error<
10992  "stride must be greater or equal to the number of rows">;
10993def err_builtin_matrix_invalid_dimension: Error<
10994  "%0 dimension is outside the allowed range [1, %1]">;
10995
10996def warn_mismatched_import : Warning<
10997  "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
10998  "previous declaration">,
10999  InGroup<IgnoredAttributes>;
11000def warn_import_on_definition : Warning<
11001  "import %select{module|name}0 cannot be applied to a function with a definition">,
11002  InGroup<IgnoredAttributes>;
11003
11004def err_preserve_field_info_not_field : Error<
11005  "__builtin_preserve_field_info argument %0 not a field access">;
11006def err_preserve_field_info_not_const: Error<
11007  "__builtin_preserve_field_info argument %0 not a constant">;
11008def err_btf_type_id_not_const: Error<
11009  "__builtin_btf_type_id argument %0 not a constant">;
11010def err_preserve_type_info_invalid : Error<
11011  "__builtin_preserve_type_info argument %0 invalid">;
11012def err_preserve_type_info_not_const: Error<
11013  "__builtin_preserve_type_info argument %0 not a constant">;
11014def err_preserve_enum_value_invalid : Error<
11015  "__builtin_preserve_enum_value argument %0 invalid">;
11016def err_preserve_enum_value_not_const: Error<
11017  "__builtin_preserve_enum_value argument %0 not a constant">;
11018
11019def err_bit_cast_non_trivially_copyable : Error<
11020  "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
11021def err_bit_cast_type_size_mismatch : Error<
11022  "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
11023
11024// SYCL-specific diagnostics
11025def warn_sycl_kernel_num_of_template_params : Warning<
11026  "'sycl_kernel' attribute only applies to a function template with at least"
11027  " two template parameters">, InGroup<IgnoredAttributes>;
11028def warn_sycl_kernel_invalid_template_param_type : Warning<
11029  "template parameter of a function template with the 'sycl_kernel' attribute"
11030  " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
11031def warn_sycl_kernel_num_of_function_params : Warning<
11032  "function template with 'sycl_kernel' attribute must have a single parameter">,
11033  InGroup<IgnoredAttributes>;
11034def warn_sycl_kernel_return_type : Warning<
11035  "function template with 'sycl_kernel' attribute must have a 'void' return type">,
11036  InGroup<IgnoredAttributes>;
11037
11038def err_ext_int_bad_size : Error<"%select{signed|unsigned}0 _ExtInt must "
11039                                 "have a bit size of at least %select{2|1}0">;
11040def err_ext_int_max_size : Error<"%select{signed|unsigned}0 _ExtInt of bit "
11041                                 "sizes greater than %1 not supported">;
11042
11043// errors of expect.with.probability
11044def err_probability_not_constant_float : Error<
11045   "probability argument to __builtin_expect_with_probability must be constant "
11046   "floating-point expression">;
11047def err_probability_out_of_range : Error<
11048   "probability argument to __builtin_expect_with_probability is outside the "
11049   "range [0.0, 1.0]">;
11050} // end of sema component.
11051