xref: /freebsd/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td (revision e1c4c8dd8d2d10b6104f06856a77bd5b4813a801)
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">;
69def note_cast_operand_to_int : Note<"cast one or both operands to int to silence this warning">;
70
71// Constant expressions
72def err_expr_not_ice : Error<
73  "expression is not an %select{integer|integral}0 constant expression">;
74def ext_expr_not_ice : Extension<
75  "expression is not an %select{integer|integral}0 constant expression; "
76  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
77def err_typecheck_converted_constant_expression : Error<
78  "value of type %0 is not implicitly convertible to %1">;
79def err_typecheck_converted_constant_expression_disallowed : Error<
80  "conversion from %0 to %1 is not allowed in a converted constant expression">;
81def err_typecheck_converted_constant_expression_indirect : Error<
82  "conversion from %0 to %1 in converted constant expression would "
83  "bind reference to a temporary">;
84def err_expr_not_cce : Error<
85  "%select{case value|enumerator value|non-type template argument|"
86  "array size|explicit specifier argument|noexcept specifier argument|"
87  "call to 'size()'|call to 'data()'}0 is not a constant expression">;
88def ext_cce_narrowing : ExtWarn<
89  "%select{case value|enumerator value|non-type template argument|"
90  "array size|explicit specifier argument|noexcept specifier argument}0 "
91  "%select{cannot be narrowed from type %2 to %3|"
92  "evaluates to %2, which cannot be narrowed to type %3}1">,
93  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
94def err_ice_not_integral : Error<
95  "%select{integer|integral}1 constant expression must have "
96  "%select{integer|integral or unscoped enumeration}1 type, not %0">;
97def err_ice_incomplete_type : Error<
98  "integral constant expression has incomplete class type %0">;
99def err_ice_explicit_conversion : Error<
100  "integral constant expression requires explicit conversion from %0 to %1">;
101def note_ice_conversion_here : Note<
102  "conversion to %select{integral|enumeration}0 type %1 declared here">;
103def err_ice_ambiguous_conversion : Error<
104  "ambiguous conversion from type %0 to an integral or unscoped "
105  "enumeration type">;
106def err_ice_too_large : Error<
107  "integer constant expression evaluates to value %0 that cannot be "
108  "represented in a %1-bit %select{signed|unsigned}2 integer type">;
109def err_expr_not_string_literal : Error<"expression is not a string literal">;
110
111// Semantic analysis of constant literals.
112def ext_predef_outside_function : Warning<
113  "predefined identifier is only valid inside function">,
114  InGroup<DiagGroup<"predefined-identifier-outside-function">>;
115def ext_init_from_predefined : ExtWarn<
116  "initializing an array from a '%0' predefined identifier is a Microsoft extension">,
117  InGroup<MicrosoftInitFromPredefined>;
118def ext_string_literal_from_predefined : ExtWarn<
119  "expansion of predefined identifier '%0' to a string literal is a Microsoft extension">,
120  InGroup<MicrosoftStringLiteralFromPredefined>;
121def warn_float_overflow : Warning<
122  "magnitude of floating-point constant too large for type %0; maximum is %1">,
123   InGroup<LiteralRange>;
124def warn_float_underflow : Warning<
125  "magnitude of floating-point constant too small for type %0; minimum is %1">,
126  InGroup<LiteralRange>;
127def warn_float_compare_literal : Warning<
128  "floating-point comparison is always %select{true|false}0; "
129  "constant cannot be represented exactly in type %1">,
130  InGroup<LiteralRange>;
131def warn_double_const_requires_fp64 : Warning<
132  "double precision constant requires %select{cl_khr_fp64|cl_khr_fp64 and __opencl_c_fp64}0, "
133  "casting to single precision">;
134def err_half_const_requires_fp16 : Error<
135  "half precision constant requires cl_khr_fp16">;
136
137// C99 variable-length arrays
138def ext_vla : Extension<"variable length arrays are a C99 feature">,
139  InGroup<VLAExtension>;
140// In C++ language modes, we warn by default as an extension, while in GNU++
141// language modes, we warn as an extension but add the warning group to -Wall.
142def ext_vla_cxx : ExtWarn<
143  "variable length arrays in C++ are a Clang extension">,
144  InGroup<VLACxxExtension>;
145def ext_vla_cxx_in_gnu_mode : Extension<ext_vla_cxx.Summary>,
146  InGroup<VLACxxExtension>;
147def ext_vla_cxx_static_assert : ExtWarn<
148  "variable length arrays in C++ are a Clang extension; did you mean to use "
149  "'static_assert'?">, InGroup<VLAUseStaticAssert>;
150def ext_vla_cxx_in_gnu_mode_static_assert : Extension<
151  ext_vla_cxx_static_assert.Summary>, InGroup<VLAUseStaticAssert>;
152def warn_vla_used : Warning<"variable length array used">,
153  InGroup<VLA>, DefaultIgnore;
154def err_vla_in_sfinae : Error<
155  "variable length array cannot be formed during template argument deduction">;
156def err_array_star_in_function_definition : Error<
157  "variable length array must be bound in function definition">;
158def err_vla_decl_in_file_scope : Error<
159  "variable length array declaration not allowed at file scope">;
160def err_vla_decl_has_static_storage : Error<
161  "variable length array declaration cannot have 'static' storage duration">;
162def err_vla_decl_has_extern_linkage : Error<
163  "variable length array declaration cannot have 'extern' linkage">;
164def ext_vla_folded_to_constant : ExtWarn<
165  "variable length array folded to constant array as an extension">,
166  InGroup<GNUFoldingConstant>;
167def err_vla_unsupported : Error<
168  "variable length arrays are not supported for %select{the current target|'%1'}0">;
169def err_vla_in_coroutine_unsupported : Error<
170  "variable length arrays in a coroutine are not supported">;
171def note_vla_unsupported : Note<
172  "variable length arrays are not supported for the current target">;
173
174// C99 variably modified types
175def err_variably_modified_template_arg : Error<
176  "variably modified type %0 cannot be used as a template argument">;
177def err_variably_modified_nontype_template_param : Error<
178  "non-type template parameter of variably modified type %0">;
179def err_variably_modified_new_type : Error<
180  "'new' cannot allocate object of variably modified type %0">;
181
182// C99 Designated Initializers
183def ext_designated_init : Extension<
184  "designated initializers are a C99 feature">, InGroup<C99Designator>;
185def err_array_designator_negative : Error<
186  "array designator value '%0' is negative">;
187def err_array_designator_empty_range : Error<
188  "array designator range [%0, %1] is empty">;
189def err_array_designator_non_array : Error<
190  "array designator cannot initialize non-array type %0">;
191def err_array_designator_too_large : Error<
192  "array designator index (%0) exceeds array bounds (%1)">;
193def err_field_designator_non_aggr : Error<
194  "field designator cannot initialize a "
195  "%select{non-struct, non-union|non-class}0 type %1">;
196def err_field_designator_unknown : Error<
197  "field designator %0 does not refer to any field in type %1">;
198def err_field_designator_nonfield : Error<
199  "field designator %0 does not refer to a non-static data member">;
200def note_field_designator_found : Note<"field designator refers here">;
201def err_designator_for_scalar_or_sizeless_init : Error<
202  "designator in initializer for %select{scalar|indivisible sizeless}0 "
203  "type %1">;
204def warn_initializer_overrides : Warning<
205  "initializer %select{partially |}0overrides prior initialization of "
206  "this subobject">, InGroup<InitializerOverrides>;
207def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Summary>,
208  InGroup<InitializerOverrides>, SFINAEFailure;
209def ext_initializer_union_overrides : ExtWarn<warn_initializer_overrides.Summary>,
210  InGroup<InitializerOverrides>, DefaultError, SFINAEFailure;
211def err_initializer_overrides_destructed : Error<
212  "initializer would partially override prior initialization of object of "
213  "type %1 with non-trivial destruction">;
214def note_previous_initializer : Note<
215  "previous initialization %select{|with side effects }0is here"
216  "%select{| (side effects will not occur at run time)}0">;
217def err_designator_into_flexible_array_member : Error<
218  "designator into flexible array member subobject">;
219def note_flexible_array_member : Note<
220  "initialized flexible array member %0 is here">;
221def ext_flexible_array_init : Extension<
222  "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
223
224// C++20 designated initializers
225def ext_cxx_designated_init : Extension<
226  "designated initializers are a C++20 extension">, InGroup<CXX20Designator>,
227  SuppressInSystemMacro;
228def warn_cxx17_compat_designated_init : Warning<
229  "designated initializers are incompatible with C++ standards before C++20">,
230  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
231def ext_designated_init_mixed : ExtWarn<
232  "mixture of designated and non-designated initializers in the same "
233  "initializer list is a C99 extension">, InGroup<C99Designator>;
234def note_designated_init_mixed : Note<
235  "first non-designated initializer is here">;
236def ext_designated_init_array : ExtWarn<
237  "array designators are a C99 extension">, InGroup<C99Designator>;
238def ext_designated_init_nested : ExtWarn<
239  "nested designators are a C99 extension">, InGroup<C99Designator>;
240def ext_designated_init_reordered : ExtWarn<
241  "ISO C++ requires field designators to be specified in declaration order; "
242  "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
243  SFINAEFailure;
244def note_previous_field_init : Note<
245  "previous initialization for field %0 is here">;
246def ext_designated_init_brace_elision : ExtWarn<
247  "brace elision for designated initializer is a C99 extension">,
248  InGroup<C99Designator>, SFINAEFailure;
249
250// Declarations.
251def ext_plain_complex : ExtWarn<
252  "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
253def ext_imaginary_constant : Extension<
254  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
255def ext_integer_complex : Extension<
256  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
257def ext_c23_auto_non_plain_identifier : Extension<
258  "type inference of a declaration other than a plain identifier with optional "
259  "trailing attributes is a Clang extension">,
260  InGroup<DiagGroup<"auto-decl-extensions">>;
261
262def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
263  "'_Fract' or '_Accum', not '%0'">;
264def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
265def err_invalid_width_spec : Error<
266  "'%select{|short|long|long long}0 %1' is invalid">;
267def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
268
269def ext_auto_type_specifier : ExtWarn<
270  "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
271def warn_auto_storage_class : Warning<
272  "'auto' storage class specifier is redundant and incompatible with C++11">,
273  InGroup<CXX11Compat>, DefaultIgnore;
274
275def warn_deprecated_register : Warning<
276  "'register' storage class specifier is deprecated "
277  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
278def ext_register_storage_class : ExtWarn<
279  "ISO C++17 does not allow 'register' storage class specifier">,
280  DefaultError, InGroup<Register>;
281
282def err_invalid_decl_spec_combination : Error<
283  "cannot combine with previous '%0' declaration specifier">;
284def err_invalid_vector_decl_spec_combination : Error<
285  "cannot combine with previous '%0' declaration specifier. "
286  "'__vector' must be first">;
287def err_invalid_pixel_decl_spec_combination : Error<
288  "'__pixel' must be preceded by '__vector'.  "
289  "'%0' declaration specifier not allowed here">;
290def err_invalid_vector_bool_decl_spec : Error<
291  "cannot use '%0' with '__vector bool'">;
292def err_invalid_vector_long_decl_spec : Error<
293  "cannot use 'long' with '__vector'">;
294def err_invalid_vector_float_decl_spec : Error<
295  "cannot use 'float' with '__vector'">;
296def err_invalid_vector_double_decl_spec : Error <
297  "use of 'double' with '__vector' requires VSX support to be enabled "
298  "(available on POWER7 or later)">;
299def err_invalid_vector_bool_int128_decl_spec : Error <
300  "use of '__int128' with '__vector bool' requires VSX support enabled (on "
301  "POWER10 or later)">;
302def err_invalid_vector_int128_decl_spec : Error<
303  "use of '__int128' with '__vector' requires extended Altivec support"
304  " (available on POWER8 or later)">;
305def err_invalid_vector_long_long_decl_spec : Error <
306  "use of 'long long' with '__vector' requires VSX support (available on "
307  "POWER7 or later) to be enabled">;
308def err_invalid_vector_long_double_decl_spec : Error<
309  "cannot use 'long double' with '__vector'">;
310def warn_vector_long_decl_spec_combination : Warning<
311  "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
312
313def err_redeclaration_different_type : Error<
314  "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
315def err_bad_variable_name : Error<
316  "%0 cannot be the name of a variable or data member">;
317def err_bad_parameter_name : Error<
318  "%0 cannot be the name of a parameter">;
319def err_bad_parameter_name_template_id : Error<
320  "parameter name cannot have template arguments">;
321def ext_parameter_name_omitted_c23 : ExtWarn<
322  "omitting the parameter name in a function definition is a C23 extension">,
323  InGroup<C23>;
324def err_anyx86_interrupt_attribute : Error<
325  "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
326  "have %select{a 'void' return type|"
327  "only a pointer parameter optionally followed by an integer parameter|"
328  "a pointer as the first parameter|a %2 type as the second parameter}1">;
329def err_anyx86_interrupt_called : Error<
330  "interrupt service routine cannot be called directly">;
331def warn_anyx86_excessive_regsave : Warning<
332  "%select{interrupt service routine|function with attribute"
333  " 'no_caller_saved_registers'}0 should only call a function"
334  " with attribute 'no_caller_saved_registers'"
335  " or be compiled with '-mgeneral-regs-only'">,
336  InGroup<DiagGroup<"excessive-regsave">>;
337def warn_arm_interrupt_calling_convention : Warning<
338   "call to function without interrupt attribute could clobber interruptee's VFP registers">,
339   InGroup<Extra>;
340def warn_interrupt_attribute_invalid : Warning<
341   "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
342   "functions that have %select{no parameters|a 'void' return type}1">,
343   InGroup<IgnoredAttributes>;
344def warn_riscv_repeated_interrupt_attribute : Warning<
345  "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
346def note_riscv_repeated_interrupt_attribute : Note<
347  "repeated RISC-V 'interrupt' attribute is here">;
348def warn_unused_parameter : Warning<"unused parameter %0">,
349  InGroup<UnusedParameter>, DefaultIgnore;
350def warn_unused_but_set_parameter : Warning<"parameter %0 set but not used">,
351  InGroup<UnusedButSetParameter>, DefaultIgnore;
352def warn_unused_variable : Warning<"unused variable %0">,
353  InGroup<UnusedVariable>, DefaultIgnore;
354def warn_unused_but_set_variable : Warning<"variable %0 set but not used">,
355  InGroup<UnusedButSetVariable>, DefaultIgnore;
356def warn_unused_local_typedef : Warning<
357  "unused %select{typedef|type alias}0 %1">,
358  InGroup<UnusedLocalTypedef>, DefaultIgnore;
359def warn_unused_property_backing_ivar :
360  Warning<"ivar %0 which backs the property is not "
361  "referenced in this property's accessor">,
362  InGroup<UnusedPropertyIvar>, DefaultIgnore;
363def warn_unused_const_variable : Warning<"unused variable %0">,
364  InGroup<UnusedConstVariable>, DefaultIgnore;
365def warn_unused_exception_param : Warning<"unused exception parameter %0">,
366  InGroup<UnusedExceptionParameter>, DefaultIgnore;
367def warn_decl_in_param_list : Warning<
368  "declaration of %0 will not be visible outside of this function">,
369  InGroup<Visibility>;
370def warn_redefinition_in_param_list : Warning<
371  "redefinition of %0 will not be visible outside of this function">,
372  InGroup<Visibility>;
373def warn_empty_parens_are_function_decl : Warning<
374  "empty parentheses interpreted as a function declaration">,
375  InGroup<VexingParse>;
376def warn_parens_disambiguated_as_function_declaration : Warning<
377  "parentheses were disambiguated as a function declaration">,
378  InGroup<VexingParse>;
379def warn_parens_disambiguated_as_variable_declaration : Warning<
380  "parentheses were disambiguated as redundant parentheses around declaration "
381  "of variable named %0">, InGroup<VexingParse>;
382def warn_redundant_parens_around_declarator : Warning<
383  "redundant parentheses surrounding declarator">,
384  InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
385def note_additional_parens_for_variable_declaration : Note<
386  "add a pair of parentheses to declare a variable">;
387def note_raii_guard_add_name : Note<
388  "add a variable name to declare a %0 initialized with %1">;
389def note_function_style_cast_add_parentheses : Note<
390  "add enclosing parentheses to perform a function-style cast">;
391def note_remove_parens_for_variable_declaration : Note<
392  "remove parentheses to silence this warning">;
393def note_empty_parens_function_call : Note<
394  "change this ',' to a ';' to call %0">;
395def note_empty_parens_default_ctor : Note<
396  "remove parentheses to declare a variable">;
397def note_empty_parens_zero_initialize : Note<
398  "replace parentheses with an initializer to declare a variable">;
399def warn_unused_function : Warning<"unused function %0">,
400  InGroup<UnusedFunction>, DefaultIgnore;
401def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
402  InGroup<UnusedTemplate>, DefaultIgnore;
403def warn_unused_member_function : Warning<"unused member function %0">,
404  InGroup<UnusedMemberFunction>, DefaultIgnore;
405def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
406  InGroup<UsedButMarkedUnused>, DefaultIgnore;
407def warn_unneeded_internal_decl : Warning<
408  "%select{function|variable}0 %1 is not needed and will not be emitted">,
409  InGroup<UnneededInternalDecl>, DefaultIgnore;
410def warn_unneeded_static_internal_decl : Warning<
411  "'static' function %0 declared in header file "
412  "should be declared 'static inline'">,
413  InGroup<UnneededInternalDecl>, DefaultIgnore;
414def warn_unneeded_member_function : Warning<
415  "member function %0 is not needed and will not be emitted">,
416  InGroup<UnneededMemberFunction>, DefaultIgnore;
417def warn_unused_private_field: Warning<"private field %0 is not used">,
418  InGroup<UnusedPrivateField>, DefaultIgnore;
419def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
420  "%select{used|required to be captured for this use}1">,
421  InGroup<UnusedLambdaCapture>, DefaultIgnore;
422
423def warn_reserved_extern_symbol: Warning<
424  "identifier %0 is reserved because %select{"
425  "<ERROR>|" // ReservedIdentifierStatus::NotReserved
426  "it starts with '_' at global scope|"
427  "it starts with '_' and has C language linkage|"
428  "it starts with '__'|"
429  "it starts with '_' followed by a capital letter|"
430  "it contains '__'}1">,
431  InGroup<ReservedIdentifier>, DefaultIgnore;
432def warn_deprecated_literal_operator_id: Warning<
433  "identifier %0 preceded by whitespace in a literal operator declaration "
434  "is deprecated">, InGroup<DeprecatedLiteralOperator>, DefaultIgnore;
435def warn_reserved_module_name : Warning<
436  "%0 is a reserved name for a module">, InGroup<ReservedModuleIdentifier>;
437
438def warn_parameter_size: Warning<
439  "%0 is a large (%1 bytes) pass-by-value argument; "
440  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
441def warn_return_value_size: Warning<
442  "return value of %0 is a large (%1 bytes) pass-by-value object; "
443  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
444def warn_return_value_udt: Warning<
445  "%0 has C-linkage specified, but returns user-defined type %1 which is "
446  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
447def warn_return_value_udt_incomplete: Warning<
448  "%0 has C-linkage specified, but returns incomplete type %1 which could be "
449  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
450def warn_implicit_function_decl : Warning<
451  "implicit declaration of function %0">,
452  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
453def ext_implicit_function_decl_c99 : ExtWarn<
454  "call to undeclared function %0; ISO C99 and later do not support implicit "
455  "function declarations">, InGroup<ImplicitFunctionDeclare>;
456def note_function_suggestion : Note<"did you mean %0?">;
457
458def err_ellipsis_first_param : Error<
459  "ISO C requires a named parameter before '...'">;
460def err_declarator_need_ident : Error<"declarator requires an identifier">;
461def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
462def ext_use_out_of_scope_declaration : ExtWarn<
463  "use of out-of-scope declaration of %0%select{| whose type is not "
464  "compatible with that of an implicit declaration}1">,
465  InGroup<DiagGroup<"out-of-scope-function">>;
466def err_inline_non_function : Error<
467  "'inline' can only appear on functions%select{| and non-local variables}0">;
468def err_noreturn_non_function : Error<
469  "'_Noreturn' can only appear on functions">;
470def warn_qual_return_type : Warning<
471  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
472  InGroup<IgnoredQualifiers>, DefaultIgnore;
473def warn_deprecated_redundant_constexpr_static_def : Warning<
474  "out-of-line definition of constexpr static data member is redundant "
475  "in C++17 and is deprecated">,
476  InGroup<DeprecatedRedundantConstexprStaticDef>, DefaultIgnore;
477
478def warn_decl_shadow :
479  Warning<"declaration shadows a %select{"
480          "local variable|"
481          "variable in %2|"
482          "static data member of %2|"
483          "field of %2|"
484          "typedef in %2|"
485          "type alias in %2|"
486          "structured binding}1">,
487  InGroup<Shadow>, DefaultIgnore, SuppressInSystemMacro;
488def warn_decl_shadow_uncaptured_local :
489  Warning<warn_decl_shadow.Summary>,
490  InGroup<ShadowUncapturedLocal>, DefaultIgnore;
491def warn_ctor_parm_shadows_field:
492  Warning<"constructor parameter %0 shadows the field %1 of %2">,
493  InGroup<ShadowFieldInConstructor>, DefaultIgnore;
494def warn_modifying_shadowing_decl :
495  Warning<"modifying constructor parameter %0 that shadows a "
496          "field of %1">,
497  InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
498
499// C++ decomposition declarations
500def err_decomp_decl_context : Error<
501  "decomposition declaration not permitted in this context">;
502def warn_cxx14_compat_decomp_decl : Warning<
503  "decomposition declarations are incompatible with "
504  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
505def ext_decomp_decl : ExtWarn<
506  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
507def ext_decomp_decl_cond : ExtWarn<
508  "ISO C++17 does not permit structured binding declaration in a condition">,
509  InGroup<DiagGroup<"binding-in-condition">>;
510def err_decomp_decl_spec : Error<
511  "decomposition declaration cannot be declared "
512  "%plural{1:'%1'|:with '%1' specifiers}0">;
513def ext_decomp_decl_spec : ExtWarn<
514  "decomposition declaration declared "
515  "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
516  InGroup<CXX20>;
517def warn_cxx17_compat_decomp_decl_spec : Warning<
518  "decomposition declaration declared "
519  "%plural{1:'%1'|:with '%1' specifiers}0 "
520  "is incompatible with C++ standards before C++20">,
521  InGroup<CXXPre20Compat>, DefaultIgnore;
522def err_decomp_decl_type : Error<
523  "decomposition declaration cannot be declared with type %0; "
524  "declared type must be 'auto' or reference to 'auto'">;
525def err_decomp_decl_constraint : Error<
526  "decomposition declaration cannot be declared with constrained 'auto'">;
527def err_decomp_decl_parens : Error<
528  "decomposition declaration cannot be declared with parentheses">;
529def err_decomp_decl_template : Error<
530  "decomposition declaration template not supported">;
531def err_decomp_decl_not_alone : Error<
532  "decomposition declaration must be the only declaration in its group">;
533def err_decomp_decl_requires_init : Error<
534  "decomposition declaration %0 requires an initializer">;
535def err_decomp_decl_wrong_number_bindings : Error<
536  "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
537  "%select{%plural{0:no|:only %1}1|%1}4 "
538  "%plural{1:name was|:names were}1 provided">;
539def err_decomp_decl_unbindable_type : Error<
540  "cannot decompose %select{union|non-class, non-array}1 type %2">;
541def err_decomp_decl_multiple_bases_with_members : Error<
542  "cannot decompose class type %1: "
543  "%select{its base classes %2 and|both it and its base class}0 %3 "
544  "have non-static data members">;
545def err_decomp_decl_ambiguous_base : Error<
546  "cannot decompose members of ambiguous base class %1 of %0:%2">;
547def err_decomp_decl_inaccessible_base : Error<
548  "cannot decompose members of inaccessible base class %1 of %0">,
549  AccessControl;
550def err_decomp_decl_inaccessible_field : Error<
551  "cannot decompose %select{private|protected}0 member %1 of %3">,
552  AccessControl;
553def err_decomp_decl_lambda : Error<
554  "cannot decompose lambda closure type">;
555def err_decomp_decl_anon_union_member : Error<
556  "cannot decompose class type %0 because it has an anonymous "
557  "%select{struct|union}1 member">;
558def err_decomp_decl_std_tuple_element_not_specialized : Error<
559  "cannot decompose this type; 'std::tuple_element<%0>::type' "
560  "does not name a type">;
561def err_decomp_decl_std_tuple_size_not_constant : Error<
562  "cannot decompose this type; 'std::tuple_size<%0>::value' "
563  "is not a valid integral constant expression">;
564def note_in_binding_decl_init : Note<
565  "in implicit initialization of binding declaration %0">;
566
567def err_std_type_trait_not_class_template : Error<
568  "unsupported standard library implementation: "
569  "'std::%0' is not a class template">;
570
571// C++ using declarations
572def err_using_requires_qualname : Error<
573  "using declaration requires a qualified name">;
574def err_using_typename_non_type : Error<
575  "'typename' keyword used on a non-type">;
576def err_using_dependent_value_is_type : Error<
577  "dependent using declaration resolved to type without 'typename'">;
578def err_using_decl_nested_name_specifier_is_not_class : Error<
579  "using declaration in class refers into '%0', which is not a class">;
580def warn_cxx17_compat_using_decl_non_member_enumerator : Warning<
581  "member using declaration naming non-class '%0' enumerator is "
582  "incompatible with C++ standards before C++20">, InGroup<CXXPre20Compat>,
583  DefaultIgnore;
584def err_using_decl_nested_name_specifier_is_current_class : Error<
585  "using declaration refers to its own class">;
586def err_using_decl_nested_name_specifier_is_not_base_class : Error<
587  "using declaration refers into '%0', which is not a base class of %1">;
588def err_using_decl_constructor_not_in_direct_base : Error<
589  "%0 is not a direct base of %1, cannot inherit constructors">;
590def err_using_decl_can_not_refer_to_class_member : Error<
591  "using declaration cannot refer to class member">;
592def warn_cxx17_compat_using_decl_class_member_enumerator : Warning<
593  "member using declaration naming a non-member enumerator is incompatible "
594  "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
595def err_using_enum_is_dependent : Error<
596  "using-enum cannot name a dependent type">;
597def err_using_enum_not_enum : Error<
598  "%0 is not an enumerated type">;
599def err_ambiguous_inherited_constructor : Error<
600  "constructor of %0 inherited from multiple base class subobjects">;
601def note_ambiguous_inherited_constructor_using : Note<
602  "inherited from base class %0 here">;
603def note_using_decl_class_member_workaround : Note<
604  "use %select{an alias declaration|a typedef declaration|a reference|"
605  "a const variable|a constexpr variable}0 instead">;
606def err_using_decl_can_not_refer_to_namespace : Error<
607  "using declaration cannot refer to a namespace">;
608def warn_cxx17_compat_using_decl_scoped_enumerator: Warning<
609  "using declaration naming a scoped enumerator is incompatible with "
610  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
611def ext_using_decl_scoped_enumerator : ExtWarn<
612  "using declaration naming a scoped enumerator is a C++20 extension">,
613  InGroup<CXX20>;
614def err_using_decl_constructor : Error<
615  "using declaration cannot refer to a constructor">;
616def warn_cxx98_compat_using_decl_constructor : Warning<
617  "inheriting constructors are incompatible with C++98">,
618  InGroup<CXX98Compat>, DefaultIgnore;
619def err_using_decl_destructor : Error<
620  "using declaration cannot refer to a destructor">;
621def err_using_decl_template_id : Error<
622  "using declaration cannot refer to a template specialization">;
623def note_using_decl_target : Note<"target of using declaration">;
624def note_using_decl_conflict : Note<"conflicting declaration">;
625def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
626def err_using_decl_conflict : Error<
627  "target of using declaration conflicts with declaration already in scope">;
628def err_using_decl_conflict_reverse : Error<
629  "declaration conflicts with target of using declaration already in scope">;
630def note_using_decl : Note<"%select{|previous }0using declaration">;
631def err_using_decl_redeclaration_expansion : Error<
632  "using declaration pack expansion at block scope produces multiple values">;
633def err_use_of_empty_using_if_exists : Error<
634  "reference to unresolved using declaration">;
635def note_empty_using_if_exists_here : Note<
636  "using declaration annotated with 'using_if_exists' here">;
637def err_using_if_exists_on_ctor : Error<
638  "'using_if_exists' attribute cannot be applied to an inheriting constructor">;
639def err_using_enum_decl_redeclaration : Error<
640  "redeclaration of using-enum declaration">;
641def note_using_enum_decl : Note<"%select{|previous }0using-enum declaration">;
642
643def warn_access_decl_deprecated : Warning<
644  "access declarations are deprecated; use using declarations instead">,
645  InGroup<Deprecated>;
646def err_access_decl : Error<
647  "ISO C++11 does not allow access declarations; "
648  "use using declarations instead">;
649def warn_deprecated_copy : Warning<
650  "definition of implicit copy %select{constructor|assignment operator}1 "
651  "for %0 is deprecated because it has a user-declared copy "
652  "%select{assignment operator|constructor}1">,
653  InGroup<DeprecatedCopy>, DefaultIgnore;
654def warn_deprecated_copy_with_dtor : Warning<
655  "definition of implicit copy %select{constructor|assignment operator}1 "
656  "for %0 is deprecated because it has a user-declared destructor">,
657  InGroup<DeprecatedCopyWithDtor>, DefaultIgnore;
658def warn_deprecated_copy_with_user_provided_copy: Warning<
659  "definition of implicit copy %select{constructor|assignment operator}1 "
660  "for %0 is deprecated because it has a user-provided copy "
661  "%select{assignment operator|constructor}1">,
662  InGroup<DeprecatedCopyWithUserProvidedCopy>, DefaultIgnore;
663def warn_deprecated_copy_with_user_provided_dtor : Warning<
664  "definition of implicit copy %select{constructor|assignment operator}1 "
665  "for %0 is deprecated because it has a user-provided destructor">,
666  InGroup<DeprecatedCopyWithUserProvidedDtor>, DefaultIgnore;
667def warn_cxx17_compat_exception_spec_in_signature : Warning<
668  "mangled name of %0 will change in C++17 due to non-throwing exception "
669  "specification in function signature">, InGroup<CXX17CompatMangling>;
670
671def warn_global_constructor : Warning<
672  "declaration requires a global constructor">,
673  InGroup<GlobalConstructors>, DefaultIgnore;
674def warn_global_destructor : Warning<
675  "declaration requires a global destructor">,
676   InGroup<GlobalConstructors>, DefaultIgnore;
677def warn_exit_time_destructor : Warning<
678  "declaration requires an exit-time destructor">,
679  InGroup<ExitTimeDestructors>, DefaultIgnore;
680
681def err_invalid_thread : Error<
682  "'%0' is only allowed on variable declarations">;
683def err_thread_non_global : Error<
684  "'%0' variables must have global storage">;
685def err_thread_unsupported : Error<
686  "thread-local storage is not supported for the current target">;
687
688// FIXME: Combine fallout warnings to just one warning.
689def warn_maybe_falloff_nonvoid_function : Warning<
690  "non-void function does not return a value in all control paths">,
691  InGroup<ReturnType>;
692def warn_falloff_nonvoid_function : Warning<
693  "non-void function does not return a value">,
694  InGroup<ReturnType>;
695def warn_const_attr_with_pure_attr : Warning<
696  "'const' attribute imposes more restrictions; 'pure' attribute ignored">,
697  InGroup<IgnoredAttributes>;
698def warn_pure_function_returns_void : Warning<
699  "'%select{pure|const}0' attribute on function returning 'void'; attribute ignored">,
700  InGroup<IgnoredAttributes>;
701
702def err_maybe_falloff_nonvoid_block : Error<
703  "non-void block does not return a value in all control paths">;
704def err_falloff_nonvoid_block : Error<
705  "non-void block does not return a value">;
706def warn_maybe_falloff_nonvoid_coroutine : Warning<
707  "non-void coroutine does not return a value in all control paths">,
708  InGroup<ReturnType>;
709def warn_falloff_nonvoid_coroutine : Warning<
710  "non-void coroutine does not return a value">,
711  InGroup<ReturnType>;
712def warn_suggest_noreturn_function : Warning<
713  "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
714  InGroup<MissingNoreturn>, DefaultIgnore;
715def warn_suggest_noreturn_block : Warning<
716  "block could be declared with attribute 'noreturn'">,
717  InGroup<MissingNoreturn>, DefaultIgnore;
718
719// Unreachable code.
720def warn_unreachable : Warning<
721  "code will never be executed">,
722  InGroup<UnreachableCode>, DefaultIgnore;
723def warn_unreachable_break : Warning<
724  "'break' will never be executed">,
725  InGroup<UnreachableCodeBreak>, DefaultIgnore;
726def warn_unreachable_return : Warning<
727  "'return' will never be executed">,
728  InGroup<UnreachableCodeReturn>, DefaultIgnore;
729def warn_unreachable_loop_increment : Warning<
730  "loop will run at most once (loop increment never executed)">,
731  InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
732def warn_unreachable_fallthrough_attr : Warning<
733  "fallthrough annotation in unreachable code">,
734  InGroup<UnreachableCodeFallthrough>, DefaultIgnore;
735def note_unreachable_silence : Note<
736  "silence by adding parentheses to mark code as explicitly dead">;
737def warn_unreachable_association : Warning<
738  "due to lvalue conversion of the controlling expression, association of type "
739  "%0 will never be selected because it is %select{of array type|qualified}1">,
740  InGroup<UnreachableCodeGenericAssoc>;
741
742/// Built-in functions.
743def ext_implicit_lib_function_decl : ExtWarn<
744  "implicitly declaring library function '%0' with type %1">,
745  InGroup<ImplicitFunctionDeclare>;
746def ext_implicit_lib_function_decl_c99 : ExtWarn<
747  "call to undeclared library function '%0' with type %1; ISO C99 and later "
748  "do not support implicit function declarations">,
749  InGroup<ImplicitFunctionDeclare>;
750def note_include_header_or_declare : Note<
751  "include the header <%0> or explicitly provide a declaration for '%1'">;
752def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
753def warn_implicit_decl_no_jmp_buf
754    : Warning<"declaration of built-in function '%0' requires the declaration"
755    " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
756      InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
757def warn_implicit_decl_requires_sysheader : Warning<
758  "declaration of built-in function '%1' requires inclusion of the header <%0>">,
759  InGroup<BuiltinRequiresHeader>;
760def warn_redecl_library_builtin : Warning<
761  "incompatible redeclaration of library function %0">,
762  InGroup<DiagGroup<"incompatible-library-redeclaration">>;
763def err_builtin_definition : Error<"definition of builtin function %0">;
764def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
765def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
766def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
767  "%select{GCP|CDE}1">;
768def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
769def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
770def err_invalid_cpu_specific_dispatch_value : Error<
771"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
772def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
773  InGroup<ImplicitFunctionDeclare>, DefaultError;
774def warn_cstruct_memaccess : Warning<
775  "%select{destination for|source of|first operand of|second operand of}0 this "
776  "%1 call is a pointer to record %2 that is not trivial to "
777  "%select{primitive-default-initialize|primitive-copy}3">,
778  InGroup<NonTrivialMemaccess>;
779def note_nontrivial_field : Note<
780  "field is non-trivial to %select{copy|default-initialize}0">;
781def err_non_trivial_c_union_in_invalid_context : Error<
782  "cannot %select{"
783  "use type %1 for a function/method parameter|"
784  "use type %1 for function/method return|"
785  "default-initialize an object of type %1|"
786  "declare an automatic variable of type %1|"
787  "copy-initialize an object of type %1|"
788  "assign to a variable of type %1|"
789  "construct an automatic compound literal of type %1|"
790  "capture a variable of type %1|"
791  "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
792  "}3 "
793  "since it %select{contains|is}2 a union that is non-trivial to "
794  "%select{default-initialize|destruct|copy}0">;
795def note_non_trivial_c_union : Note<
796  "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
797  "non-trivial to %select{default-initialize|destruct|copy}1">;
798def warn_dyn_class_memaccess : Warning<
799  "%select{destination for|source of|first operand of|second operand of}0 this "
800  "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
801  "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
802  InGroup<DynamicClassMemaccess>;
803def note_bad_memaccess_silence : Note<
804  "explicitly cast the pointer to silence this warning">;
805def warn_sizeof_pointer_expr_memaccess : Warning<
806  "'%0' call operates on objects of type %1 while the size is based on a "
807  "different type %2">,
808  InGroup<SizeofPointerMemaccess>;
809def warn_sizeof_pointer_expr_memaccess_note : Note<
810  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
811  "it by the number of elements)|remove the addressof in the argument to "
812  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
813  "length}0?">;
814def warn_sizeof_pointer_type_memaccess : Warning<
815  "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
816  "%select{destination|source}2; expected %3 or an explicit length">,
817  InGroup<SizeofPointerMemaccess>;
818def warn_strlcpycat_wrong_size : Warning<
819  "size argument in %0 call appears to be size of the source; "
820  "expected the size of the destination">,
821  InGroup<DiagGroup<"strlcpy-strlcat-size">>;
822def note_strlcpycat_wrong_size : Note<
823  "change size argument to be the size of the destination">;
824def warn_memsize_comparison : Warning<
825  "size argument in %0 call is a comparison">,
826  InGroup<DiagGroup<"memsize-comparison">>;
827def note_memsize_comparison_paren : Note<
828  "did you mean to compare the result of %0 instead?">;
829def note_memsize_comparison_cast_silence : Note<
830  "explicitly cast the argument to size_t to silence this warning">;
831def warn_suspicious_sizeof_memset : Warning<
832  "%select{'size' argument to memset is '0'|"
833  "setting buffer to a 'sizeof' expression}0"
834  "; did you mean to transpose the last two arguments?">,
835  InGroup<MemsetTransposedArgs>;
836def note_suspicious_sizeof_memset_silence : Note<
837  "%select{parenthesize the third argument|"
838  "cast the second argument to 'int'}0 to silence">;
839def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
840  InGroup<SuspiciousBzero>;
841def note_suspicious_bzero_size_silence : Note<
842  "parenthesize the second argument to silence">;
843
844def warn_strncat_large_size : Warning<
845  "the value of the size argument in 'strncat' is too large, might lead to a "
846  "buffer overflow">, InGroup<StrncatSize>;
847def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
848  "to be size of the source">, InGroup<StrncatSize>;
849def warn_strncat_wrong_size : Warning<
850  "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
851def note_strncat_wrong_size : Note<
852  "change the argument to be the free space in the destination buffer minus "
853  "the terminating null byte">;
854
855def warn_assume_side_effects : Warning<
856  "the argument to %0 has side effects that will be discarded">,
857  InGroup<DiagGroup<"assume">>;
858def warn_assume_attribute_string_unknown : Warning<
859  "unknown assumption string '%0'; attribute is potentially ignored">,
860  InGroup<UnknownAssumption>;
861def warn_assume_attribute_string_unknown_suggested : Warning<
862  "unknown assumption string '%0' may be misspelled; attribute is potentially "
863  "ignored, did you mean '%1'?">,
864  InGroup<MisspelledAssumption>;
865
866def warn_builtin_chk_overflow : Warning<
867  "'%0' will always overflow; destination buffer has size %1,"
868  " but size argument is %2">,
869  InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
870
871def warn_fortify_source_overflow
872  : Warning<warn_builtin_chk_overflow.Summary>, InGroup<FortifySource>;
873def warn_fortify_source_size_mismatch : Warning<
874  "'%0' size argument is too large; destination buffer has size %1,"
875  " but size argument is %2">, InGroup<FortifySource>;
876
877def warn_fortify_strlen_overflow: Warning<
878  "'%0' will always overflow; destination buffer has size %1,"
879  " but the source string has length %2 (including NUL byte)">,
880  InGroup<FortifySource>;
881
882def subst_format_overflow : TextSubstitution<
883  "'%0' will always overflow; destination buffer has size %1,"
884  " but format string expands to at least %2">;
885
886def warn_format_overflow : Warning<
887  "%sub{subst_format_overflow}0,1,2">,
888  InGroup<FormatOverflow>;
889
890def warn_format_overflow_non_kprintf : Warning<
891  "%sub{subst_format_overflow}0,1,2">,
892  InGroup<FormatOverflowNonKprintf>;
893
894def subst_format_truncation: TextSubstitution<
895  "'%0' will always be truncated; specified size is %1,"
896  " but format string expands to at least %2">;
897
898def warn_format_truncation: Warning<
899  "%sub{subst_format_truncation}0,1,2">,
900  InGroup<FormatTruncation>;
901
902def warn_format_truncation_non_kprintf: Warning<
903  "%sub{subst_format_truncation}0,1,2">,
904  InGroup<FormatTruncationNonKprintf>;
905
906def warn_fortify_scanf_overflow : Warning<
907  "'%0' may overflow; destination buffer in argument %1 has size "
908  "%2, but the corresponding specifier may require size %3">,
909  InGroup<FortifySource>;
910
911def err_function_start_invalid_type: Error<
912  "argument must be a function">;
913
914/// main()
915// static main() is not an error in C, just in C++.
916def warn_static_main : Warning<"'main' should not be declared static">,
917    InGroup<Main>;
918def err_static_main : Error<"'main' is not allowed to be declared static">;
919def err_inline_main : Error<"'main' is not allowed to be declared inline">;
920def ext_variadic_main : ExtWarn<
921  "'main' is not allowed to be declared variadic">, InGroup<Main>;
922def ext_noreturn_main : ExtWarn<
923  "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
924def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
925def err_constexpr_main : Error<
926  "'main' is not allowed to be declared %select{constexpr|consteval}0">;
927def err_deleted_main : Error<"'main' is not allowed to be deleted">;
928def err_mainlike_template_decl : Error<"%0 cannot be a template">;
929def err_main_returns_nonint : Error<"'main' must return 'int'">;
930def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
931    InGroup<MainReturnType>;
932def note_main_change_return_type : Note<"change return type to 'int'">;
933def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
934    "must be 0, 2, or 3">;
935def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
936    InGroup<Main>;
937def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
938    "parameter of 'main' (%select{argument count|argument array|environment|"
939    "platform-specific data}0) must be of type %1">;
940def warn_main_returns_bool_literal : Warning<"bool literal returned from "
941    "'main'">, InGroup<Main>;
942def err_main_global_variable :
943    Error<"main cannot be declared as global variable">;
944def warn_main_redefined : Warning<"variable named 'main' with external linkage "
945    "has undefined behavior">, InGroup<Main>;
946def ext_main_used : Extension<
947  "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
948
949/// parser diagnostics
950def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
951  InGroup<MissingDeclarations>;
952def err_no_declarators : Error<"declaration does not declare anything">;
953def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
954  InGroup<MissingDeclarations>;
955def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
956
957def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
958  "anonymous non-C-compatible type given name for linkage purposes "
959  "by %select{typedef|alias}0 declaration; "
960  "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
961def err_non_c_like_anon_struct_in_typedef : Error<
962  "anonymous non-C-compatible type given name for linkage purposes "
963  "by %select{typedef|alias}0 declaration after its linkage was computed; "
964  "add a tag name here to establish linkage prior to definition">;
965def err_typedef_changes_linkage : Error<
966  "unsupported: anonymous type given name for linkage purposes "
967  "by %select{typedef|alias}0 declaration after its linkage was computed; "
968  "add a tag name here to establish linkage prior to definition">;
969def note_non_c_like_anon_struct : Note<
970  "type is not C-compatible due to this "
971  "%select{base class|default member initializer|lambda expression|"
972  "friend declaration|member declaration}0">;
973def note_typedef_for_linkage_here : Note<
974  "type is given name %0 for linkage purposes by this "
975  "%select{typedef|alias}1 declaration">;
976
977def err_statically_allocated_object : Error<
978  "interface type cannot be statically allocated">;
979def err_object_cannot_be_passed_returned_by_value : Error<
980  "interface type %1 cannot be %select{returned|passed}0 by value"
981  "; did you forget * in %1?">;
982def err_parameters_retval_cannot_have_fp16_type : Error<
983  "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
984def err_opencl_half_load_store : Error<
985  "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
986  "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
987def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
988def err_opencl_half_declaration : Error<
989  "declaring variable of type %0 is not allowed">;
990def err_opencl_invalid_param : Error<
991  "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
992def err_opencl_invalid_return : Error<
993  "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
994def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
995def warn_pragma_options_align_reset_failed : Warning<
996  "#pragma options align=reset failed: %0">,
997  InGroup<IgnoredPragmas>;
998def err_pragma_options_align_mac68k_target_unsupported : Error<
999  "mac68k alignment pragma is not supported on this target">;
1000def warn_pragma_align_not_xl_compatible : Warning<
1001  "#pragma align(packed) may not be compatible with objects generated with AIX XL C/C++">,
1002  InGroup<AIXCompat>;
1003def warn_pragma_pack_invalid_alignment : Warning<
1004  "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
1005  InGroup<IgnoredPragmas>;
1006def err_pragma_pack_invalid_alignment : Error<
1007  warn_pragma_pack_invalid_alignment.Summary>;
1008def warn_pragma_pack_non_default_at_include : Warning<
1009  "non-default #pragma pack value changes the alignment of struct or union "
1010  "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
1011  DefaultIgnore;
1012def warn_pragma_pack_modified_after_include : Warning<
1013  "the current #pragma pack alignment value is modified in the included "
1014  "file">, InGroup<PragmaPack>;
1015def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
1016  "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
1017def note_pragma_pack_here : Note<
1018  "previous '#pragma pack' directive that modifies alignment is here">;
1019def note_pragma_pack_pop_instead_reset : Note<
1020  "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
1021// Follow the Microsoft implementation.
1022def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
1023def warn_pragma_pack_pop_identifier_and_alignment : Warning<
1024  "specifying both a name and alignment to 'pop' is undefined">;
1025def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
1026  InGroup<IgnoredPragmas>;
1027def err_pragma_fc_pp_scope : Error<
1028  "'#pragma float_control push/pop' can only appear at file or namespace scope "
1029  "or within a language linkage specification">;
1030def err_pragma_fc_noprecise_requires_nofenv : Error<
1031  "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
1032def err_pragma_fc_except_requires_precise : Error<
1033  "'#pragma float_control(except, on)' is illegal when precise is disabled">;
1034def err_pragma_fc_noprecise_requires_noexcept : Error<
1035  "'#pragma float_control(precise, off)' is illegal when except is enabled">;
1036def err_pragma_fenv_requires_precise : Error<
1037  "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
1038def warn_cxx_ms_struct :
1039  Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
1040          "with base classes or virtual functions">,
1041  DefaultError, InGroup<IncompatibleMSStruct>;
1042def err_pragma_pack_identifer_not_supported : Error<
1043  "specifying an identifier within `#pragma pack` is not supported on this target">;
1044def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
1045def warn_section_msvc_compat : Warning<"`#pragma const_seg` for section %1 will"
1046  " not apply to %0 due to the presence of a %select{mutable field||non-trivial constructor|non-trivial destructor}2">,
1047  InGroup<IncompatibleMSPragmaSection>;
1048def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
1049def err_invalid_super_scope : Error<"invalid use of '__super', "
1050  "this keyword can only be used inside class or member function scope">;
1051def err_super_in_lambda_unsupported : Error<
1052  "use of '__super' inside a lambda is unsupported">;
1053
1054def err_pragma_expected_file_scope : Error<
1055  "'#pragma %0' can only appear at file scope">;
1056def err_pragma_alloc_text_c_linkage: Error<
1057  "'#pragma alloc_text' is applicable only to functions with C linkage">;
1058def err_pragma_alloc_text_not_function: Error<
1059  "'#pragma alloc_text' is applicable only to functions">;
1060
1061def warn_pragma_unused_undeclared_var : Warning<
1062  "undeclared variable %0 used as an argument for '#pragma unused'">,
1063  InGroup<IgnoredPragmas>;
1064def warn_atl_uuid_deprecated : Warning<
1065  "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
1066  InGroup<DeprecatedDeclarations>;
1067def warn_pragma_unused_expected_var_arg : Warning<
1068  "only variables can be arguments to '#pragma unused'">,
1069  InGroup<IgnoredPragmas>;
1070def err_pragma_push_visibility_mismatch : Error<
1071  "#pragma visibility push with no matching #pragma visibility pop">;
1072def note_surrounding_namespace_ends_here : Note<
1073  "surrounding namespace with visibility attribute ends here">;
1074def err_pragma_pop_visibility_mismatch : Error<
1075  "#pragma visibility pop with no matching #pragma visibility push">;
1076def note_surrounding_namespace_starts_here : Note<
1077  "surrounding namespace with visibility attribute starts here">;
1078def err_pragma_loop_invalid_argument_type : Error<
1079  "invalid argument of type %0; expected an integer type">;
1080def err_pragma_loop_invalid_argument_value : Error<
1081  "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
1082def err_pragma_loop_compatibility : Error<
1083  "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
1084def err_pragma_loop_precedes_nonloop : Error<
1085  "expected a for, while, or do-while loop to follow '%0'">;
1086
1087def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
1088  "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
1089  "those declarations">;
1090def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
1091  "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
1092def err_pragma_attribute_invalid_matchers : Error<
1093  "attribute %0 can't be applied to %1">;
1094def err_pragma_attribute_stack_mismatch : Error<
1095  "'#pragma clang attribute %select{%1.|}0pop' with no matching"
1096  " '#pragma clang attribute %select{%1.|}0push'">;
1097def warn_pragma_attribute_unused : Warning<
1098  "unused attribute %0 in '#pragma clang attribute push' region">,
1099  InGroup<PragmaClangAttribute>;
1100def note_pragma_attribute_region_ends_here : Note<
1101  "'#pragma clang attribute push' regions ends here">;
1102def err_pragma_attribute_no_pop_eof : Error<"unterminated "
1103  "'#pragma clang attribute push' at end of file">;
1104def note_pragma_attribute_applied_decl_here : Note<
1105  "when applied to this declaration">;
1106def err_pragma_attr_attr_no_push : Error<
1107  "'#pragma clang attribute' attribute with no matching "
1108  "'#pragma clang attribute push'">;
1109
1110/// Objective-C parser diagnostics
1111def err_duplicate_class_def : Error<
1112  "duplicate interface definition for class %0">;
1113def err_undef_superclass : Error<
1114  "cannot find interface declaration for %0, superclass of %1">;
1115def err_forward_superclass : Error<
1116  "attempting to use the forward class %0 as superclass of %1">;
1117def err_no_nsconstant_string_class : Error<
1118  "cannot find interface declaration for %0">;
1119def err_recursive_superclass : Error<
1120  "trying to recursively use %0 as superclass of %1">;
1121def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
1122def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
1123def warn_duplicate_protocol_def : Warning<
1124  "duplicate protocol definition of %0 is ignored">,
1125  InGroup<DiagGroup<"duplicate-protocol">>;
1126def err_protocol_has_circular_dependency : Error<
1127  "protocol has circular dependency">;
1128def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
1129def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
1130def err_atprotocol_protocol : Error<
1131  "@protocol is using a forward protocol declaration of %0">;
1132def warn_readonly_property : Warning<
1133  "attribute 'readonly' of property %0 restricts attribute "
1134  "'readwrite' of property inherited from %1">,
1135  InGroup<PropertyAttr>;
1136
1137def warn_property_attribute : Warning<
1138  "'%1' attribute on property %0 does not match the property inherited from %2">,
1139  InGroup<PropertyAttr>;
1140def warn_property_types_are_incompatible : Warning<
1141  "property type %0 is incompatible with type %1 inherited from %2">,
1142  InGroup<DiagGroup<"incompatible-property-type">>;
1143def warn_protocol_property_mismatch : Warning<
1144  "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
1145  "getter %1|with setter %1}0 was selected for synthesis">,
1146  InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
1147def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Summary>;
1148def err_undef_interface : Error<"cannot find interface declaration for %0">;
1149def err_category_forward_interface : Error<
1150  "cannot define %select{category|class extension}0 for undefined class %1">;
1151def err_class_extension_after_impl : Error<
1152  "cannot declare class extension for %0 after class implementation">;
1153def note_implementation_declared : Note<
1154  "class implementation is declared here">;
1155def note_while_in_implementation : Note<
1156  "detected while default synthesizing properties in class implementation">;
1157def note_class_declared : Note<
1158  "class is declared here">;
1159def note_receiver_class_declared : Note<
1160  "receiver is instance of class declared here">;
1161def note_receiver_expr_here : Note<
1162  "receiver expression is here">;
1163def note_receiver_is_id : Note<
1164  "receiver is treated with 'id' type for purpose of method lookup">;
1165def note_suppressed_class_declare : Note<
1166  "class with specified objc_requires_property_definitions attribute is declared here">;
1167def err_objc_root_class_subclass : Error<
1168  "objc_root_class attribute may only be specified on a root class declaration">;
1169def err_restricted_superclass_mismatch : Error<
1170  "cannot subclass a class that was declared with the "
1171  "'objc_subclassing_restricted' attribute">;
1172def err_class_stub_subclassing_mismatch : Error<
1173  "'objc_class_stub' attribute cannot be specified on a class that does not "
1174  "have the 'objc_subclassing_restricted' attribute">;
1175def err_implementation_of_class_stub : Error<
1176  "cannot declare implementation of a class declared with the "
1177  "'objc_class_stub' attribute">;
1178def warn_objc_root_class_missing : Warning<
1179  "class %0 defined without specifying a base class">,
1180  InGroup<ObjCRootClass>;
1181def err_objc_runtime_visible_category : Error<
1182  "cannot implement a category for class %0 that is only visible via the "
1183  "Objective-C runtime">;
1184def err_objc_runtime_visible_subclass : Error<
1185  "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1186  "Objective-C runtime">;
1187def note_objc_needs_superclass : Note<
1188  "add a super class to fix this problem">;
1189def err_conflicting_super_class : Error<"conflicting super class name %0">;
1190def err_dup_implementation_class : Error<"reimplementation of class %0">;
1191def err_dup_implementation_category : Error<
1192  "reimplementation of category %1 for class %0">;
1193def err_conflicting_ivar_type : Error<
1194  "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1195def err_duplicate_ivar_declaration : Error<
1196  "instance variable is already declared">;
1197def warn_on_superclass_use : Warning<
1198  "class implementation may not have super class">;
1199def err_conflicting_ivar_bitwidth : Error<
1200  "instance variable %0 has conflicting bit-field width">;
1201def err_conflicting_ivar_name : Error<
1202  "conflicting instance variable names: %0 vs %1">;
1203def err_inconsistent_ivar_count : Error<
1204  "inconsistent number of instance variables specified">;
1205def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1206  InGroup<DiagGroup<"incomplete-implementation">>;
1207def warn_objc_boxing_invalid_utf8_string : Warning<
1208  "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1209  InGroup<ObjCBoxing>;
1210
1211def err_objc_non_runtime_protocol_in_protocol_expr : Error<
1212  "cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression">;
1213def err_objc_direct_on_protocol : Error<
1214  "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1215  "declared in an Objective-C protocol">;
1216def err_objc_direct_duplicate_decl : Error<
1217  "%select{|direct }0%select{method|property}1 declaration conflicts "
1218  "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1219def err_objc_direct_impl_decl_mismatch : Error<
1220  "direct method was declared in %select{the primary interface|an extension|a category}0 "
1221  "but is implemented in %select{the primary interface|a category|a different category}1">;
1222def err_objc_direct_missing_on_decl : Error<
1223  "direct method implementation was previously declared not direct">;
1224def err_objc_direct_on_override : Error<
1225  "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1226def err_objc_override_direct_method : Error<
1227  "cannot override a method that is declared direct by a superclass">;
1228def warn_objc_direct_ignored : Warning<
1229  "%0 attribute isn't implemented by this Objective-C runtime">,
1230  InGroup<IgnoredAttributes>;
1231def warn_objc_direct_property_ignored : Warning<
1232  "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1233  InGroup<IgnoredAttributes>;
1234def err_objc_direct_dynamic_property : Error<
1235  "direct property cannot be @dynamic">;
1236def err_objc_direct_protocol_conformance : Error<
1237  "%select{category %1|class extension}0 cannot conform to protocol %2 because "
1238  "of direct members declared in interface %3">;
1239def note_direct_member_here : Note<"direct member declared here">;
1240
1241def warn_conflicting_overriding_ret_types : Warning<
1242  "conflicting return type in "
1243  "declaration of %0%diff{: $ vs $|}1,2">,
1244  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1245
1246def warn_conflicting_ret_types : Warning<
1247  "conflicting return type in "
1248  "implementation of %0%diff{: $ vs $|}1,2">,
1249  InGroup<MismatchedReturnTypes>;
1250
1251def warn_conflicting_overriding_ret_type_modifiers : Warning<
1252  "conflicting distributed object modifiers on return type "
1253  "in declaration of %0">,
1254  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1255
1256def warn_conflicting_ret_type_modifiers : Warning<
1257  "conflicting distributed object modifiers on return type "
1258  "in implementation of %0">,
1259  InGroup<DistributedObjectModifiers>;
1260
1261def warn_non_covariant_overriding_ret_types : Warning<
1262  "conflicting return type in "
1263  "declaration of %0: %1 vs %2">,
1264  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1265
1266def warn_non_covariant_ret_types : Warning<
1267  "conflicting return type in "
1268  "implementation of %0: %1 vs %2">,
1269  InGroup<MethodSignatures>, DefaultIgnore;
1270
1271def warn_conflicting_overriding_param_types : Warning<
1272  "conflicting parameter types in "
1273  "declaration of %0%diff{: $ vs $|}1,2">,
1274  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1275
1276def warn_conflicting_param_types : Warning<
1277  "conflicting parameter types in "
1278  "implementation of %0%diff{: $ vs $|}1,2">,
1279  InGroup<MismatchedParameterTypes>;
1280
1281def warn_conflicting_param_modifiers : Warning<
1282  "conflicting distributed object modifiers on parameter type "
1283  "in implementation of %0">,
1284  InGroup<DistributedObjectModifiers>;
1285
1286def warn_conflicting_overriding_param_modifiers : Warning<
1287  "conflicting distributed object modifiers on parameter type "
1288  "in declaration of %0">,
1289  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1290
1291def warn_non_contravariant_overriding_param_types : Warning<
1292  "conflicting parameter types in "
1293  "declaration of %0: %1 vs %2">,
1294  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1295
1296def warn_non_contravariant_param_types : Warning<
1297  "conflicting parameter types in "
1298  "implementation of %0: %1 vs %2">,
1299  InGroup<MethodSignatures>, DefaultIgnore;
1300
1301def warn_conflicting_overriding_variadic :Warning<
1302  "conflicting variadic declaration of method and its "
1303  "implementation">,
1304  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1305
1306def warn_conflicting_variadic :Warning<
1307  "conflicting variadic declaration of method and its "
1308  "implementation">;
1309
1310def warn_category_method_impl_match:Warning<
1311  "category is implementing a method which will also be implemented"
1312  " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1313
1314def warn_implements_nscopying : Warning<
1315"default assign attribute on property %0 which implements "
1316"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1317
1318def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1319  InGroup<ObjCMultipleMethodNames>;
1320def warn_strict_multiple_method_decl : Warning<
1321  "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1322def warn_accessor_property_type_mismatch : Warning<
1323  "type of property %0 does not match type of accessor %1">;
1324def note_conv_function_declared_at : Note<"type conversion function declared here">;
1325def note_method_declared_at : Note<"method %0 declared here">;
1326def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1327def note_property_attribute : Note<"property %0 is declared "
1328  "%select{deprecated|unavailable|partial}1 here">;
1329def err_setter_type_void : Error<"type of setter must be void">;
1330def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1331def warn_duplicate_method_decl :
1332  Warning<"multiple declarations of method %0 found and ignored">,
1333  InGroup<MethodDuplicate>, DefaultIgnore;
1334def warn_objc_cdirective_format_string :
1335  Warning<"using %0 directive in %select{NSString|CFString}1 "
1336          "which is being passed as a formatting argument to the formatting "
1337          "%select{method|CFfunction}2">,
1338  InGroup<ObjCCStringFormat>, DefaultIgnore;
1339def err_objc_var_decl_inclass :
1340    Error<"cannot declare variable inside @interface or @protocol">;
1341def err_missing_method_context : Error<
1342  "missing context for method declaration">;
1343def err_objc_property_attr_mutually_exclusive : Error<
1344  "property attributes '%0' and '%1' are mutually exclusive">;
1345def err_objc_property_requires_object : Error<
1346  "property with '%0' attribute must be of object type">;
1347def warn_objc_property_assign_on_object : Warning<
1348  "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1349  InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1350def warn_objc_property_no_assignment_attribute : Warning<
1351  "no 'assign', 'retain', or 'copy' attribute is specified - "
1352  "'assign' is assumed">,
1353  InGroup<ObjCPropertyNoAttribute>;
1354def warn_objc_isa_use : Warning<
1355  "direct access to Objective-C's isa is deprecated in favor of "
1356  "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1357def warn_objc_isa_assign : Warning<
1358  "assignment to Objective-C's isa is deprecated in favor of "
1359  "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1360def warn_objc_pointer_masking : Warning<
1361  "bitmasking for introspection of Objective-C object pointers is strongly "
1362  "discouraged">,
1363  InGroup<ObjCPointerIntrospect>;
1364def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Summary>,
1365  InGroup<ObjCPointerIntrospectPerformSelector>;
1366def warn_objc_property_default_assign_on_object : Warning<
1367  "default property attribute 'assign' not appropriate for object">,
1368  InGroup<ObjCPropertyNoAttribute>;
1369def warn_property_attr_mismatch : Warning<
1370  "property attribute in class extension does not match the primary class">,
1371  InGroup<PropertyAttr>;
1372def warn_property_implicitly_mismatched : Warning <
1373  "primary property declaration is implicitly strong while redeclaration "
1374  "in class extension is weak">,
1375  InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1376def warn_objc_property_copy_missing_on_block : Warning<
1377    "'copy' attribute must be specified for the block property "
1378    "when -fobjc-gc-only is specified">;
1379def warn_objc_property_retain_of_block : Warning<
1380    "retain'ed block property does not copy the block "
1381    "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1382def warn_objc_readonly_property_has_setter : Warning<
1383    "setter cannot be specified for a readonly property">,
1384    InGroup<ObjCReadonlyPropertyHasSetter>;
1385def warn_atomic_property_rule : Warning<
1386  "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1387  "with a user defined %select{getter|setter}2">,
1388  InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1389def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1390  "synthesized, or both be user defined, or the property must be nonatomic">;
1391def err_atomic_property_nontrivial_assign_op : Error<
1392  "atomic property of reference type %0 cannot have non-trivial assignment"
1393  " operator">;
1394def warn_cocoa_naming_owned_rule : Warning<
1395  "property follows Cocoa naming"
1396  " convention for returning 'owned' objects">,
1397  InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1398def err_cocoa_naming_owned_rule : Error<
1399  "property follows Cocoa naming"
1400  " convention for returning 'owned' objects">;
1401def note_cocoa_naming_declare_family : Note<
1402  "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1403  "object">;
1404def warn_auto_synthesizing_protocol_property :Warning<
1405  "auto property synthesis will not synthesize property %0"
1406  " declared in protocol %1">,
1407  InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1408def note_add_synthesize_directive : Note<
1409  "add a '@synthesize' directive">;
1410def warn_no_autosynthesis_shared_ivar_property : Warning <
1411  "auto property synthesis will not synthesize property "
1412  "%0 because it cannot share an ivar with another synthesized property">,
1413  InGroup<ObjCNoPropertyAutoSynthesis>;
1414def warn_no_autosynthesis_property : Warning<
1415  "auto property synthesis will not synthesize property "
1416  "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1417  "via another property">,
1418  InGroup<ObjCNoPropertyAutoSynthesis>;
1419def warn_autosynthesis_property_in_superclass : Warning<
1420  "auto property synthesis will not synthesize property "
1421  "%0; it will be implemented by its superclass, use @dynamic to "
1422  "acknowledge intention">,
1423  InGroup<ObjCNoPropertyAutoSynthesis>;
1424def warn_autosynthesis_property_ivar_match :Warning<
1425  "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1426  "%2, not existing instance variable %3">,
1427  InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1428def warn_missing_explicit_synthesis : Warning <
1429  "auto property synthesis is synthesizing property not explicitly synthesized">,
1430  InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1431def warn_property_getter_owning_mismatch : Warning<
1432  "property declared as returning non-retained objects"
1433  "; getter returning retained objects">;
1434def warn_property_redecl_getter_mismatch : Warning<
1435  "getter name mismatch between property redeclaration (%1) and its original "
1436  "declaration (%0)">, InGroup<PropertyAttr>;
1437def err_property_setter_ambiguous_use : Error<
1438  "synthesized properties %0 and %1 both claim setter %2 -"
1439  " use of this setter will cause unexpected behavior">;
1440def warn_default_atomic_custom_getter_setter : Warning<
1441  "atomic by default property %0 has a user defined %select{getter|setter}1 "
1442  "(property should be marked 'atomic' if this is intended)">,
1443  InGroup<CustomAtomic>, DefaultIgnore;
1444def err_use_continuation_class : Error<
1445  "illegal redeclaration of property in class extension %0"
1446  " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1447def err_type_mismatch_continuation_class : Error<
1448  "type of property %0 in class extension does not match "
1449  "property type in primary class">;
1450def err_use_continuation_class_redeclaration_readwrite : Error<
1451  "illegal redeclaration of 'readwrite' property in class extension %0"
1452  " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1453  "'readonly' public property?)">;
1454def err_continuation_class : Error<"class extension has no primary class">;
1455def err_property_type : Error<"property cannot have array or function type %0">;
1456def err_missing_property_context : Error<
1457  "missing context for property implementation declaration">;
1458def err_bad_property_decl : Error<
1459  "property implementation must have its declaration in interface %0 or one of "
1460  "its extensions">;
1461def err_category_property : Error<
1462  "property declared in category %0 cannot be implemented in "
1463  "class implementation">;
1464def note_property_declare : Note<
1465  "property declared here">;
1466def note_protocol_property_declare : Note<
1467  "it could also be property "
1468  "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1469  "%1|with setter %1}0 declared here">;
1470def note_property_synthesize : Note<
1471  "property synthesized here">;
1472def err_synthesize_category_decl : Error<
1473  "@synthesize not allowed in a category's implementation">;
1474def err_synthesize_on_class_property : Error<
1475  "@synthesize not allowed on a class property %0">;
1476def err_missing_property_interface : Error<
1477  "property implementation in a category with no category declaration">;
1478def err_bad_category_property_decl : Error<
1479  "property implementation must have its declaration in the category %0">;
1480def err_bad_property_context : Error<
1481  "property implementation must be in a class or category implementation">;
1482def err_missing_property_ivar_decl : Error<
1483  "synthesized property %0 must either be named the same as a compatible"
1484  " instance variable or must explicitly name an instance variable">;
1485def err_arc_perform_selector_retains : Error<
1486  "performSelector names a selector which retains the object">;
1487def warn_arc_perform_selector_leaks : Warning<
1488  "performSelector may cause a leak because its selector is unknown">,
1489  InGroup<DiagGroup<"arc-performSelector-leaks">>;
1490def warn_dealloc_in_category : Warning<
1491"-dealloc is being overridden in a category">,
1492InGroup<DeallocInCategory>;
1493def err_gc_weak_property_strong_type : Error<
1494  "weak attribute declared on a __strong type property in GC mode">;
1495def warn_arc_repeated_use_of_weak : Warning <
1496  "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1497  "accessed multiple times in this %select{function|method|block|lambda}2 "
1498  "but may be unpredictably set to nil; assign to a strong variable to keep "
1499  "the object alive">,
1500  InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1501def warn_implicitly_retains_self : Warning <
1502  "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1503  "this is intended behavior">,
1504  InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1505def warn_arc_possible_repeated_use_of_weak : Warning <
1506  "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1507  "be accessed multiple times in this %select{function|method|block|lambda}2 "
1508  "and may be unpredictably set to nil; assign to a strong variable to keep "
1509  "the object alive">,
1510  InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1511def note_arc_weak_also_accessed_here : Note<
1512  "also accessed here">;
1513def err_incomplete_synthesized_property : Error<
1514  "cannot synthesize property %0 with incomplete type %1">;
1515
1516def err_property_ivar_type : Error<
1517  "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1518def err_property_accessor_type : Error<
1519  "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1520def err_ivar_in_superclass_use : Error<
1521  "property %0 attempting to use instance variable %1 declared in super class %2">;
1522def err_weak_property : Error<
1523  "existing instance variable %1 for __weak property %0 must be __weak">;
1524def err_strong_property : Error<
1525  "existing instance variable %1 for strong property %0 may not be __weak">;
1526def err_dynamic_property_ivar_decl : Error<
1527  "dynamic property cannot have instance variable specification">;
1528def err_duplicate_ivar_use : Error<
1529  "synthesized properties %0 and %1 both claim instance variable %2">;
1530def err_property_implemented : Error<"property %0 is already implemented">;
1531def warn_objc_missing_super_call : Warning<
1532  "method possibly missing a [super %0] call">,
1533  InGroup<ObjCMissingSuperCalls>;
1534def err_dealloc_bad_result_type : Error<
1535  "dealloc return type must be correctly specified as 'void' under ARC, "
1536  "instead of %0">;
1537def warn_undeclared_selector : Warning<
1538  "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1539def warn_undeclared_selector_with_typo : Warning<
1540  "undeclared selector %0; did you mean %1?">,
1541  InGroup<UndeclaredSelector>, DefaultIgnore;
1542def warn_implicit_atomic_property : Warning<
1543  "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1544def note_auto_readonly_iboutlet_fixup_suggest : Note<
1545  "property should be changed to be readwrite">;
1546def warn_auto_readonly_iboutlet_property : Warning<
1547  "readonly IBOutlet property %0 when auto-synthesized may "
1548  "not work correctly with 'nib' loader">,
1549  InGroup<DiagGroup<"readonly-iboutlet-property">>;
1550def warn_auto_implicit_atomic_property : Warning<
1551  "property is assumed atomic when auto-synthesizing the property">,
1552  InGroup<ImplicitAtomic>, DefaultIgnore;
1553def warn_unimplemented_selector:  Warning<
1554  "no method with selector %0 is implemented in this translation unit">,
1555  InGroup<Selector>, DefaultIgnore;
1556def warn_unimplemented_protocol_method : Warning<
1557  "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1558def warn_multiple_selectors: Warning<
1559  "several methods with selector %0 of mismatched types are found "
1560  "for the @selector expression">,
1561  InGroup<SelectorTypeMismatch>, DefaultIgnore;
1562def err_direct_selector_expression : Error<
1563  "@selector expression formed with direct selector %0">;
1564def warn_potentially_direct_selector_expression : Warning<
1565  "@selector expression formed with potentially direct selector %0">,
1566  InGroup<ObjCPotentiallyDirectSelector>;
1567def warn_strict_potentially_direct_selector_expression : Warning<
1568  warn_potentially_direct_selector_expression.Summary>,
1569  InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1570
1571def err_objc_kindof_nonobject : Error<
1572  "'__kindof' specifier cannot be applied to non-object type %0">;
1573def err_objc_kindof_wrong_position : Error<
1574  "'__kindof' type specifier must precede the declarator">;
1575
1576def err_objc_method_unsupported_param_ret_type : Error<
1577  "%0 %select{parameter|return}1 type is unsupported; "
1578  "support for vector types for this target is introduced in %2">;
1579
1580def warn_messaging_unqualified_id : Warning<
1581  "messaging unqualified id">, DefaultIgnore,
1582  InGroup<DiagGroup<"objc-messaging-id">>;
1583def err_messaging_unqualified_id_with_direct_method : Error<
1584  "messaging unqualified id with a method that is possibly direct">;
1585def err_messaging_super_with_direct_method : Error<
1586  "messaging super with a direct method">;
1587def err_messaging_class_with_direct_method : Error<
1588  "messaging a Class with a method that is possibly direct">;
1589
1590// C++ declarations
1591def err_static_assert_expression_is_not_constant : Error<
1592  "static assertion expression is not an integral constant expression">;
1593def err_constexpr_if_condition_expression_is_not_constant : Error<
1594  "constexpr if condition is not a constant expression">;
1595def err_static_assert_failed : Error<"static assertion failed%select{: %1|}0">;
1596def err_static_assert_requirement_failed : Error<
1597  "static assertion failed due to requirement '%0'%select{: %2|}1">;
1598def note_expr_evaluates_to : Note<
1599  "expression evaluates to '%0 %1 %2'">;
1600def err_static_assert_invalid_message : Error<
1601  "the message in a static assertion must be a string literal or an "
1602  "object with 'data()' and 'size()' member functions">;
1603def err_static_assert_missing_member_function : Error<
1604  "the message object in this static assertion is missing %select{"
1605  "a 'size()' member function|"
1606  "a 'data()' member function|"
1607  "'data()' and 'size()' member functions}0">;
1608def err_static_assert_invalid_mem_fn_ret_ty : Error<
1609  "the message in a static assertion must have a '%select{size|data}0()' member "
1610  "function returning an object convertible to '%select{std::size_t|const char *}0'">;
1611def warn_static_assert_message_constexpr : Warning<
1612  "the message in this static assertion is not a "
1613  "constant expression">,
1614  DefaultError, InGroup<DiagGroup<"invalid-static-assert-message">>;
1615def err_static_assert_message_constexpr : Error<
1616  "the message in a static assertion must be produced by a "
1617  "constant expression">;
1618
1619def warn_consteval_if_always_true : Warning<
1620  "consteval if is always true in an %select{unevaluated|immediate}0 context">,
1621  InGroup<DiagGroup<"redundant-consteval-if">>;
1622
1623def ext_inline_variable : ExtWarn<
1624  "inline variables are a C++17 extension">, InGroup<CXX17>;
1625def warn_cxx14_compat_inline_variable : Warning<
1626  "inline variables are incompatible with C++ standards before C++17">,
1627  DefaultIgnore, InGroup<CXXPre17Compat>;
1628
1629def warn_inline_namespace_reopened_noninline : Warning<
1630  "inline namespace reopened as a non-inline namespace">,
1631  InGroup<InlineNamespaceReopenedNoninline>;
1632def err_inline_namespace_mismatch : Error<
1633  "non-inline namespace cannot be reopened as inline">;
1634def err_inline_namespace_std : Error<
1635  "cannot declare the namespace 'std' to be inline">;
1636
1637def err_unexpected_friend : Error<
1638  "friends can only be classes or functions">;
1639def ext_enum_friend : ExtWarn<
1640  "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1641def warn_cxx98_compat_enum_friend : Warning<
1642  "befriending enumeration type %0 is incompatible with C++98">,
1643  InGroup<CXX98Compat>, DefaultIgnore;
1644def ext_nonclass_type_friend : ExtWarn<
1645  "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1646def warn_cxx98_compat_nonclass_type_friend : Warning<
1647  "non-class friend type %0 is incompatible with C++98">,
1648  InGroup<CXX98Compat>, DefaultIgnore;
1649def err_friend_is_member : Error<
1650  "friends cannot be members of the declaring class">;
1651def warn_cxx98_compat_friend_is_member : Warning<
1652  "friend declaration naming a member of the declaring class is incompatible "
1653  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1654def ext_unelaborated_friend_type : ExtWarn<
1655  "unelaborated friend declaration is a C++11 extension; specify "
1656  "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1657  InGroup<CXX11>;
1658def warn_cxx98_compat_unelaborated_friend_type : Warning<
1659  "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1660  "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1661def err_qualified_friend_no_match : Error<
1662  "friend declaration of %0 does not match any declaration in %1">;
1663def err_introducing_special_friend : Error<
1664  "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1665  " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1666  "as a friend">;
1667def err_tagless_friend_type_template : Error<
1668  "friend type templates must use an elaborated type">;
1669def err_no_matching_local_friend : Error<
1670  "no matching function found in local scope">;
1671def err_no_matching_local_friend_suggest : Error<
1672  "no matching function %0 found in local scope; did you mean %3?">;
1673def err_partial_specialization_friend : Error<
1674  "partial specialization cannot be declared as a friend">;
1675def err_qualified_friend_def : Error<
1676  "friend function definition cannot be qualified with '%0'">;
1677def err_friend_def_in_local_class : Error<
1678  "friend function cannot be defined in a local class">;
1679def err_friend_specialization_def : Error<
1680  "friend function specialization cannot be defined">;
1681def err_friend_not_first_in_declaration : Error<
1682  "'friend' must appear first in a non-function declaration">;
1683def err_using_decl_friend : Error<
1684  "cannot befriend target of using declaration">;
1685def warn_template_qualified_friend_unsupported : Warning<
1686  "dependent nested name specifier '%0' for friend class declaration is "
1687  "not supported; turning off access control for %1">,
1688  InGroup<UnsupportedFriend>;
1689def warn_template_qualified_friend_ignored : Warning<
1690  "dependent nested name specifier '%0' for friend template declaration is "
1691  "not supported; ignoring this friend declaration">,
1692  InGroup<UnsupportedFriend>;
1693def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1694  "unqualified friend declaration referring to type outside of the nearest "
1695  "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1696  InGroup<MicrosoftUnqualifiedFriend>;
1697def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1698
1699def err_invalid_base_in_interface : Error<
1700  "interface type cannot inherit from "
1701  "%select{struct|non-public interface|class}0 %1">;
1702
1703def err_abstract_type_in_decl : Error<
1704  "%select{return|parameter|variable|field|instance variable|"
1705  "synthesized instance variable}0 type %1 is an abstract class">;
1706def err_allocation_of_abstract_type : Error<
1707  "allocating an object of abstract class type %0">;
1708def err_throw_abstract_type : Error<
1709  "cannot throw an object of abstract type %0">;
1710def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1711def err_capture_of_abstract_type : Error<
1712  "by-copy capture of value of abstract type %0">;
1713def err_capture_of_incomplete_or_sizeless_type : Error<
1714  "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1715def err_capture_default_non_local : Error<
1716  "non-local lambda expression cannot have a capture-default">;
1717
1718def err_multiple_final_overriders : Error<
1719  "virtual function %q0 has more than one final overrider in %1">;
1720def note_final_overrider : Note<"final overrider of %q0 in %1">;
1721
1722def err_type_defined_in_type_specifier : Error<
1723  "%0 cannot be defined in a type specifier">;
1724def err_type_defined_in_result_type : Error<
1725  "%0 cannot be defined in the result type of a function">;
1726def err_type_defined_in_param_type : Error<
1727  "%0 cannot be defined in a parameter type">;
1728def err_type_defined_in_alias_template : Error<
1729  "%0 cannot be defined in a type alias template">;
1730def err_type_defined_in_condition : Error<
1731  "%0 cannot be defined in a condition">;
1732def err_type_defined_in_enum : Error<
1733  "%0 cannot be defined in an enumeration">;
1734def ext_type_defined_in_offsetof : Extension<
1735  "defining a type within '%select{__builtin_offsetof|offsetof}0' is a Clang "
1736  "extension">, InGroup<GNUOffsetofExtensions>;
1737
1738def note_pure_virtual_function : Note<
1739  "unimplemented pure virtual method %0 in %1">;
1740
1741def note_pure_qualified_call_kext : Note<
1742  "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1743
1744def err_deleted_decl_not_first : Error<
1745  "deleted definition must be first declaration">;
1746
1747def err_deleted_override : Error<
1748  "deleted function %0 cannot override a non-deleted function">;
1749def err_non_deleted_override : Error<
1750  "non-deleted function %0 cannot override a deleted function">;
1751def err_consteval_override : Error<
1752  "consteval function %0 cannot override a non-consteval function">;
1753def err_non_consteval_override : Error<
1754  "non-consteval function %0 cannot override a consteval function">;
1755
1756def warn_weak_vtable : Warning<
1757  "%0 has no out-of-line virtual method definitions; its vtable will be "
1758  "emitted in every translation unit">,
1759  InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1760def warn_weak_template_vtable : Warning<
1761  "this warning is no longer in use and will be removed in the next release">,
1762  InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1763
1764def ext_using_undefined_std : ExtWarn<
1765  "using directive refers to implicitly-defined namespace 'std'">;
1766
1767// C++ exception specifications
1768def err_exception_spec_in_typedef : Error<
1769  "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1770def err_distant_exception_spec : Error<
1771  "exception specifications are not allowed beyond a single level "
1772  "of indirection">;
1773def err_incomplete_in_exception_spec : Error<
1774  "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1775  "in exception specification">;
1776def err_sizeless_in_exception_spec : Error<
1777  "%select{|reference to }0sizeless type %1 is not allowed "
1778  "in exception specification">;
1779def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Summary>,
1780  InGroup<MicrosoftExceptionSpec>;
1781def err_rref_in_exception_spec : Error<
1782  "rvalue reference type %0 is not allowed in exception specification">;
1783def err_mismatched_exception_spec : Error<
1784  "exception specification in declaration does not match previous declaration">;
1785def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Summary>,
1786  InGroup<MicrosoftExceptionSpec>;
1787def err_override_exception_spec : Error<
1788  "exception specification of overriding function is more lax than "
1789  "base version">;
1790def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Summary>,
1791  InGroup<MicrosoftExceptionSpec>;
1792def err_incompatible_exception_specs : Error<
1793  "target exception specification is not superset of source">;
1794def warn_incompatible_exception_specs : Warning<
1795  err_incompatible_exception_specs.Summary>, InGroup<IncompatibleExceptionSpec>;
1796def err_deep_exception_specs_differ : Error<
1797  "exception specifications of %select{return|argument}0 types differ">;
1798def warn_deep_exception_specs_differ : Warning<
1799  err_deep_exception_specs_differ.Summary>, InGroup<IncompatibleExceptionSpec>;
1800def err_missing_exception_specification : Error<
1801  "%0 is missing exception specification '%1'">;
1802def ext_missing_exception_specification : ExtWarn<
1803  err_missing_exception_specification.Summary>,
1804  InGroup<DiagGroup<"missing-exception-spec">>;
1805def err_exception_spec_not_parsed : Error<
1806  "exception specification is not available until end of class definition">;
1807def err_exception_spec_cycle : Error<
1808  "exception specification of %0 uses itself">;
1809def err_exception_spec_incomplete_type : Error<
1810  "exception specification needed for member of incomplete class %0">;
1811def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1812  "dynamic exception specifications with types are currently ignored in wasm">,
1813  InGroup<WebAssemblyExceptionSpec>;
1814
1815// C++ access checking
1816def err_class_redeclared_with_different_access : Error<
1817  "%0 redeclared with '%1' access">;
1818def err_access : Error<
1819  "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1820def ext_ms_using_declaration_inaccessible : ExtWarn<
1821  "using declaration referring to inaccessible member '%0' (which refers "
1822  "to accessible member '%1') is a Microsoft compatibility extension">,
1823    AccessControl, InGroup<MicrosoftUsingDecl>;
1824def err_access_ctor : Error<
1825  "calling a %select{private|protected}0 constructor of class %2">,
1826  AccessControl;
1827def ext_rvalue_to_reference_access_ctor : Extension<
1828  "C++98 requires an accessible copy constructor for class %2 when binding "
1829  "a reference to a temporary; was %select{private|protected}0">,
1830  AccessControl, InGroup<BindToTemporaryCopy>;
1831def err_access_base_ctor : Error<
1832  // The ERRORs represent other special members that aren't constructors, in
1833  // hopes that someone will bother noticing and reporting if they appear
1834  "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1835  "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1836  "|*ERROR*|}2constructor">, AccessControl;
1837def err_access_field_ctor : Error<
1838  // The ERRORs represent other special members that aren't constructors, in
1839  // hopes that someone will bother noticing and reporting if they appear
1840  "field of type %0 has %select{private|protected}2 "
1841  "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1842  AccessControl;
1843def err_access_friend_function : Error<
1844  "friend function %1 is a %select{private|protected}0 member of %3">,
1845  AccessControl;
1846
1847def err_access_dtor : Error<
1848  "calling a %select{private|protected}1 destructor of class %0">,
1849  AccessControl;
1850def err_access_dtor_base :
1851    Error<"base class %0 has %select{private|protected}1 destructor">,
1852    AccessControl;
1853def err_access_dtor_vbase :
1854    Error<"inherited virtual base class %1 has "
1855    "%select{private|protected}2 destructor">,
1856    AccessControl;
1857def err_access_dtor_temp :
1858    Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1859    AccessControl;
1860def err_access_dtor_exception :
1861    Error<"exception object of type %0 has %select{private|protected}1 "
1862          "destructor">, AccessControl;
1863def err_access_dtor_field :
1864    Error<"field of type %1 has %select{private|protected}2 destructor">,
1865    AccessControl;
1866def err_access_dtor_var :
1867    Error<"variable of type %1 has %select{private|protected}2 destructor">,
1868    AccessControl;
1869def err_access_dtor_ivar :
1870    Error<"instance variable of type %0 has %select{private|protected}1 "
1871          "destructor">,
1872    AccessControl;
1873def note_previous_access_declaration : Note<
1874  "previously declared '%1' here">;
1875def note_access_natural : Note<
1876  "%select{|implicitly }1declared %select{private|protected}0 here">;
1877def note_access_constrained_by_path : Note<
1878  "constrained by %select{|implicitly }1%select{private|protected}0"
1879  " inheritance here">;
1880def note_access_protected_restricted_noobject : Note<
1881  "must name member using the type of the current context %0">;
1882def note_access_protected_restricted_ctordtor : Note<
1883  "protected %select{constructor|destructor}0 can only be used to "
1884  "%select{construct|destroy}0 a base class subobject">;
1885def note_access_protected_restricted_object : Note<
1886  "can only access this member on an object of type %0">;
1887def warn_cxx98_compat_sfinae_access_control : Warning<
1888  "substitution failure due to access control is incompatible with C++98">,
1889  InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1890
1891// C++ name lookup
1892def err_incomplete_nested_name_spec : Error<
1893  "incomplete type %0 named in nested name specifier">;
1894def err_incomplete_enum : Error<
1895  "enumeration %0 is incomplete">;
1896def err_dependent_nested_name_spec : Error<
1897  "nested name specifier for a declaration cannot depend on a template "
1898  "parameter">;
1899def err_nested_name_member_ref_lookup_ambiguous : Error<
1900  "lookup of %0 in member access expression is ambiguous">;
1901def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1902  "lookup of %0 in member access expression is ambiguous; using member of %1">,
1903  InGroup<AmbigMemberTemplate>;
1904def note_ambig_member_ref_object_type : Note<
1905  "lookup in the object type %0 refers here">;
1906def note_ambig_member_ref_scope : Note<
1907  "lookup from the current scope refers here">;
1908def err_qualified_member_nonclass : Error<
1909  "qualified member access refers to a member in %0">;
1910def err_incomplete_member_access : Error<
1911  "member access into incomplete type %0">;
1912def err_incomplete_type : Error<
1913  "incomplete type %0 where a complete type is required">;
1914def warn_cxx98_compat_enum_nested_name_spec : Warning<
1915  "enumeration type in nested name specifier is incompatible with C++98">,
1916  InGroup<CXX98Compat>, DefaultIgnore;
1917def err_nested_name_spec_is_not_class : Error<
1918  "%0 cannot appear before '::' because it is not a class"
1919  "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1920def ext_nested_name_spec_is_enum : ExtWarn<
1921  "use of enumeration in a nested name specifier is a C++11 extension">,
1922  InGroup<CXX11>;
1923def err_out_of_line_qualified_id_type_names_constructor : Error<
1924  "qualified reference to %0 is a constructor name rather than a "
1925  "%select{template name|type}1 in this context">;
1926def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1927  "ISO C++ specifies that "
1928  "qualified reference to %0 is a constructor name rather than a "
1929  "%select{template name|type}1 in this context, despite preceding "
1930  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1931  InGroup<DiagGroup<"injected-class-name">>;
1932
1933// C++ class members
1934def err_storageclass_invalid_for_member : Error<
1935  "storage class specified for a member declaration">;
1936def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1937def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1938def ext_mutable_reference : ExtWarn<
1939  "'mutable' on a reference type is a Microsoft extension">,
1940  InGroup<MicrosoftMutableReference>;
1941def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1942def err_mutable_nonmember : Error<
1943  "'mutable' can only be applied to member variables">;
1944def err_virtual_in_union : Error<
1945  "unions cannot have virtual functions">;
1946def err_virtual_non_function : Error<
1947  "'virtual' can only appear on non-static member functions">;
1948def err_virtual_out_of_class : Error<
1949  "'virtual' can only be specified inside the class definition">;
1950def err_virtual_member_function_template : Error<
1951  "'virtual' cannot be specified on member function templates">;
1952def err_static_overrides_virtual : Error<
1953  "'static' member function %0 overrides a virtual function in a base class">;
1954def err_explicit_non_function : Error<
1955  "'explicit' can only appear on non-static member functions">;
1956def err_explicit_out_of_class : Error<
1957  "'explicit' can only be specified inside the class definition">;
1958def err_explicit_non_ctor_or_conv_function : Error<
1959  "'explicit' can only be applied to a constructor or conversion function">;
1960def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1961def err_static_out_of_line : Error<
1962  "'static' can only be specified inside the class definition">;
1963def ext_static_out_of_line : ExtWarn<
1964  err_static_out_of_line.Summary>,
1965  InGroup<MicrosoftTemplate>;
1966def err_storage_class_for_static_member : Error<
1967  "static data member definition cannot specify a storage class">;
1968def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1969def err_not_integral_type_bitfield : Error<
1970  "bit-field %0 has non-integral type %1">;
1971def err_not_integral_type_anon_bitfield : Error<
1972  "anonymous bit-field has non-integral type %0">;
1973def err_anon_bitfield_qualifiers : Error<
1974  "anonymous bit-field cannot have qualifiers">;
1975def err_member_function_initialization : Error<
1976  "initializer on function does not look like a pure-specifier">;
1977def err_non_virtual_pure : Error<
1978  "%0 is not virtual and cannot be declared pure">;
1979def ext_pure_function_definition : ExtWarn<
1980  "function definition with pure-specifier is a Microsoft extension">,
1981  InGroup<MicrosoftPureDefinition>;
1982def err_qualified_member_of_unrelated : Error<
1983  "%q0 is not a member of class %1">;
1984
1985def err_member_function_call_bad_cvr : Error<
1986  "'this' argument to member function %0 has type %1, but function is not marked "
1987  "%select{const|restrict|const or restrict|volatile|const or volatile|"
1988  "volatile or restrict|const, volatile, or restrict}2">;
1989def err_member_function_call_bad_ref : Error<
1990  "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1991  "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1992def err_member_function_call_bad_type : Error<
1993  "cannot initialize object parameter of type %0 with an expression "
1994  "of type %1">;
1995
1996def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1997  "call to pure virtual member function %0 has undefined behavior; "
1998  "overrides of %0 in subclasses are not available in the "
1999  "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
2000
2001def select_special_member_kind : TextSubstitution<
2002  "%select{default constructor|copy constructor|move constructor|"
2003  "copy assignment operator|move assignment operator|destructor}0">;
2004
2005def note_member_declared_at : Note<"member is declared here">;
2006def note_ivar_decl : Note<"instance variable is declared here">;
2007def note_bitfield_decl : Note<"bit-field is declared here">;
2008def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
2009def note_member_synthesized_at : Note<
2010  "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
2011  "first required here">;
2012def note_comparison_synthesized_at : Note<
2013  "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
2014  "first required here">;
2015def err_missing_default_ctor : Error<
2016  "%select{constructor for %1 must explicitly initialize the|"
2017  "implicit default constructor for %1 must explicitly initialize the|"
2018  "cannot use constructor inherited from base class %4;}0 "
2019  "%select{base class|member}2 %3 %select{which|which|of %1}0 "
2020  "does not have a default constructor">;
2021def note_due_to_dllexported_class : Note<
2022  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
2023
2024def err_illegal_union_or_anon_struct_member : Error<
2025  "%select{anonymous struct|union}0 member %1 has a non-trivial "
2026  "%sub{select_special_member_kind}2">;
2027
2028def warn_frame_address : Warning<
2029  "calling '%0' with a nonzero argument is unsafe">,
2030  InGroup<FrameAddress>, DefaultIgnore;
2031
2032def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
2033  "%select{anonymous struct|union}0 member %1 with a non-trivial "
2034  "%sub{select_special_member_kind}2 is incompatible with C++98">,
2035  InGroup<CXX98Compat>, DefaultIgnore;
2036
2037def note_nontrivial_virtual_dtor : Note<
2038  "destructor for %0 is not trivial because it is virtual">;
2039def note_nontrivial_has_virtual : Note<
2040  "because type %0 has a virtual %select{member function|base class}1">;
2041def note_nontrivial_no_def_ctor : Note<
2042  "because %select{base class of |field of |}0type %1 has no "
2043  "default constructor">;
2044def note_user_declared_ctor : Note<
2045  "implicit default constructor suppressed by user-declared constructor">;
2046def note_nontrivial_no_copy : Note<
2047  "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
2048  "assignment operator|<<ERROR>>}2 can be used to "
2049  "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
2050  "%select{base class|field|an object}0 of type %3">;
2051def note_nontrivial_user_provided : Note<
2052  "because %select{base class of |field of |}0type %1 has a user-provided "
2053  "%sub{select_special_member_kind}2">;
2054def note_nontrivial_default_member_init : Note<
2055  "because field %0 has an initializer">;
2056def note_nontrivial_param_type : Note<
2057  "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
2058def note_nontrivial_default_arg : Note<"because it has a default argument">;
2059def note_nontrivial_variadic : Note<"because it is a variadic function">;
2060def note_nontrivial_subobject : Note<
2061  "because the function selected to %select{construct|copy|move|copy|move|"
2062  "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
2063def note_nontrivial_objc_ownership : Note<
2064  "because type %0 has a member with %select{no|no|__strong|__weak|"
2065  "__autoreleasing}1 ownership">;
2066
2067/// Selector for a TagTypeKind value.
2068def select_tag_type_kind : TextSubstitution<
2069  "%select{struct|interface|union|class|enum}0">;
2070
2071def err_static_data_member_not_allowed_in_anon_struct : Error<
2072  "static data member %0 not allowed in anonymous "
2073  "%sub{select_tag_type_kind}1">;
2074def ext_static_data_member_in_union : ExtWarn<
2075  "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
2076def warn_cxx98_compat_static_data_member_in_union : Warning<
2077  "static data member %0 in union is incompatible with C++98">,
2078  InGroup<CXX98Compat>, DefaultIgnore;
2079def ext_union_member_of_reference_type : ExtWarn<
2080  "union member %0 has reference type %1, which is a Microsoft extension">,
2081  InGroup<MicrosoftUnionMemberReference>;
2082def err_union_member_of_reference_type : Error<
2083  "union member %0 has reference type %1">;
2084def ext_anonymous_struct_union_qualified : Extension<
2085  "anonymous %select{struct|union}0 cannot be '%1'">;
2086def err_different_return_type_for_overriding_virtual_function : Error<
2087  "virtual function %0 has a different return type "
2088  "%diff{($) than the function it overrides (which has return type $)|"
2089  "than the function it overrides}1,2">;
2090def note_overridden_virtual_function : Note<
2091  "overridden virtual function is here">;
2092def err_conflicting_overriding_attributes : Error<
2093  "virtual function %0 has different attributes "
2094  "%diff{($) than the function it overrides (which has $)|"
2095  "than the function it overrides}1,2">;
2096def err_conflicting_overriding_cc_attributes : Error<
2097  "virtual function %0 has different calling convention attributes "
2098  "%diff{($) than the function it overrides (which has calling convention $)|"
2099  "than the function it overrides}1,2">;
2100def warn_overriding_method_missing_noescape : Warning<
2101  "parameter of overriding method should be annotated with "
2102  "__attribute__((noescape))">, InGroup<MissingNoEscape>;
2103def note_overridden_marked_noescape : Note<
2104  "parameter of overridden method is annotated with __attribute__((noescape))">;
2105def note_cat_conform_to_noescape_prot : Note<
2106  "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
2107
2108def err_covariant_return_inaccessible_base : Error<
2109  "invalid covariant return for virtual function: %1 is a "
2110  "%select{private|protected}2 base class of %0">, AccessControl;
2111def err_covariant_return_ambiguous_derived_to_base_conv : Error<
2112  "return type of virtual function %3 is not covariant with the return type of "
2113  "the function it overrides (ambiguous conversion from derived class "
2114  "%0 to base class %1:%2)">;
2115def err_covariant_return_not_derived : Error<
2116  "return type of virtual function %0 is not covariant with the return type of "
2117  "the function it overrides (%1 is not derived from %2)">;
2118def err_covariant_return_incomplete : Error<
2119  "return type of virtual function %0 is not covariant with the return type of "
2120  "the function it overrides (%1 is incomplete)">;
2121def err_covariant_return_type_different_qualifications : Error<
2122  "return type of virtual function %0 is not covariant with the return type of "
2123  "the function it overrides (%1 has different qualifiers than %2)">;
2124def err_covariant_return_type_class_type_more_qualified : Error<
2125  "return type of virtual function %0 is not covariant with the return type of "
2126  "the function it overrides (class type %1 is more qualified than class "
2127  "type %2">;
2128
2129// C++ implicit special member functions
2130def note_in_declaration_of_implicit_special_member : Note<
2131  "while declaring the implicit %sub{select_special_member_kind}1"
2132  " for %0">;
2133
2134// C++ constructors
2135def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
2136def err_invalid_qualified_constructor : Error<
2137  "'%0' qualifier is not allowed on a constructor">;
2138def err_ref_qualifier_constructor : Error<
2139  "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
2140
2141def err_constructor_return_type : Error<
2142  "constructor cannot have a return type">;
2143def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
2144def err_constructor_byvalue_arg : Error<
2145  "copy constructor must pass its first argument by reference">;
2146def warn_no_constructor_for_refconst : Warning<
2147  "%select{struct|interface|union|class|enum}0 %1 does not declare any "
2148  "constructor to initialize its non-modifiable members">;
2149def note_refconst_member_not_initialized : Note<
2150  "%select{const|reference}0 member %1 will never be initialized">;
2151def ext_ms_explicit_constructor_call : ExtWarn<
2152  "explicit constructor calls are a Microsoft extension">,
2153  InGroup<MicrosoftExplicitConstructorCall>;
2154
2155// C++ destructors
2156def err_destructor_not_member : Error<
2157  "destructor must be a non-static member function">;
2158def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
2159def err_invalid_qualified_destructor : Error<
2160  "'%0' qualifier is not allowed on a destructor">;
2161def err_ref_qualifier_destructor : Error<
2162  "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
2163def err_destructor_return_type : Error<"destructor cannot have a return type">;
2164def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
2165def err_destructor_with_params : Error<"destructor cannot have any parameters">;
2166def err_destructor_variadic : Error<"destructor cannot be variadic">;
2167def ext_destructor_typedef_name : ExtWarn<
2168  "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
2169  "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
2170def err_undeclared_destructor_name : Error<
2171  "undeclared identifier %0 in destructor name">;
2172def err_destructor_name : Error<
2173  "expected the class name after '~' to name the enclosing class">;
2174def err_destructor_name_nontype : Error<
2175  "identifier %0 after '~' in destructor name does not name a type">;
2176def err_destructor_expr_mismatch : Error<
2177  "identifier %0 in object destruction expression does not name the type "
2178  "%1 of the object being destroyed">;
2179def err_destructor_expr_nontype : Error<
2180  "identifier %0 in object destruction expression does not name a type">;
2181def err_destructor_expr_type_mismatch : Error<
2182  "destructor type %0 in object destruction expression does not match the "
2183  "type %1 of the object being destroyed">;
2184def note_destructor_type_here : Note<
2185  "type %0 found by destructor name lookup">;
2186def note_destructor_nontype_here : Note<
2187  "non-type declaration found by destructor name lookup">;
2188def ext_dtor_named_in_wrong_scope : Extension<
2189  "ISO C++ requires the name after '::~' to be found in the same scope as "
2190  "the name before '::~'">, InGroup<DtorName>;
2191def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
2192  "qualified destructor name only found in lexical scope; omit the qualifier "
2193  "to find this type name by unqualified lookup">, InGroup<DtorName>;
2194def ext_dtor_name_ambiguous : Extension<
2195  "ISO C++ considers this destructor name lookup to be ambiguous">,
2196  InGroup<DtorName>;
2197
2198def err_destroy_attr_on_non_static_var : Error<
2199  "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
2200  " variable with static or thread storage duration">;
2201
2202def err_destructor_template : Error<
2203  "destructor cannot be declared as a template">;
2204
2205// C++ initialization
2206def err_init_conversion_failed : Error<
2207  "cannot initialize %select{a variable|a parameter|template parameter|"
2208  "return object|statement expression result|an "
2209  "exception object|a member subobject|an array element|a new value|a value|a "
2210  "base class|a constructor delegation|a vector element|a block element|a "
2211  "block element|a complex element|a lambda capture|a compound literal "
2212  "initializer|a related result|a parameter of CF audited function|a "
2213  "structured binding|a member subobject}0 "
2214  "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2215  "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2216  "%select{|: different classes%diff{ ($ vs $)|}5,6"
2217  "|: different number of parameters (%5 vs %6)"
2218  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2219  "|: different return type%diff{ ($ vs $)|}5,6"
2220  "|: different qualifiers (%5 vs %6)"
2221  "|: different exception specifications}4">;
2222def note_forward_class_conversion : Note<"%0 is not defined, but forward "
2223  "declared here; conversion would be valid if it was derived from %1">;
2224
2225def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2226  "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2227def err_lvalue_reference_bind_to_initlist : Error<
2228  "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2229  "initializer list temporary">;
2230def err_lvalue_reference_bind_to_temporary : Error<
2231  "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2232  "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2233def err_lvalue_reference_bind_to_unrelated : Error<
2234  "%select{non-const|volatile}0 lvalue reference "
2235  "%diff{to type $ cannot bind to a value of unrelated type $|"
2236  "cannot bind to a value of unrelated type}1,2">;
2237def err_reference_bind_drops_quals : Error<
2238  "binding reference %diff{of type $ to value of type $|to value}0,1 "
2239  "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2240  "not permitted due to incompatible qualifiers}2">;
2241def err_reference_bind_failed : Error<
2242  "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2243  "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2244  "incompatible type}0,3">;
2245def err_reference_bind_temporary_addrspace : Error<
2246  "reference of type %0 cannot bind to a temporary object because of "
2247  "address space mismatch">;
2248def err_reference_bind_init_list : Error<
2249  "reference to type %0 cannot bind to an initializer list">;
2250def err_init_list_bad_dest_type : Error<
2251  "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2252  "list">;
2253def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2254  "aggregate initialization of type %0 with user-declared constructors "
2255  "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2256def warn_cxx17_compat_aggregate_init_paren_list : Warning<
2257  "aggregate initialization of type %0 from a parenthesized list of values "
2258  "is a C++20 extension">, DefaultIgnore, InGroup<CXX20>;
2259
2260def err_reference_bind_to_bitfield : Error<
2261  "%select{non-const|volatile}0 reference cannot bind to "
2262  "bit-field%select{| %1}2">;
2263def err_reference_bind_to_bitfield_in_cce : Error<
2264  "reference cannot bind to bit-field in converted constant expression">;
2265def err_reference_bind_to_vector_element : Error<
2266  "%select{non-const|volatile}0 reference cannot bind to vector element">;
2267def err_reference_bind_to_matrix_element : Error<
2268  "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2269def err_reference_var_requires_init : Error<
2270  "declaration of reference variable %0 requires an initializer">;
2271def err_reference_without_init : Error<
2272  "reference to type %0 requires an initializer">;
2273def note_value_initialization_here : Note<
2274  "in value-initialization of type %0 here">;
2275def err_reference_has_multiple_inits : Error<
2276  "reference cannot be initialized with multiple values">;
2277def err_init_non_aggr_init_list : Error<
2278  "initialization of non-aggregate type %0 with an initializer list">;
2279def err_designated_init_for_non_aggregate : Error<
2280  "initialization of non-aggregate type %0 with a designated initializer list">;
2281def err_init_reference_member_uninitialized : Error<
2282  "reference member of type %0 uninitialized">;
2283def note_uninit_reference_member : Note<
2284  "uninitialized reference member is here">;
2285def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2286  InGroup<Uninitialized>;
2287def warn_base_class_is_uninit : Warning<
2288  "base class %0 is uninitialized when used here to access %q1">,
2289  InGroup<Uninitialized>;
2290def warn_reference_field_is_uninit : Warning<
2291  "reference %0 is not yet bound to a value when used here">,
2292  InGroup<Uninitialized>;
2293def note_uninit_in_this_constructor : Note<
2294  "during field initialization in %select{this|the implicit default}0 "
2295  "constructor">;
2296def warn_static_self_reference_in_init : Warning<
2297  "static variable %0 is suspiciously used within its own initialization">,
2298  InGroup<UninitializedStaticSelfInit>;
2299def warn_uninit_self_reference_in_init : Warning<
2300  "variable %0 is uninitialized when used within its own initialization">,
2301  InGroup<Uninitialized>;
2302def warn_uninit_self_reference_in_reference_init : Warning<
2303  "reference %0 is not yet bound to a value when used within its own"
2304  " initialization">,
2305  InGroup<Uninitialized>;
2306def warn_uninit_var : Warning<
2307  "variable %0 is uninitialized when %select{used here|captured by block}1">,
2308  InGroup<Uninitialized>, DefaultIgnore;
2309def warn_sometimes_uninit_var : Warning<
2310  "variable %0 is %select{used|captured}1 uninitialized whenever "
2311  "%select{'%3' condition is %select{true|false}4|"
2312  "'%3' loop %select{is entered|exits because its condition is false}4|"
2313  "'%3' loop %select{condition is true|exits because its condition is false}4|"
2314  "switch %3 is taken|"
2315  "its declaration is reached|"
2316  "%3 is called}2">,
2317  InGroup<UninitializedSometimes>, DefaultIgnore;
2318def warn_maybe_uninit_var : Warning<
2319  "variable %0 may be uninitialized when "
2320  "%select{used here|captured by block}1">,
2321  InGroup<UninitializedMaybe>, DefaultIgnore;
2322def note_var_declared_here : Note<"variable %0 is declared here">;
2323def note_uninit_var_use : Note<
2324  "%select{uninitialized use occurs|variable is captured by block}0 here">;
2325def warn_uninit_byref_blockvar_captured_by_block : Warning<
2326  "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2327  "block">, InGroup<Uninitialized>, DefaultIgnore;
2328def note_block_var_fixit_add_initialization : Note<
2329  "did you mean to use __block %0?">;
2330def note_in_omitted_aggregate_initializer : Note<
2331  "in implicit initialization of %select{"
2332  "array element %1 with omitted initializer|"
2333  "field %1 with omitted initializer|"
2334  "trailing array elements in runtime-sized array new}0">;
2335def note_in_reference_temporary_list_initializer : Note<
2336  "in initialization of temporary of type %0 created to "
2337  "list-initialize this reference">;
2338def note_var_fixit_add_initialization : Note<
2339  "initialize the variable %0 to silence this warning">;
2340def note_uninit_fixit_remove_cond : Note<
2341  "remove the %select{'%1' if its condition|condition if it}0 "
2342  "is always %select{false|true}2">;
2343def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2344def err_list_init_in_parens : Error<
2345  "cannot initialize %select{non-class|reference}0 type %1 with a "
2346  "parenthesized initializer list">;
2347
2348def warn_uninit_const_reference : Warning<
2349  "variable %0 is uninitialized when passed as a const reference argument "
2350  "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2351
2352def warn_unsequenced_mod_mod : Warning<
2353  "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2354def warn_unsequenced_mod_use : Warning<
2355  "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2356
2357def select_initialized_entity_kind : TextSubstitution<
2358  "%select{copying variable|copying parameter|initializing template parameter|"
2359  "returning object|initializing statement expression result|"
2360  "throwing object|copying member subobject|copying array element|"
2361  "allocating object|copying temporary|initializing base subobject|"
2362  "initializing vector element|capturing value}0">;
2363
2364def err_temp_copy_no_viable : Error<
2365  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2366def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2367  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2368  "C++98 requires a copy constructor when binding a reference to a temporary">,
2369  InGroup<BindToTemporaryCopy>;
2370def err_temp_copy_ambiguous : Error<
2371  "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2372  "of type %1">;
2373def err_temp_copy_deleted : Error<
2374  "%sub{select_initialized_entity_kind}0 of type %1 "
2375  "invokes deleted constructor">;
2376def err_temp_copy_incomplete : Error<
2377  "copying a temporary object of incomplete type %0">;
2378def warn_cxx98_compat_temp_copy : Warning<
2379  "%sub{select_initialized_entity_kind}1 "
2380  "of type %2 when binding a reference to a temporary would %select{invoke "
2381  "an inaccessible constructor|find no viable constructor|find ambiguous "
2382  "constructors|invoke a deleted constructor}0 in C++98">,
2383  InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2384def err_selected_explicit_constructor : Error<
2385  "chosen constructor is explicit in copy-initialization">;
2386def note_explicit_ctor_deduction_guide_here : Note<
2387  "explicit %select{constructor|deduction guide}0 declared here">;
2388
2389// C++11 decltype
2390def err_decltype_in_declarator : Error<
2391    "'decltype' cannot be used to name a declaration">;
2392
2393// C++11 auto
2394def warn_cxx98_compat_auto_type_specifier : Warning<
2395  "'auto' type specifier is incompatible with C++98">,
2396  InGroup<CXX98Compat>, DefaultIgnore;
2397def err_auto_variable_cannot_appear_in_own_initializer : Error<
2398  "variable %0 declared with deduced type %1 "
2399  "cannot appear in its own initializer">;
2400def err_binding_cannot_appear_in_own_initializer : Error<
2401  "binding %0 cannot appear in the initializer of its own "
2402  "decomposition declaration">;
2403def err_new_array_of_auto : Error<
2404  "cannot allocate array of 'auto'">;
2405def err_auto_not_allowed : Error<
2406  "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2407  "use of "
2408  "%select{class template|function template|variable template|alias template|"
2409  "template template parameter|concept|template}2 %3 requires template "
2410  "arguments; argument deduction}0 not allowed "
2411  "%select{in function prototype"
2412  "|in non-static struct member|in struct member"
2413  "|in non-static union member|in union member"
2414  "|in non-static class member|in interface member"
2415  "|in exception declaration|in template parameter until C++17|in block literal"
2416  "|in template argument|in typedef|in type alias|in function return type"
2417  "|in conversion function type|here|in lambda parameter"
2418  "|in type allocated by 'new'|in K&R-style function parameter"
2419  "|in template parameter|in friend declaration|in function prototype that is "
2420  "not a function declaration|in requires expression parameter"
2421  "|in array declaration"
2422  "|in declaration of conversion function template}1">;
2423def err_dependent_deduced_tst : Error<
2424  "typename specifier refers to "
2425  "%select{class template|function template|variable template|alias template|"
2426  "template template parameter|template}0 member in %1; "
2427  "argument deduction not allowed here">;
2428def err_deduced_tst : Error<
2429  "typename specifier refers to "
2430  "%select{class template|function template|variable template|alias template|"
2431  "template template parameter|template}0; argument deduction not allowed "
2432  "here">;
2433def err_auto_not_allowed_var_inst : Error<
2434  "'auto' variable template instantiation is not allowed">;
2435def err_auto_var_requires_init : Error<
2436  "declaration of variable %0 with deduced type %1 requires an initializer">;
2437def err_auto_new_requires_ctor_arg : Error<
2438  "new expression for type %0 requires a constructor argument">;
2439def ext_auto_new_list_init : Extension<
2440  "ISO C++ standards before C++17 do not allow new expression for "
2441  "type %0 to use list-initialization">, InGroup<CXX17>;
2442def err_auto_var_init_no_expression : Error<
2443  "initializer for variable %0 with type %1 is empty">;
2444def err_auto_expr_init_no_expression : Error<
2445  "initializer for functional-style cast to %0 is empty">;
2446def err_auto_var_init_multiple_expressions : Error<
2447  "initializer for variable %0 with type %1 contains multiple expressions">;
2448def err_auto_expr_init_multiple_expressions : Error<
2449  "initializer for functional-style cast to %0 contains multiple expressions">;
2450def err_auto_var_init_paren_braces : Error<
2451  "cannot deduce type for variable %1 with type %2 from "
2452  "%select{parenthesized|nested}0 initializer list">;
2453def err_auto_new_ctor_multiple_expressions : Error<
2454  "new expression for type %0 contains multiple constructor arguments">;
2455def err_auto_expr_init_paren_braces : Error<
2456  "cannot deduce actual type for %1 from "
2457  "%select{parenthesized|nested}0 initializer list">;
2458def warn_cxx20_compat_auto_expr : Warning<
2459  "'auto' as a functional-style cast is incompatible with C++ standards "
2460  "before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
2461def err_auto_missing_trailing_return : Error<
2462  "'auto' return without trailing return type; deduced return types are a "
2463  "C++14 extension">;
2464def err_deduced_return_type : Error<
2465  "deduced return types are a C++14 extension">;
2466def err_trailing_return_without_auto : Error<
2467  "function with trailing return type must specify return type 'auto', not %0">;
2468def err_trailing_return_in_parens : Error<
2469  "trailing return type may not be nested within parentheses">;
2470def err_auto_var_deduction_failure : Error<
2471  "variable %0 with type %1 has incompatible initializer of type %2">;
2472def err_auto_var_deduction_failure_from_init_list : Error<
2473  "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2474def err_auto_expr_deduction_failure : Error<
2475  "functional-style cast to %0 has incompatible initializer of type %1">;
2476def err_auto_new_deduction_failure : Error<
2477  "new expression for type %0 has incompatible constructor argument of type %1">;
2478def err_auto_inconsistent_deduction : Error<
2479  "deduced conflicting types %diff{($ vs $) |}0,1"
2480  "for initializer list element type">;
2481def err_auto_different_deductions : Error<
2482  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2483  "deduced as %1 in declaration of %2 and "
2484  "deduced as %3 in declaration of %4">;
2485def err_auto_non_deduced_not_alone : Error<
2486  "%select{function with deduced return type|"
2487  "declaration with trailing return type}0 "
2488  "must be the only declaration in its group">;
2489def err_implied_std_initializer_list_not_found : Error<
2490  "cannot deduce type of initializer list because std::initializer_list was "
2491  "not found; include <initializer_list>">;
2492def err_malformed_std_initializer_list : Error<
2493  "std::initializer_list must be a class template with a single type parameter">;
2494def err_auto_init_list_from_c : Error<
2495  "cannot use %select{'auto'|<ERROR>|'__auto_type'}0 with "
2496  "%select{initializer list|array}1 in C">;
2497def err_auto_bitfield : Error<
2498  "cannot pass bit-field as __auto_type initializer in C">;
2499
2500// C++1y decltype(auto) type
2501def err_decltype_auto_invalid : Error<
2502  "'decltype(auto)' not allowed here">;
2503def err_decltype_auto_cannot_be_combined : Error<
2504  "'decltype(auto)' cannot be combined with other type specifiers">;
2505def err_decltype_auto_function_declarator_not_declaration : Error<
2506  "'decltype(auto)' can only be used as a return type "
2507  "in a function declaration">;
2508def err_decltype_auto_compound_type : Error<
2509  "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2510def err_decltype_auto_initializer_list : Error<
2511  "cannot deduce 'decltype(auto)' from initializer list">;
2512
2513// C++17 deduced class template specialization types
2514def err_deduced_class_template_compound_type : Error<
2515  "cannot %select{form pointer to|form reference to|form array of|"
2516  "form function returning|use parentheses when declaring variable with}0 "
2517  "deduced class template specialization type">;
2518def err_deduced_non_class_template_specialization_type : Error<
2519  "%select{<error>|function template|variable template|alias template|"
2520  "template template parameter|concept|template}0 %1 requires template "
2521  "arguments; argument deduction only allowed for class templates">;
2522def err_deduced_class_template_ctor_ambiguous : Error<
2523  "ambiguous deduction for template arguments of %0">;
2524def err_deduced_class_template_ctor_no_viable : Error<
2525  "no viable constructor or deduction guide for deduction of "
2526  "template arguments of %0">;
2527def err_deduced_class_template_incomplete : Error<
2528  "template %0 has no definition and no %select{|viable }1deduction guides "
2529  "for deduction of template arguments">;
2530def err_deduced_class_template_deleted : Error<
2531  "class template argument deduction for %0 selected a deleted constructor">;
2532def err_deduced_class_template_explicit : Error<
2533  "class template argument deduction for %0 selected an explicit "
2534  "%select{constructor|deduction guide}1 for copy-list-initialization">;
2535def err_deduction_guide_no_trailing_return_type : Error<
2536  "deduction guide declaration without trailing return type">;
2537def err_deduction_guide_bad_trailing_return_type : Error<
2538  "deduced type %1 of deduction guide is not %select{|written as }2"
2539  "a specialization of template %0">;
2540def err_deduction_guide_with_complex_decl : Error<
2541  "cannot specify any part of a return type in the "
2542  "declaration of a deduction guide">;
2543def err_deduction_guide_invalid_specifier : Error<
2544  "deduction guide cannot be declared '%0'">;
2545def err_deduction_guide_name_not_class_template : Error<
2546  "cannot specify deduction guide for "
2547  "%select{<error>|function template|variable template|alias template|"
2548  "template template parameter|concept|dependent template name}0 %1">;
2549def err_deduction_guide_wrong_scope : Error<
2550  "deduction guide must be declared in the same scope as template %q0">;
2551def err_deduction_guide_defines_function : Error<
2552  "deduction guide cannot have a function definition">;
2553def err_deduction_guide_redeclared : Error<
2554  "redeclaration of deduction guide">;
2555def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2556  "%select{explicitly instantiated|explicitly specialized}0">;
2557def err_deduction_guide_template_not_deducible : Error<
2558  "deduction guide template contains "
2559  "%select{a template parameter|template parameters}0 that cannot be "
2560  "deduced">;
2561def err_deduction_guide_wrong_access : Error<
2562  "deduction guide has different access from the corresponding "
2563  "member template">;
2564def note_deduction_guide_template_access : Note<
2565  "member template declared %0 here">;
2566def note_deduction_guide_access : Note<
2567  "deduction guide declared %0 by intervening access specifier">;
2568def warn_cxx14_compat_class_template_argument_deduction : Warning<
2569  "class template argument deduction is incompatible with C++ standards "
2570  "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2571  InGroup<CXXPre17Compat>, DefaultIgnore;
2572def warn_ctad_maybe_unsupported : Warning<
2573  "%0 may not intend to support class template argument deduction">,
2574  InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2575def note_suppress_ctad_maybe_unsupported : Note<
2576  "add a deduction guide to suppress this warning">;
2577
2578
2579// C++14 deduced return types
2580def err_auto_fn_deduction_failure : Error<
2581  "cannot deduce return type %0 from returned value of type %1">;
2582def err_auto_fn_different_deductions : Error<
2583  "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2584  "deduced as %2 in earlier return statement">;
2585def err_auto_fn_used_before_defined : Error<
2586  "function %0 with deduced return type cannot be used before it is defined">;
2587def err_auto_fn_no_return_but_not_auto : Error<
2588  "cannot deduce return type %0 for function with no return statements">;
2589def err_auto_fn_return_void_but_not_auto : Error<
2590  "cannot deduce return type %0 from omitted return expression">;
2591def err_auto_fn_return_init_list : Error<
2592  "cannot deduce return type from initializer list">;
2593def err_auto_fn_virtual : Error<
2594  "function with deduced return type cannot be virtual">;
2595def warn_cxx11_compat_deduced_return_type : Warning<
2596  "return type deduction is incompatible with C++ standards before C++14">,
2597  InGroup<CXXPre14Compat>, DefaultIgnore;
2598
2599// C++11 override control
2600def override_keyword_only_allowed_on_virtual_member_functions : Error<
2601  "only virtual member functions can be marked '%0'">;
2602def override_keyword_hides_virtual_member_function : Error<
2603  "non-virtual member function marked '%0' hides virtual member "
2604  "%select{function|functions}1">;
2605def err_function_marked_override_not_overriding : Error<
2606  "%0 marked 'override' but does not override any member functions">;
2607def warn_destructor_marked_not_override_overriding : TextSubstitution <
2608  "%0 overrides a destructor but is not marked 'override'">;
2609def warn_function_marked_not_override_overriding : TextSubstitution <
2610  "%0 overrides a member function but is not marked 'override'">;
2611def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2612  "%sub{warn_destructor_marked_not_override_overriding}0">,
2613  InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2614def warn_inconsistent_function_marked_not_override_overriding : Warning <
2615  "%sub{warn_function_marked_not_override_overriding}0">,
2616  InGroup<CXX11WarnInconsistentOverrideMethod>;
2617def warn_suggest_destructor_marked_not_override_overriding : Warning <
2618  "%sub{warn_destructor_marked_not_override_overriding}0">,
2619  InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2620def warn_suggest_function_marked_not_override_overriding : Warning <
2621  "%sub{warn_function_marked_not_override_overriding}0">,
2622  InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2623def err_class_marked_final_used_as_base : Error<
2624  "base %0 is marked '%select{final|sealed}1'">;
2625def warn_abstract_final_class : Warning<
2626  "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2627def warn_final_dtor_non_final_class : Warning<
2628  "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2629  InGroup<FinalDtorNonFinalClass>;
2630def note_final_dtor_non_final_class_silence : Note<
2631  "mark %0 as '%select{final|sealed}1' to silence this warning">;
2632
2633// C++11 attributes
2634def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2635
2636// C++11 final
2637def err_final_function_overridden : Error<
2638  "declaration of %0 overrides a '%select{final|sealed}1' function">;
2639
2640// C++11 scoped enumerations
2641def err_enum_invalid_underlying : Error<
2642  "%select{non-integral type %0|%0}1 is an invalid underlying type">;
2643def err_enumerator_too_large : Error<
2644  "enumerator value is not representable in the underlying type %0">;
2645def ext_enumerator_too_large : Extension<
2646  "enumerator value is not representable in the underlying type %0">,
2647  InGroup<MicrosoftEnumValue>;
2648def err_enumerator_wrapped : Error<
2649  "enumerator value %0 is not representable in the underlying type %1">;
2650def err_enum_redeclare_type_mismatch : Error<
2651  "enumeration redeclared with different underlying type %0 (was %1)">;
2652def err_enum_redeclare_fixed_mismatch : Error<
2653  "enumeration previously declared with %select{non|}0fixed underlying type">;
2654def err_enum_redeclare_scoped_mismatch : Error<
2655  "enumeration previously declared as %select{un|}0scoped">;
2656def err_only_enums_have_underlying_types : Error<
2657  "only enumeration types have underlying types">;
2658def err_underlying_type_of_incomplete_enum : Error<
2659  "cannot determine underlying type of incomplete enumeration type %0">;
2660
2661// C++11 delegating constructors
2662def err_delegating_ctor : Error<
2663  "delegating constructors are permitted only in C++11">;
2664def warn_cxx98_compat_delegating_ctor : Warning<
2665  "delegating constructors are incompatible with C++98">,
2666  InGroup<CXX98Compat>, DefaultIgnore;
2667def err_delegating_initializer_alone : Error<
2668  "an initializer for a delegating constructor must appear alone">;
2669def warn_delegating_ctor_cycle : Warning<
2670  "constructor for %0 creates a delegation cycle">, DefaultError,
2671  InGroup<DelegatingCtorCycles>;
2672def note_it_delegates_to : Note<"it delegates to">;
2673def note_which_delegates_to : Note<"which delegates to">;
2674
2675// C++11 range-based for loop
2676def err_for_range_decl_must_be_var : Error<
2677  "for range declaration must declare a variable">;
2678def err_for_range_storage_class : Error<
2679  "loop variable %0 may not be declared %select{'extern'|'static'|"
2680  "'__private_extern__'|'auto'|'register'|'constexpr'|'thread_local'}1">;
2681def err_type_defined_in_for_range : Error<
2682  "types may not be defined in a for range declaration">;
2683def err_for_range_deduction_failure : Error<
2684  "cannot use type %0 as a range">;
2685def err_for_range_incomplete_type : Error<
2686  "cannot use incomplete type %0 as a range">;
2687def err_for_range_iter_deduction_failure : Error<
2688  "cannot use type %0 as an iterator">;
2689def ext_for_range_begin_end_types_differ : ExtWarn<
2690  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2691  InGroup<CXX17>;
2692def warn_for_range_begin_end_types_differ : Warning<
2693  "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2694  "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2695def note_in_for_range: Note<
2696  "when looking up '%select{begin|end}0' function for range expression "
2697  "of type %1">;
2698def err_for_range_invalid: Error<
2699  "invalid range expression of type %0; no viable '%select{begin|end}1' "
2700  "function available">;
2701def note_for_range_member_begin_end_ignored : Note<
2702  "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2703def err_range_on_array_parameter : Error<
2704  "cannot build range expression with array function parameter %0 since "
2705  "parameter with array type %1 is treated as pointer type %2">;
2706def err_for_range_dereference : Error<
2707  "invalid range expression of type %0; did you mean to dereference it "
2708  "with '*'?">;
2709def note_for_range_invalid_iterator : Note <
2710  "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2711def note_for_range_begin_end : Note<
2712  "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2713def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2714  "loop variable %0 "
2715  "%diff{of type $ binds to a temporary constructed from type $"
2716  "|binds to a temporary constructed from a different type}1,2">,
2717  InGroup<RangeLoopConstruct>, DefaultIgnore;
2718def note_use_type_or_non_reference : Note<
2719  "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2720def warn_for_range_ref_binds_ret_temp : Warning<
2721  "loop variable %0 binds to a temporary value produced by a range of type %1">,
2722  InGroup<RangeLoopBindReference>, DefaultIgnore;
2723def note_use_non_reference_type : Note<"use non-reference type %0">;
2724def warn_for_range_copy : Warning<
2725  "loop variable %0 creates a copy from type %1">,
2726  InGroup<RangeLoopConstruct>, DefaultIgnore;
2727def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2728def err_objc_for_range_init_stmt : Error<
2729  "initialization statement is not supported when iterating over Objective-C "
2730  "collection">;
2731
2732// C++11 constexpr
2733def warn_cxx98_compat_constexpr : Warning<
2734  "'constexpr' specifier is incompatible with C++98">,
2735  InGroup<CXX98Compat>, DefaultIgnore;
2736// FIXME: Maybe this should also go in -Wc++14-compat?
2737def warn_cxx14_compat_constexpr_not_const : Warning<
2738  "'constexpr' non-static member function will not be implicitly 'const' "
2739  "in C++14; add 'const' to avoid a change in behavior">,
2740  InGroup<DiagGroup<"constexpr-not-const">>;
2741def err_invalid_consteval_take_address : Error<
2742  "cannot take address of %select{immediate|consteval}2 "
2743  "%select{function|call operator of}1 %0 outside"
2744  " of an immediate invocation">;
2745def err_invalid_consteval_call : Error<
2746  "call to %select{immediate|consteval}1 function "
2747  "%q0 is not a constant expression">;
2748
2749def err_immediate_function_used_before_definition : Error<
2750  "immediate function %0 used before it is defined">;
2751
2752def note_immediate_function_reason : Note<
2753  "%0 is an immediate %select{function|constructor}5 because "
2754  "%select{its body|the%select{| default}7 initializer of %8}6 "
2755  "%select{evaluates the address of %select{an immediate|a consteval}2 "
2756  "function %1|contains a call to %select{an immediate|a consteval}2 "
2757  "%select{function|constructor}4 %1 and that call is not a constant "
2758  "expression}3">;
2759
2760def note_invalid_consteval_initializer : Note<
2761  "in the default initializer of %0">;
2762def note_invalid_consteval_initializer_here : Note<
2763  "initialized here %0">;
2764def err_invalid_consteval_decl_kind : Error<
2765  "%0 cannot be declared consteval">;
2766def err_invalid_constexpr : Error<
2767  "%select{function parameter|typedef}0 "
2768  "cannot be %sub{select_constexpr_spec_kind}1">;
2769def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2770  "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2771def err_constexpr_tag : Error<
2772  "%select{class|struct|interface|union|enum|enum class|enum struct}0 "
2773  "cannot be marked %sub{select_constexpr_spec_kind}1">;
2774def err_constexpr_dtor : Error<
2775  "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2776def err_constexpr_dtor_subobject : Error<
2777  "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2778  "%select{data member %2|base class %3}1 does not have a "
2779  "constexpr destructor">;
2780def note_constexpr_dtor_subobject : Note<
2781  "%select{data member %1|base class %2}0 declared here">;
2782def err_constexpr_wrong_decl_kind : Error<
2783  "%sub{select_constexpr_spec_kind}0 can only be used "
2784  "in %select{|variable and function|function|variable}0 declarations">;
2785def err_invalid_constexpr_var_decl : Error<
2786  "constexpr variable declaration must be a definition">;
2787def err_constexpr_static_mem_var_requires_init : Error<
2788  "declaration of constexpr static data member %0 requires an initializer">;
2789def err_constexpr_var_non_literal : Error<
2790  "constexpr variable cannot have non-literal type %0">;
2791def err_constexpr_var_requires_const_init : Error<
2792  "constexpr variable %0 must be initialized by a constant expression">;
2793def err_constexpr_var_requires_const_destruction : Error<
2794  "constexpr variable %0 must have constant destruction">;
2795def err_constexpr_redecl_mismatch : Error<
2796  "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2797  " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2798def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2799def warn_cxx17_compat_constexpr_virtual : Warning<
2800  "virtual constexpr functions are incompatible with "
2801  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2802def err_constexpr_virtual_base : Error<
2803  "constexpr %select{member function|constructor}0 not allowed in "
2804  "%select{struct|interface|class}1 with virtual base "
2805  "%plural{1:class|:classes}2">;
2806def note_non_literal_incomplete : Note<
2807  "incomplete type %0 is not a literal type">;
2808def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2809  "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2810def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2811def err_constexpr_non_literal_return : Error<
2812  "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2813def err_constexpr_non_literal_param : Error<
2814  "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2815  "not a literal type">;
2816def err_constexpr_body_invalid_stmt : Error<
2817  "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2818def ext_constexpr_body_invalid_stmt : ExtWarn<
2819  "use of this statement in a constexpr %select{function|constructor}0 "
2820  "is a C++14 extension">, InGroup<CXX14>;
2821def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2822  "use of this statement in a constexpr %select{function|constructor}0 "
2823  "is incompatible with C++ standards before C++14">,
2824  InGroup<CXXPre14Compat>, DefaultIgnore;
2825def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2826  "use of this statement in a constexpr %select{function|constructor}0 "
2827  "is a C++20 extension">, InGroup<CXX20>;
2828def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2829  "use of this statement in a constexpr %select{function|constructor}0 "
2830  "is incompatible with C++ standards before C++20">,
2831  InGroup<CXXPre20Compat>, DefaultIgnore;
2832def ext_constexpr_body_invalid_stmt_cxx23 : ExtWarn<
2833  "use of this statement in a constexpr %select{function|constructor}0 "
2834  "is a C++23 extension">, InGroup<CXX23>;
2835def warn_cxx20_compat_constexpr_body_invalid_stmt : Warning<
2836  "use of this statement in a constexpr %select{function|constructor}0 "
2837  "is incompatible with C++ standards before C++23">,
2838  InGroup<CXXPre23Compat>, DefaultIgnore;
2839def ext_constexpr_type_definition : ExtWarn<
2840  "type definition in a constexpr %select{function|constructor}0 "
2841  "is a C++14 extension">, InGroup<CXX14>;
2842def warn_cxx11_compat_constexpr_type_definition : Warning<
2843  "type definition in a constexpr %select{function|constructor}0 "
2844  "is incompatible with C++ standards before C++14">,
2845  InGroup<CXXPre14Compat>, DefaultIgnore;
2846def err_constexpr_vla : Error<
2847  "variably-modified type %0 cannot be used in a constexpr "
2848  "%select{function|constructor}1">;
2849def ext_constexpr_local_var : ExtWarn<
2850  "variable declaration in a constexpr %select{function|constructor}0 "
2851  "is a C++14 extension">, InGroup<CXX14>;
2852def warn_cxx11_compat_constexpr_local_var : Warning<
2853  "variable declaration in a constexpr %select{function|constructor}0 "
2854  "is incompatible with C++ standards before C++14">,
2855  InGroup<CXXPre14Compat>, DefaultIgnore;
2856def ext_constexpr_static_var : ExtWarn<
2857  "definition of a %select{static|thread_local}1 variable "
2858  "in a constexpr %select{function|constructor}0 "
2859  "is a C++23 extension">, InGroup<CXX23>;
2860def warn_cxx20_compat_constexpr_var : Warning<
2861  "definition of a %select{static variable|thread_local variable|variable "
2862  "of non-literal type}1 in a constexpr %select{function|constructor}0 "
2863  "is incompatible with C++ standards before C++23">,
2864  InGroup<CXXPre23Compat>, DefaultIgnore;
2865def err_constexpr_local_var_non_literal_type : Error<
2866  "variable of non-literal type %1 cannot be defined in a constexpr "
2867  "%select{function|constructor}0 before C++23">;
2868def ext_constexpr_local_var_no_init : ExtWarn<
2869  "uninitialized variable in a constexpr %select{function|constructor}0 "
2870  "is a C++20 extension">, InGroup<CXX20>;
2871def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2872  "uninitialized variable in a constexpr %select{function|constructor}0 "
2873  "is incompatible with C++ standards before C++20">,
2874  InGroup<CXXPre20Compat>, DefaultIgnore;
2875def ext_constexpr_function_never_constant_expr : ExtWarn<
2876  "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2877  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2878def err_attr_cond_never_constant_expr : Error<
2879  "%0 attribute expression never produces a constant expression">;
2880def err_diagnose_if_invalid_diagnostic_type : Error<
2881  "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2882  "instead">;
2883def err_constexpr_body_no_return : Error<
2884  "no return statement in %select{constexpr|consteval}0 function">;
2885def err_constexpr_return_missing_expr : Error<
2886  "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2887def warn_cxx11_compat_constexpr_body_no_return : Warning<
2888  "constexpr function with no return statements is incompatible with C++ "
2889  "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2890def ext_constexpr_body_multiple_return : ExtWarn<
2891  "multiple return statements in constexpr function is a C++14 extension">,
2892  InGroup<CXX14>;
2893def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2894  "multiple return statements in constexpr function "
2895  "is incompatible with C++ standards before C++14">,
2896  InGroup<CXXPre14Compat>, DefaultIgnore;
2897def note_constexpr_body_previous_return : Note<
2898  "previous return statement is here">;
2899def err_ms_constexpr_cannot_be_applied : Error<
2900  "attribute 'msvc::constexpr' cannot be applied to the %select{constexpr|consteval|virtual}0 function %1">;
2901
2902// C++20 function try blocks in constexpr
2903def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2904  "function try block in constexpr %select{function|constructor}0 is "
2905  "a C++20 extension">, InGroup<CXX20>;
2906def warn_cxx17_compat_constexpr_function_try_block : Warning<
2907  "function try block in constexpr %select{function|constructor}0 is "
2908  "incompatible with C++ standards before C++20">,
2909  InGroup<CXXPre20Compat>, DefaultIgnore;
2910
2911def ext_constexpr_union_ctor_no_init : ExtWarn<
2912  "constexpr union constructor that does not initialize any member "
2913  "is a C++20 extension">, InGroup<CXX20>;
2914def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2915  "constexpr union constructor that does not initialize any member "
2916  "is incompatible with C++ standards before C++20">,
2917  InGroup<CXXPre20Compat>, DefaultIgnore;
2918def ext_constexpr_ctor_missing_init : ExtWarn<
2919  "constexpr constructor that does not initialize all members "
2920  "is a C++20 extension">, InGroup<CXX20>;
2921def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2922  "constexpr constructor that does not initialize all members "
2923  "is incompatible with C++ standards before C++20">,
2924  InGroup<CXXPre20Compat>, DefaultIgnore;
2925def note_constexpr_ctor_missing_init : Note<
2926  "member not initialized by constructor">;
2927def note_non_literal_no_constexpr_ctors : Note<
2928  "%0 is not literal because it is not an aggregate and has no constexpr "
2929  "constructors other than copy or move constructors">;
2930def note_non_literal_base_class : Note<
2931  "%0 is not literal because it has base class %1 of non-literal type">;
2932def note_non_literal_field : Note<
2933  "%0 is not literal because it has data member %1 of "
2934  "%select{non-literal|volatile}3 type %2">;
2935def note_non_literal_user_provided_dtor : Note<
2936  "%0 is not literal because it has a user-provided destructor">;
2937def note_non_literal_nontrivial_dtor : Note<
2938  "%0 is not literal because it has a non-trivial destructor">;
2939def note_non_literal_non_constexpr_dtor : Note<
2940  "%0 is not literal because its destructor is not constexpr">;
2941def note_non_literal_lambda : Note<
2942  "lambda closure types are non-literal types before C++17">;
2943def warn_private_extern : Warning<
2944  "use of __private_extern__ on a declaration may not produce external symbol "
2945  "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2946def note_private_extern : Note<
2947  "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2948
2949// C++ Concepts
2950def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2951  "concept declarations may only appear in global or namespace scope">;
2952def err_concept_no_parameters : Error<
2953  "concept template parameter list must have at least one parameter; explicit "
2954  "specialization of concepts is not allowed">;
2955def err_concept_extra_headers : Error<
2956  "extraneous template parameter list in concept definition">;
2957def err_concept_no_associated_constraints : Error<
2958  "concept cannot have associated constraints">;
2959def err_non_constant_constraint_expression : Error<
2960  "substitution into constraint expression resulted in a non-constant "
2961  "expression">;
2962def err_non_bool_atomic_constraint : Error<
2963  "atomic constraint must be of type 'bool' (found %0)">;
2964def err_template_arg_list_constraints_not_satisfied : Error<
2965  "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2966  "template template parameter|template}0 %1%2">;
2967def note_substituted_constraint_expr_is_ill_formed : Note<
2968  "because substituted constraint expression is ill-formed%0">;
2969def note_constraint_references_error
2970    : Note<"constraint depends on a previously diagnosed expression">;
2971def note_atomic_constraint_evaluated_to_false : Note<
2972  "%select{and|because}0 '%1' evaluated to false">;
2973def note_concept_specialization_constraint_evaluated_to_false : Note<
2974  "%select{and|because}0 '%1' evaluated to false">;
2975def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2976  "%select{and|because}0 %1 does not satisfy %2">;
2977def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2978  "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2979def err_constrained_virtual_method : Error<
2980  "virtual function cannot have a requires clause">;
2981def err_trailing_requires_clause_on_deduction_guide : Error<
2982  "deduction guide cannot have a requires clause">;
2983def err_constrained_non_templated_function
2984    : Error<"non-templated function cannot have a requires clause">;
2985def err_reference_to_function_with_unsatisfied_constraints : Error<
2986  "invalid reference to function %0: constraints not satisfied">;
2987def err_requires_expr_local_parameter_default_argument : Error<
2988  "default arguments not allowed for parameters of a requires expression">;
2989def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2990  "constraint variable %0 cannot be used in an evaluated context">;
2991def note_expr_requirement_expr_substitution_error : Note<
2992  "%select{and|because}0 '%1' would be invalid: %2">;
2993def note_expr_requirement_expr_unknown_substitution_error : Note<
2994  "%select{and|because}0 '%1' would be invalid">;
2995def note_expr_requirement_noexcept_not_met : Note<
2996  "%select{and|because}0 '%1' may throw an exception">;
2997def note_expr_requirement_type_requirement_substitution_error : Note<
2998  "%select{and|because}0 '%1' would be invalid: %2">;
2999def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
3000  "%select{and|because}0 '%1' would be invalid">;
3001def note_expr_requirement_constraints_not_satisfied : Note<
3002  "%select{and|because}0 type constraint '%1' was not satisfied:">;
3003def note_expr_requirement_constraints_not_satisfied_simple : Note<
3004  "%select{and|because}0 %1 does not satisfy %2:">;
3005def note_type_requirement_substitution_error : Note<
3006  "%select{and|because}0 '%1' would be invalid: %2">;
3007def note_type_requirement_unknown_substitution_error : Note<
3008  "%select{and|because}0 '%1' would be invalid">;
3009def note_nested_requirement_substitution_error : Note<
3010  "%select{and|because}0 '%1' would be invalid%2">;
3011def note_nested_requirement_unknown_substitution_error : Note<
3012  "%select{and|because}0 '%1' would be invalid">;
3013def note_ambiguous_atomic_constraints : Note<
3014  "similar constraint expressions not considered equivalent; constraint "
3015  "expressions cannot be considered equivalent unless they originate from the "
3016  "same concept">;
3017def note_ambiguous_atomic_constraints_similar_expression : Note<
3018  "similar constraint expression here">;
3019def err_unsupported_placeholder_constraint : Error<
3020  "constrained placeholder types other than simple 'auto' on non-type template "
3021  "parameters not supported yet">;
3022
3023def err_template_different_requires_clause : Error<
3024  "requires clause differs in template redeclaration">;
3025def err_template_different_type_constraint : Error<
3026  "type constraint differs in template redeclaration">;
3027def err_template_template_parameter_not_at_least_as_constrained : Error<
3028  "template template argument %0 is more constrained than template template "
3029  "parameter %1">;
3030
3031def err_type_constraint_non_type_concept : Error<
3032  "concept named in type constraint is not a type concept">;
3033def err_type_constraint_missing_arguments : Error<
3034  "%0 requires more than 1 template argument; provide the remaining arguments "
3035  "explicitly to use it here">;
3036def err_placeholder_constraints_not_satisfied : Error<
3037  "deduced type %0 does not satisfy %1">;
3038
3039// C++11 char16_t/char32_t
3040def warn_cxx98_compat_unicode_type : Warning<
3041  "'%0' type specifier is incompatible with C++98">,
3042  InGroup<CXX98Compat>, DefaultIgnore;
3043def warn_cxx17_compat_unicode_type : Warning<
3044  "'char8_t' type specifier is incompatible with C++ standards before C++20">,
3045  InGroup<CXXPre20Compat>, DefaultIgnore;
3046
3047// __make_integer_seq
3048def err_integer_sequence_negative_length : Error<
3049  "integer sequences must have non-negative sequence length">;
3050def err_integer_sequence_integral_element_type : Error<
3051  "integer sequences must have integral element type">;
3052
3053// __type_pack_element
3054def err_type_pack_element_out_of_bounds : Error<
3055  "a parameter pack may not be accessed at an out of bounds index">;
3056
3057// Objective-C++
3058def err_objc_decls_may_only_appear_in_global_scope : Error<
3059  "Objective-C declarations may only appear in global scope">;
3060def warn_auto_var_is_id : Warning<
3061  "'auto' deduced as 'id' in declaration of %0">,
3062  InGroup<DiagGroup<"auto-var-id">>;
3063
3064// Attributes
3065def warn_attribute_ignored_no_calls_in_stmt: Warning<
3066  "%0 attribute is ignored because there exists no call expression inside the "
3067  "statement">,
3068  InGroup<IgnoredAttributes>;
3069
3070def warn_attribute_ignored_non_function_pointer: Warning<
3071  "%0 attribute is ignored because %1 is not a function pointer">,
3072  InGroup<IgnoredAttributes>;
3073
3074def warn_function_attribute_ignored_in_stmt : Warning<
3075  "attribute is ignored on this statement as it only applies to functions; "
3076  "use '%0' on statements">,
3077  InGroup<IgnoredAttributes>;
3078
3079def err_musttail_needs_trivial_args : Error<
3080  "tail call requires that the return value, all parameters, and any "
3081  "temporaries created by the expression are trivially destructible">;
3082def err_musttail_needs_call : Error<
3083  "%0 attribute requires that the return value is the result of a function call"
3084  >;
3085def err_musttail_needs_prototype : Error<
3086  "%0 attribute requires that both caller and callee functions have a "
3087  "prototype">;
3088def note_musttail_fix_non_prototype : Note<
3089  "add 'void' to the parameter list to turn an old-style K&R function "
3090  "declaration into a prototype">;
3091def err_musttail_structors_forbidden : Error<"cannot perform a tail call "
3092  "%select{from|to}0 a %select{constructor|destructor}1">;
3093def note_musttail_structors_forbidden : Note<"target "
3094  "%select{constructor|destructor}0 is declared here">;
3095def err_musttail_forbidden_from_this_context : Error<
3096  "%0 attribute cannot be used from "
3097  "%select{a block|an Objective-C function|this context}1">;
3098def err_musttail_member_mismatch : Error<
3099  "%select{non-member|static member|non-static member}0 "
3100  "function cannot perform a tail call to "
3101  "%select{non-member|static member|non-static member|pointer-to-member}1 "
3102  "function%select{| %3}2">;
3103def note_musttail_callee_defined_here : Note<"%0 declared here">;
3104def note_tail_call_required : Note<"tail call required by %0 attribute here">;
3105def err_musttail_mismatch : Error<
3106  "cannot perform a tail call to function%select{| %1}0 because its signature "
3107  "is incompatible with the calling function">;
3108def note_musttail_mismatch : Note<
3109    "target function "
3110    "%select{is a member of different class%diff{ (expected $ but has $)|}1,2"
3111    "|has different number of parameters (expected %1 but has %2)"
3112    "|has type mismatch at %ordinal3 parameter"
3113    "%diff{ (expected $ but has $)|}1,2"
3114    "|has different return type%diff{ ($ expected but has $)|}1,2}0">;
3115def err_musttail_callconv_mismatch : Error<
3116  "cannot perform a tail call to function%select{| %1}0 because it uses an "
3117  "incompatible calling convention">;
3118def note_musttail_callconv_mismatch : Note<
3119  "target function has calling convention %1 (expected %0)">;
3120def err_musttail_scope : Error<
3121  "cannot perform a tail call from this return statement">;
3122def err_musttail_no_variadic : Error<
3123  "%0 attribute may not be used with variadic functions">;
3124def err_musttail_no_return : Error<
3125  "%0 attribute may not be used with no-return-attribute functions">;
3126
3127def err_nsobject_attribute : Error<
3128  "'NSObject' attribute is for pointer types only">;
3129def err_attributes_are_not_compatible : Error<
3130  "%0 and %1%select{ attributes|}2 are not compatible">;
3131def err_attribute_invalid_argument : Error<
3132  "%select{a reference type|an array type|a non-vector or "
3133  "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
3134def err_attribute_wrong_number_arguments : Error<
3135  "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
3136  ":requires exactly %1 arguments}1">;
3137def err_attribute_wrong_number_arguments_for : Error <
3138  "%0 attribute references function %1, which %plural{0:takes no arguments|1:takes one argument|"
3139  ":takes exactly %2 arguments}2">;
3140def err_attribute_bounds_for_function : Error<
3141  "%0 attribute references parameter %1, but the function %2 has only %3 parameters">;
3142def err_attribute_no_member_function : Error<
3143  "%0 attribute cannot be applied to non-static member functions">;
3144def err_attribute_parameter_types : Error<
3145  "%0 attribute parameter types do not match: parameter %1 of function %2 has type %3, "
3146  "but parameter %4 of function %5 has type %6">;
3147
3148def err_attribute_too_many_arguments : Error<
3149  "%0 attribute takes no more than %1 argument%s1">;
3150def err_attribute_too_few_arguments : Error<
3151  "%0 attribute takes at least %1 argument%s1">;
3152def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
3153def err_attribute_invalid_bitint_vector_type : Error<
3154  "'_BitInt' vector element width must be %select{a power of 2|"
3155  "at least as wide as 'CHAR_BIT'}0">;
3156def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
3157def err_attribute_bad_neon_vector_size : Error<
3158  "Neon vector size must be 64 or 128 bits">;
3159def err_attribute_invalid_sve_type : Error<
3160  "%0 attribute applied to non-SVE type %1">;
3161def err_attribute_bad_sve_vector_size : Error<
3162  "invalid SVE vector size '%0', must match value set by "
3163  "'-msve-vector-bits' ('%1')">;
3164def err_attribute_arm_feature_sve_bits_unsupported : Error<
3165  "%0 is only supported when '-msve-vector-bits=<bits>' is specified with a "
3166  "value of 128, 256, 512, 1024 or 2048.">;
3167def warn_attribute_arm_sm_incompat_builtin : Warning<
3168  "builtin call has undefined behaviour when called from a %0 function">,
3169  InGroup<DiagGroup<"undefined-arm-streaming">>;
3170def warn_attribute_arm_za_builtin_no_za_state : Warning<
3171  "builtin call is not valid when calling from a function without active ZA state">,
3172  InGroup<DiagGroup<"undefined-arm-za">>;
3173def warn_attribute_arm_zt0_builtin_no_zt0_state : Warning<
3174  "builtin call is not valid when calling from a function without active ZT0 state">,
3175  InGroup<DiagGroup<"undefined-arm-zt0">>;
3176def err_sve_vector_in_non_sve_target : Error<
3177  "SVE vector type %0 cannot be used in a target without sve">;
3178def err_attribute_riscv_rvv_bits_unsupported : Error<
3179  "%0 is only supported when '-mrvv-vector-bits=<bits>' is specified with a "
3180  "value of \"zvl\" or a power 2 in the range [64,65536]">;
3181def err_attribute_bad_rvv_vector_size : Error<
3182  "invalid RVV vector size '%0', expected size is '%1' based on LMUL of type "
3183  "and '-mrvv-vector-bits'">;
3184def err_attribute_invalid_rvv_type : Error<
3185  "%0 attribute applied to non-RVV type %1">;
3186def err_attribute_requires_positive_integer : Error<
3187  "%0 attribute requires a %select{positive|non-negative}1 "
3188  "integral compile time constant expression">;
3189def err_attribute_requires_opencl_version : Error<
3190  "attribute %0 is supported in the OpenCL version %1%select{| onwards}2">;
3191def err_invalid_branch_protection_spec : Error<
3192  "invalid or misplaced branch protection specification '%0'">;
3193def warn_unsupported_branch_protection_spec : Warning<
3194  "unsupported branch protection specification '%0'">, InGroup<BranchProtection>;
3195
3196def warn_unsupported_target_attribute
3197    : Warning<"%select{unsupported|duplicate|unknown}0%select{| CPU|"
3198              " tune CPU}1 '%2' in the '%select{target|target_clones|target_version}3' "
3199              "attribute string; '%select{target|target_clones|target_version}3' "
3200              "attribute ignored">,
3201      InGroup<IgnoredAttributes>;
3202def err_attribute_unsupported
3203    : Error<"%0 attribute is not supported on targets missing %1;"
3204            " specify an appropriate -march= or -mcpu=">;
3205def err_duplicate_target_attribute
3206    : Error<"%select{unsupported|duplicate|unknown}0%select{| CPU|"
3207              " tune CPU}1 '%2' in the '%select{target|target_clones|target_version}3' "
3208              "attribute string; ">;
3209// The err_*_attribute_argument_not_int are separate because they're used by
3210// VerifyIntegerConstantExpression.
3211def err_aligned_attribute_argument_not_int : Error<
3212  "'aligned' attribute requires integer constant">;
3213def err_align_value_attribute_argument_not_int : Error<
3214  "'align_value' attribute requires integer constant">;
3215def err_alignas_attribute_wrong_decl_type : Error<
3216  "%0 attribute cannot be applied to %select{a function parameter|"
3217  "a variable with 'register' storage class|a 'catch' variable|a bit-field|"
3218  "an enumeration}1">;
3219def err_alignas_missing_on_definition : Error<
3220  "%0 must be specified on definition if it is specified on any declaration">;
3221def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
3222def err_alignas_mismatch : Error<
3223  "redeclaration has different alignment requirement (%1 vs %0)">;
3224def err_alignas_underaligned : Error<
3225  "requested alignment is less than minimum alignment of %1 for type %0">;
3226def warn_aligned_attr_underaligned : Warning<err_alignas_underaligned.Summary>,
3227  InGroup<IgnoredAttributes>;
3228def err_attribute_sizeless_type : Error<
3229  "%0 attribute cannot be applied to sizeless type %1">;
3230def err_attribute_argument_n_type : Error<
3231  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
3232  "constant|a string|an identifier|a constant expression|a builtin function}2">;
3233def err_attribute_argument_type : Error<
3234  "%0 attribute requires %select{int or bool|an integer "
3235  "constant|a string|an identifier}1">;
3236def err_attribute_argument_out_of_range : Error<
3237  "%0 attribute requires integer constant between %1 and %2 inclusive">;
3238def err_init_priority_object_attr : Error<
3239  "can only use 'init_priority' attribute on file-scope definitions "
3240  "of objects of class type">;
3241def err_attribute_argument_out_of_bounds : Error<
3242  "%0 attribute parameter %1 is out of bounds">;
3243def err_attribute_only_once_per_parameter : Error<
3244  "%0 attribute can only be applied once per parameter">;
3245def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
3246def note_previous_uuid : Note<"previous uuid specified here">;
3247def warn_attribute_pointers_only : Warning<
3248  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
3249  InGroup<IgnoredAttributes>;
3250def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Summary>;
3251def err_attribute_integers_only : Error<
3252  "%0 attribute argument may only refer to a function parameter of integer "
3253  "type">;
3254def warn_attribute_return_pointers_only : Warning<
3255  "%0 attribute only applies to return values that are pointers">,
3256  InGroup<IgnoredAttributes>;
3257def warn_attribute_return_pointers_refs_only : Warning<
3258  "%0 attribute only applies to return values that are pointers or references">,
3259  InGroup<IgnoredAttributes>;
3260def warn_attribute_pointer_or_reference_only : Warning<
3261  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
3262  InGroup<IgnoredAttributes>;
3263def err_attribute_no_member_pointers : Error<
3264  "%0 attribute cannot be used with pointers to members">;
3265def err_attribute_invalid_implicit_this_argument : Error<
3266  "%0 attribute is invalid for the implicit this argument">;
3267def err_ownership_type : Error<
3268  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
3269def err_ownership_returns_index_mismatch : Error<
3270  "'ownership_returns' attribute index does not match; here it is %0">;
3271def note_ownership_returns_index_mismatch : Note<
3272  "declared with index %0 here">;
3273def err_format_strftime_third_parameter : Error<
3274  "strftime format attribute requires 3rd parameter to be 0">;
3275def err_format_attribute_not : Error<"format argument not a string type">;
3276def err_format_attribute_result_not : Error<"function does not return %0">;
3277def err_format_attribute_implicit_this_format_string : Error<
3278  "format attribute cannot specify the implicit this argument as the format "
3279  "string">;
3280def err_callback_attribute_no_callee : Error<
3281  "'callback' attribute specifies no callback callee">;
3282def err_callback_attribute_invalid_callee : Error<
3283  "'callback' attribute specifies invalid callback callee">;
3284def err_callback_attribute_multiple : Error<
3285  "multiple 'callback' attributes specified">;
3286def err_callback_attribute_argument_unknown : Error<
3287  "'callback' attribute argument %0 is not a known function parameter">;
3288def err_callback_callee_no_function_type : Error<
3289  "'callback' attribute callee does not have function type">;
3290def err_callback_callee_is_variadic : Error<
3291  "'callback' attribute callee may not be variadic">;
3292def err_callback_implicit_this_not_available : Error<
3293  "'callback' argument at position %0 references unavailable implicit 'this'">;
3294def err_init_method_bad_return_type : Error<
3295  "init methods must return an object pointer type, not %0">;
3296def err_attribute_invalid_size : Error<
3297  "vector size not an integral multiple of component size">;
3298def err_attribute_zero_size : Error<"zero %0 size">;
3299def err_attribute_size_too_large : Error<"%0 size too large">;
3300def err_typecheck_sve_rvv_ambiguous : Error<
3301  "cannot combine fixed-length and sizeless %select{SVE|RVV}0 vectors "
3302  "in expression, result is ambiguous (%1 and %2)">;
3303def err_typecheck_sve_rvv_gnu_ambiguous : Error<
3304  "cannot combine GNU and %select{SVE|RVV}0 vectors in expression, result is ambiguous (%1 and %2)">;
3305def err_typecheck_vector_not_convertable_implict_truncation : Error<
3306   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
3307   " %2 as implicit conversion would cause truncation">;
3308def err_typecheck_vector_not_convertable : Error<
3309  "cannot convert between vector values of different size (%0 and %1)">;
3310def err_typecheck_vector_not_convertable_non_scalar : Error<
3311  "cannot convert between vector and non-scalar values (%0 and %1)">;
3312def err_typecheck_vector_lengths_not_equal : Error<
3313  "vector operands do not have the same number of elements (%0 and %1)">;
3314def warn_typecheck_vector_element_sizes_not_equal : Warning<
3315  "vector operands do not have the same elements sizes (%0 and %1)">,
3316  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
3317def err_ext_vector_component_exceeds_length : Error<
3318  "vector component access exceeds type %0">;
3319def err_ext_vector_component_name_illegal : Error<
3320  "illegal vector component name '%0'">;
3321def err_attribute_address_space_negative : Error<
3322  "address space is negative">;
3323def err_attribute_address_space_too_high : Error<
3324  "address space is larger than the maximum supported (%0)">;
3325def err_attribute_address_multiple_qualifiers : Error<
3326  "multiple address spaces specified for type">;
3327def warn_attribute_address_multiple_identical_qualifiers : Warning<
3328  "multiple identical address spaces specified for type">,
3329  InGroup<DuplicateDeclSpecifier>;
3330def err_attribute_not_clinkage : Error<
3331  "function type with %0 attribute must have C linkage">;
3332def err_function_decl_cmse_ns_call : Error<
3333  "functions may not be declared with 'cmse_nonsecure_call' attribute">;
3334def err_attribute_address_function_type : Error<
3335  "function type may not be qualified with an address space">;
3336def err_as_qualified_auto_decl : Error<
3337  "automatic variable qualified with an%select{| invalid}0 address space">;
3338def err_arg_with_address_space : Error<
3339  "parameter may not be qualified with an address space">;
3340def err_field_with_address_space : Error<
3341  "field may not be qualified with an address space">;
3342def err_compound_literal_with_address_space : Error<
3343  "compound literal in function scope may not be qualified with an address space">;
3344def err_address_space_mismatch_templ_inst : Error<
3345  "conflicting address space qualifiers are provided between types %0 and %1">;
3346def err_attr_objc_ownership_redundant : Error<
3347  "the type %0 is already explicitly ownership-qualified">;
3348def err_invalid_nsnumber_type : Error<
3349  "%0 is not a valid literal type for NSNumber">;
3350def err_objc_illegal_boxed_expression_type : Error<
3351  "illegal type %0 used in a boxed expression">;
3352def err_objc_non_trivially_copyable_boxed_expression_type : Error<
3353  "non-trivially copyable type %0 cannot be used in a boxed expression">;
3354def err_objc_incomplete_boxed_expression_type : Error<
3355  "incomplete type %0 used in a boxed expression">;
3356def err_undeclared_objc_literal_class : Error<
3357  "definition of class %0 must be available to use Objective-C "
3358  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
3359  "string literals}1">;
3360def err_undeclared_boxing_method : Error<
3361  "declaration of %0 is missing in %1 class">;
3362def err_objc_literal_method_sig : Error<
3363  "literal construction method %0 has incompatible signature">;
3364def note_objc_literal_method_param : Note<
3365  "%select{first|second|third}0 parameter has unexpected type %1 "
3366  "(should be %2)">;
3367def note_objc_literal_method_return : Note<
3368  "method returns unexpected type %0 (should be an object type)">;
3369def err_invalid_collection_element : Error<
3370  "collection element of type %0 is not an Objective-C object">;
3371def err_box_literal_collection : Error<
3372  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3373  "in a collection">;
3374def warn_objc_literal_comparison : Warning<
3375  "direct comparison of %select{an array literal|a dictionary literal|"
3376  "a numeric literal|a boxed expression|}0 has undefined behavior">,
3377  InGroup<ObjCLiteralComparison>;
3378def err_missing_atsign_prefix : Error<
3379  "%select{string|numeric}0 literal must be prefixed by '@'">;
3380def warn_objc_string_literal_comparison : Warning<
3381  "direct comparison of a string literal has undefined behavior">,
3382  InGroup<ObjCStringComparison>;
3383def warn_concatenated_literal_array_init : Warning<
3384  "suspicious concatenation of string literals in an array initialization; "
3385  "did you mean to separate the elements with a comma?">,
3386  InGroup<StringConcatation>, DefaultIgnore;
3387def warn_concatenated_nsarray_literal : Warning<
3388  "concatenated NSString literal for an NSArray expression - "
3389  "possibly missing a comma">,
3390  InGroup<ObjCStringConcatenation>;
3391def note_objc_literal_comparison_isequal : Note<
3392  "use 'isEqual:' instead">;
3393def warn_objc_collection_literal_element : Warning<
3394  "object of type %0 is not compatible with "
3395  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3396  InGroup<ObjCLiteralConversion>;
3397def warn_nsdictionary_duplicate_key : Warning<
3398  "duplicate key in dictionary literal">,
3399  InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3400def note_nsdictionary_duplicate_key_here : Note<
3401  "previous equal key is here">;
3402def err_swift_param_attr_not_swiftcall : Error<
3403  "'%0' parameter can only be used with swiftcall%select{ or swiftasynccall|}1 "
3404  "calling convention%select{|s}1">;
3405def err_swift_indirect_result_not_first : Error<
3406  "'swift_indirect_result' parameters must be first parameters of function">;
3407def err_swift_error_result_not_after_swift_context : Error<
3408  "'swift_error_result' parameter must follow 'swift_context' parameter">;
3409def err_swift_abi_parameter_wrong_type : Error<
3410  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3411  "type here is %2">;
3412
3413def err_attribute_argument_invalid : Error<
3414  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3415  "min must not be greater than max}1">;
3416def err_attribute_argument_is_zero : Error<
3417  "%0 attribute must be greater than 0">;
3418def warn_attribute_argument_n_negative : Warning<
3419  "%0 attribute parameter %1 is negative and will be ignored">,
3420  InGroup<CudaCompat>;
3421def err_property_function_in_objc_container : Error<
3422  "use of Objective-C property in function nested in Objective-C "
3423  "container not supported, move function outside its container">;
3424
3425let CategoryName = "Cocoa API Issue" in {
3426def warn_objc_redundant_literal_use : Warning<
3427  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3428}
3429
3430def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3431  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3432
3433def err_attr_codemodel_arg : Error<"code model '%0' is not supported on this target">;
3434
3435def err_aix_attr_unsupported_tls_model : Error<"TLS model '%0' is not yet supported on AIX">;
3436
3437def err_tls_var_aligned_over_maximum : Error<
3438  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3439  "alignment (%2) for a thread-local variable on this target">;
3440
3441def err_only_annotate_after_access_spec : Error<
3442  "access specifier can only have annotation attributes">;
3443
3444def err_attribute_section_invalid_for_target : Error<
3445  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3446def err_pragma_section_invalid_for_target : Error<
3447  "argument to #pragma section is not valid for this target: %0">;
3448def warn_attribute_section_drectve : Warning<
3449  "#pragma %0(\".drectve\") has undefined behavior, "
3450  "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3451def warn_mismatched_section : Warning<
3452  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3453def warn_attribute_section_on_redeclaration : Warning<
3454  "section attribute is specified on redeclared variable">, InGroup<Section>;
3455def err_mismatched_code_seg_base : Error<
3456  "derived class must specify the same code segment as its base classes">;
3457def err_mismatched_code_seg_override : Error<
3458  "overriding virtual function must specify the same code segment as its overridden function">;
3459def err_conflicting_codeseg_attribute : Error<
3460  "conflicting code segment specifiers">;
3461def warn_duplicate_codeseg_attribute : Warning<
3462  "duplicate code segment specifiers">, InGroup<Section>;
3463
3464def err_anonymous_property: Error<
3465  "anonymous property is not supported">;
3466def err_property_is_variably_modified : Error<
3467  "property %0 has a variably modified type">;
3468def err_no_accessor_for_property : Error<
3469  "no %select{getter|setter}0 defined for property %1">;
3470def err_cannot_find_suitable_accessor : Error<
3471  "cannot find suitable %select{getter|setter}0 for property %1">;
3472
3473def warn_alloca : Warning<
3474  "use of function %0 is discouraged; there is no way to check for failure but "
3475  "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3476  InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3477
3478def warn_alloca_align_alignof : Warning<
3479  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3480  InGroup<DiagGroup<"alloca-with-align-alignof">>;
3481
3482def err_alignment_too_small : Error<
3483  "requested alignment must be %0 or greater">;
3484def err_alignment_too_big : Error<
3485  "requested alignment must be %0 or smaller">;
3486def err_alignment_not_power_of_two : Error<
3487  "requested alignment is not a power of 2">;
3488def warn_alignment_not_power_of_two : Warning<
3489  err_alignment_not_power_of_two.Summary>,
3490  InGroup<DiagGroup<"non-power-of-two-alignment">>;
3491def err_alignment_dependent_typedef_name : Error<
3492  "requested alignment is dependent but declaration is not dependent">;
3493
3494def warn_alignment_builtin_useless : Warning<
3495  "%select{aligning a value|the result of checking whether a value is aligned}0"
3496  " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3497def err_attribute_aligned_too_great : Error<
3498  "requested alignment must be %0 bytes or smaller">;
3499def warn_assume_aligned_too_great
3500    : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3501              "alignment assumed">,
3502      InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3503def warn_not_xl_compatible
3504    : Warning<"alignment of 16 bytes for a struct member is not binary "
3505              "compatible with IBM XL C/C++ for AIX 16.1.0 or older">,
3506      InGroup<AIXCompat>;
3507def note_misaligned_member_used_here : Note<
3508    "passing byval argument %0 with potentially incompatible alignment here">;
3509def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3510  "%q0 redeclared without %1 attribute: previous %1 ignored">,
3511  InGroup<MicrosoftInconsistentDllImport>;
3512def warn_redeclaration_without_import_attribute : Warning<
3513  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3514  InGroup<MicrosoftInconsistentDllImport>;
3515def warn_dllimport_dropped_from_inline_function : Warning<
3516  "%q0 redeclared inline; %1 attribute ignored">,
3517  InGroup<IgnoredAttributes>;
3518def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3519  " exception specification; attribute ignored">,
3520  InGroup<IgnoredAttributes>;
3521def warn_attribute_ignored_on_non_definition :
3522  Warning<"%0 attribute ignored on a non-definition declaration">,
3523  InGroup<IgnoredAttributes>;
3524def warn_attribute_ignored_on_inline :
3525  Warning<"%0 attribute ignored on inline function">,
3526  InGroup<IgnoredAttributes>;
3527def warn_nocf_check_attribute_ignored :
3528  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3529  InGroup<IgnoredAttributes>;
3530def warn_attribute_after_definition_ignored : Warning<
3531  "attribute %0 after definition is ignored">,
3532   InGroup<IgnoredAttributes>;
3533def warn_attributes_likelihood_ifstmt_conflict
3534    : Warning<"conflicting attributes %0 are ignored">,
3535      InGroup<IgnoredAttributes>;
3536def warn_cxx11_gnu_attribute_on_type : Warning<
3537  "attribute %0 ignored, because it cannot be applied to a type">,
3538  InGroup<IgnoredAttributes>;
3539def warn_unhandled_ms_attribute_ignored : Warning<
3540  "__declspec attribute %0 is not supported">,
3541  InGroup<IgnoredAttributes>;
3542def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3543  "attribute %0 has no effect when annotating an infinite loop">,
3544   InGroup<IgnoredAttributes>;
3545def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3546  "annotating the infinite loop here">;
3547def warn_attribute_has_no_effect_on_compile_time_if : Warning<
3548  "attribute %0 has no effect when annotating an 'if %select{constexpr|consteval}1' statement">,
3549   InGroup<IgnoredAttributes>;
3550def note_attribute_has_no_effect_on_compile_time_if_here : Note<
3551  "annotating the 'if %select{constexpr|consteval}0' statement here">;
3552def err_decl_attribute_invalid_on_stmt : Error<
3553  "%0%select{ attribute|}1 cannot be applied to a statement">;
3554def err_attribute_invalid_on_decl : Error<
3555  "%0%select{ attribute|}1 cannot be applied to a declaration">;
3556def warn_type_attribute_deprecated_on_decl : Warning<
3557  "applying attribute %0 to a declaration is deprecated; apply it to the type instead">,
3558  InGroup<DeprecatedAttributes>;
3559def warn_declspec_attribute_ignored : Warning<
3560  "attribute %0 is ignored, place it after "
3561  "\"%select{class|struct|interface|union|enum|enum class|enum struct}1\" to apply attribute to "
3562  "type declaration">, InGroup<IgnoredAttributes>;
3563def err_declspec_keyword_has_no_effect : Error<
3564  "%0 cannot appear here, place it after "
3565  "\"%select{class|struct|interface|union|enum}1\" to apply it to the "
3566  "type declaration">;
3567def warn_attribute_precede_definition : Warning<
3568  "attribute declaration must precede definition">,
3569  InGroup<IgnoredAttributes>;
3570def warn_attribute_void_function_method : Warning<
3571  "attribute %0 cannot be applied to "
3572  "%select{functions|Objective-C method}1 without return value">,
3573  InGroup<IgnoredAttributes>;
3574def warn_attribute_weak_on_field : Warning<
3575  "__weak attribute cannot be specified on a field declaration">,
3576  InGroup<IgnoredAttributes>;
3577def warn_gc_attribute_weak_on_local : Warning<
3578  "Objective-C GC does not allow weak variables on the stack">,
3579  InGroup<IgnoredAttributes>;
3580def warn_nsobject_attribute : Warning<
3581  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3582  InGroup<NSobjectAttribute>;
3583def warn_independentclass_attribute : Warning<
3584  "'objc_independent_class' attribute may be put on a typedef only; "
3585  "attribute is ignored">,
3586  InGroup<IndependentClassAttribute>;
3587def warn_ptr_independentclass_attribute : Warning<
3588  "'objc_independent_class' attribute may be put on Objective-C object "
3589  "pointer type only; attribute is ignored">,
3590  InGroup<IndependentClassAttribute>;
3591def warn_attribute_weak_on_local : Warning<
3592  "__weak attribute cannot be specified on an automatic variable when ARC "
3593  "is not enabled">,
3594  InGroup<IgnoredAttributes>;
3595def warn_weak_identifier_undeclared : Warning<
3596  "weak identifier %0 never declared">;
3597def warn_attribute_cmse_entry_static : Warning<
3598  "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3599  InGroup<IgnoredAttributes>;
3600def warn_cmse_nonsecure_union : Warning<
3601  "passing union across security boundary via %select{parameter %1|return value}0 "
3602  "may leak information">,
3603  InGroup<DiagGroup<"cmse-union-leak">>;
3604def err_attribute_weak_static : Error<
3605  "weak declaration cannot have internal linkage">;
3606def err_attribute_selectany_non_extern_data : Error<
3607  "'selectany' can only be applied to data items with external linkage">;
3608def err_declspec_thread_on_thread_variable : Error<
3609  "'__declspec(thread)' applied to variable that already has a "
3610  "thread-local storage specifier">;
3611def err_attribute_dll_not_extern : Error<
3612  "%q0 must have external linkage when declared %q1">;
3613def err_attribute_dll_thread_local : Error<
3614  "%q0 cannot be thread local when declared %q1">;
3615def err_attribute_dll_lambda : Error<
3616  "lambda cannot be declared %0">;
3617def warn_attribute_invalid_on_definition : Warning<
3618  "'%0' attribute cannot be specified on a definition">,
3619  InGroup<IgnoredAttributes>;
3620def err_attribute_dll_redeclaration : Error<
3621  "redeclaration of %q0 cannot add %q1 attribute">;
3622def warn_attribute_dll_redeclaration : Warning<
3623  "redeclaration of %q0 should not add %q1 attribute">,
3624  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3625def err_attribute_dllimport_function_definition : Error<
3626  "dllimport cannot be applied to non-inline function definition">;
3627def err_attribute_dllimport_function_specialization_definition : Error<
3628  "cannot define non-inline dllimport template specialization">;
3629def err_attribute_dll_deleted : Error<
3630  "attribute %q0 cannot be applied to a deleted function">;
3631def err_attribute_dllimport_data_definition : Error<
3632  "definition of dllimport data">;
3633def err_attribute_dllimport_static_field_definition : Error<
3634  "definition of dllimport static field not allowed">;
3635def warn_attribute_dllimport_static_field_definition : Warning<
3636  "definition of dllimport static field">,
3637  InGroup<DiagGroup<"dllimport-static-field-def">>;
3638def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3639  "explicit instantiation declaration should not be 'dllexport'">,
3640  InGroup<DllexportExplicitInstantiationDecl>;
3641def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3642  "'dllexport' attribute ignored on explicit instantiation definition">,
3643  InGroup<IgnoredAttributes>;
3644def warn_invalid_initializer_from_system_header : Warning<
3645  "invalid constructor from class in system header, should not be explicit">,
3646  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3647def note_used_in_initialization_here : Note<"used in initialization here">;
3648def err_attribute_dll_member_of_dll_class : Error<
3649  "attribute %q0 cannot be applied to member of %q1 class">;
3650def warn_attribute_dll_instantiated_base_class : Warning<
3651  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3652  "base class template without dll attribute is not supported">,
3653  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3654def err_attribute_dll_ambiguous_default_ctor : Error<
3655  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3656def err_attribute_weakref_not_static : Error<
3657  "weakref declaration must have internal linkage">;
3658def err_attribute_weakref_not_global_context : Error<
3659  "weakref declaration of %0 must be in a global context">;
3660def err_attribute_weakref_without_alias : Error<
3661  "weakref declaration of %0 must also have an alias attribute">;
3662def err_alias_not_supported_on_darwin : Error <
3663  "aliases are not supported on darwin">;
3664def warn_attribute_wrong_decl_type_str : Warning<
3665  "%0%select{ attribute|}1 only applies to %2">, InGroup<IgnoredAttributes>;
3666def err_attribute_wrong_decl_type_str : Error<
3667  warn_attribute_wrong_decl_type_str.Summary>;
3668def warn_attribute_wrong_decl_type : Warning<
3669  "%0%select{ attribute|}1 only applies to %select{"
3670  "functions"
3671  "|unions"
3672  "|variables and functions"
3673  "|functions and methods"
3674  "|functions, methods and blocks"
3675  "|functions, methods, and parameters"
3676  "|variables"
3677  "|variables and fields"
3678  "|variables, data members and tag types"
3679  "|types and namespaces"
3680  "|variables, functions and classes"
3681  "|kernel functions"
3682  "|non-K&R-style functions}2">,
3683  InGroup<IgnoredAttributes>;
3684def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Summary>;
3685def warn_type_attribute_wrong_type : Warning<
3686  "'%0' only applies to %select{function|pointer|"
3687  "Objective-C object or block pointer}1 types; type here is %2">,
3688  InGroup<IgnoredAttributes>;
3689def err_type_attribute_wrong_type : Error<
3690  warn_type_attribute_wrong_type.Summary>;
3691def warn_incomplete_encoded_type : Warning<
3692  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3693  InGroup<DiagGroup<"encode-type">>;
3694def warn_gnu_inline_attribute_requires_inline : Warning<
3695  "'gnu_inline' attribute requires function to be marked 'inline',"
3696  " attribute ignored">,
3697  InGroup<IgnoredAttributes>;
3698def warn_gnu_inline_cplusplus_without_extern : Warning<
3699  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3700  " available, this changed in Clang 10">,
3701  InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3702def err_attribute_vecreturn_only_vector_member : Error<
3703  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3704def err_attribute_vecreturn_only_pod_record : Error<
3705  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3706def err_sme_attr_mismatch : Error<
3707  "function declared %0 was previously declared %1, which has different SME function attributes">;
3708def err_sme_call_in_non_sme_target : Error<
3709  "call to a streaming function requires 'sme'">;
3710def err_sme_za_call_no_za_state : Error<
3711  "call to a shared ZA function requires the caller to have ZA state">;
3712def err_sme_zt0_call_no_zt0_state : Error<
3713  "call to a shared ZT0 function requires the caller to have ZT0 state">;
3714def err_sme_unimplemented_za_save_restore : Error<
3715  "call to a function that shares state other than 'za' from a "
3716  "function that has live 'za' state requires a spill/fill of ZA, which is not yet "
3717  "implemented">;
3718def note_sme_use_preserves_za : Note<
3719  "add '__arm_preserves(\"za\")' to the callee if it preserves ZA">;
3720def err_sme_definition_using_sm_in_non_sme_target : Error<
3721  "function executed in streaming-SVE mode requires 'sme'">;
3722def err_sme_definition_using_za_in_non_sme_target : Error<
3723  "function using ZA state requires 'sme'">;
3724def err_sme_definition_using_zt0_in_non_sme2_target : Error<
3725  "function using ZT0 state requires 'sme2'">;
3726def err_conflicting_attributes_arm_state : Error<
3727  "conflicting attributes for state '%0'">;
3728def err_unknown_arm_state : Error<
3729  "unknown state '%0'">;
3730def err_missing_arm_state : Error<
3731  "missing state for %0">;
3732def err_cconv_change : Error<
3733  "function declared '%0' here was previously declared "
3734  "%select{'%2'|without calling convention}1">;
3735def warn_cconv_unsupported : Warning<
3736  "%0 calling convention is not supported %select{"
3737  // Use CallingConventionIgnoredReason Enum to specify these.
3738  "for this target"
3739  "|on variadic function"
3740  "|on constructor/destructor"
3741  "|on builtin function"
3742  "}1">,
3743  InGroup<IgnoredAttributes>;
3744def error_cconv_unsupported : Error<warn_cconv_unsupported.Summary>;
3745def err_cconv_knr : Error<
3746  "function with no prototype cannot use the %0 calling convention">;
3747def warn_cconv_knr : Warning<
3748  err_cconv_knr.Summary>,
3749  InGroup<DiagGroup<"missing-prototype-for-cc">>;
3750def err_cconv_varargs : Error<
3751  "variadic function cannot use %0 calling convention">;
3752def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3753  "attribute was previously declared "
3754  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3755def err_function_attribute_mismatch : Error<
3756  "function declared with %0 attribute "
3757  "was previously declared without the %0 attribute">;
3758def err_objc_precise_lifetime_bad_type : Error<
3759  "objc_precise_lifetime only applies to retainable types; type here is %0">;
3760def warn_objc_precise_lifetime_meaningless : Error<
3761  "objc_precise_lifetime is not meaningful for "
3762  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3763def err_invalid_pcs : Error<"invalid PCS type">;
3764def warn_attribute_not_on_decl : Warning<
3765  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3766def err_base_specifier_attribute : Error<
3767  "%0%select{ attribute|}1 cannot be applied to a base specifier">;
3768def warn_declspec_allocator_nonpointer : Warning<
3769  "ignoring __declspec(allocator) because the function return type %0 is not "
3770  "a pointer or reference type">, InGroup<IgnoredAttributes>;
3771def err_cconv_incomplete_param_type : Error<
3772  "parameter %0 must have a complete type to use function %1 with the %2 "
3773  "calling convention">;
3774def err_attribute_output_parameter : Error<
3775  "attribute only applies to output parameters">;
3776
3777def ext_cannot_use_trivial_abi : ExtWarn<
3778  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3779def note_cannot_use_trivial_abi_reason : Note<
3780  "'trivial_abi' is disallowed on %0 because %select{"
3781  "its copy constructors and move constructors are all deleted|"
3782  "it is polymorphic|"
3783  "it has a base of a non-trivial class type|it has a virtual base|"
3784  "it has a __weak field|it has a field of a non-trivial class type}1">;
3785
3786// Availability attribute
3787def warn_availability_unknown_platform : Warning<
3788  "unknown platform %0 in availability macro">, InGroup<Availability>;
3789def warn_availability_version_ordering : Warning<
3790  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3791  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3792  "attribute ignored">, InGroup<Availability>;
3793def warn_mismatched_availability: Warning<
3794  "availability does not match previous declaration">, InGroup<Availability>;
3795def warn_mismatched_availability_override : Warning<
3796  "%select{|overriding }4method %select{introduced after|"
3797  "deprecated before|obsoleted before}0 "
3798  "%select{the protocol method it implements|overridden method}4 "
3799  "on %1 (%2 vs. %3)">, InGroup<Availability>;
3800def warn_mismatched_availability_override_unavail : Warning<
3801  "%select{|overriding }1method cannot be unavailable on %0 when "
3802  "%select{the protocol method it implements|its overridden method}1 is "
3803  "available">,
3804  InGroup<Availability>;
3805def warn_availability_on_static_initializer : Warning<
3806  "ignoring availability attribute %select{on '+load' method|"
3807  "with constructor attribute|with destructor attribute}0">,
3808  InGroup<Availability>;
3809def note_overridden_method : Note<
3810  "overridden method is here">;
3811def warn_availability_swift_unavailable_deprecated_only : Warning<
3812  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3813  InGroup<Availability>;
3814def note_protocol_method : Note<
3815  "protocol method is here">;
3816def warn_availability_fuchsia_unavailable_minor : Warning<
3817  "Fuchsia API Level prohibits specifying a minor or sub-minor version">,
3818  InGroup<Availability>;
3819
3820def warn_unguarded_availability :
3821  Warning<"%0 is only available on %1 %2 or newer">,
3822  InGroup<UnguardedAvailability>, DefaultIgnore;
3823def warn_unguarded_availability_new :
3824  Warning<warn_unguarded_availability.Summary>,
3825  InGroup<UnguardedAvailabilityNew>;
3826def note_decl_unguarded_availability_silence : Note<
3827  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3828def note_unguarded_available_silence : Note<
3829  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3830  " this warning">;
3831def warn_at_available_unchecked_use : Warning<
3832  "%select{@available|__builtin_available}0 does not guard availability here; "
3833  "use if (%select{@available|__builtin_available}0) instead">,
3834  InGroup<DiagGroup<"unsupported-availability-guard">>;
3835
3836def warn_missing_sdksettings_for_availability_checking : Warning<
3837  "%0 availability is ignored without a valid 'SDKSettings.json' in the SDK">,
3838  InGroup<DiagGroup<"ignored-availability-without-sdk-settings">>;
3839
3840// Thread Safety Attributes
3841def warn_thread_attribute_ignored : Warning<
3842  "ignoring %0 attribute because its argument is invalid">,
3843  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3844def warn_thread_attribute_not_on_non_static_member : Warning<
3845  "%0 attribute without capability arguments can only be applied to non-static "
3846  "methods of a class">,
3847  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3848def warn_thread_attribute_not_on_capability_member : Warning<
3849  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3850  "annotated with 'capability' or 'scoped_lockable' attribute">,
3851  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3852def warn_thread_attribute_argument_not_lockable : Warning<
3853  "%0 attribute requires arguments whose type is annotated "
3854  "with 'capability' attribute; type here is %1">,
3855  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3856def warn_thread_attribute_decl_not_lockable : Warning<
3857  "%0 attribute can only be applied in a context annotated "
3858  "with 'capability' attribute">,
3859  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3860def warn_thread_attribute_decl_not_pointer : Warning<
3861  "%0 only applies to pointer types; type here is %1">,
3862  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3863def err_attribute_argument_out_of_bounds_extra_info : Error<
3864  "%0 attribute parameter %1 is out of bounds: "
3865  "%plural{0:no parameters to index into|"
3866  "1:can only be 1, since there is one parameter|"
3867  ":must be between 1 and %2}2">;
3868
3869// Thread Safety Analysis
3870def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3871  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3872def warn_unlock_kind_mismatch : Warning<
3873  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3874  "%select{shared|exclusive}3 access">,
3875  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3876def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3877  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3878def warn_no_unlock : Warning<
3879  "%0 '%1' is still held at the end of function">,
3880  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3881def warn_expecting_locked : Warning<
3882  "expecting %0 '%1' to be held at the end of function">,
3883  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3884// FIXME: improve the error message about locks not in scope
3885def warn_lock_some_predecessors : Warning<
3886  "%0 '%1' is not held on every path through here">,
3887  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3888def warn_expecting_lock_held_on_loop : Warning<
3889  "expecting %0 '%1' to be held at start of each loop">,
3890  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3891def note_locked_here : Note<"%0 acquired here">;
3892def note_unlocked_here : Note<"%0 released here">;
3893def warn_lock_exclusive_and_shared : Warning<
3894  "%0 '%1' is acquired exclusively and shared in the same scope">,
3895  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3896def note_lock_exclusive_and_shared : Note<
3897  "the other acquisition of %0 '%1' is here">;
3898def warn_variable_requires_any_lock : Warning<
3899  "%select{reading|writing}1 variable %0 requires holding "
3900  "%select{any mutex|any mutex exclusively}1">,
3901  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3902def warn_var_deref_requires_any_lock : Warning<
3903  "%select{reading|writing}1 the value pointed to by %0 requires holding "
3904  "%select{any mutex|any mutex exclusively}1">,
3905  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3906def warn_fun_excludes_mutex : Warning<
3907  "cannot call function '%1' while %0 '%2' is held">,
3908  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3909def warn_cannot_resolve_lock : Warning<
3910  "cannot resolve lock expression">,
3911  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3912def warn_acquired_before : Warning<
3913  "%0 '%1' must be acquired before '%2'">,
3914  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3915def warn_acquired_before_after_cycle : Warning<
3916  "Cycle in acquired_before/after dependencies, starting with '%0'">,
3917  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3918
3919
3920// Thread safety warnings negative capabilities
3921def warn_acquire_requires_negative_cap : Warning<
3922  "acquiring %0 '%1' requires negative capability '%2'">,
3923  InGroup<ThreadSafetyNegative>, DefaultIgnore;
3924def warn_fun_requires_negative_cap : Warning<
3925  "calling function %0 requires negative capability '%1'">,
3926  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3927
3928// Thread safety warnings on pass/return by reference
3929def warn_guarded_pass_by_reference : Warning<
3930  "passing variable %1 by reference requires holding %0 "
3931  "%select{'%2'|'%2' exclusively}3">,
3932  InGroup<ThreadSafetyReference>, DefaultIgnore;
3933def warn_pt_guarded_pass_by_reference : Warning<
3934  "passing the value that %1 points to by reference requires holding %0 "
3935  "%select{'%2'|'%2' exclusively}3">,
3936  InGroup<ThreadSafetyReference>, DefaultIgnore;
3937def warn_guarded_return_by_reference : Warning<
3938  "returning variable %1 by reference requires holding %0 "
3939  "%select{'%2'|'%2' exclusively}3">,
3940  InGroup<ThreadSafetyReferenceReturn>, DefaultIgnore;
3941def warn_pt_guarded_return_by_reference : Warning<
3942  "returning the value that %1 points to by reference requires holding %0 "
3943  "%select{'%2'|'%2' exclusively}3">,
3944  InGroup<ThreadSafetyReferenceReturn>, DefaultIgnore;
3945
3946// Imprecise thread safety warnings
3947def warn_variable_requires_lock : Warning<
3948  "%select{reading|writing}3 variable %1 requires holding %0 "
3949  "%select{'%2'|'%2' exclusively}3">,
3950  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3951def warn_var_deref_requires_lock : Warning<
3952  "%select{reading|writing}3 the value pointed to by %1 requires "
3953  "holding %0 %select{'%2'|'%2' exclusively}3">,
3954  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3955def warn_fun_requires_lock : Warning<
3956  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3957  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3958
3959// Precise thread safety warnings
3960def warn_variable_requires_lock_precise :
3961  Warning<warn_variable_requires_lock.Summary>,
3962  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3963def warn_var_deref_requires_lock_precise :
3964  Warning<warn_var_deref_requires_lock.Summary>,
3965  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3966def warn_fun_requires_lock_precise :
3967  Warning<warn_fun_requires_lock.Summary>,
3968  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3969def note_found_mutex_near_match : Note<"found near match '%0'">;
3970
3971// Verbose thread safety warnings
3972def warn_thread_safety_verbose : Warning<"thread safety verbose warning">,
3973  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3974def note_thread_warning_in_fun : Note<"thread warning in function %0">;
3975def note_guarded_by_declared_here : Note<"guarded_by declared here">;
3976
3977// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3978def warn_thread_safety_beta : Warning<"thread safety beta warning">,
3979  InGroup<ThreadSafetyBeta>, DefaultIgnore;
3980
3981// Consumed warnings
3982def warn_use_in_invalid_state : Warning<
3983  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3984  "state">, InGroup<Consumed>, DefaultIgnore;
3985def warn_use_of_temp_in_invalid_state : Warning<
3986  "invalid invocation of method '%0' on a temporary object while it is in the "
3987  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3988def warn_attr_on_unconsumable_class : Warning<
3989  "consumed analysis attribute is attached to member of class %0 which isn't "
3990  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3991def warn_return_typestate_for_unconsumable_type : Warning<
3992  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3993  DefaultIgnore;
3994def warn_return_typestate_mismatch : Warning<
3995  "return value not in expected state; expected '%0', observed '%1'">,
3996  InGroup<Consumed>, DefaultIgnore;
3997def warn_loop_state_mismatch : Warning<
3998  "state of variable '%0' must match at the entry and exit of loop">,
3999  InGroup<Consumed>, DefaultIgnore;
4000def warn_param_return_typestate_mismatch : Warning<
4001  "parameter '%0' not in expected state when the function returns: expected "
4002  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
4003def warn_param_typestate_mismatch : Warning<
4004  "argument not in expected state; expected '%0', observed '%1'">,
4005  InGroup<Consumed>, DefaultIgnore;
4006
4007// no_sanitize attribute
4008def warn_unknown_sanitizer_ignored : Warning<
4009  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
4010
4011def warn_impcast_vector_scalar : Warning<
4012  "implicit conversion turns vector to scalar: %0 to %1">,
4013  InGroup<Conversion>, DefaultIgnore;
4014def warn_impcast_complex_scalar : Warning<
4015  "implicit conversion discards imaginary component: %0 to %1">,
4016  InGroup<Conversion>, DefaultIgnore;
4017def err_impcast_complex_scalar : Error<
4018  "implicit conversion from %0 to %1 is not permitted in C++">;
4019def warn_impcast_float_precision : Warning<
4020  "implicit conversion loses floating-point precision: %0 to %1">,
4021  InGroup<ImplicitFloatConversion>, DefaultIgnore;
4022def warn_impcast_float_result_precision : Warning<
4023  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
4024  InGroup<ImplicitFloatConversion>, DefaultIgnore;
4025def warn_impcast_double_promotion : Warning<
4026  "implicit conversion increases floating-point precision: %0 to %1">,
4027  InGroup<DoublePromotion>, DefaultIgnore;
4028def warn_impcast_integer_sign : Warning<
4029  "implicit conversion changes signedness: %0 to %1">,
4030  InGroup<SignConversion>, DefaultIgnore;
4031def warn_impcast_integer_sign_conditional : Warning<
4032  "operand of ? changes signedness: %0 to %1">,
4033  InGroup<SignConversion>, DefaultIgnore;
4034def warn_impcast_integer_precision : Warning<
4035  "implicit conversion loses integer precision: %0 to %1">,
4036  InGroup<ImplicitIntConversion>, DefaultIgnore;
4037def warn_impcast_high_order_zero_bits : Warning<
4038  "higher order bits are zeroes after implicit conversion">,
4039  InGroup<ImplicitIntConversion>, DefaultIgnore;
4040def warn_impcast_nonnegative_result : Warning<
4041  "the resulting value is always non-negative after implicit conversion">,
4042  InGroup<SignConversion>, DefaultIgnore;
4043def warn_impcast_integer_64_32 : Warning<
4044  "implicit conversion loses integer precision: %0 to %1">,
4045  InGroup<Shorten64To32>, DefaultIgnore;
4046def warn_impcast_integer_precision_constant : Warning<
4047  "implicit conversion from %2 to %3 changes value from %0 to %1">,
4048  InGroup<ConstantConversion>;
4049def warn_impcast_single_bit_bitield_precision_constant : Warning<
4050  "implicit truncation from %2 to a one-bit wide bit-field changes value from "
4051  "%0 to %1">, InGroup<SingleBitBitFieldConstantConversion>;
4052def warn_impcast_bitfield_precision_constant : Warning<
4053  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
4054  InGroup<BitFieldConstantConversion>;
4055def warn_impcast_constant_value_to_objc_bool : Warning<
4056  "implicit conversion from constant value %0 to 'BOOL'; "
4057  "the only well defined values for 'BOOL' are YES and NO">,
4058  InGroup<ObjCBoolConstantConversion>;
4059
4060def warn_impcast_fixed_point_range : Warning<
4061  "implicit conversion from %0 cannot fit within the range of values for %1">,
4062  InGroup<ImplicitFixedPointConversion>;
4063
4064def warn_impcast_literal_float_to_integer : Warning<
4065  "implicit conversion from %0 to %1 changes value from %2 to %3">,
4066  InGroup<LiteralConversion>;
4067def warn_impcast_literal_float_to_integer_out_of_range : Warning<
4068  "implicit conversion of out of range value from %0 to %1 is undefined">,
4069  InGroup<LiteralConversion>;
4070def warn_impcast_float_integer : Warning<
4071  "implicit conversion turns floating-point number into integer: %0 to %1">,
4072  InGroup<FloatConversion>, DefaultIgnore;
4073def warn_impcast_float_to_objc_signed_char_bool : Warning<
4074  "implicit conversion from floating-point type %0 to 'BOOL'">,
4075  InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
4076def warn_impcast_int_to_objc_signed_char_bool : Warning<
4077  "implicit conversion from integral type %0 to 'BOOL'">,
4078  InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
4079
4080// Implicit int -> float conversion precision loss warnings.
4081def warn_impcast_integer_float_precision : Warning<
4082  "implicit conversion from %0 to %1 may lose precision">,
4083  InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
4084def warn_impcast_integer_float_precision_constant : Warning<
4085  "implicit conversion from %2 to %3 changes value from %0 to %1">,
4086  InGroup<ImplicitConstIntFloatConversion>;
4087
4088def warn_impcast_float_to_integer : Warning<
4089  "implicit conversion from %0 to %1 changes value from %2 to %3">,
4090  InGroup<FloatOverflowConversion>, DefaultIgnore;
4091def warn_impcast_float_to_integer_out_of_range : Warning<
4092  "implicit conversion of out of range value from %0 to %1 is undefined">,
4093  InGroup<FloatOverflowConversion>, DefaultIgnore;
4094def warn_impcast_float_to_integer_zero : Warning<
4095  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
4096  InGroup<FloatZeroConversion>, DefaultIgnore;
4097
4098def warn_impcast_string_literal_to_bool : Warning<
4099  "implicit conversion turns string literal into bool: %0 to %1">,
4100  InGroup<StringConversion>, DefaultIgnore;
4101def warn_impcast_different_enum_types : Warning<
4102  "implicit conversion from enumeration type %0 to different enumeration type "
4103  "%1">, InGroup<EnumConversion>;
4104def warn_impcast_bool_to_null_pointer : Warning<
4105    "initialization of pointer of type %0 to null from a constant boolean "
4106    "expression">, InGroup<BoolConversion>;
4107def warn_non_literal_null_pointer : Warning<
4108    "expression which evaluates to zero treated as a null pointer constant of "
4109    "type %0">, InGroup<NonLiteralNullConversion>;
4110def warn_pointer_compare : Warning<
4111    "comparing a pointer to a null character constant; did you mean "
4112    "to compare to %select{NULL|(void *)0}0?">,
4113    InGroup<DiagGroup<"pointer-compare">>;
4114def warn_impcast_null_pointer_to_integer : Warning<
4115    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
4116    InGroup<NullConversion>;
4117def warn_impcast_floating_point_to_bool : Warning<
4118    "implicit conversion turns floating-point number into bool: %0 to %1">,
4119    InGroup<ImplicitConversionFloatingPointToBool>;
4120def ext_ms_impcast_fn_obj : ExtWarn<
4121  "implicit conversion between pointer-to-function and pointer-to-object is a "
4122  "Microsoft extension">, InGroup<MicrosoftCast>;
4123
4124def warn_impcast_pointer_to_bool : Warning<
4125    "address of%select{| function| array}0 '%1' will always evaluate to "
4126    "'true'">,
4127    InGroup<PointerBoolConversion>;
4128def warn_cast_nonnull_to_bool : Warning<
4129    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
4130    "'true' on first encounter">,
4131    InGroup<PointerBoolConversion>;
4132def warn_this_bool_conversion : Warning<
4133  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
4134  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
4135def warn_address_of_reference_bool_conversion : Warning<
4136  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4137  "code; pointer may be assumed to always convert to true">,
4138  InGroup<UndefinedBoolConversion>;
4139
4140def warn_xor_used_as_pow : Warning<
4141  "result of '%0' is %1; did you mean exponentiation?">,
4142  InGroup<XorUsedAsPow>;
4143def warn_xor_used_as_pow_base_extra : Warning<
4144  "result of '%0' is %1; did you mean '%2' (%3)?">,
4145  InGroup<XorUsedAsPow>;
4146def warn_xor_used_as_pow_base : Warning<
4147  "result of '%0' is %1; did you mean '%2'?">,
4148  InGroup<XorUsedAsPow>;
4149def note_xor_used_as_pow_silence : Note<
4150  "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
4151
4152def warn_null_pointer_compare : Warning<
4153    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
4154    "equal to a null pointer is always %select{true|false}2">,
4155    InGroup<TautologicalPointerCompare>;
4156def warn_nonnull_expr_compare : Warning<
4157    "comparison of nonnull %select{function call|parameter}0 '%1' "
4158    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
4159    "encounter">,
4160    InGroup<TautologicalPointerCompare>;
4161def warn_this_null_compare : Warning<
4162  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
4163  "assumed to always evaluate to %select{true|false}0">,
4164  InGroup<TautologicalUndefinedCompare>;
4165def warn_address_of_reference_null_compare : Warning<
4166  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4167  "code; comparison may be assumed to always evaluate to "
4168  "%select{true|false}0">,
4169  InGroup<TautologicalUndefinedCompare>;
4170def note_reference_is_return_value : Note<"%0 returns a reference">;
4171
4172def note_pointer_declared_here : Note<
4173  "pointer %0 declared here">;
4174def warn_division_sizeof_ptr : Warning<
4175  "'%0' will return the size of the pointer, not the array itself">,
4176  InGroup<DiagGroup<"sizeof-pointer-div">>;
4177def warn_division_sizeof_array : Warning<
4178  "expression does not compute the number of elements in this array; element "
4179  "type is %0, not %1">,
4180  InGroup<DiagGroup<"sizeof-array-div">>;
4181
4182def note_function_warning_silence : Note<
4183    "prefix with the address-of operator to silence this warning">;
4184def note_function_to_function_call : Note<
4185    "suffix with parentheses to turn this into a function call">;
4186def warn_impcast_objective_c_literal_to_bool : Warning<
4187    "implicit boolean conversion of Objective-C object literal always "
4188    "evaluates to true">,
4189    InGroup<ObjCLiteralConversion>;
4190
4191def warn_cast_align : Warning<
4192  "cast from %0 to %1 increases required alignment from %2 to %3">,
4193  InGroup<CastAlign>, DefaultIgnore;
4194def warn_old_style_cast : Warning<
4195  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore,
4196  SuppressInSystemMacro;
4197
4198// Separate between casts to void* and non-void* pointers.
4199// Some APIs use (abuse) void* for something like a user context,
4200// and often that value is an integer even if it isn't a pointer itself.
4201// Having a separate warning flag allows users to control the warning
4202// for their workflow.
4203def warn_int_to_pointer_cast : Warning<
4204  "cast to %1 from smaller integer type %0">,
4205  InGroup<IntToPointerCast>;
4206def warn_int_to_void_pointer_cast : Warning<
4207  "cast to %1 from smaller integer type %0">,
4208  InGroup<IntToVoidPointerCast>;
4209def warn_pointer_to_int_cast : Warning<
4210  "cast to smaller integer type %1 from %0">,
4211  InGroup<PointerToIntCast>;
4212def warn_pointer_to_enum_cast : Warning<
4213  warn_pointer_to_int_cast.Summary>,
4214  InGroup<PointerToEnumCast>;
4215def warn_void_pointer_to_int_cast : Warning<
4216  "cast to smaller integer type %1 from %0">,
4217  InGroup<VoidPointerToIntCast>;
4218def warn_void_pointer_to_enum_cast : Warning<
4219  warn_void_pointer_to_int_cast.Summary>,
4220  InGroup<VoidPointerToEnumCast>;
4221
4222def warn_attribute_ignored_for_field_of_type : Warning<
4223  "%0 attribute ignored for field of type %1">,
4224  InGroup<IgnoredAttributes>;
4225def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
4226  "enums in the Microsoft ABI are signed integers by default; consider giving "
4227  "the enum %0 an unsigned underlying type to make this code portable">,
4228  InGroup<SignedEnumBitfield>, DefaultIgnore;
4229def warn_attribute_packed_for_bitfield : Warning<
4230  "'packed' attribute was ignored on bit-fields with single-byte alignment "
4231  "in older versions of GCC and Clang">,
4232  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
4233def warn_transparent_union_attribute_field_size_align : Warning<
4234  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
4235  "%select{alignment|size}0 of the first field in transparent union; "
4236  "transparent_union attribute ignored">,
4237  InGroup<IgnoredAttributes>;
4238def note_transparent_union_first_field_size_align : Note<
4239  "%select{alignment|size}0 of first field is %1 bits">;
4240def warn_transparent_union_attribute_not_definition : Warning<
4241  "transparent_union attribute can only be applied to a union definition; "
4242  "attribute ignored">,
4243  InGroup<IgnoredAttributes>;
4244def warn_transparent_union_attribute_floating : Warning<
4245  "first field of a transparent union cannot have %select{floating point|"
4246  "vector}0 type %1; transparent_union attribute ignored">,
4247  InGroup<IgnoredAttributes>;
4248def warn_transparent_union_attribute_zero_fields : Warning<
4249  "transparent union definition must contain at least one field; "
4250  "transparent_union attribute ignored">,
4251  InGroup<IgnoredAttributes>;
4252def warn_attribute_type_not_supported : Warning<
4253  "%0 attribute argument not supported: %1">,
4254  InGroup<IgnoredAttributes>;
4255def warn_attribute_type_not_supported_global : Warning<
4256  "%0 attribute argument '%1' not supported on a global variable">,
4257  InGroup<IgnoredAttributes>;
4258def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
4259  InGroup<IgnoredAttributes>;
4260def warn_attribute_protected_visibility :
4261  Warning<"target does not support 'protected' visibility; using 'default'">,
4262  InGroup<DiagGroup<"unsupported-visibility">>;
4263def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
4264def note_previous_attribute : Note<"previous attribute is here">;
4265def note_conflicting_attribute : Note<"conflicting attribute is here">;
4266def note_attribute : Note<"attribute is here">;
4267def err_mismatched_ms_inheritance : Error<
4268  "inheritance model does not match %select{definition|previous declaration}0">;
4269def warn_ignored_ms_inheritance : Warning<
4270  "inheritance model ignored on %select{primary template|partial specialization}0">,
4271  InGroup<IgnoredAttributes>;
4272def note_previous_ms_inheritance : Note<
4273  "previous inheritance model specified here">;
4274def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
4275def err_mode_not_primitive : Error<
4276  "mode attribute only supported for integer and floating-point types">;
4277def err_mode_wrong_type : Error<
4278  "type of machine mode does not match type of base type">;
4279def warn_vector_mode_deprecated : Warning<
4280  "specifying vector types with the 'mode' attribute is deprecated; "
4281  "use the 'vector_size' attribute instead">,
4282  InGroup<DeprecatedAttributes>;
4283def warn_deprecated_noreturn_spelling : Warning<
4284  "the '[[_Noreturn]]' attribute spelling is deprecated in C23; use "
4285  "'[[noreturn]]' instead">, InGroup<DeprecatedAttributes>;
4286def err_complex_mode_vector_type : Error<
4287  "type of machine mode does not support base vector types">;
4288def err_enum_mode_vector_type : Error<
4289  "mode %0 is not supported for enumeration types">;
4290def warn_attribute_nonnull_no_pointers : Warning<
4291  "'nonnull' attribute applied to function with no pointer arguments">,
4292  InGroup<IgnoredAttributes>;
4293def warn_attribute_nonnull_parm_no_args : Warning<
4294  "'nonnull' attribute when used on parameters takes no arguments">,
4295  InGroup<IgnoredAttributes>;
4296def warn_function_stmt_attribute_precedence : Warning<
4297  "statement attribute %0 has higher precedence than function attribute "
4298  "'%select{always_inline|flatten|noinline}1'">,
4299  InGroup<IgnoredAttributes>;
4300def note_declared_nonnull : Note<
4301  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
4302def warn_attribute_sentinel_named_arguments : Warning<
4303  "'sentinel' attribute requires named arguments">,
4304  InGroup<IgnoredAttributes>;
4305def warn_attribute_sentinel_not_variadic : Warning<
4306  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
4307  InGroup<IgnoredAttributes>;
4308def warn_deprecated_ignored_on_using : Warning<
4309  "%0 currently has no effect on a using declaration">,
4310  InGroup<IgnoredAttributes>;
4311def err_attribute_sentinel_less_than_zero : Error<
4312  "'sentinel' parameter 1 less than zero">;
4313def err_attribute_sentinel_not_zero_or_one : Error<
4314  "'sentinel' parameter 2 not 0 or 1">;
4315def warn_cleanup_ext : Warning<
4316  "GCC does not allow the 'cleanup' attribute argument to be anything other "
4317  "than a simple identifier">,
4318  InGroup<GccCompat>;
4319def err_attribute_cleanup_arg_not_function : Error<
4320  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
4321def err_attribute_cleanup_func_must_take_one_arg : Error<
4322  "'cleanup' function %0 must take 1 parameter">;
4323def err_attribute_cleanup_func_arg_incompatible_type : Error<
4324  "'cleanup' function %0 parameter has "
4325  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
4326def err_attribute_regparm_wrong_platform : Error<
4327  "'regparm' is not valid on this platform">;
4328def err_attribute_regparm_invalid_number : Error<
4329  "'regparm' parameter must be between 0 and %0 inclusive">;
4330def err_attribute_not_supported_in_lang : Error<
4331  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
4332def err_attribute_not_supported_on_arch
4333    : Error<"%0 attribute is not supported on '%1'">;
4334def warn_gcc_ignores_type_attr : Warning<
4335  "GCC does not allow the %0 attribute to be written on a type">,
4336  InGroup<GccCompat>;
4337def warn_gcc_requires_variadic_function : Warning<
4338  "GCC requires a function with the %0 attribute to be variadic">,
4339  InGroup<GccCompat>;
4340
4341// Clang-Specific Attributes
4342def warn_attribute_iboutlet : Warning<
4343  "%0 attribute can only be applied to instance variables or properties">,
4344  InGroup<IgnoredAttributes>;
4345def err_iboutletcollection_type : Error<
4346  "invalid type %0 as argument of iboutletcollection attribute">;
4347def err_iboutletcollection_builtintype : Error<
4348  "type argument of iboutletcollection attribute cannot be a builtin type">;
4349def warn_iboutlet_object_type : Warning<
4350  "%select{instance variable|property}2 with %0 attribute must "
4351  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
4352def warn_iboutletcollection_property_assign : Warning<
4353  "IBOutletCollection properties should be copy/strong and not assign">,
4354  InGroup<ObjCInvalidIBOutletProperty>;
4355
4356def err_attribute_overloadable_mismatch : Error<
4357  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
4358def note_attribute_overloadable_prev_overload : Note<
4359  "previous %select{unmarked |}0overload of function is here">;
4360def err_attribute_overloadable_no_prototype : Error<
4361  "'overloadable' function %0 must have a prototype">;
4362def err_attribute_overloadable_multiple_unmarked_overloads : Error<
4363  "at most one overload for a given name may lack the 'overloadable' "
4364  "attribute">;
4365def warn_attribute_no_builtin_invalid_builtin_name : Warning<
4366  "'%0' is not a valid builtin name for %1">,
4367  InGroup<DiagGroup<"invalid-no-builtin-names">>;
4368def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
4369  "empty %0 cannot be composed with named ones">;
4370def err_attribute_no_builtin_on_non_definition : Error<
4371  "%0 attribute is permitted on definitions only">;
4372def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
4373  "%0 attribute has no effect on defaulted or deleted functions">;
4374def warn_ns_attribute_wrong_return_type : Warning<
4375  "%0 attribute only applies to %select{functions|methods|properties}1 that "
4376  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
4377  InGroup<IgnoredAttributes>;
4378def err_ns_attribute_wrong_parameter_type : Error<
4379  "%0 attribute only applies to "
4380  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
4381def warn_ns_attribute_wrong_parameter_type : Warning<
4382  "%0 attribute only applies to "
4383  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
4384  InGroup<IgnoredAttributes>;
4385def warn_objc_requires_super_protocol : Warning<
4386  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
4387  InGroup<DiagGroup<"requires-super-attribute">>;
4388def note_protocol_decl : Note<
4389  "protocol is declared here">;
4390def note_protocol_decl_undefined : Note<
4391  "protocol %0 has no definition">;
4392def err_attribute_preferred_name_arg_invalid : Error<
4393  "argument %0 to 'preferred_name' attribute is not a typedef for "
4394  "a specialization of %1">;
4395def err_attribute_builtin_alias : Error<
4396  "%0 attribute can only be applied to a ARM, HLSL or RISC-V builtin">;
4397
4398// called-once attribute diagnostics.
4399def err_called_once_attribute_wrong_type : Error<
4400  "'called_once' attribute only applies to function-like parameters">;
4401
4402def warn_completion_handler_never_called : Warning<
4403  "%select{|captured }1completion handler is never called">,
4404  InGroup<CompletionHandler>, DefaultIgnore;
4405def warn_called_once_never_called : Warning<
4406  "%select{|captured }1%0 parameter marked 'called_once' is never called">,
4407  InGroup<CalledOnceParameter>;
4408
4409def warn_completion_handler_never_called_when : Warning<
4410  "completion handler is never %select{used|called}1 when "
4411  "%select{taking true branch|taking false branch|"
4412  "handling this case|none of the cases applies|"
4413  "entering the loop|skipping the loop|taking one of the branches}2">,
4414  InGroup<CompletionHandler>, DefaultIgnore;
4415def warn_called_once_never_called_when : Warning<
4416  "%0 parameter marked 'called_once' is never %select{used|called}1 when "
4417  "%select{taking true branch|taking false branch|"
4418  "handling this case|none of the cases applies|"
4419  "entering the loop|skipping the loop|taking one of the branches}2">,
4420  InGroup<CalledOnceParameter>;
4421
4422def warn_completion_handler_called_twice : Warning<
4423  "completion handler is called twice">,
4424  InGroup<CompletionHandler>, DefaultIgnore;
4425def warn_called_once_gets_called_twice : Warning<
4426  "%0 parameter marked 'called_once' is called twice">,
4427  InGroup<CalledOnceParameter>;
4428def note_called_once_gets_called_twice : Note<
4429  "previous call is here%select{; set to nil to indicate "
4430  "it cannot be called afterwards|}0">;
4431
4432// objc_designated_initializer attribute diagnostics.
4433def warn_objc_designated_init_missing_super_call : Warning<
4434  "designated initializer missing a 'super' call to a designated initializer of the super class">,
4435  InGroup<ObjCDesignatedInit>;
4436def note_objc_designated_init_marked_here : Note<
4437  "method marked as designated initializer of the class here">;
4438def warn_objc_designated_init_non_super_designated_init_call : Warning<
4439  "designated initializer should only invoke a designated initializer on 'super'">,
4440  InGroup<ObjCDesignatedInit>;
4441def warn_objc_designated_init_non_designated_init_call : Warning<
4442  "designated initializer invoked a non-designated initializer">,
4443  InGroup<ObjCDesignatedInit>;
4444def warn_objc_secondary_init_super_init_call : Warning<
4445  "convenience initializer should not invoke an initializer on 'super'">,
4446  InGroup<ObjCDesignatedInit>;
4447def warn_objc_secondary_init_missing_init_call : Warning<
4448  "convenience initializer missing a 'self' call to another initializer">,
4449  InGroup<ObjCDesignatedInit>;
4450def warn_objc_implementation_missing_designated_init_override : Warning<
4451  "method override for the designated initializer of the superclass %objcinstance0 not found">,
4452  InGroup<ObjCDesignatedInit>;
4453def err_designated_init_attr_non_init : Error<
4454  "'objc_designated_initializer' attribute only applies to init methods "
4455  "of interface or class extension declarations">;
4456
4457// objc_bridge attribute diagnostics.
4458def err_objc_attr_not_id : Error<
4459  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
4460def err_objc_attr_typedef_not_id : Error<
4461  "parameter of %0 attribute must be 'id' when used on a typedef">;
4462def err_objc_attr_typedef_not_void_pointer : Error<
4463  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
4464def err_objc_cf_bridged_not_interface : Error<
4465  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
4466def err_objc_ns_bridged_invalid_cfobject : Error<
4467  "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
4468def warn_objc_invalid_bridge : Warning<
4469  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
4470def warn_objc_invalid_bridge_to_cf : Warning<
4471  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
4472
4473// objc_bridge_related attribute diagnostics.
4474def err_objc_bridged_related_invalid_class : Error<
4475  "could not find Objective-C class %0 to convert %1 to %2">;
4476def err_objc_bridged_related_invalid_class_name : Error<
4477  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
4478def err_objc_bridged_related_known_method : Error<
4479 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
4480 "method for this conversion">;
4481
4482def err_objc_attr_protocol_requires_definition : Error<
4483  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
4484
4485// Swift attributes.
4486def warn_attr_swift_name_function
4487  : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
4488    InGroup<SwiftNameAttribute>;
4489def warn_attr_swift_name_invalid_identifier
4490  : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4491    InGroup<SwiftNameAttribute>;
4492def warn_attr_swift_name_decl_kind
4493  : Warning<"%0 attribute cannot be applied to this declaration">,
4494    InGroup<SwiftNameAttribute>;
4495def warn_attr_swift_name_subscript_invalid_parameter
4496  : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4497        "have at least one parameter|"
4498        "have a 'self:' parameter}1">,
4499    InGroup<SwiftNameAttribute>;
4500def warn_attr_swift_name_missing_parameters
4501  : Warning<"%0 attribute is missing parameter label clause">,
4502    InGroup<SwiftNameAttribute>;
4503def warn_attr_swift_name_setter_parameters
4504  : Warning<"%0 attribute for setter must have one parameter for new value">,
4505    InGroup<SwiftNameAttribute>;
4506def warn_attr_swift_name_multiple_selfs
4507  : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4508    InGroup<SwiftNameAttribute>;
4509def warn_attr_swift_name_getter_parameters
4510  : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4511    InGroup<SwiftNameAttribute>;
4512def warn_attr_swift_name_subscript_setter_no_newValue
4513  : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4514    InGroup<SwiftNameAttribute>;
4515def warn_attr_swift_name_subscript_setter_multiple_newValues
4516  : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4517    InGroup<SwiftNameAttribute>;
4518def warn_attr_swift_name_subscript_getter_newValue
4519  : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4520    InGroup<SwiftNameAttribute>;
4521def warn_attr_swift_name_num_params
4522  : Warning<"too %select{few|many}0 parameters in the signature specified by "
4523            "the %1 attribute (expected %2; got %3)">,
4524    InGroup<SwiftNameAttribute>;
4525def warn_attr_swift_name_decl_missing_params
4526  : Warning<"%0 attribute cannot be applied to a %select{function|method}1 "
4527            "with no parameters">,
4528    InGroup<SwiftNameAttribute>;
4529
4530def err_attr_swift_error_no_error_parameter : Error<
4531  "%0 attribute can only be applied to a %select{function|method}1 with an "
4532  "error parameter">;
4533def err_attr_swift_error_return_type : Error<
4534  "%0 attribute with '%1' convention can only be applied to a "
4535  "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4536
4537def err_swift_async_no_access : Error<
4538  "first argument to 'swift_async' must be either 'none', 'swift_private', or "
4539  "'not_swift_private'">;
4540def err_swift_async_bad_block_type : Error<
4541  "'swift_async' completion handler parameter must have block type returning"
4542  " 'void', type here is %0">;
4543
4544def err_swift_async_error_without_swift_async : Error<
4545  "%0 attribute must be applied to a %select{function|method}1 annotated "
4546  "with non-'none' attribute 'swift_async'">;
4547def err_swift_async_error_no_error_parameter : Error<
4548  "%0 attribute with 'nonnull_error' convention can only be applied to a "
4549  "%select{function|method}1 with a completion handler with an error "
4550  "parameter">;
4551def err_swift_async_error_non_integral : Error<
4552  "%0 attribute with '%1' convention must have an integral-typed parameter "
4553  "in completion handler at index %2, type here is %3">;
4554
4555def warn_ignored_objc_externally_retained : Warning<
4556  "'objc_externally_retained' can only be applied to local variables "
4557  "%select{of retainable type|with strong ownership}0">,
4558  InGroup<IgnoredAttributes>;
4559
4560// Function Parameter Semantic Analysis.
4561def err_param_with_void_type : Error<"argument may not have 'void' type">;
4562def err_void_only_param : Error<
4563  "'void' must be the first and only parameter if specified">;
4564def err_void_param_qualified : Error<
4565  "'void' as parameter must not have type qualifiers">;
4566def err_ident_list_in_fn_declaration : Error<
4567  "a parameter list without types is only allowed in a function definition">;
4568def ext_param_not_declared : ExtWarn<
4569  "parameter %0 was not declared, defaults to 'int'; ISO C99 and later do not "
4570  "support implicit int">, InGroup<ImplicitInt>;
4571def err_param_default_argument : Error<
4572  "C does not support default arguments">;
4573def err_param_default_argument_redefinition : Error<
4574  "redefinition of default argument">;
4575def ext_param_default_argument_redefinition : ExtWarn<
4576  err_param_default_argument_redefinition.Summary>,
4577  InGroup<MicrosoftDefaultArgRedefinition>;
4578def err_param_default_argument_missing : Error<
4579  "missing default argument on parameter">;
4580def err_param_default_argument_missing_name : Error<
4581  "missing default argument on parameter %0">;
4582def err_param_default_argument_references_param : Error<
4583  "default argument references parameter %0">;
4584def err_param_default_argument_references_local : Error<
4585  "default argument references local variable %0 of enclosing function">;
4586def err_param_default_argument_references_this : Error<
4587  "default argument references 'this'">;
4588def err_param_default_argument_nonfunc : Error<
4589  "default arguments can only be specified for parameters in a function "
4590  "declaration">;
4591def err_param_default_argument_template_redecl : Error<
4592  "default arguments cannot be added to a function template that has already "
4593  "been declared">;
4594def err_param_default_argument_member_template_redecl : Error<
4595  "default arguments cannot be added to an out-of-line definition of a member "
4596  "of a %select{class template|class template partial specialization|nested "
4597  "class in a template}0">;
4598def err_param_default_argument_on_parameter_pack : Error<
4599  "parameter pack cannot have a default argument">;
4600def err_uninitialized_member_for_assign : Error<
4601  "cannot define the implicit copy assignment operator for %0, because "
4602  "non-static %select{reference|const}1 member %2 cannot use copy "
4603  "assignment operator">;
4604def err_uninitialized_member_in_ctor : Error<
4605  "%select{constructor for %1|"
4606  "implicit default constructor for %1|"
4607  "cannot use constructor inherited from %1:}0 must explicitly "
4608  "initialize the %select{reference|const}2 member %3">;
4609def err_default_arg_makes_ctor_special : Error<
4610  "addition of default argument on redeclaration makes this constructor a "
4611  "%select{default|copy|move}0 constructor">;
4612def err_stmt_expr_in_default_arg : Error<
4613  "default %select{argument|non-type template argument}0 may not use a GNU "
4614  "statement expression">;
4615
4616def err_use_of_default_argument_to_function_declared_later : Error<
4617  "use of default argument to function %0 that is declared later in class %1">;
4618def note_default_argument_declared_here : Note<
4619  "default argument declared here">;
4620def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4621def note_recursive_default_argument_used_here : Note<
4622  "default argument used here">;
4623
4624def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4625  "%diff{promoted type $ of K&R function parameter is not compatible with the "
4626  "parameter type $|promoted type of K&R function parameter is not compatible "
4627  "with parameter type}0,1 declared in a previous prototype">,
4628  InGroup<KNRPromotedParameter>;
4629
4630
4631// C++ Overloading Semantic Analysis.
4632def err_ovl_diff_return_type : Error<
4633  "functions that differ only in their return type cannot be overloaded">;
4634def err_ovl_static_nonstatic_member : Error<
4635  "static and non-static member functions with the same parameter types "
4636  "cannot be overloaded">;
4637
4638let Deferrable = 1 in {
4639
4640def err_ovl_no_viable_function_in_call : Error<
4641  "no matching function for call to %0">;
4642def err_ovl_no_viable_member_function_in_call : Error<
4643  "no matching member function for call to %0">;
4644def err_ovl_ambiguous_call : Error<
4645  "call to %0 is ambiguous">;
4646def err_ovl_deleted_call : Error<"call to deleted function %0">;
4647def err_ovl_ambiguous_member_call : Error<
4648  "call to member function %0 is ambiguous">;
4649def err_ovl_deleted_member_call : Error<
4650  "call to deleted member function %0">;
4651def note_ovl_too_many_candidates : Note<
4652    "remaining %0 candidate%s0 omitted; "
4653    "pass -fshow-overloads=all to show them">;
4654
4655def select_ovl_candidate_kind : TextSubstitution<
4656  "%select{function|function|function (with reversed parameter order)|"
4657    "constructor|"
4658    "constructor (the implicit default constructor)|"
4659    "constructor (the implicit copy constructor)|"
4660    "constructor (the implicit move constructor)|"
4661    "function (the implicit copy assignment operator)|"
4662    "function (the implicit move assignment operator)|"
4663    "function (the implicit 'operator==' for this 'operator<=>)'|"
4664    "inherited constructor}0%select{| template| %2}1">;
4665
4666def note_ovl_candidate : Note<
4667    "candidate %sub{select_ovl_candidate_kind}0,1,3"
4668    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4669    "| has different number of parameters (expected %5 but has %6)"
4670    "| has type mismatch at %ordinal5 parameter"
4671    "%diff{ (expected $ but has $)|}6,7"
4672    "| has different return type%diff{ ($ expected but has $)|}5,6"
4673    "| has different qualifiers (expected %5 but found %6)"
4674    "| has different exception specification}4">;
4675
4676def note_ovl_candidate_explicit : Note<
4677    "explicit %select{constructor|conversion function|deduction guide}0 "
4678    "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4679def note_ovl_candidate_inherited_constructor : Note<
4680    "constructor from base class %0 inherited here">;
4681def note_ovl_candidate_inherited_constructor_slice : Note<
4682    "candidate %select{constructor|template}0 ignored: "
4683    "inherited constructor cannot be used to %select{copy|move}1 object">;
4684def note_ovl_candidate_illegal_constructor : Note<
4685    "candidate %select{constructor|template}0 ignored: "
4686    "instantiation %select{takes|would take}0 its own class type by value">;
4687def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4688    "candidate constructor ignored: cannot be used to construct an object "
4689    "in address space %0">;
4690def note_ovl_candidate_bad_deduction : Note<
4691    "candidate template ignored: failed template argument deduction">;
4692def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4693    "couldn't infer template argument %0">;
4694def note_ovl_candidate_incomplete_deduction_pack : Note<
4695    "candidate template ignored: "
4696    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4697    "expanded parameter in deduced argument pack %2">;
4698def note_ovl_candidate_inconsistent_deduction : Note<
4699    "candidate template ignored: deduced %select{conflicting types|"
4700    "conflicting values|conflicting templates|packs of different lengths}0 "
4701    "for parameter %1%diff{ ($ vs. $)|}2,3">;
4702def note_ovl_candidate_inconsistent_deduction_types : Note<
4703    "candidate template ignored: deduced values %diff{"
4704    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4705    "%1 and %3 of conflicting types for parameter %0}2,4">;
4706def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4707    "candidate template ignored: invalid explicitly-specified argument "
4708    "for template parameter %0">;
4709def note_ovl_candidate_unsatisfied_constraints : Note<
4710    "candidate template ignored: constraints not satisfied%0">;
4711def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4712    "candidate template ignored: invalid explicitly-specified argument "
4713    "for %ordinal0 template parameter">;
4714def note_ovl_candidate_instantiation_depth : Note<
4715    "candidate template ignored: substitution exceeded maximum template "
4716    "instantiation depth">;
4717def note_ovl_candidate_underqualified : Note<
4718    "candidate template ignored: cannot deduce a type for %0 that would "
4719    "make %2 equal %1">;
4720def note_ovl_candidate_substitution_failure : Note<
4721    "candidate template ignored: substitution failure%0%1">;
4722def note_ovl_candidate_disabled_by_enable_if : Note<
4723    "candidate template ignored: disabled by %0%1">;
4724def note_ovl_candidate_disabled_by_requirement : Note<
4725    "candidate template ignored: requirement '%0' was not satisfied%1">;
4726def note_ovl_candidate_has_pass_object_size_params: Note<
4727    "candidate address cannot be taken because parameter %0 has "
4728    "pass_object_size attribute">;
4729def err_diagnose_if_succeeded : Error<"%0">;
4730def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4731    ShowInSystemHeader;
4732def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4733    "candidate disabled: %0">;
4734def err_addrof_function_disabled_by_enable_if_attr : Error<
4735    "cannot take address of function %0 because it has one or more "
4736    "non-tautological enable_if conditions">;
4737def err_addrof_function_constraints_not_satisfied : Error<
4738    "cannot take address of function %0 because its constraints are not "
4739    "satisfied">;
4740def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4741    "candidate function made ineligible by enable_if">;
4742def note_ovl_candidate_deduced_mismatch : Note<
4743    "candidate template ignored: deduced type "
4744    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4745    "adjusted type $ of %select{|element of }4argument"
4746    "|of %select{|element of }4%ordinal0 parameter does not match "
4747    "adjusted type of %select{|element of }4argument}1,2%3">;
4748def note_ovl_candidate_non_deduced_mismatch : Note<
4749    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4750// This note is needed because the above note would sometimes print two
4751// different types with the same name.  Remove this note when the above note
4752// can handle that case properly.
4753def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4754    "candidate template ignored: could not match %q0 against %q1">;
4755
4756// Note that we don't treat templates differently for this diagnostic.
4757def note_ovl_candidate_arity : Note<"candidate "
4758    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4759    "requires%select{ at least| at most|}3 %4 "
4760    "%select{|non-object }6argument%s4, but %5 "
4761    "%plural{1:was|:were}5 provided">;
4762
4763def note_ovl_candidate_arity_one : Note<"candidate "
4764    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4765    "%select{requires at least|allows at most single|requires single}3 "
4766    "%select{|non-object }6"
4767    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4768
4769def note_ovl_candidate_deleted : Note<
4770    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4771    "%select{explicitly made unavailable|explicitly deleted|"
4772    "implicitly deleted}3">;
4773
4774// Giving the index of the bad argument really clutters this message, and
4775// it's relatively unimportant because 1) it's generally obvious which
4776// argument(s) are of the given object type and 2) the fix is usually
4777// to complete the type, which doesn't involve changes to the call line
4778// anyway.  If people complain, we can change it.
4779def note_ovl_candidate_bad_conv_incomplete : Note<
4780    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4781    "cannot convert argument of incomplete type "
4782    "%diff{$ to $|to parameter type}3,4 for "
4783    "%select{%ordinal6 argument|object argument}5"
4784    "%select{|; dereference the argument with *|"
4785    "; take the address of the argument with &|"
4786    "; remove *|"
4787    "; remove &}7">;
4788def note_ovl_candidate_bad_list_argument : Note<
4789    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4790    "%select{cannot convert initializer list|too few initializers in list"
4791    "|too many initializers in list}7 argument to %4">;
4792def note_ovl_candidate_bad_overload : Note<
4793    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4794    "no overload of %4 matching %3 for %ordinal5 argument">;
4795def note_ovl_candidate_bad_conv : Note<
4796    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4797    "no known conversion "
4798    "%diff{from $ to $|from argument type to parameter type}3,4 for "
4799    "%select{%ordinal6 argument|object argument}5"
4800    "%select{|; dereference the argument with *|"
4801    "; take the address of the argument with &|"
4802    "; remove *|"
4803    "; remove &}7">;
4804def note_ovl_candidate_bad_arc_conv : Note<
4805    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4806    "cannot implicitly convert argument "
4807    "%diff{of type $ to $|type to parameter type}3,4 for "
4808    "%select{%ordinal6 argument|object argument}5 under ARC">;
4809def note_ovl_candidate_bad_value_category : Note<
4810    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4811    "expects an %select{lvalue|rvalue}5 for "
4812    "%select{%ordinal4 argument|object argument}3">;
4813def note_ovl_candidate_bad_addrspace : Note<
4814    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4815    "cannot %select{pass pointer to|bind reference in}5 %3 "
4816    "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4817    "argument">;
4818def note_ovl_candidate_bad_addrspace_this : Note<
4819    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4820    "'this' object is in %3, but method expects object in %4">;
4821def note_ovl_candidate_bad_gc : Note<
4822    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4823    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4824    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4825def note_ovl_candidate_bad_ownership : Note<
4826    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4827    "%select{%ordinal7|'this'}6 argument (%3) has "
4828    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4829    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4830    "__autoreleasing}5 ownership">;
4831def note_ovl_candidate_bad_cvr_this : Note<
4832    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4833    "'this' argument has type %3, but method is not marked "
4834    "%select{const|restrict|const or restrict|volatile|const or volatile|"
4835    "volatile or restrict|const, volatile, or restrict}4">;
4836def note_ovl_candidate_bad_cvr : Note<
4837    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4838    "%ordinal5 argument (%3) would lose "
4839    "%select{const|restrict|const and restrict|volatile|const and volatile|"
4840    "volatile and restrict|const, volatile, and restrict}4 qualifier"
4841    "%select{||s||s|s|s}4">;
4842def note_ovl_candidate_bad_base_to_derived_conv : Note<
4843    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4844    "cannot %select{convert from|convert from|bind}3 "
4845    "%select{base class pointer|superclass|base class object of type}3 %4 to "
4846    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4847    "%ordinal6 argument">;
4848def note_ovl_candidate_bad_target : Note<
4849    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4850    "call to "
4851    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4852    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4853def note_ovl_candidate_constraints_not_satisfied : Note<
4854    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4855    "not satisfied">;
4856def note_ovl_surrogate_constraints_not_satisfied : Note<
4857    "conversion candidate %0 not viable: constraints not satisfied">;
4858def note_implicit_member_target_infer_collision : Note<
4859    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4860    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4861    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4862
4863def note_ambiguous_type_conversion: Note<
4864    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4865def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4866def err_ovl_no_viable_function_in_init : Error<
4867  "no matching constructor for initialization of %0">;
4868def err_ovl_no_conversion_in_cast : Error<
4869  "cannot convert %1 to %2 without a conversion operator">;
4870def err_ovl_no_viable_conversion_in_cast : Error<
4871  "no matching conversion for %select{|static_cast|reinterpret_cast|"
4872  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4873def err_ovl_ambiguous_conversion_in_cast : Error<
4874  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4875  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4876def err_ovl_deleted_conversion_in_cast : Error<
4877  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4878  "functional-style cast|}0 from %1 to %2 uses deleted function">;
4879def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4880def err_ref_init_ambiguous : Error<
4881  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4882def err_ovl_deleted_init : Error<
4883  "call to deleted constructor of %0">;
4884def err_ovl_deleted_special_init : Error<
4885  "call to implicitly-deleted %select{default constructor|copy constructor|"
4886  "move constructor|copy assignment operator|move assignment operator|"
4887  "destructor|function}0 of %1">;
4888def err_ovl_ambiguous_oper_unary : Error<
4889  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4890def err_ovl_ambiguous_oper_binary : Error<
4891  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4892def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4893  "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4894  "and %2) to be ambiguous despite there being a unique best viable function"
4895  "%select{ with non-reversed arguments|}3">,
4896  InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4897def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4898  "ambiguity is between a regular call to this operator and a call with the "
4899  "argument order reversed">;
4900def note_ovl_ambiguous_eqeq_reversed_self_non_const : Note<
4901  "mark 'operator==' as const or add a matching 'operator!=' to resolve the ambiguity">;
4902def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4903  "candidate function with non-reversed arguments">;
4904def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4905  "ambiguous candidate function with reversed arguments">;
4906def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4907def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4908def err_ovl_deleted_oper : Error<
4909  "overload resolution selected deleted operator '%0'">;
4910def err_ovl_deleted_special_oper : Error<
4911  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4912  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4913  "implicitly deleted">;
4914def err_ovl_deleted_comparison : Error<
4915  "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4916def err_ovl_rewrite_equalequal_not_bool : Error<
4917  "return type %0 of selected 'operator==' function for rewritten "
4918  "'%1' comparison is not 'bool'">;
4919def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4920  "ISO C++20 requires return type of selected 'operator==' function for "
4921  "rewritten '%1' comparison to be 'bool', not %0">,
4922  InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4923def err_ovl_no_viable_subscript :
4924    Error<"no viable overloaded operator[] for type %0">;
4925def err_ovl_no_oper :
4926    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4927def err_ovl_unresolvable : Error<
4928  "reference to %select{overloaded|multiversioned}1 function could not be "
4929  "resolved; did you mean to call it%select{| with no arguments}0?">;
4930def err_bound_member_function : Error<
4931  "reference to non-static member function must be called"
4932  "%select{|; did you mean to call it with no arguments?}0">;
4933def note_possible_target_of_call : Note<"possible target for call">;
4934def err_no_viable_destructor : Error<
4935  "no viable destructor found for class %0">;
4936def err_ambiguous_destructor : Error<
4937  "destructor of class %0 is ambiguous">;
4938
4939def err_ovl_no_viable_object_call : Error<
4940  "no matching function for call to object of type %0">;
4941def err_ovl_ambiguous_object_call : Error<
4942  "call to object of type %0 is ambiguous">;
4943def err_ovl_ambiguous_subscript_call : Error<
4944  "call to subscript operator of type %0 is ambiguous">;
4945def err_ovl_deleted_object_call : Error<
4946  "call to deleted function call operator in type %0">;
4947def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4948def err_member_call_without_object : Error<
4949  "call to %select{non-static|explicit}0 member function without an object argument">;
4950
4951// C++ Address of Overloaded Function
4952def err_addr_ovl_no_viable : Error<
4953  "address of overloaded function %0 does not match required type %1">;
4954def err_addr_ovl_ambiguous : Error<
4955  "address of overloaded function %0 is ambiguous">;
4956def err_addr_ovl_not_func_ptrref : Error<
4957  "address of overloaded function %0 cannot be converted to type %1">;
4958def err_addr_ovl_no_qualifier : Error<
4959  "cannot form member pointer of type %0 without '&' and class name">;
4960
4961} // let Deferrable
4962
4963// C++11 Literal Operators
4964def err_ovl_no_viable_literal_operator : Error<
4965  "no matching literal operator for call to %0"
4966  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4967  "%select{| or 'const char *'}4"
4968  "%select{|, and no matching literal operator template}5">;
4969
4970// C++ Template Declarations
4971def err_template_param_shadow : Error<
4972  "declaration of %0 shadows template parameter">;
4973def ext_template_param_shadow : ExtWarn<
4974  err_template_param_shadow.Summary>, InGroup<MicrosoftTemplateShadow>;
4975def note_template_param_here : Note<"template parameter is declared here">;
4976def note_template_param_external : Note<
4977  "template parameter from hidden source: %0">;
4978def warn_template_export_unsupported : Warning<
4979  "exported templates are unsupported">;
4980def err_template_outside_namespace_or_class_scope : Error<
4981  "templates can only be declared in namespace or class scope">;
4982def err_template_inside_local_class : Error<
4983  "templates cannot be declared inside of a local class">;
4984def err_template_linkage : Error<"templates must have C++ linkage">;
4985def err_template_typedef : Error<"a typedef cannot be a template">;
4986def err_template_unnamed_class : Error<
4987  "cannot declare a class template with no name">;
4988def err_template_param_list_different_arity : Error<
4989  "%select{too few|too many}0 template parameters in template "
4990  "%select{|template parameter }1redeclaration">;
4991def note_template_param_list_different_arity : Note<
4992  "%select{too few|too many}0 template parameters in template template "
4993  "argument">;
4994def note_template_prev_declaration : Note<
4995  "previous template %select{declaration|template parameter}0 is here">;
4996def err_template_param_different_kind : Error<
4997  "template parameter has a different kind in template "
4998  "%select{|template parameter }0redeclaration">;
4999def note_template_param_different_kind : Note<
5000  "template parameter has a different kind in template argument">;
5001
5002def err_invalid_decl_specifier_in_nontype_parm : Error<
5003  "invalid declaration specifier in template non-type parameter">;
5004
5005def err_template_nontype_parm_different_type : Error<
5006  "template non-type parameter has a different type %0 in template "
5007  "%select{|template parameter }1redeclaration">;
5008
5009def note_template_nontype_parm_different_type : Note<
5010  "template non-type parameter has a different type %0 in template argument">;
5011def note_template_nontype_parm_prev_declaration : Note<
5012  "previous non-type template parameter with type %0 is here">;
5013def err_template_nontype_parm_bad_type : Error<
5014  "a non-type template parameter cannot have type %0">;
5015def err_template_nontype_parm_bad_structural_type : Error<
5016  "a non-type template parameter cannot have type %0 before C++20">;
5017def err_template_nontype_parm_incomplete : Error<
5018  "non-type template parameter has incomplete type %0">;
5019def err_template_nontype_parm_not_literal : Error<
5020  "non-type template parameter has non-literal type %0">;
5021def err_template_nontype_parm_rvalue_ref : Error<
5022  "non-type template parameter has rvalue reference type %0">;
5023def err_template_nontype_parm_not_structural : Error<
5024  "type %0 of non-type template parameter is not a structural type">;
5025def note_not_structural_non_public : Note<
5026  "%0 is not a structural type because it has a "
5027  "%select{non-static data member|base class}1 that is not public">;
5028def note_not_structural_mutable_field : Note<
5029  "%0 is not a structural type because it has a mutable "
5030  "non-static data member">;
5031def note_not_structural_rvalue_ref_field : Note<
5032  "%0 is not a structural type because it has a non-static data member "
5033  "of rvalue reference type">;
5034def note_not_structural_subobject : Note<
5035  "%0 is not a structural type because it has a "
5036  "%select{non-static data member|base class}1 of non-structural type %2">;
5037def warn_cxx17_compat_template_nontype_parm_type : Warning<
5038  "non-type template parameter of type %0 is incompatible with "
5039  "C++ standards before C++20">,
5040  DefaultIgnore, InGroup<CXXPre20Compat>;
5041def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
5042  "non-type template parameters declared with %0 are incompatible with C++ "
5043  "standards before C++17">,
5044  DefaultIgnore, InGroup<CXXPre17Compat>;
5045def err_template_param_default_arg_redefinition : Error<
5046  "template parameter redefines default argument">;
5047def err_template_param_default_arg_inconsistent_redefinition : Error<
5048  "template parameter default argument is inconsistent with previous definition">;
5049def note_template_param_prev_default_arg : Note<
5050  "previous default template argument defined here">;
5051def note_template_param_prev_default_arg_in_other_module : Note<
5052  "previous default template argument defined in module %0">;
5053def err_template_param_default_arg_missing : Error<
5054  "template parameter missing a default argument">;
5055def ext_template_parameter_default_in_function_template : ExtWarn<
5056  "default template arguments for a function template are a C++11 extension">,
5057  InGroup<CXX11>;
5058def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
5059  "default template arguments for a function template are incompatible with C++98">,
5060  InGroup<CXX98Compat>, DefaultIgnore;
5061def err_template_parameter_default_template_member : Error<
5062  "cannot add a default template argument to the definition of a member of a "
5063  "class template">;
5064def err_template_parameter_default_friend_template : Error<
5065  "default template argument not permitted on a friend template">;
5066def err_template_template_parm_no_parms : Error<
5067  "template template parameter must have its own template parameters">;
5068
5069def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
5070  InGroup<CXX14>;
5071def warn_cxx11_compat_variable_template : Warning<
5072  "variable templates are incompatible with C++ standards before C++14">,
5073  InGroup<CXXPre14Compat>, DefaultIgnore;
5074def err_template_variable_noparams : Error<
5075  "extraneous 'template<>' in declaration of variable %0">;
5076def err_template_member : Error<"member %0 declared as a template">;
5077def err_member_with_template_arguments : Error<"member %0 cannot have template arguments">;
5078def err_template_member_noparams : Error<
5079  "extraneous 'template<>' in declaration of member %0">;
5080def err_template_tag_noparams : Error<
5081  "extraneous 'template<>' in declaration of %0 %1">;
5082
5083def warn_cxx17_compat_adl_only_template_id : Warning<
5084  "use of function template name with no prior function template "
5085  "declaration in function call with explicit template arguments "
5086  "is incompatible with C++ standards before C++20">,
5087  InGroup<CXXPre20Compat>, DefaultIgnore;
5088def ext_adl_only_template_id : ExtWarn<
5089  "use of function template name with no prior declaration in function call "
5090  "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
5091
5092def warn_unqualified_call_to_std_cast_function : Warning<
5093  "unqualified call to '%0'">, InGroup<DiagGroup<"unqualified-std-cast-call">>;
5094
5095// C++ Template Argument Lists
5096def err_template_missing_args : Error<
5097  "use of "
5098  "%select{class template|function template|variable template|alias template|"
5099  "template template parameter|concept|template}0 %1 requires template "
5100  "arguments">;
5101def err_template_arg_list_different_arity : Error<
5102  "%select{too few|too many}0 template arguments for "
5103  "%select{class template|function template|variable template|alias template|"
5104  "template template parameter|concept|template}1 %2">;
5105def note_template_decl_here : Note<"template is declared here">;
5106def note_template_decl_external : Note<
5107  "template declaration from hidden source: %0">;
5108def err_template_arg_must_be_type : Error<
5109  "template argument for template type parameter must be a type">;
5110def err_template_arg_must_be_type_suggest : Error<
5111  "template argument for template type parameter must be a type; "
5112  "did you forget 'typename'?">;
5113def ext_ms_template_type_arg_missing_typename : ExtWarn<
5114  "template argument for template type parameter must be a type; "
5115  "omitted 'typename' is a Microsoft extension">,
5116  InGroup<MicrosoftTemplate>;
5117def err_template_arg_must_be_expr : Error<
5118  "template argument for non-type template parameter must be an expression">;
5119def err_template_arg_nontype_ambig : Error<
5120  "template argument for non-type template parameter is treated as function type %0">;
5121def err_template_arg_must_be_template : Error<
5122  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
5123def ext_template_arg_local_type : ExtWarn<
5124  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
5125def ext_template_arg_unnamed_type : ExtWarn<
5126  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
5127def warn_cxx98_compat_template_arg_local_type : Warning<
5128  "local type %0 as template argument is incompatible with C++98">,
5129  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
5130def warn_cxx98_compat_template_arg_unnamed_type : Warning<
5131  "unnamed type as template argument is incompatible with C++98">,
5132  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
5133def note_template_unnamed_type_here : Note<
5134  "unnamed type used in template argument was declared here">;
5135def err_template_arg_overload_type : Error<
5136  "template argument is the type of an unresolved overloaded function">;
5137def err_template_arg_not_valid_template : Error<
5138  "template argument does not refer to a class or alias template, or template "
5139  "template parameter">;
5140def note_template_arg_refers_here_func : Note<
5141  "template argument refers to function template %0, here">;
5142def err_template_arg_template_params_mismatch : Error<
5143  "template template argument has different template parameters than its "
5144  "corresponding template template parameter">;
5145def err_template_arg_not_integral_or_enumeral : Error<
5146  "non-type template argument of type %0 must have an integral or enumeration"
5147  " type">;
5148def err_template_arg_not_ice : Error<
5149  "non-type template argument of type %0 is not an integral constant "
5150  "expression">;
5151def err_template_arg_not_address_constant : Error<
5152  "non-type template argument of type %0 is not a constant expression">;
5153def warn_cxx98_compat_template_arg_null : Warning<
5154  "use of null pointer as non-type template argument is incompatible with "
5155  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5156def err_template_arg_untyped_null_constant : Error<
5157  "null non-type template argument must be cast to template parameter type %0">;
5158def err_template_arg_wrongtype_null_constant : Error<
5159  "null non-type template argument of type %0 does not match template parameter "
5160  "of type %1">;
5161def err_non_type_template_parm_type_deduction_failure : Error<
5162  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
5163def err_deduced_non_type_template_arg_type_mismatch : Error<
5164  "deduced non-type template argument does not have the same type as the "
5165  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
5166def err_non_type_template_arg_subobject : Error<
5167  "non-type template argument refers to subobject '%0'">;
5168def err_non_type_template_arg_addr_label_diff : Error<
5169  "template argument / label address difference / what did you expect?">;
5170def err_template_arg_not_convertible : Error<
5171  "non-type template argument of type %0 cannot be converted to a value "
5172  "of type %1">;
5173def warn_template_arg_negative : Warning<
5174  "non-type template argument with value '%0' converted to '%1' for unsigned "
5175  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5176def warn_template_arg_too_large : Warning<
5177  "non-type template argument value '%0' truncated to '%1' for "
5178  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5179def err_template_arg_no_ref_bind : Error<
5180  "non-type template parameter of reference type "
5181  "%diff{$ cannot bind to template argument of type $"
5182  "|cannot bind to template of incompatible argument type}0,1">;
5183def err_template_arg_ref_bind_ignores_quals : Error<
5184  "reference binding of non-type template parameter "
5185  "%diff{of type $ to template argument of type $|to template argument}0,1 "
5186  "ignores qualifiers">;
5187def err_template_arg_not_decl_ref : Error<
5188  "non-type template argument does not refer to any declaration">;
5189def err_template_arg_not_address_of : Error<
5190  "non-type template argument for template parameter of pointer type %0 must "
5191  "have its address taken">;
5192def err_template_arg_address_of_non_pointer : Error<
5193  "address taken in non-type template argument for template parameter of "
5194  "reference type %0">;
5195def err_template_arg_reference_var : Error<
5196  "non-type template argument of reference type %0 is not an object">;
5197def err_template_arg_field : Error<
5198  "non-type template argument refers to non-static data member %0">;
5199def err_template_arg_method : Error<
5200  "non-type template argument refers to non-static member function %0">;
5201def err_template_arg_object_no_linkage : Error<
5202  "non-type template argument refers to %select{function|object}0 %1 that "
5203  "does not have linkage">;
5204def warn_cxx98_compat_template_arg_object_internal : Warning<
5205  "non-type template argument referring to %select{function|object}0 %1 with "
5206  "internal linkage is incompatible with C++98">,
5207  InGroup<CXX98Compat>, DefaultIgnore;
5208def ext_template_arg_object_internal : ExtWarn<
5209  "non-type template argument referring to %select{function|object}0 %1 with "
5210  "internal linkage is a C++11 extension">, InGroup<CXX11>;
5211def err_template_arg_thread_local : Error<
5212  "non-type template argument refers to thread-local object">;
5213def note_template_arg_internal_object : Note<
5214  "non-type template argument refers to %select{function|object}0 here">;
5215def note_template_arg_refers_here : Note<
5216  "non-type template argument refers here">;
5217def err_template_arg_not_object_or_func : Error<
5218  "non-type template argument does not refer to an object or function">;
5219def err_template_arg_not_pointer_to_member_form : Error<
5220  "non-type template argument is not a pointer to member constant">;
5221def err_template_arg_invalid : Error<
5222  "non-type template argument '%0' is invalid">;
5223def ext_template_arg_extra_parens : ExtWarn<
5224  "address non-type template argument cannot be surrounded by parentheses">;
5225def warn_cxx98_compat_template_arg_extra_parens : Warning<
5226  "redundant parentheses surrounding address non-type template argument are "
5227  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5228def err_pointer_to_member_type : Error<
5229  "invalid use of pointer to member type after %select{.*|->*}0">;
5230def err_pointer_to_member_call_drops_quals : Error<
5231  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
5232def err_pointer_to_member_oper_value_classify: Error<
5233  "pointer-to-member function type %0 can only be called on an "
5234  "%select{rvalue|lvalue}1">;
5235def ext_pointer_to_const_ref_member_on_rvalue : Extension<
5236  "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
5237  InGroup<CXX20>, SFINAEFailure;
5238def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
5239  "invoking a pointer to a 'const &' member function on an rvalue is "
5240  "incompatible with C++ standards before C++20">,
5241  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
5242def ext_ms_deref_template_argument: ExtWarn<
5243  "non-type template argument containing a dereference operation is a "
5244  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5245def ext_ms_delayed_template_argument: ExtWarn<
5246  "using the undeclared type %0 as a default template argument is a "
5247  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5248def err_template_arg_deduced_incomplete_pack : Error<
5249  "deduced incomplete pack %0 for template parameter %1">;
5250
5251// C++ template specialization
5252def err_template_spec_unknown_kind : Error<
5253  "can only provide an explicit specialization for a class template, function "
5254  "template, variable template, or a member function, static data member, "
5255  "%select{or member class|member class, or member enumeration}0 of a "
5256  "class template">;
5257def note_specialized_entity : Note<
5258  "explicitly specialized declaration is here">;
5259def err_template_spec_decl_function_scope : Error<
5260  "explicit specialization of %0 in function scope">;
5261def err_template_spec_decl_friend : Error<
5262  "cannot declare an explicit specialization in a friend">;
5263def err_template_spec_redecl_out_of_scope : Error<
5264  "%select{class template|class template partial|variable template|"
5265  "variable template partial|function template|member "
5266  "function|static data member|member class|member enumeration}0 "
5267  "specialization of %1 not in %select{a namespace enclosing %2|"
5268  "class %2 or an enclosing namespace}3">;
5269def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
5270  "%select{class template|class template partial|variable template|"
5271  "variable template partial|function template|member "
5272  "function|static data member|member class|member enumeration}0 "
5273  "specialization of %1 not in %select{a namespace enclosing %2|"
5274  "class %2 or an enclosing namespace}3 "
5275  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
5276def err_template_spec_redecl_global_scope : Error<
5277  "%select{class template|class template partial|variable template|"
5278  "variable template partial|function template|member "
5279  "function|static data member|member class|member enumeration}0 "
5280  "specialization of %1 must occur at global scope">;
5281def err_spec_member_not_instantiated : Error<
5282  "specialization of member %q0 does not specialize an instantiated member">;
5283def note_specialized_decl : Note<"attempt to specialize declaration here">;
5284def err_specialization_after_instantiation : Error<
5285  "explicit specialization of %0 after instantiation">;
5286def note_instantiation_required_here : Note<
5287  "%select{implicit|explicit}0 instantiation first required here">;
5288def err_template_spec_friend : Error<
5289  "template specialization declaration cannot be a friend">;
5290def err_template_spec_default_arg : Error<
5291  "default argument not permitted on an explicit "
5292  "%select{instantiation|specialization}0 of function %1">;
5293def err_not_class_template_specialization : Error<
5294  "cannot specialize a %select{dependent template|template template "
5295  "parameter}0">;
5296def ext_explicit_specialization_storage_class : ExtWarn<
5297  "explicit specialization cannot have a storage class">;
5298def err_explicit_specialization_inconsistent_storage_class : Error<
5299  "explicit specialization has extraneous, inconsistent storage class "
5300  "'%select{none|extern|static|__private_extern__|auto|register}0'">;
5301def err_dependent_function_template_spec_no_match : Error<
5302  "no candidate function template was found for dependent"
5303  " %select{member|friend}0 function template specialization">;
5304def note_dependent_function_template_spec_discard_reason : Note<
5305  "candidate ignored: %select{not a function template|"
5306  "not a member of the enclosing %select{class template|"
5307  "namespace; did you mean to explicitly qualify the specialization?}1}0">;
5308
5309// C++ class template specializations and out-of-line definitions
5310def err_template_spec_needs_header : Error<
5311  "template specialization requires 'template<>'">;
5312def err_template_spec_needs_template_parameters : Error<
5313  "template specialization or definition requires a template parameter list "
5314  "corresponding to the nested type %0">;
5315def err_template_param_list_matches_nontemplate : Error<
5316  "template parameter list matching the non-templated nested type %0 should "
5317  "be empty ('template<>')">;
5318def err_alias_template_extra_headers : Error<
5319  "extraneous template parameter list in alias template declaration">;
5320def err_template_spec_extra_headers : Error<
5321  "extraneous template parameter list in template specialization or "
5322  "out-of-line template definition">;
5323def warn_template_spec_extra_headers : Warning<
5324  "extraneous template parameter list in template specialization">;
5325def note_explicit_template_spec_does_not_need_header : Note<
5326  "'template<>' header not required for explicitly-specialized class %0 "
5327  "declared here">;
5328def err_template_qualified_declarator_no_match : Error<
5329  "nested name specifier '%0' for declaration does not refer into a class, "
5330  "class template or class template partial specialization">;
5331def err_specialize_member_of_template : Error<
5332  "cannot specialize %select{|(with 'template<>') }0a member of an "
5333  "unspecialized template">;
5334
5335// C++ Class Template Partial Specialization
5336def err_default_arg_in_partial_spec : Error<
5337    "default template argument in a class template partial specialization">;
5338def err_dependent_non_type_arg_in_partial_spec : Error<
5339    "type of specialized non-type template argument depends on a template "
5340    "parameter of the partial specialization">;
5341def note_dependent_non_type_default_arg_in_partial_spec : Note<
5342    "template parameter is used in default argument declared here">;
5343def err_dependent_typed_non_type_arg_in_partial_spec : Error<
5344    "non-type template argument specializes a template parameter with "
5345    "dependent type %0">;
5346def err_partial_spec_args_match_primary_template : Error<
5347    "%select{class|variable}0 template partial specialization does not "
5348    "specialize any template argument; to %select{declare|define}1 the "
5349    "primary template, remove the template argument list">;
5350def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
5351    "%select{class|variable}0 template partial specialization is not "
5352    "more specialized than the primary template">, DefaultError,
5353    InGroup<DiagGroup<"invalid-partial-specialization">>;
5354def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
5355def ext_partial_specs_not_deducible : ExtWarn<
5356    "%select{class|variable}0 template partial specialization contains "
5357    "%select{a template parameter|template parameters}1 that cannot be "
5358    "deduced; this partial specialization will never be used">,
5359    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
5360def note_non_deducible_parameter : Note<
5361    "non-deducible template parameter %0">;
5362def err_partial_spec_ordering_ambiguous : Error<
5363    "ambiguous partial specializations of %0">;
5364def note_partial_spec_match : Note<"partial specialization matches %0">;
5365def err_partial_spec_redeclared : Error<
5366  "class template partial specialization %0 cannot be redeclared">;
5367def note_prev_partial_spec_here : Note<
5368  "previous declaration of class template partial specialization %0 is here">;
5369def err_partial_spec_fully_specialized : Error<
5370  "partial specialization of %0 does not use any of its template parameters">;
5371
5372// C++ Variable Template Partial Specialization
5373def err_var_partial_spec_redeclared : Error<
5374  "variable template partial specialization %0 cannot be redefined">;
5375def note_var_prev_partial_spec_here : Note<
5376  "previous declaration of variable template partial specialization is here">;
5377def err_var_spec_no_template : Error<
5378  "no variable template matches%select{| partial}0 specialization">;
5379def err_var_spec_no_template_but_method : Error<
5380  "no variable template matches specialization; "
5381  "did you mean to use %0 as function template instead?">;
5382
5383// C++ Function template specializations
5384def err_function_template_spec_no_match : Error<
5385    "no function template matches function template specialization %0">;
5386def err_function_template_spec_ambiguous : Error<
5387    "function template specialization %0 ambiguously refers to more than one "
5388    "function template; explicitly specify%select{| additional}1 template "
5389    "arguments to identify a particular function template">;
5390def note_function_template_spec_matched : Note<
5391    "function template %q0 matches specialization %1">;
5392def err_function_template_partial_spec : Error<
5393    "function template partial specialization is not allowed">;
5394
5395// C++ Template Instantiation
5396def err_template_recursion_depth_exceeded : Error<
5397  "recursive template instantiation exceeded maximum depth of %0">,
5398  DefaultFatal, NoSFINAE;
5399def err_constraint_depends_on_self : Error<
5400  "satisfaction of constraint '%0' depends on itself">, NoSFINAE;
5401def note_template_recursion_depth : Note<
5402  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
5403
5404def err_template_instantiate_within_definition : Error<
5405  "%select{implicit|explicit}0 instantiation of template %1 within its"
5406  " own definition">;
5407def err_template_instantiate_undefined : Error<
5408  "%select{implicit|explicit}0 instantiation of undefined template %1">;
5409def err_implicit_instantiate_member_undefined : Error<
5410  "implicit instantiation of undefined member %0">;
5411def note_template_class_instantiation_was_here : Note<
5412  "class template %0 was instantiated here">;
5413def note_template_class_explicit_specialization_was_here : Note<
5414  "class template %0 was explicitly specialized here">;
5415def note_template_class_instantiation_here : Note<
5416  "in instantiation of template class %q0 requested here">;
5417def note_template_member_class_here : Note<
5418  "in instantiation of member class %q0 requested here">;
5419def note_template_member_function_here : Note<
5420  "in instantiation of member function %q0 requested here">;
5421def note_function_template_spec_here : Note<
5422  "in instantiation of function template specialization %q0 requested here">;
5423def note_template_static_data_member_def_here : Note<
5424  "in instantiation of static data member %q0 requested here">;
5425def note_template_variable_def_here : Note<
5426  "in instantiation of variable template specialization %q0 requested here">;
5427def note_template_enum_def_here : Note<
5428  "in instantiation of enumeration %q0 requested here">;
5429def note_template_nsdmi_here : Note<
5430  "in instantiation of default member initializer %q0 requested here">;
5431def note_template_type_alias_instantiation_here : Note<
5432  "in instantiation of template type alias %0 requested here">;
5433def note_template_exception_spec_instantiation_here : Note<
5434  "in instantiation of exception specification for %0 requested here">;
5435def note_template_requirement_instantiation_here : Note<
5436  "in instantiation of requirement here">;
5437def note_template_requirement_params_instantiation_here : Note<
5438  "in instantiation of requirement parameters here">;
5439def warn_var_template_missing : Warning<"instantiation of variable %q0 "
5440  "required here, but no definition is available">,
5441  InGroup<UndefinedVarTemplate>;
5442def warn_func_template_missing : Warning<"instantiation of function %q0 "
5443  "required here, but no definition is available">,
5444  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
5445def note_forward_template_decl : Note<
5446  "forward declaration of template entity is here">;
5447def note_inst_declaration_hint : Note<"add an explicit instantiation "
5448  "declaration to suppress this warning if %q0 is explicitly instantiated in "
5449  "another translation unit">;
5450def note_evaluating_exception_spec_here : Note<
5451  "in evaluation of exception specification for %q0 needed here">;
5452
5453def note_default_arg_instantiation_here : Note<
5454  "in instantiation of default argument for '%0' required here">;
5455def note_default_function_arg_instantiation_here : Note<
5456  "in instantiation of default function argument expression "
5457  "for '%0' required here">;
5458def note_explicit_template_arg_substitution_here : Note<
5459  "while substituting explicitly-specified template arguments into function "
5460  "template %0 %1">;
5461def note_function_template_deduction_instantiation_here : Note<
5462  "while substituting deduced template arguments into function template %0 "
5463  "%1">;
5464def note_deduced_template_arg_substitution_here : Note<
5465  "during template argument deduction for %select{class|variable}0 template "
5466  "%select{partial specialization |}1%2 %3">;
5467def note_prior_template_arg_substitution : Note<
5468  "while substituting prior template arguments into %select{non-type|template}0"
5469  " template parameter%1 %2">;
5470def note_template_default_arg_checking : Note<
5471  "while checking a default template argument used here">;
5472def note_concept_specialization_here : Note<
5473  "while checking the satisfaction of concept '%0' requested here">;
5474def note_nested_requirement_here : Note<
5475  "while checking the satisfaction of nested requirement requested here">;
5476def note_checking_constraints_for_template_id_here : Note<
5477  "while checking constraint satisfaction for template '%0' required here">;
5478def note_checking_constraints_for_var_spec_id_here : Note<
5479  "while checking constraint satisfaction for variable template "
5480  "partial specialization '%0' required here">;
5481def note_checking_constraints_for_class_spec_id_here : Note<
5482  "while checking constraint satisfaction for class template partial "
5483  "specialization '%0' required here">;
5484def note_checking_constraints_for_function_here : Note<
5485  "while checking constraint satisfaction for function '%0' required here">;
5486def note_constraint_substitution_here : Note<
5487  "while substituting template arguments into constraint expression here">;
5488def note_constraint_normalization_here : Note<
5489  "while calculating associated constraint of template '%0' here">;
5490def note_parameter_mapping_substitution_here : Note<
5491  "while substituting into concept arguments here; substitution failures not "
5492  "allowed in concept arguments">;
5493def note_building_deduction_guide_here : Note<
5494  "while building implicit deduction guide first needed here">;
5495def note_lambda_substitution_here : Note<
5496  "while substituting into a lambda expression here">;
5497def note_instantiation_contexts_suppressed : Note<
5498  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
5499  "see all)">;
5500
5501def err_field_instantiates_to_function : Error<
5502  "data member instantiated with function type %0">;
5503def err_variable_instantiates_to_function : Error<
5504  "%select{variable|static data member}0 instantiated with function type %1">;
5505def err_nested_name_spec_non_tag : Error<
5506  "type %0 cannot be used prior to '::' because it has no members">;
5507
5508def err_using_pack_expansion_empty : Error<
5509  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
5510
5511// C++ Explicit Instantiation
5512def err_explicit_instantiation_duplicate : Error<
5513    "duplicate explicit instantiation of %0">;
5514def ext_explicit_instantiation_duplicate : ExtWarn<
5515    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
5516    InGroup<MicrosoftTemplate>;
5517def note_previous_explicit_instantiation : Note<
5518    "previous explicit instantiation is here">;
5519def warn_explicit_instantiation_after_specialization : Warning<
5520  "explicit instantiation of %0 that occurs after an explicit "
5521  "specialization has no effect">,
5522  InGroup<DiagGroup<"instantiation-after-specialization">>;
5523def note_previous_template_specialization : Note<
5524    "previous template specialization is here">;
5525def err_explicit_instantiation_nontemplate_type : Error<
5526    "explicit instantiation of non-templated type %0">;
5527def note_nontemplate_decl_here : Note<
5528    "non-templated declaration is here">;
5529def err_explicit_instantiation_in_class : Error<
5530  "explicit instantiation of %0 in class scope">;
5531def err_explicit_instantiation_out_of_scope : Error<
5532  "explicit instantiation of %0 not in a namespace enclosing %1">;
5533def err_explicit_instantiation_must_be_global : Error<
5534  "explicit instantiation of %0 must occur at global scope">;
5535def warn_explicit_instantiation_out_of_scope_0x : Warning<
5536  "explicit instantiation of %0 not in a namespace enclosing %1">,
5537  InGroup<CXX11Compat>, DefaultIgnore;
5538def warn_explicit_instantiation_must_be_global_0x : Warning<
5539  "explicit instantiation of %0 must occur at global scope">,
5540  InGroup<CXX11Compat>, DefaultIgnore;
5541
5542def err_explicit_instantiation_requires_name : Error<
5543  "explicit instantiation declaration requires a name">;
5544def err_explicit_instantiation_of_typedef : Error<
5545  "explicit instantiation of typedef %0">;
5546def err_explicit_instantiation_storage_class : Error<
5547  "explicit instantiation cannot have a storage class">;
5548def err_explicit_instantiation_internal_linkage : Error<
5549  "explicit instantiation declaration of %0 with internal linkage">;
5550def err_explicit_instantiation_not_known : Error<
5551  "explicit instantiation of %0 does not refer to a function template, "
5552  "variable template, member function, member class, or static data member">;
5553def note_explicit_instantiation_here : Note<
5554  "explicit instantiation refers here">;
5555def err_explicit_instantiation_data_member_not_instantiated : Error<
5556  "explicit instantiation refers to static data member %q0 that is not an "
5557  "instantiation">;
5558def err_explicit_instantiation_member_function_not_instantiated : Error<
5559  "explicit instantiation refers to member function %q0 that is not an "
5560  "instantiation">;
5561def err_explicit_instantiation_ambiguous : Error<
5562  "partial ordering for explicit instantiation of %0 is ambiguous">;
5563def note_explicit_instantiation_candidate : Note<
5564  "explicit instantiation candidate function %q0 template here %1">;
5565def err_explicit_instantiation_inline : Error<
5566  "explicit instantiation cannot be 'inline'">;
5567def warn_explicit_instantiation_inline_0x : Warning<
5568  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5569  DefaultIgnore;
5570def err_explicit_instantiation_constexpr : Error<
5571  "explicit instantiation cannot be 'constexpr'">;
5572def ext_explicit_instantiation_without_qualified_id : Extension<
5573  "qualifier in explicit instantiation of %q0 requires a template-id "
5574  "(a typedef is not permitted)">;
5575def err_explicit_instantiation_without_template_id : Error<
5576  "explicit instantiation of %q0 must specify a template argument list">;
5577def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5578  "explicit instantiation of %q0 must occur in namespace %1">;
5579def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5580  "explicit instantiation of %q0 must occur in namespace %1">,
5581  InGroup<CXX11Compat>, DefaultIgnore;
5582def err_explicit_instantiation_undefined_member : Error<
5583  "explicit instantiation of undefined %select{member class|member function|"
5584  "static data member}0 %1 of class template %2">;
5585def err_explicit_instantiation_undefined_func_template : Error<
5586  "explicit instantiation of undefined function template %0">;
5587def err_explicit_instantiation_undefined_var_template : Error<
5588  "explicit instantiation of undefined variable template %q0">;
5589def err_explicit_instantiation_declaration_after_definition : Error<
5590  "explicit instantiation declaration (with 'extern') follows explicit "
5591  "instantiation definition (without 'extern')">;
5592def note_explicit_instantiation_definition_here : Note<
5593  "explicit instantiation definition is here">;
5594def err_invalid_var_template_spec_type : Error<"type %2 "
5595  "of %select{explicit instantiation|explicit specialization|"
5596  "partial specialization|redeclaration}0 of %1 does not match"
5597  " expected type %3">;
5598def err_mismatched_exception_spec_explicit_instantiation : Error<
5599  "exception specification in explicit instantiation does not match "
5600  "instantiated one">;
5601def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5602  err_mismatched_exception_spec_explicit_instantiation.Summary>,
5603  InGroup<MicrosoftExceptionSpec>;
5604def err_explicit_instantiation_dependent : Error<
5605  "explicit instantiation has dependent template arguments">;
5606
5607// C++ typename-specifiers
5608def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5609def err_typename_nested_not_found_enable_if : Error<
5610  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5611  "this declaration">;
5612def err_typename_nested_not_found_requirement : Error<
5613  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5614  "declaration">;
5615def err_typename_nested_not_type : Error<
5616    "typename specifier refers to non-type member %0 in %1">;
5617def err_typename_not_type : Error<
5618    "typename specifier refers to non-type %0">;
5619def note_typename_member_refers_here : Note<
5620    "referenced member %0 is declared here">;
5621def note_typename_refers_here : Note<
5622    "referenced %0 is declared here">;
5623def err_typename_missing : Error<
5624  "missing 'typename' prior to dependent type name '%0%1'">;
5625def err_typename_missing_template : Error<
5626  "missing 'typename' prior to dependent type template name '%0%1'">;
5627def ext_typename_missing : ExtWarn<
5628  "missing 'typename' prior to dependent type name '%0%1'">,
5629  InGroup<DiagGroup<"typename-missing">>;
5630def ext_typename_outside_of_template : ExtWarn<
5631  "'typename' occurs outside of a template">, InGroup<CXX11>;
5632def warn_cxx98_compat_typename_outside_of_template : Warning<
5633  "use of 'typename' outside of a template is incompatible with C++98">,
5634  InGroup<CXX98Compat>, DefaultIgnore;
5635def err_typename_refers_to_using_value_decl : Error<
5636  "typename specifier refers to a dependent using declaration for a value "
5637  "%0 in %1">;
5638def note_using_value_decl_missing_typename : Note<
5639  "add 'typename' to treat this using declaration as a type">;
5640def warn_cxx17_compat_implicit_typename : Warning<"use of implicit 'typename' is "
5641  "incompatible with C++ standards before C++20">, InGroup<CXX20Compat>,
5642  DefaultIgnore;
5643def ext_implicit_typename : ExtWarn<"missing 'typename' prior to dependent "
5644  "type name %0%1; implicit 'typename' is a C++20 extension">,
5645  InGroup<CXX20>;
5646
5647def err_template_kw_refers_to_non_template : Error<
5648  "%0%select{| following the 'template' keyword}1 "
5649  "does not refer to a template">;
5650def note_template_kw_refers_to_non_template : Note<
5651  "declared as a non-template here">;
5652def err_template_kw_refers_to_dependent_non_template : Error<
5653  "%0%select{| following the 'template' keyword}1 "
5654  "cannot refer to a dependent template">;
5655def err_template_kw_refers_to_type_template : Error<
5656  "'%0%1' is expected to be a non-type template, but instantiated to a %select{class|type alias}2 template">;
5657def note_referenced_type_template : Note<
5658  "%select{class|type alias}0 template declared here">;
5659def err_template_kw_missing : Error<
5660  "missing 'template' keyword prior to dependent template name '%0%1'">;
5661def ext_template_outside_of_template : ExtWarn<
5662  "'template' keyword outside of a template">, InGroup<CXX11>;
5663def warn_cxx98_compat_template_outside_of_template : Warning<
5664  "use of 'template' keyword outside of a template is incompatible with C++98">,
5665  InGroup<CXX98Compat>, DefaultIgnore;
5666
5667def err_non_type_template_in_nested_name_specifier : Error<
5668  "qualified name refers into a specialization of %select{function|variable}0 "
5669  "template %1">;
5670def err_template_id_not_a_type : Error<
5671  "template name refers to non-type template %0">;
5672def note_template_declared_here : Note<
5673  "%select{function template|class template|variable template"
5674  "|type alias template|template template parameter}0 "
5675  "%1 declared here">;
5676def err_template_expansion_into_fixed_list : Error<
5677  "pack expansion used as argument for non-pack parameter of %select{alias "
5678  "template|concept}0">;
5679def note_parameter_type : Note<
5680  "parameter of type %0 is declared here">;
5681
5682// C++11 Variadic Templates
5683def err_template_param_pack_default_arg : Error<
5684  "template parameter pack cannot have a default argument">;
5685def err_template_param_pack_must_be_last_template_parameter : Error<
5686  "template parameter pack must be the last template parameter">;
5687
5688def err_template_parameter_pack_non_pack : Error<
5689  "%select{template type|non-type template|template template}0 parameter"
5690  "%select{| pack}1 conflicts with previous %select{template type|"
5691  "non-type template|template template}0 parameter%select{ pack|}1">;
5692def note_template_parameter_pack_non_pack : Note<
5693  "%select{template type|non-type template|template template}0 parameter"
5694  "%select{| pack}1 does not match %select{template type|non-type template"
5695  "|template template}0 parameter%select{ pack|}1 in template argument">;
5696def note_template_parameter_pack_here : Note<
5697  "previous %select{template type|non-type template|template template}0 "
5698  "parameter%select{| pack}1 declared here">;
5699
5700def err_unexpanded_parameter_pack : Error<
5701  "%select{expression|base type|declaration type|data member type|bit-field "
5702  "size|static assertion|fixed underlying type|enumerator value|"
5703  "using declaration|friend declaration|qualifier|initializer|default argument|"
5704  "non-type template parameter type|exception type|explicit specialization|"
5705  "partial specialization|__if_exists name|__if_not_exists name|lambda|block|"
5706  "type constraint|requirement|requires clause}0 "
5707  "contains%plural{0: an|:}1 unexpanded parameter pack"
5708  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5709
5710def err_pack_expansion_without_parameter_packs : Error<
5711  "pack expansion does not contain any unexpanded parameter packs">;
5712def err_pack_expansion_length_conflict : Error<
5713  "pack expansion contains parameter packs %0 and %1 that have different "
5714  "lengths (%2 vs. %3)">;
5715def err_pack_expansion_length_conflict_multilevel : Error<
5716  "pack expansion contains parameter pack %0 that has a different "
5717  "length (%1 vs. %2) from outer parameter packs">;
5718def err_pack_expansion_length_conflict_partial : Error<
5719  "pack expansion contains parameter pack %0 that has a different "
5720  "length (at least %1 vs. %2) from outer parameter packs">;
5721def err_pack_expansion_member_init : Error<
5722  "pack expansion for initialization of member %0">;
5723
5724def err_function_parameter_pack_without_parameter_packs : Error<
5725  "type %0 of function parameter pack does not contain any unexpanded "
5726  "parameter packs">;
5727def err_ellipsis_in_declarator_not_parameter : Error<
5728  "only function and template parameters can be parameter packs">;
5729
5730def err_sizeof_pack_no_pack_name : Error<
5731  "%0 does not refer to the name of a parameter pack">;
5732
5733def err_fold_expression_packs_both_sides : Error<
5734  "binary fold expression has unexpanded parameter packs in both operands">;
5735def err_fold_expression_empty : Error<
5736  "unary fold expression has empty expansion for operator '%0' "
5737  "with no fallback value">;
5738def err_fold_expression_bad_operand : Error<
5739  "expression not permitted as operand of fold expression">;
5740def err_fold_expression_limit_exceeded: Error<
5741  "instantiating fold expression with %0 arguments exceeded expression nesting "
5742  "limit of %1">, DefaultFatal, NoSFINAE;
5743
5744def err_unexpected_typedef : Error<
5745  "unexpected type name %0: expected expression">;
5746def err_unexpected_namespace : Error<
5747  "unexpected namespace name %0: expected expression">;
5748def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5749def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5750  "use of undeclared identifier %0; "
5751  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5752  InGroup<MicrosoftTemplate>;
5753def err_found_in_dependent_base : Error<
5754  "explicit qualification required to use member %0 from dependent base class">;
5755def ext_found_in_dependent_base : ExtWarn<"use of member %0 "
5756  "found via unqualified lookup into dependent bases of class templates is a "
5757  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5758def err_found_later_in_class : Error<"member %0 used before its declaration">;
5759def ext_found_later_in_class : ExtWarn<
5760  "use of member %0 before its declaration is a Microsoft extension">,
5761  InGroup<MicrosoftTemplate>;
5762def ext_unqualified_base_class : ExtWarn<
5763  "unqualified base initializer of class templates is a Microsoft extension">,
5764  InGroup<MicrosoftTemplate>;
5765def note_dependent_member_use : Note<
5766  "must qualify identifier to find this declaration in dependent base class">;
5767def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5768    "visible in the template definition nor found by argument-dependent lookup">;
5769def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5770    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5771def err_undeclared_use : Error<"use of undeclared %0">;
5772def warn_deprecated : Warning<"%0 is deprecated">,
5773    InGroup<DeprecatedDeclarations>;
5774def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5775def warn_property_method_deprecated :
5776    Warning<"property access is using %0 method which is deprecated">,
5777    InGroup<DeprecatedDeclarations>;
5778def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5779    InGroup<DeprecatedDeclarations>;
5780def warn_deprecated_anonymous_namespace : Warning<
5781  "'deprecated' attribute on anonymous namespace ignored">,
5782  InGroup<IgnoredAttributes>;
5783def warn_deprecated_fwdclass_message : Warning<
5784    "%0 may be deprecated because the receiver type is unknown">,
5785    InGroup<DeprecatedDeclarations>;
5786def warn_deprecated_def : Warning<
5787  "implementing deprecated %select{method|class|category}0">,
5788  InGroup<DeprecatedImplementations>, DefaultIgnore;
5789def warn_unavailable_def : Warning<
5790  "implementing unavailable method">,
5791  InGroup<DeprecatedImplementations>, DefaultIgnore;
5792def warn_deprecated_builtin : Warning<
5793  "builtin %0 is deprecated; use %1 instead">,
5794  InGroup<DeprecatedBuiltins>;
5795def err_unavailable : Error<"%0 is unavailable">;
5796def err_property_method_unavailable :
5797    Error<"property access is using %0 method which is unavailable">;
5798def err_unavailable_message : Error<"%0 is unavailable: %1">;
5799def warn_unavailable_fwdclass_message : Warning<
5800    "%0 may be unavailable because the receiver type is unknown">,
5801    InGroup<UnavailableDeclarations>;
5802def note_availability_specified_here : Note<
5803  "%0 has been explicitly marked "
5804  "%select{unavailable|deleted|deprecated}1 here">;
5805def note_partial_availability_specified_here : Note<
5806  "%0 has been marked as being introduced in %1 %2 here, "
5807  "but the deployment target is %1 %3">;
5808def note_implicitly_deleted : Note<
5809  "explicitly defaulted function was implicitly deleted here">;
5810def warn_not_enough_argument : Warning<
5811  "not enough variable arguments in %0 declaration to fit a sentinel">,
5812  InGroup<Sentinel>;
5813def warn_missing_sentinel : Warning <
5814  "missing sentinel in %select{function call|method dispatch|block call}0">,
5815  InGroup<Sentinel>;
5816def note_sentinel_here : Note<
5817  "%select{function|method|block}0 has been explicitly marked sentinel here">;
5818def warn_strict_uses_without_prototype : Warning<
5819  "passing arguments to %select{a function|%1}0 without a prototype is "
5820  "deprecated in all versions of C and is not supported in C23">,
5821  InGroup<DeprecatedNonPrototype>;
5822def warn_missing_prototype : Warning<
5823  "no previous prototype for function %0">,
5824  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5825def note_declaration_not_a_prototype : Note<
5826  "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5827  "to make it %select{a prototype for a zero-parameter function|one}0">;
5828// This is not actually an extension, but we only want it to be enabled in
5829// -pedantic mode and this is the most direct way of accomplishing that.
5830def warn_strict_prototypes : Extension<
5831  "a %select{function|block}0 declaration without a prototype is deprecated "
5832  "%select{in all versions of C|}0">, InGroup<StrictPrototypes>;
5833def warn_non_prototype_changes_behavior : Warning<
5834  "a function %select{declaration|definition}0 without a prototype is "
5835  "deprecated in all versions of C %select{and is not supported in C23|and is "
5836  "treated as a zero-parameter prototype in C23, conflicting with a "
5837  "%select{previous|subsequent}2 %select{declaration|definition}3}1">,
5838  InGroup<DeprecatedNonPrototype>;
5839def note_conflicting_prototype : Note<"conflicting prototype is here">;
5840def warn_missing_variable_declarations : Warning<
5841  "no previous extern declaration for non-static variable %0">,
5842  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5843def note_static_for_internal_linkage : Note<
5844  "declare 'static' if the %select{variable|function}0 is not intended to be "
5845  "used outside of this translation unit">;
5846def err_static_data_member_reinitialization :
5847  Error<"static data member %0 already has an initializer">;
5848def err_redefinition : Error<"redefinition of %0">;
5849def err_alias_after_tentative :
5850  Error<"alias definition of %0 after tentative definition">;
5851def err_alias_is_definition :
5852  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5853def err_definition_of_implicitly_declared_member : Error<
5854  "definition of implicitly declared %select{default constructor|copy "
5855  "constructor|move constructor|copy assignment operator|move assignment "
5856  "operator|destructor|function}1">;
5857def err_definition_of_explicitly_defaulted_member : Error<
5858  "definition of explicitly defaulted %select{default constructor|copy "
5859  "constructor|move constructor|copy assignment operator|move assignment "
5860  "operator|destructor|function}0">;
5861def err_redefinition_extern_inline : Error<
5862  "redefinition of a 'extern inline' function %0 is not supported in "
5863  "%select{C99 mode|C++}1">;
5864def warn_attr_abi_tag_namespace : Warning<
5865  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5866  InGroup<IgnoredAttributes>;
5867def err_abi_tag_on_redeclaration : Error<
5868  "cannot add 'abi_tag' attribute in a redeclaration">;
5869def err_new_abi_tag_on_redeclaration : Error<
5870  "'abi_tag' %0 missing in original declaration">;
5871def note_use_ifdef_guards : Note<
5872  "unguarded header; consider using #ifdef guards or #pragma once">;
5873
5874def warn_var_decl_not_read_only : Warning<
5875  "object of type %0 cannot be placed in read-only memory">,
5876  InGroup<ReadOnlyPlacementChecks>;
5877def note_enforce_read_only_placement : Note<"type was declared read-only here">;
5878
5879
5880def note_deleted_dtor_no_operator_delete : Note<
5881  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5882def note_deleted_special_member_class_subobject : Note<
5883  "%select{default constructor of|copy constructor of|move constructor of|"
5884  "copy assignment operator of|move assignment operator of|destructor of|"
5885  "constructor inherited by}0 "
5886  "%1 is implicitly deleted because "
5887  "%select{base class %3|%select{||||variant }4field %3}2 "
5888  "%select{has "
5889  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5890  "%select{%select{default constructor|copy constructor|move constructor|copy "
5891  "assignment operator|move assignment operator|destructor|"
5892  "%select{default|corresponding|default|default|default}4 constructor}0|"
5893  "destructor}5"
5894  "%select{||s||}4"
5895  "|is an ObjC pointer}6">;
5896def note_deleted_default_ctor_uninit_field : Note<
5897  "%select{default constructor of|constructor inherited by}0 "
5898  "%1 is implicitly deleted because field %2 of "
5899  "%select{reference|const-qualified}4 type %3 would not be initialized">;
5900def note_deleted_default_ctor_all_const : Note<
5901  "%select{default constructor of|constructor inherited by}0 "
5902  "%1 is implicitly deleted because all "
5903  "%select{data members|data members of an anonymous union member}2"
5904  " are const-qualified">;
5905def note_deleted_copy_ctor_rvalue_reference : Note<
5906  "copy constructor of %0 is implicitly deleted because field %1 is of "
5907  "rvalue reference type %2">;
5908def note_deleted_copy_user_declared_move : Note<
5909  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5910  " %1 has a user-declared move %select{constructor|assignment operator}2">;
5911def note_deleted_assign_field : Note<
5912  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5913  "because field %2 is of %select{reference|const-qualified}4 type %3">;
5914
5915// These should be errors.
5916def warn_undefined_internal : Warning<
5917  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5918  InGroup<DiagGroup<"undefined-internal">>;
5919def err_undefined_internal_type : Error<
5920  "%select{function|variable}0 %q1 is used but not defined in this "
5921  "translation unit, and cannot be defined in any other translation unit "
5922  "because its type does not have linkage">;
5923def ext_undefined_internal_type : Extension<
5924  "ISO C++ requires a definition in this translation unit for "
5925  "%select{function|variable}0 %q1 because its type does not have linkage">,
5926  InGroup<DiagGroup<"undefined-internal-type">>;
5927def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5928  InGroup<DiagGroup<"undefined-inline">>;
5929def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5930def note_used_here : Note<"used here">;
5931
5932def err_attribute_missing_on_first_decl : Error<
5933  "%0 attribute does not appear on the first declaration">;
5934def warn_internal_linkage_local_storage : Warning<
5935  "'internal_linkage' attribute on a non-static local variable is ignored">,
5936  InGroup<IgnoredAttributes>;
5937
5938def ext_internal_in_extern_inline : ExtWarn<
5939  "static %select{function|variable}0 %1 is used in an inline function with "
5940  "external linkage">, InGroup<StaticInInline>;
5941def ext_internal_in_extern_inline_quiet : Extension<
5942  "static %select{function|variable}0 %1 is used in an inline function with "
5943  "external linkage">, InGroup<StaticInInline>;
5944def warn_static_local_in_extern_inline : Warning<
5945  "non-constant static local variable in inline function may be different "
5946  "in different files">, InGroup<StaticLocalInInline>;
5947def note_convert_inline_to_static : Note<
5948  "use 'static' to give inline function %0 internal linkage">;
5949
5950def ext_redefinition_of_typedef : ExtWarn<
5951  "redefinition of typedef %0 is a C11 feature">,
5952  InGroup<DiagGroup<"typedef-redefinition"> >;
5953def err_redefinition_variably_modified_typedef : Error<
5954  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5955
5956def err_inline_decl_follows_def : Error<
5957  "inline declaration of %0 follows non-inline definition">;
5958def err_inline_declaration_block_scope : Error<
5959  "inline declaration of %0 not allowed in block scope">;
5960def err_static_non_static : Error<
5961  "static declaration of %0 follows non-static declaration">;
5962def err_different_language_linkage : Error<
5963  "declaration of %0 has a different language linkage">;
5964def ext_retained_language_linkage : Extension<
5965  "friend function %0 retaining previous language linkage is an extension">,
5966  InGroup<DiagGroup<"retained-language-linkage">>;
5967def err_extern_c_global_conflict : Error<
5968  "declaration of %1 %select{with C language linkage|in global scope}0 "
5969  "conflicts with declaration %select{in global scope|with C language linkage}0">;
5970def note_extern_c_global_conflict : Note<
5971  "declared %select{in global scope|with C language linkage}0 here">;
5972def note_extern_c_begins_here : Note<
5973  "extern \"C\" language linkage specification begins here">;
5974def warn_weak_import : Warning <
5975  "an already-declared variable is made a weak_import declaration %0">;
5976def ext_static_non_static : Extension<
5977  "redeclaring non-static %0 as static is a Microsoft extension">,
5978  InGroup<MicrosoftRedeclareStatic>;
5979def err_non_static_static : Error<
5980  "non-static declaration of %0 follows static declaration">;
5981def err_extern_non_extern : Error<
5982  "extern declaration of %0 follows non-extern declaration">;
5983def err_non_extern_extern : Error<
5984  "non-extern declaration of %0 follows extern declaration">;
5985def err_non_thread_thread : Error<
5986  "non-thread-local declaration of %0 follows thread-local declaration">;
5987def err_thread_non_thread : Error<
5988  "thread-local declaration of %0 follows non-thread-local declaration">;
5989def err_thread_thread_different_kind : Error<
5990  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5991  "follows declaration with %select{dynamic|static}1 initialization">;
5992def err_mismatched_owning_module : Error<
5993  "declaration of %0 in %select{the global module|module %2}1 follows "
5994  "declaration in %select{the global module|module %4}3">;
5995def err_redefinition_different_type : Error<
5996  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5997def err_redefinition_different_kind : Error<
5998  "redefinition of %0 as different kind of symbol">;
5999def err_redefinition_different_namespace_alias : Error<
6000  "redefinition of %0 as an alias for a different namespace">;
6001def note_previous_namespace_alias : Note<
6002  "previously defined as an alias for %0">;
6003def warn_forward_class_redefinition : Warning<
6004  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
6005  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
6006def err_redefinition_different_typedef : Error<
6007  "%select{typedef|type alias|type alias template}0 "
6008  "redefinition with different types%diff{ ($ vs $)|}1,2">;
6009def err_redefinition_different_concept : Error<
6010  "redefinition of concept %0 with different template parameters or requirements">;
6011def err_tag_reference_non_tag : Error<
6012  "%select{non-struct type|non-class type|non-union type|non-enum "
6013  "type|typedef|type alias|template|type alias template|template "
6014  "template argument}1 %0 cannot be referenced with a "
6015  "%select{struct|interface|union|class|enum}2 specifier">;
6016def err_tag_reference_conflict : Error<
6017  "implicit declaration introduced by elaborated type conflicts with a "
6018  "%select{non-struct type|non-class type|non-union type|non-enum "
6019  "type|typedef|type alias|template|type alias template|template "
6020  "template argument}0 of the same name">;
6021def err_dependent_tag_decl : Error<
6022  "%select{declaration|definition}0 of "
6023  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
6024def err_tag_definition_of_typedef : Error<
6025  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
6026def err_conflicting_types : Error<"conflicting types for %0">;
6027def err_different_pass_object_size_params : Error<
6028  "conflicting pass_object_size attributes on parameters">;
6029def err_late_asm_label_name : Error<
6030  "cannot apply asm label to %select{variable|function}0 after its first use">;
6031def err_different_asm_label : Error<"conflicting asm label">;
6032def err_nested_redefinition : Error<"nested redefinition of %0">;
6033def err_use_with_wrong_tag : Error<
6034  "use of %0 with tag type that does not match previous declaration">;
6035def warn_struct_class_tag_mismatch : Warning<
6036  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
6037  "declared as a %select{struct|interface|class}3%select{| template}1; "
6038  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
6039  InGroup<MismatchedTags>, DefaultIgnore;
6040def warn_struct_class_previous_tag_mismatch : Warning<
6041  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
6042  "here but previously declared as "
6043  "%select{a struct|an interface|a class}3%select{| template}1; "
6044  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
6045  InGroup<MismatchedTags>, DefaultIgnore;
6046def note_struct_class_suggestion : Note<
6047  "did you mean %select{struct|interface|class}0 here?">;
6048def ext_forward_ref_enum : Extension<
6049  "ISO C forbids forward references to 'enum' types">;
6050def err_forward_ref_enum : Error<
6051  "ISO C++ forbids forward references to 'enum' types">;
6052def ext_ms_forward_ref_enum : ExtWarn<
6053  "forward references to 'enum' types are a Microsoft extension">,
6054  InGroup<MicrosoftEnumForwardReference>;
6055def ext_forward_ref_enum_def : Extension<
6056  "redeclaration of already-defined enum %0 is a GNU extension">,
6057  InGroup<GNURedeclaredEnum>;
6058
6059def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
6060def err_duplicate_member : Error<"duplicate member %0">;
6061def err_misplaced_ivar : Error<
6062  "instance variables may not be placed in %select{categories|class extension}0">;
6063def warn_ivars_in_interface : Warning<
6064  "declaration of instance variables in the interface is deprecated">,
6065  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
6066def ext_enum_value_not_int : Extension<
6067  "ISO C restricts enumerator values to range of 'int' (%0 is too "
6068  "%select{small|large}1)">;
6069def ext_enum_too_large : ExtWarn<
6070  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
6071def ext_enumerator_increment_too_large : ExtWarn<
6072  "incremented enumerator value %0 is not representable in the "
6073  "largest integer type">, InGroup<EnumTooLarge>;
6074def warn_flag_enum_constant_out_of_range : Warning<
6075  "enumeration value %0 is out of range of flags in enumeration type %1">,
6076  InGroup<FlagEnum>;
6077
6078def err_vm_decl_in_file_scope : Error<
6079  "variably modified type declaration not allowed at file scope">;
6080def err_vm_decl_has_extern_linkage : Error<
6081  "variably modified type declaration cannot have 'extern' linkage">;
6082def err_typecheck_field_variable_size : Error<
6083  "fields must have a constant size: 'variable length array in structure' "
6084  "extension will never be supported">;
6085def err_vm_func_decl : Error<
6086  "function declaration cannot have variably modified type">;
6087def err_array_too_large : Error<
6088  "array is too large (%0 elements)">;
6089
6090def err_typecheck_negative_array_size : Error<"array size is negative">;
6091def warn_typecheck_function_qualifiers_ignored : Warning<
6092  "'%0' qualifier on function type %1 has no effect">,
6093  InGroup<IgnoredQualifiers>;
6094def warn_typecheck_function_qualifiers_unspecified : Warning<
6095  "'%0' qualifier on function type %1 has unspecified behavior">;
6096def warn_typecheck_reference_qualifiers : Warning<
6097  "'%0' qualifier on reference type %1 has no effect">,
6098  InGroup<IgnoredReferenceQualifiers>;
6099def err_typecheck_invalid_restrict_not_pointer : Error<
6100  "restrict requires a pointer or reference (%0 is invalid)">;
6101def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
6102  "restrict requires a pointer or reference">;
6103def err_typecheck_invalid_restrict_invalid_pointee : Error<
6104  "pointer to function type %0 may not be 'restrict' qualified">;
6105def ext_typecheck_zero_array_size : Extension<
6106  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
6107def err_typecheck_zero_array_size : Error<
6108  "zero-length arrays are not permitted in %select{C++|SYCL device code}0">;
6109def err_array_size_non_int : Error<"size of array has non-integer type %0">;
6110def err_init_element_not_constant : Error<
6111  "initializer element is not a compile-time constant">;
6112def ext_aggregate_init_not_constant : Extension<
6113  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
6114def err_local_cant_init : Error<
6115  "'__local' variable cannot have an initializer">;
6116def err_loader_uninitialized_cant_init
6117    : Error<"variable with 'loader_uninitialized' attribute cannot have an "
6118            "initializer">;
6119def err_loader_uninitialized_trivial_ctor
6120    : Error<"variable with 'loader_uninitialized' attribute must have a "
6121            "trivial default constructor">;
6122def err_loader_uninitialized_redeclaration
6123    : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
6124def err_loader_uninitialized_extern_decl
6125    : Error<"variable %0 cannot be declared both 'extern' and with the "
6126            "'loader_uninitialized' attribute">;
6127def err_block_extern_cant_init : Error<
6128  "declaration of block scope identifier with linkage cannot have an initializer">;
6129def warn_extern_init : Warning<"'extern' variable has an initializer">,
6130  InGroup<DiagGroup<"extern-initializer">>;
6131def err_variable_object_no_init : Error<
6132  "variable-sized object may not be initialized">;
6133def err_excess_initializers : Error<
6134  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
6135def ext_excess_initializers : ExtWarn<
6136  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
6137  InGroup<ExcessInitializers>;
6138def err_excess_initializers_for_sizeless_type : Error<
6139  "excess elements in initializer for indivisible sizeless type %0">;
6140def ext_excess_initializers_for_sizeless_type : ExtWarn<
6141  "excess elements in initializer for indivisible sizeless type %0">,
6142  InGroup<ExcessInitializers>;
6143def err_excess_initializers_in_char_array_initializer : Error<
6144  "excess elements in char array initializer">;
6145def ext_excess_initializers_in_char_array_initializer : ExtWarn<
6146  "excess elements in char array initializer">,
6147  InGroup<ExcessInitializers>;
6148def err_initializer_string_for_char_array_too_long : Error<
6149  "initializer-string for char array is too long, array size is %0 but initializer has size %1 (including the null terminating character)">;
6150def ext_initializer_string_for_char_array_too_long : ExtWarn<
6151  "initializer-string for char array is too long">,
6152  InGroup<ExcessInitializers>;
6153def warn_missing_field_initializers : Warning<
6154  "missing field %0 initializer">,
6155  InGroup<MissingFieldInitializers>, DefaultIgnore;
6156def warn_braces_around_init : Warning<
6157  "braces around %select{scalar |}0initializer">,
6158  InGroup<DiagGroup<"braced-scalar-init">>;
6159def ext_many_braces_around_init : ExtWarn<
6160  "too many braces around %select{scalar |}0initializer">,
6161  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
6162def ext_complex_component_init : Extension<
6163  "complex initialization specifying real and imaginary components "
6164  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
6165def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
6166def err_empty_sizeless_initializer : Error<
6167  "initializer for sizeless type %0 cannot be empty">;
6168def warn_cxx98_compat_empty_scalar_initializer : Warning<
6169  "scalar initialized from empty initializer list is incompatible with C++98">,
6170  InGroup<CXX98Compat>, DefaultIgnore;
6171def warn_cxx98_compat_empty_sizeless_initializer : Warning<
6172  "initializing %0 from an empty initializer list is incompatible with C++98">,
6173  InGroup<CXX98Compat>, DefaultIgnore;
6174def warn_cxx98_compat_reference_list_init : Warning<
6175  "reference initialized from initializer list is incompatible with C++98">,
6176  InGroup<CXX98Compat>, DefaultIgnore;
6177def warn_cxx98_compat_initializer_list_init : Warning<
6178  "initialization of initializer_list object is incompatible with C++98">,
6179  InGroup<CXX98Compat>, DefaultIgnore;
6180def warn_cxx98_compat_ctor_list_init : Warning<
6181  "constructor call from initializer list is incompatible with C++98">,
6182  InGroup<CXX98Compat>, DefaultIgnore;
6183def err_illegal_initializer : Error<
6184  "illegal initializer (only variables can be initialized)">;
6185def err_illegal_initializer_type : Error<"illegal initializer type %0">;
6186def ext_init_list_type_narrowing : ExtWarn<
6187  "type %0 cannot be narrowed to %1 in initializer list">,
6188  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6189def ext_init_list_type_narrowing_const_reference : ExtWarn<
6190  ext_init_list_type_narrowing.Summary>,
6191  InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6192def ext_init_list_variable_narrowing : ExtWarn<
6193  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6194  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6195def ext_init_list_variable_narrowing_const_reference : ExtWarn<
6196  ext_init_list_variable_narrowing.Summary>, InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6197def ext_init_list_constant_narrowing : ExtWarn<
6198  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
6199  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6200def ext_init_list_constant_narrowing_const_reference : ExtWarn<
6201  ext_init_list_constant_narrowing.Summary>,
6202  InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6203def warn_init_list_type_narrowing : Warning<
6204  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
6205  InGroup<CXX11Narrowing>, DefaultIgnore;
6206def warn_init_list_variable_narrowing : Warning<
6207  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6208  "initializer list in C++11">,
6209  InGroup<CXX11Narrowing>, DefaultIgnore;
6210def warn_init_list_constant_narrowing : Warning<
6211  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
6212  "C++11">,
6213  InGroup<CXX11Narrowing>, DefaultIgnore;
6214def note_init_list_narrowing_silence : Note<
6215  "insert an explicit cast to silence this issue">;
6216def err_init_objc_class : Error<
6217  "cannot initialize Objective-C class type %0">;
6218def err_implicit_empty_initializer : Error<
6219  "initializer for aggregate with no elements requires explicit braces">;
6220def err_bitfield_has_negative_width : Error<
6221  "bit-field %0 has negative width (%1)">;
6222def err_anon_bitfield_has_negative_width : Error<
6223  "anonymous bit-field has negative width (%0)">;
6224def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
6225def err_bitfield_width_exceeds_type_width : Error<
6226  "width of%select{ anonymous|}0 bit-field%select{| %1}0 (%2 bits) exceeds the "
6227  "%select{width|size}3 of its type (%4 bit%s4)">;
6228def err_incorrect_number_of_vector_initializers : Error<
6229  "number of elements must be either one or match the size of the vector">;
6230
6231// Used by C++ which allows bit-fields that are wider than the type.
6232def warn_bitfield_width_exceeds_type_width: Warning<
6233  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
6234  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
6235def err_bitfield_too_wide : Error<
6236  "%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
6237def warn_bitfield_too_small_for_enum : Warning<
6238  "bit-field %0 is not wide enough to store all enumerators of %1">,
6239  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6240def note_widen_bitfield : Note<
6241  "widen this field to %0 bits to store all values of %1">;
6242def warn_unsigned_bitfield_assigned_signed_enum : Warning<
6243  "assigning value of signed enum type %1 to unsigned bit-field %0; "
6244  "negative enumerators of enum %1 will be converted to positive values">,
6245  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6246def warn_signed_bitfield_enum_conversion : Warning<
6247  "signed bit-field %0 needs an extra bit to represent the largest positive "
6248  "enumerators of %1">,
6249  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6250def note_change_bitfield_sign : Note<
6251  "consider making the bitfield type %select{unsigned|signed}0">;
6252
6253def warn_missing_braces : Warning<
6254  "suggest braces around initialization of subobject">,
6255  InGroup<MissingBraces>, DefaultIgnore;
6256
6257def err_redefinition_of_label : Error<"redefinition of label %0">;
6258def err_undeclared_label_use : Error<"use of undeclared label %0">;
6259def err_goto_ms_asm_label : Error<
6260  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
6261def note_goto_ms_asm_label : Note<
6262  "inline assembly label %0 declared here">;
6263def warn_unused_label : Warning<"unused label %0">,
6264  InGroup<UnusedLabel>, DefaultIgnore;
6265
6266def err_continue_from_cond_var_init : Error<
6267  "cannot jump from this continue statement to the loop increment; "
6268  "jump bypasses initialization of loop condition variable">;
6269def err_goto_into_protected_scope : Error<
6270  "cannot jump from this goto statement to its label">;
6271def ext_goto_into_protected_scope : ExtWarn<
6272  "jump from this goto statement to its label is a Microsoft extension">,
6273  InGroup<MicrosoftGoto>;
6274def warn_cxx98_compat_goto_into_protected_scope : Warning<
6275  "jump from this goto statement to its label is incompatible with C++98">,
6276  InGroup<CXX98Compat>, DefaultIgnore;
6277def err_switch_into_protected_scope : Error<
6278  "cannot jump from switch statement to this case label">;
6279def warn_cxx98_compat_switch_into_protected_scope : Warning<
6280  "jump from switch statement to this case label is incompatible with C++98">,
6281  InGroup<CXX98Compat>, DefaultIgnore;
6282def err_indirect_goto_without_addrlabel : Error<
6283  "indirect goto in function with no address-of-label expressions">;
6284def err_indirect_goto_in_protected_scope : Error<
6285  "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
6286def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
6287  "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
6288  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6289def note_indirect_goto_target : Note<
6290  "possible target of %select{indirect|asm}0 goto statement">;
6291def note_protected_by_variable_init : Note<
6292  "jump bypasses variable initialization">;
6293def note_protected_by_variable_nontriv_destructor : Note<
6294  "jump bypasses variable with a non-trivial destructor">;
6295def note_protected_by_variable_non_pod : Note<
6296  "jump bypasses initialization of non-POD variable">;
6297def note_protected_by_cleanup : Note<
6298  "jump bypasses initialization of variable with __attribute__((cleanup))">;
6299def note_protected_by_vla_typedef : Note<
6300  "jump bypasses initialization of VLA typedef">;
6301def note_protected_by_vla_type_alias : Note<
6302  "jump bypasses initialization of VLA type alias">;
6303def note_protected_by_constexpr_if : Note<
6304  "jump enters controlled statement of constexpr if">;
6305def note_protected_by_consteval_if : Note<
6306  "jump enters controlled statement of consteval if">;
6307def note_protected_by_if_available : Note<
6308  "jump enters controlled statement of if available">;
6309def note_protected_by_vla : Note<
6310  "jump bypasses initialization of variable length array">;
6311def note_protected_by_objc_fast_enumeration : Note<
6312  "jump enters Objective-C fast enumeration loop">;
6313def note_protected_by_objc_try : Note<
6314  "jump bypasses initialization of @try block">;
6315def note_protected_by_objc_catch : Note<
6316  "jump bypasses initialization of @catch block">;
6317def note_protected_by_objc_finally : Note<
6318  "jump bypasses initialization of @finally block">;
6319def note_protected_by_objc_synchronized : Note<
6320  "jump bypasses initialization of @synchronized block">;
6321def note_protected_by_objc_autoreleasepool : Note<
6322  "jump bypasses auto release push of @autoreleasepool block">;
6323def note_protected_by_cxx_try : Note<
6324  "jump bypasses initialization of try block">;
6325def note_protected_by_cxx_catch : Note<
6326  "jump bypasses initialization of catch block">;
6327def note_protected_by_seh_try : Note<
6328  "jump bypasses initialization of __try block">;
6329def note_protected_by_seh_except : Note<
6330  "jump bypasses initialization of __except block">;
6331def note_protected_by_seh_finally : Note<
6332  "jump bypasses initialization of __finally block">;
6333def note_protected_by___block : Note<
6334  "jump bypasses setup of __block variable">;
6335def note_protected_by_objc_strong_init : Note<
6336  "jump bypasses initialization of __strong variable">;
6337def note_protected_by_objc_weak_init : Note<
6338  "jump bypasses initialization of __weak variable">;
6339def note_protected_by_non_trivial_c_struct_init : Note<
6340  "jump bypasses initialization of variable of non-trivial C struct type">;
6341def note_enters_block_captures_cxx_obj : Note<
6342  "jump enters lifetime of block which captures a destructible C++ object">;
6343def note_enters_block_captures_strong : Note<
6344  "jump enters lifetime of block which strongly captures a variable">;
6345def note_enters_block_captures_weak : Note<
6346  "jump enters lifetime of block which weakly captures a variable">;
6347def note_enters_block_captures_non_trivial_c_struct : Note<
6348  "jump enters lifetime of block which captures a C struct that is non-trivial "
6349  "to destroy">;
6350def note_enters_compound_literal_scope : Note<
6351  "jump enters lifetime of a compound literal that is non-trivial to destruct">;
6352def note_enters_statement_expression : Note<
6353  "jump enters a statement expression">;
6354
6355def note_exits_cleanup : Note<
6356  "jump exits scope of variable with __attribute__((cleanup))">;
6357def note_exits_dtor : Note<
6358  "jump exits scope of variable with non-trivial destructor">;
6359def note_exits_temporary_dtor : Note<
6360  "jump exits scope of lifetime-extended temporary with non-trivial "
6361  "destructor">;
6362def note_exits___block : Note<
6363  "jump exits scope of __block variable">;
6364def note_exits_objc_try : Note<
6365  "jump exits @try block">;
6366def note_exits_objc_catch : Note<
6367  "jump exits @catch block">;
6368def note_exits_objc_finally : Note<
6369  "jump exits @finally block">;
6370def note_exits_objc_synchronized : Note<
6371  "jump exits @synchronized block">;
6372def note_exits_cxx_try : Note<
6373  "jump exits try block">;
6374def note_exits_cxx_catch : Note<
6375  "jump exits catch block">;
6376def note_exits_seh_try : Note<
6377  "jump exits __try block">;
6378def note_exits_seh_except : Note<
6379  "jump exits __except block">;
6380def note_exits_seh_finally : Note<
6381  "jump exits __finally block">;
6382def note_exits_objc_autoreleasepool : Note<
6383  "jump exits autoreleasepool block">;
6384def note_exits_objc_strong : Note<
6385  "jump exits scope of __strong variable">;
6386def note_exits_objc_weak : Note<
6387  "jump exits scope of __weak variable">;
6388def note_exits_block_captures_cxx_obj : Note<
6389  "jump exits lifetime of block which captures a destructible C++ object">;
6390def note_exits_block_captures_strong : Note<
6391  "jump exits lifetime of block which strongly captures a variable">;
6392def note_exits_block_captures_weak : Note<
6393  "jump exits lifetime of block which weakly captures a variable">;
6394def note_exits_block_captures_non_trivial_c_struct : Note<
6395  "jump exits lifetime of block which captures a C struct that is non-trivial "
6396  "to destroy">;
6397def note_exits_compound_literal_scope : Note<
6398  "jump exits lifetime of a compound literal that is non-trivial to destruct">;
6399
6400def err_func_returning_qualified_void : ExtWarn<
6401  "function cannot return qualified void type %0">,
6402  InGroup<DiagGroup<"qualified-void-return-type">>;
6403def err_func_returning_array_function : Error<
6404  "function cannot return %select{array|function}0 type %1">;
6405def err_field_declared_as_function : Error<"field %0 declared as a function">;
6406def err_field_incomplete_or_sizeless : Error<
6407  "field has %select{incomplete|sizeless}0 type %1">;
6408def ext_variable_sized_type_in_struct : ExtWarn<
6409  "field %0 with variable sized type %1 not at the end of a struct or class is"
6410  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
6411
6412def ext_c99_flexible_array_member : Extension<
6413  "flexible array members are a C99 feature">, InGroup<C99>;
6414def err_flexible_array_virtual_base : Error<
6415  "flexible array member %0 not allowed in "
6416  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
6417def err_flexible_array_empty_aggregate : Error<
6418  "flexible array member %0 not allowed in otherwise empty "
6419  "%select{struct|interface|union|class|enum}1">;
6420def err_flexible_array_has_nontrivial_dtor : Error<
6421  "flexible array member %0 of type %1 with non-trivial destruction">;
6422def ext_flexible_array_in_struct : Extension<
6423  "%0 may not be nested in a struct due to flexible array member">,
6424  InGroup<FlexibleArrayExtensions>;
6425def ext_flexible_array_in_array : Extension<
6426  "%0 may not be used as an array element due to flexible array member">,
6427  InGroup<FlexibleArrayExtensions>;
6428def err_flexible_array_init : Error<
6429  "initialization of flexible array member is not allowed">;
6430def ext_flexible_array_empty_aggregate_ms : Extension<
6431  "flexible array member %0 in otherwise empty "
6432  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
6433  InGroup<MicrosoftFlexibleArray>;
6434def err_flexible_array_union : Error<
6435  "flexible array member %0 in a union is not allowed">;
6436def ext_flexible_array_union_ms : Extension<
6437  "flexible array member %0 in a union is a Microsoft extension">,
6438  InGroup<MicrosoftFlexibleArray>;
6439def ext_flexible_array_empty_aggregate_gnu : Extension<
6440  "flexible array member %0 in otherwise empty "
6441  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
6442  InGroup<GNUEmptyStruct>;
6443def ext_flexible_array_union_gnu : Extension<
6444  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
6445
6446def err_flexible_array_not_at_end : Error<
6447  "flexible array member %0 with type %1 is not at the end of"
6448  " %select{struct|interface|union|class|enum}2">;
6449def err_objc_variable_sized_type_not_at_end : Error<
6450  "field %0 with variable sized type %1 is not at the end of class">;
6451def note_next_field_declaration : Note<
6452  "next field declaration is here">;
6453def note_next_ivar_declaration : Note<
6454  "next %select{instance variable declaration|synthesized instance variable}0"
6455  " is here">;
6456def err_synthesize_variable_sized_ivar : Error<
6457  "synthesized property with variable size type %0"
6458  " requires an existing instance variable">;
6459def err_flexible_array_arc_retainable : Error<
6460  "ARC forbids flexible array members with retainable object type">;
6461def warn_variable_sized_ivar_visibility : Warning<
6462  "field %0 with variable sized type %1 is not visible to subclasses and"
6463  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
6464def warn_superclass_variable_sized_type_not_at_end : Warning<
6465  "field %0 can overwrite instance variable %1 with variable sized type %2"
6466  " in superclass %3">, InGroup<ObjCFlexibleArray>;
6467
6468def err_flexible_array_count_not_in_same_struct : Error<
6469  "'counted_by' field %0 isn't within the same struct as the flexible array">;
6470def err_counted_by_attr_not_on_flexible_array_member : Error<
6471  "'counted_by' only applies to C99 flexible array members">;
6472def err_counted_by_attr_refers_to_flexible_array : Error<
6473  "'counted_by' cannot refer to the flexible array %0">;
6474def err_counted_by_must_be_in_structure : Error<
6475  "field %0 in 'counted_by' not inside structure">;
6476def err_flexible_array_counted_by_attr_field_not_integer : Error<
6477  "field %0 in 'counted_by' must be a non-boolean integer type">;
6478def note_flexible_array_counted_by_attr_field : Note<
6479  "field %0 declared here">;
6480
6481let CategoryName = "ARC Semantic Issue" in {
6482
6483// ARC-mode diagnostics.
6484
6485let CategoryName = "ARC Weak References" in {
6486
6487def err_arc_weak_no_runtime : Error<
6488  "cannot create __weak reference because the current deployment target "
6489  "does not support weak references">;
6490def err_arc_weak_disabled : Error<
6491  "cannot create __weak reference in file using manual reference counting">;
6492def err_synthesizing_arc_weak_property_disabled : Error<
6493  "cannot synthesize weak property in file using manual reference counting">;
6494def err_synthesizing_arc_weak_property_no_runtime : Error<
6495  "cannot synthesize weak property because the current deployment target "
6496  "does not support weak references">;
6497def err_arc_unsupported_weak_class : Error<
6498  "class is incompatible with __weak references">;
6499def err_arc_weak_unavailable_assign : Error<
6500  "assignment of a weak-unavailable object to a __weak object">;
6501def err_arc_weak_unavailable_property : Error<
6502  "synthesizing __weak instance variable of type %0, which does not "
6503  "support weak references">;
6504def note_implemented_by_class : Note<
6505  "when implemented by class %0">;
6506def err_arc_convesion_of_weak_unavailable : Error<
6507  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
6508  " a __weak object of type %2">;
6509
6510} // end "ARC Weak References" category
6511
6512let CategoryName = "ARC Restrictions" in {
6513
6514def err_unavailable_in_arc : Error<
6515  "%0 is unavailable in ARC">;
6516def note_arc_forbidden_type : Note<
6517  "declaration uses type that is ill-formed in ARC">;
6518def note_performs_forbidden_arc_conversion : Note<
6519  "inline function performs a conversion which is forbidden in ARC">;
6520def note_arc_init_returns_unrelated : Note<
6521  "init method must return a type related to its receiver type">;
6522def note_arc_weak_disabled : Note<
6523  "declaration uses __weak, but ARC is disabled">;
6524def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
6525  "the current deployment target does not support">;
6526def note_arc_field_with_ownership : Note<
6527  "field has non-trivial ownership qualification">;
6528
6529def err_arc_illegal_explicit_message : Error<
6530  "ARC forbids explicit message send of %0">;
6531def err_arc_unused_init_message : Error<
6532  "the result of a delegate init call must be immediately returned "
6533  "or assigned to 'self'">;
6534def err_arc_mismatched_cast : Error<
6535  "%select{implicit conversion|cast}0 of "
6536  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
6537  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
6538  " to %3 is disallowed with ARC">;
6539def err_arc_nolifetime_behavior : Error<
6540  "explicit ownership qualifier on cast result has no effect">;
6541def err_arc_objc_property_default_assign_on_object : Error<
6542  "ARC forbids synthesizing a property of an Objective-C object "
6543  "with unspecified ownership or storage attribute">;
6544def err_arc_illegal_selector : Error<
6545  "ARC forbids use of %0 in a @selector">;
6546def err_arc_illegal_method_def : Error<
6547  "ARC forbids %select{implementation|synthesis}0 of %1">;
6548def warn_arc_strong_pointer_objc_pointer : Warning<
6549  "method parameter of type %0 with no explicit ownership">,
6550  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
6551
6552} // end "ARC Restrictions" category
6553
6554def err_arc_lost_method_convention : Error<
6555  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
6556  "method, but its implementation doesn't match because %select{"
6557  "its result type is not an object pointer|"
6558  "its result type is unrelated to its receiver type}1">;
6559def note_arc_lost_method_convention : Note<"declaration in interface">;
6560def err_arc_gained_method_convention : Error<
6561  "method implementation does not match its declaration">;
6562def note_arc_gained_method_convention : Note<
6563  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
6564  "family because %select{its result type is not an object pointer|"
6565  "its result type is unrelated to its receiver type}1">;
6566def err_typecheck_arc_assign_self : Error<
6567  "cannot assign to 'self' outside of a method in the init family">;
6568def err_typecheck_arc_assign_self_class_method : Error<
6569  "cannot assign to 'self' in a class method">;
6570def err_typecheck_arr_assign_enumeration : Error<
6571  "fast enumeration variables cannot be modified in ARC by default; "
6572  "declare the variable __strong to allow this">;
6573def err_typecheck_arc_assign_externally_retained : Error<
6574  "variable declared with 'objc_externally_retained' "
6575  "cannot be modified in ARC">;
6576def warn_arc_retained_assign : Warning<
6577  "assigning retained object to %select{weak|unsafe_unretained}0 "
6578  "%select{property|variable}1"
6579  "; object will be released after assignment">,
6580  InGroup<ARCUnsafeRetainedAssign>;
6581def warn_arc_retained_property_assign : Warning<
6582  "assigning retained object to unsafe property"
6583  "; object will be released after assignment">,
6584  InGroup<ARCUnsafeRetainedAssign>;
6585def warn_arc_literal_assign : Warning<
6586  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
6587  " to a weak %select{property|variable}1"
6588  "; object will be released after assignment">,
6589  InGroup<ARCUnsafeRetainedAssign>;
6590def err_arc_new_array_without_ownership : Error<
6591  "'new' cannot allocate an array of %0 with no explicit ownership">;
6592def err_arc_autoreleasing_var : Error<
6593  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
6594  "__autoreleasing ownership">;
6595def err_arc_autoreleasing_capture : Error<
6596  "cannot capture __autoreleasing variable in a "
6597  "%select{block|lambda by copy}0">;
6598def err_arc_thread_ownership : Error<
6599  "thread-local variable has non-trivial ownership: type is %0">;
6600def err_arc_indirect_no_ownership : Error<
6601  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6602def err_arc_array_param_no_ownership : Error<
6603  "must explicitly describe intended ownership of an object array parameter">;
6604def err_arc_pseudo_dtor_inconstant_quals : Error<
6605  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6606  "type %1">;
6607def err_arc_init_method_unrelated_result_type : Error<
6608  "init methods must return a type related to the receiver type">;
6609def err_arc_nonlocal_writeback : Error<
6610  "passing address of %select{non-local|non-scalar}0 object to "
6611  "__autoreleasing parameter for write-back">;
6612def err_arc_method_not_found : Error<
6613  "no known %select{instance|class}1 method for selector %0">;
6614def err_arc_receiver_forward_class : Error<
6615  "receiver %0 for class message is a forward declaration">;
6616def err_arc_may_not_respond : Error<
6617  "no visible @interface for %0 declares the selector %1">;
6618def err_arc_receiver_forward_instance : Error<
6619  "receiver type %0 for instance message is a forward declaration">;
6620def warn_receiver_forward_instance : Warning<
6621  "receiver type %0 for instance message is a forward declaration">,
6622  InGroup<ForwardClassReceiver>, DefaultIgnore;
6623def err_arc_collection_forward : Error<
6624  "collection expression type %0 is a forward declaration">;
6625def err_arc_multiple_method_decl : Error<
6626  "multiple methods named %0 found with mismatched result, "
6627  "parameter type or attributes">;
6628def warn_arc_lifetime_result_type : Warning<
6629  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6630  "lifetime qualifier on return type is ignored">,
6631  InGroup<IgnoredQualifiers>;
6632
6633let CategoryName = "ARC Retain Cycle" in {
6634
6635def warn_arc_retain_cycle : Warning<
6636  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6637  InGroup<ARCRetainCycles>;
6638def note_arc_retain_cycle_owner : Note<
6639  "block will be retained by %select{the captured object|an object strongly "
6640  "retained by the captured object}0">;
6641
6642} // end "ARC Retain Cycle" category
6643
6644def warn_arc_object_memaccess : Warning<
6645  "%select{destination for|source of}0 this %1 call is a pointer to "
6646  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6647
6648let CategoryName = "ARC and @properties" in {
6649
6650def err_arc_strong_property_ownership : Error<
6651  "existing instance variable %1 for strong property %0 may not be "
6652  "%select{|__unsafe_unretained||__weak}2">;
6653def err_arc_assign_property_ownership : Error<
6654  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6655  "attribute must be __unsafe_unretained">;
6656def err_arc_inconsistent_property_ownership : Error<
6657  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6658  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6659
6660} // end "ARC and @properties" category
6661
6662def warn_block_capture_autoreleasing : Warning<
6663  "block captures an autoreleasing out-parameter, which may result in "
6664  "use-after-free bugs">,
6665  InGroup<BlockCaptureAutoReleasing>;
6666def note_declare_parameter_strong : Note<
6667  "declare the parameter __strong or capture a __block __strong variable to "
6668  "keep values alive across autorelease pools">;
6669
6670def err_arc_atomic_ownership : Error<
6671  "cannot perform atomic operation on a pointer to type %0: type has "
6672  "non-trivial ownership">;
6673
6674let CategoryName = "ARC Casting Rules" in {
6675
6676def err_arc_bridge_cast_incompatible : Error<
6677  "incompatible types casting %0 to %1 with a %select{__bridge|"
6678  "__bridge_transfer|__bridge_retained}2 cast">;
6679def err_arc_bridge_cast_wrong_kind : Error<
6680  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6681  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6682  "__bridge_transfer|__bridge_retained}4">;
6683def err_arc_cast_requires_bridge : Error<
6684  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6685  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6686  "requires a bridged cast">;
6687def note_arc_bridge : Note<
6688  "use __bridge to convert directly (no change in ownership)">;
6689def note_arc_cstyle_bridge : Note<
6690  "use __bridge with C-style cast to convert directly (no change in ownership)">;
6691def note_arc_bridge_transfer : Note<
6692  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6693  "ownership of a +1 %0 into ARC">;
6694def note_arc_cstyle_bridge_transfer : Note<
6695  "use __bridge_transfer with C-style cast to transfer "
6696  "ownership of a +1 %0 into ARC">;
6697def note_arc_bridge_retained : Note<
6698  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6699  "ARC object available as a +1 %0">;
6700def note_arc_cstyle_bridge_retained : Note<
6701  "use __bridge_retained with C-style cast to make an "
6702  "ARC object available as a +1 %0">;
6703
6704} // ARC Casting category
6705
6706} // ARC category name
6707
6708def err_flexible_array_init_needs_braces : Error<
6709  "flexible array requires brace-enclosed initializer">;
6710def err_illegal_decl_array_of_functions : Error<
6711  "'%0' declared as array of functions of type %1">;
6712def err_array_incomplete_or_sizeless_type : Error<
6713  "array has %select{incomplete|sizeless}0 element type %1">;
6714def err_illegal_message_expr_incomplete_type : Error<
6715  "Objective-C message has incomplete result type %0">;
6716def err_illegal_decl_array_of_references : Error<
6717  "'%0' declared as array of references of type %1">;
6718def err_decl_negative_array_size : Error<
6719  "'%0' declared as an array with a negative size">;
6720def err_array_static_outside_prototype : Error<
6721  "%0 used in array declarator outside of function prototype">;
6722def err_array_static_not_outermost : Error<
6723  "%0 used in non-outermost array type derivation">;
6724def err_array_star_outside_prototype : Error<
6725  "star modifier used outside of function prototype">;
6726def err_illegal_decl_pointer_to_reference : Error<
6727  "'%0' declared as a pointer to a reference of type %1">;
6728def err_illegal_decl_mempointer_to_reference : Error<
6729  "'%0' declared as a member pointer to a reference of type %1">;
6730def err_illegal_decl_mempointer_to_void : Error<
6731  "'%0' declared as a member pointer to void">;
6732def err_illegal_decl_mempointer_in_nonclass : Error<
6733  "'%0' does not point into a class">;
6734def err_mempointer_in_nonclass_type : Error<
6735  "member pointer refers into non-class type %0">;
6736def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6737def err_nonfunction_block_type : Error<
6738  "block pointer to non-function type is invalid">;
6739def err_return_block_has_expr : Error<"void block should not return a value">;
6740def err_block_return_missing_expr : Error<
6741  "non-void block should return a value">;
6742def err_func_def_incomplete_result : Error<
6743  "incomplete result type %0 in function definition">;
6744def err_atomic_specifier_bad_type
6745    : Error<"_Atomic cannot be applied to "
6746            "%select{incomplete |array |function |reference |atomic |qualified "
6747            "|sizeless ||integer |}0type "
6748            "%1 %select{|||||||which is not trivially copyable||in C23}0">;
6749def warn_atomic_member_access : Warning<
6750  "accessing a member of an atomic structure or union is undefined behavior">,
6751  InGroup<DiagGroup<"atomic-access">>, DefaultError;
6752
6753// Expressions.
6754def err_using_placeholder_variable : Error<
6755  "ambiguous reference to placeholder '_', which is defined multiple times">;
6756def note_reference_placeholder : Note<
6757  "placeholder declared here">;
6758def ext_placeholder_var_definition : ExtWarn<
6759  "placeholder variables are a C++2c extension">, InGroup<CXX26>;
6760def warn_cxx23_placeholder_var_definition : Warning<
6761  "placeholder variables are incompatible with C++ standards before C++2c">,
6762  DefaultIgnore, InGroup<CXXPre26Compat>;
6763
6764def ext_sizeof_alignof_function_type : Extension<
6765  "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6766def ext_sizeof_alignof_void_type : Extension<
6767  "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6768def err_opencl_sizeof_alignof_type : Error<
6769  "invalid application of '%0' to a void type">;
6770def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6771  "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6772def err_sizeof_alignof_function_type : Error<
6773  "invalid application of '%0' to a function type">;
6774def err_openmp_default_simd_align_expr : Error<
6775  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6776def err_sizeof_alignof_typeof_bitfield : Error<
6777  "invalid application of '%select{sizeof|alignof|typeof|typeof_unqual}0' to "
6778  "bit-field">;
6779def err_alignof_member_of_incomplete_type : Error<
6780  "invalid application of 'alignof' to a field of a class still being defined">;
6781def err_vecstep_non_scalar_vector_type : Error<
6782  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6783def err_offsetof_incomplete_type : Error<
6784  "offsetof of incomplete type %0">;
6785def err_offsetof_record_type : Error<
6786  "offsetof requires struct, union, or class type, %0 invalid">;
6787def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6788def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6789  InGroup<InvalidOffsetof>;
6790def ext_offsetof_non_standardlayout_type : ExtWarn<
6791  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6792def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6793def err_offsetof_field_of_virtual_base : Error<
6794  "invalid application of 'offsetof' to a field of a virtual base">;
6795def warn_sub_ptr_zero_size_types : Warning<
6796  "subtraction of pointers to type %0 of zero size has undefined behavior">,
6797  InGroup<PointerArith>;
6798def warn_pointer_arith_null_ptr : Warning<
6799  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6800  InGroup<NullPointerArithmetic>, DefaultIgnore;
6801def warn_gnu_null_ptr_arith : Extension<
6802  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6803  InGroup<GNUNullPointerArithmetic>;
6804def warn_pointer_sub_null_ptr : Warning<
6805  "performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior">,
6806  InGroup<NullPointerSubtraction>, DefaultIgnore;
6807
6808def warn_floatingpoint_eq : Warning<
6809  "comparing floating point with == or != is unsafe">,
6810  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6811
6812def err_setting_eval_method_used_in_unsafe_context : Error <
6813  "%select{'#pragma clang fp eval_method'|option 'ffp-eval-method'}0 cannot be used with "
6814  "%select{option 'fapprox-func'|option 'mreassociate'|option 'freciprocal'|option 'ffp-eval-method'|'#pragma clang fp reassociate'|'#pragma clang fp reciprocal'}1">;
6815
6816def warn_remainder_division_by_zero : Warning<
6817  "%select{remainder|division}0 by zero is undefined">,
6818  InGroup<DivZero>;
6819def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6820  InGroup<DiagGroup<"shift-negative-value">>;
6821def warn_shift_negative : Warning<"shift count is negative">,
6822  InGroup<DiagGroup<"shift-count-negative">>;
6823def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6824  InGroup<DiagGroup<"shift-count-overflow">>;
6825def warn_shift_result_gt_typewidth : Warning<
6826  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6827  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6828def warn_shift_result_sets_sign_bit : Warning<
6829  "signed shift result (%0) sets the sign bit of the shift expression's "
6830  "type (%1) and becomes negative">,
6831  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6832
6833def warn_precedence_bitwise_rel : Warning<
6834  "%0 has lower precedence than %1; %1 will be evaluated first">,
6835  InGroup<Parentheses>;
6836def note_precedence_bitwise_first : Note<
6837  "place parentheses around the %0 expression to evaluate it first">;
6838def note_precedence_silence : Note<
6839  "place parentheses around the '%0' expression to silence this warning">;
6840
6841def warn_precedence_conditional : Warning<
6842  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6843  InGroup<Parentheses>;
6844def warn_precedence_bitwise_conditional : Warning<
6845  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6846  InGroup<BitwiseConditionalParentheses>;
6847def note_precedence_conditional_first : Note<
6848  "place parentheses around the '?:' expression to evaluate it first">;
6849
6850def warn_enum_constant_in_bool_context : Warning<
6851  "converting the enum constant to a boolean">,
6852  InGroup<IntInBoolContext>, DefaultIgnore;
6853def warn_left_shift_in_bool_context : Warning<
6854  "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6855  InGroup<IntInBoolContext>, DefaultIgnore;
6856def warn_logical_instead_of_bitwise : Warning<
6857  "use of logical '%0' with constant operand">,
6858  InGroup<DiagGroup<"constant-logical-operand">>;
6859def note_logical_instead_of_bitwise_change_operator : Note<
6860  "use '%0' for a bitwise operation">;
6861def note_logical_instead_of_bitwise_remove_constant : Note<
6862  "remove constant to silence this warning">;
6863
6864def warn_bitwise_op_in_bitwise_op : Warning<
6865  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6866
6867def warn_logical_and_in_logical_or : Warning<
6868  "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6869
6870def warn_overloaded_shift_in_comparison :Warning<
6871  "overloaded operator %select{>>|<<}0 has higher precedence than "
6872  "comparison operator">,
6873  InGroup<OverloadedShiftOpParentheses>;
6874def note_evaluate_comparison_first :Note<
6875  "place parentheses around comparison expression to evaluate it first">;
6876
6877def note_concatenated_string_literal_silence :Note<
6878  "place parentheses around the string literal to silence warning">;
6879
6880def warn_addition_in_bitshift : Warning<
6881  "operator '%0' has lower precedence than '%1'; "
6882  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6883
6884def warn_self_assignment_builtin : Warning<
6885  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6886  "you mean to assign to member %2?}1">,
6887  InGroup<SelfAssignment>, DefaultIgnore;
6888def warn_self_assignment_overloaded : Warning<
6889  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6890  "you mean to assign to member %2?}1">,
6891  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6892def warn_self_move : Warning<
6893  "explicitly moving variable of type %0 to itself%select{|; did you mean to "
6894  "move to member %2?}1">,
6895  InGroup<SelfMove>, DefaultIgnore;
6896
6897def err_builtin_move_forward_unsupported : Error<
6898  "unsupported signature for %q0">;
6899def err_use_of_unaddressable_function : Error<
6900  "taking address of non-addressable standard library function">;
6901// FIXME: This should also be in -Wc++23-compat once we have it.
6902def warn_cxx20_compat_use_of_unaddressable_function : Warning<
6903  "taking address of non-addressable standard library function "
6904  "is incompatible with C++20">, InGroup<CXX20Compat>;
6905
6906def warn_redundant_move_on_return : Warning<
6907  "redundant move in return statement">,
6908  InGroup<RedundantMove>, DefaultIgnore;
6909def warn_pessimizing_move_on_return : Warning<
6910  "moving a local object in a return statement prevents copy elision">,
6911  InGroup<PessimizingMove>, DefaultIgnore;
6912def warn_pessimizing_move_on_initialization : Warning<
6913  "moving a temporary object prevents copy elision">,
6914  InGroup<PessimizingMove>, DefaultIgnore;
6915def note_remove_move : Note<"remove std::move call here">;
6916
6917def warn_string_plus_int : Warning<
6918  "adding %0 to a string does not append to the string">,
6919  InGroup<StringPlusInt>;
6920def warn_string_plus_char : Warning<
6921  "adding %0 to a string pointer does not append to the string">,
6922  InGroup<StringPlusChar>;
6923def note_string_plus_scalar_silence : Note<
6924  "use array indexing to silence this warning">;
6925
6926def warn_sizeof_array_param : Warning<
6927  "sizeof on array function parameter will return size of %0 instead of %1">,
6928  InGroup<SizeofArrayArgument>;
6929
6930def warn_sizeof_array_decay : Warning<
6931  "sizeof on pointer operation will return size of %0 instead of %1">,
6932  InGroup<SizeofArrayDecay>;
6933
6934def err_sizeof_nonfragile_interface : Error<
6935  "application of '%select{alignof|sizeof}1' to interface %0 is "
6936  "not supported on this architecture and platform">;
6937def err_atdef_nonfragile_interface : Error<
6938  "use of @defs is not supported on this architecture and platform">;
6939def err_subscript_nonfragile_interface : Error<
6940  "subscript requires size of interface %0, which is not constant for "
6941  "this architecture and platform">;
6942
6943def err_arithmetic_nonfragile_interface : Error<
6944  "arithmetic on pointer to interface %0, which is not a constant size for "
6945  "this architecture and platform">;
6946
6947def warn_deprecated_comma_subscript : Warning<
6948  "top-level comma expression in array subscript is deprecated "
6949  "in C++20 and unsupported in C++23">,
6950  InGroup<DeprecatedCommaSubscript>;
6951
6952def ext_subscript_non_lvalue : Extension<
6953  "ISO C90 does not allow subscripting non-lvalue array">;
6954def err_typecheck_subscript_value : Error<
6955  "subscripted value is not an array, pointer, or vector">;
6956def err_typecheck_subscript_not_integer : Error<
6957  "array subscript is not an integer">;
6958def err_subscript_function_type : Error<
6959  "subscript of pointer to function type %0">;
6960def err_subscript_incomplete_or_sizeless_type : Error<
6961  "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6962def err_subscript_svbool_t : Error<
6963  "subscript of svbool_t is not allowed">;
6964def err_dereference_incomplete_type : Error<
6965  "dereference of pointer to incomplete type %0">;
6966def ext_gnu_subscript_void_type : Extension<
6967  "subscript of a pointer to void is a GNU extension">,
6968  InGroup<GNUPointerArith>;
6969def err_typecheck_member_reference_struct_union : Error<
6970  "member reference base type %0 is not a structure or union">;
6971def err_typecheck_member_reference_ivar : Error<
6972  "%0 does not have a member named %1">;
6973def err_arc_weak_ivar_access : Error<
6974  "dereferencing a __weak pointer is not allowed due to possible "
6975  "null value caused by race condition, assign it to strong variable first">;
6976def err_typecheck_member_reference_arrow : Error<
6977  "member reference type %0 is not a pointer">;
6978def err_typecheck_member_reference_suggestion : Error<
6979  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6980def note_typecheck_member_reference_suggestion : Note<
6981  "did you mean to use '.' instead?">;
6982def note_member_reference_arrow_from_operator_arrow : Note<
6983  "'->' applied to return value of the operator->() declared here">;
6984def err_typecheck_member_reference_type : Error<
6985  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6986def err_typecheck_member_reference_unknown : Error<
6987  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6988def err_member_reference_needs_call : Error<
6989  "base of member reference is a function; perhaps you meant to call "
6990  "it%select{| with no arguments}0?">;
6991def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6992  InGroup<CharSubscript>, DefaultIgnore;
6993
6994def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6995def err_no_member : Error<"no member named %0 in %1">;
6996def err_no_member_overloaded_arrow : Error<
6997  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6998
6999def err_member_not_yet_instantiated : Error<
7000  "no member %0 in %1; it has not yet been instantiated">;
7001def note_non_instantiated_member_here : Note<
7002  "not-yet-instantiated member is declared here">;
7003
7004def err_enumerator_does_not_exist : Error<
7005  "enumerator %0 does not exist in instantiation of %1">;
7006def note_enum_specialized_here : Note<
7007  "enum %0 was explicitly specialized here">;
7008
7009def err_specialization_not_primary_template : Error<
7010  "cannot reference member of primary template because deduced class "
7011  "template specialization %0 is %select{instantiated from a partial|"
7012  "an explicit}1 specialization">;
7013
7014def err_member_redeclared : Error<"class member cannot be redeclared">;
7015def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
7016  InGroup<RedeclaredClassMember>;
7017def err_member_redeclared_in_instantiation : Error<
7018  "multiple overloads of %0 instantiate to the same signature %1">;
7019def err_member_name_of_class : Error<"member %0 has the same name as its class">;
7020def err_member_def_undefined_record : Error<
7021  "out-of-line definition of %0 from class %1 without definition">;
7022def err_member_decl_does_not_match : Error<
7023  "out-of-line %select{declaration|definition}2 of %0 "
7024  "does not match any declaration in %1">;
7025def err_friend_decl_with_def_arg_must_be_def : Error<
7026  "friend declaration specifying a default argument must be a definition">;
7027def err_friend_decl_with_enclosing_temp_constraint_must_be_def : Error<
7028  "friend declaration with a constraint that depends on an enclosing "
7029  "template parameter must be a definition">;
7030def err_non_temp_friend_decl_with_requires_clause_must_be_def : Error<
7031  "non-template friend declaration with a requires clause must be a definition">;
7032def err_friend_decl_with_def_arg_redeclared : Error<
7033  "friend declaration specifying a default argument must be the only declaration">;
7034def err_friend_decl_does_not_match : Error<
7035  "friend declaration of %0 does not match any declaration in %1">;
7036def err_member_decl_does_not_match_suggest : Error<
7037  "out-of-line %select{declaration|definition}2 of %0 "
7038  "does not match any declaration in %1; did you mean %3?">;
7039def err_member_def_does_not_match_ret_type : Error<
7040  "return type of out-of-line definition of %q0 differs from "
7041  "that in the declaration">;
7042def err_nonstatic_member_out_of_line : Error<
7043  "non-static data member defined out-of-line">;
7044def err_qualified_typedef_declarator : Error<
7045  "typedef declarator cannot be qualified">;
7046def err_qualified_param_declarator : Error<
7047  "parameter declarator cannot be qualified">;
7048def ext_out_of_line_declaration : ExtWarn<
7049  "out-of-line declaration of a member must be a definition">,
7050  InGroup<OutOfLineDeclaration>, DefaultError;
7051def err_member_extra_qualification : Error<
7052  "extra qualification on member %0">;
7053def warn_member_extra_qualification : Warning<
7054  err_member_extra_qualification.Summary>, InGroup<MicrosoftExtraQualification>;
7055def warn_namespace_member_extra_qualification : Warning<
7056  "extra qualification on member %0">,
7057  InGroup<DiagGroup<"extra-qualification">>;
7058def err_member_qualification : Error<
7059  "non-friend class member %0 cannot have a qualified name">;
7060def note_member_def_close_match : Note<"member declaration nearly matches">;
7061def note_member_def_close_const_match : Note<
7062  "member declaration does not match because "
7063  "it %select{is|is not}0 const qualified">;
7064def note_member_def_close_param_match : Note<
7065  "type of %ordinal0 parameter of member declaration does not match definition"
7066  "%diff{ ($ vs $)|}1,2">;
7067def note_local_decl_close_match : Note<"local declaration nearly matches">;
7068def note_local_decl_close_param_match : Note<
7069  "type of %ordinal0 parameter of local declaration does not match definition"
7070  "%diff{ ($ vs $)|}1,2">;
7071def err_typecheck_ivar_variable_size : Error<
7072  "instance variables must have a constant size">;
7073def err_ivar_reference_type : Error<
7074  "instance variables cannot be of reference type">;
7075def err_typecheck_illegal_increment_decrement : Error<
7076  "cannot %select{decrement|increment}1 value of type %0">;
7077def err_typecheck_expect_int : Error<
7078  "used type %0 where integer is required">;
7079def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
7080  "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
7081def err_typecheck_pointer_arith_function_type : Error<
7082  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
7083  "function type%select{|s}2 %1%select{| and %3}2">;
7084def err_typecheck_pointer_arith_void_type : Error<
7085  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
7086def err_typecheck_decl_incomplete_type : Error<
7087  "variable has incomplete type %0">;
7088def ext_typecheck_decl_incomplete_type : ExtWarn<
7089  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
7090  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
7091def err_tentative_def_incomplete_type : Error<
7092  "tentative definition has type %0 that is never completed">;
7093def warn_tentative_incomplete_array : Warning<
7094  "tentative array definition assumed to have one element">;
7095def err_typecheck_incomplete_array_needs_initializer : Error<
7096  "definition of variable with array type needs an explicit size "
7097  "or an initializer">;
7098def err_array_init_not_init_list : Error<
7099  "array initializer must be an initializer "
7100  "list%select{| or string literal| or wide string literal}0">;
7101def err_array_init_narrow_string_into_wchar : Error<
7102  "initializing wide char array with non-wide string literal">;
7103def err_array_init_wide_string_into_char : Error<
7104  "initializing char array with wide string literal">;
7105def err_array_init_incompat_wide_string_into_wchar : Error<
7106  "initializing wide char array with incompatible wide string literal">;
7107def err_array_init_plain_string_into_char8_t : Error<
7108  "initializing 'char8_t' array with plain string literal">;
7109def note_array_init_plain_string_into_char8_t : Note<
7110  "add 'u8' prefix to form a 'char8_t' string literal">;
7111def err_array_init_utf8_string_into_char : Error<
7112  "initialization of %select{|signed }0char array with "
7113  "UTF-8 string literal is not permitted by %select{'-fchar8_t'|C++20}1">;
7114def warn_cxx20_compat_utf8_string : Warning<
7115  "type of UTF-8 string literal will change from array of const char to "
7116  "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
7117def note_cxx20_compat_utf8_string_remove_u8 : Note<
7118  "remove 'u8' prefix to avoid a change of behavior; "
7119  "Clang encodes unprefixed narrow string literals as UTF-8">;
7120def err_array_init_different_type : Error<
7121  "cannot initialize array %diff{of type $ with array of type $|"
7122  "with different type of array}0,1">;
7123def err_array_init_non_constant_array : Error<
7124  "cannot initialize array %diff{of type $ with non-constant array of type $|"
7125  "with different type of array}0,1">;
7126def ext_array_init_copy : Extension<
7127  "initialization of an array "
7128  "%diff{of type $ from a compound literal of type $|"
7129  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
7130// This is intentionally not disabled by -Wno-gnu.
7131def ext_array_init_parens : ExtWarn<
7132  "parenthesized initialization of a member array is a GNU extension">,
7133  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
7134def warn_deprecated_string_literal_conversion : Warning<
7135  "conversion from string literal to %0 is deprecated">,
7136  InGroup<CXX11CompatDeprecatedWritableStr>;
7137def ext_deprecated_string_literal_conversion : ExtWarn<
7138  "ISO C++11 does not allow conversion from string literal to %0">,
7139  InGroup<WritableStrings>, SFINAEFailure;
7140def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
7141def err_typecheck_sclass_fscope : Error<
7142  "illegal storage class on file-scoped variable">;
7143def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
7144  InGroup<MissingDeclarations>;
7145def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
7146  "of a type">, InGroup<MissingDeclarations>;
7147def err_standalone_class_nested_name_specifier : Error<
7148  "forward declaration of %select{class|struct|interface|union|enum|enum class|enum struct}0 cannot "
7149  "have a nested name specifier">;
7150def err_typecheck_sclass_func : Error<"illegal storage class on function">;
7151def err_static_block_func : Error<
7152  "function declared in block scope cannot have 'static' storage class">;
7153def err_typecheck_address_of : Error<"address of %select{bit-field"
7154  "|vector element|property expression|register variable|matrix element}0 requested">;
7155def ext_typecheck_addrof_void : Extension<
7156  "ISO C forbids taking the address of an expression of type 'void'">;
7157def err_unqualified_pointer_member_function : Error<
7158  "must explicitly qualify name of member function when taking its address">;
7159def err_invalid_form_pointer_member_function : Error<
7160  "cannot create a non-constant pointer to member function">;
7161def err_address_of_function_with_pass_object_size_params: Error<
7162  "cannot take address of function %0 because parameter %1 has "
7163  "pass_object_size attribute">;
7164def err_parens_pointer_member_function : Error<
7165  "cannot parenthesize the name of a method when forming a member pointer">;
7166def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
7167  "extra '&' taking address of overloaded function">;
7168def err_typecheck_invalid_lvalue_addrof : Error<
7169  "cannot take the address of an rvalue of type %0">;
7170def ext_typecheck_addrof_temporary : ExtWarn<
7171  "taking the address of a temporary object of type %0">,
7172  InGroup<AddressOfTemporary>, DefaultError;
7173def err_typecheck_addrof_temporary : Error<
7174  "taking the address of a temporary object of type %0">;
7175def err_typecheck_addrof_dtor : Error<
7176  "taking the address of a destructor">;
7177def err_typecheck_unary_expr : Error<
7178  "invalid argument type %0 to unary expression">;
7179def err_typecheck_indirection_requires_pointer : Error<
7180  "indirection requires pointer operand (%0 invalid)">;
7181def ext_typecheck_indirection_through_void_pointer : ExtWarn<
7182  "ISO C does not allow indirection on operand of type %0">,
7183  InGroup<VoidPointerDeref>;
7184def err_typecheck_indirection_through_void_pointer_cpp
7185    : Error<"indirection not permitted on operand of type %0">;
7186def warn_indirection_through_null : Warning<
7187  "indirection of non-volatile null pointer will be deleted, not trap">,
7188  InGroup<NullDereference>;
7189def warn_binding_null_to_reference : Warning<
7190  "binding dereferenced null pointer to reference has undefined behavior">,
7191  InGroup<NullDereference>;
7192def note_indirection_through_null : Note<
7193  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
7194def warn_pointer_indirection_from_incompatible_type : Warning<
7195  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
7196  "behavior">,
7197  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7198def warn_taking_address_of_packed_member : Warning<
7199  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
7200  InGroup<DiagGroup<"address-of-packed-member">>;
7201def warn_param_mismatched_alignment : Warning<
7202  "passing %0-byte aligned argument to %1-byte aligned parameter %2%select{| of %4}3 may result in an unaligned pointer access">,
7203  InGroup<DiagGroup<"align-mismatch">>;
7204
7205def err_objc_object_assignment : Error<
7206  "cannot assign to class object (%0 invalid)">;
7207def err_typecheck_invalid_operands : Error<
7208  "invalid operands to binary expression (%0 and %1)">, Deferrable;
7209def note_typecheck_invalid_operands_converted : Note<
7210  "%select{first|second}0 operand was implicitly converted to type %1">;
7211def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
7212  "logical expression with vector %select{type %1 and non-vector type %2|types"
7213  " %1 and %2}0 is only supported in C++">;
7214def err_typecheck_sub_ptr_compatible : Error<
7215  "%diff{$ and $ are not pointers to compatible types|"
7216  "pointers to incompatible types}0,1">;
7217def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
7218  "ordered comparison between pointer and integer (%0 and %1)">;
7219def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
7220  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
7221def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
7222  "ordered comparison between pointer and zero (%0 and %1)">;
7223def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
7224  "three-way comparison between pointer and zero">;
7225def ext_typecheck_compare_complete_incomplete_pointers : Extension<
7226  "pointer comparisons before C11 "
7227  "need to be between two complete or two incomplete types; "
7228  "%0 is %select{|in}2complete and "
7229  "%1 is %select{|in}3complete">,
7230  InGroup<C11>;
7231def warn_typecheck_ordered_comparison_of_function_pointers : Warning<
7232  "ordered comparison of function pointers (%0 and %1)">,
7233  InGroup<OrderedCompareFunctionPointers>;
7234def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
7235  "ordered comparison of function pointers (%0 and %1)">,
7236  InGroup<OrderedCompareFunctionPointers>;
7237def err_typecheck_ordered_comparison_of_function_pointers : Error<
7238  "ordered comparison of function pointers (%0 and %1)">;
7239def ext_typecheck_comparison_of_fptr_to_void : Extension<
7240  "equality comparison between function pointer and void pointer (%0 and %1)">;
7241def err_typecheck_comparison_of_fptr_to_void : Error<
7242  "equality comparison between function pointer and void pointer (%0 and %1)">;
7243def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
7244  "comparison between pointer and integer (%0 and %1)">,
7245  InGroup<DiagGroup<"pointer-integer-compare">>;
7246def err_typecheck_comparison_of_pointer_integer : Error<
7247  "comparison between pointer and integer (%0 and %1)">;
7248def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
7249  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
7250  InGroup<CompareDistinctPointerType>;
7251def ext_typecheck_cond_incompatible_operands : ExtWarn<
7252  "incompatible operand types (%0 and %1)">;
7253def err_cond_voidptr_arc : Error <
7254  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
7255  "in ARC mode">;
7256def err_typecheck_comparison_of_distinct_pointers : Error<
7257  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
7258def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
7259  "%select{comparison between %diff{ ($ and $)|}0,1"
7260  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
7261  "|conditional operator with the second and third operands of type "
7262  "%diff{ ($ and $)|}0,1}2"
7263  " which are pointers to non-overlapping address spaces">;
7264
7265def select_arith_conv_kind : TextSubstitution<
7266  "%select{arithmetic between|bitwise operation between|comparison of|"
7267  "conditional expression between|compound assignment of}0">;
7268def warn_arith_conv_enum_float : Warning<
7269  "%sub{select_arith_conv_kind}0 "
7270  "%select{floating-point|enumeration}1 type %2 "
7271  "%plural{2:with|4:from|:and}0 "
7272  "%select{enumeration|floating-point}1 type %3">,
7273  InGroup<EnumFloatConversion>, DefaultIgnore;
7274def warn_arith_conv_enum_float_cxx20 : Warning<
7275  "%sub{select_arith_conv_kind}0 "
7276  "%select{floating-point|enumeration}1 type %2 "
7277  "%plural{2:with|4:from|:and}0 "
7278  "%select{enumeration|floating-point}1 type %3 is deprecated">,
7279  InGroup<DeprecatedEnumFloatConversion>;
7280def err_arith_conv_enum_float_cxx26 : Error<
7281  "invalid %sub{select_arith_conv_kind}0 "
7282  "%select{floating-point|enumeration}1 type %2 "
7283  "%plural{2:with|4:from|:and}0 "
7284  "%select{enumeration|floating-point}1 type %3">;
7285def warn_arith_conv_mixed_enum_types : Warning<
7286  "%sub{select_arith_conv_kind}0 "
7287  "different enumeration types%diff{ ($ and $)|}1,2">,
7288  InGroup<EnumEnumConversion>, DefaultIgnore;
7289def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
7290  "%sub{select_arith_conv_kind}0 "
7291  "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
7292  InGroup<DeprecatedEnumEnumConversion>;
7293def err_conv_mixed_enum_types_cxx26 : Error<
7294  "invalid %sub{select_arith_conv_kind}0 "
7295  "different enumeration types%diff{ ($ and $)|}1,2">;
7296
7297def warn_arith_conv_mixed_anon_enum_types : Warning<
7298  warn_arith_conv_mixed_enum_types.Summary>,
7299  InGroup<AnonEnumEnumConversion>, DefaultIgnore;
7300def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
7301  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7302  InGroup<DeprecatedAnonEnumEnumConversion>;
7303def warn_conditional_mixed_enum_types : Warning<
7304  warn_arith_conv_mixed_enum_types.Summary>,
7305  InGroup<EnumCompareConditional>, DefaultIgnore;
7306def warn_conditional_mixed_enum_types_cxx20 : Warning<
7307  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7308  InGroup<DeprecatedEnumCompareConditional>;
7309def warn_comparison_mixed_enum_types : Warning<
7310  warn_arith_conv_mixed_enum_types.Summary>,
7311  InGroup<EnumCompare>;
7312def warn_comparison_mixed_enum_types_cxx20 : Warning<
7313  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7314  InGroup<DeprecatedEnumCompare>;
7315def warn_comparison_of_mixed_enum_types_switch : Warning<
7316  "comparison of different enumeration types in switch statement"
7317  "%diff{ ($ and $)|}0,1">,
7318  InGroup<EnumCompareSwitch>;
7319
7320def err_typecheck_assign_const : Error<
7321  "%select{"
7322  "cannot assign to return value because function %1 returns a const value|"
7323  "cannot assign to variable %1 with const-qualified type %2|"
7324  "cannot assign to %select{non-|}1static data member %2 "
7325  "with const-qualified type %3|"
7326  "cannot assign to non-static data member within const member function %1|"
7327  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
7328  "with %select{|nested }3const-qualified data member %4|"
7329  "read-only variable is not assignable}0">;
7330
7331def note_typecheck_assign_const : Note<
7332  "%select{"
7333  "function %1 which returns const-qualified type %2 declared here|"
7334  "variable %1 declared const here|"
7335  "%select{non-|}1static data member %2 declared const here|"
7336  "member function %q1 is declared const here|"
7337  "%select{|nested }1data member %2 declared const here}0">;
7338
7339def warn_unsigned_always_true_comparison : Warning<
7340  "result of comparison of %select{%3|unsigned expression}0 %2 "
7341  "%select{unsigned expression|%3}0 is always %4">,
7342  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
7343def warn_unsigned_char_always_true_comparison : Warning<
7344  "result of comparison of %select{%3|char expression}0 %2 "
7345  "%select{char expression|%3}0 is always %4, since char is interpreted as "
7346  "unsigned">, InGroup<TautologicalUnsignedCharZeroCompare>, DefaultIgnore;
7347def warn_unsigned_enum_always_true_comparison : Warning<
7348  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
7349  "%select{unsigned enum expression|%3}0 is always %4">,
7350  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
7351def warn_tautological_constant_compare : Warning<
7352  "result of comparison %select{%3|%1}0 %2 "
7353  "%select{%1|%3}0 is always %4">,
7354  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
7355def warn_tautological_compare_objc_bool : Warning<
7356  "result of comparison of constant %0 with expression of type 'BOOL'"
7357  " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
7358  InGroup<TautologicalObjCBoolCompare>;
7359def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
7360def warn_tautological_compare_value_range : Warning<
7361  "result of comparison of "
7362  "%select{%4|%sub{subst_int_range}1,2}0 %3 "
7363  "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
7364  InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
7365
7366def warn_mixed_sign_comparison : Warning<
7367  "comparison of integers of different signs: %0 and %1">,
7368  InGroup<SignCompare>, DefaultIgnore;
7369def warn_out_of_range_compare : Warning<
7370  "result of comparison of %select{constant %0|true|false}1 with "
7371  "%select{expression of type %2|boolean expression}3 is always %4">,
7372  InGroup<TautologicalOutOfRangeCompare>;
7373def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Summary>,
7374  InGroup<TautologicalConstantCompare>;
7375def warn_integer_constants_in_conditional_always_true : Warning<
7376  "converting the result of '?:' with integer constants to a boolean always "
7377  "evaluates to 'true'">,
7378  InGroup<TautologicalConstantCompare>;
7379def warn_left_shift_always : Warning<
7380  "converting the result of '<<' to a boolean always evaluates "
7381  "to %select{false|true}0">,
7382  InGroup<TautologicalConstantCompare>;
7383def warn_null_in_arithmetic_operation : Warning<
7384  "use of NULL in arithmetic operation">,
7385  InGroup<NullArithmetic>;
7386def warn_null_in_comparison_operation : Warning<
7387  "comparison between NULL and non-pointer "
7388  "%select{(%1 and NULL)|(NULL and %1)}0">,
7389  InGroup<NullArithmetic>;
7390def err_shift_rhs_only_vector : Error<
7391  "requested shift is a vector of type %0 but the first operand is not a "
7392  "vector (%1)">;
7393
7394def warn_logical_not_on_lhs_of_check : Warning<
7395  "logical not is only applied to the left hand side of this "
7396  "%select{comparison|bitwise operator}0">,
7397  InGroup<LogicalNotParentheses>;
7398def note_logical_not_fix : Note<
7399  "add parentheses after the '!' to evaluate the "
7400  "%select{comparison|bitwise operator}0 first">;
7401def note_logical_not_silence_with_parens : Note<
7402  "add parentheses around left hand side expression to silence this warning">;
7403
7404def err_invalid_this_use : Error<
7405  "invalid use of 'this' %select{outside of a non-static member function"
7406  "|in a function with an explicit object parameter}0">;
7407def err_this_static_member_func : Error<
7408  "'this' cannot be%select{| implicitly}0 used in a static member function "
7409  "declaration">;
7410def err_invalid_member_use_in_method : Error<
7411  "invalid use of member %0 in %select{static|explicit object}1 member function">;
7412
7413def err_invalid_qualified_function_type : Error<
7414  "%select{non-member function|static member function|explicit object member function|deduction guide}0 "
7415  "%select{of type %2 |}1cannot have '%3' qualifier">;
7416def err_compound_qualified_function_type : Error<
7417  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
7418  "cannot have '%3' qualifier">;
7419def err_qualified_function_typeid : Error<
7420  "type operand %0 of 'typeid' cannot have '%1' qualifier">;
7421
7422def err_cxx20_deducing_this  : Error<
7423  "explicit object parameters are incompatible with C++ standards before C++2b">;
7424def err_explicit_object_default_arg: Error<
7425  "the explicit object parameter cannot have a default argument">;
7426def err_explicit_object_parameter_pack: Error<
7427  "the explicit object parameter cannot be a function parameter pack">;
7428def err_explicit_object_parameter_must_be_first: Error<
7429  "an explicit object parameter can only appear as the first parameter "
7430  "of the %select{function|lambda}0">;
7431def err_explicit_object_parameter_nonmember: Error<
7432  "an explicit object parameter cannot appear in a "
7433  "%select{static|virtual|non-member}0 %select{function|lambda}1">;
7434def err_explicit_object_parameter_constructor: Error<
7435  "an explicit object parameter cannot appear in a %select{constructor|destructor}0">;
7436def err_explicit_object_parameter_mutable: Error<
7437  "a lambda with an explicit object parameter cannot be mutable">;
7438def err_invalid_explicit_object_type_in_lambda: Error<
7439  "invalid explicit object parameter type %0 in lambda with capture; "
7440  "the type must be the same as, or derived from, the lambda">;
7441
7442def err_ref_qualifier_overload : Error<
7443  "cannot overload a member function %select{without a ref-qualifier|with "
7444  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
7445  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
7446
7447def err_invalid_non_static_member_use : Error<
7448  "invalid use of non-static data member %0">;
7449def err_nested_non_static_member_use : Error<
7450  "%select{call to non-static member function|use of non-static data member}0 "
7451  "%2 of %1 from nested type %3">;
7452def warn_cxx98_compat_non_static_member_use : Warning<
7453  "use of non-static data member %0 in an unevaluated context is "
7454  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
7455def err_invalid_incomplete_type_use : Error<
7456  "invalid use of incomplete type %0">;
7457def err_builtin_func_cast_more_than_one_arg : Error<
7458  "function-style cast to a builtin type can only take one argument">;
7459def err_value_init_for_array_type : Error<
7460  "array types cannot be value-initialized">;
7461def err_init_for_function_type : Error<
7462  "cannot create object of function type %0">;
7463def warn_format_nonliteral_noargs : Warning<
7464  "format string is not a string literal (potentially insecure)">,
7465  InGroup<FormatSecurity>;
7466def warn_format_nonliteral : Warning<
7467  "format string is not a string literal">,
7468  InGroup<FormatNonLiteral>, DefaultIgnore;
7469
7470def err_unexpected_interface : Error<
7471  "unexpected interface name %0: expected expression">;
7472def err_ref_non_value : Error<"%0 does not refer to a value">;
7473def err_ref_vm_type : Error<
7474  "cannot refer to declaration with a variably modified type inside block">;
7475def err_ref_flexarray_type : Error<
7476  "cannot refer to declaration of structure variable with flexible array member "
7477  "inside block">;
7478def err_ref_array_type : Error<
7479  "cannot refer to declaration with an array type inside block">;
7480def err_property_not_found : Error<
7481  "property %0 not found on object of type %1">;
7482def err_invalid_property_name : Error<
7483  "%0 is not a valid property name (accessing an object of type %1)">;
7484def err_getter_not_found : Error<
7485  "no getter method for read from property">;
7486def err_objc_subscript_method_not_found : Error<
7487  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
7488  "found on object of type %0">;
7489def err_objc_subscript_index_type : Error<
7490  "method index parameter type %0 is not integral type">;
7491def err_objc_subscript_key_type : Error<
7492  "method key parameter type %0 is not object type">;
7493def err_objc_subscript_dic_object_type : Error<
7494  "method object parameter type %0 is not object type">;
7495def err_objc_subscript_object_type : Error<
7496  "cannot assign to this %select{dictionary|array}1 because assigning method's "
7497  "2nd parameter of type %0 is not an Objective-C pointer type">;
7498def err_objc_subscript_base_type : Error<
7499  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
7500def err_objc_multiple_subscript_type_conversion : Error<
7501  "indexing expression is invalid because subscript type %0 has "
7502  "multiple type conversion functions">;
7503def err_objc_subscript_type_conversion : Error<
7504  "indexing expression is invalid because subscript type %0 is not an integral"
7505  " or Objective-C pointer type">;
7506def err_objc_subscript_pointer : Error<
7507  "indexing expression is invalid because subscript type %0 is not an"
7508  " Objective-C pointer">;
7509def err_objc_indexing_method_result_type : Error<
7510  "method for accessing %select{dictionary|array}1 element must have Objective-C"
7511  " object return type instead of %0">;
7512def err_objc_index_incomplete_class_type : Error<
7513  "Objective-C index expression has incomplete class type %0">;
7514def err_illegal_container_subscripting_op : Error<
7515  "illegal operation on Objective-C container subscripting">;
7516def err_property_not_found_forward_class : Error<
7517  "property %0 cannot be found in forward class object %1">;
7518def err_property_not_as_forward_class : Error<
7519  "property %0 refers to an incomplete Objective-C class %1 "
7520  "(with no @interface available)">;
7521def note_forward_class : Note<
7522  "forward declaration of class here">;
7523def err_duplicate_property : Error<
7524  "property has a previous declaration">;
7525def ext_gnu_void_ptr : Extension<
7526  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
7527  InGroup<GNUPointerArith>;
7528def ext_gnu_ptr_func_arith : Extension<
7529  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
7530  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
7531  InGroup<GNUPointerArith>;
7532def err_readonly_message_assignment : Error<
7533  "assigning to 'readonly' return result of an Objective-C message not allowed">;
7534def ext_integer_increment_complex : Extension<
7535  "ISO C does not support '++'/'--' on complex integer type %0">;
7536def ext_integer_complement_complex : Extension<
7537  "ISO C does not support '~' for complex conjugation of %0">;
7538def err_nosetter_property_assignment : Error<
7539  "%select{assignment to readonly property|"
7540  "no setter method %1 for assignment to property}0">;
7541def err_nosetter_property_incdec : Error<
7542  "%select{%select{increment|decrement}1 of readonly property|"
7543  "no setter method %2 for %select{increment|decrement}1 of property}0">;
7544def err_nogetter_property_compound_assignment : Error<
7545  "a getter method is needed to perform a compound assignment on a property">;
7546def err_nogetter_property_incdec : Error<
7547  "no getter method %1 for %select{increment|decrement}0 of property">;
7548def err_no_subobject_property_setting : Error<
7549  "expression is not assignable">;
7550def err_qualified_objc_access : Error<
7551  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
7552
7553def ext_freestanding_complex : Extension<
7554  "complex numbers are an extension in a freestanding C99 implementation">;
7555
7556// FIXME: Remove when we support imaginary.
7557def err_imaginary_not_supported : Error<"imaginary types are not supported">;
7558
7559// Obj-c expressions
7560def warn_root_inst_method_not_found : Warning<
7561  "instance method %0 is being used on 'Class' which is not in the root class">,
7562  InGroup<MethodAccess>;
7563def warn_class_method_not_found : Warning<
7564  "class method %objcclass0 not found (return type defaults to 'id')">,
7565  InGroup<MethodAccess>;
7566def warn_instance_method_on_class_found : Warning<
7567  "instance method %0 found instead of class method %1">,
7568  InGroup<MethodAccess>;
7569def warn_inst_method_not_found : Warning<
7570  "instance method %objcinstance0 not found (return type defaults to 'id')">,
7571  InGroup<MethodAccess>;
7572def warn_instance_method_not_found_with_typo : Warning<
7573  "instance method %objcinstance0 not found (return type defaults to 'id')"
7574  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
7575def warn_class_method_not_found_with_typo : Warning<
7576  "class method %objcclass0 not found (return type defaults to 'id')"
7577  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
7578def err_method_not_found_with_typo : Error<
7579  "%select{instance|class}1 method %0 not found "
7580  "; did you mean %2?">;
7581def err_no_super_class_message : Error<
7582  "no @interface declaration found in class messaging of %0">;
7583def err_root_class_cannot_use_super : Error<
7584  "%0 cannot use 'super' because it is a root class">;
7585def err_invalid_receiver_to_message_super : Error<
7586  "'super' is only valid in a method body">;
7587def err_invalid_receiver_class_message : Error<
7588  "receiver type %0 is not an Objective-C class">;
7589def err_missing_open_square_message_send : Error<
7590  "missing '[' at start of message send expression">;
7591def warn_bad_receiver_type : Warning<
7592  "receiver type %0 is not 'id' or interface pointer, consider "
7593  "casting it to 'id'">,InGroup<ObjCReceiver>;
7594def err_bad_receiver_type : Error<"bad receiver type %0">;
7595def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
7596def err_unknown_receiver_suggest : Error<
7597  "unknown receiver %0; did you mean %1?">;
7598def err_objc_throw_expects_object : Error<
7599  "@throw requires an Objective-C object type (%0 invalid)">;
7600def err_objc_synchronized_expects_object : Error<
7601  "@synchronized requires an Objective-C object type (%0 invalid)">;
7602def err_rethrow_used_outside_catch : Error<
7603  "@throw (rethrow) used outside of a @catch block">;
7604def err_attribute_multiple_objc_gc : Error<
7605  "multiple garbage collection attributes specified for type">;
7606def err_catch_param_not_objc_type : Error<
7607  "@catch parameter is not a pointer to an interface type">;
7608def err_illegal_qualifiers_on_catch_parm : Error<
7609  "illegal qualifiers on @catch parameter">;
7610def err_storage_spec_on_catch_parm : Error<
7611  "@catch parameter cannot have storage specifier '%0'">;
7612def warn_register_objc_catch_parm : Warning<
7613  "'register' storage specifier on @catch parameter will be ignored">;
7614def err_qualified_objc_catch_parm : Error<
7615  "@catch parameter declarator cannot be qualified">;
7616def warn_objc_pointer_cxx_catch_fragile : Warning<
7617  "cannot catch an exception thrown with @throw in C++ in the non-unified "
7618  "exception model">, InGroup<ObjCNonUnifiedException>;
7619def err_objc_object_catch : Error<
7620  "cannot catch an Objective-C object by value">;
7621def err_incomplete_type_objc_at_encode : Error<
7622  "'@encode' of incomplete type %0">;
7623def warn_objc_circular_container : Warning<
7624  "adding %0 to %1 might cause circular dependency in container">,
7625  InGroup<DiagGroup<"objc-circular-container">>;
7626def note_objc_circular_container_declared_here : Note<"%0 declared here">;
7627def warn_objc_unsafe_perform_selector : Warning<
7628  "%0 is incompatible with selectors that return a "
7629  "%select{struct|union|vector}1 type">,
7630  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
7631def note_objc_unsafe_perform_selector_method_declared_here :  Note<
7632  "method %0 that returns %1 declared here">;
7633def err_attribute_arm_builtin_alias : Error<
7634  "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
7635def err_attribute_arm_mve_polymorphism : Error<
7636  "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
7637def err_attribute_webassembly_funcref : Error<
7638  "'__funcref' attribute can only be applied to a function pointer type">;
7639
7640def warn_setter_getter_impl_required : Warning<
7641  "property %0 requires method %1 to be defined - "
7642  "use @synthesize, @dynamic or provide a method implementation "
7643  "in this class implementation">,
7644  InGroup<ObjCPropertyImpl>;
7645def warn_setter_getter_impl_required_in_category : Warning<
7646  "property %0 requires method %1 to be defined - "
7647  "use @dynamic or provide a method implementation in this category">,
7648  InGroup<ObjCPropertyImpl>;
7649def note_parameter_named_here : Note<
7650  "passing argument to parameter %0 here">;
7651def note_parameter_here : Note<
7652  "passing argument to parameter here">;
7653def note_method_return_type_change : Note<
7654  "compiler has implicitly changed method %0 return type">;
7655
7656def warn_impl_required_for_class_property : Warning<
7657  "class property %0 requires method %1 to be defined - "
7658  "use @dynamic or provide a method implementation "
7659  "in this class implementation">,
7660  InGroup<ObjCPropertyImpl>;
7661def warn_impl_required_in_category_for_class_property : Warning<
7662  "class property %0 requires method %1 to be defined - "
7663  "use @dynamic or provide a method implementation in this category">,
7664  InGroup<ObjCPropertyImpl>;
7665
7666// C++ casts
7667// These messages adhere to the TryCast pattern: %0 is an int specifying the
7668// cast type, %1 is the source type, %2 is the destination type.
7669def err_bad_reinterpret_cast_overload : Error<
7670  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
7671
7672def warn_reinterpret_different_from_static : Warning<
7673  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
7674  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
7675  "'static_cast'">, InGroup<ReinterpretBaseClass>;
7676def note_reinterpret_updowncast_use_static: Note<
7677  "use 'static_cast' to adjust the pointer correctly while "
7678  "%select{upcasting|downcasting}0">;
7679
7680def err_bad_static_cast_overload : Error<
7681  "address of overloaded function %0 cannot be static_cast to type %1">;
7682
7683def err_bad_cstyle_cast_overload : Error<
7684  "address of overloaded function %0 cannot be cast to type %1">;
7685
7686
7687def err_bad_cxx_cast_generic : Error<
7688  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7689  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7690def err_bad_cxx_cast_unrelated_class : Error<
7691  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7692  "functional-style cast|}0 from %1 to %2, which are not related by "
7693  "inheritance, is not allowed">;
7694def note_type_incomplete : Note<"%0 is incomplete">;
7695def err_bad_cxx_cast_rvalue : Error<
7696  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7697  "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7698def err_bad_cxx_cast_bitfield : Error<
7699  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7700  "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7701def err_bad_cxx_cast_qualifiers_away : Error<
7702  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7703  "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7704def err_bad_cxx_cast_addr_space_mismatch : Error<
7705  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7706  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7707  " spaces">;
7708def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7709  "ISO C++ does not allow "
7710  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7711  "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
7712  "even though the source and destination types are unrelated">,
7713  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
7714def err_bad_const_cast_dest : Error<
7715  "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
7716  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
7717def ext_cast_fn_obj : Extension<
7718  "cast between pointer-to-function and pointer-to-object is an extension">;
7719def ext_ms_cast_fn_obj : ExtWarn<
7720  "static_cast between pointer-to-function and pointer-to-object is a "
7721  "Microsoft extension">, InGroup<MicrosoftCast>;
7722def warn_cxx98_compat_cast_fn_obj : Warning<
7723  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
7724  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7725def err_bad_reinterpret_cast_small_int : Error<
7726  "cast from pointer to smaller type %2 loses information">;
7727def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
7728  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7729  "to scalar %2 of different size">;
7730def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
7731  "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
7732  "to vector %2 of different size">;
7733def err_bad_cxx_cast_vector_to_vector_different_size : Error<
7734  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7735  "to vector %2 of different size">;
7736def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
7737  "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
7738  "changes address space of nested pointers">,
7739  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7740def err_bad_lvalue_to_rvalue_cast : Error<
7741  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
7742  "not compatible">;
7743def err_bad_rvalue_to_rvalue_cast : Error<
7744  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
7745  "not compatible">;
7746def err_bad_static_cast_pointer_nonpointer : Error<
7747  "cannot cast from type %1 to pointer type %2">;
7748def err_bad_static_cast_member_pointer_nonmp : Error<
7749  "cannot cast from type %1 to member pointer type %2">;
7750def err_bad_cxx_cast_member_pointer_size : Error<
7751  "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
7752  "type %1 to member pointer type %2 of different size">;
7753def err_bad_reinterpret_cast_reference : Error<
7754  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
7755def warn_undefined_reinterpret_cast : Warning<
7756  "reinterpret_cast from %0 to %1 has undefined behavior">,
7757  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7758
7759// These messages don't adhere to the pattern.
7760// FIXME: Display the path somehow better.
7761def err_ambiguous_base_to_derived_cast : Error<
7762  "ambiguous cast from base %0 to derived %1:%2">;
7763def err_static_downcast_via_virtual : Error<
7764  "cannot cast %0 to %1 via virtual base %2">;
7765def err_downcast_from_inaccessible_base : Error<
7766  "cannot cast %select{private|protected}2 base class %1 to %0">;
7767def err_upcast_to_inaccessible_base : Error<
7768  "cannot cast %0 to its %select{private|protected}2 base class %1">;
7769def err_bad_dynamic_cast_not_ref_or_ptr : Error<
7770  "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
7771def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
7772def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
7773def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
7774def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
7775
7776// Other C++ expressions
7777def err_need_header_before_typeid : Error<
7778  "you need to include <typeinfo> before using the 'typeid' operator">;
7779def err_need_header_before_placement_new : Error<
7780  "no matching %0 function for non-allocating placement new expression; "
7781  "include <new>">;
7782def err_ms___leave_not_in___try : Error<
7783  "'__leave' statement not in __try block">;
7784def err_uuidof_without_guid : Error<
7785  "cannot call operator __uuidof on a type with no GUID">;
7786def err_uuidof_with_multiple_guids : Error<
7787  "cannot call operator __uuidof on a type with multiple GUIDs">;
7788def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
7789def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
7790def err_static_illegal_in_new : Error<
7791  "the 'static' modifier for the array size is not legal in new expressions">;
7792def err_array_new_needs_size : Error<
7793  "array size must be specified in new expression with no initializer">;
7794def err_bad_new_type : Error<
7795  "cannot allocate %select{function|reference}1 type %0 with new">;
7796def err_new_incomplete_or_sizeless_type : Error<
7797  "allocation of %select{incomplete|sizeless}0 type %1">;
7798def err_new_array_nonconst : Error<
7799  "only the first dimension of an allocated array may have dynamic size">;
7800def err_new_array_size_unknown_from_init : Error<
7801  "cannot determine allocated array size from initializer">;
7802def err_new_array_init_args : Error<
7803  "array 'new' cannot have initialization arguments">;
7804def ext_new_paren_array_nonconst : ExtWarn<
7805  "when type is in parentheses, array cannot have dynamic size">;
7806def err_placement_new_non_placement_delete : Error<
7807  "'new' expression with placement arguments refers to non-placement "
7808  "'operator delete'">;
7809def err_array_size_not_integral : Error<
7810  "array size expression must have integral or %select{|unscoped }0"
7811  "enumeration type, not %1">;
7812def err_array_size_incomplete_type : Error<
7813  "array size expression has incomplete class type %0">;
7814def err_array_size_explicit_conversion : Error<
7815  "array size expression of type %0 requires explicit conversion to type %1">;
7816def note_array_size_conversion : Note<
7817  "conversion to %select{integral|enumeration}0 type %1 declared here">;
7818def err_array_size_ambiguous_conversion : Error<
7819  "ambiguous conversion of array size expression of type %0 to an integral or "
7820  "enumeration type">;
7821def ext_array_size_conversion : Extension<
7822  "implicit conversion from array size expression of type %0 to "
7823  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7824  InGroup<CXX11>;
7825def warn_cxx98_compat_array_size_conversion : Warning<
7826  "implicit conversion from array size expression of type %0 to "
7827  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7828  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7829def err_address_space_qualified_new : Error<
7830  "'new' cannot allocate objects of type %0 in address space '%1'">;
7831def err_address_space_qualified_delete : Error<
7832  "'delete' cannot delete objects of type %0 in address space '%1'">;
7833
7834def err_default_init_const : Error<
7835  "default initialization of an object of const type %0"
7836  "%select{| without a user-provided default constructor}1">;
7837def ext_default_init_const : ExtWarn<
7838  "default initialization of an object of const type %0"
7839  "%select{| without a user-provided default constructor}1 "
7840  "is a Microsoft extension">,
7841  InGroup<MicrosoftConstInit>;
7842def err_delete_operand : Error<"cannot delete expression of type %0">;
7843def ext_delete_void_ptr_operand : ExtWarn<
7844  "cannot delete expression with pointer-to-'void' type %0">,
7845  InGroup<DeleteIncomplete>;
7846def err_ambiguous_delete_operand : Error<
7847  "ambiguous conversion of delete expression of type %0 to a pointer">;
7848def warn_delete_incomplete : Warning<
7849  "deleting pointer to incomplete type %0 may cause undefined behavior">,
7850  InGroup<DeleteIncomplete>;
7851def err_delete_incomplete_class_type : Error<
7852  "deleting incomplete class type %0; no conversions to pointer type">;
7853def err_delete_explicit_conversion : Error<
7854  "converting delete expression from type %0 to type %1 invokes an explicit "
7855  "conversion function">;
7856def note_delete_conversion : Note<"conversion to pointer type %0">;
7857def warn_delete_array_type : Warning<
7858  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7859def warn_mismatched_delete_new : Warning<
7860  "'delete%select{|[]}0' applied to a pointer that was allocated with "
7861  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7862  InGroup<DiagGroup<"mismatched-new-delete">>;
7863def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7864def err_no_suitable_delete_member_function_found : Error<
7865  "no suitable member %0 in %1">;
7866def err_ambiguous_suitable_delete_member_function_found : Error<
7867  "multiple suitable %0 functions in %1">;
7868def warn_ambiguous_suitable_delete_function_found : Warning<
7869  "multiple suitable %0 functions for %1; no 'operator delete' function "
7870  "will be invoked if initialization throws an exception">,
7871  InGroup<DiagGroup<"ambiguous-delete">>;
7872def note_member_declared_here : Note<
7873  "member %0 declared here">;
7874def note_member_first_declared_here : Note<
7875  "member %0 first declared here">;
7876def warn_bitwise_instead_of_logical : Warning<
7877  "use of bitwise '%0' with boolean operands">,
7878  InGroup<BitwiseInsteadOfLogical>, DefaultIgnore;
7879def warn_bitwise_negation_bool : Warning<
7880  "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7881  "did you mean logical negation?">,
7882  InGroup<BoolOperation>, DefaultIgnore;
7883def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7884def warn_increment_bool : Warning<
7885  "incrementing expression of type bool is deprecated and "
7886  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7887def ext_increment_bool : ExtWarn<
7888  "ISO C++17 does not allow incrementing expression of type bool">,
7889  DefaultError, SFINAEFailure, InGroup<IncrementBool>;
7890def err_increment_decrement_enum : Error<
7891  "cannot %select{decrement|increment}0 expression of enum type %1">;
7892
7893def warn_deprecated_increment_decrement_volatile : Warning<
7894  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7895  "is deprecated">, InGroup<DeprecatedVolatile>;
7896def warn_deprecated_simple_assign_volatile : Warning<
7897  "use of result of assignment to object of volatile-qualified type %0 "
7898  "is deprecated">, InGroup<DeprecatedVolatile>;
7899def warn_deprecated_volatile_return : Warning<
7900  "volatile-qualified return type %0 is deprecated">,
7901  InGroup<DeprecatedVolatile>;
7902def warn_deprecated_volatile_param : Warning<
7903  "volatile-qualified parameter type %0 is deprecated">,
7904  InGroup<DeprecatedVolatile>;
7905def warn_deprecated_volatile_structured_binding : Warning<
7906  "volatile qualifier in structured binding declaration is deprecated">,
7907  InGroup<DeprecatedVolatile>;
7908
7909def warn_deprecated_altivec_src_compat : Warning<
7910  "Current handling of vector bool and vector pixel types in this context are "
7911  "deprecated. The default behaviour will soon change to that implied by the "
7912  "'-altivec-compat=xl' option">,
7913  InGroup<DiagGroup<"deprecated-altivec-src-compat">>;
7914
7915def warn_deprecated_lax_vec_conv_all : Warning<
7916  "Implicit conversion between vector types ('%0' and '%1') is deprecated. "
7917  "In the future, the behavior implied by '-fno-lax-vector-conversions' "
7918  "will be the default.">,
7919  InGroup<DiagGroup<"deprecate-lax-vec-conv-all">>;
7920
7921def err_catch_incomplete_ptr : Error<
7922  "cannot catch pointer to incomplete type %0">;
7923def err_catch_incomplete_ref : Error<
7924  "cannot catch reference to incomplete type %0">;
7925def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7926def err_catch_sizeless : Error<
7927  "cannot catch %select{|reference to }0sizeless type %1">;
7928def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7929def err_catch_variably_modified : Error<
7930  "cannot catch variably modified type %0">;
7931def err_qualified_catch_declarator : Error<
7932  "exception declarator cannot be qualified">;
7933def err_early_catch_all : Error<"catch-all handler must come last">;
7934def err_bad_memptr_rhs : Error<
7935  "right hand operand to %0 has non-pointer-to-member type %1">;
7936def err_bad_memptr_lhs : Error<
7937  "left hand operand to %0 must be a %select{|pointer to }1class "
7938  "compatible with the right hand operand, but is %2">;
7939def err_memptr_incomplete : Error<
7940  "member pointer has incomplete base type %0">;
7941def warn_exception_caught_by_earlier_handler : Warning<
7942  "exception of type %0 will be caught by earlier handler">,
7943  InGroup<Exceptions>;
7944def note_previous_exception_handler : Note<"for type %0">;
7945def err_exceptions_disabled : Error<
7946  "cannot use '%0' with exceptions disabled">;
7947def err_objc_exceptions_disabled : Error<
7948  "cannot use '%0' with Objective-C exceptions disabled">;
7949def warn_throw_in_noexcept_func : Warning<
7950  "%0 has a non-throwing exception specification but can still throw">,
7951  InGroup<Exceptions>;
7952def note_throw_in_dtor : Note<
7953  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7954  "non-throwing}1 exception specification">;
7955def note_throw_in_function : Note<"function declared non-throwing here">;
7956def err_seh_try_outside_functions : Error<
7957  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7958def err_mixing_cxx_try_seh_try : Error<
7959  "cannot use %select{C++ 'try'|Objective-C '@try'}0 "
7960  "in the same function as SEH '__try'">;
7961def err_seh_try_unsupported : Error<
7962  "SEH '__try' is not supported on this target">;
7963def note_conflicting_try_here : Note<
7964  "conflicting %0 here">;
7965def warn_jump_out_of_seh_finally : Warning<
7966  "jump out of __finally block has undefined behavior">,
7967  InGroup<DiagGroup<"jump-seh-finally">>;
7968def warn_non_virtual_dtor : Warning<
7969  "%0 has virtual functions but non-virtual destructor">,
7970  InGroup<NonVirtualDtor>, DefaultIgnore;
7971def warn_delete_non_virtual_dtor : Warning<
7972  "%select{delete|destructor}0 called on non-final %1 that has "
7973  "virtual functions but non-virtual destructor">,
7974  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7975def note_delete_non_virtual : Note<
7976  "qualify call to silence this warning">;
7977def warn_delete_abstract_non_virtual_dtor : Warning<
7978  "%select{delete|destructor}0 called on %1 that is abstract but has "
7979  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7980def warn_overloaded_virtual : Warning<
7981  "%q0 hides overloaded virtual %select{function|functions}1">,
7982  InGroup<OverloadedVirtual>, DefaultIgnore;
7983def note_hidden_overloaded_virtual_declared_here : Note<
7984  "hidden overloaded virtual function %q0 declared here"
7985  "%select{|: different classes%diff{ ($ vs $)|}2,3"
7986  "|: different number of parameters (%2 vs %3)"
7987  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7988  "|: different return type%diff{ ($ vs $)|}2,3"
7989  "|: different qualifiers (%2 vs %3)"
7990  "|: different exception specifications}1">;
7991def warn_using_directive_in_header : Warning<
7992  "using namespace directive in global context in header">,
7993  InGroup<HeaderHygiene>, DefaultIgnore;
7994def warn_overaligned_type : Warning<
7995  "type %0 requires %1 bytes of alignment and the default allocator only "
7996  "guarantees %2 bytes">,
7997  InGroup<OveralignedType>, DefaultIgnore;
7998def err_array_element_alignment : Error<
7999  "size of array element of type %0 (%1 bytes) isn't a multiple of its alignment (%2 bytes)">;
8000def err_aligned_allocation_unavailable : Error<
8001  "aligned %select{allocation|deallocation}0 function of type '%1' is "
8002  "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
8003def note_silence_aligned_allocation_unavailable : Note<
8004  "if you supply your own aligned allocation functions, use "
8005  "-faligned-allocation to silence this diagnostic">;
8006
8007def err_conditional_void_nonvoid : Error<
8008  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
8009  "is of type %0">;
8010def err_conditional_ambiguous : Error<
8011  "conditional expression is ambiguous; "
8012  "%diff{$ can be converted to $ and vice versa|"
8013  "types can be convert to each other}0,1">;
8014def err_conditional_ambiguous_ovl : Error<
8015  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
8016  "can be converted to several common types">;
8017def err_conditional_vector_size : Error<
8018  "vector condition type %0 and result type %1 do not have the same number "
8019  "of elements">;
8020def err_conditional_vector_element_size : Error<
8021  "vector condition type %0 and result type %1 do not have elements of the "
8022  "same size">;
8023def err_conditional_vector_has_void : Error<
8024  "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
8025def err_conditional_vector_operand_type
8026    : Error<"enumeration type %0 is not allowed in a vector conditional">;
8027def err_conditional_vector_cond_result_mismatch
8028    : Error<"cannot mix vectors and extended vectors in a vector conditional">;
8029def err_conditional_vector_mismatched
8030    : Error<"vector operands to the vector conditional must be the same type "
8031            "%diff{($ and $)|}0,1}">;
8032
8033def err_throw_incomplete : Error<
8034  "cannot throw object of incomplete type %0">;
8035def err_throw_incomplete_ptr : Error<
8036  "cannot throw pointer to object of incomplete type %0">;
8037def err_throw_sizeless : Error<
8038  "cannot throw object of sizeless type %0">;
8039def warn_throw_underaligned_obj : Warning<
8040  "underaligned exception object thrown">,
8041  InGroup<UnderalignedExceptionObject>;
8042def note_throw_underaligned_obj : Note<
8043  "required alignment of type %0 (%1 bytes) is larger than the supported "
8044  "alignment of C++ exception objects on this target (%2 bytes)">;
8045def err_return_in_constructor_handler : Error<
8046  "return in the catch of a function try block of a constructor is illegal">;
8047def warn_cdtor_function_try_handler_mem_expr : Warning<
8048  "cannot refer to a non-static member from the handler of a "
8049  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
8050def err_throw_object_throwing_dtor : Error<
8051  "cannot throw object of type %0 with a potentially-throwing destructor">;
8052
8053let CategoryName = "Lambda Issue" in {
8054  def err_capture_more_than_once : Error<
8055    "%0 can appear only once in a capture list">;
8056  def err_reference_capture_with_reference_default : Error<
8057    "'&' cannot precede a capture when the capture default is '&'">;
8058  def err_copy_capture_with_copy_default : Error<
8059    "'&' must precede a capture when the capture default is '='">;
8060  def err_capture_does_not_name_variable : Error<
8061    "%0 in capture list does not name a variable">;
8062  def err_capture_non_automatic_variable : Error<
8063    "%0 cannot be captured because it does not have automatic storage "
8064    "duration">;
8065  def err_this_capture : Error<
8066    "'this' cannot be %select{implicitly |}0captured in this context">;
8067  def note_lambda_this_capture_fixit : Note<
8068    "explicitly capture 'this'">;
8069  def err_lambda_capture_anonymous_var : Error<
8070    "unnamed variable cannot be implicitly captured in a lambda expression">;
8071  def err_lambda_capture_flexarray_type : Error<
8072    "variable %0 with flexible array member cannot be captured in "
8073    "a lambda expression">;
8074  def err_lambda_impcap : Error<
8075    "variable %0 cannot be implicitly captured in a lambda with no "
8076    "capture-default specified">;
8077  def note_lambda_variable_capture_fixit : Note<
8078    "capture %0 by %select{value|reference}1">;
8079  def note_lambda_default_capture_fixit : Note<
8080    "default capture by %select{value|reference}0">;
8081  def note_lambda_decl : Note<"lambda expression begins here">;
8082  def err_lambda_unevaluated_operand : Error<
8083    "lambda expression in an unevaluated operand">;
8084  def err_lambda_in_constant_expression : Error<
8085    "a lambda expression may not appear inside of a constant expression">;
8086  def err_lambda_in_invalid_context : Error<
8087    "a lambda expression cannot appear in this context">;
8088  def err_lambda_return_init_list : Error<
8089    "cannot deduce lambda return type from initializer list">;
8090  def err_lambda_capture_default_arg : Error<
8091    "lambda expression in default argument cannot capture any entity">;
8092  def err_lambda_incomplete_result : Error<
8093    "incomplete result type %0 in lambda expression">;
8094  def err_noreturn_lambda_has_return_expr : Error<
8095    "lambda declared 'noreturn' should not return">;
8096  def warn_maybe_falloff_nonvoid_lambda : Warning<
8097    "non-void lambda does not return a value in all control paths">,
8098    InGroup<ReturnType>;
8099  def warn_falloff_nonvoid_lambda : Warning<
8100    "non-void lambda does not return a value">,
8101    InGroup<ReturnType>;
8102  def err_access_lambda_capture : Error<
8103    // The ERRORs represent other special members that aren't constructors, in
8104    // hopes that someone will bother noticing and reporting if they appear
8105    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
8106    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
8107    AccessControl;
8108  def note_lambda_to_block_conv : Note<
8109    "implicit capture of lambda object due to conversion to block pointer "
8110    "here">;
8111  def note_var_explicitly_captured_here : Note<"variable %0 is"
8112    "%select{| explicitly}1 captured here">;
8113
8114  // C++14 lambda init-captures.
8115  def warn_cxx11_compat_init_capture : Warning<
8116    "initialized lambda captures are incompatible with C++ standards "
8117    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
8118  def ext_init_capture : ExtWarn<
8119    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
8120  def err_init_capture_no_expression : Error<
8121    "initializer missing for lambda capture %0">;
8122  def err_init_capture_multiple_expressions : Error<
8123    "initializer for lambda capture %0 contains multiple expressions">;
8124  def err_init_capture_paren_braces : Error<
8125    "cannot deduce type for lambda capture %1 from "
8126    "%select{parenthesized|nested}0 initializer list">;
8127  def err_init_capture_deduction_failure : Error<
8128    "cannot deduce type for lambda capture %0 from initializer of type %2">;
8129  def err_init_capture_deduction_failure_from_init_list : Error<
8130    "cannot deduce type for lambda capture %0 from initializer list">;
8131  def warn_cxx17_compat_init_capture_pack : Warning<
8132    "initialized lambda capture packs are incompatible with C++ standards "
8133    "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8134  def ext_init_capture_pack : ExtWarn<
8135    "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
8136
8137  // C++14 generic lambdas.
8138  def warn_cxx11_compat_generic_lambda : Warning<
8139    "generic lambdas are incompatible with C++11">,
8140    InGroup<CXXPre14Compat>, DefaultIgnore;
8141
8142  // C++17 '*this' captures.
8143  def warn_cxx14_compat_star_this_lambda_capture : Warning<
8144    "by value capture of '*this' is incompatible with C++ standards before C++17">,
8145     InGroup<CXXPre17Compat>, DefaultIgnore;
8146  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
8147    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
8148
8149  // C++17 parameter shadows capture
8150  def err_parameter_shadow_capture : Error<
8151    "a lambda parameter cannot shadow an explicitly captured entity">;
8152
8153  // C++20 [=, this] captures.
8154  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
8155    "explicit capture of 'this' with a capture default of '=' is incompatible "
8156    "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8157  def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
8158    "explicit capture of 'this' with a capture default of '=' "
8159    "is a C++20 extension">, InGroup<CXX20>;
8160  def warn_deprecated_this_capture : Warning<
8161    "implicit capture of 'this' with a capture default of '=' is deprecated">,
8162    InGroup<DeprecatedThisCapture>;
8163  def note_deprecated_this_capture : Note<
8164    "add an explicit capture of 'this' to capture '*this' by reference">;
8165
8166  // C++20 default constructible / assignable lambdas.
8167  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
8168    "%select{default construction|assignment}0 of lambda is incompatible with "
8169    "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8170}
8171
8172def err_return_in_captured_stmt : Error<
8173  "cannot return from %0">;
8174def err_capture_block_variable : Error<
8175  "__block variable %0 cannot be captured in a "
8176  "%select{lambda expression|captured statement}1">;
8177
8178def err_operator_arrow_circular : Error<
8179  "circular pointer delegation detected">;
8180def err_operator_arrow_depth_exceeded : Error<
8181  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
8182  "'operator->' calls">;
8183def note_operator_arrow_here : Note<
8184  "'operator->' declared here produces an object of type %0">;
8185def note_operator_arrows_suppressed : Note<
8186  "(skipping %0 'operator->'%s0 in backtrace)">;
8187def note_operator_arrow_depth : Note<
8188  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
8189
8190def err_pseudo_dtor_base_not_scalar : Error<
8191  "object expression of non-scalar type %0 cannot be used in a "
8192  "pseudo-destructor expression">;
8193def ext_pseudo_dtor_on_void : ExtWarn<
8194  "pseudo-destructors on type void are a Microsoft extension">,
8195  InGroup<MicrosoftVoidPseudoDtor>;
8196def err_pseudo_dtor_type_mismatch : Error<
8197  "the type of object expression "
8198  "%diff{($) does not match the type being destroyed ($)|"
8199  "does not match the type being destroyed}0,1 "
8200  "in pseudo-destructor expression">;
8201def err_pseudo_dtor_call_with_args : Error<
8202  "call to pseudo-destructor cannot have any arguments">;
8203def err_dtor_expr_without_call : Error<
8204  "reference to %select{destructor|pseudo-destructor}0 must be called"
8205  "%select{|; did you mean to call it with no arguments?}1">;
8206def err_pseudo_dtor_destructor_non_type : Error<
8207  "%0 does not refer to a type name in pseudo-destructor expression; expected "
8208  "the name of type %1">;
8209def err_invalid_use_of_function_type : Error<
8210  "a function type is not allowed here">;
8211def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
8212def err_typecheck_bool_condition : Error<
8213  "value of type %0 is not contextually convertible to 'bool'">;
8214def err_typecheck_ambiguous_condition : Error<
8215  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
8216def err_typecheck_nonviable_condition : Error<
8217  "no viable conversion%select{%diff{ from $ to $|}1,2|"
8218  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
8219def err_typecheck_nonviable_condition_incomplete : Error<
8220  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
8221def err_typecheck_deleted_function : Error<
8222  "conversion function %diff{from $ to $|between types}0,1 "
8223  "invokes a deleted function">;
8224
8225def err_expected_class_or_namespace : Error<"%0 is not a class"
8226  "%select{ or namespace|, namespace, or enumeration}1">;
8227def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
8228  "because namespace %1 does not enclose namespace %2">;
8229def err_export_non_namespace_scope_name : Error<
8230  "cannot export %0 as it is not at namespace scope">;
8231def err_redeclaration_non_exported : Error <
8232  "cannot export redeclaration %0 here since the previous declaration "
8233  "%select{is not exported|has internal linkage|has module linkage}1">;
8234def err_invalid_declarator_global_scope : Error<
8235  "definition or redeclaration of %0 cannot name the global scope">;
8236def err_invalid_declarator_in_function : Error<
8237  "definition or redeclaration of %0 not allowed inside a function">;
8238def err_invalid_declarator_in_block : Error<
8239  "definition or redeclaration of %0 not allowed inside a block">;
8240def err_not_tag_in_scope : Error<
8241  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
8242
8243def err_no_typeid_with_fno_rtti : Error<
8244  "use of typeid requires -frtti">;
8245def err_no_dynamic_cast_with_fno_rtti : Error<
8246  "use of dynamic_cast requires -frtti">;
8247def warn_no_dynamic_cast_with_rtti_disabled: Warning<
8248  "dynamic_cast will not work since RTTI data is disabled by "
8249  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8250def warn_no_typeid_with_rtti_disabled: Warning<
8251  "typeid will not work since RTTI data is disabled by "
8252  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8253
8254def err_cannot_form_pointer_to_member_of_reference_type : Error<
8255  "cannot form a pointer-to-member to member %0 of reference type %1">;
8256def err_incomplete_object_call : Error<
8257  "incomplete type in call to object of type %0">;
8258
8259def warn_condition_is_assignment : Warning<"using the result of an "
8260  "assignment as a condition without parentheses">,
8261  InGroup<Parentheses>;
8262def warn_free_nonheap_object
8263  : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
8264    InGroup<FreeNonHeapObject>;
8265
8266// Completely identical except off by default.
8267def warn_condition_is_idiomatic_assignment : Warning<"using the result "
8268  "of an assignment as a condition without parentheses">,
8269  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
8270def note_condition_assign_to_comparison : Note<
8271  "use '==' to turn this assignment into an equality comparison">;
8272def note_condition_or_assign_to_comparison : Note<
8273  "use '!=' to turn this compound assignment into an inequality comparison">;
8274def note_condition_assign_silence : Note<
8275  "place parentheses around the assignment to silence this warning">;
8276
8277def warn_equality_with_extra_parens : Warning<"equality comparison with "
8278  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
8279def note_equality_comparison_to_assign : Note<
8280  "use '=' to turn this equality comparison into an assignment">;
8281def note_equality_comparison_silence : Note<
8282  "remove extraneous parentheses around the comparison to silence this warning">;
8283
8284// assignment related diagnostics (also for argument passing, returning, etc).
8285// In most of these diagnostics the %2 is a value from the
8286// Sema::AssignmentAction enumeration
8287def err_typecheck_convert_incompatible : Error<
8288  "%select{%diff{assigning to $ from incompatible type $|"
8289  "assigning to type from incompatible type}0,1"
8290  "|%diff{passing $ to parameter of incompatible type $|"
8291  "passing type to parameter of incompatible type}0,1"
8292  "|%diff{returning $ from a function with incompatible result type $|"
8293  "returning type from a function with incompatible result type}0,1"
8294  "|%diff{converting $ to incompatible type $|"
8295  "converting type to incompatible type}0,1"
8296  "|%diff{initializing $ with an expression of incompatible type $|"
8297  "initializing type with an expression of incompatible type}0,1"
8298  "|%diff{sending $ to parameter of incompatible type $|"
8299  "sending type to parameter of incompatible type}0,1"
8300  "|%diff{casting $ to incompatible type $|"
8301  "casting type to incompatible type}0,1}2"
8302  "%select{|; dereference with *|"
8303  "; take the address with &|"
8304  "; remove *|"
8305  "; remove &}3"
8306  "%select{|: different classes%diff{ ($ vs $)|}5,6"
8307  "|: different number of parameters (%5 vs %6)"
8308  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
8309  "|: different return type%diff{ ($ vs $)|}5,6"
8310  "|: different qualifiers (%5 vs %6)"
8311  "|: different exception specifications}4">;
8312def err_typecheck_missing_return_type_incompatible : Error<
8313  "%diff{return type $ must match previous return type $|"
8314  "return type must match previous return type}0,1 when %select{block "
8315  "literal|lambda expression}2 has unspecified explicit return type">;
8316
8317def note_incomplete_class_and_qualified_id : Note<
8318  "conformance of forward class %0 to protocol %1 can not be confirmed">;
8319def warn_incompatible_qualified_id : Warning<
8320  "%select{%diff{assigning to $ from incompatible type $|"
8321  "assigning to type from incompatible type}0,1"
8322  "|%diff{passing $ to parameter of incompatible type $|"
8323  "passing type to parameter of incompatible type}0,1"
8324  "|%diff{returning $ from a function with incompatible result type $|"
8325  "returning type from a function with incompatible result type}0,1"
8326  "|%diff{converting $ to incompatible type $|"
8327  "converting type to incompatible type}0,1"
8328  "|%diff{initializing $ with an expression of incompatible type $|"
8329  "initializing type with an expression of incompatible type}0,1"
8330  "|%diff{sending $ to parameter of incompatible type $|"
8331  "sending type to parameter of incompatible type}0,1"
8332  "|%diff{casting $ to incompatible type $|"
8333  "casting type to incompatible type}0,1}2">;
8334def err_incompatible_qualified_id : Error<
8335  "%select{%diff{assigning to $ from incompatible type $|"
8336  "assigning to type from incompatible type}0,1"
8337  "|%diff{passing $ to parameter of incompatible type $|"
8338  "passing type to parameter of incompatible type}0,1"
8339  "|%diff{returning $ from a function with incompatible result type $|"
8340  "returning type from a function with incompatible result type}0,1"
8341  "|%diff{converting $ to incompatible type $|"
8342  "converting type to incompatible type}0,1"
8343  "|%diff{initializing $ with an expression of incompatible type $|"
8344  "initializing type with an expression of incompatible type}0,1"
8345  "|%diff{sending $ to parameter of incompatible type $|"
8346  "sending type to parameter of incompatible type}0,1"
8347  "|%diff{casting $ to incompatible type $|"
8348  "casting type to incompatible type}0,1}2">;
8349def err_typecheck_convert_pointer_int : Error<
8350  "incompatible pointer to integer conversion "
8351  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8352  "|%diff{passing $ to parameter of type $|"
8353  "passing to parameter of different type}0,1"
8354  "|%diff{returning $ from a function with result type $|"
8355  "returning from function with different return type}0,1"
8356  "|%diff{converting $ to type $|converting between types}0,1"
8357  "|%diff{initializing $ with an expression of type $|"
8358  "initializing with expression of different type}0,1"
8359  "|%diff{sending $ to parameter of type $|"
8360  "sending to parameter of different type}0,1"
8361  "|%diff{casting $ to type $|casting between types}0,1}2"
8362  "%select{|; dereference with *|"
8363  "; take the address with &|"
8364  "; remove *|"
8365  "; remove &}3">;
8366def ext_typecheck_convert_pointer_int : ExtWarn<
8367  err_typecheck_convert_pointer_int.Summary>,
8368  InGroup<IntConversion>, DefaultError;
8369def err_typecheck_convert_int_pointer : Error<
8370  "incompatible integer to pointer conversion "
8371  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8372  "|%diff{passing $ to parameter of type $|"
8373  "passing to parameter of different type}0,1"
8374  "|%diff{returning $ from a function with result type $|"
8375  "returning from function with different return type}0,1"
8376  "|%diff{converting $ to type $|converting between types}0,1"
8377  "|%diff{initializing $ with an expression of type $|"
8378  "initializing with expression of different type}0,1"
8379  "|%diff{sending $ to parameter of type $|"
8380  "sending to parameter of different type}0,1"
8381  "|%diff{casting $ to type $|casting between types}0,1}2"
8382  "%select{|; dereference with *|"
8383  "; take the address with &|"
8384  "; remove *|"
8385  "; remove &}3">;
8386def ext_typecheck_convert_int_pointer : ExtWarn<
8387  err_typecheck_convert_int_pointer.Summary>,
8388  InGroup<IntConversion>, DefaultError;
8389def ext_typecheck_convert_pointer_void_func : Extension<
8390  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8391  "|%diff{passing $ to parameter of type $|"
8392  "passing to parameter of different type}0,1"
8393  "|%diff{returning $ from a function with result type $|"
8394  "returning from function with different return type}0,1"
8395  "|%diff{converting $ to type $|converting between types}0,1"
8396  "|%diff{initializing $ with an expression of type $|"
8397  "initializing with expression of different type}0,1"
8398  "|%diff{sending $ to parameter of type $|"
8399  "sending to parameter of different type}0,1"
8400  "|%diff{casting $ to type $|casting between types}0,1}2"
8401  " converts between void pointer and function pointer">;
8402def err_typecheck_convert_pointer_void_func : Error<
8403  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8404  "|%diff{passing $ to parameter of type $|"
8405  "passing to parameter of different type}0,1"
8406  "|%diff{returning $ from a function with result type $|"
8407  "returning from function with different return type}0,1"
8408  "|%diff{converting $ to type $|converting between types}0,1"
8409  "|%diff{initializing $ with an expression of type $|"
8410  "initializing with expression of different type}0,1"
8411  "|%diff{sending $ to parameter of type $|"
8412  "sending to parameter of different type}0,1"
8413  "|%diff{casting $ to type $|casting between types}0,1}2"
8414  " converts between void pointer and function pointer">;
8415def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
8416  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8417  "|%diff{passing $ to parameter of type $|"
8418  "passing to parameter of different type}0,1"
8419  "|%diff{returning $ from a function with result type $|"
8420  "returning from function with different return type}0,1"
8421  "|%diff{converting $ to type $|converting between types}0,1"
8422  "|%diff{initializing $ with an expression of type $|"
8423  "initializing with expression of different type}0,1"
8424  "|%diff{sending $ to parameter of type $|"
8425  "sending to parameter of different type}0,1"
8426  "|%diff{casting $ to type $|casting between types}0,1}2"
8427  " converts between pointers to integer types %select{with different sign|"
8428  "where one is of the unique plain 'char' type and the other is not}3">,
8429  InGroup<DiagGroup<"pointer-sign">>;
8430def err_typecheck_convert_incompatible_pointer_sign :
8431  Error<ext_typecheck_convert_incompatible_pointer_sign.Summary>;
8432def ext_typecheck_convert_incompatible_pointer : ExtWarn<
8433  "incompatible pointer types "
8434  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8435  "|%diff{passing $ to parameter of type $|"
8436  "passing to parameter of different type}0,1"
8437  "|%diff{returning $ from a function with result type $|"
8438  "returning from function with different return type}0,1"
8439  "|%diff{converting $ to type $|converting between types}0,1"
8440  "|%diff{initializing $ with an expression of type $|"
8441  "initializing with expression of different type}0,1"
8442  "|%diff{sending $ to parameter of type $|"
8443  "sending to parameter of different type}0,1"
8444  "|%diff{casting $ to type $|casting between types}0,1}2"
8445  "%select{|; dereference with *|"
8446  "; take the address with &|"
8447  "; remove *|"
8448  "; remove &}3">,
8449  InGroup<IncompatiblePointerTypes>;
8450def err_typecheck_convert_incompatible_pointer : Error<
8451  "incompatible pointer types "
8452  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8453  "|%diff{passing $ to parameter of type $|"
8454  "passing to parameter of different type}0,1"
8455  "|%diff{returning $ from a function with result type $|"
8456  "returning from function with different return type}0,1"
8457  "|%diff{converting $ to type $|converting between types}0,1"
8458  "|%diff{initializing $ with an expression of type $|"
8459  "initializing with expression of different type}0,1"
8460  "|%diff{sending $ to parameter of type $|"
8461  "sending to parameter of different type}0,1"
8462  "|%diff{casting $ to type $|casting between types}0,1}2"
8463  "%select{|; dereference with *|"
8464  "; take the address with &|"
8465  "; remove *|"
8466  "; remove &}3">;
8467def err_typecheck_convert_incompatible_function_pointer : Error<
8468  "incompatible function pointer types "
8469  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8470  "|%diff{passing $ to parameter of type $|"
8471  "passing to parameter of different type}0,1"
8472  "|%diff{returning $ from a function with result type $|"
8473  "returning from function with different return type}0,1"
8474  "|%diff{converting $ to type $|converting between types}0,1"
8475  "|%diff{initializing $ with an expression of type $|"
8476  "initializing with expression of different type}0,1"
8477  "|%diff{sending $ to parameter of type $|"
8478  "sending to parameter of different type}0,1"
8479  "|%diff{casting $ to type $|casting between types}0,1}2"
8480  "%select{|; dereference with *|"
8481  "; take the address with &|"
8482  "; remove *|"
8483  "; remove &}3">;
8484def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
8485  err_typecheck_convert_incompatible_function_pointer.Summary>,
8486  InGroup<IncompatibleFunctionPointerTypes>, DefaultError;
8487def warn_typecheck_convert_incompatible_function_pointer_strict : Warning<
8488  err_typecheck_convert_incompatible_function_pointer.Summary>,
8489  InGroup<DiagGroup<"incompatible-function-pointer-types-strict">>, DefaultIgnore;
8490def ext_typecheck_convert_discards_qualifiers : ExtWarn<
8491  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8492  "|%diff{passing $ to parameter of type $|"
8493  "passing to parameter of different type}0,1"
8494  "|%diff{returning $ from a function with result type $|"
8495  "returning from function with different return type}0,1"
8496  "|%diff{converting $ to type $|converting between types}0,1"
8497  "|%diff{initializing $ with an expression of type $|"
8498  "initializing with expression of different type}0,1"
8499  "|%diff{sending $ to parameter of type $|"
8500  "sending to parameter of different type}0,1"
8501  "|%diff{casting $ to type $|casting between types}0,1}2"
8502  " discards qualifiers">,
8503  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8504def err_typecheck_convert_discards_qualifiers : Error<
8505  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8506  "|%diff{passing $ to parameter of type $|"
8507  "passing to parameter of different type}0,1"
8508  "|%diff{returning $ from a function with result type $|"
8509  "returning from function with different return type}0,1"
8510  "|%diff{converting $ to type $|converting between types}0,1"
8511  "|%diff{initializing $ with an expression of type $|"
8512  "initializing with expression of different type}0,1"
8513  "|%diff{sending $ to parameter of type $|"
8514  "sending to parameter of different type}0,1"
8515  "|%diff{casting $ to type $|casting between types}0,1}2"
8516  " discards qualifiers">;
8517def ext_nested_pointer_qualifier_mismatch : ExtWarn<
8518  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8519  "|%diff{passing $ to parameter of type $|"
8520  "passing to parameter of different type}0,1"
8521  "|%diff{returning $ from a function with result type $|"
8522  "returning from function with different return type}0,1"
8523  "|%diff{converting $ to type $|converting between types}0,1"
8524  "|%diff{initializing $ with an expression of type $|"
8525  "initializing with expression of different type}0,1"
8526  "|%diff{sending $ to parameter of type $|"
8527  "sending to parameter of different type}0,1"
8528  "|%diff{casting $ to type $|casting between types}0,1}2"
8529  " discards qualifiers in nested pointer types">,
8530  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8531def err_nested_pointer_qualifier_mismatch : Error<
8532  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8533  "|%diff{passing $ to parameter of type $|"
8534  "passing to parameter of different type}0,1"
8535  "|%diff{returning $ from a function with result type $|"
8536  "returning from function with different return type}0,1"
8537  "|%diff{converting $ to type $|converting between types}0,1"
8538  "|%diff{initializing $ with an expression of type $|"
8539  "initializing with expression of different type}0,1"
8540  "|%diff{sending $ to parameter of type $|"
8541  "sending to parameter of different type}0,1"
8542  "|%diff{casting $ to type $|casting between types}0,1}2"
8543  " discards qualifiers in nested pointer types">;
8544def warn_incompatible_vectors : Warning<
8545  "incompatible vector types "
8546  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8547  "|%diff{passing $ to parameter of type $|"
8548  "passing to parameter of different type}0,1"
8549  "|%diff{returning $ from a function with result type $|"
8550  "returning from function with different return type}0,1"
8551  "|%diff{converting $ to type $|converting between types}0,1"
8552  "|%diff{initializing $ with an expression of type $|"
8553  "initializing with expression of different type}0,1"
8554  "|%diff{sending $ to parameter of type $|"
8555  "sending to parameter of different type}0,1"
8556  "|%diff{casting $ to type $|casting between types}0,1}2">,
8557  InGroup<VectorConversion>, DefaultIgnore;
8558def err_incompatible_vectors : Error<
8559  "incompatible vector types "
8560  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8561  "|%diff{passing $ to parameter of type $|"
8562  "passing to parameter of different type}0,1"
8563  "|%diff{returning $ from a function with result type $|"
8564  "returning from function with different return type}0,1"
8565  "|%diff{converting $ to type $|converting between types}0,1"
8566  "|%diff{initializing $ with an expression of type $|"
8567  "initializing with expression of different type}0,1"
8568  "|%diff{sending $ to parameter of type $|"
8569  "sending to parameter of different type}0,1"
8570  "|%diff{casting $ to type $|casting between types}0,1}2">;
8571def err_int_to_block_pointer : Error<
8572  "invalid block pointer conversion "
8573  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8574  "|%diff{passing $ to parameter of type $|"
8575  "passing to parameter of different type}0,1"
8576  "|%diff{returning $ from a function with result type $|"
8577  "returning from function with different return type}0,1"
8578  "|%diff{converting $ to type $|converting between types}0,1"
8579  "|%diff{initializing $ with an expression of type $|"
8580  "initializing with expression of different type}0,1"
8581  "|%diff{sending $ to parameter of type $|"
8582  "sending to parameter of different type}0,1"
8583  "|%diff{casting $ to type $|casting between types}0,1}2">;
8584def err_typecheck_convert_incompatible_block_pointer : Error<
8585  "incompatible block pointer types "
8586  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8587  "|%diff{passing $ to parameter of type $|"
8588  "passing to parameter of different type}0,1"
8589  "|%diff{returning $ from a function with result type $|"
8590  "returning from function with different return type}0,1"
8591  "|%diff{converting $ to type $|converting between types}0,1"
8592  "|%diff{initializing $ with an expression of type $|"
8593  "initializing with expression of different type}0,1"
8594  "|%diff{sending $ to parameter of type $|"
8595  "sending to parameter of different type}0,1"
8596  "|%diff{casting $ to type $|casting between types}0,1}2">;
8597def err_typecheck_incompatible_address_space : Error<
8598  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8599  "|%diff{passing $ to parameter of type $|"
8600  "passing to parameter of different type}0,1"
8601  "|%diff{returning $ from a function with result type $|"
8602  "returning from function with different return type}0,1"
8603  "|%diff{converting $ to type $|converting between types}0,1"
8604  "|%diff{initializing $ with an expression of type $|"
8605  "initializing with expression of different type}0,1"
8606  "|%diff{sending $ to parameter of type $|"
8607  "sending to parameter of different type}0,1"
8608  "|%diff{casting $ to type $|casting between types}0,1}2"
8609  " changes address space of pointer">;
8610def err_typecheck_incompatible_nested_address_space : Error<
8611  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8612  "|%diff{passing $ to parameter of type $|"
8613  "passing to parameter of different type}0,1"
8614  "|%diff{returning $ from a function with result type $|"
8615  "returning from function with different return type}0,1"
8616  "|%diff{converting $ to type $|converting between types}0,1"
8617  "|%diff{initializing $ with an expression of type $|"
8618  "initializing with expression of different type}0,1"
8619  "|%diff{sending $ to parameter of type $|"
8620  "sending to parameter of different type}0,1"
8621  "|%diff{casting $ to type $|casting between types}0,1}2"
8622  " changes address space of nested pointer">;
8623def err_typecheck_incompatible_ownership : Error<
8624  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8625  "|%diff{passing $ to parameter of type $|"
8626  "passing to parameter of different type}0,1"
8627  "|%diff{returning $ from a function with result type $|"
8628  "returning from function with different return type}0,1"
8629  "|%diff{converting $ to type $|converting between types}0,1"
8630  "|%diff{initializing $ with an expression of type $|"
8631  "initializing with expression of different type}0,1"
8632  "|%diff{sending $ to parameter of type $|"
8633  "sending to parameter of different type}0,1"
8634  "|%diff{casting $ to type $|casting between types}0,1}2"
8635  " changes retain/release properties of pointer">;
8636def err_typecheck_comparison_of_distinct_blocks : Error<
8637  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
8638
8639def err_typecheck_array_not_modifiable_lvalue : Error<
8640  "array type %0 is not assignable">;
8641def err_typecheck_non_object_not_modifiable_lvalue : Error<
8642  "non-object type %0 is not assignable">;
8643def err_typecheck_expression_not_modifiable_lvalue : Error<
8644  "expression is not assignable">;
8645def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
8646  "incomplete type %0 is not assignable">;
8647def err_typecheck_lvalue_casts_not_supported : Error<
8648  "assignment to cast is illegal, lvalue casts are not supported">;
8649
8650def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
8651  "vector is not assignable (contains duplicate components)">;
8652def err_block_decl_ref_not_modifiable_lvalue : Error<
8653  "variable is not assignable (missing __block type specifier)">;
8654def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8655  "cannot assign to a variable captured by copy in a non-mutable lambda">;
8656def err_typecheck_call_not_function : Error<
8657  "called object type %0 is not a function or function pointer">;
8658def err_call_incomplete_return : Error<
8659  "calling function with incomplete return type %0">;
8660def err_call_function_incomplete_return : Error<
8661  "calling %0 with incomplete return type %1">;
8662def err_call_incomplete_argument : Error<
8663  "argument type %0 is incomplete">;
8664def err_typecheck_call_too_few_args : Error<
8665  "too few %select{|||execution configuration }0"
8666  "%select{|non-object }3arguments to "
8667  "%select{function|block|method|kernel function}0 call, "
8668  "expected %1, have %2">;
8669def err_typecheck_call_too_few_args_one : Error<
8670  "too few %select{|||execution configuration }0"
8671  "%select{|non-object }2arguments to "
8672  "%select{function|block|method|kernel function}0 call, "
8673  "single argument %1 was not specified">;
8674def err_typecheck_call_too_few_args_at_least : Error<
8675  "too few %select{|||execution configuration }0"
8676  "%select{|non-object }3arguments to "
8677  "%select{function|block|method|kernel function}0 call, "
8678  "expected at least %1, have %2">;
8679def err_typecheck_call_too_few_args_at_least_one : Error<
8680  "too few %select{|||execution configuration }0"
8681  "%select{|non-object }2arguments to "
8682  "%select{function|block|method|kernel function}0 call, "
8683  "at least argument %1 must be specified">;
8684def err_typecheck_call_too_few_args_suggest : Error<
8685  "too few %select{|||execution configuration }0"
8686  "%select{|non-object }3arguments to "
8687  "%select{function|block|method|kernel function}0 call, "
8688  "expected %1, have %2; did you mean %4?">;
8689def err_typecheck_call_too_few_args_at_least_suggest : Error<
8690  "too few %select{|||execution configuration }0"
8691  "%select{|non-object }3arguments to "
8692  "%select{function|block|method|kernel function}0 call, "
8693  "expected at least %1, have %2; did you mean %4?">;
8694def err_typecheck_call_too_many_args : Error<
8695  "too many %select{|||execution configuration }0"
8696  "%select{|non-object }3arguments to "
8697  "%select{function|block|method|kernel function}0 call, "
8698  "expected %1, have %2">;
8699def err_typecheck_call_too_many_args_one : Error<
8700  "too many %select{|||execution configuration }0"
8701  "%select{|non-object }3arguments to "
8702  "%select{function|block|method|kernel function}0 call, "
8703  "expected single argument %1, have %2 arguments">;
8704def err_typecheck_call_too_many_args_at_most : Error<
8705  "too many %select{|||execution configuration }0"
8706  "%select{|non-object }3arguments to "
8707  "%select{function|block|method|kernel function}0 call, "
8708  "expected at most %1, have %2">;
8709def err_typecheck_call_too_many_args_at_most_one : Error<
8710  "too many %select{|||execution configuration }0arguments to "
8711  "%select{function|block|method|kernel function}0 call, "
8712  "expected at most single %select{|non-object }3argument %1, "
8713  "have %2%select{|non-object}3 arguments">;
8714def err_typecheck_call_too_many_args_suggest : Error<
8715  "too many %select{|||execution configuration }0"
8716  "%select{|non-object }3arguments to "
8717  "%select{function|block|method|kernel function}0 call, "
8718  "expected %1, have %2; did you mean %4?">;
8719def err_typecheck_call_too_many_args_at_most_suggest : Error<
8720  "too many %select{|||execution configuration }0"
8721  "%select{|non-object }3arguments to "
8722  "%select{function|block|method|kernel function}0 call, "
8723  "expected at most %1, have %2; did you mean %4?">;
8724
8725def err_arc_typecheck_convert_incompatible_pointer : Error<
8726  "incompatible pointer types passing retainable parameter of type %0"
8727  "to a CF function expecting %1 type">;
8728
8729def err_builtin_fn_use : Error<"builtin functions must be directly called">;
8730
8731def warn_call_wrong_number_of_arguments : Warning<
8732  "too %select{few|many}0 arguments in call to %1">;
8733def err_atomic_builtin_must_be_pointer : Error<
8734  "address argument to atomic builtin must be a pointer (%0 invalid)">;
8735def err_atomic_builtin_must_be_pointer_intptr : Error<
8736  "address argument to atomic builtin must be a pointer to integer or pointer"
8737  " (%0 invalid)">;
8738def err_atomic_builtin_cannot_be_const : Error<
8739  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
8740def err_atomic_builtin_must_be_pointer_intfltptr : Error<
8741  "address argument to atomic builtin must be a pointer to integer,"
8742  " floating-point or pointer (%0 invalid)">;
8743def err_atomic_builtin_pointer_size : Error<
8744  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
8745  "type (%0 invalid)">;
8746def err_atomic_exclusive_builtin_pointer_size : Error<
8747  "address argument to load or store exclusive builtin must be a pointer to"
8748  " 1,2,4 or 8 byte type (%0 invalid)">;
8749def err_atomic_builtin_ext_int_size : Error<
8750  "Atomic memory operand must have a power-of-two size">;
8751def err_atomic_builtin_bit_int_prohibit : Error<
8752  "argument to atomic builtin of type '_BitInt' is not supported">;
8753def err_atomic_op_needs_atomic : Error<
8754  "address argument to atomic operation must be a pointer to _Atomic "
8755  "type (%0 invalid)">;
8756def err_atomic_op_needs_non_const_atomic : Error<
8757  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
8758  "type (%1 invalid)">;
8759def err_atomic_op_needs_non_const_pointer : Error<
8760  "address argument to atomic operation must be a pointer to non-const "
8761  "type (%0 invalid)">;
8762def err_atomic_op_needs_trivial_copy : Error<
8763  "address argument to atomic operation must be a pointer to a "
8764  "trivially-copyable type (%0 invalid)">;
8765def err_atomic_op_needs_atomic_int_ptr_or_fp : Error<
8766  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8767  "integer, pointer or supported floating point type (%1 invalid)">;
8768def err_atomic_op_needs_atomic_int_or_ptr : Error<
8769  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8770  "integer or pointer (%1 invalid)">;
8771def err_atomic_op_needs_atomic_int_or_fp : Error<
8772  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8773  "integer or supported floating point type (%1 invalid)">;
8774def err_atomic_op_needs_atomic_int : Error<
8775  "address argument to atomic operation must be a pointer to "
8776  "%select{|atomic }0integer (%1 invalid)">;
8777def warn_atomic_op_has_invalid_memory_order : Warning<
8778  "%select{|success |failure }0memory order argument to atomic operation is invalid">,
8779  InGroup<DiagGroup<"atomic-memory-ordering">>;
8780def err_atomic_op_has_invalid_synch_scope : Error<
8781  "synchronization scope argument to atomic operation is invalid">;
8782def warn_atomic_implicit_seq_cst : Warning<
8783  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
8784  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
8785
8786def err_overflow_builtin_must_be_int : Error<
8787  "operand argument to %select{overflow builtin|checked integer operation}0 "
8788  "must be an integer type %select{|other than plain 'char', 'bool', bit-precise, "
8789  "or an enumeration }0(%1 invalid)">;
8790def err_overflow_builtin_must_be_ptr_int : Error<
8791  "result argument to %select{overflow builtin|checked integer operation}0 "
8792  "must be a pointer to a non-const integer type %select{|other than plain 'char', "
8793  "'bool', bit-precise, or an enumeration }0(%1 invalid)">;
8794def err_overflow_builtin_bit_int_max_size : Error<
8795  "__builtin_mul_overflow does not support 'signed _BitInt' operands of more "
8796  "than %0 bits">;
8797def err_expected_struct_pointer_argument : Error<
8798  "expected pointer to struct as %ordinal0 argument to %1, found %2">;
8799def err_expected_callable_argument : Error<
8800  "expected a callable expression as %ordinal0 argument to %1, found %2">;
8801def note_building_builtin_dump_struct_call : Note<
8802  "in call to printing function with arguments '(%0)' while dumping struct">;
8803
8804def err_atomic_load_store_uses_lib : Error<
8805  "atomic %select{load|store}0 requires runtime support that is not "
8806  "available for this target">;
8807
8808def err_nontemporal_builtin_must_be_pointer : Error<
8809  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
8810def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
8811  "address argument to nontemporal builtin must be a pointer to integer, float, "
8812  "pointer, or a vector of such types (%0 invalid)">;
8813
8814def err_deleted_function_use : Error<"attempt to use a deleted function">;
8815def err_deleted_inherited_ctor_use : Error<
8816  "constructor inherited by %0 from base class %1 is implicitly deleted">;
8817
8818def note_called_by : Note<"called by %0">;
8819def err_kern_type_not_void_return : Error<
8820  "kernel function type %0 must have void return type">;
8821def err_kern_is_nonstatic_method : Error<
8822  "kernel function %0 must be a free function or static member function">;
8823def err_config_scalar_return : Error<
8824  "CUDA special function '%0' must have scalar return type">;
8825def err_kern_call_not_global_function : Error<
8826  "kernel call to non-global function %0">;
8827def err_global_call_not_config : Error<
8828  "call to global function %0 not configured">;
8829def err_ref_bad_target : Error<
8830  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8831  "%select{function|variable}1 %2 in %select{__device__|__global__|__host__|__host__ __device__}3 function">;
8832def note_cuda_const_var_unpromoted : Note<
8833  "const variable cannot be emitted on device side due to dynamic initialization">;
8834def note_cuda_host_var : Note<
8835  "host variable declared here">;
8836def err_ref_bad_target_global_initializer : Error<
8837  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8838  "function %1 in global initializer">;
8839def err_capture_bad_target : Error<
8840  "capture host variable %0 by reference in device or host device lambda function">;
8841def warn_maybe_capture_bad_target_this_ptr : Warning<
8842  "capture host side class data member by this pointer in device or host device lambda function "
8843  "may result in invalid memory access if this pointer is not accessible on device side">,
8844  InGroup<DiagGroup<"gpu-maybe-wrong-side">>;
8845def warn_kern_is_method : Extension<
8846  "kernel function %0 is a member function; this may not be accepted by nvcc">,
8847  InGroup<CudaCompat>;
8848def warn_kern_is_inline : Warning<
8849  "ignored 'inline' attribute on kernel function %0">,
8850  InGroup<CudaCompat>;
8851def err_variadic_device_fn : Error<
8852  "CUDA device code does not support variadic functions">;
8853def err_va_arg_in_device : Error<
8854"CUDA device code does not support va_arg">;
8855def err_alias_not_supported_on_nvptx : Error<"CUDA older than 10.0 does not support .alias">;
8856def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8857  "constexpr function %0 without __host__ or __device__ attributes cannot "
8858  "overload __device__ function with same signature.  Add a __host__ "
8859  "attribute, or build with -fno-cuda-host-device-constexpr.">;
8860def note_cuda_conflicting_device_function_declared_here : Note<
8861  "conflicting __device__ function declared here">;
8862def err_cuda_device_exceptions : Error<
8863  "cannot use '%0' in "
8864  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8865def err_dynamic_var_init : Error<
8866    "dynamic initialization is not supported for "
8867    "__device__, __constant__, __shared__, and __managed__ variables.">;
8868def err_shared_var_init : Error<
8869    "initialization is not supported for __shared__ variables.">;
8870def err_cuda_vla : Error<
8871    "cannot use variable-length arrays in "
8872    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8873def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8874def err_cuda_host_shared : Error<
8875    "__shared__ local variables not allowed in "
8876    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8877def err_cuda_nonstatic_constdev: Error<"__constant__, __device__, and "
8878    "__managed__ are not allowed on non-static local variables">;
8879def err_cuda_ovl_target : Error<
8880  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8881  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8882def note_cuda_ovl_candidate_target_mismatch : Note<
8883    "candidate template ignored: target attributes do not match">;
8884
8885def err_cuda_device_builtin_surftex_cls_template : Error<
8886    "illegal device builtin %select{surface|texture}0 reference "
8887    "class template %1 declared here">;
8888def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8889    "%0 needs to have exactly %1 template parameters">;
8890def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8891    "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8892    "%select{a type|an integer or enum value}2">;
8893
8894def err_cuda_device_builtin_surftex_ref_decl : Error<
8895    "illegal device builtin %select{surface|texture}0 reference "
8896    "type %1 declared here">;
8897def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8898    "%0 needs to be instantiated from a class template with proper "
8899    "template arguments">;
8900
8901def err_hip_invalid_args_builtin_mangled_name : Error<
8902    "invalid argument: symbol must be a device-side function or global variable">;
8903
8904def warn_hip_omp_target_directives : Warning<
8905  "HIP does not support OpenMP target directives; directive has been ignored">,
8906  InGroup<HIPOpenMPOffloading>, DefaultError;
8907
8908def warn_non_pod_vararg_with_format_string : Warning<
8909  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8910  "%select{function|block|method|constructor}2; expected type from format "
8911  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8912// The arguments to this diagnostic should match the warning above.
8913def err_cannot_pass_objc_interface_to_vararg_format : Error<
8914  "cannot pass object with interface type %1 by value to variadic "
8915  "%select{function|block|method|constructor}2; expected type from format "
8916  "string was %3">;
8917def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8918  "cannot pass non-trivial C object of type %0 by value to variadic "
8919  "%select{function|block|method|constructor}1">;
8920
8921
8922def err_cannot_pass_objc_interface_to_vararg : Error<
8923  "cannot pass object with interface type %0 by value through variadic "
8924  "%select{function|block|method|constructor}1">;
8925def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8926  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8927  " %select{function|block|method|constructor}2; call will abort at runtime">,
8928  InGroup<NonPODVarargs>, DefaultError;
8929def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8930  "passing object of trivial but non-POD type %0 through variadic"
8931  " %select{function|block|method|constructor}1 is incompatible with C++98">,
8932  InGroup<CXX98Compat>, DefaultIgnore;
8933def warn_pass_class_arg_to_vararg : Warning<
8934  "passing object of class type %0 through variadic "
8935  "%select{function|block|method|constructor}1"
8936  "%select{|; did you mean to call '%3'?}2">,
8937  InGroup<ClassVarargs>, DefaultIgnore;
8938def err_cannot_pass_to_vararg : Error<
8939  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8940  "%select{function|block|method|constructor}2">;
8941def err_cannot_pass_to_vararg_format : Error<
8942  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8943  "%select{function|block|method|constructor}2; expected type from format "
8944  "string was %3">;
8945
8946def err_typecheck_call_invalid_ordered_compare : Error<
8947  "ordered compare requires two args of floating point type"
8948  "%diff{ ($ and $)|}0,1">;
8949def err_typecheck_call_invalid_unary_fp : Error<
8950  "floating point classification requires argument of floating point type "
8951  "(passed in %0)">;
8952def err_typecheck_cond_expect_int_float : Error<
8953  "used type %0 where integer or floating point type is required">;
8954def err_typecheck_cond_expect_scalar : Error<
8955  "used type %0 where arithmetic or pointer type is required">;
8956def err_typecheck_cond_expect_nonfloat : Error<
8957  "used type %0 where floating point type is not allowed">;
8958def ext_typecheck_cond_one_void : Extension<
8959  "C99 forbids conditional expressions with only one void side">;
8960def err_typecheck_cast_to_incomplete : Error<
8961  "cast to incomplete type %0">;
8962def ext_typecheck_cast_nonscalar : Extension<
8963  "C99 forbids casting nonscalar type %0 to the same type">;
8964def ext_typecheck_cast_to_union : Extension<
8965  "cast to union type is a GNU extension">,
8966  InGroup<GNUUnionCast>;
8967def err_typecheck_cast_to_union_no_type : Error<
8968  "cast to union type from type %0 not present in union">;
8969def err_cast_pointer_from_non_pointer_int : Error<
8970  "operand of type %0 cannot be cast to a pointer type">;
8971def warn_cast_pointer_from_sel : Warning<
8972  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8973  InGroup<SelTypeCast>;
8974def warn_function_def_in_objc_container : Warning<
8975  "function definition inside an Objective-C container is deprecated">,
8976  InGroup<FunctionDefInObjCContainer>;
8977def err_typecheck_call_requires_real_fp : Error<
8978  "argument type %0 is not a real floating point type">;
8979def err_typecheck_call_different_arg_types : Error<
8980  "arguments are of different types%diff{ ($ vs $)|}0,1">;
8981
8982def warn_cast_calling_conv : Warning<
8983  "cast between incompatible calling conventions '%0' and '%1'; "
8984  "calls through this pointer may abort at runtime">,
8985  InGroup<DiagGroup<"cast-calling-convention">>;
8986def note_change_calling_conv_fixit : Note<
8987  "consider defining %0 with the '%1' calling convention">;
8988def warn_bad_function_cast : Warning<
8989  "cast from function call of type %0 to non-matching type %1">,
8990  InGroup<BadFunctionCast>, DefaultIgnore;
8991def warn_cast_function_type : Warning<
8992  "cast %diff{from $ to $ |}0,1converts to incompatible function type">,
8993  InGroup<CastFunctionType>, DefaultIgnore;
8994def warn_cast_function_type_strict : Warning<warn_cast_function_type.Summary>,
8995  InGroup<CastFunctionTypeStrict>, DefaultIgnore;
8996def err_cast_pointer_to_non_pointer_int : Error<
8997  "pointer cannot be cast to type %0">;
8998def err_nullptr_cast : Error<
8999  "cannot cast an object of type %select{'nullptr_t' to %1|%1 to 'nullptr_t'}0"
9000>;
9001def err_typecheck_expect_scalar_operand : Error<
9002  "operand of type %0 where arithmetic or pointer type is required">;
9003def err_typecheck_cond_incompatible_operands : Error<
9004  "incompatible operand types%diff{ ($ and $)|}0,1">;
9005def err_typecheck_expect_flt_or_vector : Error<
9006  "invalid operand of type %0 where floating, complex or "
9007  "a vector of such types is required">;
9008def err_cast_selector_expr : Error<
9009  "cannot type cast @selector expression">;
9010def err_make_signed_integral_only : Error<
9011  "'%select{make_unsigned|make_signed}0' is only compatible with "
9012  "non-%select{bool|_BitInt(1)}1 integers and enum types, but was given "
9013  "%2%select{| whose underlying type is %4}3">;
9014def ext_typecheck_cond_incompatible_pointers : ExtWarn<
9015  "pointer type mismatch%diff{ ($ and $)|}0,1">,
9016  InGroup<DiagGroup<"pointer-type-mismatch">>;
9017def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
9018  "pointer/integer type mismatch in conditional expression"
9019  "%diff{ ($ and $)|}0,1">,
9020  InGroup<DiagGroup<"conditional-type-mismatch">>;
9021def err_typecheck_choose_expr_requires_constant : Error<
9022  "'__builtin_choose_expr' requires a constant expression">;
9023def warn_unused_expr : Warning<"expression result unused">,
9024  InGroup<UnusedValue>;
9025def warn_unused_comma_left_operand : Warning<
9026  "left operand of comma operator has no effect">,
9027  InGroup<UnusedValue>;
9028def warn_unused_voidptr : Warning<
9029  "expression result unused; should this cast be to 'void'?">,
9030  InGroup<UnusedValue>;
9031def warn_unused_property_expr : Warning<
9032 "property access result unused - getters should not be used for side effects">,
9033  InGroup<UnusedGetterReturnValue>;
9034def warn_unused_container_subscript_expr : Warning<
9035 "container access result unused - container access should not be used for side effects">,
9036  InGroup<UnusedValue>;
9037def warn_unused_call : Warning<
9038  "ignoring return value of function declared with %0 attribute">,
9039  InGroup<UnusedValue>;
9040def warn_unused_constructor : Warning<
9041  "ignoring temporary created by a constructor declared with %0 attribute">,
9042  InGroup<UnusedValue>;
9043def warn_unused_constructor_msg : Warning<
9044  "ignoring temporary created by a constructor declared with %0 attribute: %1">,
9045  InGroup<UnusedValue>;
9046def warn_side_effects_unevaluated_context : Warning<
9047  "expression with side effects has no effect in an unevaluated context">,
9048  InGroup<UnevaluatedExpression>;
9049def warn_side_effects_typeid : Warning<
9050  "expression with side effects will be evaluated despite being used as an "
9051  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
9052def warn_unused_result : Warning<
9053  "ignoring return value of function declared with %0 attribute">,
9054  InGroup<UnusedResult>;
9055def warn_unused_result_msg : Warning<
9056  "ignoring return value of function declared with %0 attribute: %1">,
9057  InGroup<UnusedResult>;
9058def warn_unused_result_typedef_unsupported_spelling : Warning<
9059  "'[[%select{nodiscard|gnu::warn_unused_result}0]]' attribute ignored when "
9060  "applied to a typedef; consider using '__attribute__((warn_unused_result))' "
9061  "or '[[clang::warn_unused_result]]' instead">, InGroup<IgnoredAttributes>;
9062def warn_unused_volatile : Warning<
9063  "expression result unused; assign into a variable to force a volatile load">,
9064  InGroup<DiagGroup<"unused-volatile-lvalue">>;
9065
9066def ext_cxx14_attr : Extension<
9067  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14Attrs>;
9068def ext_cxx17_attr : Extension<
9069  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17Attrs>;
9070def ext_cxx20_attr : Extension<
9071  "use of the %0 attribute is a C++20 extension">, InGroup<CXX20Attrs>;
9072
9073def warn_unused_comparison : Warning<
9074  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
9075  InGroup<UnusedComparison>;
9076def note_inequality_comparison_to_or_assign : Note<
9077  "use '|=' to turn this inequality comparison into an or-assignment">;
9078
9079def err_incomplete_type_used_in_type_trait_expr : Error<
9080  "incomplete type %0 used in type trait expression">;
9081
9082// C++20 constinit and require_constant_initialization attribute
9083def warn_cxx20_compat_constinit : Warning<
9084  "'constinit' specifier is incompatible with C++ standards before C++20">,
9085  InGroup<CXX20Compat>, DefaultIgnore;
9086def err_constinit_local_variable : Error<
9087  "local variable cannot be declared 'constinit'">;
9088def err_require_constant_init_failed : Error<
9089  "variable does not have a constant initializer">;
9090def note_declared_required_constant_init_here : Note<
9091  "required by %select{'require_constant_initialization' attribute|"
9092  "'constinit' specifier}0 here">;
9093def ext_constinit_missing : ExtWarn<
9094  "'constinit' specifier missing on initializing declaration of %0">,
9095  InGroup<DiagGroup<"missing-constinit">>;
9096def note_constinit_specified_here : Note<"variable declared constinit here">;
9097def err_constinit_added_too_late : Error<
9098  "'constinit' specifier added after initialization of variable">;
9099def warn_require_const_init_added_too_late : Warning<
9100  "'require_constant_initialization' attribute added after initialization "
9101  "of variable">, InGroup<IgnoredAttributes>;
9102def note_constinit_missing_here : Note<
9103  "add the "
9104  "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
9105  "to the initializing declaration here">;
9106
9107def err_dimension_expr_not_constant_integer : Error<
9108  "dimension expression does not evaluate to a constant unsigned int">;
9109
9110def err_typecheck_cond_incompatible_operands_null : Error<
9111  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
9112def ext_empty_struct_union : Extension<
9113  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
9114def ext_no_named_members_in_struct_union : Extension<
9115  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
9116def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
9117  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
9118  InGroup<CXXCompat>, DefaultIgnore;
9119def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
9120  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
9121  InGroup<ExternCCompat>;
9122def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
9123  "volatile qualifiers|const qualifier|volatile qualifier}2">,
9124  InGroup<CastQual>, DefaultIgnore;
9125def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
9126  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
9127def warn_redefine_extname_not_applied : Warning<
9128  "#pragma redefine_extname is applicable to external C declarations only; "
9129  "not applied to %select{function|variable}0 %1">,
9130  InGroup<Pragmas>;
9131} // End of general sema category.
9132
9133// inline asm.
9134let CategoryName = "Inline Assembly Issue" in {
9135  def err_asm_pmf_through_constraint_not_permitted
9136    : Error<"cannot pass a pointer-to-member through register-constrained "
9137            "inline assembly parameter">;
9138  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
9139  def err_asm_invalid_output_constraint : Error<
9140    "invalid output constraint '%0' in asm">;
9141  def err_asm_invalid_lvalue_in_input : Error<
9142    "invalid lvalue in asm input for constraint '%0'">;
9143  def err_asm_invalid_input_constraint : Error<
9144    "invalid input constraint '%0' in asm">;
9145  def err_asm_tying_incompatible_types : Error<
9146    "unsupported inline asm: input with type "
9147    "%diff{$ matching output with type $|}0,1">;
9148  def err_asm_unexpected_constraint_alternatives : Error<
9149    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
9150  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
9151  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
9152  def err_asm_unwind_and_goto : Error<"unwind clobber can't be used with asm goto">;
9153  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
9154    "global register variables on this target">;
9155  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
9156    "match variable size">;
9157  def err_asm_bad_register_type : Error<"bad type for named register variable">;
9158  def err_asm_invalid_input_size : Error<
9159    "invalid input size for constraint '%0'">;
9160  def err_asm_invalid_output_size : Error<
9161    "invalid output size for constraint '%0'">;
9162  def err_invalid_asm_cast_lvalue : Error<
9163    "invalid use of a cast in a inline asm context requiring an lvalue: "
9164    "remove the cast or build with -fheinous-gnu-extensions">;
9165  def err_invalid_asm_value_for_constraint
9166      : Error <"value '%0' out of range for constraint '%1'">;
9167  def err_asm_non_addr_value_in_memory_constraint : Error <
9168    "reference to a %select{bit-field|vector element|global register variable}0"
9169    " in asm %select{input|output}1 with a memory constraint '%2'">;
9170  def err_asm_input_duplicate_match : Error<
9171    "more than one input constraint matches the same output '%0'">;
9172  def err_store_value_to_reg : Error<
9173    "impossible constraint in asm: can't store value into a register">;
9174
9175  def warn_asm_label_on_auto_decl : Warning<
9176    "ignored asm label '%0' on automatic variable">;
9177  def warn_invalid_asm_cast_lvalue : Warning<
9178    "invalid use of a cast in an inline asm context requiring an lvalue: "
9179    "accepted due to -fheinous-gnu-extensions, but clang may remove support "
9180    "for this in the future">;
9181  def warn_asm_mismatched_size_modifier : Warning<
9182    "value size does not match register size specified by the constraint "
9183    "and modifier">,
9184    InGroup<ASMOperandWidths>;
9185
9186  def note_asm_missing_constraint_modifier : Note<
9187    "use constraint modifier \"%0\"">;
9188  def note_asm_input_duplicate_first : Note<
9189    "constraint '%0' is already present here">;
9190 def error_duplicate_asm_operand_name : Error<
9191    "duplicate use of asm operand name \"%0\"">;
9192 def note_duplicate_asm_operand_name : Note<
9193    "asm operand name \"%0\" first referenced here">;
9194}
9195
9196  def error_inoutput_conflict_with_clobber : Error<
9197    "asm-specifier for input or output variable conflicts with asm"
9198    " clobber list">;
9199
9200let CategoryName = "Semantic Issue" in {
9201
9202def err_invalid_conversion_between_matrixes : Error<
9203  "conversion between matrix types%diff{ $ and $|}0,1 of different size is not allowed">;
9204
9205def err_invalid_conversion_between_matrix_and_type : Error<
9206  "conversion between matrix type %0 and incompatible type %1 is not allowed">;
9207
9208def err_invalid_conversion_between_vectors : Error<
9209  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
9210  "size">;
9211def err_invalid_conversion_between_vector_and_integer : Error<
9212  "invalid conversion between vector type %0 and integer type %1 "
9213  "of different size">;
9214
9215def err_opencl_function_pointer : Error<
9216  "%select{pointers|references}0 to functions are not allowed">;
9217
9218def err_opencl_taking_address_capture : Error<
9219  "taking address of a capture is not allowed">;
9220
9221def err_invalid_conversion_between_vector_and_scalar : Error<
9222  "invalid conversion between vector type %0 and scalar type %1">;
9223
9224// C++ member initializers.
9225def err_only_constructors_take_base_inits : Error<
9226  "only constructors take base initializers">;
9227
9228def err_multiple_mem_initialization : Error <
9229  "multiple initializations given for non-static member %0">;
9230def err_multiple_mem_union_initialization : Error <
9231  "initializing multiple members of union">;
9232def err_multiple_base_initialization : Error <
9233  "multiple initializations given for base %0">;
9234
9235def err_mem_init_not_member_or_class : Error<
9236  "member initializer %0 does not name a non-static data member or base "
9237  "class">;
9238
9239def warn_initializer_out_of_order : Warning<
9240  "%select{field|base class}0 %1 will be initialized after "
9241  "%select{field|base}2 %3">,
9242  InGroup<ReorderCtor>, DefaultIgnore;
9243
9244def warn_some_initializers_out_of_order : Warning<
9245  "initializer order does not match the declaration order">,
9246  InGroup<ReorderCtor>, DefaultIgnore;
9247
9248def note_initializer_out_of_order : Note<
9249  "%select{field|base class}0 %1 will be initialized after "
9250  "%select{field|base}2 %3">;
9251
9252def warn_abstract_vbase_init_ignored : Warning<
9253  "initializer for virtual base class %0 of abstract class %1 "
9254  "will never be used">,
9255  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
9256
9257def err_base_init_does_not_name_class : Error<
9258  "constructor initializer %0 does not name a class">;
9259def err_base_init_direct_and_virtual : Error<
9260  "base class initializer %0 names both a direct base class and an "
9261  "inherited virtual base class">;
9262def err_not_direct_base_or_virtual : Error<
9263  "type %0 is not a direct or virtual base of %1">;
9264
9265def err_in_class_initializer_non_const : Error<
9266  "non-const static data member must be initialized out of line">;
9267def err_in_class_initializer_volatile : Error<
9268  "static const volatile data member must be initialized out of line">;
9269def err_in_class_initializer_bad_type : Error<
9270  "static data member of type %0 must be initialized out of line">;
9271def ext_in_class_initializer_float_type : ExtWarn<
9272  "in-class initializer for static data member of type %0 is a GNU extension">,
9273  InGroup<GNUStaticFloatInit>;
9274def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
9275  "in-class initializer for static data member of type %0 requires "
9276  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
9277def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
9278def err_in_class_initializer_literal_type : Error<
9279  "in-class initializer for static data member of type %0 requires "
9280  "'constexpr' specifier">;
9281def err_in_class_initializer_non_constant : Error<
9282  "in-class initializer for static data member is not a constant expression">;
9283def err_default_member_initializer_not_yet_parsed : Error<
9284  "default member initializer for %1 needed within definition of enclosing "
9285  "class %0 outside of member functions">;
9286def note_default_member_initializer_not_yet_parsed : Note<
9287  "default member initializer declared here">;
9288def err_default_member_initializer_cycle
9289    : Error<"default member initializer for %0 uses itself">;
9290
9291def ext_in_class_initializer_non_constant : Extension<
9292  "in-class initializer for static data member is not a constant expression; "
9293  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
9294
9295def err_thread_dynamic_init : Error<
9296  "initializer for thread-local variable must be a constant expression">;
9297def err_thread_nontrivial_dtor : Error<
9298  "type of thread-local variable has non-trivial destruction">;
9299def note_use_thread_local : Note<
9300  "use 'thread_local' to allow this">;
9301
9302// C++ anonymous unions and GNU anonymous structs/unions
9303def ext_anonymous_union : Extension<
9304  "anonymous unions are a C11 extension">, InGroup<C11>;
9305def ext_gnu_anonymous_struct : Extension<
9306  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
9307def ext_c11_anonymous_struct : Extension<
9308  "anonymous structs are a C11 extension">, InGroup<C11>;
9309def err_anonymous_union_not_static : Error<
9310  "anonymous unions at namespace or global scope must be declared 'static'">;
9311def err_anonymous_union_with_storage_spec : Error<
9312  "anonymous union at class scope must not have a storage specifier">;
9313def err_anonymous_struct_not_member : Error<
9314  "anonymous %select{structs|structs and classes}0 must be "
9315  "%select{struct or union|class}0 members">;
9316def err_anonymous_record_member_redecl : Error<
9317  "member of anonymous %select{struct|union}0 redeclares %1">;
9318def err_anonymous_record_with_type : Error<
9319  "types cannot be declared in an anonymous %select{struct|union}0">;
9320def ext_anonymous_record_with_type : Extension<
9321  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
9322  "extension">, InGroup<MicrosoftAnonTag>;
9323def ext_anonymous_record_with_anonymous_type : Extension<
9324  "anonymous types declared in an anonymous %select{struct|union}0 "
9325  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
9326def err_anonymous_record_with_function : Error<
9327  "functions cannot be declared in an anonymous %select{struct|union}0">;
9328def err_anonymous_record_with_static : Error<
9329  "static members cannot be declared in an anonymous %select{struct|union}0">;
9330def err_anonymous_record_bad_member : Error<
9331  "anonymous %select{struct|union}0 can only contain non-static data members">;
9332def err_anonymous_record_nonpublic_member : Error<
9333  "anonymous %select{struct|union}0 cannot contain a "
9334  "%select{private|protected}1 data member">;
9335def ext_ms_anonymous_record : ExtWarn<
9336  "anonymous %select{structs|unions}0 are a Microsoft extension">,
9337  InGroup<MicrosoftAnonTag>;
9338
9339// C++ local classes
9340def err_reference_to_local_in_enclosing_context : Error<
9341  "reference to local %select{variable|binding}1 %0 declared in enclosing "
9342  "%select{%3|block literal|lambda expression|context}2">;
9343def err_capture_binding_openmp : Error<
9344  "capturing a structured binding is not yet supported in OpenMP">;
9345def ext_capture_binding : ExtWarn<
9346  "captured structured bindings are a C++20 extension">, InGroup<CXX20>;
9347def warn_cxx17_compat_capture_binding : Warning<
9348  "captured structured bindings are incompatible with "
9349  "C++ standards before C++20">,
9350  InGroup<CXXPre20Compat>, DefaultIgnore;
9351
9352def err_static_data_member_not_allowed_in_local_class : Error<
9353  "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
9354
9355// C++ derived classes
9356def err_base_clause_on_union : Error<"unions cannot have base classes">;
9357def err_base_must_be_class : Error<"base specifier must name a class">;
9358def err_union_as_base_class : Error<"unions cannot be base classes">;
9359def err_circular_inheritance : Error<
9360  "circular inheritance between %0 and %1">;
9361def err_base_class_has_flexible_array_member : Error<
9362  "base class %0 has a flexible array member">;
9363def err_incomplete_base_class : Error<"base class has incomplete type">;
9364def err_duplicate_base_class : Error<
9365  "base class %0 specified more than once as a direct base class">;
9366def warn_inaccessible_base_class : Warning<
9367  "direct base %0 is inaccessible due to ambiguity:%1">,
9368  InGroup<DiagGroup<"inaccessible-base">>;
9369// FIXME: better way to display derivation?  Pass entire thing into diagclient?
9370def err_ambiguous_derived_to_base_conv : Error<
9371  "ambiguous conversion from derived class %0 to base class %1:%2">;
9372def err_ambiguous_memptr_conv : Error<
9373  "ambiguous conversion from pointer to member of %select{base|derived}0 "
9374  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
9375def ext_ms_ambiguous_direct_base : ExtWarn<
9376  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
9377  InGroup<MicrosoftInaccessibleBase>;
9378
9379def err_memptr_conv_via_virtual : Error<
9380  "conversion from pointer to member of class %0 to pointer to member "
9381  "of class %1 via virtual base %2 is not allowed">;
9382
9383// C++ member name lookup
9384def err_ambiguous_member_multiple_subobjects : Error<
9385  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
9386def err_ambiguous_member_multiple_subobject_types : Error<
9387  "member %0 found in multiple base classes of different types">;
9388def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
9389def note_ambiguous_member_type_found : Note<
9390  "member type %0 found by ambiguous name lookup">;
9391def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
9392def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
9393def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
9394  "declaration in a different namespace">;
9395def note_hidden_tag : Note<"type declaration hidden">;
9396def note_hiding_object : Note<"declaration hides type">;
9397
9398// C++ operator overloading
9399def err_operator_overload_needs_class_or_enum : Error<
9400  "overloaded %0 must have at least one parameter of class "
9401  "or enumeration type">;
9402
9403def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
9404def warn_cxx20_compat_operator_overload_static : Warning<
9405  "declaring overloaded %0 as 'static' is incompatible with C++ standards "
9406  "before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
9407def ext_operator_overload_static : ExtWarn<
9408  "declaring overloaded %0 as 'static' is a C++23 extension">, InGroup<CXX23>;
9409def err_operator_overload_static : Error<
9410  "overloaded %0 cannot be a static member function">;
9411def err_operator_overload_default_arg : Error<
9412  "parameter of overloaded %0 cannot have a default argument">;
9413
9414def ext_subscript_overload : Warning<
9415  "overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a "
9416  "C++23 extension">, InGroup<CXXPre23Compat>, DefaultIgnore;
9417def error_subscript_overload : Error<
9418  "overloaded %0 cannot have %select{no|a defaulted|more than one}1 parameter before C++23">;
9419
9420def err_operator_overload_must_be : Error<
9421  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
9422  "(has %1 parameter%s1)">;
9423
9424def err_operator_overload_must_be_member : Error<
9425  "overloaded %0 must be a non-static member function">;
9426def err_operator_overload_post_incdec_must_be_int : Error<
9427  "parameter of overloaded post-%select{increment|decrement}1 operator must "
9428  "have type 'int' (not %0)">;
9429
9430// C++ allocation and deallocation functions.
9431def err_operator_new_delete_declared_in_namespace : Error<
9432  "%0 cannot be declared inside a namespace">;
9433def err_operator_new_delete_declared_static : Error<
9434  "%0 cannot be declared static in global scope">;
9435def ext_operator_new_delete_declared_inline : ExtWarn<
9436  "replacement function %0 cannot be declared 'inline'">,
9437  InGroup<DiagGroup<"inline-new-delete">>;
9438def err_operator_new_delete_invalid_result_type : Error<
9439  "%0 must return type %1">;
9440def err_operator_new_delete_dependent_result_type : Error<
9441  "%0 cannot have a dependent return type; use %1 instead">;
9442def err_operator_new_delete_too_few_parameters : Error<
9443  "%0 must have at least one parameter">;
9444def err_operator_new_delete_template_too_few_parameters : Error<
9445  "%0 template must have at least two parameters">;
9446def warn_operator_new_returns_null : Warning<
9447  "%0 should not return a null pointer unless it is declared 'throw()'"
9448  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
9449
9450def err_operator_new_dependent_param_type : Error<
9451  "%0 cannot take a dependent type as first parameter; "
9452  "use size_t (%1) instead">;
9453def err_operator_new_param_type : Error<
9454  "%0 takes type size_t (%1) as first parameter">;
9455def err_operator_new_default_arg: Error<
9456  "parameter of %0 cannot have a default argument">;
9457def err_operator_delete_dependent_param_type : Error<
9458  "%0 cannot take a dependent type as first parameter; use %1 instead">;
9459def err_operator_delete_param_type : Error<
9460  "first parameter of %0 must have type %1">;
9461def err_destroying_operator_delete_not_usual : Error<
9462  "destroying operator delete can have only an optional size and optional "
9463  "alignment parameter">;
9464def note_implicit_delete_this_in_destructor_here : Note<
9465  "while checking implicit 'delete this' for virtual destructor">;
9466def err_builtin_operator_new_delete_not_usual : Error<
9467  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
9468  "selects non-usual %select{allocation|deallocation}0 function">;
9469def note_non_usual_function_declared_here : Note<
9470  "non-usual %0 declared here">;
9471
9472// C++ literal operators
9473def err_literal_operator_outside_namespace : Error<
9474  "literal operator %0 must be in a namespace or global scope">;
9475def err_literal_operator_id_outside_namespace : Error<
9476  "non-namespace scope '%0' cannot have a literal operator member">;
9477def err_literal_operator_default_argument : Error<
9478  "literal operator cannot have a default argument">;
9479def err_literal_operator_bad_param_count : Error<
9480  "non-template literal operator must have one or two parameters">;
9481def err_literal_operator_invalid_param : Error<
9482  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
9483def err_literal_operator_param : Error<
9484  "invalid literal operator parameter type %0, did you mean %1?">;
9485def err_literal_operator_template_with_params : Error<
9486  "literal operator template cannot have any parameters">;
9487def err_literal_operator_template : Error<
9488  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
9489def err_literal_operator_extern_c : Error<
9490  "literal operator must have C++ linkage">;
9491def ext_string_literal_operator_template : ExtWarn<
9492  "string literal operator templates are a GNU extension">,
9493  InGroup<GNUStringLiteralOperatorTemplate>;
9494def warn_user_literal_reserved : Warning<
9495  "user-defined literal suffixes %select{<ERROR>|not starting with '_'|containing '__'}0 are reserved"
9496  "%select{; no literal will invoke this operator|}1">,
9497  InGroup<UserDefinedLiterals>;
9498
9499// C++ conversion functions
9500def err_conv_function_not_member : Error<
9501  "conversion function must be a non-static member function">;
9502def err_conv_function_return_type : Error<
9503  "conversion function cannot have a return type">;
9504def err_conv_function_with_params : Error<
9505  "conversion function cannot have any parameters">;
9506def err_conv_function_variadic : Error<
9507  "conversion function cannot be variadic">;
9508def err_conv_function_to_array : Error<
9509  "conversion function cannot convert to an array type">;
9510def err_conv_function_to_function : Error<
9511  "conversion function cannot convert to a function type">;
9512def err_conv_function_with_complex_decl : Error<
9513  "cannot specify any part of a return type in the "
9514  "declaration of a conversion function"
9515  "%select{"
9516  "; put the complete type after 'operator'|"
9517  "; use a typedef to declare a conversion to %1|"
9518  "; use an alias template to declare a conversion to %1|"
9519  "}0">;
9520def err_conv_function_redeclared : Error<
9521  "conversion function cannot be redeclared">;
9522def warn_conv_to_self_not_used : Warning<
9523  "conversion function converting %0 to itself will never be used">,
9524  InGroup<ClassConversion>;
9525def warn_conv_to_base_not_used : Warning<
9526  "conversion function converting %0 to its base class %1 will never be used">,
9527  InGroup<ClassConversion>;
9528def warn_conv_to_void_not_used : Warning<
9529  "conversion function converting %0 to %1 will never be used">,
9530  InGroup<ClassConversion>;
9531
9532def warn_not_compound_assign : Warning<
9533  "use of unary operator that may be intended as compound assignment (%0=)">;
9534
9535// C++11 explicit conversion operators
9536def ext_explicit_conversion_functions : ExtWarn<
9537  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
9538def warn_cxx98_compat_explicit_conversion_functions : Warning<
9539  "explicit conversion functions are incompatible with C++98">,
9540  InGroup<CXX98Compat>, DefaultIgnore;
9541
9542// C++11 defaulted functions
9543def err_defaulted_special_member_params : Error<
9544  "an explicitly-defaulted %sub{select_special_member_kind}0 cannot "
9545  "have default arguments">;
9546def err_defaulted_special_member_variadic : Error<
9547  "an explicitly-defaulted %sub{select_special_member_kind}0 cannot "
9548  "be variadic">;
9549def err_defaulted_special_member_return_type : Error<
9550  "explicitly-defaulted %select{copy|move}0 assignment operator must "
9551  "return %1">;
9552def err_defaulted_special_member_quals : Error<
9553  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
9554  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
9555def err_defaulted_special_member_explicit_object_mismatch : Error<
9556  "the type of the explicit object parameter of an explicitly-defaulted "
9557  "%select{copy|move}0 assignment operator should match the type of the class %1">;
9558def err_defaulted_special_member_volatile_param : Error<
9559  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
9560  "may not be volatile">;
9561def err_defaulted_special_member_move_const_param : Error<
9562  "the parameter for an explicitly-defaulted move "
9563  "%select{constructor|assignment operator}0 may not be const">;
9564def err_defaulted_special_member_copy_const_param : Error<
9565  "the parameter for this explicitly-defaulted copy "
9566  "%select{constructor|assignment operator}0 is const, but a member or base "
9567  "requires it to be non-const">;
9568def err_defaulted_copy_assign_not_ref : Error<
9569  "the parameter for an explicitly-defaulted copy assignment operator must be an "
9570  "lvalue reference type">;
9571def err_incorrect_defaulted_constexpr : Error<
9572  "defaulted definition of %sub{select_special_member_kind}0 "
9573  "is not constexpr">;
9574def err_incorrect_defaulted_constexpr_with_vb: Error<
9575  "%sub{select_special_member_kind}0 cannot be 'constexpr' in a class with virtual base class">;
9576def err_incorrect_defaulted_consteval : Error<
9577  "defaulted declaration of %sub{select_special_member_kind}0 "
9578  "cannot be consteval because implicit definition is not constexpr">;
9579def warn_defaulted_method_deleted : Warning<
9580  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
9581  "deleted">, InGroup<DefaultedFunctionDeleted>;
9582def note_replace_equals_default_to_delete : Note<
9583  "replace 'default' with 'delete'">;
9584def err_out_of_line_default_deletes : Error<
9585  "defaulting this %sub{select_special_member_kind}0 "
9586  "would delete it after its first declaration">;
9587def note_deleted_type_mismatch : Note<
9588  "function is implicitly deleted because its declared type does not match "
9589  "the type of an implicit %sub{select_special_member_kind}0">;
9590def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
9591  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
9592  "different from the implicit type is incompatible with C++ standards before "
9593  "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9594def warn_vbase_moved_multiple_times : Warning<
9595  "defaulted move assignment operator of %0 will move assign virtual base "
9596  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
9597def note_vbase_moved_here : Note<
9598  "%select{%1 is a virtual base class of base class %2 declared here|"
9599  "virtual base class %1 declared here}0">;
9600
9601// C++20 defaulted comparisons
9602// This corresponds to values of Sema::DefaultedComparisonKind.
9603def select_defaulted_comparison_kind : TextSubstitution<
9604  "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
9605  "operator">;
9606def ext_defaulted_comparison : ExtWarn<
9607  "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
9608def warn_cxx17_compat_defaulted_comparison : Warning<
9609  "defaulted comparison operators are incompatible with C++ standards "
9610  "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9611def err_defaulted_comparison_template : Error<
9612  "comparison operator template cannot be defaulted">;
9613def err_defaulted_comparison_num_args : Error<
9614  "%select{non-member|member}0 %sub{select_defaulted_comparison_kind}1"
9615  " must have %select{2|1}0 parameters">;
9616def err_defaulted_comparison_param : Error<
9617  "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
9618  "; found %1, expected %2%select{| or %4}3">;
9619def err_defaulted_comparison_param_unknown : Error<
9620  "invalid parameter type for non-member defaulted"
9621  " %sub{select_defaulted_comparison_kind}0"
9622  "; found %1, expected class or reference to a constant class">;
9623def err_defaulted_comparison_param_mismatch : Error<
9624  "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
9625  "must have the same type%diff{ (found $ vs $)|}1,2">;
9626def err_defaulted_comparison_not_friend : Error<
9627  "%sub{select_defaulted_comparison_kind}0 is not a friend of"
9628  " %select{|incomplete class }1%2">;
9629def err_defaulted_comparison_non_const : Error<
9630  "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
9631  "const-qualified">;
9632def err_defaulted_comparison_return_type_not_bool : Error<
9633  "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9634  "must be 'bool', not %1">;
9635def err_defaulted_comparison_deduced_return_type_not_auto : Error<
9636  "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9637  "must be 'auto', not %1">;
9638def warn_defaulted_comparison_deleted : Warning<
9639  "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
9640  "deleted">, InGroup<DefaultedFunctionDeleted>;
9641def err_non_first_default_compare_deletes : Error<
9642  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
9643  "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
9644  "would delete it after its first declaration">;
9645def err_non_first_default_compare_in_class : Error<
9646  "defaulting this %sub{select_defaulted_comparison_kind}0 "
9647  "is not allowed because it was already declared outside the class">;
9648def note_defaulted_comparison_union : Note<
9649  "defaulted %0 is implicitly deleted because "
9650  "%2 is a %select{union-like class|union}1 with variant members">;
9651def note_defaulted_comparison_reference_member : Note<
9652  "defaulted %0 is implicitly deleted because "
9653  "class %1 has a reference member">;
9654def note_defaulted_comparison_ambiguous : Note<
9655  "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
9656  "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
9657def note_defaulted_comparison_inaccessible : Note<
9658  "defaulted %0 is implicitly deleted because it would invoke a "
9659  "%select{private|protected}3 %4%select{ member of %6|"
9660  " member of %6 to compare member %2| to compare base class %2}1">;
9661def note_defaulted_comparison_calls_deleted : Note<
9662  "defaulted %0 is implicitly deleted because it would invoke a deleted "
9663  "comparison function%select{| for member %2| for base class %2}1">;
9664def note_defaulted_comparison_no_viable_function : Note<
9665  "defaulted %0 is implicitly deleted because there is no viable "
9666  "%select{three-way comparison function|'operator=='}1 for "
9667  "%select{|member |base class }2%3">;
9668def note_defaulted_comparison_no_viable_function_synthesized : Note<
9669  "three-way comparison cannot be synthesized because there is no viable "
9670  "function for %select{'=='|'<'}0 comparison">;
9671def note_defaulted_comparison_not_rewritten_callee : Note<
9672  "defaulted %0 is implicitly deleted because this non-rewritten comparison "
9673  "function would be the best match for the comparison">;
9674def note_defaulted_comparison_not_rewritten_conversion : Note<
9675  "defaulted %0 is implicitly deleted because a builtin comparison function "
9676  "using this conversion would be the best match for the comparison">;
9677def note_defaulted_comparison_cannot_deduce : Note<
9678  "return type of defaulted 'operator<=>' cannot be deduced because "
9679  "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
9680  "is not a standard comparison category type">;
9681def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
9682  "return type of defaulted 'operator<=>' cannot be deduced because "
9683  "three-way comparison for %select{|member|base class}0 %1 "
9684  "has a deduced return type and is not yet defined">;
9685def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
9686  "%select{|member|base class}0 %1 declared here">;
9687def note_defaulted_comparison_cannot_deduce_callee : Note<
9688  "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
9689def ext_defaulted_comparison_constexpr_mismatch : Extension<
9690  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9691  "three-way comparison operator}0 that is "
9692  "declared %select{constexpr|consteval}2 but"
9693  "%select{|for which the corresponding implicit 'operator==' }0 "
9694  "invokes a non-constexpr comparison function is a C++23 extension">,
9695  InGroup<DiagGroup<"c++23-default-comp-relaxed-constexpr">>;
9696def warn_cxx23_compat_defaulted_comparison_constexpr_mismatch : Warning<
9697  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9698  "three-way comparison operator}0 that is "
9699  "declared %select{constexpr|consteval}2 but"
9700  "%select{|for which the corresponding implicit 'operator==' }0 "
9701  "invokes a non-constexpr comparison function is incompatible with C++ "
9702  "standards before C++23">,
9703  InGroup<CXXPre23Compat>, DefaultIgnore;
9704def note_defaulted_comparison_not_constexpr : Note<
9705  "non-constexpr comparison function would be used to compare "
9706  "%select{|member %1|base class %1}0">;
9707def note_defaulted_comparison_not_constexpr_here : Note<
9708  "non-constexpr comparison function declared here">;
9709def note_in_declaration_of_implicit_equality_comparison : Note<
9710  "while declaring the corresponding implicit 'operator==' "
9711  "for this defaulted 'operator<=>'">;
9712def err_volatile_comparison_operator : Error<
9713  "defaulted comparison function must not be volatile">;
9714def err_ref_qualifier_comparison_operator : Error<
9715  "ref-qualifier '&&' is not allowed on a defaulted comparison operator">;
9716
9717def ext_implicit_exception_spec_mismatch : ExtWarn<
9718  "function previously declared with an %select{explicit|implicit}0 exception "
9719  "specification redeclared with an %select{implicit|explicit}0 exception "
9720  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
9721
9722def warn_ptr_arith_precedes_bounds : Warning<
9723  "the pointer decremented by %0 refers before the beginning of the array">,
9724  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9725def warn_ptr_arith_exceeds_bounds : Warning<
9726  "the pointer incremented by %0 refers past the end of the array (that has type %1)">,
9727  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9728def warn_array_index_precedes_bounds : Warning<
9729  "array index %0 is before the beginning of the array">,
9730  InGroup<ArrayBounds>;
9731def warn_array_index_exceeds_bounds : Warning<
9732  "array index %0 is past the end of the array (that has type %1%select{|, cast to %3}2)">,
9733  InGroup<ArrayBounds>;
9734def warn_ptr_arith_exceeds_max_addressable_bounds : Warning<
9735  "the pointer incremented by %0 refers past the last possible element for an array in %1-bit "
9736  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9737  InGroup<ArrayBounds>;
9738def warn_array_index_exceeds_max_addressable_bounds : Warning<
9739  "array index %0 refers past the last possible element for an array in %1-bit "
9740  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9741  InGroup<ArrayBounds>;
9742def note_array_declared_here : Note<
9743  "array %0 declared here">;
9744
9745def warn_inconsistent_array_form : Warning<
9746  "argument %0 of type %1 with mismatched bound">,
9747  InGroup<ArrayParameter>, DefaultIgnore;
9748def note_previous_declaration_as : Note<
9749  "previously declared as %0 here">;
9750
9751def warn_printf_insufficient_data_args : Warning<
9752  "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
9753def warn_printf_data_arg_not_used : Warning<
9754  "data argument not used by format string">, InGroup<FormatExtraArgs>;
9755def warn_format_invalid_conversion : Warning<
9756  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
9757def warn_printf_incomplete_specifier : Warning<
9758  "incomplete format specifier">, InGroup<Format>;
9759def warn_missing_format_string : Warning<
9760  "format string missing">, InGroup<Format>;
9761def warn_scanf_nonzero_width : Warning<
9762  "zero field width in scanf format string is unused">,
9763  InGroup<Format>;
9764def warn_format_conversion_argument_type_mismatch : Warning<
9765  "format specifies type %0 but the argument has "
9766  "%select{type|underlying type}2 %1">,
9767  InGroup<Format>;
9768def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
9769  warn_format_conversion_argument_type_mismatch.Summary>,
9770  InGroup<FormatPedantic>;
9771def warn_format_conversion_argument_type_mismatch_confusion : Warning<
9772  warn_format_conversion_argument_type_mismatch.Summary>,
9773  InGroup<FormatTypeConfusion>, DefaultIgnore;
9774def warn_format_argument_needs_cast : Warning<
9775  "%select{values of type|enum values with underlying type}2 '%0' should not "
9776  "be used as format arguments; add an explicit cast to %1 instead">,
9777  InGroup<Format>;
9778def warn_format_argument_needs_cast_pedantic : Warning<
9779  warn_format_argument_needs_cast.Summary>,
9780  InGroup<FormatPedantic>, DefaultIgnore;
9781def warn_printf_positional_arg_exceeds_data_args : Warning <
9782  "data argument position '%0' exceeds the number of data arguments (%1)">,
9783  InGroup<Format>;
9784def warn_format_zero_positional_specifier : Warning<
9785  "position arguments in format strings start counting at 1 (not 0)">,
9786  InGroup<Format>;
9787def warn_format_invalid_positional_specifier : Warning<
9788  "invalid position specified for %select{field width|field precision}0">,
9789  InGroup<Format>;
9790def warn_format_mix_positional_nonpositional_args : Warning<
9791  "cannot mix positional and non-positional arguments in format string">,
9792  InGroup<Format>;
9793def warn_static_array_too_small : Warning<
9794  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
9795  " callee requires at least %1">,
9796  InGroup<ArrayBounds>;
9797def note_callee_static_array : Note<
9798  "callee declares array parameter as static here">;
9799def warn_empty_format_string : Warning<
9800  "format string is empty">, InGroup<FormatZeroLength>;
9801def warn_format_string_is_wide_literal : Warning<
9802  "format string should not be a wide string">, InGroup<Format>;
9803def warn_printf_format_string_contains_null_char : Warning<
9804  "format string contains '\\0' within the string body">, InGroup<Format>;
9805def warn_printf_format_string_not_null_terminated : Warning<
9806  "format string is not null-terminated">, InGroup<Format>;
9807def warn_printf_asterisk_missing_arg : Warning<
9808  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
9809  InGroup<Format>;
9810def warn_printf_asterisk_wrong_type : Warning<
9811  "field %select{width|precision}0 should have type %1, but argument has type %2">,
9812  InGroup<Format>;
9813def warn_printf_nonsensical_optional_amount: Warning<
9814  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
9815  InGroup<Format>;
9816def warn_printf_nonsensical_flag: Warning<
9817  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
9818  InGroup<Format>;
9819def warn_format_nonsensical_length: Warning<
9820  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
9821  InGroup<Format>;
9822def warn_format_non_standard_positional_arg: Warning<
9823  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
9824def warn_format_non_standard: Warning<
9825  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
9826  InGroup<FormatNonStandard>, DefaultIgnore;
9827def warn_format_non_standard_conversion_spec: Warning<
9828  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
9829  InGroup<FormatNonStandard>, DefaultIgnore;
9830def err_invalid_mask_type_size : Error<
9831  "mask type size must be between 1-byte and 8-bytes">;
9832def warn_format_invalid_annotation : Warning<
9833  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
9834  InGroup<Format>;
9835def warn_format_P_no_precision : Warning<
9836  "using '%%P' format specifier without precision">,
9837  InGroup<Format>;
9838def warn_printf_ignored_flag: Warning<
9839  "flag '%0' is ignored when flag '%1' is present">,
9840  InGroup<Format>;
9841def warn_printf_empty_objc_flag: Warning<
9842  "missing object format flag">,
9843  InGroup<Format>;
9844def warn_printf_ObjCflags_without_ObjCConversion: Warning<
9845  "object format flags cannot be used with '%0' conversion specifier">,
9846  InGroup<Format>;
9847def warn_printf_invalid_objc_flag: Warning<
9848    "'%0' is not a valid object format flag">,
9849    InGroup<Format>;
9850def warn_printf_narg_not_supported : Warning<
9851    "'%%n' specifier not supported on this platform">,
9852    InGroup<Format>;
9853def warn_scanf_scanlist_incomplete : Warning<
9854  "no closing ']' for '%%[' in scanf format string">,
9855  InGroup<Format>;
9856def warn_format_bool_as_character : Warning<
9857  "using '%0' format specifier, but argument has boolean value">,
9858  InGroup<Format>;
9859def note_format_string_defined : Note<"format string is defined here">;
9860def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
9861def note_printf_c_str: Note<"did you mean to call the %0 method?">;
9862def note_format_security_fixit: Note<
9863  "treat the string as an argument to avoid this">;
9864
9865def warn_null_arg : Warning<
9866  "null passed to a callee that requires a non-null argument">,
9867  InGroup<NonNull>;
9868def warn_null_ret : Warning<
9869  "null returned from %select{function|method}0 that requires a non-null return value">,
9870  InGroup<NonNull>;
9871
9872def err_lifetimebound_no_object_param : Error<
9873  "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
9874  "function has no implicit object parameter">;
9875def err_lifetimebound_ctor_dtor : Error<
9876  "'lifetimebound' attribute cannot be applied to a "
9877  "%select{constructor|destructor}0">;
9878
9879// CHECK: returning address/reference of stack memory
9880def warn_ret_stack_addr_ref : Warning<
9881  "%select{address of|reference to}0 stack memory associated with "
9882  "%select{local variable|parameter}2 %1 returned">,
9883  InGroup<ReturnStackAddress>;
9884def warn_ret_local_temp_addr_ref : Warning<
9885  "returning %select{address of|reference to}0 local temporary object">,
9886  InGroup<ReturnStackAddress>;
9887def warn_ret_addr_label : Warning<
9888  "returning address of label, which is local">,
9889  InGroup<ReturnStackAddress>;
9890def err_ret_local_block : Error<
9891  "returning block that lives on the local stack">;
9892def note_local_var_initializer : Note<
9893  "%select{via initialization of|binding reference}0 variable "
9894  "%select{%2 |}1here">;
9895def note_lambda_capture_initializer : Note<
9896  "%select{implicitly |}2captured%select{| by reference}3"
9897  "%select{%select{ due to use|}2 here|"
9898  " via initialization of lambda capture %0}1">;
9899def note_init_with_default_member_initializer : Note<
9900  "initializing field %0 with default member initializer">;
9901
9902// Check for initializing a member variable with the address or a reference to
9903// a constructor parameter.
9904def warn_bind_ref_member_to_parameter : Warning<
9905  "binding reference member %0 to stack allocated "
9906  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9907def warn_init_ptr_member_to_parameter_addr : Warning<
9908  "initializing pointer member %0 with the stack address of "
9909  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9910def note_ref_or_ptr_member_declared_here : Note<
9911  "%select{reference|pointer}0 member declared here">;
9912
9913def err_dangling_member : Error<
9914  "%select{reference|backing array for 'std::initializer_list'}2 "
9915  "%select{|subobject of }1member %0 "
9916  "%select{binds to|is}2 a temporary object "
9917  "whose lifetime would be shorter than the lifetime of "
9918  "the constructed object">;
9919def warn_dangling_member : Warning<
9920  "%select{reference|backing array for 'std::initializer_list'}2 "
9921  "%select{|subobject of }1member %0 "
9922  "%select{binds to|is}2 a temporary object "
9923  "whose lifetime is shorter than the lifetime of the constructed object">,
9924  InGroup<DanglingField>;
9925def warn_dangling_lifetime_pointer_member : Warning<
9926  "initializing pointer member %0 to point to a temporary object "
9927  "whose lifetime is shorter than the lifetime of the constructed object">,
9928  InGroup<DanglingGsl>;
9929def note_lifetime_extending_member_declared_here : Note<
9930  "%select{%select{reference|'std::initializer_list'}0 member|"
9931  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
9932  "declared here">;
9933def warn_dangling_variable : Warning<
9934  "%select{temporary %select{whose address is used as value of|"
9935  "%select{|implicitly }2bound to}4 "
9936  "%select{%select{|reference }4member of local variable|"
9937  "local %select{variable|reference}4}1|"
9938  "array backing "
9939  "%select{initializer list subobject of local variable|"
9940  "local initializer list}1}0 "
9941  "%select{%3 |}2will be destroyed at the end of the full-expression">,
9942  InGroup<Dangling>;
9943def warn_new_dangling_reference : Warning<
9944  "temporary bound to reference member of allocated object "
9945  "will be destroyed at the end of the full-expression">,
9946  InGroup<DanglingField>;
9947def warn_dangling_lifetime_pointer : Warning<
9948  "object backing the pointer "
9949  "will be destroyed at the end of the full-expression">,
9950  InGroup<DanglingGsl>;
9951def warn_new_dangling_initializer_list : Warning<
9952  "array backing "
9953  "%select{initializer list subobject of the allocated object|"
9954  "the allocated initializer list}0 "
9955  "will be destroyed at the end of the full-expression">,
9956  InGroup<DanglingInitializerList>;
9957def warn_unsupported_lifetime_extension : Warning<
9958  "lifetime extension of "
9959  "%select{temporary|backing array of initializer list}0 created "
9960  "by aggregate initialization using a default member initializer "
9961  "is not yet supported; lifetime of %select{temporary|backing array}0 "
9962  "will end at the end of the full-expression">, InGroup<Dangling>;
9963
9964// For non-floating point, expressions of the form x == x or x != x
9965// should result in a warning, since these always evaluate to a constant.
9966// Array comparisons have similar warnings
9967def warn_comparison_always : Warning<
9968  "%select{self-|array }0comparison always evaluates to "
9969  "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9970  InGroup<TautologicalCompare>;
9971def warn_comparison_bitwise_always : Warning<
9972  "bitwise comparison always evaluates to %select{false|true}0">,
9973  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9974def warn_comparison_bitwise_or : Warning<
9975  "bitwise or with non-zero value always evaluates to true">,
9976  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9977def warn_tautological_negation_and_compare: Warning<
9978  "'&&' of a value and its negation always evaluates to false">,
9979  InGroup<TautologicalNegationCompare>, DefaultIgnore;
9980def warn_tautological_negation_or_compare: Warning<
9981  "'||' of a value and its negation always evaluates to true">,
9982  InGroup<TautologicalNegationCompare>, DefaultIgnore;
9983def warn_tautological_overlap_comparison : Warning<
9984  "overlapping comparisons always evaluate to %select{false|true}0">,
9985  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9986def warn_depr_array_comparison : Warning<
9987  "comparison between two arrays is deprecated; "
9988  "to compare array addresses, use unary '+' to decay operands to pointers">,
9989  InGroup<DeprecatedArrayCompare>;
9990
9991def warn_stringcompare : Warning<
9992  "result of comparison against %select{a string literal|@encode}0 is "
9993  "unspecified (use an explicit string comparison function instead)">,
9994  InGroup<StringCompare>;
9995
9996def warn_identity_field_assign : Warning<
9997  "assigning %select{field|instance variable}0 to itself">,
9998  InGroup<SelfAssignmentField>;
9999
10000// Type safety attributes
10001def err_type_tag_for_datatype_not_ice : Error<
10002  "'type_tag_for_datatype' attribute requires the initializer to be "
10003  "an %select{integer|integral}0 constant expression">;
10004def err_type_tag_for_datatype_too_large : Error<
10005  "'type_tag_for_datatype' attribute requires the initializer to be "
10006  "an %select{integer|integral}0 constant expression "
10007  "that can be represented by a 64 bit integer">;
10008def err_tag_index_out_of_range : Error<
10009  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
10010def warn_type_tag_for_datatype_wrong_kind : Warning<
10011  "this type tag was not designed to be used with this function">,
10012  InGroup<TypeSafety>;
10013def warn_type_safety_type_mismatch : Warning<
10014  "argument type %0 doesn't match specified %1 type tag "
10015  "%select{that requires %3|}2">, InGroup<TypeSafety>;
10016def warn_type_safety_null_pointer_required : Warning<
10017  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
10018
10019// Generic selections.
10020def err_assoc_type_incomplete : Error<
10021  "type %0 in generic association incomplete">;
10022def err_assoc_type_nonobject : Error<
10023  "type %0 in generic association not an object type">;
10024def err_assoc_type_variably_modified : Error<
10025  "type %0 in generic association is a variably modified type">;
10026def err_assoc_compatible_types : Error<
10027  "type %0 in generic association compatible with previously specified type %1">;
10028def note_compat_assoc : Note<
10029  "compatible type %0 specified here">;
10030def err_generic_sel_no_match : Error<
10031  "controlling expression type %0 not compatible with any generic association type">;
10032def err_generic_sel_multi_match : Error<
10033  "controlling expression type %0 compatible with %1 generic association types">;
10034
10035
10036// Blocks
10037def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
10038  " or %select{pick a deployment target that supports them|for OpenCL C 2.0"
10039  " or OpenCL C 3.0 with __opencl_c_device_enqueue feature}0">;
10040def err_block_returning_array_function : Error<
10041  "block cannot return %select{array|function}0 type %1">;
10042
10043// Builtin annotation
10044def err_builtin_annotation_first_arg : Error<
10045  "first argument to __builtin_annotation must be an integer">;
10046def err_builtin_annotation_second_arg : Error<
10047  "second argument to __builtin_annotation must be a non-wide string constant">;
10048def err_msvc_annotation_wide_str : Error<
10049  "arguments to __annotation must be wide string constants">;
10050
10051// CFString checking
10052def err_cfstring_literal_not_string_constant : Error<
10053  "CFString literal is not a string constant">;
10054def warn_cfstring_truncated : Warning<
10055  "input conversion stopped due to an input byte that does not "
10056  "belong to the input codeset UTF-8">,
10057  InGroup<DiagGroup<"CFString-literal">>;
10058
10059// os_log checking
10060// TODO: separate diagnostic for os_trace()
10061def err_os_log_format_not_string_constant : Error<
10062  "os_log() format argument is not a string constant">;
10063def err_os_log_argument_too_big : Error<
10064  "os_log() argument %0 is too big (%1 bytes, max %2)">;
10065def warn_os_log_format_narg : Error<
10066 "os_log() '%%n' format specifier is not allowed">, DefaultError;
10067
10068// Statements.
10069def err_continue_not_in_loop : Error<
10070  "'continue' statement not in loop statement">;
10071def err_break_not_in_loop_or_switch : Error<
10072  "'break' statement not in loop or switch statement">;
10073def warn_loop_ctrl_binds_to_inner : Warning<
10074  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
10075  InGroup<GccCompat>;
10076def err_omp_bind_required_on_loop : Error<
10077  "expected 'bind' clause for 'loop' construct without an enclosing OpenMP "
10078  "construct">;
10079def err_omp_loop_reduction_clause : Error<
10080  "'reduction' clause not allowed with '#pragma omp loop bind(teams)'">;
10081def warn_break_binds_to_switch : Warning<
10082  "'break' is bound to loop, GCC binds it to switch">,
10083  InGroup<GccCompat>;
10084def err_default_not_in_switch : Error<
10085  "'default' statement not in switch statement">;
10086def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
10087def warn_bool_switch_condition : Warning<
10088  "switch condition has boolean value">, InGroup<SwitchBool>;
10089def warn_case_value_overflow : Warning<
10090  "overflow converting case value to switch condition type (%0 to %1)">,
10091  InGroup<Switch>;
10092def err_duplicate_case : Error<"duplicate case value '%0'">;
10093def err_duplicate_case_differing_expr : Error<
10094  "duplicate case value: '%0' and '%1' both equal '%2'">;
10095def warn_case_empty_range : Warning<"empty case range specified">;
10096def warn_missing_case_for_condition :
10097  Warning<"no case matching constant switch condition '%0'">;
10098def err_loop_attr_conflict : Error<
10099  "conflicting loop attribute %0">;
10100def err_attribute_power_of_two_in_range : Error<
10101  "%0 attribute requires an integer argument which is a constant power of two "
10102  "between %1 and %2 inclusive; provided argument was %3">;
10103
10104def warn_def_missing_case : Warning<"%plural{"
10105  "1:enumeration value %1 not explicitly handled in switch|"
10106  "2:enumeration values %1 and %2 not explicitly handled in switch|"
10107  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
10108  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
10109  InGroup<SwitchEnum>, DefaultIgnore;
10110
10111def warn_missing_case : Warning<"%plural{"
10112  "1:enumeration value %1 not handled in switch|"
10113  "2:enumeration values %1 and %2 not handled in switch|"
10114  "3:enumeration values %1, %2, and %3 not handled in switch|"
10115  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
10116  InGroup<Switch>;
10117def warn_switch_default : Warning<"'switch' missing 'default' label">,
10118  InGroup<SwitchDefault>, DefaultIgnore;
10119
10120def warn_unannotated_fallthrough : Warning<
10121  "unannotated fall-through between switch labels">,
10122  InGroup<ImplicitFallthrough>, DefaultIgnore;
10123def warn_unannotated_fallthrough_per_function : Warning<
10124  "unannotated fall-through between switch labels in partly-annotated "
10125  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
10126def note_insert_fallthrough_fixit : Note<
10127  "insert '%0;' to silence this warning">;
10128def note_insert_break_fixit : Note<
10129  "insert 'break;' to avoid fall-through">;
10130def err_fallthrough_attr_wrong_target : Error<
10131  "%0 attribute is only allowed on empty statements">;
10132def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
10133def err_fallthrough_attr_outside_switch : Error<
10134  "fallthrough annotation is outside switch statement">;
10135def err_fallthrough_attr_invalid_placement : Error<
10136  "fallthrough annotation does not directly precede switch label">;
10137
10138def warn_unreachable_default : Warning<
10139  "default label in switch which covers all enumeration values">,
10140  InGroup<CoveredSwitchDefault>, DefaultIgnore;
10141def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
10142  InGroup<Switch>;
10143def warn_not_in_enum_assignment : Warning<"integer constant not in range "
10144  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
10145def err_typecheck_statement_requires_scalar : Error<
10146  "statement requires expression of scalar type (%0 invalid)">;
10147def err_typecheck_statement_requires_integer : Error<
10148  "statement requires expression of integer type (%0 invalid)">;
10149def err_multiple_default_labels_defined : Error<
10150  "multiple default labels in one switch">;
10151def err_switch_multiple_conversions : Error<
10152  "multiple conversions from switch condition type %0 to an integral or "
10153  "enumeration type">;
10154def note_switch_conversion : Note<
10155  "conversion to %select{integral|enumeration}0 type %1">;
10156def err_switch_explicit_conversion : Error<
10157  "switch condition type %0 requires explicit conversion to %1">;
10158def err_switch_incomplete_class_type : Error<
10159  "switch condition has incomplete class type %0">;
10160
10161def warn_empty_if_body : Warning<
10162  "if statement has empty body">, InGroup<EmptyBody>;
10163def warn_empty_for_body : Warning<
10164  "for loop has empty body">, InGroup<EmptyBody>;
10165def warn_empty_range_based_for_body : Warning<
10166  "range-based for loop has empty body">, InGroup<EmptyBody>;
10167def warn_empty_while_body : Warning<
10168  "while loop has empty body">, InGroup<EmptyBody>;
10169def warn_empty_switch_body : Warning<
10170  "switch statement has empty body">, InGroup<EmptyBody>;
10171def note_empty_body_on_separate_line : Note<
10172  "put the semicolon on a separate line to silence this warning">;
10173
10174def err_va_start_captured_stmt : Error<
10175  "'va_start' cannot be used in a captured statement">;
10176def err_va_start_outside_function : Error<
10177  "'va_start' cannot be used outside a function">;
10178def err_va_start_fixed_function : Error<
10179  "'va_start' used in function with fixed args">;
10180def err_va_start_used_in_wrong_abi_function : Error<
10181  "'va_start' used in %select{System V|Win64}0 ABI function">;
10182def err_ms_va_start_used_in_sysv_function : Error<
10183  "'__builtin_ms_va_start' used in System V ABI function">;
10184def warn_second_arg_of_va_start_not_last_named_param : Warning<
10185  "second argument to 'va_start' is not the last named parameter">,
10186  InGroup<Varargs>;
10187def warn_c17_compat_ellipsis_only_parameter : Warning<
10188  "'...' as the only parameter of a function is incompatible with C standards "
10189  "before C23">, DefaultIgnore, InGroup<CPre23Compat>;
10190def warn_va_start_type_is_undefined : Warning<
10191  "passing %select{an object that undergoes default argument promotion|"
10192  "an object of reference type|a parameter declared with the 'register' "
10193  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
10194def err_first_argument_to_va_arg_not_of_type_va_list : Error<
10195  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
10196def err_second_parameter_to_va_arg_incomplete: Error<
10197  "second argument to 'va_arg' is of incomplete type %0">;
10198def err_second_parameter_to_va_arg_abstract: Error<
10199  "second argument to 'va_arg' is of abstract type %0">;
10200def warn_second_parameter_to_va_arg_not_pod : Warning<
10201  "second argument to 'va_arg' is of non-POD type %0">,
10202  InGroup<NonPODVarargs>, DefaultError;
10203def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
10204  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
10205  InGroup<NonPODVarargs>, DefaultError;
10206def warn_second_parameter_to_va_arg_never_compatible : Warning<
10207  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
10208  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
10209
10210def warn_return_missing_expr : Warning<
10211  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
10212  InGroup<ReturnType>;
10213def ext_return_missing_expr : ExtWarn<
10214  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
10215  InGroup<ReturnType>;
10216def ext_return_has_expr : ExtWarn<
10217  "%select{void function|void method|constructor|destructor}1 %0 "
10218  "should not return a value">,
10219  DefaultError, InGroup<ReturnType>;
10220def ext_return_has_void_expr : Extension<
10221  "void %select{function|method|block}1 %0 should not return void expression">;
10222def err_return_init_list : Error<
10223  "%select{void function|void method|constructor|destructor}1 %0 "
10224  "must not return a value">;
10225def err_ctor_dtor_returns_void : Error<
10226  "%select{constructor|destructor}1 %0 must not return void expression">;
10227def warn_noreturn_function_has_return_expr : Warning<
10228  "function %0 declared 'noreturn' should not return">,
10229  InGroup<InvalidNoreturn>;
10230def warn_falloff_noreturn_function : Warning<
10231  "function declared 'noreturn' should not return">,
10232  InGroup<InvalidNoreturn>;
10233def err_noreturn_block_has_return_expr : Error<
10234  "block declared 'noreturn' should not return">;
10235def err_carries_dependency_missing_on_first_decl : Error<
10236  "%select{function|parameter}0 declared '[[carries_dependency]]' "
10237  "after its first declaration">;
10238def note_carries_dependency_missing_first_decl : Note<
10239  "declaration missing '[[carries_dependency]]' attribute is here">;
10240def err_carries_dependency_param_not_function_decl : Error<
10241  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
10242  "declaration or lambda">;
10243def err_block_on_nonlocal : Error<
10244  "__block attribute not allowed, only allowed on local variables">;
10245def err_block_on_vm : Error<
10246  "__block attribute not allowed on declaration with a variably modified type">;
10247def err_sizeless_nonlocal : Error<
10248  "non-local variable with sizeless type %0">;
10249
10250def err_vec_builtin_non_vector : Error<
10251 "first two arguments to %0 must be vectors">;
10252def err_vec_builtin_incompatible_vector : Error<
10253  "first two arguments to %0 must have the same type">;
10254def err_vsx_builtin_nonconstant_argument : Error<
10255  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
10256
10257def err_shufflevector_nonconstant_argument : Error<
10258  "index for __builtin_shufflevector must be a constant integer">;
10259def err_shufflevector_argument_too_large : Error<
10260  "index for __builtin_shufflevector must be less than the total number "
10261  "of vector elements">;
10262
10263def err_convertvector_non_vector : Error<
10264  "first argument to __builtin_convertvector must be a vector">;
10265def err_builtin_non_vector_type : Error<
10266  "%0 argument to %1 must be of vector type">;
10267def err_convertvector_incompatible_vector : Error<
10268  "first two arguments to __builtin_convertvector must have the same number of elements">;
10269
10270def err_first_argument_to_cwsc_not_call : Error<
10271  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
10272def err_first_argument_to_cwsc_block_call : Error<
10273  "first argument to __builtin_call_with_static_chain must not be a block call">;
10274def err_first_argument_to_cwsc_builtin_call : Error<
10275  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
10276def err_first_argument_to_cwsc_pdtor_call : Error<
10277  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
10278def err_second_argument_to_cwsc_not_pointer : Error<
10279  "second argument to __builtin_call_with_static_chain must be of pointer type">;
10280
10281def err_vector_incorrect_num_initializers : Error<
10282  "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
10283def err_altivec_empty_initializer : Error<"expected initializer">;
10284
10285def err_invalid_neon_type_code : Error<
10286  "incompatible constant for this __builtin_neon function">;
10287def err_argument_invalid_range : Error<
10288  "argument value %0 is outside the valid range [%1, %2]">;
10289def warn_argument_invalid_range : Warning<
10290  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
10291  InGroup<DiagGroup<"argument-outside-range">>;
10292def warn_argument_undefined_behaviour : Warning<
10293  "argument value %0 will result in undefined behaviour">,
10294  InGroup<DiagGroup<"argument-undefined-behaviour">>;
10295def err_argument_not_multiple : Error<
10296  "argument should be a multiple of %0">;
10297def err_argument_not_power_of_2 : Error<
10298  "argument should be a power of 2">;
10299def err_argument_not_shifted_byte : Error<
10300  "argument should be an 8-bit value shifted by a multiple of 8 bits">;
10301def err_argument_not_shifted_byte_or_xxff : Error<
10302  "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
10303def err_argument_not_contiguous_bit_field : Error<
10304  "argument %0 value should represent a contiguous bit field">;
10305def err_rotation_argument_to_cadd : Error<
10306  "argument should be the value 90 or 270">;
10307def err_rotation_argument_to_cmla : Error<
10308  "argument should be the value 0, 90, 180 or 270">;
10309def warn_neon_vector_initializer_non_portable : Warning<
10310  "vector initializers are not compatible with NEON intrinsics in big endian "
10311  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
10312def note_neon_vector_initializer_non_portable : Note<
10313  "consider using vld1_%0%1() to initialize a vector from memory, or "
10314  "vcreate_%0%1() to initialize from an integer constant">;
10315def note_neon_vector_initializer_non_portable_q : Note<
10316  "consider using vld1q_%0%1() to initialize a vector from memory, or "
10317  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
10318  "constants">;
10319def err_systemz_invalid_tabort_code : Error<
10320  "invalid transaction abort code">;
10321def err_64_bit_builtin_32_bit_tgt : Error<
10322  "this builtin is only available on 64-bit targets">;
10323def err_32_bit_builtin_64_bit_tgt : Error<
10324  "this builtin is only available on 32-bit targets">;
10325def err_builtin_x64_aarch64_only : Error<
10326  "this builtin is only available on x86-64 and aarch64 targets">;
10327def err_mips_builtin_requires_dsp : Error<
10328  "this builtin requires 'dsp' ASE, please use -mdsp">;
10329def err_mips_builtin_requires_dspr2 : Error<
10330  "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
10331def err_mips_builtin_requires_msa : Error<
10332  "this builtin requires 'msa' ASE, please use -mmsa">;
10333def err_ppc_builtin_requires_abi : Error<
10334  "this builtin requires ABI -mabi=%0">;
10335def err_ppc_invalid_use_mma_type : Error<
10336  "invalid use of PPC MMA type">;
10337def err_ppc_invalid_test_data_class_type : Error<
10338  "expected a 'float', 'double' or '__float128' for the first argument">;
10339def err_x86_builtin_invalid_rounding : Error<
10340  "invalid rounding argument">;
10341def err_x86_builtin_invalid_scale : Error<
10342  "scale argument must be 1, 2, 4, or 8">;
10343def err_x86_builtin_tile_arg_duplicate : Error<
10344  "tile arguments must refer to different tiles">;
10345
10346def err_builtin_target_unsupported : Error<
10347  "builtin is not supported on this target">;
10348def err_builtin_longjmp_unsupported : Error<
10349  "__builtin_longjmp is not supported for the current target">;
10350def err_builtin_setjmp_unsupported : Error<
10351  "__builtin_setjmp is not supported for the current target">;
10352
10353def err_builtin_longjmp_invalid_val : Error<
10354  "argument to __builtin_longjmp must be a constant 1">;
10355def err_builtin_requires_language : Error<"'%0' is only available in %1">;
10356
10357def err_constant_integer_arg_type : Error<
10358  "argument to %0 must be a constant integer">;
10359
10360def ext_mixed_decls_code : Extension<
10361  "mixing declarations and code is a C99 extension">,
10362  InGroup<DeclarationAfterStatement>;
10363def warn_mixed_decls_code : Warning<
10364  "mixing declarations and code is incompatible with standards before C99">,
10365  InGroup<DeclarationAfterStatement>, DefaultIgnore;
10366
10367def err_non_local_variable_decl_in_for : Error<
10368  "declaration of non-local variable in 'for' loop">;
10369def err_non_variable_decl_in_for : Error<
10370  "non-variable declaration in 'for' loop">;
10371def err_toomany_element_decls : Error<
10372  "only one element declaration is allowed">;
10373def err_selector_element_not_lvalue : Error<
10374  "selector element is not a valid lvalue">;
10375def err_selector_element_type : Error<
10376  "selector element type %0 is not a valid object">;
10377def err_selector_element_const_type : Error<
10378  "selector element of type %0 cannot be a constant lvalue expression">;
10379def err_collection_expr_type : Error<
10380  "the type %0 is not a pointer to a fast-enumerable object">;
10381def warn_collection_expr_type : Warning<
10382  "collection expression type %0 may not respond to %1">;
10383
10384def err_invalid_conversion_between_ext_vectors : Error<
10385  "invalid conversion between ext-vector type %0 and %1">;
10386
10387def warn_duplicate_attribute_exact : Warning<
10388  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
10389
10390def warn_duplicate_attribute : Warning<
10391  "attribute %0 is already applied with different arguments">,
10392  InGroup<IgnoredAttributes>;
10393def err_disallowed_duplicate_attribute : Error<
10394  "attribute %0 cannot appear more than once on a declaration">;
10395
10396def warn_sync_fetch_and_nand_semantics_change : Warning<
10397  "the semantics of this intrinsic changed with GCC "
10398  "version 4.4 - the newer semantics are provided here">,
10399  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
10400
10401// Type
10402def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
10403  InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
10404def warn_receiver_forward_class : Warning<
10405  "receiver %0 is a forward class and corresponding @interface may not exist">,
10406  InGroup<ForwardClassReceiver>;
10407def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
10408def ext_missing_type_specifier : ExtWarn<
10409  "type specifier missing, defaults to 'int'; ISO C99 and later do not support "
10410  "implicit int">, InGroup<ImplicitInt>;
10411def err_missing_type_specifier : Error<
10412  "a type specifier is required for all declarations">;
10413def err_decimal_unsupported : Error<
10414  "GNU decimal type extension not supported">;
10415def err_objc_array_of_interfaces : Error<
10416  "array of interface %0 is invalid (probably should be an array of pointers)">;
10417def ext_c99_array_usage : Extension<
10418  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10419  "feature">, InGroup<C99>;
10420def err_c99_array_usage_cxx : Error<
10421  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10422  "feature, not permitted in C++">;
10423def err_type_unsupported : Error<
10424  "%0 is not supported on this target">;
10425def err_nsconsumed_attribute_mismatch : Error<
10426  "overriding method has mismatched ns_consumed attribute on its"
10427  " parameter">;
10428def err_nsreturns_retained_attribute_mismatch : Error<
10429  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
10430  " attributes">;
10431def err_nserrordomain_invalid_decl : Error<
10432  "domain argument %select{|%1 }0does not refer to global constant">;
10433def err_nserrordomain_wrong_type : Error<
10434  "domain argument %0 does not point to an NSString or CFString constant">;
10435
10436def warn_nsconsumed_attribute_mismatch : Warning<
10437  err_nsconsumed_attribute_mismatch.Summary>, InGroup<NSConsumedMismatch>;
10438def warn_nsreturns_retained_attribute_mismatch : Warning<
10439  err_nsreturns_retained_attribute_mismatch.Summary>, InGroup<NSReturnsMismatch>;
10440
10441def note_getter_unavailable : Note<
10442  "or because setter is declared here, but no getter method %0 is found">;
10443def err_invalid_protocol_qualifiers : Error<
10444  "invalid protocol qualifiers on non-ObjC type">;
10445def warn_ivar_use_hidden : Warning<
10446  "local declaration of %0 hides instance variable">,
10447   InGroup<ShadowIvar>;
10448def warn_direct_initialize_call : Warning<
10449  "explicit call to +initialize results in duplicate call to +initialize">,
10450   InGroup<ExplicitInitializeCall>;
10451def warn_direct_super_initialize_call : Warning<
10452  "explicit call to [super initialize] should only be in implementation "
10453  "of +initialize">,
10454   InGroup<ExplicitInitializeCall>;
10455def err_ivar_use_in_class_method : Error<
10456  "instance variable %0 accessed in class method">;
10457def err_private_ivar_access : Error<"instance variable %0 is private">,
10458  AccessControl;
10459def err_protected_ivar_access : Error<"instance variable %0 is protected">,
10460  AccessControl;
10461def warn_maynot_respond : Warning<"%0 may not respond to %1">;
10462def ext_typecheck_base_super : Warning<
10463  "method parameter type "
10464  "%diff{$ does not match super class method parameter type $|"
10465  "does not match super class method parameter type}0,1">,
10466   InGroup<SuperSubClassMismatch>, DefaultIgnore;
10467def warn_missing_method_return_type : Warning<
10468  "method has no return type specified; defaults to 'id'">,
10469  InGroup<MissingMethodReturnType>, DefaultIgnore;
10470def warn_direct_ivar_access : Warning<"instance variable %0 is being "
10471  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
10472
10473// Spell-checking diagnostics
10474def err_unknown_typename : Error<
10475  "unknown type name %0">;
10476def err_unknown_type_or_class_name_suggest : Error<
10477  "unknown %select{type|class}1 name %0; did you mean %2?">;
10478def err_unknown_typename_suggest : Error<
10479  "unknown type name %0; did you mean %1?">;
10480def err_unknown_nested_typename_suggest : Error<
10481  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
10482def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
10483def err_undeclared_use_suggest : Error<
10484  "use of undeclared %0; did you mean %1?">;
10485def err_undeclared_var_use_suggest : Error<
10486  "use of undeclared identifier %0; did you mean %1?">;
10487def err_no_template : Error<"no template named %0">;
10488def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
10489def err_no_member_template : Error<"no template named %0 in %1">;
10490def err_no_member_template_suggest : Error<
10491  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
10492def err_non_template_in_template_id : Error<
10493  "%0 does not name a template but is followed by template arguments">;
10494def err_non_template_in_template_id_suggest : Error<
10495  "%0 does not name a template but is followed by template arguments; "
10496  "did you mean %1?">;
10497def err_non_template_in_member_template_id_suggest : Error<
10498  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
10499def note_non_template_in_template_id_found : Note<
10500  "non-template declaration found by name lookup">;
10501def err_mem_init_not_member_or_class_suggest : Error<
10502  "initializer %0 does not name a non-static data member or base "
10503  "class; did you mean the %select{base class|member}1 %2?">;
10504def err_field_designator_unknown_suggest : Error<
10505  "field designator %0 does not refer to any field in type %1; did you mean "
10506  "%2?">;
10507def err_typecheck_member_reference_ivar_suggest : Error<
10508  "%0 does not have a member named %1; did you mean %2?">;
10509def err_property_not_found_suggest : Error<
10510  "property %0 not found on object of type %1; did you mean %2?">;
10511def err_class_property_found : Error<
10512  "property %0 is a class property; did you mean to access it with class '%1'?">;
10513def err_ivar_access_using_property_syntax_suggest : Error<
10514  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
10515def warn_property_access_suggest : Warning<
10516"property %0 not found on object of type %1; did you mean to access property %2?">,
10517InGroup<PropertyAccessDotSyntax>;
10518def err_property_found_suggest : Error<
10519  "property %0 found on object of type %1; did you mean to access "
10520  "it with the \".\" operator?">;
10521def err_undef_interface_suggest : Error<
10522  "cannot find interface declaration for %0; did you mean %1?">;
10523def warn_undef_interface_suggest : Warning<
10524  "cannot find interface declaration for %0; did you mean %1?">;
10525def err_undef_superclass_suggest : Error<
10526  "cannot find interface declaration for %0, superclass of %1; did you mean "
10527  "%2?">;
10528def err_undeclared_protocol_suggest : Error<
10529  "cannot find protocol declaration for %0; did you mean %1?">;
10530def note_base_class_specified_here : Note<
10531  "base class %0 specified here">;
10532def err_using_directive_suggest : Error<
10533  "no namespace named %0; did you mean %1?">;
10534def err_using_directive_member_suggest : Error<
10535  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
10536def note_namespace_defined_here : Note<"namespace %0 defined here">;
10537def err_sizeof_pack_no_pack_name_suggest : Error<
10538  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
10539def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
10540
10541def err_uncasted_use_of_unknown_any : Error<
10542  "%0 has unknown type; cast it to its declared type to use it">;
10543def err_uncasted_call_of_unknown_any : Error<
10544  "%0 has unknown return type; cast the call to its declared return type">;
10545def err_uncasted_send_to_unknown_any_method : Error<
10546  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
10547  "message send to the method's return type">;
10548def err_unsupported_unknown_any_decl : Error<
10549  "%0 has unknown type, which is not supported for this kind of declaration">;
10550def err_unsupported_unknown_any_expr : Error<
10551  "unsupported expression with unknown type">;
10552def err_unsupported_unknown_any_call : Error<
10553  "call to unsupported expression with unknown type">;
10554def err_unknown_any_addrof : Error<
10555  "the address of a declaration with unknown type "
10556  "can only be cast to a pointer type">;
10557def err_unknown_any_addrof_call : Error<
10558  "address-of operator cannot be applied to a call to a function with "
10559  "unknown return type">;
10560def err_unknown_any_var_function_type : Error<
10561  "variable %0 with unknown type cannot be given a function type">;
10562def err_unknown_any_function : Error<
10563  "function %0 with unknown type must be given a function type">;
10564
10565def err_filter_expression_integral : Error<
10566  "filter expression has non-integral type %0">;
10567
10568def err_non_asm_stmt_in_naked_function : Error<
10569  "non-ASM statement in naked function is not supported">;
10570def err_asm_naked_this_ref : Error<
10571  "'this' pointer references not allowed in naked functions">;
10572def err_asm_naked_parm_ref : Error<
10573  "parameter references not allowed in naked functions">;
10574
10575// OpenCL warnings and errors.
10576def err_invalid_astype_of_different_size : Error<
10577  "invalid reinterpretation: sizes of %0 and %1 must match">;
10578def err_static_kernel : Error<
10579  "kernel functions cannot be declared static">;
10580def err_method_kernel : Error<
10581  "kernel functions cannot be class members">;
10582def err_template_kernel : Error<
10583  "kernel functions cannot be used in a template declaration, instantiation or specialization">;
10584def err_opencl_ptrptr_kernel_param : Error<
10585  "kernel parameter cannot be declared as a pointer to a pointer">;
10586def err_kernel_arg_address_space : Error<
10587  "pointer arguments to kernel functions must reside in '__global', "
10588  "'__constant' or '__local' address space">;
10589def err_opencl_ext_vector_component_invalid_length : Error<
10590  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
10591def err_opencl_function_variable : Error<
10592  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
10593def err_opencl_addrspace_scope : Error<
10594  "variables in the %0 address space can only be declared in the outermost "
10595  "scope of a kernel function">;
10596def err_static_function_scope : Error<
10597  "variables in function scope cannot be declared static">;
10598def err_opencl_bitfields : Error<
10599  "bit-fields are not supported in OpenCL">;
10600def err_opencl_vla : Error<
10601  "variable length arrays are not supported in OpenCL">;
10602def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
10603    "scalar operand type has greater rank than the type of the vector "
10604    "element. (%0 and %1)">;
10605def err_bad_kernel_param_type : Error<
10606  "%0 cannot be used as the type of a kernel parameter">;
10607def err_record_with_pointers_kernel_param : Error<
10608  "%select{struct|union}0 kernel parameters may not contain pointers">;
10609def note_within_field_of_type : Note<
10610  "within field of type %0 declared here">;
10611def note_illegal_field_declared_here : Note<
10612  "field of illegal %select{type|pointer type}0 %1 declared here">;
10613def err_opencl_type_struct_or_union_field : Error<
10614  "the %0 type cannot be used to declare a structure or union field">;
10615def err_event_t_addr_space_qual : Error<
10616  "the event_t type can only be used with __private address space qualifier">;
10617def err_expected_kernel_void_return_type : Error<
10618  "kernel must have void return type">;
10619def err_sampler_initializer_not_integer : Error<
10620  "sampler_t initialization requires 32-bit integer, not %0">;
10621def warn_sampler_initializer_invalid_bits : Warning<
10622  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
10623def err_sampler_argument_required : Error<
10624  "sampler_t variable required - got %0">;
10625def err_wrong_sampler_addressspace: Error<
10626  "sampler type cannot be used with the __local and __global address space qualifiers">;
10627def err_opencl_nonconst_global_sampler : Error<
10628  "global sampler requires a const or constant address space qualifier">;
10629def err_opencl_cast_non_zero_to_event_t : Error<
10630  "cannot cast non-zero value '%0' to 'event_t'">;
10631def err_opencl_global_invalid_addr_space : Error<
10632  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
10633def err_missing_actual_pipe_type : Error<
10634  "missing actual type specifier for pipe">;
10635def err_reference_pipe_type : Error <
10636  "pipes packet types cannot be of reference type">;
10637def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
10638def err_opencl_kernel_attr :
10639  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
10640def err_return_value_with_address_space : Error<
10641  "return type cannot be qualified with address space">;
10642def err_opencl_constant_no_init : Error<
10643  "variable in constant address space must be initialized">;
10644def err_opencl_atomic_init: Error<
10645  "atomic variable can be %select{assigned|initialized}0 to a variable only "
10646  "in global address space">;
10647def err_opencl_implicit_vector_conversion : Error<
10648  "implicit conversions between vector types (%0 and %1) are not permitted">;
10649def err_opencl_invalid_type_array : Error<
10650  "array of %0 type is invalid in OpenCL">;
10651def err_opencl_ternary_with_block : Error<
10652  "block type cannot be used as expression in ternary expression in OpenCL">;
10653def err_opencl_pointer_to_type : Error<
10654  "pointer to type %0 is invalid in OpenCL">;
10655def err_opencl_type_can_only_be_used_as_function_parameter : Error <
10656  "type %0 can only be used as a function parameter in OpenCL">;
10657def err_opencl_type_not_found : Error<
10658  "%0 type %1 not found; include the base header with -finclude-default-header">;
10659def warn_opencl_attr_deprecated_ignored : Warning <
10660  "%0 attribute is deprecated and ignored in %1">, InGroup<IgnoredAttributes>;
10661def err_opencl_variadic_function : Error<
10662  "invalid prototype, variadic arguments are not allowed in OpenCL">;
10663def err_opencl_requires_extension : Error<
10664  "use of %select{type|declaration}0 %1 requires %2 support">;
10665def ext_opencl_double_without_pragma : Extension<
10666  "Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is"
10667  " supported">;
10668def warn_opencl_generic_address_space_arg : Warning<
10669  "passing non-generic address space pointer to %0"
10670  " may cause dynamic conversion affecting performance">,
10671  InGroup<Conversion>, DefaultIgnore;
10672
10673// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
10674def err_opencl_builtin_pipe_first_arg : Error<
10675  "first argument to %0 must be a pipe type">;
10676def err_opencl_builtin_pipe_arg_num : Error<
10677  "invalid number of arguments to function: %0">;
10678def err_opencl_builtin_pipe_invalid_arg : Error<
10679  "invalid argument type to function %0 (expecting %1 having %2)">;
10680def err_opencl_builtin_pipe_invalid_access_modifier : Error<
10681  "invalid pipe access modifier (expecting %0)">;
10682
10683// OpenCL access qualifier
10684def err_opencl_invalid_access_qualifier : Error<
10685  "access qualifier can only be used for pipe and image type">;
10686def err_opencl_invalid_read_write : Error<
10687  "access qualifier %0 can not be used for %1 %select{|prior to OpenCL C version 2.0 or in version 3.0 "
10688  "and without __opencl_c_read_write_images feature}2">;
10689def err_opencl_multiple_access_qualifiers : Error<
10690  "multiple access qualifiers">;
10691def note_opencl_typedef_access_qualifier : Note<
10692  "previously declared '%0' here">;
10693
10694// OpenCL v2.0 s6.12.5 Blocks restrictions
10695def err_opencl_block_storage_type : Error<
10696  "the __block storage type is not permitted">;
10697def err_opencl_invalid_block_declaration : Error<
10698  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
10699def err_opencl_extern_block_declaration : Error<
10700  "invalid block variable declaration - using 'extern' storage class is disallowed">;
10701def err_opencl_block_ref_block : Error<
10702  "cannot refer to a block inside block">;
10703
10704// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
10705def err_opencl_builtin_to_addr_invalid_arg : Error<
10706  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
10707
10708// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
10709def err_opencl_enqueue_kernel_incorrect_args : Error<
10710  "illegal call to enqueue_kernel, incorrect argument types">;
10711def err_opencl_enqueue_kernel_local_size_args : Error<
10712  "mismatch in number of block parameters and local size arguments passed">;
10713def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
10714  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
10715def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
10716  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
10717def err_opencl_enqueue_kernel_blocks_no_args : Error<
10718  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
10719
10720def err_opencl_builtin_expected_type : Error<
10721  "illegal call to %0, expected %1 argument type">;
10722
10723// OpenCL v3.0 s6.3.7 - Vector Components
10724def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
10725  "vector component name '%0' is a feature from OpenCL version 3.0 onwards">,
10726  InGroup<OpenCLUnsupportedRGBA>;
10727
10728def err_openclcxx_placement_new : Error<
10729  "use of placement new requires explicit declaration">;
10730
10731// MIG routine annotations.
10732def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
10733  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
10734  InGroup<IgnoredAttributes>;
10735
10736def warn_imp_cast_drops_unaligned : Warning<
10737  "implicit cast from type %0 to type %1 drops __unaligned qualifier">,
10738  InGroup<DiagGroup<"unaligned-qualifier-implicit-cast">>;
10739
10740} // end of sema category
10741
10742let CategoryName = "OpenMP Issue" in {
10743// OpenMP support.
10744def err_omp_expected_var_arg : Error<
10745  "%0 is not a global variable, static local variable or static data member">;
10746def err_omp_expected_var_arg_suggest : Error<
10747  "%0 is not a global variable, static local variable or static data member; "
10748  "did you mean %1">;
10749def err_omp_global_var_arg : Error<
10750  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
10751def err_omp_ref_type_arg : Error<
10752  "arguments of '#pragma omp %0' cannot be of reference type %1">;
10753def err_omp_region_not_file_context : Error<
10754  "directive must be at file or namespace scope">;
10755def err_omp_var_scope : Error<
10756  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
10757def err_omp_var_used : Error<
10758  "'#pragma omp %0' must precede all references to variable %q1">;
10759def err_omp_var_thread_local : Error<
10760  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
10761def err_omp_private_incomplete_type : Error<
10762  "a private variable with incomplete type %0">;
10763def err_omp_firstprivate_incomplete_type : Error<
10764  "a firstprivate variable with incomplete type %0">;
10765def err_omp_lastprivate_incomplete_type : Error<
10766  "a lastprivate variable with incomplete type %0">;
10767def err_omp_reduction_incomplete_type : Error<
10768  "a reduction list item with incomplete type %0">;
10769def warn_omp_minus_in_reduction_deprecated : Warning<
10770  "minus(-) operator for reductions is deprecated; use + or user defined reduction instead">,
10771  InGroup<Deprecated>;
10772def err_omp_unexpected_clause_value : Error<
10773  "expected %0 in OpenMP clause '%1'">;
10774def err_omp_unexpected_call_to_omp_runtime_api
10775    : Error<"calls to OpenMP runtime API are not allowed within a region that "
10776            "corresponds to a construct with an order clause that specifies "
10777            "concurrent">;
10778def err_omp_expected_var_name_member_expr : Error<
10779  "expected variable name%select{| or data member of current class}0">;
10780def err_omp_expected_var_name_member_expr_with_type : Error<
10781  "expected variable%select{| or static data member|, static data member, "
10782  "or non-static data member of current class}0 of type '%1'">;
10783def err_omp_expected_var_name_member_expr_or_array_item : Error<
10784  "expected variable name%select{|, data member of current class}0, array element or array section">;
10785def err_omp_expected_addressable_lvalue_or_array_item : Error<
10786  "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">;
10787def err_omp_expected_named_var_member_or_array_expression: Error<
10788  "expected expression containing only member accesses and/or array sections based on named variables">;
10789def err_omp_bit_fields_forbidden_in_clause : Error<
10790  "bit fields cannot be used to specify storage in a '%0' clause">;
10791def err_array_section_does_not_specify_contiguous_storage : Error<
10792  "array section does not specify contiguous storage">;
10793def err_array_section_does_not_specify_length : Error<
10794  "array section does not specify length for outermost dimension">;
10795def err_omp_union_type_not_allowed : Error<
10796  "mapping of union members is not allowed">;
10797def err_omp_expected_access_to_data_field : Error<
10798  "expected access to data field">;
10799def err_omp_multiple_array_items_in_map_clause : Error<
10800  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
10801def err_omp_duplicate_map_type_modifier : Error<
10802  "same map type modifier has been specified more than once">;
10803def err_omp_duplicate_motion_modifier : Error<
10804  "same motion modifier has been specified more than once">;
10805def err_omp_pointer_mapped_along_with_derived_section : Error<
10806  "pointer cannot be mapped along with a section derived from itself">;
10807def err_omp_original_storage_is_shared_and_does_not_contain : Error<
10808  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
10809def err_omp_same_pointer_dereferenced : Error<
10810  "same pointer dereferenced in multiple different ways in map clause expressions">;
10811def note_omp_task_predetermined_firstprivate_here : Note<
10812  "predetermined as a firstprivate in a task construct here">;
10813def err_omp_threadprivate_incomplete_type : Error<
10814  "threadprivate variable with incomplete type %0">;
10815def err_omp_no_dsa_for_variable : Error<
10816  "variable %0 must have explicitly specified data sharing attributes">;
10817def err_omp_defaultmap_no_attr_for_variable : Error<
10818  "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
10819def note_omp_default_dsa_none : Note<
10820  "explicit data sharing attribute requested here">;
10821def note_omp_defaultmap_attr_none : Note<
10822  "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
10823def err_omp_wrong_dsa : Error<
10824  "%0 variable cannot be %1">;
10825def err_omp_variably_modified_type_not_supported : Error<
10826  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
10827def note_omp_explicit_dsa : Note<
10828  "defined as %0">;
10829def note_omp_predetermined_dsa : Note<
10830  "%select{static data member is predetermined as shared|"
10831  "variable with static storage duration is predetermined as shared|"
10832  "loop iteration variable is predetermined as private|"
10833  "loop iteration variable is predetermined as linear|"
10834  "loop iteration variable is predetermined as lastprivate|"
10835  "constant variable is predetermined as shared|"
10836  "global variable is predetermined as shared|"
10837  "non-shared variable in a task construct is predetermined as firstprivate|"
10838  "variable with automatic storage duration is predetermined as private}0"
10839  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
10840def note_omp_implicit_dsa : Note<
10841  "implicitly determined as %0">;
10842def err_omp_loop_var_dsa : Error<
10843  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
10844def err_omp_not_for : Error<
10845  "%select{statement after '#pragma omp %1' must be a for loop|"
10846  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
10847def note_omp_collapse_ordered_expr : Note<
10848  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
10849def err_omp_negative_expression_in_clause : Error<
10850  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
10851def err_omp_not_integral : Error<
10852  "expression must have integral or unscoped enumeration "
10853  "type, not %0">;
10854def err_omp_threadprivate_in_target : Error<
10855  "threadprivate variables cannot be used in target constructs">;
10856def err_omp_incomplete_type : Error<
10857  "expression has incomplete class type %0">;
10858def err_omp_explicit_conversion : Error<
10859  "expression requires explicit conversion from %0 to %1">;
10860def note_omp_conversion_here : Note<
10861  "conversion to %select{integral|enumeration}0 type %1 declared here">;
10862def err_omp_ambiguous_conversion : Error<
10863  "ambiguous conversion from type %0 to an integral or unscoped "
10864  "enumeration type">;
10865def err_omp_iterator_not_integral_or_pointer : Error<
10866  "expected integral or pointer type as the iterator-type, not %0">;
10867def err_omp_iterator_step_not_integral : Error<
10868  "iterator step expression %0 is not the integral expression">;
10869def err_omp_iterator_step_constant_zero : Error<
10870  "iterator step expression %0 evaluates to 0">;
10871def err_omp_required_access : Error<
10872  "%0 variable must be %1">;
10873def err_omp_const_variable : Error<
10874  "const-qualified variable cannot be %0">;
10875def err_omp_const_not_mutable_variable : Error<
10876  "const-qualified variable without mutable fields cannot be %0">;
10877def err_omp_const_list_item : Error<
10878  "const-qualified list item cannot be %0">;
10879def err_omp_linear_incomplete_type : Error<
10880  "a linear variable with incomplete type %0">;
10881def err_omp_linear_expected_int_or_ptr : Error<
10882  "argument of a linear clause should be of integral or pointer "
10883  "type, not %0">;
10884def warn_omp_linear_step_zero : Warning<
10885  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
10886  InGroup<OpenMPClauses>;
10887def warn_omp_alignment_not_power_of_two : Warning<
10888  "aligned clause will be ignored because the requested alignment is not a power of 2">,
10889  InGroup<OpenMPClauses>;
10890def err_omp_invalid_target_decl : Error<
10891  "%0 used in declare target directive is not a variable or a function name">;
10892def err_omp_declare_target_to_and_link : Error<
10893  "%0 must not appear in both clauses 'to' and 'link'">;
10894def warn_omp_not_in_target_context : Warning<
10895  "declaration is not declared in any declare target region">,
10896  InGroup<OpenMPTarget>;
10897def err_omp_function_in_link_clause : Error<
10898  "function name is not allowed in 'link' clause">;
10899def err_omp_aligned_expected_array_or_ptr : Error<
10900  "argument of aligned clause should be array"
10901  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
10902  ", not %0">;
10903def err_omp_used_in_clause_twice : Error<
10904  "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
10905def err_omp_local_var_in_threadprivate_init : Error<
10906  "variable with local storage in initial value of threadprivate variable">;
10907def err_omp_loop_not_canonical_init : Error<
10908  "initialization clause of OpenMP for loop is not in canonical form "
10909  "('var = init' or 'T var = init')">;
10910def ext_omp_loop_not_canonical_init : ExtWarn<
10911  "initialization clause of OpenMP for loop is not in canonical form "
10912  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
10913def err_omp_loop_not_canonical_cond : Error<
10914  "condition of OpenMP for loop must be a relational comparison "
10915  "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
10916def err_omp_loop_not_canonical_incr : Error<
10917  "increment clause of OpenMP for loop must perform simple addition "
10918  "or subtraction on loop variable %0">;
10919def err_omp_loop_variable_type : Error<
10920  "variable must be of integer or %select{pointer|random access iterator}0 type">;
10921def err_omp_loop_incr_not_compatible : Error<
10922  "increment expression must cause %0 to %select{decrease|increase}1 "
10923  "on each iteration of OpenMP for loop">;
10924def note_omp_loop_cond_requres_compatible_incr : Note<
10925  "loop step is expected to be %select{negative|positive}0 due to this condition">;
10926def err_omp_loop_diff_cxx : Error<
10927  "could not calculate number of iterations calling 'operator-' with "
10928  "upper and lower loop bounds">;
10929def err_omp_loop_cannot_use_stmt : Error<
10930  "'%0' statement cannot be used in OpenMP for loop">;
10931def err_omp_simd_region_cannot_use_stmt : Error<
10932  "'%0' statement cannot be used in OpenMP simd region">;
10933def warn_omp_loop_64_bit_var : Warning<
10934  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
10935  InGroup<OpenMPLoopForm>;
10936def err_omp_unknown_reduction_identifier_prior_omp_6_0 : Error<
10937  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
10938  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10939def err_omp_unknown_reduction_identifier_since_omp_6_0 : Error<
10940  "incorrect reduction identifier, expected one of '+', '*', '&', '|', '^', "
10941  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10942def err_omp_not_resolved_reduction_identifier : Error<
10943  "unable to resolve declare reduction construct for type %0">;
10944def err_omp_reduction_ref_type_arg : Error<
10945  "argument of OpenMP clause '%0' must reference the same object in all threads">;
10946def err_omp_clause_not_arithmetic_type_arg : Error<
10947  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
10948def err_omp_clause_floating_type_arg : Error<
10949  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
10950def err_omp_once_referenced : Error<
10951  "variable can appear only once in OpenMP '%0' clause">;
10952def err_omp_once_referenced_in_target_update : Error<
10953  "variable can appear only once in OpenMP 'target update' construct">;
10954def note_omp_referenced : Note<
10955  "previously referenced here">;
10956def err_omp_reduction_in_task : Error<
10957  "reduction variables may not be accessed in an explicit task">;
10958def err_omp_reduction_id_not_compatible : Error<
10959  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
10960def err_omp_reduction_identifier_mismatch : Error<
10961  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
10962def note_omp_previous_reduction_identifier : Note<
10963  "previously marked as task_reduction with different reduction operation">;
10964def err_omp_prohibited_region : Error<
10965  "region cannot be%select{| closely}0 nested inside '%1' region"
10966  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
10967  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
10968  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
10969  "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
10970  "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
10971def err_omp_prohibited_region_simd : Error<
10972  "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
10973def err_omp_prohibited_region_atomic : Error<
10974  "OpenMP constructs may not be nested inside an atomic region">;
10975def err_omp_prohibited_region_order
10976    : Error<"construct '%0' not allowed in a region associated with a "
10977            "directive with 'order' clause">;
10978def err_omp_prohibited_region_critical_same_name : Error<
10979  "cannot nest 'critical' regions having the same name %0">;
10980def note_omp_previous_critical_region : Note<
10981  "previous 'critical' region starts here">;
10982def err_omp_several_directives_in_region : Error<
10983  "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
10984def note_omp_previous_directive : Note<
10985  "previous '%0' directive used here">;
10986def err_omp_sections_not_compound_stmt : Error<
10987  "the statement for '#pragma omp sections' must be a compound statement">;
10988def err_omp_parallel_sections_not_compound_stmt : Error<
10989  "the statement for '#pragma omp parallel sections' must be a compound statement">;
10990def err_omp_orphaned_section_directive : Error<
10991  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
10992  " must be closely nested to a sections region%select{|, not a %1 region}0">;
10993def err_omp_sections_substmt_not_section : Error<
10994  "statement in 'omp sections' directive must be enclosed into a section region">;
10995def err_omp_parallel_sections_substmt_not_section : Error<
10996  "statement in 'omp parallel sections' directive must be enclosed into a section region">;
10997def err_omp_parallel_reduction_in_task_firstprivate : Error<
10998  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
10999def err_omp_atomic_read_not_expression_statement : Error<
11000  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
11001  " where v and x are both lvalue expressions with scalar type">;
11002def note_omp_atomic_read_write: Note<
11003  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
11004def err_omp_atomic_write_not_expression_statement : Error<
11005  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
11006  " where x is a lvalue expression with scalar type">;
11007def err_omp_atomic_update_not_expression_statement : Error<
11008  "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',"
11009  " where x is an lvalue expression with scalar type">;
11010def err_omp_atomic_not_expression_statement : Error<
11011  "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',"
11012  " where x is an lvalue expression with scalar type">;
11013def note_omp_atomic_update: Note<
11014  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
11015  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
11016  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
11017def err_omp_atomic_capture_not_expression_statement : Error<
11018  "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',"
11019  " where x and v are both lvalue expressions with scalar type">;
11020def err_omp_atomic_capture_not_compound_statement : Error<
11021  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
11022  " '{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;}',"
11023  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
11024  " where x is an lvalue expression with scalar type">;
11025def note_omp_atomic_capture: Note<
11026  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
11027def err_omp_atomic_compare : Error<
11028  "the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}',"
11029  " '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}',"
11030  " 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type,"
11031  " and 'ordop' is one of '<' or '>'.">;
11032def err_omp_atomic_compare_capture : Error<
11033  "the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}',"
11034  " '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}',"
11035  " 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x', 'r', and 'v' are lvalue expressions with scalar type, 'expr', 'e', and 'd' are expressions with scalar type,"
11036  " and 'ordop' is one of '<' or '>'.">;
11037def note_omp_atomic_compare: Note<
11038  "%select{expected compound statement|expected exactly one expression statement|expected assignment statement|expected conditional operator|expect result value to be at false expression|"
11039  "expect binary operator in conditional expression|expect '<', '>' or '==' as order operator|expect comparison in a form of 'x == e', 'e == x', 'x ordop expr', or 'expr ordop x'|"
11040  "expect lvalue for result value|expect scalar value|expect integer value|unexpected 'else' statement|expect '==' operator|expect an assignment statement 'v = x'|"
11041  "expect a 'if' statement|expect no more than two statements|expect a compound statement|expect 'else' statement|expect a form 'r = x == e; if (r) ...'}0">;
11042def err_omp_atomic_fail_wrong_or_no_clauses : Error<"expected a memory order clause">;
11043def err_omp_atomic_fail_no_compare : Error<"expected 'compare' clause with the 'fail' modifier">;
11044def err_omp_atomic_several_clauses : Error<
11045  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
11046def err_omp_several_mem_order_clauses : Error<
11047  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
11048def err_omp_atomic_incompatible_mem_order_clause : Error<
11049  "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
11050def note_omp_previous_mem_order_clause : Note<
11051  "'%0' clause used here">;
11052def err_omp_target_contains_not_only_teams : Error<
11053  "target construct with nested teams region contains statements outside of the teams construct">;
11054def note_omp_nested_teams_construct_here : Note<
11055  "nested teams construct here">;
11056def note_omp_nested_statement_here : Note<
11057  "%select{statement|directive}0 outside teams construct here">;
11058def err_omp_single_copyprivate_with_nowait : Error<
11059  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
11060def err_omp_nowait_clause_without_depend: Error<
11061  "directive '#pragma omp taskwait' cannot use 'nowait' clause without 'depend' clause">;
11062def note_omp_nowait_clause_here : Note<
11063  "'nowait' clause is here">;
11064def err_omp_single_decl_in_declare_simd_variant : Error<
11065  "single declaration is expected after 'declare %select{simd|variant}0' directive">;
11066def err_omp_function_expected : Error<
11067  "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
11068def err_omp_wrong_cancel_region : Error<
11069  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
11070def err_omp_parent_cancel_region_nowait : Error<
11071  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
11072def err_omp_parent_cancel_region_ordered : Error<
11073  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
11074def 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">;
11075def 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">;
11076def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
11077def err_omp_mapper_wrong_type : Error<
11078  "mapper type must be of struct, union or class type">;
11079def err_omp_declare_mapper_wrong_var : Error<
11080  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
11081def err_omp_declare_mapper_redefinition : Error<
11082  "redefinition of user-defined mapper for type %0 with name %1">;
11083def err_omp_invalid_mapper: Error<
11084  "cannot find a valid user-defined mapper for type %0 with name %1">;
11085def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
11086def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
11087def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
11088def err_omp_typecheck_section_value : Error<
11089  "subscripted value is not an array or pointer">;
11090def err_omp_typecheck_section_not_integer : Error<
11091  "array section %select{lower bound|length}0 is not an integer">;
11092def err_omp_typecheck_shaping_not_integer : Error<
11093  "array shaping operation dimension is not an integer">;
11094def err_omp_shaping_dimension_not_positive : Error<
11095  "array shaping dimension is evaluated to a non-positive value %0">;
11096def err_omp_section_function_type : Error<
11097  "section of pointer to function type %0">;
11098def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
11099  InGroup<CharSubscript>, DefaultIgnore;
11100def err_omp_section_incomplete_type : Error<
11101  "section of pointer to incomplete type %0">;
11102def err_omp_section_not_subset_of_array : Error<
11103  "array section must be a subset of the original array">;
11104def err_omp_section_length_negative : Error<
11105  "section length is evaluated to a negative value %0">;
11106def err_omp_section_stride_non_positive : Error<
11107  "section stride is evaluated to a non-positive value %0">;
11108def err_omp_section_length_undefined : Error<
11109  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
11110def err_omp_wrong_linear_modifier : Error<
11111  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
11112def err_omp_wrong_linear_modifier_non_reference : Error<
11113  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
11114def err_omp_step_simple_modifier_exclusive : Error<
11115  "step simple modifier is exclusive and can't be use with 'val', 'uval' or 'ref' modifier">;
11116def err_omp_wrong_simdlen_safelen_values : Error<
11117  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
11118def err_omp_wrong_if_directive_name_modifier : Error<
11119  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
11120def err_omp_no_more_if_clause : Error<
11121  "no more 'if' clause is allowed">;
11122def err_omp_unnamed_if_clause : Error<
11123  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
11124def note_omp_previous_named_if_clause : Note<
11125  "previous clause with directive name modifier specified here">;
11126def err_omp_ordered_directive_with_param : Error<
11127  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
11128def err_omp_ordered_directive_without_param : Error<
11129  "'ordered' directive with '%0' clause cannot be closely nested inside ordered region without specified parameter">;
11130def note_omp_ordered_param : Note<
11131  "'ordered' clause%select{| with specified parameter}0">;
11132def err_omp_expected_base_var_name : Error<
11133  "expected variable name as a base of the array %select{subscript|section}0">;
11134def err_omp_map_shared_storage : Error<
11135  "variable already marked as mapped in current construct">;
11136def err_omp_invalid_map_type_for_directive : Error<
11137  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
11138def err_omp_invalid_map_type_modifier_for_directive : Error<
11139  "map type modifier '%0' is not allowed for '#pragma omp %1'">;
11140def err_omp_no_clause_for_directive : Error<
11141  "expected at least one %0 clause for '#pragma omp %1'">;
11142def err_omp_threadprivate_in_clause : Error<
11143  "threadprivate variables are not allowed in '%0' clause">;
11144def err_omp_wrong_ordered_loop_count : Error<
11145  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
11146def note_collapse_loop_count : Note<
11147  "parameter of the 'collapse' clause">;
11148def err_omp_clauses_mutually_exclusive : Error<
11149  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
11150def note_omp_previous_clause : Note<
11151  "'%0' clause is specified here">;
11152def err_omp_hint_clause_no_name : Error<
11153  "the name of the construct must be specified in presence of 'hint' clause">;
11154def err_omp_critical_with_hint : Error<
11155  "constructs with the same name must have a 'hint' clause with the same value">;
11156def note_omp_critical_hint_here : Note<
11157  "%select{|previous }0'hint' clause with value '%1'">;
11158def note_omp_critical_no_hint : Note<
11159  "%select{|previous }0directive with no 'hint' clause specified">;
11160def err_omp_depend_clause_thread_simd : Error<
11161  "'%0' clauses cannot be mixed with '%1' clause">;
11162def err_omp_depend_sink_expected_loop_iteration : Error<
11163  "expected%select{| %1}0 loop iteration variable">;
11164def err_omp_depend_sink_unexpected_expr : Error<
11165  "unexpected expression: number of expressions is larger than the number of associated loops">;
11166def err_omp_depend_sink_expected_plus_minus : Error<
11167  "expected '+' or '-' operation">;
11168def err_omp_taskwait_depend_mutexinoutset_not_allowed : Error<
11169  "'mutexinoutset' modifier not allowed in 'depend' clause on 'taskwait' directive">;
11170def err_omp_sink_and_source_not_allowed : Error<
11171  "'%0(%select{source|sink:vec}1)' clause%select{|s}1 cannot be mixed with '%0(%select{sink:vec|source}1)' clause%select{s|}1">;
11172def err_omp_depend_zero_length_array_section_not_allowed : Error<
11173  "zero-length array section is not allowed in 'depend' clause">;
11174def err_omp_depend_sink_source_with_modifier : Error<
11175  "depend modifier cannot be used with 'sink' or 'source' depend type">;
11176def err_omp_depend_modifier_not_iterator : Error<
11177  "expected iterator specification as depend modifier">;
11178def err_omp_map_modifier_not_iterator : Error<
11179  "expected iterator specification as map modifier">;
11180def err_omp_linear_ordered : Error<
11181  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
11182def err_omp_unexpected_schedule_modifier : Error<
11183  "modifier '%0' cannot be used along with modifier '%1'">;
11184def err_omp_schedule_nonmonotonic_static : Error<
11185  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
11186def err_omp_simple_clause_incompatible_with_ordered : Error<
11187  "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
11188def err_omp_ordered_simd : Error<
11189  "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
11190def err_omp_variable_in_given_clause_and_dsa : Error<
11191  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
11192def err_omp_param_or_this_in_clause : Error<
11193  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
11194def err_omp_expected_uniform_param : Error<
11195  "expected a reference to a parameter specified in a 'uniform' clause">;
11196def err_omp_expected_int_param : Error<
11197  "expected a reference to an integer-typed parameter">;
11198def err_omp_at_least_one_motion_clause_required : Error<
11199  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
11200def err_omp_cannot_update_with_internal_linkage : Error<
11201  "the host cannot update a declare target variable that is not externally visible.">;
11202def err_omp_usedeviceptr_not_a_pointer : Error<
11203  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
11204def err_omp_argument_type_isdeviceptr : Error <
11205  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
11206def warn_omp_nesting_simd : Warning<
11207  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
11208  InGroup<SourceUsesOpenMP>;
11209def err_omp_orphaned_device_directive : Error<
11210  "orphaned 'omp %0' directives are prohibited"
11211  "; perhaps you forget to enclose the directive into a "
11212  "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
11213def err_omp_reduction_non_addressable_expression : Error<
11214  "expected addressable reduction item for the task-based directives">;
11215def err_omp_reduction_with_nogroup : Error<
11216  "'reduction' clause cannot be used with 'nogroup' clause">;
11217def err_omp_reduction_vla_unsupported : Error<
11218  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
11219def err_omp_linear_distribute_var_non_loop_iteration : Error<
11220  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
11221def warn_omp_non_trivial_type_mapped : Warning<
11222  "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
11223  InGroup<OpenMPMapping>;
11224def err_omp_requires_clause_redeclaration : Error <
11225  "Only one %0 clause can appear on a requires directive in a single translation unit">;
11226def note_omp_requires_previous_clause : Note <
11227  "%0 clause previously used here">;
11228def err_omp_directive_before_requires : Error <
11229  "'%0' region encountered before requires directive with '%1' clause">;
11230def note_omp_requires_encountered_directive : Note <
11231  "'%0' previously encountered here">;
11232def err_omp_device_ancestor_without_requires_reverse_offload : Error <
11233  "Device clause with ancestor device-modifier used without specifying 'requires reverse_offload'">;
11234def err_omp_invalid_scope : Error <
11235  "'#pragma omp %0' directive must appear only in file scope">;
11236def note_omp_invalid_length_on_this_ptr_mapping : Note <
11237  "expected length on mapping of 'this' array section expression to be '1'">;
11238def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
11239  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
11240def note_omp_invalid_subscript_on_this_ptr_map : Note <
11241  "expected 'this' subscript expression on map clause to be 'this[0]'">;
11242def err_omp_invalid_map_this_expr : Error <
11243  "invalid 'this' expression on 'map' clause">;
11244def err_omp_implied_type_not_found : Error<
11245  "'%0' type not found; include <omp.h>">;
11246def err_omp_expected_omp_depend_t_lvalue : Error<
11247  "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
11248def err_omp_depobj_expected : Error<
11249  "expected depobj expression">;
11250def err_omp_depobj_single_clause_expected : Error<
11251  "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
11252def err_omp_scan_single_clause_expected : Error<
11253  "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
11254def err_omp_inclusive_exclusive_not_reduction : Error<
11255  "the list item must appear in 'reduction' clause with the 'inscan' modifier "
11256  "of the parent directive">;
11257def err_omp_reduction_not_inclusive_exclusive : Error<
11258  "the inscan reduction list item must appear as a list item in an 'inclusive' or"
11259  " 'exclusive' clause on an inner 'omp scan' directive">;
11260def err_omp_wrong_inscan_reduction : Error<
11261  "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
11262  " 'omp parallel for', or 'omp parallel for simd' directive">;
11263def err_omp_inscan_reduction_expected : Error<
11264  "expected 'reduction' clause with the 'inscan' modifier">;
11265def note_omp_previous_inscan_reduction : Note<
11266  "'reduction' clause with 'inscan' modifier is used here">;
11267def err_omp_expected_predefined_allocator : Error<
11268  "expected one of the predefined allocators for the variables with the static "
11269  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
11270  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
11271  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
11272def warn_omp_used_different_allocator : Warning<
11273  "allocate directive specifies %select{default|'%1'}0 allocator while "
11274  "previously used %select{default|'%3'}2">,
11275  InGroup<OpenMPClauses>;
11276def note_omp_previous_allocator : Note<
11277  "previous allocator is specified here">;
11278def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
11279  "inside of the target region; provide an 'allocator' clause or use 'requires'"
11280  " directive with the 'dynamic_allocators' clause">;
11281def err_expected_allocator_expression : Error<"expected an allocator expression "
11282  "inside of the target region; provide an allocator expression or use 'requires'"
11283  " directive with the 'dynamic_allocators' clause">;
11284def warn_omp_allocate_thread_on_task_target_directive : Warning<
11285  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
11286  InGroup<OpenMPClauses>;
11287def err_omp_expected_private_copy_for_allocate : Error<
11288  "the referenced item is not found in any private clause on the same directive">;
11289def err_omp_stmt_depends_on_loop_counter : Error<
11290  "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
11291def err_omp_invariant_dependency : Error<
11292  "expected loop invariant expression">;
11293def err_omp_invariant_or_linear_dependency : Error<
11294  "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
11295def err_omp_wrong_dependency_iterator_type : Error<
11296  "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
11297def err_target_unsupported_type
11298    : Error<"%0 requires %select{|%2 bit size}1 %3 %select{|return }4type support,"
11299            " but target '%5' does not support it">;
11300def err_omp_lambda_capture_in_declare_target_not_to : Error<
11301  "variable captured in declare target region must appear in a to clause">;
11302def err_omp_device_type_mismatch : Error<
11303  "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
11304def err_omp_wrong_device_function_call : Error<
11305  "function with 'device_type(%0)' is not available on %select{device|host}1">;
11306def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
11307def warn_omp_declare_target_after_first_use : Warning<
11308  "declaration marked as declare target after first use, it may lead to incorrect results">,
11309  InGroup<OpenMPTarget>;
11310def err_omp_declare_variant_incompat_attributes : Error<
11311  "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
11312def warn_omp_declare_variant_score_not_constant
11313    : Warning<"score expressions in the OpenMP context selector need to be "
11314              "constant; %0 is not and will be ignored">,
11315      InGroup<SourceUsesOpenMP>;
11316def err_omp_declare_variant_user_condition_not_constant
11317    : Error<"the user condition in the OpenMP context selector needs to be "
11318            "constant; %0 is not">;
11319def warn_omp_declare_variant_after_used : Warning<
11320  "'#pragma omp declare variant' cannot be applied for function after first "
11321  "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
11322def warn_omp_declare_variant_after_emitted : Warning<
11323  "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
11324  " the original function might be used">, InGroup<SourceUsesOpenMP>;
11325def err_omp_declare_variant_doesnt_support : Error<
11326  "'#pragma omp declare variant' does not "
11327  "support %select{function templates|virtual functions|"
11328  "deduced return types|constructors|destructors|deleted functions|"
11329  "defaulted functions|constexpr functions|consteval function}0">;
11330def err_omp_declare_variant_diff : Error<
11331  "function with '#pragma omp declare variant' has a different %select{calling convention"
11332  "|return type|constexpr specification|inline specification|storage class|"
11333  "linkage}0">;
11334def err_omp_declare_variant_prototype_required : Error<
11335  "function with '#pragma omp declare variant' must have a prototype when "
11336  "'append_args' is used">;
11337def err_omp_interop_type_not_found : Error<
11338  "'omp_interop_t' must be defined when 'append_args' clause is used; include <omp.h>">;
11339def err_omp_declare_variant_incompat_types : Error<
11340  "variant in '#pragma omp declare variant' with type %0 is incompatible with"
11341  " type %1%select{| with appended arguments}2">;
11342def err_omp_declare_variant_same_base_function : Error<
11343  "variant in '#pragma omp declare variant' is the same as the base function">;
11344def warn_omp_declare_variant_marked_as_declare_variant : Warning<
11345  "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
11346  >, InGroup<SourceUsesOpenMP>;
11347def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
11348def err_omp_one_defaultmap_each_category: Error<
11349  "at most one defaultmap clause for each variable-category can appear on the directive">;
11350def err_omp_lastprivate_conditional_non_scalar : Error<
11351  "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
11352  >;
11353def err_omp_flush_order_clause_and_list : Error<
11354  "'flush' directive with memory order clause '%0' cannot have the list">;
11355def note_omp_flush_order_clause_here : Note<
11356  "memory order clause '%0' is specified here">;
11357def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
11358  "expected addressable lvalue in '%0' clause">;
11359def err_omp_var_expected : Error<
11360  "expected variable of the '%0' type%select{|, not %2}1">;
11361def err_omp_non_pointer_type_array_shaping_base : Error<
11362  "expected expression with a pointer to a complete type as a base of an array "
11363  "shaping operation">;
11364def err_omp_reduction_task_not_parallel_or_worksharing : Error<
11365  "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
11366  " worksharing constructs">;
11367def err_omp_expected_array_alloctraits : Error<
11368  "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
11369def err_omp_predefined_allocator_with_traits : Error<
11370  "predefined allocator cannot have traits specified">;
11371def note_omp_predefined_allocator : Note<
11372  "predefined trait '%0' used here">;
11373def err_omp_nonpredefined_allocator_without_traits : Error<
11374  "non-predefined allocator must have traits specified">;
11375def err_omp_allocator_used_in_clauses : Error<
11376  "allocators used in 'uses_allocators' clause cannot appear in other "
11377  "data-sharing or data-mapping attribute clauses">;
11378def err_omp_allocator_not_in_uses_allocators : Error<
11379  "allocator must be specified in the 'uses_allocators' clause">;
11380def note_omp_protected_structured_block
11381    : Note<"jump bypasses OpenMP structured block">;
11382def note_omp_exits_structured_block
11383    : Note<"jump exits scope of OpenMP structured block">;
11384def err_omp_lastprivate_loop_var_non_loop_iteration : Error<
11385  "only loop iteration variables are allowed in 'lastprivate' clause in "
11386  "'omp %0' directives">;
11387def err_omp_interop_variable_expected : Error<
11388  "expected%select{| non-const}0 variable of type 'omp_interop_t'">;
11389def err_omp_interop_variable_wrong_type : Error<
11390  "interop variable must be of type 'omp_interop_t'">;
11391def err_omp_interop_prefer_type : Error<
11392  "prefer_list item must be a string literal or constant integral "
11393  "expression">;
11394def err_omp_interop_bad_depend_clause : Error<
11395  "'depend' clause requires the 'targetsync' interop type">;
11396def err_omp_interop_var_multiple_actions : Error<
11397  "interop variable %0 used in multiple action clauses">;
11398def err_omp_dispatch_statement_call
11399    : Error<"statement after '#pragma omp dispatch' must be a direct call"
11400            " to a target function or an assignment to one">;
11401def err_omp_unroll_full_variable_trip_count : Error<
11402  "loop to be fully unrolled must have a constant trip count">;
11403def note_omp_directive_here : Note<"'%0' directive found here">;
11404def err_omp_instantiation_not_supported
11405    : Error<"instantiation of '%0' not supported yet">;
11406def err_omp_adjust_arg_multiple_clauses : Error<
11407  "'adjust_arg' argument %0 used in multiple clauses">;
11408def err_omp_clause_requires_dispatch_construct : Error<
11409  "'%0' clause requires 'dispatch' context selector">;
11410def err_omp_append_args_with_varargs : Error<
11411  "'append_args' is not allowed with varargs functions">;
11412def err_openmp_vla_in_task_untied : Error<
11413  "variable length arrays are not supported in OpenMP tasking regions with 'untied' clause">;
11414def warn_omp_unterminated_declare_target : Warning<
11415  "expected '#pragma omp end declare target' at end of file to match '#pragma omp %0'">,
11416  InGroup<SourceUsesOpenMP>;
11417def err_ompx_bare_no_grid : Error<
11418  "'ompx_bare' clauses requires explicit grid size via 'num_teams' and 'thread_limit' clauses">;
11419} // end of OpenMP category
11420
11421let CategoryName = "Related Result Type Issue" in {
11422// Objective-C related result type compatibility
11423def warn_related_result_type_compatibility_class : Warning<
11424  "method is expected to return an instance of its class type "
11425  "%diff{$, but is declared to return $|"
11426  ", but is declared to return different type}0,1">;
11427def warn_related_result_type_compatibility_protocol : Warning<
11428  "protocol method is expected to return an instance of the implementing "
11429  "class, but is declared to return %0">;
11430def note_related_result_type_family : Note<
11431  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
11432  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
11433  "self}1' method family%select{| and is expected to return an instance of its "
11434  "class type}0">;
11435def note_related_result_type_overridden : Note<
11436  "overridden method returns an instance of its class type">;
11437def note_related_result_type_inferred : Note<
11438  "%select{class|instance}0 method %1 is assumed to return an instance of "
11439  "its receiver type (%2)">;
11440def note_related_result_type_explicit : Note<
11441  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
11442  "%select{| and is expected to return an instance of its class type}0">;
11443def err_invalid_type_for_program_scope_var : Error<
11444  "the %0 type cannot be used to declare a program scope variable">;
11445
11446}
11447
11448let CategoryName = "Modules Issue" in {
11449def err_module_decl_in_module_map_module : Error<
11450  "'module' declaration found while building module from module map">;
11451def err_module_decl_in_header_unit : Error<
11452  "'module' declaration found while building header unit">;
11453def err_module_interface_implementation_mismatch : Error<
11454  "missing 'export' specifier in module declaration while "
11455  "building module interface">;
11456def err_current_module_name_mismatch : Error<
11457  "module name '%0' specified on command line does not match name of module">;
11458def err_module_redefinition : Error<
11459  "redefinition of module '%0'">;
11460def note_prev_module_definition : Note<"previously defined here">;
11461def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
11462def err_module_not_defined : Error<
11463  "definition of module '%0' is not available; use -fmodule-file= to specify "
11464  "path to precompiled module interface">;
11465def err_module_redeclaration : Error<
11466  "translation unit contains multiple module declarations">;
11467def note_prev_module_declaration : Note<"previous module declaration is here">;
11468def err_module_declaration_missing : Error<
11469  "missing 'export module' declaration in module interface unit">;
11470def err_module_declaration_missing_after_global_module_introducer : Error<
11471  "missing 'module' declaration at end of global module fragment "
11472  "introduced here">;
11473def err_module_private_specialization : Error<
11474  "%select{template|partial|member}0 specialization cannot be "
11475  "declared __module_private__">;
11476def err_module_private_local : Error<
11477  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
11478  "__module_private__">;
11479def err_module_private_local_class : Error<
11480  "local %select{struct|interface|union|class|enum}0 cannot be declared "
11481  "__module_private__">;
11482def err_module_unimported_use : Error<
11483  "%select{declaration|definition|default argument|"
11484  "explicit specialization|partial specialization}0 of %1 must be imported "
11485  "from module '%2' before it is required">;
11486def err_module_unimported_use_header : Error<
11487  "%select{missing '#include'|missing '#include %3'}2; "
11488  "%select{||default argument of |explicit specialization of |"
11489  "partial specialization of }0%1 must be "
11490  "%select{declared|defined|defined|declared|declared}0 "
11491  "before it is used">;
11492def err_module_unimported_use_multiple : Error<
11493  "%select{declaration|definition|default argument|"
11494  "explicit specialization|partial specialization}0 of %1 must be imported "
11495  "from one of the following modules before it is required:%2">;
11496def note_unreachable_entity : Note<
11497  "%select{declaration|definition|default argument declared|"
11498  "explicit specialization declared|partial specialization declared}0 here "
11499  "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
11500def ext_module_import_in_extern_c : ExtWarn<
11501  "import of C++ module '%0' appears within extern \"C\" language linkage "
11502  "specification">, DefaultError,
11503  InGroup<DiagGroup<"module-import-in-extern-c">>;
11504def err_module_import_not_at_top_level_fatal : Error<
11505  "import of module '%0' appears within %1">, DefaultFatal;
11506def ext_module_import_not_at_top_level_noop : ExtWarn<
11507  "redundant #include of module '%0' appears within %1">, DefaultError,
11508  InGroup<DiagGroup<"modules-import-nested-redundant">>;
11509def note_module_import_not_at_top_level : Note<"%0 begins here">;
11510def err_module_self_import : Error<
11511  "import of module '%0' appears within same top-level module '%1'">;
11512def err_module_self_import_cxx20 : Error<
11513  "import of module '%0' appears within its own %select{interface|implementation}1">;
11514def err_module_import_in_implementation : Error<
11515  "@import of module '%0' in implementation of '%1'; use #import">;
11516
11517// C++ Modules
11518def err_module_import_non_interface_nor_parition : Error<
11519  "import of module '%0' imported non C++20 importable modules">;
11520def err_module_decl_not_at_start : Error<
11521  "module declaration must occur at the start of the translation unit">;
11522def note_global_module_introducer_missing : Note<
11523  "add 'module;' to the start of the file to introduce a "
11524  "global module fragment">;
11525def err_export_within_anonymous_namespace : Error<
11526  "export declaration appears within anonymous namespace">;
11527def note_anonymous_namespace : Note<"anonymous namespace begins here">;
11528def note_export : Note<"export block begins here">;
11529def err_export_within_export : Error<
11530  "export declaration appears within another export declaration">;
11531def err_export_anon_ns_internal : Error<
11532  "anonymous namespaces cannot be exported">;
11533def err_export_internal : Error<
11534  "declaration of %0 with internal linkage cannot be exported">;
11535def err_export_using_internal : Error<
11536  "using declaration referring to %1 with %select{internal|module|unknown}0 "
11537  "linkage cannot be exported">;
11538def err_export_not_in_module_interface : Error<
11539  "export declaration can only be used within a module purview">;
11540def err_export_inline_not_defined : Error<
11541  "inline function not defined%select{| before the private module fragment}0">;
11542def err_export_partition_impl : Error<
11543  "module partition implementations cannot be exported">;
11544def err_export_in_private_module_fragment : Error<
11545  "export declaration cannot be used in a private module fragment">;
11546def note_private_module_fragment : Note<
11547  "private module fragment begins here">;
11548def err_private_module_fragment_not_module : Error<
11549  "private module fragment declaration with no preceding module declaration">;
11550def err_private_module_fragment_redefined : Error<
11551  "private module fragment redefined">;
11552def err_private_module_fragment_not_module_interface : Error<
11553  "private module fragment in module implementation unit">;
11554def note_not_module_interface_add_export : Note<
11555  "add 'export' here if this is intended to be a module interface unit">;
11556def err_invalid_module_name : Error<"%0 is an invalid name for a module">;
11557def err_extern_def_in_header_unit : Error<
11558  "non-inline external definitions are not permitted in C++ header units">;
11559
11560def warn_experimental_header_unit : Warning<
11561  "the implementation of header units is in an experimental phase">,
11562  InGroup<DiagGroup<"experimental-header-units">>;
11563
11564def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
11565  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
11566  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
11567def note_equivalent_internal_linkage_decl : Note<
11568  "declared here%select{ in module '%1'|}0">;
11569
11570def note_redefinition_modules_same_file : Note<
11571  "'%0' included multiple times, additional include site in header from module '%1'">;
11572def note_redefinition_include_same_file : Note<
11573  "'%0' included multiple times, additional include site here">;
11574}
11575
11576let CategoryName = "Coroutines Issue" in {
11577def err_return_in_coroutine : Error<
11578  "return statement not allowed in coroutine; did you mean 'co_return'?">;
11579def note_declared_coroutine_here : Note<
11580  "function is a coroutine due to use of '%0' here">;
11581def err_coroutine_objc_method : Error<
11582  "Objective-C methods as coroutines are not yet supported">;
11583def err_coroutine_unevaluated_context : Error<
11584  "'%0' cannot be used in an unevaluated context">;
11585def err_coroutine_within_handler : Error<
11586  "'%0' cannot be used in the handler of a try block">;
11587def err_coroutine_outside_function : Error<
11588  "'%0' cannot be used outside a function">;
11589def err_coroutine_invalid_func_context : Error<
11590  "'%1' cannot be used in %select{a constructor|a destructor"
11591  "|the 'main' function|a constexpr function"
11592  "|a function with a deduced return type|a varargs function"
11593  "|a consteval function}0">;
11594def err_implied_coroutine_type_not_found : Error<
11595  "%0 type was not found; include <coroutine> before defining "
11596  "a coroutine">;
11597def err_implicit_coroutine_std_nothrow_type_not_found : Error<
11598  "std::nothrow was not found; include <new> before defining a coroutine which "
11599  "uses get_return_object_on_allocation_failure()">;
11600def err_malformed_std_nothrow : Error<
11601  "std::nothrow must be a valid variable declaration">;
11602def err_malformed_std_coroutine_handle : Error<
11603  "std::coroutine_handle isn't a class template">;
11604def err_coroutine_handle_missing_member : Error<
11605  "std::coroutine_handle must have a member named '%0'">;
11606def err_malformed_std_coroutine_traits : Error<
11607  "std::coroutine_traits isn't a class template">;
11608def err_implied_std_coroutine_traits_promise_type_not_found : Error<
11609  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
11610def err_implied_std_coroutine_traits_promise_type_not_class : Error<
11611  "this function cannot be a coroutine: %0 is not a class">;
11612def err_coroutine_promise_type_incomplete : Error<
11613  "this function cannot be a coroutine: %0 is an incomplete type">;
11614def err_coroutine_type_missing_specialization : Error<
11615  "this function cannot be a coroutine: missing definition of "
11616  "specialization %0">;
11617def err_coroutine_promise_incompatible_return_functions : Error<
11618  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
11619def note_coroutine_promise_implicit_await_transform_required_here : Note<
11620  "call to 'await_transform' implicitly required by 'co_await' here">;
11621def note_coroutine_promise_suspend_implicitly_required : Note<
11622  "call to '%select{initial_suspend|final_suspend}0' implicitly "
11623  "required by the %select{initial suspend point|final suspend point}0">;
11624def err_coroutine_promise_unhandled_exception_required : Error<
11625  "%0 is required to declare the member 'unhandled_exception()'">;
11626def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
11627  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
11628  InGroup<CoroutineMissingUnhandledException>;
11629def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
11630  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
11631def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
11632  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
11633def err_coroutine_promise_new_requires_nothrow : Error<
11634  "%0 is required to have a non-throwing noexcept specification when the promise "
11635   "type declares 'get_return_object_on_allocation_failure()'">;
11636def note_coroutine_promise_call_implicitly_required : Note<
11637  "call to %0 implicitly required by coroutine function here">;
11638def err_await_suspend_invalid_return_type : Error<
11639  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
11640>;
11641def note_await_ready_no_bool_conversion : Note<
11642  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
11643>;
11644def warn_coroutine_handle_address_invalid_return_type : Warning <
11645  "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">,
11646  InGroup<Coroutine>;
11647def err_coroutine_promise_final_suspend_requires_nothrow : Error<
11648  "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
11649>;
11650def note_coroutine_function_declare_noexcept : Note<
11651  "must be declared with 'noexcept'"
11652>;
11653def warn_always_inline_coroutine : Warning<
11654  "this coroutine may be split into pieces; not every piece is guaranteed to be inlined"
11655  >,
11656  InGroup<AlwaysInlineCoroutine>;
11657def err_coroutine_unusable_new : Error<
11658  "'operator new' provided by %0 is not usable with the function signature of %1"
11659>;
11660def err_coroutine_unfound_nothrow_new : Error <
11661  "unable to find %select{'::operator new(size_t, nothrow_t)'|"
11662  "'::operator new(size_t, align_val_t, nothrow_t)'}1 for %0"
11663>;
11664def warn_non_aligned_allocation_function : Warning <
11665  "under -fcoro-aligned-allocation, the non-aligned allocation function "
11666  "for the promise type %0 has higher precedence than the global aligned "
11667  "allocation function">,
11668  InGroup<CoroNonAlignedAllocationFunction>;
11669def err_conflicting_aligned_options : Error <
11670  "conflicting option '-fcoro-aligned-allocation' and '-fno-aligned-allocation'"
11671>;
11672def err_coro_invalid_addr_of_label : Error<
11673  "the GNU address of label extension is not allowed in coroutines."
11674>;
11675def err_coroutine_return_type : Error<
11676  "function returns a type %0 marked with [[clang::coro_return_type]] but is neither a coroutine nor a coroutine wrapper; "
11677  "non-coroutines should be marked with [[clang::coro_wrapper]] to allow returning coroutine return type"
11678>;
11679} // end of coroutines issue category
11680
11681let CategoryName = "Documentation Issue" in {
11682def warn_not_a_doxygen_trailing_member_comment : Warning<
11683  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
11684def warn_splice_in_doxygen_comment : Warning<
11685  "line splicing in Doxygen comments are not supported">, InGroup<Documentation>, DefaultIgnore;
11686} // end of documentation issue category
11687
11688let CategoryName = "Nullability Issue" in {
11689
11690def warn_mismatched_nullability_attr : Warning<
11691  "nullability specifier %0 conflicts with existing specifier %1">,
11692  InGroup<Nullability>;
11693
11694def warn_nullability_declspec : Warning<
11695  "nullability specifier %0 cannot be applied "
11696  "to non-pointer type %1; did you mean to apply the specifier to the "
11697  "%select{pointer|block pointer|member pointer|function pointer|"
11698  "member function pointer}2?">,
11699  InGroup<NullabilityDeclSpec>,
11700  DefaultError;
11701
11702def note_nullability_here : Note<"%0 specified here">;
11703
11704def err_nullability_nonpointer : Error<
11705  "nullability specifier %0 cannot be applied to non-pointer type %1">;
11706
11707def warn_nullability_lost : Warning<
11708  "implicit conversion from nullable pointer %0 to non-nullable pointer "
11709  "type %1">,
11710  InGroup<NullableToNonNullConversion>, DefaultIgnore;
11711def warn_zero_as_null_pointer_constant : Warning<
11712  "zero as null pointer constant">,
11713  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
11714
11715def err_nullability_cs_multilevel : Error<
11716  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
11717def note_nullability_type_specifier : Note<
11718  "use nullability type specifier %0 to affect the innermost "
11719  "pointer type of %1">;
11720
11721def warn_null_resettable_setter : Warning<
11722  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
11723  InGroup<Nullability>;
11724
11725def warn_nullability_missing : Warning<
11726  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
11727  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
11728  InGroup<NullabilityCompleteness>;
11729def warn_nullability_missing_array : Warning<
11730  "array parameter is missing a nullability type specifier (_Nonnull, "
11731  "_Nullable, or _Null_unspecified)">,
11732  InGroup<NullabilityCompletenessOnArrays>;
11733def note_nullability_fix_it : Note<
11734  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
11735  "%select{pointer|block pointer|member pointer|array parameter}1 "
11736  "%select{should never be null|may be null|should not declare nullability}0">;
11737
11738def warn_nullability_inferred_on_nested_type : Warning<
11739  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
11740  "deprecated">,
11741  InGroup<NullabilityInferredOnNestedType>;
11742
11743def err_objc_type_arg_explicit_nullability : Error<
11744  "type argument %0 cannot explicitly specify nullability">;
11745
11746def err_objc_type_param_bound_explicit_nullability : Error<
11747  "type parameter %0 bound %1 cannot explicitly specify nullability">;
11748
11749}
11750
11751let CategoryName = "Generics Issue" in {
11752
11753def err_objc_type_param_bound_nonobject : Error<
11754  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
11755
11756def err_objc_type_param_bound_missing_pointer : Error<
11757  "missing '*' in type bound %0 for type parameter %1">;
11758def err_objc_type_param_bound_qualified : Error<
11759  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
11760
11761def err_objc_type_param_redecl : Error<
11762  "redeclaration of type parameter %0">;
11763
11764def err_objc_type_param_arity_mismatch : Error<
11765  "%select{forward class declaration|class definition|category|extension}0 has "
11766  "too %select{few|many}1 type parameters (expected %2, have %3)">;
11767
11768def err_objc_type_param_bound_conflict : Error<
11769  "type bound %0 for type parameter %1 conflicts with "
11770  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
11771
11772def err_objc_type_param_variance_conflict : Error<
11773  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
11774  "%select{in|co|contra}2variant type parameter %3">;
11775
11776def note_objc_type_param_here : Note<"type parameter %0 declared here">;
11777
11778def err_objc_type_param_bound_missing : Error<
11779  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
11780
11781def err_objc_parameterized_category_nonclass : Error<
11782  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
11783  "parameters">;
11784
11785def err_objc_parameterized_forward_class : Error<
11786  "forward declaration of non-parameterized class %0 cannot have type "
11787  "parameters">;
11788
11789def err_objc_parameterized_forward_class_first : Error<
11790  "class %0 previously declared with type parameters">;
11791
11792def err_objc_type_arg_missing_star : Error<
11793  "type argument %0 must be a pointer (requires a '*')">;
11794def err_objc_type_arg_qualified : Error<
11795  "type argument %0 cannot be qualified with '%1'">;
11796
11797def err_objc_type_arg_missing : Error<
11798  "no type or protocol named %0">;
11799
11800def err_objc_type_args_and_protocols : Error<
11801  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
11802  "%select{protocol|type}0 (%2)">;
11803
11804def err_objc_type_args_non_class : Error<
11805  "type arguments cannot be applied to non-class type %0">;
11806
11807def err_objc_type_args_non_parameterized_class : Error<
11808  "type arguments cannot be applied to non-parameterized class %0">;
11809
11810def err_objc_type_args_specialized_class : Error<
11811  "type arguments cannot be applied to already-specialized class type %0">;
11812
11813def err_objc_type_args_wrong_arity : Error<
11814  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
11815}
11816
11817def err_type_available_only_in_default_eval_method : Error<
11818  "cannot use type '%0' within '#pragma clang fp eval_method'; type is set "
11819  "according to the default eval method for the translation unit">;
11820
11821def err_objc_type_arg_not_id_compatible : Error<
11822  "type argument %0 is neither an Objective-C object nor a block type">;
11823
11824def err_objc_type_arg_does_not_match_bound : Error<
11825  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
11826
11827def warn_objc_redundant_qualified_class_type : Warning<
11828  "parameterized class %0 already conforms to the protocols listed; did you "
11829  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
11830
11831def warn_block_literal_attributes_on_omitted_return_type : Warning<
11832  "attribute %0 ignored, because it cannot be applied to omitted return type">,
11833  InGroup<IgnoredAttributes>;
11834
11835def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
11836  "'%0' qualifier on omitted return type %1 has no effect">,
11837  InGroup<IgnoredQualifiers>;
11838
11839def warn_shadow_field : Warning<
11840  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
11841  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
11842def note_shadow_field : Note<"declared here">;
11843
11844def err_multiversion_required_in_redecl : Error<
11845  "function declaration is missing %select{'target'|'cpu_specific' or "
11846  "'cpu_dispatch'|'target_version'}0 attribute in a multiversioned function">;
11847def note_multiversioning_caused_here : Note<
11848  "function multiversioning caused by this declaration">;
11849def err_multiversion_after_used : Error<
11850  "function declaration cannot become a multiversioned function after first "
11851  "usage">;
11852def err_bad_multiversion_option : Error<
11853  "function multiversioning doesn't support %select{feature|architecture}0 "
11854  "'%1'">;
11855def err_multiversion_duplicate : Error<
11856  "multiversioned function redeclarations require identical target attributes">;
11857def err_multiversion_noproto : Error<
11858  "multiversioned function must have a prototype">;
11859def err_multiversion_disallowed_other_attr
11860    : Error<"attribute "
11861            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
11862            "multiversioning cannot be combined"
11863            " with attribute %1">;
11864def err_multiversion_diff : Error<
11865  "multiversioned function declaration has a different %select{calling convention"
11866  "|return type|constexpr specification|inline specification|linkage|"
11867  "language linkage}0">;
11868def err_multiversion_doesnt_support
11869    : Error<"attribute "
11870            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
11871            "multiversioned functions do not "
11872            "yet support %select{function templates|virtual functions|"
11873            "deduced return types|constructors|destructors|deleted functions|"
11874            "defaulted functions|constexpr functions|consteval "
11875            "function|lambdas}1">;
11876def err_multiversion_not_allowed_on_main : Error<
11877  "'main' cannot be a multiversioned function">;
11878def err_multiversion_not_supported : Error<
11879 "function multiversioning is not supported on the current target">;
11880def err_multiversion_types_mixed : Error<
11881  "multiversioning attributes cannot be combined">;
11882def err_cpu_dispatch_mismatch : Error<
11883 "'cpu_dispatch' function redeclared with different CPUs">;
11884def err_cpu_specific_multiple_defs : Error<
11885 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
11886def warn_multiversion_duplicate_entries : Warning<
11887 "CPU list contains duplicate entries; attribute ignored">,
11888  InGroup<FunctionMultiVersioning>;
11889def warn_dispatch_body_ignored : Warning<
11890  "body of cpu_dispatch function will be ignored">,
11891  InGroup<FunctionMultiVersioning>;
11892def err_target_clone_must_have_default
11893    : Error<"'target_clones' multiversioning requires a default target">;
11894def err_target_clone_doesnt_match
11895    : Error<"'target_clones' attribute does not match previous declaration">;
11896def warn_target_clone_mixed_values
11897    : ExtWarn<
11898          "mixing 'target_clones' specifier mechanisms is permitted for GCC "
11899          "compatibility; use a comma separated sequence of string literals, "
11900          "or a string literal containing a comma-separated list of versions">,
11901      InGroup<TargetClonesMixedSpecifiers>;
11902def warn_target_clone_duplicate_options
11903    : Warning<"version list contains duplicate entries">,
11904      InGroup<FunctionMultiVersioning>;
11905def warn_target_clone_no_impact_options
11906    : Warning<"version list contains entries that don't impact code generation">,
11907      InGroup<FunctionMultiVersioning>;
11908
11909// three-way comparison operator diagnostics
11910def err_implied_comparison_category_type_not_found : Error<
11911  "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
11912  "because type '%0' was not found; include <compare>">;
11913def err_spaceship_argument_narrowing : Error<
11914  "argument to 'operator<=>' "
11915  "%select{cannot be narrowed from type %1 to %2|"
11916  "evaluates to %1, which cannot be narrowed to type %2}0">;
11917def err_std_compare_type_not_supported : Error<
11918  "standard library implementation of %0 is not supported; "
11919   "%select{member '%2' does not have expected form|"
11920   "member '%2' is missing|"
11921   "the type is not trivially copyable|"
11922   "the type does not have the expected form}1">;
11923def note_rewriting_operator_as_spaceship : Note<
11924  "while rewriting comparison as call to 'operator<=>' declared here">;
11925def err_three_way_vector_comparison : Error<
11926  "three-way comparison between vectors is not supported">;
11927
11928// Memory Tagging Extensions (MTE) diagnostics
11929def err_memtag_arg_null_or_pointer : Error<
11930  "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
11931def err_memtag_any2arg_pointer : Error<
11932  "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
11933def err_memtag_arg_must_be_pointer : Error<
11934  "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
11935def err_memtag_arg_must_be_integer : Error<
11936  "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
11937
11938def warn_dereference_of_noderef_type : Warning<
11939  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
11940def warn_dereference_of_noderef_type_no_decl : Warning<
11941  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
11942def warn_noderef_on_non_pointer_or_array : Warning<
11943  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
11944def warn_noderef_to_dereferenceable_pointer : Warning<
11945  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
11946
11947def err_builtin_launder_invalid_arg : Error<
11948  "%select{non-pointer|function pointer|void pointer}0 argument to "
11949  "'__builtin_launder' is not allowed">;
11950
11951def err_builtin_invalid_arg_type: Error <
11952  "%ordinal0 argument must be a "
11953  "%select{vector, integer or floating point type|matrix|"
11954  "pointer to a valid matrix element type|"
11955  "signed integer or floating point type|vector type|"
11956  "floating point type|"
11957  "vector of integers}1 (was %2)">;
11958
11959def err_builtin_matrix_disabled: Error<
11960  "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
11961def err_matrix_index_not_integer: Error<
11962  "matrix %select{row|column}0 index is not an integer">;
11963def err_matrix_index_outside_range: Error<
11964  "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
11965def err_matrix_incomplete_index: Error<
11966  "single subscript expressions are not allowed for matrix values">;
11967def err_matrix_separate_incomplete_index: Error<
11968  "matrix row and column subscripts cannot be separated by any expression">;
11969def err_matrix_subscript_comma: Error<
11970  "comma expressions are not allowed as indices in matrix subscript expressions">;
11971def err_builtin_matrix_scalar_unsigned_arg: Error<
11972  "%0 argument must be a constant unsigned integer expression">;
11973def err_builtin_matrix_pointer_arg_mismatch: Error<
11974  "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
11975def err_builtin_matrix_store_to_const: Error<
11976  "cannot store matrix to read-only pointer">;
11977def err_builtin_matrix_stride_too_small: Error<
11978  "stride must be greater or equal to the number of rows">;
11979def err_builtin_matrix_invalid_dimension: Error<
11980  "%0 dimension is outside the allowed range [1, %1]">;
11981
11982def warn_mismatched_import : Warning<
11983  "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
11984  "previous declaration">,
11985  InGroup<IgnoredAttributes>;
11986def warn_import_on_definition : Warning<
11987  "import %select{module|name}0 cannot be applied to a function with a definition">,
11988  InGroup<IgnoredAttributes>;
11989
11990def err_preserve_field_info_not_field : Error<
11991  "__builtin_preserve_field_info argument %0 not a field access">;
11992def err_preserve_field_info_not_const: Error<
11993  "__builtin_preserve_field_info argument %0 not a constant">;
11994def err_btf_type_id_not_const: Error<
11995  "__builtin_btf_type_id argument %0 not a constant">;
11996def err_preserve_type_info_invalid : Error<
11997  "__builtin_preserve_type_info argument %0 invalid">;
11998def err_preserve_type_info_not_const: Error<
11999  "__builtin_preserve_type_info argument %0 not a constant">;
12000def err_preserve_enum_value_invalid : Error<
12001  "__builtin_preserve_enum_value argument %0 invalid">;
12002def err_preserve_enum_value_not_const: Error<
12003  "__builtin_preserve_enum_value argument %0 not a constant">;
12004
12005def err_bit_cast_non_trivially_copyable : Error<
12006  "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
12007def err_bit_cast_type_size_mismatch : Error<
12008  "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
12009
12010// SYCL-specific diagnostics
12011def warn_sycl_kernel_num_of_template_params : Warning<
12012  "'sycl_kernel' attribute only applies to a function template with at least"
12013  " two template parameters">, InGroup<IgnoredAttributes>;
12014def warn_sycl_kernel_invalid_template_param_type : Warning<
12015  "template parameter of a function template with the 'sycl_kernel' attribute"
12016  " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
12017def warn_sycl_kernel_num_of_function_params : Warning<
12018  "function template with 'sycl_kernel' attribute must have a single parameter">,
12019  InGroup<IgnoredAttributes>;
12020def warn_sycl_kernel_return_type : Warning<
12021  "function template with 'sycl_kernel' attribute must have a 'void' return type">,
12022  InGroup<IgnoredAttributes>;
12023def err_sycl_special_type_num_init_method : Error<
12024  "types with 'sycl_special_class' attribute must have one and only one '__init' "
12025  "method defined">;
12026
12027def warn_cuda_maxclusterrank_sm_90 : Warning<
12028  "maxclusterrank requires sm_90 or higher, CUDA arch provided: %0, ignoring "
12029  "%1 attribute">, InGroup<IgnoredAttributes>;
12030
12031def err_bit_int_bad_size : Error<"%select{signed|unsigned}0 _BitInt must "
12032                                 "have a bit size of at least %select{2|1}0">;
12033def err_bit_int_max_size : Error<"%select{signed|unsigned}0 _BitInt of bit "
12034                                 "sizes greater than %1 not supported">;
12035
12036// errors of expect.with.probability
12037def err_probability_not_constant_float : Error<
12038   "probability argument to __builtin_expect_with_probability must be constant "
12039   "floating-point expression">;
12040def err_probability_out_of_range : Error<
12041   "probability argument to __builtin_expect_with_probability is outside the "
12042   "range [0.0, 1.0]">;
12043
12044// TCB warnings
12045def err_tcb_conflicting_attributes : Error<
12046  "attributes '%0(\"%2\")' and '%1(\"%2\")' are mutually exclusive">;
12047def warn_tcb_enforcement_violation : Warning<
12048  "calling %0 is a violation of trusted computing base '%1'">,
12049  InGroup<DiagGroup<"tcb-enforcement">>;
12050
12051// RISC-V builtin required extension warning
12052def err_riscv_builtin_requires_extension : Error<
12053  "builtin requires%select{| at least one of the following extensions}0: %1">;
12054def err_riscv_builtin_invalid_lmul : Error<
12055  "LMUL argument must be in the range [0,3] or [5,7]">;
12056def err_riscv_type_requires_extension : Error<
12057  "RISC-V type %0 requires the '%1' extension"
12058>;
12059
12060def err_std_source_location_impl_not_found : Error<
12061  "'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called">;
12062def err_std_source_location_impl_malformed : Error<
12063  "'std::source_location::__impl' must be standard-layout and have only two 'const char *' fields '_M_file_name' and '_M_function_name', and two integral fields '_M_line' and '_M_column'">;
12064
12065// HLSL Diagnostics
12066def err_hlsl_attr_unsupported_in_stage : Error<"attribute %0 is unsupported in '%1' shaders, requires %select{|one of the following: }2%3">;
12067def err_hlsl_attr_invalid_type : Error<
12068   "attribute %0 only applies to a field or parameter of type '%1'">;
12069def err_hlsl_attr_invalid_ast_node : Error<
12070   "attribute %0 only applies to %1">;
12071def err_hlsl_entry_shader_attr_mismatch : Error<
12072   "%0 attribute on entry function does not match the target profile">;
12073def err_hlsl_numthreads_argument_oor : Error<"argument '%select{X|Y|Z}0' to numthreads attribute cannot exceed %1">;
12074def err_hlsl_numthreads_invalid : Error<"total number of threads cannot exceed %0">;
12075def err_hlsl_missing_numthreads : Error<"missing numthreads attribute for %0 shader entry">;
12076def err_hlsl_attribute_param_mismatch : Error<"%0 attribute parameters do not match the previous declaration">;
12077def err_hlsl_duplicate_parameter_modifier : Error<"duplicate parameter modifier %0">;
12078def err_hlsl_missing_semantic_annotation : Error<
12079  "semantic annotations must be present for all parameters of an entry "
12080  "function or patch constant function">;
12081def err_hlsl_init_priority_unsupported : Error<
12082  "initializer priorities are not supported in HLSL">;
12083
12084def err_hlsl_unsupported_register_type : Error<"invalid resource class specifier '%0' used; expected 'b', 's', 't', or 'u'">;
12085def err_hlsl_unsupported_register_number : Error<"register number should be an integer">;
12086def err_hlsl_expected_space : Error<"invalid space specifier '%0' used; expected 'space' followed by an integer, like space1">;
12087def err_hlsl_pointers_unsupported : Error<
12088  "%select{pointers|references}0 are unsupported in HLSL">;
12089
12090def err_hlsl_operator_unsupported : Error<
12091  "the '%select{&|*|->}0' operator is unsupported in HLSL">;
12092
12093def err_hlsl_param_qualifier_mismatch :
12094  Error<"conflicting parameter qualifier %0 on parameter %1">;
12095
12096// Layout randomization diagnostics.
12097def err_non_designated_init_used : Error<
12098  "a randomized struct can only be initialized with a designated initializer">;
12099def err_cast_from_randomized_struct : Error<
12100  "casting from randomized structure pointer type %0 to %1">;
12101
12102// Unsafe buffer usage diagnostics.
12103def warn_unsafe_buffer_variable : Warning<
12104  "%0 is an %select{unsafe pointer used for buffer access|unsafe buffer that "
12105  "does not perform bounds checks}1">,
12106  InGroup<UnsafeBufferUsage>, DefaultIgnore;
12107def warn_unsafe_buffer_operation : Warning<
12108  "%select{unsafe pointer operation|unsafe pointer arithmetic|"
12109  "unsafe buffer access|function introduces unsafe buffer manipulation|unsafe invocation of span::data}0">,
12110  InGroup<UnsafeBufferUsage>, DefaultIgnore;
12111def note_unsafe_buffer_operation : Note<
12112  "used%select{| in pointer arithmetic| in buffer access}0 here">;
12113def note_unsafe_buffer_variable_fixit_group : Note<
12114  "change type of %0 to '%select{std::span|std::array|std::span::iterator}1' to preserve bounds information%select{|, and change %2 to '%select{std::span|std::array|std::span::iterator}1' to propagate bounds information between them}3">;
12115def note_unsafe_buffer_variable_fixit_together : Note<
12116  "change type of %0 to '%select{std::span|std::array|std::span::iterator}1' to preserve bounds information"
12117  "%select{|, and change %2 to safe types to make function %4 bounds-safe}3">;
12118def note_safe_buffer_usage_suggestions_disabled : Note<
12119  "pass -fsafe-buffer-usage-suggestions to receive code hardening suggestions">;
12120#ifndef NDEBUG
12121// Not a user-facing diagnostic. Useful for debugging false negatives in
12122// -fsafe-buffer-usage-suggestions (i.e. lack of -Wunsafe-buffer-usage fixits).
12123def note_safe_buffer_debug_mode : Note<"safe buffers debug: %0">;
12124#endif
12125
12126def err_builtin_pass_in_regs_non_class : Error<
12127  "argument %0 is not an unqualified class type">;
12128
12129
12130// WebAssembly reference type and table diagnostics.
12131def err_wasm_reference_pr : Error<
12132  "%select{pointer|reference}0 to WebAssembly reference type is not allowed">;
12133def err_wasm_ca_reference : Error<
12134  "cannot %select{capture|take address of}0 WebAssembly reference">;
12135def err_wasm_funcref_not_wasm : Error<
12136  "invalid use of '__funcref' keyword outside the WebAssembly triple">;
12137def err_wasm_table_pr : Error<
12138  "cannot form a %select{pointer|reference}0 to a WebAssembly table">;
12139def err_typecheck_wasm_table_must_have_zero_length : Error<
12140  "only zero-length WebAssembly tables are currently supported">;
12141def err_wasm_table_in_function : Error<
12142  "WebAssembly table cannot be declared within a function">;
12143def err_wasm_table_as_function_parameter : Error<
12144  "cannot use WebAssembly table as a function parameter">;
12145def err_wasm_table_invalid_uett_operand : Error<
12146  "invalid application of '%0' to WebAssembly table">;
12147def err_wasm_cast_table : Error<
12148  "cannot cast %select{to|from}0 a WebAssembly table">;
12149def err_wasm_table_conditional_expression : Error<
12150  "cannot use a WebAssembly table within a branch of a conditional expression">;
12151def err_wasm_table_art : Error<
12152  "cannot %select{assign|return|throw|subscript}0 a WebAssembly table">;
12153def err_wasm_reftype_tc : Error<
12154  "cannot %select{throw|catch}0 a WebAssembly reference type">;
12155def err_wasm_reftype_exception_spec : Error<
12156  "WebAssembly reference type not allowed in exception specification">;
12157def err_wasm_table_must_be_static : Error<
12158  "WebAssembly table must be static">;
12159def err_wasm_reftype_multidimensional_array : Error<
12160  "multi-dimensional arrays of WebAssembly references are not allowed">;
12161def err_wasm_builtin_arg_must_be_table_type : Error <
12162  "%ordinal0 argument must be a WebAssembly table">;
12163def err_wasm_builtin_arg_must_match_table_element_type : Error <
12164  "%ordinal0 argument must match the element type of the WebAssembly table in the %ordinal1 argument">;
12165def err_wasm_builtin_arg_must_be_integer_type : Error <
12166  "%ordinal0 argument must be an integer">;
12167} // end of sema component.
12168