xref: /llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td (revision abc8812df02599fc413d9ed77b992f8236ed2af9)
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|non-type parameter of template template parameter|"
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|non-type parameter of template template parameter|"
90  "array size|explicit specifier argument|noexcept specifier argument|"
91  "call to 'size()'|call to 'data()'}0 %select{cannot be narrowed from "
92  "type %2 to %3|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 %select{for the current target|in '%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 warn_c23_compat_imaginary_constant : Warning<
254  "imaginary constants are incompatible with C standards before C2y">,
255  DefaultIgnore, InGroup<CPre2yCompat>;
256def ext_c2y_imaginary_constant : Extension<
257  "imaginary constants are a C2y extension">, InGroup<C2y>;
258def ext_gnu_imaginary_constant : Extension<
259  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
260def ext_integer_complex : Extension<
261  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
262def ext_c23_auto_non_plain_identifier : Extension<
263  "type inference of a declaration other than a plain identifier with optional "
264  "trailing attributes is a Clang extension">,
265  InGroup<DiagGroup<"auto-decl-extensions">>;
266
267def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
268  "'_Fract' or '_Accum', not '%0'">;
269def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
270def err_invalid_width_spec : Error<
271  "'%select{|short|long|long long}0 %1' is invalid">;
272def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
273
274def ext_auto_type_specifier : ExtWarn<
275  "'auto' type specifier is a %select{C++11|HLSL 202y}0 extension">,
276  InGroup<CXX11>;
277def ext_hlsl_auto_type_specifier : ExtWarn<
278  ext_auto_type_specifier.Summary>, InGroup<HLSL202y>;
279def warn_auto_storage_class : Warning<
280  "'auto' storage class specifier is redundant and incompatible with C++11">,
281  InGroup<CXX11Compat>, DefaultIgnore;
282
283def warn_deprecated_register : Warning<
284  "'register' storage class specifier is deprecated "
285  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
286def ext_register_storage_class : ExtWarn<
287  "ISO C++17 does not allow 'register' storage class specifier">,
288  DefaultError, InGroup<Register>;
289
290def err_invalid_decl_spec_combination : Error<
291  "cannot combine with previous '%0' declaration specifier">;
292def err_invalid_vector_decl_spec_combination : Error<
293  "cannot combine with previous '%0' declaration specifier. "
294  "'__vector' must be first">;
295def err_invalid_pixel_decl_spec_combination : Error<
296  "'__pixel' must be preceded by '__vector'.  "
297  "'%0' declaration specifier not allowed here">;
298def err_invalid_vector_bool_decl_spec : Error<
299  "cannot use '%0' with '__vector bool'">;
300def err_invalid_vector_long_decl_spec : Error<
301  "cannot use 'long' with '__vector'">;
302def err_invalid_vector_float_decl_spec : Error<
303  "cannot use 'float' with '__vector'">;
304def err_invalid_vector_double_decl_spec : Error <
305  "use of 'double' with '__vector' requires VSX support to be enabled "
306  "(available on POWER7 or later)">;
307def err_invalid_vector_bool_int128_decl_spec : Error <
308  "use of '__int128' with '__vector bool' requires VSX support enabled (on "
309  "POWER10 or later)">;
310def err_invalid_vector_int128_decl_spec : Error<
311  "use of '__int128' with '__vector' requires extended Altivec support"
312  " (available on POWER8 or later)">;
313def err_invalid_vector_long_long_decl_spec : Error <
314  "use of 'long long' with '__vector' requires VSX support (available on "
315  "POWER7 or later) to be enabled">;
316def err_invalid_vector_long_double_decl_spec : Error<
317  "cannot use 'long double' with '__vector'">;
318def err_invalid_vector_complex_decl_spec : Error<
319  "cannot use '_Complex' with '__vector'">;
320def warn_vector_long_decl_spec_combination : Warning<
321  "use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
322
323def err_redeclaration_different_type : Error<
324  "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
325def err_bad_variable_name : Error<
326  "%0 cannot be the name of a variable or data member">;
327def err_bad_parameter_name : Error<
328  "%0 cannot be the name of a parameter">;
329def err_bad_parameter_name_template_id : Error<
330  "parameter name cannot have template arguments">;
331def ext_parameter_name_omitted_c23 : ExtWarn<
332  "omitting the parameter name in a function definition is a C23 extension">,
333  InGroup<C23>;
334def err_anyx86_interrupt_attribute : Error<
335  "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
336  "have %select{a 'void' return type|"
337  "only a pointer parameter optionally followed by an integer parameter|"
338  "a pointer as the first parameter|a %2 type as the second parameter}1">;
339def err_anyx86_interrupt_called : Error<
340  "interrupt service routine cannot be called directly">;
341def warn_anyx86_excessive_regsave : Warning<
342  "%select{interrupt service routine|function with attribute"
343  " 'no_caller_saved_registers'}0 should only call a function"
344  " with attribute 'no_caller_saved_registers'"
345  " or be compiled with '-mgeneral-regs-only'">,
346  InGroup<DiagGroup<"excessive-regsave">>;
347def warn_arm_interrupt_vfp_clobber : Warning<
348  "interrupt service routine with vfp enabled may clobber the "
349  "interruptee's vfp state">,
350  InGroup<DiagGroup<"arm-interrupt-vfp-clobber">>;
351def err_arm_interrupt_called : Error<
352  "interrupt service routine cannot be called directly">;
353def warn_interrupt_attribute_invalid : Warning<
354   "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
355   "functions that have %select{no parameters|a 'void' return type}1">,
356   InGroup<IgnoredAttributes>;
357def warn_riscv_repeated_interrupt_attribute : Warning<
358  "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
359def note_riscv_repeated_interrupt_attribute : Note<
360  "repeated RISC-V 'interrupt' attribute is here">;
361def warn_unused_parameter : Warning<"unused parameter %0">,
362  InGroup<UnusedParameter>, DefaultIgnore;
363def warn_unused_but_set_parameter : Warning<"parameter %0 set but not used">,
364  InGroup<UnusedButSetParameter>, DefaultIgnore;
365def warn_unused_variable : Warning<"unused variable %0">,
366  InGroup<UnusedVariable>, DefaultIgnore;
367def warn_unused_but_set_variable : Warning<"variable %0 set but not used">,
368  InGroup<UnusedButSetVariable>, DefaultIgnore;
369def warn_unused_local_typedef : Warning<
370  "unused %select{typedef|type alias}0 %1">,
371  InGroup<UnusedLocalTypedef>, DefaultIgnore;
372def warn_unused_property_backing_ivar :
373  Warning<"ivar %0 which backs the property is not "
374  "referenced in this property's accessor">,
375  InGroup<UnusedPropertyIvar>, DefaultIgnore;
376def warn_unused_const_variable : Warning<"unused variable %0">,
377  InGroup<UnusedConstVariable>, DefaultIgnore;
378def warn_unused_exception_param : Warning<"unused exception parameter %0">,
379  InGroup<UnusedExceptionParameter>, DefaultIgnore;
380def warn_decl_in_param_list : Warning<
381  "declaration of %0 will not be visible outside of this function">,
382  InGroup<Visibility>;
383def warn_redefinition_in_param_list : Warning<
384  "redefinition of %0 will not be visible outside of this function">,
385  InGroup<Visibility>;
386def warn_empty_parens_are_function_decl : Warning<
387  "empty parentheses interpreted as a function declaration">,
388  InGroup<VexingParse>;
389def warn_parens_disambiguated_as_function_declaration : Warning<
390  "parentheses were disambiguated as a function declaration">,
391  InGroup<VexingParse>;
392def warn_parens_disambiguated_as_variable_declaration : Warning<
393  "parentheses were disambiguated as redundant parentheses around declaration "
394  "of variable named %0">, InGroup<VexingParse>;
395def warn_redundant_parens_around_declarator : Warning<
396  "redundant parentheses surrounding declarator">,
397  InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
398def note_additional_parens_for_variable_declaration : Note<
399  "add a pair of parentheses to declare a variable">;
400def note_raii_guard_add_name : Note<
401  "add a variable name to declare a %0 initialized with %1">;
402def note_function_style_cast_add_parentheses : Note<
403  "add enclosing parentheses to perform a function-style cast">;
404def note_remove_parens_for_variable_declaration : Note<
405  "remove parentheses to silence this warning">;
406def note_empty_parens_function_call : Note<
407  "change this ',' to a ';' to call %0">;
408def note_empty_parens_default_ctor : Note<
409  "remove parentheses to declare a variable">;
410def note_empty_parens_zero_initialize : Note<
411  "replace parentheses with an initializer to declare a variable">;
412def warn_unused_function : Warning<"unused function %0">,
413  InGroup<UnusedFunction>, DefaultIgnore;
414def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
415  InGroup<UnusedTemplate>, DefaultIgnore;
416def warn_unused_member_function : Warning<"unused member function %0">,
417  InGroup<UnusedMemberFunction>, DefaultIgnore;
418def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
419  InGroup<UsedButMarkedUnused>, DefaultIgnore;
420def warn_unneeded_internal_decl : Warning<
421  "%select{function|variable}0 %1 is not needed and will not be emitted">,
422  InGroup<UnneededInternalDecl>, DefaultIgnore;
423def warn_unneeded_static_internal_decl : Warning<
424  "'static' function %0 declared in header file "
425  "should be declared 'static inline'">,
426  InGroup<UnneededInternalDecl>, DefaultIgnore;
427def warn_unneeded_member_function : Warning<
428  "member function %0 is not needed and will not be emitted">,
429  InGroup<UnneededMemberFunction>, DefaultIgnore;
430def warn_unused_private_field: Warning<"private field %0 is not used">,
431  InGroup<UnusedPrivateField>, DefaultIgnore;
432def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
433  "%select{used|required to be captured for this use}1">,
434  InGroup<UnusedLambdaCapture>, DefaultIgnore;
435
436def warn_reserved_extern_symbol: Warning<
437  "identifier %0 is reserved because %select{"
438  "<ERROR>|" // ReservedIdentifierStatus::NotReserved
439  "it starts with '_' at global scope|"
440  "it starts with '_' and has C language linkage|"
441  "it starts with '__'|"
442  "it starts with '_' followed by a capital letter|"
443  "it contains '__'}1">,
444  InGroup<ReservedIdentifier>, DefaultIgnore;
445def warn_deprecated_literal_operator_id: Warning<
446  "identifier %0 preceded by whitespace in a literal operator declaration "
447  "is deprecated">, InGroup<DeprecatedLiteralOperator>;
448def warn_reserved_module_name : Warning<
449  "%0 is a reserved name for a module">, InGroup<ReservedModuleIdentifier>;
450def warn_import_implementation_partition_unit_in_interface_unit : Warning<
451  "importing an implementation partition unit in a module interface is not recommended. "
452  "Names from %0 may not be reachable">,
453  InGroup<DiagGroup<"import-implementation-partition-unit-in-interface-unit">>;
454
455def warn_parameter_size: Warning<
456  "%0 is a large (%1 bytes) pass-by-value argument; "
457  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
458def warn_return_value_size: Warning<
459  "return value of %0 is a large (%1 bytes) pass-by-value object; "
460  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
461def warn_return_value_udt: Warning<
462  "%0 has C-linkage specified, but returns user-defined type %1 which is "
463  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
464def warn_return_value_udt_incomplete: Warning<
465  "%0 has C-linkage specified, but returns incomplete type %1 which could be "
466  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
467def warn_implicit_function_decl : Warning<
468  "implicit declaration of function %0">,
469  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
470def ext_implicit_function_decl_c99 : ExtWarn<
471  "call to undeclared function %0; ISO C99 and later do not support implicit "
472  "function declarations">, InGroup<ImplicitFunctionDeclare>, DefaultError;
473def note_function_suggestion : Note<"did you mean %0?">;
474
475def err_ellipsis_first_param : Error<
476  "ISO C requires a named parameter before '...'">;
477def err_declarator_need_ident : Error<"declarator requires an identifier">;
478def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
479def ext_use_out_of_scope_declaration : ExtWarn<
480  "use of out-of-scope declaration of %0%select{| whose type is not "
481  "compatible with that of an implicit declaration}1">,
482  InGroup<DiagGroup<"out-of-scope-function">>;
483def err_inline_non_function : Error<
484  "'inline' can only appear on functions%select{| and non-local variables}0">;
485def err_noreturn_non_function : Error<
486  "'_Noreturn' can only appear on functions">;
487def warn_qual_return_type : Warning<
488  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
489  InGroup<IgnoredQualifiers>, DefaultIgnore;
490def warn_qual_base_type : Warning<
491  "'%0' qualifier%s1 on base class type %2 have no effect">,
492  InGroup<IgnoredQualifiers>, DefaultIgnore;
493
494def warn_deprecated_redundant_constexpr_static_def : Warning<
495  "out-of-line definition of constexpr static data member is redundant "
496  "in C++17 and is deprecated">,
497  InGroup<DeprecatedRedundantConstexprStaticDef>, DefaultIgnore;
498
499def warn_decl_shadow :
500  Warning<"declaration shadows a %select{"
501          "local variable|"
502          "variable in %2|"
503          "static data member of %2|"
504          "field of %2|"
505          "typedef in %2|"
506          "type alias in %2|"
507          "structured binding}1">,
508  InGroup<Shadow>, DefaultIgnore, SuppressInSystemMacro;
509def warn_decl_shadow_uncaptured_local :
510  Warning<warn_decl_shadow.Summary>,
511  InGroup<ShadowUncapturedLocal>, DefaultIgnore;
512def warn_ctor_parm_shadows_field:
513  Warning<"constructor parameter %0 shadows the field %1 of %2">,
514  InGroup<ShadowFieldInConstructor>, DefaultIgnore;
515def warn_modifying_shadowing_decl :
516  Warning<"modifying constructor parameter %0 that shadows a "
517          "field of %1">,
518  InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
519
520// C++ decomposition declarations
521def err_decomp_decl_context : Error<
522  "decomposition declaration not permitted in this context">;
523def warn_cxx14_compat_decomp_decl : Warning<
524  "decomposition declarations are incompatible with "
525  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
526def ext_decomp_decl : ExtWarn<
527  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
528def ext_decomp_decl_cond : ExtWarn<
529  "ISO C++17 does not permit structured binding declaration in a condition">,
530  InGroup<DiagGroup<"binding-in-condition">>;
531def err_decomp_decl_spec : Error<
532  "decomposition declaration cannot be declared "
533  "%plural{1:'%1'|:with '%1' specifiers}0">;
534def ext_decomp_decl_spec : ExtWarn<
535  "decomposition declaration declared "
536  "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
537  InGroup<CXX20>;
538def warn_cxx17_compat_decomp_decl_spec : Warning<
539  "decomposition declaration declared "
540  "%plural{1:'%1'|:with '%1' specifiers}0 "
541  "is incompatible with C++ standards before C++20">,
542  InGroup<CXXPre20Compat>, DefaultIgnore;
543def err_decomp_decl_type : Error<
544  "decomposition declaration cannot be declared with type %0; "
545  "declared type must be 'auto' or reference to 'auto'">;
546def err_decomp_decl_constraint : Error<
547  "decomposition declaration cannot be declared with constrained 'auto'">;
548def err_decomp_decl_parens : Error<
549  "decomposition declaration cannot be declared with parentheses">;
550def err_decomp_decl_template : Error<
551  "decomposition declaration template not supported">;
552def err_decomp_decl_not_alone : Error<
553  "decomposition declaration must be the only declaration in its group">;
554def err_decomp_decl_requires_init : Error<
555  "decomposition declaration %0 requires an initializer">;
556def err_decomp_decl_wrong_number_bindings : Error<
557  "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
558  "%select{%plural{0:no|:only %1}1|%1}4 "
559  "%plural{1:name was|:names were}1 provided">;
560def err_decomp_decl_unbindable_type : Error<
561  "cannot decompose %select{union|non-class, non-array}1 type %2">;
562def err_decomp_decl_multiple_bases_with_members : Error<
563  "cannot decompose class type %1: "
564  "%select{its base classes %2 and|both it and its base class}0 %3 "
565  "have non-static data members">;
566def err_decomp_decl_ambiguous_base : Error<
567  "cannot decompose members of ambiguous base class %1 of %0:%2">;
568def err_decomp_decl_inaccessible_base : Error<
569  "cannot decompose members of inaccessible base class %1 of %0">,
570  AccessControl;
571def err_decomp_decl_inaccessible_field : Error<
572  "cannot decompose %select{private|protected}0 member %1 of %3">,
573  AccessControl;
574def err_decomp_decl_lambda : Error<
575  "cannot decompose lambda closure type">;
576def err_decomp_decl_anon_union_member : Error<
577  "cannot decompose class type %0 because it has an anonymous "
578  "%select{struct|union}1 member">;
579def err_decomp_decl_std_tuple_element_not_specialized : Error<
580  "cannot decompose this type; 'std::tuple_element<%0>::type' "
581  "does not name a type">;
582def err_decomp_decl_std_tuple_size_not_constant : Error<
583  "cannot decompose this type; 'std::tuple_size<%0>::value' "
584  "is not a valid integral constant expression">;
585def note_in_binding_decl_init : Note<
586  "in implicit initialization of binding declaration %0">;
587
588def err_std_type_trait_not_class_template : Error<
589  "unsupported standard library implementation: "
590  "'std::%0' is not a class template">;
591
592// C++ using declarations
593def err_using_requires_qualname : Error<
594  "using declaration requires a qualified name">;
595def err_using_typename_non_type : Error<
596  "'typename' keyword used on a non-type">;
597def err_using_dependent_value_is_type : Error<
598  "dependent using declaration resolved to type without 'typename'">;
599def err_using_decl_nested_name_specifier_is_not_class : Error<
600  "using declaration in class refers into '%0', which is not a class">;
601def warn_cxx17_compat_using_decl_non_member_enumerator : Warning<
602  "member using declaration naming non-class '%0' enumerator is "
603  "incompatible with C++ standards before C++20">, InGroup<CXXPre20Compat>,
604  DefaultIgnore;
605def err_using_decl_nested_name_specifier_is_current_class : Error<
606  "using declaration refers to its own class">;
607def err_using_decl_nested_name_specifier_is_not_base_class : Error<
608  "using declaration refers into '%0', which is not a base class of %1">;
609def err_using_decl_constructor_not_in_direct_base : Error<
610  "%0 is not a direct base of %1, cannot inherit constructors">;
611def err_using_decl_can_not_refer_to_class_member : Error<
612  "using declaration cannot refer to class member">;
613def warn_cxx17_compat_using_decl_class_member_enumerator : Warning<
614  "member using declaration naming a non-member enumerator is incompatible "
615  "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
616def err_using_enum_is_dependent : Error<
617  "using-enum cannot name a dependent type">;
618def err_using_enum_not_enum : Error<
619  "%0 is not an enumerated type">;
620def err_ambiguous_inherited_constructor : Error<
621  "constructor of %0 inherited from multiple base class subobjects">;
622def note_ambiguous_inherited_constructor_using : Note<
623  "inherited from base class %0 here">;
624def note_using_decl_class_member_workaround
625    : Note<"use %enum_select<MemClassWorkaround>{%AliasDecl{an alias "
626           "declaration}|%TypedefDecl{a typedef declaration}|%ReferenceDecl{a "
627           "reference}|%ConstVar{a const variable}|%ConstexprVar{a constexpr "
628           "variable}}0 instead">;
629def err_using_decl_can_not_refer_to_namespace : Error<
630  "using declaration cannot refer to a namespace">;
631def note_namespace_using_decl : Note<
632  "did you mean 'using namespace'?">;
633def warn_cxx17_compat_using_decl_scoped_enumerator: Warning<
634  "using declaration naming a scoped enumerator is incompatible with "
635  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
636def ext_using_decl_scoped_enumerator : ExtWarn<
637  "using declaration naming a scoped enumerator is a C++20 extension">,
638  InGroup<CXX20>;
639def err_using_decl_constructor : Error<
640  "using declaration cannot refer to a constructor">;
641def warn_cxx98_compat_using_decl_constructor : Warning<
642  "inheriting constructors are incompatible with C++98">,
643  InGroup<CXX98Compat>, DefaultIgnore;
644def err_using_decl_destructor : Error<
645  "using declaration cannot refer to a destructor">;
646def err_using_decl_template_id : Error<
647  "using declaration cannot refer to a template specialization">;
648def note_using_decl_target : Note<"target of using declaration">;
649def note_using_decl_conflict : Note<"conflicting declaration">;
650def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
651def err_using_decl_conflict : Error<
652  "target of using declaration conflicts with declaration already in scope">;
653def err_using_decl_conflict_reverse : Error<
654  "declaration conflicts with target of using declaration already in scope">;
655def note_using_decl : Note<"%select{|previous }0using declaration">;
656def err_using_decl_redeclaration_expansion : Error<
657  "using declaration pack expansion at block scope produces multiple values">;
658def err_use_of_empty_using_if_exists : Error<
659  "reference to unresolved using declaration">;
660def note_empty_using_if_exists_here : Note<
661  "using declaration annotated with 'using_if_exists' here">;
662def err_using_if_exists_on_ctor : Error<
663  "'using_if_exists' attribute cannot be applied to an inheriting constructor">;
664def err_using_enum_decl_redeclaration : Error<
665  "redeclaration of using-enum declaration">;
666def note_using_enum_decl : Note<"%select{|previous }0using-enum declaration">;
667
668def warn_access_decl_deprecated : Warning<
669  "access declarations are deprecated; use using declarations instead">,
670  InGroup<Deprecated>;
671def err_access_decl : Error<
672  "ISO C++11 does not allow access declarations; "
673  "use using declarations instead">;
674def warn_deprecated_copy : Warning<
675  "definition of implicit copy %select{constructor|assignment operator}1 "
676  "for %0 is deprecated because it has a user-declared copy "
677  "%select{assignment operator|constructor}1">,
678  InGroup<DeprecatedCopy>, DefaultIgnore;
679def warn_deprecated_copy_with_dtor : Warning<
680  "definition of implicit copy %select{constructor|assignment operator}1 "
681  "for %0 is deprecated because it has a user-declared destructor">,
682  InGroup<DeprecatedCopyWithDtor>, DefaultIgnore;
683def warn_deprecated_copy_with_user_provided_copy: Warning<
684  "definition of implicit copy %select{constructor|assignment operator}1 "
685  "for %0 is deprecated because it has a user-provided copy "
686  "%select{assignment operator|constructor}1">,
687  InGroup<DeprecatedCopyWithUserProvidedCopy>, DefaultIgnore;
688def warn_deprecated_copy_with_user_provided_dtor : Warning<
689  "definition of implicit copy %select{constructor|assignment operator}1 "
690  "for %0 is deprecated because it has a user-provided destructor">,
691  InGroup<DeprecatedCopyWithUserProvidedDtor>, DefaultIgnore;
692def warn_cxx17_compat_exception_spec_in_signature : Warning<
693  "mangled name of %0 will change in C++17 due to non-throwing exception "
694  "specification in function signature">, InGroup<CXX17CompatMangling>;
695
696def warn_global_constructor : Warning<
697  "declaration requires a global constructor">,
698  InGroup<GlobalConstructors>, DefaultIgnore;
699def warn_global_destructor : Warning<
700  "declaration requires a global destructor">,
701   InGroup<GlobalConstructors>, DefaultIgnore;
702def warn_exit_time_destructor : Warning<
703  "declaration requires an exit-time destructor">,
704  InGroup<ExitTimeDestructors>, DefaultIgnore;
705
706def err_invalid_thread : Error<
707  "'%0' is only allowed on variable declarations">;
708def err_thread_non_global : Error<
709  "'%0' variables must have global storage">;
710def err_thread_unsupported : Error<
711  "thread-local storage is not supported for the current target">;
712
713// FIXME: Combine fallout warnings to just one warning.
714def warn_maybe_falloff_nonvoid_function : Warning<
715  "non-void function does not return a value in all control paths">,
716  InGroup<ReturnType>;
717def warn_falloff_nonvoid_function : Warning<
718  "non-void function does not return a value">,
719  InGroup<ReturnType>;
720def warn_const_attr_with_pure_attr : Warning<
721  "'const' attribute imposes more restrictions; 'pure' attribute ignored">,
722  InGroup<IgnoredAttributes>;
723def warn_pure_function_returns_void : Warning<
724  "'%select{pure|const}0' attribute on function returning 'void'; attribute ignored">,
725  InGroup<IgnoredAttributes>;
726
727def err_maybe_falloff_nonvoid_block : Error<
728  "non-void block does not return a value in all control paths">;
729def err_falloff_nonvoid_block : Error<
730  "non-void block does not return a value">;
731def warn_maybe_falloff_nonvoid_coroutine : Warning<
732  "non-void coroutine does not return a value in all control paths">,
733  InGroup<ReturnType>;
734def warn_falloff_nonvoid_coroutine : Warning<
735  "non-void coroutine does not return a value">,
736  InGroup<ReturnType>;
737def warn_suggest_noreturn_function : Warning<
738  "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
739  InGroup<MissingNoreturn>, DefaultIgnore;
740def warn_suggest_noreturn_block : Warning<
741  "block could be declared with attribute 'noreturn'">,
742  InGroup<MissingNoreturn>, DefaultIgnore;
743
744// Unreachable code.
745def warn_unreachable : Warning<
746  "code will never be executed">,
747  InGroup<UnreachableCode>, DefaultIgnore;
748def warn_unreachable_break : Warning<
749  "'break' will never be executed">,
750  InGroup<UnreachableCodeBreak>, DefaultIgnore;
751def warn_unreachable_return : Warning<
752  "'return' will never be executed">,
753  InGroup<UnreachableCodeReturn>, DefaultIgnore;
754def warn_unreachable_loop_increment : Warning<
755  "loop will run at most once (loop increment never executed)">,
756  InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
757def warn_unreachable_fallthrough_attr : Warning<
758  "fallthrough annotation in unreachable code">,
759  InGroup<UnreachableCodeFallthrough>, DefaultIgnore;
760def note_unreachable_silence : Note<
761  "silence by adding parentheses to mark code as explicitly dead">;
762def warn_unreachable_association : Warning<
763  "due to lvalue conversion of the controlling expression, association of type "
764  "%0 will never be selected because it is %select{of array type|qualified}1">,
765  InGroup<UnreachableCodeGenericAssoc>;
766
767/// Built-in functions.
768def ext_implicit_lib_function_decl : ExtWarn<
769  "implicitly declaring library function '%0' with type %1">,
770  InGroup<ImplicitFunctionDeclare>;
771def ext_implicit_lib_function_decl_c99 : ExtWarn<
772  "call to undeclared library function '%0' with type %1; ISO C99 and later "
773  "do not support implicit function declarations">,
774  InGroup<ImplicitFunctionDeclare>, DefaultError;
775def note_include_header_or_declare : Note<
776  "include the header <%0> or explicitly provide a declaration for '%1'">;
777def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
778def warn_implicit_decl_no_jmp_buf
779    : Warning<"declaration of built-in function '%0' requires the declaration"
780    " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>">,
781      InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
782def warn_implicit_decl_requires_sysheader : Warning<
783  "declaration of built-in function '%1' requires inclusion of the header <%0>">,
784  InGroup<BuiltinRequiresHeader>;
785def warn_redecl_library_builtin : Warning<
786  "incompatible redeclaration of library function %0">,
787  InGroup<DiagGroup<"incompatible-library-redeclaration">>;
788def err_builtin_definition : Error<"definition of builtin function %0">;
789def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
790def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
791def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
792  "%select{GCP|CDE}1">;
793def warn_invalid_cpu_supports : Warning<"invalid cpu feature string for builtin">;
794def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
795def err_invalid_cpu_specific_dispatch_value : Error<
796"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
797def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
798  InGroup<ImplicitFunctionDeclare>, DefaultError;
799def warn_cstruct_memaccess : Warning<
800  "%select{destination for|source of|first operand of|second operand of}0 this "
801  "%1 call is a pointer to record %2 that is not trivial to "
802  "%select{primitive-default-initialize|primitive-copy}3">,
803  InGroup<NonTrivialMemaccess>;
804def warn_cxxstruct_memaccess : Warning<
805  "first argument in call to "
806  "%0 is a pointer to non-trivially copyable type %1">,
807  InGroup<NonTrivialMemcall>;
808def note_nontrivial_field : Note<
809  "field is non-trivial to %select{copy|default-initialize}0">;
810def err_non_trivial_c_union_in_invalid_context : Error<
811  "cannot %select{"
812  "use type %1 for a function/method parameter|"
813  "use type %1 for function/method return|"
814  "default-initialize an object of type %1|"
815  "declare an automatic variable of type %1|"
816  "copy-initialize an object of type %1|"
817  "assign to a variable of type %1|"
818  "construct an automatic compound literal of type %1|"
819  "capture a variable of type %1|"
820  "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
821  "}3 "
822  "since it %select{contains|is}2 a union that is non-trivial to "
823  "%select{default-initialize|destruct|copy}0">;
824def note_non_trivial_c_union : Note<
825  "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
826  "non-trivial to %select{default-initialize|destruct|copy}1">;
827def warn_dyn_class_memaccess : Warning<
828  "%select{destination for|source of|first operand of|second operand of}0 this "
829  "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
830  "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
831  InGroup<DynamicClassMemaccess>;
832def note_bad_memaccess_silence : Note<
833  "explicitly cast the pointer to silence this warning">;
834def warn_sizeof_pointer_expr_memaccess : Warning<
835  "'%0' call operates on objects of type %1 while the size is based on a "
836  "different type %2">,
837  InGroup<SizeofPointerMemaccess>;
838def warn_sizeof_pointer_expr_memaccess_note : Note<
839  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
840  "it by the number of elements)|remove the addressof in the argument to "
841  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
842  "length}0?">;
843def warn_sizeof_pointer_type_memaccess : Warning<
844  "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
845  "%select{destination|source}2; expected %3 or an explicit length">,
846  InGroup<SizeofPointerMemaccess>;
847def warn_strlcpycat_wrong_size : Warning<
848  "size argument in %0 call appears to be size of the source; "
849  "expected the size of the destination">,
850  InGroup<DiagGroup<"strlcpy-strlcat-size">>;
851def note_strlcpycat_wrong_size : Note<
852  "change size argument to be the size of the destination">;
853def warn_memsize_comparison : Warning<
854  "size argument in %0 call is a comparison">,
855  InGroup<DiagGroup<"memsize-comparison">>;
856def note_memsize_comparison_paren : Note<
857  "did you mean to compare the result of %0 instead?">;
858def note_memsize_comparison_cast_silence : Note<
859  "explicitly cast the argument to size_t to silence this warning">;
860def warn_suspicious_sizeof_memset : Warning<
861  "%select{'size' argument to memset is '0'|"
862  "setting buffer to a 'sizeof' expression}0"
863  "; did you mean to transpose the last two arguments?">,
864  InGroup<MemsetTransposedArgs>;
865def note_suspicious_sizeof_memset_silence : Note<
866  "%select{parenthesize the third argument|"
867  "cast the second argument to 'int'}0 to silence">;
868def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
869  InGroup<SuspiciousBzero>;
870def note_suspicious_bzero_size_silence : Note<
871  "parenthesize the second argument to silence">;
872
873def warn_strncat_large_size : Warning<
874  "the value of the size argument in 'strncat' is too large, might lead to a "
875  "buffer overflow">, InGroup<StrncatSize>;
876def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
877  "to be size of the source">, InGroup<StrncatSize>;
878def warn_strncat_wrong_size : Warning<
879  "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
880def note_strncat_wrong_size : Note<
881  "change the argument to be the free space in the destination buffer minus "
882  "the terminating null byte">;
883
884def warn_assume_side_effects : Warning<
885  "assumption is ignored because it contains (potential) side-effects">,
886  InGroup<DiagGroup<"assume">>;
887def warn_omp_assume_attribute_string_unknown : Warning<
888  "unknown assumption string '%0'; attribute is potentially ignored">,
889  InGroup<UnknownAssumption>;
890def warn_omp_assume_attribute_string_unknown_suggested : Warning<
891  "unknown assumption string '%0' may be misspelled; attribute is potentially "
892  "ignored, did you mean '%1'?">,
893  InGroup<MisspelledAssumption>;
894
895def warn_builtin_chk_overflow : Warning<
896  "'%0' will always overflow; destination buffer has size %1,"
897  " but size argument is %2">,
898  InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
899
900def warn_fortify_source_overflow
901  : Warning<warn_builtin_chk_overflow.Summary>, InGroup<FortifySource>;
902def warn_fortify_source_size_mismatch : Warning<
903  "'%0' size argument is too large; destination buffer has size %1,"
904  " but size argument is %2">, InGroup<FortifySource>;
905
906def warn_fortify_strlen_overflow: Warning<
907  "'%0' will always overflow; destination buffer has size %1,"
908  " but the source string has length %2 (including NUL byte)">,
909  InGroup<FortifySource>;
910
911def subst_format_overflow : TextSubstitution<
912  "'%0' will always overflow; destination buffer has size %1,"
913  " but format string expands to at least %2">;
914
915def warn_format_overflow : Warning<
916  "%sub{subst_format_overflow}0,1,2">,
917  InGroup<FormatOverflow>;
918
919def warn_format_overflow_non_kprintf : Warning<
920  "%sub{subst_format_overflow}0,1,2">,
921  InGroup<FormatOverflowNonKprintf>;
922
923def subst_format_truncation: TextSubstitution<
924  "'%0' will always be truncated; specified size is %1,"
925  " but format string expands to at least %2">;
926
927def warn_format_truncation: Warning<
928  "%sub{subst_format_truncation}0,1,2">,
929  InGroup<FormatTruncation>;
930
931def warn_format_truncation_non_kprintf: Warning<
932  "%sub{subst_format_truncation}0,1,2">,
933  InGroup<FormatTruncationNonKprintf>;
934
935def warn_fortify_scanf_overflow : Warning<
936  "'%0' may overflow; destination buffer in argument %1 has size "
937  "%2, but the corresponding specifier may require size %3">,
938  InGroup<FortifySource>;
939
940def err_function_start_invalid_type: Error<
941  "argument must be a function">;
942
943def err_ptrauth_disabled :
944  Error<"this target does not support pointer authentication">;
945def err_ptrauth_invalid_key :
946  Error<"%0 does not identify a valid pointer authentication key for "
947        "the current target">;
948def err_ptrauth_value_bad_type :
949  Error<"%select{signed value|extra discriminator|blended pointer|blended "
950        "integer}0 must have %select{pointer|integer|pointer or integer}1 "
951        "type; type here is %2">;
952def err_ptrauth_bad_constant_pointer :
953  Error<"argument to ptrauth_sign_constant must refer to a global variable "
954        "or function">;
955def err_ptrauth_bad_constant_discriminator :
956  Error<"discriminator argument to ptrauth_sign_constant must be a constant "
957        "integer, the address of the global variable where the result "
958        "will be stored, or a blend of the two">;
959def warn_ptrauth_sign_null_pointer :
960  Warning<"signing a null pointer will yield a non-null pointer">,
961  InGroup<PtrAuthNullPointers>;
962def warn_ptrauth_auth_null_pointer :
963  Warning<"authenticating a null pointer will almost certainly trap">,
964  InGroup<PtrAuthNullPointers>;
965def err_ptrauth_string_not_literal : Error<
966  "argument must be a string literal%select{| of char type}0">;
967def err_ptrauth_type_disc_undiscriminated : Error<
968  "cannot pass undiscriminated type %0 to "
969  "'__builtin_ptrauth_type_discriminator'">;
970
971def note_ptrauth_virtual_function_pointer_incomplete_arg_ret :
972  Note<"cannot take an address of a virtual member function if its return or "
973       "argument types are incomplete">;
974def note_ptrauth_virtual_function_incomplete_arg_ret_type :
975  Note<"%0 is incomplete">;
976
977def err_ptrauth_indirect_goto_addrlabel_arithmetic : Error<
978  "%select{subtraction|addition}0 of address-of-label expressions is not "
979  "supported with ptrauth indirect gotos">;
980
981/// main()
982// static main() is not an error in C, just in C++.
983def warn_static_main : Warning<"'main' should not be declared static">,
984    InGroup<Main>;
985def err_static_main : Error<"'main' is not allowed to be declared static">;
986def err_inline_main : Error<"'main' is not allowed to be declared inline">;
987def ext_variadic_main : ExtWarn<
988  "'main' is not allowed to be declared variadic">, InGroup<Main>;
989def ext_noreturn_main : ExtWarn<
990  "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
991def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
992def err_constexpr_main : Error<
993  "'main' is not allowed to be declared %select{constexpr|consteval}0">;
994def err_deleted_main : Error<"'main' is not allowed to be deleted">;
995def err_mainlike_template_decl : Error<"%0 cannot be a template">;
996def err_main_returns_nonint : Error<"'main' must return 'int'">;
997def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
998    InGroup<MainReturnType>;
999def note_main_change_return_type : Note<"change return type to 'int'">;
1000def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
1001    "must be 0, 2, or 3">;
1002def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
1003    InGroup<Main>;
1004def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
1005    "parameter of 'main' (%select{argument count|argument array|environment|"
1006    "platform-specific data}0) must be of type %1">;
1007def warn_main_returns_bool_literal : Warning<"bool literal returned from "
1008    "'main'">, InGroup<Main>;
1009def err_main_global_variable :
1010    Error<"main cannot be declared as a variable %select{in the global scope|with C language linkage}0">;
1011def warn_main_redefined : Warning<"variable named 'main' with external linkage "
1012    "has undefined behavior">, InGroup<Main>;
1013def ext_main_used : Extension<
1014    "referring to 'main' within an expression is a Clang extension">, InGroup<Main>;
1015def ext_main_invalid_linkage_specification : ExtWarn<
1016  "'main' should not be "
1017  "'extern \"%select{C|C++}0\"'">, InGroup<Main>;
1018
1019/// parser diagnostics
1020def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
1021  InGroup<MissingDeclarations>;
1022def err_no_declarators : Error<"declaration does not declare anything">;
1023def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
1024  InGroup<MissingDeclarations>;
1025def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
1026
1027def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
1028  "anonymous non-C-compatible type given name for linkage purposes "
1029  "by %select{typedef|alias}0 declaration; "
1030  "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
1031def err_non_c_like_anon_struct_in_typedef : Error<
1032  "anonymous non-C-compatible type given name for linkage purposes "
1033  "by %select{typedef|alias}0 declaration after its linkage was computed; "
1034  "add a tag name here to establish linkage prior to definition">;
1035def err_typedef_changes_linkage : Error<
1036  "unsupported: anonymous type given name for linkage purposes "
1037  "by %select{typedef|alias}0 declaration after its linkage was computed; "
1038  "add a tag name here to establish linkage prior to definition">;
1039def note_non_c_like_anon_struct : Note<
1040  "type is not C-compatible due to this "
1041  "%select{base class|default member initializer|lambda expression|"
1042  "friend declaration|member declaration}0">;
1043def note_typedef_for_linkage_here : Note<
1044  "type is given name %0 for linkage purposes by this "
1045  "%select{typedef|alias}1 declaration">;
1046
1047def err_statically_allocated_object : Error<
1048  "interface type cannot be statically allocated">;
1049def err_object_cannot_be_passed_returned_by_value : Error<
1050  "interface type %1 cannot be %select{returned|passed}0 by value"
1051  "; did you forget * in %1?">;
1052def err_parameters_retval_cannot_have_fp16_type : Error<
1053  "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
1054def err_opencl_half_load_store : Error<
1055  "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
1056  "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
1057def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
1058def err_opencl_half_declaration : Error<
1059  "declaring variable of type %0 is not allowed">;
1060def err_opencl_invalid_param : Error<
1061  "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
1062def err_opencl_invalid_return : Error<
1063  "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
1064def warn_pragma_options_align_reset_failed : Warning<
1065  "#pragma options align=reset failed: %0">,
1066  InGroup<IgnoredPragmas>;
1067def err_pragma_options_align_mac68k_target_unsupported : Error<
1068  "mac68k alignment pragma is not supported on this target">;
1069def warn_pragma_align_not_xl_compatible : Warning<
1070  "#pragma align(packed) may not be compatible with objects generated with AIX XL C/C++">,
1071  InGroup<AIXCompat>;
1072def warn_pragma_pack_invalid_alignment : Warning<
1073  "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
1074  InGroup<IgnoredPragmas>;
1075def err_pragma_pack_invalid_alignment : Error<
1076  warn_pragma_pack_invalid_alignment.Summary>;
1077def warn_pragma_pack_non_default_at_include : Warning<
1078  "non-default #pragma pack value changes the alignment of struct or union "
1079  "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
1080  DefaultIgnore;
1081def warn_pragma_pack_modified_after_include : Warning<
1082  "the current #pragma pack alignment value is modified in the included "
1083  "file">, InGroup<PragmaPack>;
1084def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
1085  "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
1086def note_pragma_pack_here : Note<
1087  "previous '#pragma pack' directive that modifies alignment is here">;
1088def note_pragma_pack_pop_instead_reset : Note<
1089  "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
1090// Follow the Microsoft implementation.
1091def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
1092def warn_pragma_pack_pop_identifier_and_alignment : Warning<
1093  "specifying both a name and alignment to 'pop' is undefined">;
1094def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
1095  InGroup<IgnoredPragmas>;
1096def err_pragma_fc_pp_scope : Error<
1097  "'#pragma float_control push/pop' can only appear at file or namespace scope "
1098  "or within a language linkage specification">;
1099def err_pragma_fc_noprecise_requires_nofenv : Error<
1100  "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
1101def err_pragma_fc_except_requires_precise : Error<
1102  "'#pragma float_control(except, on)' is illegal when precise is disabled">;
1103def err_pragma_fc_noprecise_requires_noexcept : Error<
1104  "'#pragma float_control(precise, off)' is illegal when except is enabled">;
1105def err_pragma_fenv_requires_precise : Error<
1106  "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
1107def warn_cxx_ms_struct :
1108  Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
1109          "with base classes or virtual functions">,
1110  DefaultError, InGroup<IncompatibleMSStruct>;
1111def err_pragma_pack_identifer_not_supported : Error<
1112  "specifying an identifier within `#pragma pack` is not supported on this target">;
1113def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
1114def warn_section_msvc_compat : Warning<"`#pragma const_seg` for section %1 will"
1115  " not apply to %0 due to the presence of a %select{mutable field||non-trivial constructor|non-trivial destructor}2">,
1116  InGroup<IncompatibleMSPragmaSection>;
1117def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
1118def err_invalid_super_scope : Error<"invalid use of '__super', "
1119  "this keyword can only be used inside class or member function scope">;
1120def err_super_in_lambda_unsupported : Error<
1121  "use of '__super' inside a lambda is unsupported">;
1122
1123def err_pragma_expected_file_scope : Error<
1124  "'#pragma %0' can only appear at file scope">;
1125def err_pragma_alloc_text_c_linkage: Error<
1126  "'#pragma alloc_text' is applicable only to functions with C linkage">;
1127def err_pragma_alloc_text_not_function: Error<
1128  "'#pragma alloc_text' is applicable only to functions">;
1129
1130def warn_pragma_unused_undeclared_var : Warning<
1131  "undeclared variable %0 used as an argument for '#pragma unused'">,
1132  InGroup<IgnoredPragmas>;
1133def warn_atl_uuid_deprecated : Warning<
1134  "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
1135  InGroup<DeprecatedDeclarations>;
1136def warn_pragma_unused_expected_var_arg : Warning<
1137  "only variables can be arguments to '#pragma unused'">,
1138  InGroup<IgnoredPragmas>;
1139def err_pragma_push_visibility_mismatch : Error<
1140  "#pragma visibility push with no matching #pragma visibility pop">;
1141def note_surrounding_namespace_ends_here : Note<
1142  "surrounding namespace with visibility attribute ends here">;
1143def err_pragma_pop_visibility_mismatch : Error<
1144  "#pragma visibility pop with no matching #pragma visibility push">;
1145def note_surrounding_namespace_starts_here : Note<
1146  "surrounding namespace with visibility attribute starts here">;
1147def err_pragma_loop_invalid_argument_type : Error<
1148  "invalid argument of type %0; expected an integer type">;
1149def err_pragma_loop_compatibility : Error<
1150  "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
1151def err_pragma_loop_precedes_nonloop : Error<
1152  "expected a for, while, or do-while loop to follow '%0'">;
1153
1154def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
1155  "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
1156  "those declarations">;
1157def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
1158  "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
1159def err_pragma_attribute_invalid_matchers : Error<
1160  "attribute %0 cannot be applied to %1">;
1161def err_pragma_attribute_stack_mismatch : Error<
1162  "'#pragma clang attribute %select{%1.|}0pop' with no matching"
1163  " '#pragma clang attribute %select{%1.|}0push'">;
1164def warn_pragma_attribute_unused : Warning<
1165  "unused attribute %0 in '#pragma clang attribute push' region">,
1166  InGroup<PragmaClangAttribute>;
1167def note_pragma_attribute_region_ends_here : Note<
1168  "'#pragma clang attribute push' regions ends here">;
1169def err_pragma_attribute_no_pop_eof : Error<"unterminated "
1170  "'#pragma clang attribute push' at end of file">;
1171def note_pragma_attribute_applied_decl_here : Note<
1172  "when applied to this declaration">;
1173def err_pragma_attr_attr_no_push : Error<
1174  "'#pragma clang attribute' attribute with no matching "
1175  "'#pragma clang attribute push'">;
1176
1177/// Objective-C parser diagnostics
1178def err_duplicate_class_def : Error<
1179  "duplicate interface definition for class %0">;
1180def err_undef_superclass : Error<
1181  "cannot find interface declaration for %0, superclass of %1">;
1182def err_forward_superclass : Error<
1183  "attempting to use the forward class %0 as superclass of %1">;
1184def err_no_nsconstant_string_class : Error<
1185  "cannot find interface declaration for %0">;
1186def err_recursive_superclass : Error<
1187  "trying to recursively use %0 as superclass of %1">;
1188def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
1189def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
1190def warn_duplicate_protocol_def : Warning<
1191  "duplicate protocol definition of %0 is ignored">,
1192  InGroup<DiagGroup<"duplicate-protocol">>;
1193def err_protocol_has_circular_dependency : Error<
1194  "protocol has circular dependency">;
1195def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
1196def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
1197def err_atprotocol_protocol : Error<
1198  "@protocol is using a forward protocol declaration of %0">;
1199def warn_readonly_property : Warning<
1200  "attribute 'readonly' of property %0 restricts attribute "
1201  "'readwrite' of property inherited from %1">,
1202  InGroup<PropertyAttr>;
1203
1204def warn_property_attribute : Warning<
1205  "'%1' attribute on property %0 does not match the property inherited from %2">,
1206  InGroup<PropertyAttr>;
1207def warn_property_types_are_incompatible : Warning<
1208  "property type %0 is incompatible with type %1 inherited from %2">,
1209  InGroup<DiagGroup<"incompatible-property-type">>;
1210def warn_protocol_property_mismatch : Warning<
1211  "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
1212  "getter %1|with setter %1}0 was selected for synthesis">,
1213  InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
1214def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Summary>;
1215def err_undef_interface : Error<"cannot find interface declaration for %0">;
1216def err_category_forward_interface : Error<
1217  "cannot define %select{category|class extension}0 for undefined class %1">;
1218def err_class_extension_after_impl : Error<
1219  "cannot declare class extension for %0 after class implementation">;
1220def note_implementation_declared : Note<
1221  "class implementation is declared here">;
1222def note_while_in_implementation : Note<
1223  "detected while default synthesizing properties in class implementation">;
1224def note_class_declared : Note<
1225  "class is declared here">;
1226def note_receiver_class_declared : Note<
1227  "receiver is instance of class declared here">;
1228def note_receiver_expr_here : Note<
1229  "receiver expression is here">;
1230def note_receiver_is_id : Note<
1231  "receiver is treated with 'id' type for purpose of method lookup">;
1232def note_suppressed_class_declare : Note<
1233  "class with specified objc_requires_property_definitions attribute is declared here">;
1234def err_objc_root_class_subclass : Error<
1235  "objc_root_class attribute may only be specified on a root class declaration">;
1236def err_restricted_superclass_mismatch : Error<
1237  "cannot subclass a class that was declared with the "
1238  "'objc_subclassing_restricted' attribute">;
1239def err_class_stub_subclassing_mismatch : Error<
1240  "'objc_class_stub' attribute cannot be specified on a class that does not "
1241  "have the 'objc_subclassing_restricted' attribute">;
1242def err_implementation_of_class_stub : Error<
1243  "cannot declare implementation of a class declared with the "
1244  "'objc_class_stub' attribute">;
1245def warn_objc_root_class_missing : Warning<
1246  "class %0 defined without specifying a base class">,
1247  InGroup<ObjCRootClass>;
1248def err_objc_runtime_visible_category : Error<
1249  "cannot implement a category for class %0 that is only visible via the "
1250  "Objective-C runtime">;
1251def err_objc_runtime_visible_subclass : Error<
1252  "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1253  "Objective-C runtime">;
1254def note_objc_needs_superclass : Note<
1255  "add a super class to fix this problem">;
1256def err_conflicting_super_class : Error<"conflicting super class name %0">;
1257def err_dup_implementation_class : Error<"reimplementation of class %0">;
1258def err_dup_implementation_category : Error<
1259  "reimplementation of category %1 for class %0">;
1260def err_conflicting_ivar_type : Error<
1261  "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1262def err_duplicate_ivar_declaration : Error<
1263  "instance variable is already declared">;
1264def warn_on_superclass_use : Warning<
1265  "class implementation may not have super class">;
1266def err_conflicting_ivar_bitwidth : Error<
1267  "instance variable %0 has conflicting bit-field width">;
1268def err_conflicting_ivar_name : Error<
1269  "conflicting instance variable names: %0 vs %1">;
1270def err_inconsistent_ivar_count : Error<
1271  "inconsistent number of instance variables specified">;
1272def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1273  InGroup<DiagGroup<"incomplete-implementation">>;
1274def warn_objc_boxing_invalid_utf8_string : Warning<
1275  "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1276  InGroup<ObjCBoxing>;
1277
1278def err_objc_non_runtime_protocol_in_protocol_expr : Error<
1279  "cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression">;
1280def err_objc_direct_on_protocol : Error<
1281  "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1282  "declared in an Objective-C protocol">;
1283def err_objc_direct_duplicate_decl : Error<
1284  "%select{|direct }0%select{method|property}1 declaration conflicts "
1285  "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1286def err_objc_direct_impl_decl_mismatch : Error<
1287  "direct method was declared in %select{the primary interface|an extension|a category}0 "
1288  "but is implemented in %select{the primary interface|a category|a different category}1">;
1289def err_objc_direct_missing_on_decl : Error<
1290  "direct method implementation was previously declared not direct">;
1291def err_objc_direct_on_override : Error<
1292  "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1293def err_objc_override_direct_method : Error<
1294  "cannot override a method that is declared direct by a superclass">;
1295def warn_objc_direct_ignored : Warning<
1296  "%0 attribute isn't implemented by this Objective-C runtime">,
1297  InGroup<IgnoredAttributes>;
1298def warn_objc_direct_property_ignored : Warning<
1299  "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1300  InGroup<IgnoredAttributes>;
1301def err_objc_direct_dynamic_property : Error<
1302  "direct property cannot be @dynamic">;
1303def err_objc_direct_protocol_conformance : Error<
1304  "%select{category %1|class extension}0 cannot conform to protocol %2 because "
1305  "of direct members declared in interface %3">;
1306def note_direct_member_here : Note<"direct member declared here">;
1307
1308def warn_conflicting_overriding_ret_types : Warning<
1309  "conflicting return type in "
1310  "declaration of %0%diff{: $ vs $|}1,2">,
1311  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1312
1313def warn_conflicting_ret_types : Warning<
1314  "conflicting return type in "
1315  "implementation of %0%diff{: $ vs $|}1,2">,
1316  InGroup<MismatchedReturnTypes>;
1317
1318def warn_conflicting_overriding_ret_type_modifiers : Warning<
1319  "conflicting distributed object modifiers on return type "
1320  "in declaration of %0">,
1321  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1322
1323def warn_conflicting_ret_type_modifiers : Warning<
1324  "conflicting distributed object modifiers on return type "
1325  "in implementation of %0">,
1326  InGroup<DistributedObjectModifiers>;
1327
1328def warn_non_covariant_overriding_ret_types : Warning<
1329  "conflicting return type in "
1330  "declaration of %0: %1 vs %2">,
1331  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1332
1333def warn_non_covariant_ret_types : Warning<
1334  "conflicting return type in "
1335  "implementation of %0: %1 vs %2">,
1336  InGroup<MethodSignatures>, DefaultIgnore;
1337
1338def warn_conflicting_overriding_param_types : Warning<
1339  "conflicting parameter types in "
1340  "declaration of %0%diff{: $ vs $|}1,2">,
1341  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1342
1343def warn_conflicting_param_types : Warning<
1344  "conflicting parameter types in "
1345  "implementation of %0%diff{: $ vs $|}1,2">,
1346  InGroup<MismatchedParameterTypes>;
1347
1348def warn_conflicting_param_modifiers : Warning<
1349  "conflicting distributed object modifiers on parameter type "
1350  "in implementation of %0">,
1351  InGroup<DistributedObjectModifiers>;
1352
1353def warn_conflicting_overriding_param_modifiers : Warning<
1354  "conflicting distributed object modifiers on parameter type "
1355  "in declaration of %0">,
1356  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1357
1358def warn_non_contravariant_overriding_param_types : Warning<
1359  "conflicting parameter types in "
1360  "declaration of %0: %1 vs %2">,
1361  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1362
1363def warn_non_contravariant_param_types : Warning<
1364  "conflicting parameter types in "
1365  "implementation of %0: %1 vs %2">,
1366  InGroup<MethodSignatures>, DefaultIgnore;
1367
1368def warn_conflicting_overriding_variadic :Warning<
1369  "conflicting variadic declaration of method and its "
1370  "implementation">,
1371  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1372
1373def warn_conflicting_variadic :Warning<
1374  "conflicting variadic declaration of method and its "
1375  "implementation">;
1376
1377def warn_category_method_impl_match:Warning<
1378  "category is implementing a method which will also be implemented"
1379  " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1380
1381def warn_implements_nscopying : Warning<
1382"default assign attribute on property %0 which implements "
1383"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1384
1385def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1386  InGroup<ObjCMultipleMethodNames>;
1387def warn_strict_multiple_method_decl : Warning<
1388  "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1389def warn_accessor_property_type_mismatch : Warning<
1390  "type of property %0 does not match type of accessor %1">;
1391def note_conv_function_declared_at : Note<"type conversion function declared here">;
1392def note_method_declared_at : Note<"method %0 declared here">;
1393def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1394def note_property_attribute : Note<"property %0 is declared "
1395  "%select{deprecated|unavailable|partial}1 here">;
1396def err_setter_type_void : Error<"type of setter must be void">;
1397def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1398def warn_duplicate_method_decl :
1399  Warning<"multiple declarations of method %0 found and ignored">,
1400  InGroup<MethodDuplicate>, DefaultIgnore;
1401def warn_objc_cdirective_format_string :
1402  Warning<"using %0 directive in %select{NSString|CFString}1 "
1403          "which is being passed as a formatting argument to the formatting "
1404          "%select{method|CFfunction}2">,
1405  InGroup<ObjCCStringFormat>, DefaultIgnore;
1406def err_objc_var_decl_inclass :
1407    Error<"cannot declare variable inside @interface or @protocol">;
1408def err_missing_method_context : Error<
1409  "missing context for method declaration">;
1410def err_objc_property_attr_mutually_exclusive : Error<
1411  "property attributes '%0' and '%1' are mutually exclusive">;
1412def err_objc_property_requires_object : Error<
1413  "property with '%0' attribute must be of object type">;
1414def warn_objc_property_assign_on_object : Warning<
1415  "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1416  InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1417def warn_objc_property_no_assignment_attribute : Warning<
1418  "no 'assign', 'retain', or 'copy' attribute is specified - "
1419  "'assign' is assumed">,
1420  InGroup<ObjCPropertyNoAttribute>;
1421def warn_objc_isa_use : Warning<
1422  "direct access to Objective-C's isa is deprecated in favor of "
1423  "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1424def warn_objc_isa_assign : Warning<
1425  "assignment to Objective-C's isa is deprecated in favor of "
1426  "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1427def warn_objc_pointer_masking : Warning<
1428  "bitmasking for introspection of Objective-C object pointers is strongly "
1429  "discouraged">,
1430  InGroup<ObjCPointerIntrospect>;
1431def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Summary>,
1432  InGroup<ObjCPointerIntrospectPerformSelector>;
1433def warn_objc_property_default_assign_on_object : Warning<
1434  "default property attribute 'assign' not appropriate for object">,
1435  InGroup<ObjCPropertyNoAttribute>;
1436def warn_property_attr_mismatch : Warning<
1437  "property attribute in class extension does not match the primary class">,
1438  InGroup<PropertyAttr>;
1439def warn_property_implicitly_mismatched : Warning <
1440  "primary property declaration is implicitly strong while redeclaration "
1441  "in class extension is weak">,
1442  InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1443def warn_objc_property_copy_missing_on_block : Warning<
1444    "'copy' attribute must be specified for the block property "
1445    "when -fobjc-gc-only is specified">;
1446def warn_objc_property_retain_of_block : Warning<
1447    "retain'ed block property does not copy the block "
1448    "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1449def warn_objc_readonly_property_has_setter : Warning<
1450    "setter cannot be specified for a readonly property">,
1451    InGroup<ObjCReadonlyPropertyHasSetter>;
1452def warn_atomic_property_rule : Warning<
1453  "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1454  "with a user defined %select{getter|setter}2">,
1455  InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1456def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1457  "synthesized, or both be user defined, or the property must be nonatomic">;
1458def err_atomic_property_nontrivial_assign_op : Error<
1459  "atomic property of reference type %0 cannot have non-trivial assignment"
1460  " operator">;
1461def warn_cocoa_naming_owned_rule : Warning<
1462  "property follows Cocoa naming"
1463  " convention for returning 'owned' objects">,
1464  InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1465def err_cocoa_naming_owned_rule : Error<
1466  "property follows Cocoa naming"
1467  " convention for returning 'owned' objects">;
1468def note_cocoa_naming_declare_family : Note<
1469  "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1470  "object">;
1471def warn_auto_synthesizing_protocol_property :Warning<
1472  "auto property synthesis will not synthesize property %0"
1473  " declared in protocol %1">,
1474  InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1475def note_add_synthesize_directive : Note<
1476  "add a '@synthesize' directive">;
1477def warn_no_autosynthesis_shared_ivar_property : Warning <
1478  "auto property synthesis will not synthesize property "
1479  "%0 because it cannot share an ivar with another synthesized property">,
1480  InGroup<ObjCNoPropertyAutoSynthesis>;
1481def warn_no_autosynthesis_property : Warning<
1482  "auto property synthesis will not synthesize property "
1483  "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1484  "via another property">,
1485  InGroup<ObjCNoPropertyAutoSynthesis>;
1486def warn_autosynthesis_property_in_superclass : Warning<
1487  "auto property synthesis will not synthesize property "
1488  "%0; it will be implemented by its superclass, use @dynamic to "
1489  "acknowledge intention">,
1490  InGroup<ObjCNoPropertyAutoSynthesis>;
1491def warn_autosynthesis_property_ivar_match :Warning<
1492  "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1493  "%2, not existing instance variable %3">,
1494  InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1495def warn_missing_explicit_synthesis : Warning <
1496  "auto property synthesis is synthesizing property not explicitly synthesized">,
1497  InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1498def warn_property_getter_owning_mismatch : Warning<
1499  "property declared as returning non-retained objects"
1500  "; getter returning retained objects">;
1501def warn_property_redecl_getter_mismatch : Warning<
1502  "getter name mismatch between property redeclaration (%1) and its original "
1503  "declaration (%0)">, InGroup<PropertyAttr>;
1504def err_property_setter_ambiguous_use : Error<
1505  "synthesized properties %0 and %1 both claim setter %2 -"
1506  " use of this setter will cause unexpected behavior">;
1507def warn_default_atomic_custom_getter_setter : Warning<
1508  "atomic by default property %0 has a user defined %select{getter|setter}1 "
1509  "(property should be marked 'atomic' if this is intended)">,
1510  InGroup<CustomAtomic>, DefaultIgnore;
1511def err_use_continuation_class : Error<
1512  "illegal redeclaration of property in class extension %0"
1513  " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1514def err_type_mismatch_continuation_class : Error<
1515  "type of property %0 in class extension does not match "
1516  "property type in primary class">;
1517def err_use_continuation_class_redeclaration_readwrite : Error<
1518  "illegal redeclaration of 'readwrite' property in class extension %0"
1519  " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1520  "'readonly' public property?)">;
1521def err_continuation_class : Error<"class extension has no primary class">;
1522def err_property_type : Error<"property cannot have array or function type %0">;
1523def err_missing_property_context : Error<
1524  "missing context for property implementation declaration">;
1525def err_bad_property_decl : Error<
1526  "property implementation must have its declaration in interface %0 or one of "
1527  "its extensions">;
1528def err_category_property : Error<
1529  "property declared in category %0 cannot be implemented in "
1530  "class implementation">;
1531def note_property_declare : Note<
1532  "property declared here">;
1533def note_protocol_property_declare : Note<
1534  "it could also be property "
1535  "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1536  "%1|with setter %1}0 declared here">;
1537def note_property_synthesize : Note<
1538  "property synthesized here">;
1539def err_synthesize_category_decl : Error<
1540  "@synthesize not allowed in a category's implementation">;
1541def err_synthesize_on_class_property : Error<
1542  "@synthesize not allowed on a class property %0">;
1543def err_missing_property_interface : Error<
1544  "property implementation in a category with no category declaration">;
1545def err_bad_category_property_decl : Error<
1546  "property implementation must have its declaration in the category %0">;
1547def err_bad_property_context : Error<
1548  "property implementation must be in a class or category implementation">;
1549def err_missing_property_ivar_decl : Error<
1550  "synthesized property %0 must either be named the same as a compatible"
1551  " instance variable or must explicitly name an instance variable">;
1552def err_arc_perform_selector_retains : Error<
1553  "performSelector names a selector which retains the object">;
1554def warn_arc_perform_selector_leaks : Warning<
1555  "performSelector may cause a leak because its selector is unknown">,
1556  InGroup<DiagGroup<"arc-performSelector-leaks">>;
1557def warn_dealloc_in_category : Warning<
1558"-dealloc is being overridden in a category">,
1559InGroup<DeallocInCategory>;
1560def err_gc_weak_property_strong_type : Error<
1561  "weak attribute declared on a __strong type property in GC mode">;
1562def warn_arc_repeated_use_of_weak : Warning <
1563  "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1564  "accessed multiple times in this %select{function|method|block|lambda}2 "
1565  "but may be unpredictably set to nil; assign to a strong variable to keep "
1566  "the object alive">,
1567  InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1568def warn_implicitly_retains_self : Warning <
1569  "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1570  "this is intended behavior">,
1571  InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1572def warn_arc_possible_repeated_use_of_weak : Warning <
1573  "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1574  "be accessed multiple times in this %select{function|method|block|lambda}2 "
1575  "and may be unpredictably set to nil; assign to a strong variable to keep "
1576  "the object alive">,
1577  InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1578def note_arc_weak_also_accessed_here : Note<
1579  "also accessed here">;
1580def err_incomplete_synthesized_property : Error<
1581  "cannot synthesize property %0 with incomplete type %1">;
1582
1583def err_property_ivar_type : Error<
1584  "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1585def err_property_accessor_type : Error<
1586  "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1587def err_ivar_in_superclass_use : Error<
1588  "property %0 attempting to use instance variable %1 declared in super class %2">;
1589def err_weak_property : Error<
1590  "existing instance variable %1 for __weak property %0 must be __weak">;
1591def err_strong_property : Error<
1592  "existing instance variable %1 for strong property %0 may not be __weak">;
1593def err_dynamic_property_ivar_decl : Error<
1594  "dynamic property cannot have instance variable specification">;
1595def err_duplicate_ivar_use : Error<
1596  "synthesized properties %0 and %1 both claim instance variable %2">;
1597def err_property_implemented : Error<"property %0 is already implemented">;
1598def warn_objc_missing_super_call : Warning<
1599  "method possibly missing a [super %0] call">,
1600  InGroup<ObjCMissingSuperCalls>;
1601def err_dealloc_bad_result_type : Error<
1602  "dealloc return type must be correctly specified as 'void' under ARC, "
1603  "instead of %0">;
1604def warn_undeclared_selector : Warning<
1605  "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1606def warn_undeclared_selector_with_typo : Warning<
1607  "undeclared selector %0; did you mean %1?">,
1608  InGroup<UndeclaredSelector>, DefaultIgnore;
1609def warn_implicit_atomic_property : Warning<
1610  "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1611def note_auto_readonly_iboutlet_fixup_suggest : Note<
1612  "property should be changed to be readwrite">;
1613def warn_auto_readonly_iboutlet_property : Warning<
1614  "readonly IBOutlet property %0 when auto-synthesized may "
1615  "not work correctly with 'nib' loader">,
1616  InGroup<DiagGroup<"readonly-iboutlet-property">>;
1617def warn_auto_implicit_atomic_property : Warning<
1618  "property is assumed atomic when auto-synthesizing the property">,
1619  InGroup<ImplicitAtomic>, DefaultIgnore;
1620def warn_unimplemented_selector:  Warning<
1621  "no method with selector %0 is implemented in this translation unit">,
1622  InGroup<Selector>, DefaultIgnore;
1623def warn_unimplemented_protocol_method : Warning<
1624  "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1625def warn_multiple_selectors: Warning<
1626  "several methods with selector %0 of mismatched types are found "
1627  "for the @selector expression">,
1628  InGroup<SelectorTypeMismatch>, DefaultIgnore;
1629def err_direct_selector_expression : Error<
1630  "@selector expression formed with direct selector %0">;
1631def warn_potentially_direct_selector_expression : Warning<
1632  "@selector expression formed with potentially direct selector %0">,
1633  InGroup<ObjCPotentiallyDirectSelector>;
1634def warn_strict_potentially_direct_selector_expression : Warning<
1635  warn_potentially_direct_selector_expression.Summary>,
1636  InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1637
1638def err_objc_kindof_nonobject : Error<
1639  "'__kindof' specifier cannot be applied to non-object type %0">;
1640def err_objc_kindof_wrong_position : Error<
1641  "'__kindof' type specifier must precede the declarator">;
1642
1643def err_objc_method_unsupported_param_ret_type : Error<
1644  "%0 %select{parameter|return}1 type is unsupported; "
1645  "support for vector types for this target is introduced in %2">;
1646
1647def warn_messaging_unqualified_id : Warning<
1648  "messaging unqualified id">, DefaultIgnore,
1649  InGroup<DiagGroup<"objc-messaging-id">>;
1650def err_messaging_unqualified_id_with_direct_method : Error<
1651  "messaging unqualified id with a method that is possibly direct">;
1652def err_messaging_super_with_direct_method : Error<
1653  "messaging super with a direct method">;
1654def err_messaging_class_with_direct_method : Error<
1655  "messaging a Class with a method that is possibly direct">;
1656
1657// C++ declarations
1658def err_static_assert_expression_is_not_constant : Error<
1659  "static assertion expression is not an integral constant expression">;
1660def err_constexpr_if_condition_expression_is_not_constant : Error<
1661  "constexpr if condition is not a constant expression">;
1662def err_static_assert_failed : Error<"static assertion failed%select{: %1|}0">;
1663def err_static_assert_requirement_failed : Error<
1664  "static assertion failed due to requirement '%0'%select{: %2|}1">;
1665def note_expr_evaluates_to : Note<
1666  "expression evaluates to '%0 %1 %2'">;
1667def err_static_assert_invalid_message : Error<
1668  "the message in a static assertion must be a string literal or an "
1669  "object with 'data()' and 'size()' member functions">;
1670def err_static_assert_missing_member_function : Error<
1671  "the message object in this static assertion is missing %select{"
1672  "a 'size()' member function|"
1673  "a 'data()' member function|"
1674  "'data()' and 'size()' member functions}0">;
1675def err_static_assert_invalid_mem_fn_ret_ty : Error<
1676  "the message in a static assertion must have a '%select{size|data}0()' member "
1677  "function returning an object convertible to '%select{std::size_t|const char *}0'">;
1678def warn_static_assert_message_constexpr : Warning<
1679  "the message in this static assertion is not a "
1680  "constant expression">,
1681  DefaultError, InGroup<DiagGroup<"invalid-static-assert-message">>;
1682def err_static_assert_message_constexpr : Error<
1683  "the message in a static assertion must be produced by a "
1684  "constant expression">;
1685
1686def warn_consteval_if_always_true : Warning<
1687  "consteval if is always true in an %select{unevaluated|immediate}0 context">,
1688  InGroup<DiagGroup<"redundant-consteval-if">>;
1689
1690def ext_inline_variable : ExtWarn<
1691  "inline variables are a C++17 extension">, InGroup<CXX17>;
1692def warn_cxx14_compat_inline_variable : Warning<
1693  "inline variables are incompatible with C++ standards before C++17">,
1694  DefaultIgnore, InGroup<CXXPre17Compat>;
1695
1696def warn_inline_namespace_reopened_noninline : Warning<
1697  "inline namespace reopened as a non-inline namespace">,
1698  InGroup<InlineNamespaceReopenedNoninline>;
1699def err_inline_namespace_mismatch : Error<
1700  "non-inline namespace cannot be reopened as inline">;
1701def err_inline_namespace_std : Error<
1702  "cannot declare the namespace 'std' to be inline">;
1703
1704def err_unexpected_friend : Error<
1705  "friends can only be classes or functions">;
1706def ext_enum_friend : ExtWarn<
1707  "elaborated enum specifier cannot be declared as a friend">,
1708  InGroup<DiagGroup<"friend-enum">>;
1709def note_enum_friend : Note<
1710  "remove 'enum%select{| struct| class}0' to befriend an enum">;
1711def ext_nonclass_type_friend : ExtWarn<
1712  "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1713def warn_cxx98_compat_nonclass_type_friend : Warning<
1714  "non-class friend type %0 is incompatible with C++98">,
1715  InGroup<CXX98Compat>, DefaultIgnore;
1716def err_friend_is_member : Error<
1717  "friends cannot be members of the declaring class">;
1718def warn_cxx98_compat_friend_is_member : Warning<
1719  "friend declaration naming a member of the declaring class is incompatible "
1720  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1721def ext_unelaborated_friend_type : ExtWarn<
1722  "unelaborated friend declaration is a C++11 extension; specify "
1723  "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1724  InGroup<CXX11>;
1725def warn_cxx98_compat_unelaborated_friend_type : Warning<
1726  "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1727  "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1728def err_qualified_friend_no_match : Error<
1729  "friend declaration of %0 does not match any declaration in %1">;
1730def err_introducing_special_friend : Error<
1731  "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1732  " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1733  "as a friend">;
1734def err_tagless_friend_type_template : Error<
1735  "friend type templates must use an elaborated type">;
1736def err_no_matching_local_friend : Error<
1737  "cannot define friend function in a local class definition">;
1738def err_no_matching_local_friend_suggest : Error<
1739  "cannot define friend function %0 in a local class definition; did you mean %3?">;
1740def err_partial_specialization_friend : Error<
1741  "partial specialization cannot be declared as a friend">;
1742def err_qualified_friend_def : Error<
1743  "friend function definition cannot be qualified with '%0'">;
1744def err_friend_def_in_local_class : Error<
1745  "friend function cannot be defined in a local class">;
1746def err_friend_specialization_def : Error<
1747  "friend function specialization cannot be defined">;
1748def err_friend_not_first_in_declaration : Error<
1749  "'friend' must appear first in a non-function declaration">;
1750def err_using_decl_friend : Error<
1751  "cannot befriend target of using declaration">;
1752def warn_template_qualified_friend_unsupported : Warning<
1753  "dependent nested name specifier '%0' for friend class declaration is "
1754  "not supported; turning off access control for %1">,
1755  InGroup<UnsupportedFriend>;
1756def warn_template_qualified_friend_ignored : Warning<
1757  "dependent nested name specifier '%0' for friend template declaration is "
1758  "not supported; ignoring this friend declaration">,
1759  InGroup<UnsupportedFriend>;
1760def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1761  "unqualified friend declaration referring to type outside of the nearest "
1762  "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1763  InGroup<MicrosoftUnqualifiedFriend>;
1764def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1765def err_friend_template_decl_multiple_specifiers: Error<
1766  "a friend declaration that befriends a template must contain exactly one type-specifier">;
1767def friend_template_decl_malformed_pack_expansion : Error<
1768  "friend declaration expands pack %0 that is declared it its own template parameter list">;
1769
1770def err_invalid_base_in_interface : Error<
1771  "interface type cannot inherit from "
1772  "%select{struct|non-public interface|class}0 %1">;
1773
1774def err_abstract_type_in_decl : Error<
1775  "%select{return|parameter|variable|field|instance variable|"
1776  "synthesized instance variable}0 type %1 is an abstract class">;
1777def err_allocation_of_abstract_type : Error<
1778  "allocating an object of abstract class type %0">;
1779def err_throw_abstract_type : Error<
1780  "cannot throw an object of abstract type %0">;
1781def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1782def err_capture_of_abstract_type : Error<
1783  "by-copy capture of value of abstract type %0">;
1784def err_capture_of_incomplete_or_sizeless_type : Error<
1785  "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1786def err_capture_default_non_local : Error<
1787  "non-local lambda expression cannot have a capture-default">;
1788
1789def err_multiple_final_overriders : Error<
1790  "virtual function %q0 has more than one final overrider in %1">;
1791def note_final_overrider : Note<"final overrider of %q0 in %1">;
1792
1793def err_type_defined_in_type_specifier : Error<
1794  "%0 cannot be defined in a type specifier">;
1795def err_type_defined_in_result_type : Error<
1796  "%0 cannot be defined in the result type of a function">;
1797def err_type_defined_in_param_type : Error<
1798  "%0 cannot be defined in a parameter type">;
1799def err_type_defined_in_alias_template : Error<
1800  "%0 cannot be defined in a type alias template">;
1801def err_type_defined_in_condition : Error<
1802  "%0 cannot be defined in a condition">;
1803def err_type_defined_in_enum : Error<
1804  "%0 cannot be defined in an enumeration">;
1805def ext_type_defined_in_offsetof : Extension<
1806  "defining a type within '%select{__builtin_offsetof|offsetof}0' is a C23 "
1807  "extension">, InGroup<C23>;
1808
1809def note_pure_virtual_function : Note<
1810  "unimplemented pure virtual method %0 in %1">;
1811
1812def note_pure_qualified_call_kext : Note<
1813  "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1814
1815def err_deleted_decl_not_first : Error<
1816  "deleted definition must be first declaration">;
1817
1818def err_deleted_override : Error<
1819  "deleted function %0 cannot override a non-deleted function">;
1820def err_non_deleted_override : Error<
1821  "non-deleted function %0 cannot override a deleted function">;
1822def err_consteval_override : Error<
1823  "consteval function %0 cannot override a non-consteval function">;
1824def err_non_consteval_override : Error<
1825  "non-consteval function %0 cannot override a consteval function">;
1826
1827def warn_weak_vtable : Warning<
1828  "%0 has no out-of-line virtual method definitions; its vtable will be "
1829  "emitted in every translation unit">,
1830  InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1831def warn_weak_template_vtable : Warning<
1832  "this warning is no longer in use and will be removed in the next release">,
1833  InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1834
1835def ext_using_undefined_std : ExtWarn<
1836  "using directive refers to implicitly-defined namespace 'std'">;
1837
1838// C++ exception specifications
1839def err_exception_spec_in_typedef : Error<
1840  "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1841def err_distant_exception_spec : Error<
1842  "exception specifications are not allowed beyond a single level "
1843  "of indirection">;
1844def err_incomplete_in_exception_spec : Error<
1845  "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1846  "in exception specification">;
1847def err_sizeless_in_exception_spec : Error<
1848  "%select{|reference to }0sizeless type %1 is not allowed "
1849  "in exception specification">;
1850def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Summary>,
1851  InGroup<MicrosoftExceptionSpec>;
1852def err_rref_in_exception_spec : Error<
1853  "rvalue reference type %0 is not allowed in exception specification">;
1854def err_mismatched_exception_spec : Error<
1855  "exception specification in declaration does not match previous declaration">;
1856def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Summary>,
1857  InGroup<MicrosoftExceptionSpec>;
1858def err_override_exception_spec : Error<
1859  "exception specification of overriding function is more lax than "
1860  "base version">;
1861def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Summary>,
1862  InGroup<MicrosoftExceptionSpec>;
1863def err_incompatible_exception_specs : Error<
1864  "target exception specification is not superset of source">;
1865def warn_incompatible_exception_specs : Warning<
1866  err_incompatible_exception_specs.Summary>, InGroup<IncompatibleExceptionSpec>;
1867def err_deep_exception_specs_differ : Error<
1868  "exception specifications of %select{return|argument}0 types differ">;
1869def warn_deep_exception_specs_differ : Warning<
1870  err_deep_exception_specs_differ.Summary>, InGroup<IncompatibleExceptionSpec>;
1871def err_missing_exception_specification : Error<
1872  "%0 is missing exception specification '%1'">;
1873def ext_missing_exception_specification : ExtWarn<
1874  err_missing_exception_specification.Summary>,
1875  InGroup<DiagGroup<"missing-exception-spec">>;
1876def err_exception_spec_not_parsed : Error<
1877  "exception specification is not available until end of class definition">;
1878def err_exception_spec_cycle : Error<
1879  "exception specification of %0 uses itself">;
1880def err_exception_spec_incomplete_type : Error<
1881  "exception specification needed for member of incomplete class %0">;
1882def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1883  "dynamic exception specifications with types are currently ignored in wasm">,
1884  InGroup<WebAssemblyExceptionSpec>;
1885
1886// C++ access checking
1887def err_class_redeclared_with_different_access : Error<
1888  "%0 redeclared with '%1' access">;
1889def err_access : Error<
1890  "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1891def ext_ms_using_declaration_inaccessible : ExtWarn<
1892  "using declaration referring to inaccessible member '%0' (which refers "
1893  "to accessible member '%1') is a Microsoft compatibility extension">,
1894    AccessControl, InGroup<MicrosoftUsingDecl>;
1895def err_access_ctor : Error<
1896  "calling a %select{private|protected}0 constructor of class %2">,
1897  AccessControl;
1898def ext_rvalue_to_reference_access_ctor : Extension<
1899  "C++98 requires an accessible copy constructor for class %2 when binding "
1900  "a reference to a temporary; was %select{private|protected}0">,
1901  AccessControl, InGroup<BindToTemporaryCopy>;
1902def err_access_base_ctor : Error<
1903  // The ERRORs represent other special members that aren't constructors, in
1904  // hopes that someone will bother noticing and reporting if they appear
1905  "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1906  "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1907  "|*ERROR*|}2constructor">, AccessControl;
1908def err_access_field_ctor : Error<
1909  // The ERRORs represent other special members that aren't constructors, in
1910  // hopes that someone will bother noticing and reporting if they appear
1911  "field of type %0 has %select{private|protected}2 "
1912  "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1913  AccessControl;
1914def err_access_friend_function : Error<
1915  "friend function %1 is a %select{private|protected}0 member of %3">,
1916  AccessControl;
1917
1918def err_access_dtor : Error<
1919  "calling a %select{private|protected}1 destructor of class %0">,
1920  AccessControl;
1921def err_access_dtor_base :
1922    Error<"base class %0 has %select{private|protected}1 destructor">,
1923    AccessControl;
1924def err_access_dtor_vbase :
1925    Error<"inherited virtual base class %1 has "
1926    "%select{private|protected}2 destructor">,
1927    AccessControl;
1928def err_access_dtor_temp :
1929    Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1930    AccessControl;
1931def err_access_dtor_exception :
1932    Error<"exception object of type %0 has %select{private|protected}1 "
1933          "destructor">, AccessControl;
1934def err_access_dtor_field :
1935    Error<"field of type %1 has %select{private|protected}2 destructor">,
1936    AccessControl;
1937def err_access_dtor_var :
1938    Error<"variable of type %1 has %select{private|protected}2 destructor">,
1939    AccessControl;
1940def err_access_dtor_ivar :
1941    Error<"instance variable of type %0 has %select{private|protected}1 "
1942          "destructor">,
1943    AccessControl;
1944def note_previous_access_declaration : Note<
1945  "previously declared '%1' here">;
1946def note_access_natural : Note<
1947  "%select{|implicitly }1declared %select{private|protected}0 here">;
1948def note_access_constrained_by_path : Note<
1949  "constrained by %select{|implicitly }1%select{private|protected}0"
1950  " inheritance here">;
1951def note_access_protected_restricted_noobject : Note<
1952  "must name member using the type of the current context %0">;
1953def note_access_protected_restricted_ctordtor : Note<
1954  "protected %select{constructor|destructor}0 can only be used to "
1955  "%select{construct|destroy}0 a base class subobject">;
1956def note_access_protected_restricted_object : Note<
1957  "can only access this member on an object of type %0">;
1958def warn_cxx98_compat_sfinae_access_control : Warning<
1959  "substitution failure due to access control is incompatible with C++98">,
1960  InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1961
1962// C++ name lookup
1963def err_incomplete_nested_name_spec : Error<
1964  "incomplete type %0 named in nested name specifier">;
1965def err_incomplete_enum : Error<
1966  "enumeration %0 is incomplete">;
1967def err_dependent_nested_name_spec : Error<
1968  "nested name specifier for a declaration cannot depend on a template "
1969  "parameter">;
1970def err_nested_name_member_ref_lookup_ambiguous : Error<
1971  "lookup of %0 in member access expression is ambiguous">;
1972def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1973  "lookup of %0 in member access expression is ambiguous; using member of %1">,
1974  InGroup<AmbigMemberTemplate>;
1975def note_ambig_member_ref_object_type : Note<
1976  "lookup in the object type %0 refers here">;
1977def note_ambig_member_ref_scope : Note<
1978  "lookup from the current scope refers here">;
1979def err_qualified_member_nonclass : Error<
1980  "qualified member access refers to a member in %0">;
1981def err_incomplete_member_access : Error<
1982  "member access into incomplete type %0">;
1983def err_incomplete_type : Error<
1984  "incomplete type %0 where a complete type is required">;
1985def warn_cxx98_compat_enum_nested_name_spec : Warning<
1986  "enumeration type in nested name specifier is incompatible with C++98">,
1987  InGroup<CXX98Compat>, DefaultIgnore;
1988def err_nested_name_spec_is_not_class : Error<
1989  "%0 cannot appear before '::' because it is not a class"
1990  "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1991def ext_nested_name_spec_is_enum : ExtWarn<
1992  "use of enumeration in a nested name specifier is a C++11 extension">,
1993  InGroup<CXX11>;
1994def err_out_of_line_qualified_id_type_names_constructor : Error<
1995  "qualified reference to %0 is a constructor name rather than a "
1996  "%select{template name|type}1 in this context">;
1997def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1998  "ISO C++ specifies that "
1999  "qualified reference to %0 is a constructor name rather than a "
2000  "%select{template name|type}1 in this context, despite preceding "
2001  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
2002  InGroup<DiagGroup<"injected-class-name">>;
2003
2004// C++ class members
2005def err_storageclass_invalid_for_member : Error<
2006  "storage class specified for a member declaration">;
2007def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
2008def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
2009def ext_mutable_reference : ExtWarn<
2010  "'mutable' on a reference type is a Microsoft extension">,
2011  InGroup<MicrosoftMutableReference>;
2012def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
2013def err_mutable_nonmember : Error<
2014  "'mutable' can only be applied to member variables">;
2015def err_virtual_in_union : Error<
2016  "unions cannot have virtual functions">;
2017def err_virtual_non_function : Error<
2018  "'virtual' can only appear on non-static member functions">;
2019def err_virtual_out_of_class : Error<
2020  "'virtual' can only be specified inside the class definition">;
2021def err_virtual_member_function_template : Error<
2022  "'virtual' cannot be specified on member function templates">;
2023def err_static_overrides_virtual : Error<
2024  "'static' member function %0 overrides a virtual function in a base class">;
2025def err_explicit_non_function : Error<
2026  "'explicit' can only appear on non-static member functions">;
2027def err_explicit_out_of_class : Error<
2028  "'explicit' can only be specified inside the class definition">;
2029def err_explicit_non_ctor_or_conv_function : Error<
2030  "'explicit' can only be applied to a constructor or conversion function">;
2031def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
2032def err_static_out_of_line : Error<
2033  "'static' can only be specified inside the class definition">;
2034def ext_static_out_of_line : ExtWarn<
2035  err_static_out_of_line.Summary>,
2036  InGroup<MicrosoftTemplate>;
2037def err_storage_class_for_static_member : Error<
2038  "static data member definition cannot specify a storage class">;
2039def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
2040def err_not_integral_type_bitfield : Error<
2041  "bit-field %0 has non-integral type %1">;
2042def err_not_integral_type_anon_bitfield : Error<
2043  "anonymous bit-field has non-integral type %0">;
2044def err_anon_bitfield_qualifiers : Error<
2045  "anonymous bit-field cannot have qualifiers">;
2046def err_member_function_initialization : Error<
2047  "initializer on function does not look like a pure-specifier">;
2048def err_non_virtual_pure : Error<
2049  "%0 is not virtual and cannot be declared pure">;
2050def ext_pure_function_definition : ExtWarn<
2051  "function definition with pure-specifier is a Microsoft extension">,
2052  InGroup<MicrosoftPureDefinition>;
2053def err_qualified_member_of_unrelated : Error<
2054  "%q0 is not a member of class %1">;
2055
2056def err_member_function_call_bad_cvr : Error<
2057  "'this' argument to member function %0 has type %1, but function is not marked "
2058  "%select{const|restrict|const or restrict|volatile|const or volatile|"
2059  "volatile or restrict|const, volatile, or restrict}2">;
2060def err_member_function_call_bad_ref : Error<
2061  "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
2062  "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
2063def err_member_function_call_bad_type : Error<
2064  "cannot initialize object parameter of type %0 with an expression "
2065  "of type %1">;
2066
2067def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
2068  "call to pure virtual member function %0 has undefined behavior; "
2069  "overrides of %0 in subclasses are not available in the "
2070  "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
2071
2072def select_special_member_kind : TextSubstitution<
2073  "%select{default constructor|copy constructor|move constructor|"
2074  "copy assignment operator|move assignment operator|destructor}0">;
2075
2076def note_member_declared_at : Note<"member is declared here">;
2077def note_ivar_decl : Note<"instance variable is declared here">;
2078def note_bitfield_decl : Note<"bit-field is declared here">;
2079def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
2080def note_member_synthesized_at : Note<
2081  "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
2082  "first required here">;
2083def note_comparison_synthesized_at : Note<
2084  "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
2085  "first required here">;
2086def err_missing_default_ctor : Error<
2087  "%select{constructor for %1 must explicitly initialize the|"
2088  "implicit default constructor for %1 must explicitly initialize the|"
2089  "cannot use constructor inherited from base class %4;}0 "
2090  "%select{base class|member}2 %3 %select{which|which|of %1}0 "
2091  "does not have a default constructor">;
2092def note_due_to_dllexported_class : Note<
2093  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
2094
2095def err_illegal_union_or_anon_struct_member : Error<
2096  "%select{anonymous struct|union}0 member %1 has a non-trivial "
2097  "%sub{select_special_member_kind}2">;
2098
2099def warn_frame_address : Warning<
2100  "calling '%0' with a nonzero argument is unsafe">,
2101  InGroup<FrameAddress>, DefaultIgnore;
2102
2103def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
2104  "%select{anonymous struct|union}0 member %1 with a non-trivial "
2105  "%sub{select_special_member_kind}2 is incompatible with C++98">,
2106  InGroup<CXX98Compat>, DefaultIgnore;
2107
2108def note_nontrivial_virtual_dtor : Note<
2109  "destructor for %0 is not trivial because it is virtual">;
2110def note_nontrivial_has_virtual : Note<
2111  "because type %0 has a virtual %select{member function|base class}1">;
2112def note_nontrivial_no_def_ctor : Note<
2113  "because %select{base class of |field of |}0type %1 has no "
2114  "default constructor">;
2115def note_user_declared_ctor : Note<
2116  "implicit default constructor suppressed by user-declared constructor">;
2117def note_nontrivial_no_copy : Note<
2118  "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
2119  "assignment operator|<<ERROR>>}2 can be used to "
2120  "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
2121  "%select{base class|field|an object}0 of type %3">;
2122def note_nontrivial_user_provided : Note<
2123  "because %select{base class of |field of |}0type %1 has a user-provided "
2124  "%sub{select_special_member_kind}2">;
2125def note_nontrivial_default_member_init : Note<
2126  "because field %0 has an initializer">;
2127def note_nontrivial_param_type : Note<
2128  "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
2129def note_nontrivial_default_arg : Note<"because it has a default argument">;
2130def note_nontrivial_variadic : Note<"because it is a variadic function">;
2131def note_nontrivial_subobject : Note<
2132  "because the function selected to %select{construct|copy|move|copy|move|"
2133  "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
2134def note_nontrivial_objc_ownership : Note<
2135  "because type %0 has a member with %select{no|no|__strong|__weak|"
2136  "__autoreleasing}1 ownership">;
2137
2138/// Selector for a TagTypeKind value.
2139def select_tag_type_kind : TextSubstitution<
2140  "%select{struct|interface|union|class|enum}0">;
2141
2142def err_static_data_member_not_allowed_in_anon_struct : Error<
2143  "static data member %0 not allowed in anonymous "
2144  "%sub{select_tag_type_kind}1">;
2145def ext_static_data_member_in_union : ExtWarn<
2146  "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
2147def warn_cxx98_compat_static_data_member_in_union : Warning<
2148  "static data member %0 in union is incompatible with C++98">,
2149  InGroup<CXX98Compat>, DefaultIgnore;
2150def ext_union_member_of_reference_type : ExtWarn<
2151  "union member %0 has reference type %1, which is a Microsoft extension">,
2152  InGroup<MicrosoftUnionMemberReference>;
2153def err_union_member_of_reference_type : Error<
2154  "union member %0 has reference type %1">;
2155def ext_anonymous_struct_union_qualified : Extension<
2156  "anonymous %select{struct|union}0 cannot be '%1'">;
2157def err_different_return_type_for_overriding_virtual_function : Error<
2158  "virtual function %0 has a different return type "
2159  "%diff{($) than the function it overrides (which has return type $)|"
2160  "than the function it overrides}1,2">;
2161def note_overridden_virtual_function : Note<
2162  "overridden virtual function is here">;
2163def err_conflicting_overriding_attributes : Error<
2164  "virtual function %0 has different attributes "
2165  "%diff{($) than the function it overrides (which has $)|"
2166  "than the function it overrides}1,2">;
2167def err_conflicting_overriding_cc_attributes : Error<
2168  "virtual function %0 has different calling convention attributes "
2169  "%diff{($) than the function it overrides (which has calling convention $)|"
2170  "than the function it overrides}1,2">;
2171def warn_overriding_method_missing_noescape : Warning<
2172  "parameter of overriding method should be annotated with "
2173  "__attribute__((noescape))">, InGroup<MissingNoEscape>;
2174def note_overridden_marked_noescape : Note<
2175  "parameter of overridden method is annotated with __attribute__((noescape))">;
2176def note_cat_conform_to_noescape_prot : Note<
2177  "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
2178
2179def err_covariant_return_inaccessible_base : Error<
2180  "invalid covariant return for virtual function: %1 is a "
2181  "%select{private|protected}2 base class of %0">, AccessControl;
2182def err_covariant_return_ambiguous_derived_to_base_conv : Error<
2183  "return type of virtual function %3 is not covariant with the return type of "
2184  "the function it overrides (ambiguous conversion from derived class "
2185  "%0 to base class %1:%2)">;
2186def err_covariant_return_not_derived : Error<
2187  "return type of virtual function %0 is not covariant with the return type of "
2188  "the function it overrides (%1 is not derived from %2)">;
2189def err_covariant_return_incomplete : Error<
2190  "return type of virtual function %0 is not covariant with the return type of "
2191  "the function it overrides (%1 is incomplete)">;
2192def err_covariant_return_type_different_qualifications : Error<
2193  "return type of virtual function %0 is not covariant with the return type of "
2194  "the function it overrides (%1 has different qualifiers than %2)">;
2195def err_covariant_return_type_class_type_not_same_or_less_qualified : Error<
2196  "return type of virtual function %0 is not covariant with the return type of "
2197  "the function it overrides (class type %1 does not have the same "
2198  "cv-qualification as or less cv-qualification than class type %2)">;
2199
2200// C++ implicit special member functions
2201def note_in_declaration_of_implicit_special_member : Note<
2202  "while declaring the implicit %sub{select_special_member_kind}1"
2203  " for %0">;
2204
2205// C++ constructors
2206def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
2207def err_invalid_qualified_constructor : Error<
2208  "'%0' qualifier is not allowed on a constructor">;
2209def err_ref_qualifier_constructor : Error<
2210  "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
2211def err_invalid_ctor_dtor_decl : Error<
2212  "invalid %select{constructor|destructor}0 declaration">;
2213
2214def err_constructor_return_type : Error<
2215  "constructor cannot have a return type">;
2216def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
2217def err_constructor_byvalue_arg : Error<
2218  "copy constructor must pass its first argument by reference">;
2219def warn_no_constructor_for_refconst : Warning<
2220  "%select{struct|interface|union|class|enum}0 %1 does not declare any "
2221  "constructor to initialize its non-modifiable members">;
2222def note_refconst_member_not_initialized : Note<
2223  "%select{const|reference}0 member %1 will never be initialized">;
2224def ext_ms_explicit_constructor_call : ExtWarn<
2225  "explicit constructor calls are a Microsoft extension">,
2226  InGroup<MicrosoftExplicitConstructorCall>;
2227
2228// C++ destructors
2229def err_destructor_not_member : Error<
2230  "destructor must be a non-static member function">;
2231def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
2232def err_invalid_qualified_destructor : Error<
2233  "'%0' qualifier is not allowed on a destructor">;
2234def err_ref_qualifier_destructor : Error<
2235  "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
2236def err_destructor_return_type : Error<"destructor cannot have a return type">;
2237def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
2238def err_destructor_with_params : Error<"destructor cannot have any parameters">;
2239def err_destructor_variadic : Error<"destructor cannot be variadic">;
2240def ext_destructor_typedef_name : ExtWarn<
2241  "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
2242  "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
2243def err_undeclared_destructor_name : Error<
2244  "undeclared identifier %0 in destructor name">;
2245def err_destructor_name : Error<
2246  "expected the class name after '~' to name the enclosing class">;
2247def err_destructor_name_nontype : Error<
2248  "identifier %0 after '~' in destructor name does not name a type">;
2249def err_destructor_expr_mismatch : Error<
2250  "identifier %0 in object destruction expression does not name the type "
2251  "%1 of the object being destroyed">;
2252def err_destructor_expr_nontype : Error<
2253  "identifier %0 in object destruction expression does not name a type">;
2254def err_destructor_expr_type_mismatch : Error<
2255  "destructor type %0 in object destruction expression does not match the "
2256  "type %1 of the object being destroyed">;
2257def note_destructor_type_here : Note<
2258  "type %0 found by destructor name lookup">;
2259def note_destructor_nontype_here : Note<
2260  "non-type declaration found by destructor name lookup">;
2261def ext_dtor_named_in_wrong_scope : Extension<
2262  "ISO C++ requires the name after '::~' to be found in the same scope as "
2263  "the name before '::~'">, InGroup<DtorName>;
2264def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
2265  "qualified destructor name only found in lexical scope; omit the qualifier "
2266  "to find this type name by unqualified lookup">, InGroup<DtorName>;
2267def ext_dtor_name_ambiguous : Extension<
2268  "ISO C++ considers this destructor name lookup to be ambiguous">,
2269  InGroup<DtorName>;
2270
2271def err_destroy_attr_on_non_static_var : Error<
2272  "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
2273  " variable with static or thread storage duration">;
2274
2275def err_destructor_template : Error<
2276  "destructor cannot be declared as a template">;
2277
2278// C++ initialization
2279def err_init_conversion_failed : Error<
2280  "cannot initialize %select{a variable|a parameter|template parameter|"
2281  "return object|statement expression result|an "
2282  "exception object|a member subobject|an array element|a new value|a value|a "
2283  "base class|a constructor delegation|a vector element|a block element|a "
2284  "block element|a complex element|a lambda capture|a compound literal "
2285  "initializer|a related result|a parameter of CF audited function|a "
2286  "structured binding|a member subobject}0 "
2287  "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2288  "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2289  "%select{|: different classes%diff{ ($ vs $)|}5,6"
2290  "|: different number of parameters (%5 vs %6)"
2291  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2292  "|: different return type%diff{ ($ vs $)|}5,6"
2293  "|: different qualifiers (%5 vs %6)"
2294  "|: different exception specifications}4">;
2295def note_forward_class_conversion : Note<"%0 is not defined, but forward "
2296  "declared here; conversion would be valid if it was derived from %1">;
2297
2298def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2299  "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2300def err_lvalue_reference_bind_to_initlist : Error<
2301  "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2302  "initializer list temporary">;
2303def err_lvalue_reference_bind_to_temporary : Error<
2304  "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2305  "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2306def err_lvalue_reference_bind_to_unrelated : Error<
2307  "%select{non-const|volatile}0 lvalue reference "
2308  "%diff{to type $ cannot bind to a value of unrelated type $|"
2309  "cannot bind to a value of unrelated type}1,2">;
2310def err_reference_bind_drops_quals : Error<
2311  "binding reference %diff{of type $ to value of type $|to value}0,1 "
2312  "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2313  "not permitted due to incompatible qualifiers}2">;
2314def err_reference_bind_failed : Error<
2315  "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2316  "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2317  "incompatible type}0,3">;
2318def err_reference_bind_temporary_addrspace : Error<
2319  "reference of type %0 cannot bind to a temporary object because of "
2320  "address space mismatch">;
2321def err_reference_bind_init_list : Error<
2322  "reference to type %0 cannot bind to an initializer list">;
2323def err_init_list_bad_dest_type : Error<
2324  "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2325  "list">;
2326def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2327  "aggregate initialization of type %0 with user-declared constructors "
2328  "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2329def warn_cxx17_compat_aggregate_init_paren_list : Warning<
2330  "aggregate initialization of type %0 from a parenthesized list of values "
2331  "is a C++20 extension">, DefaultIgnore, InGroup<CXX20>;
2332
2333def err_reference_bind_to_bitfield : Error<
2334  "%select{non-const|volatile}0 reference cannot bind to "
2335  "bit-field%select{| %1}2">;
2336def err_reference_bind_to_bitfield_in_cce : Error<
2337  "reference cannot bind to bit-field in converted constant expression">;
2338def err_reference_bind_to_vector_element : Error<
2339  "%select{non-const|volatile}0 reference cannot bind to vector element">;
2340def err_reference_bind_to_matrix_element : Error<
2341  "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2342def err_reference_var_requires_init : Error<
2343  "declaration of reference variable %0 requires an initializer">;
2344def err_reference_without_init : Error<
2345  "reference to type %0 requires an initializer">;
2346def note_value_initialization_here : Note<
2347  "in value-initialization of type %0 here">;
2348def err_reference_has_multiple_inits : Error<
2349  "reference cannot be initialized with multiple values">;
2350def err_init_non_aggr_init_list : Error<
2351  "initialization of non-aggregate type %0 with an initializer list">;
2352def err_designated_init_for_non_aggregate : Error<
2353  "initialization of non-aggregate type %0 with a designated initializer list">;
2354def err_init_reference_member_uninitialized : Error<
2355  "reference member of type %0 uninitialized">;
2356def note_uninit_reference_member : Note<
2357  "uninitialized reference member is here">;
2358def warn_field_requires_explicit_init : Warning<
2359  "field %select{%1|in %1}0 requires explicit initialization but is not "
2360   "explicitly initialized">, InGroup<UninitializedExplicitInit>;
2361def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2362  InGroup<Uninitialized>;
2363def warn_base_class_is_uninit : Warning<
2364  "base class %0 is uninitialized when used here to access %q1">,
2365  InGroup<Uninitialized>;
2366def warn_reference_field_is_uninit : Warning<
2367  "reference %0 is not yet bound to a value when used here">,
2368  InGroup<Uninitialized>;
2369def note_uninit_in_this_constructor : Note<
2370  "during field initialization in %select{this|the implicit default}0 "
2371  "constructor">;
2372def warn_static_self_reference_in_init : Warning<
2373  "static variable %0 is suspiciously used within its own initialization">,
2374  InGroup<UninitializedStaticSelfInit>;
2375def warn_uninit_self_reference_in_init : Warning<
2376  "variable %0 is uninitialized when used within its own initialization">,
2377  InGroup<Uninitialized>;
2378def warn_uninit_self_reference_in_reference_init : Warning<
2379  "reference %0 is not yet bound to a value when used within its own"
2380  " initialization">,
2381  InGroup<Uninitialized>;
2382def warn_uninit_var : Warning<
2383  "variable %0 is uninitialized when %select{used here|captured by block}1">,
2384  InGroup<Uninitialized>, DefaultIgnore;
2385def warn_sometimes_uninit_var : Warning<
2386  "variable %0 is %select{used|captured}1 uninitialized whenever "
2387  "%select{'%3' condition is %select{true|false}4|"
2388  "'%3' loop %select{is entered|exits because its condition is false}4|"
2389  "'%3' loop %select{condition is true|exits because its condition is false}4|"
2390  "switch %3 is taken|"
2391  "its declaration is reached|"
2392  "%3 is called}2">,
2393  InGroup<UninitializedSometimes>, DefaultIgnore;
2394def warn_maybe_uninit_var : Warning<
2395  "variable %0 may be uninitialized when "
2396  "%select{used here|captured by block}1">,
2397  InGroup<UninitializedMaybe>, DefaultIgnore;
2398def note_var_declared_here : Note<"variable %0 is declared here">;
2399def note_uninit_var_use : Note<
2400  "%select{uninitialized use occurs|variable is captured by block}0 here">;
2401def warn_uninit_byref_blockvar_captured_by_block : Warning<
2402  "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2403  "block">, InGroup<Uninitialized>, DefaultIgnore;
2404def note_block_var_fixit_add_initialization : Note<
2405  "did you mean to use __block %0?">;
2406def note_in_omitted_aggregate_initializer : Note<
2407  "in implicit initialization of %select{"
2408  "array element %1 with omitted initializer|"
2409  "field %1 with omitted initializer|"
2410  "trailing array elements in runtime-sized array new}0">;
2411def note_in_reference_temporary_list_initializer : Note<
2412  "in initialization of temporary of type %0 created to "
2413  "list-initialize this reference">;
2414def note_var_fixit_add_initialization : Note<
2415  "initialize the variable %0 to silence this warning">;
2416def note_uninit_fixit_remove_cond : Note<
2417  "remove the %select{'%1' if its condition|condition if it}0 "
2418  "is always %select{false|true}2">;
2419def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2420def err_list_init_in_parens : Error<
2421  "cannot initialize %select{non-class|reference}0 type %1 with a "
2422  "parenthesized initializer list">;
2423
2424def warn_uninit_const_reference : Warning<
2425  "variable %0 is uninitialized when passed as a const reference argument "
2426  "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2427
2428def warn_unsequenced_mod_mod : Warning<
2429  "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2430def warn_unsequenced_mod_use : Warning<
2431  "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2432
2433def select_initialized_entity_kind : TextSubstitution<
2434  "%select{copying variable|copying parameter|initializing template parameter|"
2435  "returning object|initializing statement expression result|"
2436  "throwing object|copying member subobject|copying array element|"
2437  "allocating object|copying temporary|initializing base subobject|"
2438  "initializing vector element|capturing value}0">;
2439
2440def err_temp_copy_no_viable : Error<
2441  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2442def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2443  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2444  "C++98 requires a copy constructor when binding a reference to a temporary">,
2445  InGroup<BindToTemporaryCopy>;
2446def err_temp_copy_ambiguous : Error<
2447  "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2448  "of type %1">;
2449def err_temp_copy_deleted : Error<
2450  "%sub{select_initialized_entity_kind}0 of type %1 "
2451  "invokes deleted constructor">;
2452def err_temp_copy_incomplete : Error<
2453  "copying a temporary object of incomplete type %0">;
2454def warn_cxx98_compat_temp_copy : Warning<
2455  "%sub{select_initialized_entity_kind}1 "
2456  "of type %2 when binding a reference to a temporary would %select{invoke "
2457  "an inaccessible constructor|find no viable constructor|find ambiguous "
2458  "constructors|invoke a deleted constructor}0 in C++98">,
2459  InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2460def err_selected_explicit_constructor : Error<
2461  "chosen constructor is explicit in copy-initialization">;
2462def note_explicit_ctor_deduction_guide_here : Note<
2463  "explicit %select{constructor|deduction guide}0 declared here">;
2464def note_implicit_deduction_guide : Note<"implicit deduction guide declared as '%0'">;
2465
2466// C++11 auto
2467def warn_cxx98_compat_auto_type_specifier : Warning<
2468  "'auto' type specifier is incompatible with C++98">,
2469  InGroup<CXX98Compat>, DefaultIgnore;
2470def err_auto_variable_cannot_appear_in_own_initializer : Error<
2471  "variable %0 declared with deduced type %1 "
2472  "cannot appear in its own initializer">;
2473def err_binding_cannot_appear_in_own_initializer : Error<
2474  "binding %0 cannot appear in the initializer of its own "
2475  "decomposition declaration">;
2476def err_new_array_of_auto : Error<
2477  "cannot allocate array of 'auto'">;
2478def err_auto_not_allowed : Error<
2479  "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2480  "use of "
2481  "%select{class template|function template|variable template|alias template|"
2482  "template template parameter|concept|template}2 %3 requires template "
2483  "arguments; argument deduction}0 not allowed "
2484  "%select{in function prototype"
2485  "|in non-static struct member|in struct member"
2486  "|in non-static union member|in union member"
2487  "|in non-static class member|in interface member"
2488  "|in exception declaration|in template parameter until C++17|in block literal"
2489  "|in template argument|in typedef|in type alias|in function return type"
2490  "|in conversion function type|here|in lambda parameter"
2491  "|in type allocated by 'new'|in K&R-style function parameter"
2492  "|in template parameter|in friend declaration|in function prototype that is "
2493  "not a function declaration|in requires expression parameter"
2494  "|in array declaration"
2495  "|in declaration of conversion function template"
2496  "|in lambda parameter before C++14}1">;
2497
2498def err_dependent_deduced_tst : Error<
2499  "typename specifier refers to "
2500  "%select{class template|function template|variable template|alias template|"
2501  "template template parameter|template}0 member in %1; "
2502  "argument deduction not allowed here">;
2503def err_deduced_tst : Error<
2504  "typename specifier refers to "
2505  "%select{class template|function template|variable template|alias template|"
2506  "template template parameter|template}0; argument deduction not allowed "
2507  "here">;
2508def err_auto_not_allowed_var_inst : Error<
2509  "'auto' variable template instantiation is not allowed">;
2510def err_auto_var_requires_init : Error<
2511  "declaration of variable %0 with deduced type %1 requires an initializer">;
2512def err_auto_new_requires_ctor_arg : Error<
2513  "new expression for type %0 requires a constructor argument">;
2514def ext_auto_new_list_init : Extension<
2515  "ISO C++ standards before C++17 do not allow new expression for "
2516  "type %0 to use list-initialization">, InGroup<CXX17>;
2517def err_auto_var_init_no_expression : Error<
2518  "initializer for variable %0 with type %1 is empty">;
2519def err_auto_expr_init_no_expression : Error<
2520  "initializer for functional-style cast to %0 is empty">;
2521def err_auto_var_init_multiple_expressions : Error<
2522  "initializer for variable %0 with type %1 contains multiple expressions">;
2523def err_auto_expr_init_multiple_expressions : Error<
2524  "initializer for functional-style cast to %0 contains multiple expressions">;
2525def err_auto_var_init_paren_braces : Error<
2526  "cannot deduce type for variable %1 with type %2 from "
2527  "%select{parenthesized|nested}0 initializer list">;
2528def err_auto_new_ctor_multiple_expressions : Error<
2529  "new expression for type %0 contains multiple constructor arguments">;
2530def err_auto_expr_init_paren_braces : Error<
2531  "cannot deduce actual type for %1 from "
2532  "%select{parenthesized|nested}0 initializer list">;
2533def warn_cxx20_compat_auto_expr : Warning<
2534  "'auto' as a functional-style cast is incompatible with C++ standards "
2535  "before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
2536def err_auto_missing_trailing_return : Error<
2537  "'auto' return without trailing return type; deduced return types are a "
2538  "C++14 extension">;
2539def err_deduced_return_type : Error<
2540  "deduced return types are a C++14 extension">;
2541def err_trailing_return_without_auto : Error<
2542  "function with trailing return type must specify return type 'auto', not %0">;
2543def err_trailing_return_in_parens : Error<
2544  "trailing return type may not be nested within parentheses">;
2545def err_auto_var_deduction_failure : Error<
2546  "variable %0 with type %1 has incompatible initializer of type %2">;
2547def err_auto_var_deduction_failure_from_init_list : Error<
2548  "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2549def err_auto_expr_deduction_failure : Error<
2550  "functional-style cast to %0 has incompatible initializer of type %1">;
2551def err_auto_new_deduction_failure : Error<
2552  "new expression for type %0 has incompatible constructor argument of type %1">;
2553def err_auto_inconsistent_deduction : Error<
2554  "deduced conflicting types %diff{($ vs $) |}0,1"
2555  "for initializer list element type">;
2556def err_auto_different_deductions : Error<
2557  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2558  "deduced as %1 in declaration of %2 and "
2559  "deduced as %3 in declaration of %4">;
2560def err_auto_non_deduced_not_alone : Error<
2561  "%select{function with deduced return type|"
2562  "declaration with trailing return type}0 "
2563  "must be the only declaration in its group">;
2564def err_implied_std_initializer_list_not_found : Error<
2565  "cannot deduce type of initializer list because std::initializer_list was "
2566  "not found; include <initializer_list>">;
2567def err_malformed_std_initializer_list : Error<
2568  "std::initializer_list must be a class template with a single type parameter">;
2569def err_auto_init_list_from_c : Error<
2570  "cannot use %select{'auto'|<ERROR>|'__auto_type'}0 with "
2571  "%select{initializer list|array}1 in C">;
2572def err_auto_bitfield : Error<
2573  "cannot pass bit-field as __auto_type initializer in C">;
2574
2575// C++1y decltype(auto) type
2576def err_decltype_auto_invalid : Error<
2577  "'decltype(auto)' not allowed here">;
2578def err_decltype_auto_cannot_be_combined : Error<
2579  "'decltype(auto)' cannot be combined with other type specifiers">;
2580def err_decltype_auto_function_declarator_not_declaration : Error<
2581  "'decltype(auto)' can only be used as a return type "
2582  "in a function declaration">;
2583def err_decltype_auto_compound_type : Error<
2584  "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2585def err_decltype_auto_initializer_list : Error<
2586  "cannot deduce 'decltype(auto)' from initializer list">;
2587
2588// C++17 deduced class template specialization types
2589def err_deduced_class_template_compound_type : Error<
2590  "cannot %select{form pointer to|form reference to|form array of|"
2591  "form function returning|use parentheses when declaring variable with}0 "
2592  "deduced class template specialization type">;
2593def err_deduced_non_class_or_alias_template_specialization_type : Error<
2594  "%select{<error>|function template|variable template|alias template|"
2595  "template template parameter|concept|template}0 %1 requires template "
2596  "arguments; argument deduction only allowed for class templates or alias "
2597  "templates">;
2598def err_deduced_class_template_ctor_ambiguous : Error<
2599  "ambiguous deduction for template arguments of %0">;
2600def err_deduced_class_template_ctor_no_viable : Error<
2601  "no viable constructor or deduction guide for deduction of "
2602  "template arguments of %0">;
2603def err_deduced_class_template_incomplete : Error<
2604  "template %0 has no definition and no %select{|viable }1deduction guides "
2605  "for deduction of template arguments">;
2606def err_deduced_class_template_deleted : Error<
2607  "class template argument deduction for %0 selected a deleted constructor">;
2608def err_deduced_class_template_explicit : Error<
2609  "class template argument deduction for %0 selected an explicit "
2610  "%select{constructor|deduction guide}1 for copy-list-initialization">;
2611def err_deduction_guide_no_trailing_return_type : Error<
2612  "deduction guide declaration without trailing return type">;
2613def err_deduction_guide_bad_trailing_return_type : Error<
2614  "deduced type %1 of deduction guide is not %select{|written as }2"
2615  "a specialization of template %0">;
2616def err_deduction_guide_with_complex_decl : Error<
2617  "cannot specify any part of a return type in the "
2618  "declaration of a deduction guide">;
2619def err_deduction_guide_invalid_specifier : Error<
2620  "deduction guide cannot be declared '%0'">;
2621def err_deduction_guide_name_not_class_template : Error<
2622  "cannot specify deduction guide for "
2623  "%select{<error>|function template|variable template|alias template|"
2624  "template template parameter|concept|dependent template name}0 %1">;
2625def err_deduction_guide_wrong_scope : Error<
2626  "deduction guide must be declared in the same scope as template %q0">;
2627def err_deduction_guide_defines_function : Error<
2628  "deduction guide cannot have a function definition">;
2629def err_deduction_guide_redeclared : Error<
2630  "redeclaration of deduction guide">;
2631def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2632  "%select{explicitly instantiated|explicitly specialized}0">;
2633def err_deduction_guide_template_not_deducible : Error<
2634  "deduction guide template contains "
2635  "%select{a template parameter|template parameters}0 that cannot be "
2636  "deduced">;
2637def err_deduction_guide_wrong_access : Error<
2638  "deduction guide has different access from the corresponding "
2639  "member template">;
2640def note_deduction_guide_template_access : Note<
2641  "member template declared %0 here">;
2642def note_deduction_guide_access : Note<
2643  "deduction guide declared %0 by intervening access specifier">;
2644def warn_cxx14_compat_class_template_argument_deduction : Warning<
2645  "class template argument deduction is incompatible with C++ standards "
2646  "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2647  InGroup<CXXPre17Compat>, DefaultIgnore;
2648def warn_ctad_maybe_unsupported : Warning<
2649  "%0 may not intend to support class template argument deduction">,
2650  InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2651def note_suppress_ctad_maybe_unsupported : Note<
2652  "add a deduction guide to suppress this warning">;
2653
2654
2655// C++14 deduced return types
2656def err_auto_fn_deduction_failure : Error<
2657  "cannot deduce return type %0 from returned value of type %1">;
2658def err_auto_fn_different_deductions : Error<
2659  "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2660  "deduced as %2 in earlier return statement">;
2661def err_auto_fn_used_before_defined : Error<
2662  "function %0 with deduced return type cannot be used before it is defined">;
2663def err_auto_fn_no_return_but_not_auto : Error<
2664  "cannot deduce return type %0 for function with no return statements">;
2665def err_auto_fn_return_void_but_not_auto : Error<
2666  "cannot deduce return type %0 from omitted return expression">;
2667def err_auto_fn_return_init_list : Error<
2668  "cannot deduce return type from initializer list">;
2669def err_auto_fn_virtual : Error<
2670  "function with deduced return type cannot be virtual">;
2671def warn_cxx11_compat_deduced_return_type : Warning<
2672  "return type deduction is incompatible with C++ standards before C++14">,
2673  InGroup<CXXPre14Compat>, DefaultIgnore;
2674
2675// C++11 override control
2676def override_keyword_only_allowed_on_virtual_member_functions : Error<
2677  "only virtual member functions can be marked '%0'">;
2678def override_keyword_hides_virtual_member_function : Error<
2679  "non-virtual member function marked '%0' hides virtual member "
2680  "%select{function|functions}1">;
2681def err_function_marked_override_not_overriding : Error<
2682  "%0 marked 'override' but does not override any member functions">;
2683def warn_destructor_marked_not_override_overriding : TextSubstitution <
2684  "%0 overrides a destructor but is not marked 'override'">;
2685def warn_function_marked_not_override_overriding : TextSubstitution <
2686  "%0 overrides a member function but is not marked 'override'">;
2687def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2688  "%sub{warn_destructor_marked_not_override_overriding}0">,
2689  InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2690def warn_inconsistent_function_marked_not_override_overriding : Warning <
2691  "%sub{warn_function_marked_not_override_overriding}0">,
2692  InGroup<CXX11WarnInconsistentOverrideMethod>;
2693def warn_suggest_destructor_marked_not_override_overriding : Warning <
2694  "%sub{warn_destructor_marked_not_override_overriding}0">,
2695  InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2696def warn_suggest_function_marked_not_override_overriding : Warning <
2697  "%sub{warn_function_marked_not_override_overriding}0">,
2698  InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2699def err_class_marked_final_used_as_base : Error<
2700  "base %0 is marked '%select{final|sealed}1'">;
2701def warn_abstract_final_class : Warning<
2702  "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2703def warn_final_dtor_non_final_class : Warning<
2704  "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2705  InGroup<FinalDtorNonFinalClass>;
2706def note_final_dtor_non_final_class_silence : Note<
2707  "mark %0 as '%select{final|sealed}1' to silence this warning">;
2708
2709// C++11 attributes
2710def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2711
2712// C++11 final
2713def err_final_function_overridden : Error<
2714  "declaration of %0 overrides a '%select{final|sealed}1' function">;
2715
2716// C++11 scoped enumerations
2717def err_enum_invalid_underlying : Error<
2718  "%select{non-integral type %0|%0}1 is an invalid underlying type">;
2719def err_enumerator_too_large : Error<
2720  "enumerator value is not representable in the underlying type %0">;
2721def ext_enumerator_too_large : Extension<
2722  "enumerator value is not representable in the underlying type %0">,
2723  InGroup<MicrosoftEnumValue>;
2724def err_enumerator_wrapped : Error<
2725  "enumerator value %0 is not representable in the underlying type %1">;
2726def err_enum_redeclare_type_mismatch : Error<
2727  "enumeration redeclared with different underlying type %0 (was %1)">;
2728def err_enum_redeclare_fixed_mismatch : Error<
2729  "enumeration previously declared with %select{non|}0fixed underlying type">;
2730def err_enum_redeclare_scoped_mismatch : Error<
2731  "enumeration previously declared as %select{un|}0scoped">;
2732def err_only_enums_have_underlying_types : Error<
2733  "only enumeration types have underlying types">;
2734def err_underlying_type_of_incomplete_enum : Error<
2735  "cannot determine underlying type of incomplete enumeration type %0">;
2736
2737// C++11 delegating constructors
2738def err_delegating_ctor : Error<
2739  "delegating constructors are permitted only in C++11">;
2740def warn_cxx98_compat_delegating_ctor : Warning<
2741  "delegating constructors are incompatible with C++98">,
2742  InGroup<CXX98Compat>, DefaultIgnore;
2743def err_delegating_initializer_alone : Error<
2744  "an initializer for a delegating constructor must appear alone">;
2745def warn_delegating_ctor_cycle : Warning<
2746  "constructor for %0 creates a delegation cycle">, DefaultError,
2747  InGroup<DelegatingCtorCycles>;
2748def note_it_delegates_to : Note<"it delegates to">;
2749def note_which_delegates_to : Note<"which delegates to">;
2750
2751// C++11 range-based for loop
2752def err_for_range_decl_must_be_var : Error<
2753  "for range declaration must declare a variable">;
2754def err_for_range_storage_class : Error<
2755  "loop variable %0 may not be declared %select{'extern'|'static'|"
2756  "'__private_extern__'|'auto'|'register'|'constexpr'|'thread_local'}1">;
2757def err_type_defined_in_for_range : Error<
2758  "types may not be defined in a for range declaration">;
2759def err_for_range_deduction_failure : Error<
2760  "cannot use type %0 as a range">;
2761def err_for_range_incomplete_type : Error<
2762  "cannot use incomplete type %0 as a range">;
2763def err_for_range_iter_deduction_failure : Error<
2764  "cannot use type %0 as an iterator">;
2765def ext_for_range_begin_end_types_differ : ExtWarn<
2766  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2767  InGroup<CXX17>;
2768def warn_for_range_begin_end_types_differ : Warning<
2769  "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2770  "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2771def note_in_for_range: Note<
2772  "when looking up '%select{begin|end}0' function for range expression "
2773  "of type %1">;
2774def err_for_range_invalid: Error<
2775  "invalid range expression of type %0; no viable '%select{begin|end}1' "
2776  "function available">;
2777def note_for_range_member_begin_end_ignored : Note<
2778  "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2779def err_range_on_array_parameter : Error<
2780  "cannot build range expression with array function parameter %0 since "
2781  "parameter with array type %1 is treated as pointer type %2">;
2782def err_for_range_dereference : Error<
2783  "invalid range expression of type %0; did you mean to dereference it "
2784  "with '*'?">;
2785def note_for_range_invalid_iterator : Note <
2786  "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2787def note_for_range_begin_end : Note<
2788  "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2789def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2790  "loop variable %0 "
2791  "%diff{of type $ binds to a temporary constructed from type $"
2792  "|binds to a temporary constructed from a different type}1,2">,
2793  InGroup<RangeLoopConstruct>, DefaultIgnore;
2794def note_use_type_or_non_reference : Note<
2795  "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2796def warn_for_range_ref_binds_ret_temp : Warning<
2797  "loop variable %0 binds to a temporary value produced by a range of type %1">,
2798  InGroup<RangeLoopBindReference>, DefaultIgnore;
2799def note_use_non_reference_type : Note<"use non-reference type %0">;
2800def warn_for_range_copy : Warning<
2801  "loop variable %0 creates a copy from type %1">,
2802  InGroup<RangeLoopConstruct>, DefaultIgnore;
2803def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2804def err_objc_for_range_init_stmt : Error<
2805  "initialization statement is not supported when iterating over Objective-C "
2806  "collection">;
2807
2808// C++11 constexpr
2809def warn_cxx98_compat_constexpr : Warning<
2810  "'constexpr' specifier is incompatible with C++98">,
2811  InGroup<CXX98Compat>, DefaultIgnore;
2812// FIXME: Maybe this should also go in -Wc++14-compat?
2813def warn_cxx14_compat_constexpr_not_const : Warning<
2814  "'constexpr' non-static member function will not be implicitly 'const' "
2815  "in C++14; add 'const' to avoid a change in behavior">,
2816  InGroup<DiagGroup<"constexpr-not-const">>;
2817def err_invalid_consteval_take_address : Error<
2818  "cannot take address of %select{immediate|consteval}2 "
2819  "%select{function|call operator of}1 %0 outside"
2820  " of an immediate invocation">;
2821def err_invalid_consteval_call : Error<
2822  "call to %select{immediate|consteval}1 function "
2823  "%q0 is not a constant expression">;
2824
2825def err_immediate_function_used_before_definition : Error<
2826  "immediate function %0 used before it is defined">;
2827
2828def note_immediate_function_reason : Note<
2829  "%0 is an immediate %select{function|constructor}5 because "
2830  "%select{its body|the%select{| default}7 initializer of %8}6 "
2831  "%select{evaluates the address of %select{an immediate|a consteval}2 "
2832  "function %1|contains a call to %select{an immediate|a consteval}2 "
2833  "%select{function|constructor}4 %1 and that call is not a constant "
2834  "expression}3">;
2835
2836def note_invalid_consteval_initializer : Note<
2837  "in the default initializer of %0">;
2838def note_invalid_consteval_initializer_here : Note<
2839  "initialized here %0">;
2840def err_invalid_consteval_decl_kind : Error<
2841  "%0 cannot be declared consteval">;
2842def err_invalid_constexpr : Error<
2843  "%select{function parameter|typedef}0 "
2844  "cannot be %sub{select_constexpr_spec_kind}1">;
2845def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2846  "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2847def err_constexpr_tag : Error<
2848  "%select{class|struct|interface|union|enum|enum class|enum struct}0 "
2849  "cannot be marked %sub{select_constexpr_spec_kind}1">;
2850def err_constexpr_dtor : Error<
2851  "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2852def err_constexpr_dtor_subobject : Error<
2853  "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2854  "%select{data member %2|base class %3}1 does not have a "
2855  "constexpr destructor">;
2856def note_constexpr_dtor_subobject : Note<
2857  "%select{data member %1|base class %2}0 declared here">;
2858def err_constexpr_wrong_decl_kind : Error<
2859  "%sub{select_constexpr_spec_kind}0 can only be used "
2860  "in %select{|variable and function|function|variable}0 declarations">;
2861def err_invalid_constexpr_var_decl : Error<
2862  "constexpr variable declaration must be a definition">;
2863def err_constexpr_static_mem_var_requires_init : Error<
2864  "declaration of constexpr static data member %0 requires an initializer">;
2865def err_constexpr_var_non_literal : Error<
2866  "constexpr variable cannot have non-literal type %0">;
2867def err_constexpr_var_requires_const_init : Error<
2868  "constexpr variable %0 must be initialized by a constant expression">;
2869def err_constexpr_var_requires_const_destruction : Error<
2870  "constexpr variable %0 must have constant destruction">;
2871def err_constexpr_redecl_mismatch : Error<
2872  "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2873  " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2874def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2875def warn_cxx17_compat_constexpr_virtual : Warning<
2876  "virtual constexpr functions are incompatible with "
2877  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2878def err_constexpr_virtual_base : Error<
2879  "constexpr %select{member function|constructor}0 not allowed in "
2880  "%select{struct|interface|class}1 with virtual base "
2881  "%plural{1:class|:classes}2">;
2882def note_non_literal_incomplete : Note<
2883  "incomplete type %0 is not a literal type">;
2884def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2885  "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2886def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2887def err_constexpr_non_literal_return : Error<
2888  "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2889def err_constexpr_non_literal_param : Error<
2890  "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2891  "not a literal type">;
2892def err_constexpr_body_invalid_stmt : Error<
2893  "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2894def ext_constexpr_body_invalid_stmt : ExtWarn<
2895  "use of this statement in a constexpr %select{function|constructor}0 "
2896  "is a C++14 extension">, InGroup<CXX14>;
2897def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2898  "use of this statement in a constexpr %select{function|constructor}0 "
2899  "is incompatible with C++ standards before C++14">,
2900  InGroup<CXXPre14Compat>, DefaultIgnore;
2901def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2902  "use of this statement in a constexpr %select{function|constructor}0 "
2903  "is a C++20 extension">, InGroup<CXX20>;
2904def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2905  "use of this statement in a constexpr %select{function|constructor}0 "
2906  "is incompatible with C++ standards before C++20">,
2907  InGroup<CXXPre20Compat>, DefaultIgnore;
2908def ext_constexpr_body_invalid_stmt_cxx23 : ExtWarn<
2909  "use of this statement in a constexpr %select{function|constructor}0 "
2910  "is a C++23 extension">, InGroup<CXX23>;
2911def warn_cxx20_compat_constexpr_body_invalid_stmt : Warning<
2912  "use of this statement in a constexpr %select{function|constructor}0 "
2913  "is incompatible with C++ standards before C++23">,
2914  InGroup<CXXPre23Compat>, DefaultIgnore;
2915def ext_constexpr_type_definition : ExtWarn<
2916  "type definition in a constexpr %select{function|constructor}0 "
2917  "is a C++14 extension">, InGroup<CXX14>;
2918def warn_cxx11_compat_constexpr_type_definition : Warning<
2919  "type definition in a constexpr %select{function|constructor}0 "
2920  "is incompatible with C++ standards before C++14">,
2921  InGroup<CXXPre14Compat>, DefaultIgnore;
2922def err_constexpr_vla : Error<
2923  "variably-modified type %0 cannot be used in a constexpr "
2924  "%select{function|constructor}1">;
2925def ext_constexpr_local_var : ExtWarn<
2926  "variable declaration in a constexpr %select{function|constructor}0 "
2927  "is a C++14 extension">, InGroup<CXX14>;
2928def warn_cxx11_compat_constexpr_local_var : Warning<
2929  "variable declaration in a constexpr %select{function|constructor}0 "
2930  "is incompatible with C++ standards before C++14">,
2931  InGroup<CXXPre14Compat>, DefaultIgnore;
2932def ext_constexpr_static_var : ExtWarn<
2933  "definition of a %select{static|thread_local}1 variable "
2934  "in a constexpr %select{function|constructor}0 "
2935  "is a C++23 extension">, InGroup<CXX23>;
2936def warn_cxx20_compat_constexpr_var : Warning<
2937  "definition of a %select{static variable|thread_local variable|variable "
2938  "of non-literal type}1 in a constexpr %select{function|constructor}0 "
2939  "is incompatible with C++ standards before C++23">,
2940  InGroup<CXXPre23Compat>, DefaultIgnore;
2941def err_constexpr_local_var_non_literal_type : Error<
2942  "variable of non-literal type %1 cannot be defined in a constexpr "
2943  "%select{function|constructor}0 before C++23">;
2944def ext_constexpr_local_var_no_init : ExtWarn<
2945  "uninitialized variable in a constexpr %select{function|constructor}0 "
2946  "is a C++20 extension">, InGroup<CXX20>;
2947def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2948  "uninitialized variable in a constexpr %select{function|constructor}0 "
2949  "is incompatible with C++ standards before C++20">,
2950  InGroup<CXXPre20Compat>, DefaultIgnore;
2951def ext_constexpr_function_never_constant_expr : ExtWarn<
2952  "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2953  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2954def err_attr_cond_never_constant_expr : Error<
2955  "%0 attribute expression never produces a constant expression">;
2956def err_diagnose_if_unknown_warning : Error<"unknown warning group '%0'">;
2957def err_diagnose_if_invalid_diagnostic_type : Error<
2958  "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2959  "instead">;
2960def err_diagnose_if_unknown_option : Error<"unknown diagnostic option">;
2961def err_diagnose_if_expected_equals : Error<
2962  "expected '=' after diagnostic option">;
2963def err_diagnose_if_unexpected_value : Error<
2964  "unexpected value; use 'true' or 'false'">;
2965def err_constexpr_body_no_return : Error<
2966  "no return statement in %select{constexpr|consteval}0 function">;
2967def err_constexpr_return_missing_expr : Error<
2968  "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2969def warn_cxx11_compat_constexpr_body_no_return : Warning<
2970  "constexpr function with no return statements is incompatible with C++ "
2971  "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2972def ext_constexpr_body_multiple_return : ExtWarn<
2973  "multiple return statements in constexpr function is a C++14 extension">,
2974  InGroup<CXX14>;
2975def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2976  "multiple return statements in constexpr function "
2977  "is incompatible with C++ standards before C++14">,
2978  InGroup<CXXPre14Compat>, DefaultIgnore;
2979def note_constexpr_body_previous_return : Note<
2980  "previous return statement is here">;
2981def err_ms_constexpr_cannot_be_applied : Error<
2982  "attribute 'msvc::constexpr' cannot be applied to the %select{constexpr|consteval|virtual}0 function %1">;
2983
2984// C++20 function try blocks in constexpr
2985def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2986  "function try block in constexpr %select{function|constructor}0 is "
2987  "a C++20 extension">, InGroup<CXX20>;
2988def warn_cxx17_compat_constexpr_function_try_block : Warning<
2989  "function try block in constexpr %select{function|constructor}0 is "
2990  "incompatible with C++ standards before C++20">,
2991  InGroup<CXXPre20Compat>, DefaultIgnore;
2992
2993def ext_constexpr_union_ctor_no_init : ExtWarn<
2994  "constexpr union constructor that does not initialize any member "
2995  "is a C++20 extension">, InGroup<CXX20>;
2996def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2997  "constexpr union constructor that does not initialize any member "
2998  "is incompatible with C++ standards before C++20">,
2999  InGroup<CXXPre20Compat>, DefaultIgnore;
3000def ext_constexpr_ctor_missing_init : ExtWarn<
3001  "constexpr constructor that does not initialize all members "
3002  "is a C++20 extension">, InGroup<CXX20>;
3003def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
3004  "constexpr constructor that does not initialize all members "
3005  "is incompatible with C++ standards before C++20">,
3006  InGroup<CXXPre20Compat>, DefaultIgnore;
3007def note_constexpr_ctor_missing_init : Note<
3008  "member not initialized by constructor">;
3009def note_non_literal_no_constexpr_ctors : Note<
3010  "%0 is not literal because it is not an aggregate and has no constexpr "
3011  "constructors other than copy or move constructors">;
3012def note_non_literal_base_class : Note<
3013  "%0 is not literal because it has base class %1 of non-literal type">;
3014def note_non_literal_field : Note<
3015  "%0 is not literal because it has data member %1 of "
3016  "%select{non-literal|volatile}3 type %2">;
3017def note_non_literal_user_provided_dtor : Note<
3018  "%0 is not literal because it has a user-provided destructor">;
3019def note_non_literal_nontrivial_dtor : Note<
3020  "%0 is not literal because it has a non-trivial destructor">;
3021def note_non_literal_non_constexpr_dtor : Note<
3022  "%0 is not literal because its destructor is not constexpr">;
3023def note_non_literal_lambda : Note<
3024  "lambda closure types are non-literal types before C++17">;
3025def warn_private_extern : Warning<
3026  "use of __private_extern__ on a declaration may not produce external symbol "
3027  "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
3028def note_private_extern : Note<
3029  "use __attribute__((visibility(\"hidden\"))) attribute instead">;
3030
3031// C23 constexpr
3032def err_c23_constexpr_not_variable : Error<
3033  "'constexpr' can only be used in variable declarations">;
3034def err_c23_constexpr_invalid_type : Error<
3035  "constexpr variable cannot have type %0">;
3036def err_c23_constexpr_init_not_representable : Error<
3037  "constexpr initializer evaluates to %0 which is not exactly representable in type %1">;
3038def err_c23_constexpr_init_type_mismatch : Error<
3039  "constexpr initializer for type %0 is of type %1">;
3040def err_c23_constexpr_pointer_not_null : Error<
3041  "constexpr pointer initializer is not null">;
3042
3043// C++ Concepts
3044def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
3045  "concept declarations may only appear in global or namespace scope">;
3046def err_concept_no_parameters : Error<
3047  "concept template parameter list must have at least one parameter; explicit "
3048  "specialization of concepts is not allowed">;
3049def err_concept_extra_headers : Error<
3050  "extraneous template parameter list in concept definition">;
3051def err_recursive_concept : Error<
3052  "a concept definition cannot refer to itself">;
3053def err_concept_no_associated_constraints : Error<
3054  "concept cannot have associated constraints">;
3055def err_non_constant_constraint_expression : Error<
3056  "substitution into constraint expression resulted in a non-constant "
3057  "expression">;
3058def err_non_bool_atomic_constraint : Error<
3059  "atomic constraint must be of type 'bool' (found %0)">;
3060def err_template_arg_list_constraints_not_satisfied : Error<
3061  "constraints not satisfied for %select{class template|function template|variable template|alias template|"
3062  "template template parameter|template}0 %1%2">;
3063def note_substituted_constraint_expr_is_ill_formed : Note<
3064  "because substituted constraint expression is ill-formed%0">;
3065def note_constraint_references_error
3066    : Note<"constraint depends on a previously diagnosed expression">;
3067def note_atomic_constraint_evaluated_to_false : Note<
3068  "%select{and|because}0 '%1' evaluated to false">;
3069def note_concept_specialization_constraint_evaluated_to_false : Note<
3070  "%select{and|because}0 '%1' evaluated to false">;
3071def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
3072  "%select{and|because}0 %1 does not satisfy %2">;
3073def note_atomic_constraint_evaluated_to_false_elaborated : Note<
3074  "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
3075def note_is_deducible_constraint_evaluated_to_false : Note<
3076  "cannot deduce template arguments for %0 from %1">;
3077def err_constrained_virtual_method : Error<
3078  "virtual function cannot have a requires clause">;
3079def err_constrained_non_templated_function
3080    : Error<"non-templated function cannot have a requires clause">;
3081def err_non_temp_spec_requires_clause : Error<
3082  "%select{explicit|friend}0 specialization cannot have a trailing requires clause "
3083  "unless it declares a function template">;
3084def err_reference_to_function_with_unsatisfied_constraints : Error<
3085  "invalid reference to function %0: constraints not satisfied">;
3086def err_requires_expr_local_parameter_default_argument : Error<
3087  "default arguments not allowed for parameters of a requires expression">;
3088def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
3089  "constraint variable %0 cannot be used in an evaluated context">;
3090def note_expr_requirement_expr_substitution_error : Note<
3091  "%select{and|because}0 '%1' would be invalid: %2">;
3092def note_expr_requirement_expr_unknown_substitution_error : Note<
3093  "%select{and|because}0 '%1' would be invalid">;
3094def note_expr_requirement_noexcept_not_met : Note<
3095  "%select{and|because}0 '%1' may throw an exception">;
3096def note_expr_requirement_type_requirement_substitution_error : Note<
3097  "%select{and|because}0 '%1' would be invalid: %2">;
3098def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
3099  "%select{and|because}0 '%1' would be invalid">;
3100def note_expr_requirement_constraints_not_satisfied : Note<
3101  "%select{and|because}0 type constraint '%1' was not satisfied:">;
3102def note_expr_requirement_constraints_not_satisfied_simple : Note<
3103  "%select{and|because}0 %1 does not satisfy %2:">;
3104def note_type_requirement_substitution_error : Note<
3105  "%select{and|because}0 '%1' would be invalid: %2">;
3106def note_type_requirement_unknown_substitution_error : Note<
3107  "%select{and|because}0 '%1' would be invalid">;
3108def note_nested_requirement_substitution_error : Note<
3109  "%select{and|because}0 '%1' would be invalid%2">;
3110def note_nested_requirement_unknown_substitution_error : Note<
3111  "%select{and|because}0 '%1' would be invalid">;
3112def note_ambiguous_atomic_constraints : Note<
3113  "similar constraint expressions not considered equivalent; constraint "
3114  "expressions cannot be considered equivalent unless they originate from the "
3115  "same concept">;
3116def note_ambiguous_atomic_constraints_similar_expression : Note<
3117  "similar constraint expression here">;
3118def err_unsupported_placeholder_constraint : Error<
3119  "constrained placeholder types other than simple 'auto' on non-type template "
3120  "parameters not supported yet">;
3121
3122def err_template_different_requires_clause : Error<
3123  "requires clause differs in template redeclaration">;
3124def err_template_different_type_constraint : Error<
3125  "type constraint differs in template redeclaration">;
3126def err_template_template_parameter_not_at_least_as_constrained : Error<
3127  "template template argument %0 is more constrained than template template "
3128  "parameter %1">;
3129
3130def err_type_constraint_non_type_concept : Error<
3131  "concept named in type constraint is not a type concept">;
3132def err_type_constraint_missing_arguments : Error<
3133  "%0 requires more than 1 template argument; provide the remaining arguments "
3134  "explicitly to use it here">;
3135def err_placeholder_constraints_not_satisfied : Error<
3136  "deduced type %0 does not satisfy %1">;
3137
3138// C++11 char16_t/char32_t
3139def warn_cxx98_compat_unicode_type : Warning<
3140  "'%0' type specifier is incompatible with C++98">,
3141  InGroup<CXX98Compat>, DefaultIgnore;
3142def warn_cxx17_compat_unicode_type : Warning<
3143  "'char8_t' type specifier is incompatible with C++ standards before C++20">,
3144  InGroup<CXXPre20Compat>, DefaultIgnore;
3145
3146// __make_integer_seq
3147def err_integer_sequence_negative_length : Error<
3148  "integer sequences must have non-negative sequence length">;
3149def err_integer_sequence_integral_element_type : Error<
3150  "integer sequences must have integral element type">;
3151
3152// __type_pack_element
3153def err_type_pack_element_out_of_bounds : Error<
3154  "a parameter pack may not be accessed at an out of bounds index">;
3155
3156// Objective-C++
3157def err_objc_decls_may_only_appear_in_global_scope : Error<
3158  "Objective-C declarations may only appear in global scope">;
3159def warn_auto_var_is_id : Warning<
3160  "'auto' deduced as 'id' in declaration of %0">,
3161  InGroup<DiagGroup<"auto-var-id">>;
3162
3163// Attributes
3164def warn_attribute_ignored_no_calls_in_stmt: Warning<
3165  "%0 attribute is ignored because there exists no call expression inside the "
3166  "statement">,
3167  InGroup<IgnoredAttributes>;
3168
3169def warn_attribute_ignored_non_function_pointer: Warning<
3170  "%0 attribute is ignored because %1 is not a function pointer">,
3171  InGroup<IgnoredAttributes>;
3172
3173def warn_function_attribute_ignored_in_stmt : Warning<
3174  "attribute is ignored on this statement as it only applies to functions; "
3175  "use '%0' on statements">,
3176  InGroup<IgnoredAttributes>;
3177
3178def err_musttail_needs_trivial_args : Error<
3179  "tail call requires that the return value, all parameters, and any "
3180  "temporaries created by the expression are trivially destructible">;
3181def err_musttail_needs_call : Error<
3182  "%0 attribute requires that the return value is the result of a function call"
3183  >;
3184def err_musttail_needs_prototype : Error<
3185  "%0 attribute requires that both caller and callee functions have a "
3186  "prototype">;
3187def note_musttail_fix_non_prototype : Note<
3188  "add 'void' to the parameter list to turn an old-style K&R function "
3189  "declaration into a prototype">;
3190def err_musttail_structors_forbidden : Error<"cannot perform a tail call "
3191  "%select{from|to}0 a %select{constructor|destructor}1">;
3192def note_musttail_structors_forbidden : Note<"target "
3193  "%select{constructor|destructor}0 is declared here">;
3194def err_musttail_forbidden_from_this_context : Error<
3195  "%0 attribute cannot be used from "
3196  "%select{a block|an Objective-C function|this context}1">;
3197def err_musttail_member_mismatch : Error<
3198  "%select{non-member|static member|non-static member}0 "
3199  "function cannot perform a tail call to "
3200  "%select{non-member|static member|non-static member|pointer-to-member}1 "
3201  "function%select{| %3}2">;
3202def note_musttail_callee_defined_here : Note<"%0 declared here">;
3203def note_tail_call_required : Note<"tail call required by %0 attribute here">;
3204def err_musttail_mismatch : Error<
3205  "cannot perform a tail call to function%select{| %1}0 because its signature "
3206  "is incompatible with the calling function">;
3207def note_musttail_mismatch : Note<
3208    "target function "
3209    "%select{is a member of different class%diff{ (expected $ but has $)|}1,2"
3210    "|has different number of parameters (expected %1 but has %2)"
3211    "|has type mismatch at %ordinal3 parameter"
3212    "%diff{ (expected $ but has $)|}1,2"
3213    "|has different return type%diff{ ($ expected but has $)|}1,2}0">;
3214def err_musttail_callconv_mismatch : Error<
3215  "cannot perform a tail call to function%select{| %1}0 because it uses an "
3216  "incompatible calling convention">;
3217def note_musttail_callconv_mismatch : Note<
3218  "target function has calling convention %1 (expected %0)">;
3219def err_musttail_scope : Error<
3220  "cannot perform a tail call from this return statement">;
3221def err_musttail_no_variadic : Error<
3222  "%0 attribute may not be used with variadic functions">;
3223def err_musttail_no_return : Error<
3224  "%0 attribute may not be used with no-return-attribute functions">;
3225
3226def err_nsobject_attribute : Error<
3227  "'NSObject' attribute is for pointer types only">;
3228def err_attributes_are_not_compatible : Error<
3229  "%0 and %1%select{ attributes|}2 are not compatible">;
3230def err_attribute_invalid_argument : Error<
3231  "%select{a reference type|an array type|a non-vector or "
3232  "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
3233def err_attribute_wrong_number_arguments : Error<
3234  "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
3235  ":requires exactly %1 arguments}1">;
3236def err_attribute_wrong_number_arguments_for : Error <
3237  "%0 attribute references function %1, which %plural{0:takes no arguments|1:takes one argument|"
3238  ":takes exactly %2 arguments}2">;
3239def err_attribute_bounds_for_function : Error<
3240  "%0 attribute references parameter %1, but the function %2 has only %3 parameters">;
3241def err_attribute_no_member_function : Error<
3242  "%0 attribute cannot be applied to non-static member functions">;
3243def err_attribute_parameter_types : Error<
3244  "%0 attribute parameter types do not match: parameter %1 of function %2 has type %3, "
3245  "but parameter %4 of function %5 has type %6">;
3246
3247def err_attribute_too_many_arguments : Error<
3248  "%0 attribute takes no more than %1 argument%s1">;
3249def err_attribute_too_few_arguments : Error<
3250  "%0 attribute takes at least %1 argument%s1">;
3251def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
3252def err_attribute_invalid_bitint_vector_type : Error<
3253  "'_BitInt' %select{vector|matrix}0 element width must be %select{a power of 2|"
3254  "at least as wide as 'CHAR_BIT'}1">;
3255def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
3256def err_attribute_bad_neon_vector_size : Error<
3257  "Neon vector size must be 64 or 128 bits">;
3258def err_attribute_invalid_sve_type : Error<
3259  "%0 attribute applied to non-SVE type %1">;
3260def err_attribute_bad_sve_vector_size : Error<
3261  "invalid SVE vector size '%0', must match value set by "
3262  "'-msve-vector-bits' ('%1')">;
3263def err_attribute_arm_feature_sve_bits_unsupported : Error<
3264  "%0 is only supported when '-msve-vector-bits=<bits>' is specified with a "
3265  "value of 128, 256, 512, 1024 or 2048">;
3266def err_attribute_arm_sm_incompat_builtin : Error<
3267  "builtin can only be called from a %0 function">;
3268def warn_attribute_arm_za_builtin_no_za_state : Warning<
3269  "builtin call is not valid when calling from a function without active ZA state">,
3270  InGroup<DiagGroup<"undefined-arm-za">>;
3271def warn_attribute_arm_zt0_builtin_no_zt0_state : Warning<
3272  "builtin call is not valid when calling from a function without active ZT0 state">,
3273  InGroup<DiagGroup<"undefined-arm-zt0">>;
3274def err_sve_vector_in_non_sve_target : Error<
3275  "SVE vector type %0 cannot be used in a target without sve">;
3276def err_sve_vector_in_non_streaming_function : Error<
3277  "SVE vector type %0 cannot be used in a non-streaming function">;
3278def err_attribute_riscv_rvv_bits_unsupported : Error<
3279  "%0 is only supported when '-mrvv-vector-bits=<bits>' is specified with a "
3280  "value of \"zvl\" or a power 2 in the range [64,65536]">;
3281def err_attribute_bad_rvv_vector_size : Error<
3282  "invalid RVV vector size '%0', expected size is '%1' based on LMUL of type "
3283  "and '-mrvv-vector-bits'">;
3284def err_attribute_invalid_rvv_type : Error<
3285  "%0 attribute applied to non-RVV type %1">;
3286def err_attribute_requires_positive_integer : Error<
3287  "%0 attribute requires a %select{positive|non-negative}1 "
3288  "integral compile time constant expression">;
3289def err_attribute_requires_opencl_version : Error<
3290  "attribute %0 is supported in the OpenCL version %1%select{| onwards}2">;
3291def err_invalid_branch_protection_spec : Error<
3292  "invalid or misplaced branch protection specification '%0'">;
3293def warn_unsupported_branch_protection_spec : Warning<
3294  "unsupported branch protection specification '%0'">, InGroup<BranchProtection>;
3295
3296def warn_unsupported_target_attribute
3297    : Warning<"%select{unsupported|duplicate|unknown}0%select{| CPU|"
3298              " tune CPU}1 '%2' in the '%select{target|target_clones|target_version}3' "
3299              "attribute string; '%select{target|target_clones|target_version}3' "
3300              "attribute ignored">,
3301      InGroup<IgnoredAttributes>;
3302def err_attribute_unsupported
3303    : Error<"%0 attribute is not supported on targets missing %1;"
3304            " specify an appropriate -march= or -mcpu=">;
3305def err_attribute_unsupported_m_profile
3306    : Error<"on M-profile architectures %0 attribute is not supported on targets missing %1;"
3307            " specify an appropriate -march= or -mcpu=">;
3308def err_duplicate_target_attribute
3309    : Error<"%select{unsupported|duplicate|unknown}0%select{| CPU|"
3310              " tune CPU}1 '%2' in the '%select{target|target_clones|target_version}3' "
3311              "attribute string;">;
3312// The err_*_attribute_argument_not_int are separate because they're used by
3313// VerifyIntegerConstantExpression.
3314def err_aligned_attribute_argument_not_int : Error<
3315  "'aligned' attribute requires integer constant">;
3316def err_align_value_attribute_argument_not_int : Error<
3317  "'align_value' attribute requires integer constant">;
3318def err_alignas_attribute_wrong_decl_type : Error<
3319  "%0 attribute cannot be applied to %select{a function parameter|"
3320  "a variable with 'register' storage class|a 'catch' variable|a bit-field|"
3321  "an enumeration}1">;
3322def err_alignas_missing_on_definition : Error<
3323  "%0 must be specified on definition if it is specified on any declaration">;
3324def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
3325def err_alignas_mismatch : Error<
3326  "redeclaration has different alignment requirement (%1 vs %0)">;
3327def err_alignas_underaligned : Error<
3328  "requested alignment is less than minimum alignment of %1 for type %0">;
3329def warn_aligned_attr_underaligned : Warning<err_alignas_underaligned.Summary>,
3330  InGroup<IgnoredAttributes>;
3331def err_attribute_sizeless_type : Error<
3332  "%0 attribute cannot be applied to sizeless type %1">;
3333def err_attribute_argument_n_type : Error<
3334  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
3335  "constant|a string|an identifier|a constant expression|a builtin function}2">;
3336def err_attribute_argument_type : Error<
3337  "%0 attribute requires %select{int or bool|an integer "
3338  "constant|a string|an identifier}1">;
3339def err_attribute_argument_out_of_range : Error<
3340  "%0 attribute requires integer constant between %1 and %2 inclusive">;
3341def err_init_priority_object_attr : Error<
3342  "can only use 'init_priority' attribute on file-scope definitions "
3343  "of objects of class type">;
3344def err_attribute_argument_out_of_bounds : Error<
3345  "%0 attribute parameter %1 is out of bounds">;
3346def err_attribute_only_once_per_parameter : Error<
3347  "%0 attribute can only be applied once per parameter">;
3348def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
3349def note_previous_uuid : Note<"previous uuid specified here">;
3350def warn_attribute_pointers_only : Warning<
3351  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
3352  InGroup<IgnoredAttributes>;
3353def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Summary>;
3354def err_attribute_integers_only : Error<
3355  "%0 attribute argument may only refer to a function parameter of integer "
3356  "type">;
3357def warn_attribute_return_pointers_only : Warning<
3358  "%0 attribute only applies to return values that are pointers">,
3359  InGroup<IgnoredAttributes>;
3360def warn_attribute_return_pointers_refs_only : Warning<
3361  "%0 attribute only applies to return values that are pointers or references">,
3362  InGroup<IgnoredAttributes>;
3363def warn_attribute_pointer_or_reference_only : Warning<
3364  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
3365  InGroup<IgnoredAttributes>;
3366def err_attribute_no_member_pointers : Error<
3367  "%0 attribute cannot be used with pointers to members">;
3368def err_attribute_invalid_implicit_this_argument : Error<
3369  "%0 attribute is invalid for the implicit this argument">;
3370def err_ownership_type : Error<
3371  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
3372def err_ownership_takes_return_type : Error<
3373  "'ownership_returns' attribute only applies to functions that return a pointer">;
3374def err_ownership_returns_index_mismatch : Error<
3375  "'ownership_returns' attribute index does not match; here it is %0">;
3376def note_ownership_returns_index_mismatch : Note<
3377  "declared with index %0 here">;
3378def err_ownership_takes_class_mismatch : Error<
3379  "'ownership_takes' attribute class does not match; here it is '%0'">;
3380def note_ownership_takes_class_mismatch : Note<
3381  "declared with class '%0' here">;
3382def err_format_strftime_third_parameter : Error<
3383  "strftime format attribute requires 3rd parameter to be 0">;
3384def err_format_attribute_not : Error<"format argument not a string type">;
3385def err_format_attribute_result_not : Error<"function does not return %0">;
3386def err_format_attribute_implicit_this_format_string : Error<
3387  "format attribute cannot specify the implicit this argument as the format "
3388  "string">;
3389def err_callback_attribute_no_callee : Error<
3390  "'callback' attribute specifies no callback callee">;
3391def err_callback_attribute_invalid_callee : Error<
3392  "'callback' attribute specifies invalid callback callee">;
3393def err_callback_attribute_multiple : Error<
3394  "multiple 'callback' attributes specified">;
3395def err_callback_attribute_argument_unknown : Error<
3396  "'callback' attribute argument %0 is not a known function parameter">;
3397def err_callback_callee_no_function_type : Error<
3398  "'callback' attribute callee does not have function type">;
3399def err_callback_callee_is_variadic : Error<
3400  "'callback' attribute callee may not be variadic">;
3401def err_callback_implicit_this_not_available : Error<
3402  "'callback' argument at position %0 references unavailable implicit 'this'">;
3403
3404def err_capture_by_attribute_multiple : Error<
3405  "multiple 'lifetime_capture' attributes specified">;
3406def err_capture_by_attribute_no_entity : Error<
3407  "'lifetime_capture_by' attribute specifies no capturing entity">;
3408def err_capture_by_implicit_this_not_available : Error<
3409  "'lifetime_capture_by' argument references unavailable implicit 'this'">;
3410def err_capture_by_attribute_argument_unknown : Error<
3411  "'lifetime_capture_by' attribute argument %0 is not a known function parameter"
3412  "; must be a function parameter, 'this', 'global' or 'unknown'">;
3413def err_capture_by_references_itself : Error<"'lifetime_capture_by' argument references itself">;
3414def err_capture_by_param_uses_reserved_name : Error<
3415  "parameter cannot be named '%select{global|unknown}0' while using 'lifetime_capture_by(%select{global|unknown}0)'">;
3416
3417def err_init_method_bad_return_type : Error<
3418  "init methods must return an object pointer type, not %0">;
3419def err_attribute_invalid_size : Error<
3420  "vector size not an integral multiple of component size">;
3421def err_attribute_zero_size : Error<"zero %0 size">;
3422def err_attribute_size_too_large : Error<"%0 size too large">;
3423def err_typecheck_sve_rvv_ambiguous : Error<
3424  "cannot combine fixed-length and sizeless %select{SVE|RVV}0 vectors "
3425  "in expression, result is ambiguous (%1 and %2)">;
3426def err_typecheck_sve_rvv_gnu_ambiguous : Error<
3427  "cannot combine GNU and %select{SVE|RVV}0 vectors in expression, result is ambiguous (%1 and %2)">;
3428def err_typecheck_vector_not_convertable_implict_truncation : Error<
3429   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
3430   " %2 as implicit conversion would cause truncation">;
3431def err_typecheck_vector_not_convertable : Error<
3432  "cannot convert between vector values of different size (%0 and %1)">;
3433def err_typecheck_vector_not_convertable_non_scalar : Error<
3434  "cannot convert between vector and non-scalar values (%0 and %1)">;
3435def err_typecheck_vector_lengths_not_equal : Error<
3436  "vector operands do not have the same number of elements (%0 and %1)">;
3437def warn_typecheck_vector_element_sizes_not_equal : Warning<
3438  "vector operands do not have the same elements sizes (%0 and %1)">,
3439  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
3440def err_ext_vector_component_exceeds_length : Error<
3441  "vector component access exceeds type %0">;
3442def err_ext_vector_component_name_illegal : Error<
3443  "illegal vector component name %0">;
3444def err_attribute_address_space_negative : Error<
3445  "address space is negative">;
3446def err_attribute_address_space_too_high : Error<
3447  "address space is larger than the maximum supported (%0)">;
3448def err_attribute_address_multiple_qualifiers : Error<
3449  "multiple address spaces specified for type">;
3450def warn_attribute_address_multiple_identical_qualifiers : Warning<
3451  "multiple identical address spaces specified for type">,
3452  InGroup<DuplicateDeclSpecifier>;
3453def err_attribute_not_clinkage : Error<
3454  "function type with %0 attribute must have C linkage">;
3455def err_function_decl_cmse_ns_call : Error<
3456  "functions may not be declared with 'cmse_nonsecure_call' attribute">;
3457def err_attribute_address_function_type : Error<
3458  "function type may not be qualified with an address space">;
3459def err_as_qualified_auto_decl : Error<
3460  "automatic variable qualified with an%select{| invalid}0 address space">;
3461def err_arg_with_address_space : Error<
3462  "parameter may not be qualified with an address space">;
3463def err_field_with_address_space : Error<
3464  "field may not be qualified with an address space">;
3465def err_compound_literal_with_address_space : Error<
3466  "compound literal in function scope may not be qualified with an address space">;
3467def err_compound_literal_with_vla_type : Error<
3468  "compound literal cannot be of variable-length array type">;
3469def err_address_space_mismatch_templ_inst : Error<
3470  "conflicting address space qualifiers are provided between types %0 and %1">;
3471def err_attr_objc_ownership_redundant : Error<
3472  "the type %0 is already explicitly ownership-qualified">;
3473def err_invalid_nsnumber_type : Error<
3474  "%0 is not a valid literal type for NSNumber">;
3475def err_objc_illegal_boxed_expression_type : Error<
3476  "illegal type %0 used in a boxed expression">;
3477def err_objc_non_trivially_copyable_boxed_expression_type : Error<
3478  "non-trivially copyable type %0 cannot be used in a boxed expression">;
3479def err_objc_incomplete_boxed_expression_type : Error<
3480  "incomplete type %0 used in a boxed expression">;
3481def err_undeclared_objc_literal_class : Error<
3482  "definition of class %0 must be available to use Objective-C "
3483  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
3484  "string literals}1">;
3485def err_undeclared_boxing_method : Error<
3486  "declaration of %0 is missing in %1 class">;
3487def err_objc_literal_method_sig : Error<
3488  "literal construction method %0 has incompatible signature">;
3489def note_objc_literal_method_param : Note<
3490  "%select{first|second|third}0 parameter has unexpected type %1 "
3491  "(should be %2)">;
3492def note_objc_literal_method_return : Note<
3493  "method returns unexpected type %0 (should be an object type)">;
3494def err_invalid_collection_element : Error<
3495  "collection element of type %0 is not an Objective-C object">;
3496def err_box_literal_collection : Error<
3497  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3498  "in a collection">;
3499def warn_objc_literal_comparison : Warning<
3500  "direct comparison of %select{an array literal|a dictionary literal|"
3501  "a numeric literal|a boxed expression|}0 has undefined behavior">,
3502  InGroup<ObjCLiteralComparison>;
3503def err_missing_atsign_prefix : Error<
3504  "%select{string|numeric}0 literal must be prefixed by '@'">;
3505def warn_objc_string_literal_comparison : Warning<
3506  "direct comparison of a string literal has undefined behavior">,
3507  InGroup<ObjCStringComparison>;
3508def warn_concatenated_literal_array_init : Warning<
3509  "suspicious concatenation of string literals in an array initialization; "
3510  "did you mean to separate the elements with a comma?">,
3511  InGroup<StringConcatation>, DefaultIgnore;
3512def warn_concatenated_nsarray_literal : Warning<
3513  "concatenated NSString literal for an NSArray expression - "
3514  "possibly missing a comma">,
3515  InGroup<ObjCStringConcatenation>;
3516def note_objc_literal_comparison_isequal : Note<
3517  "use 'isEqual:' instead">;
3518def warn_objc_collection_literal_element : Warning<
3519  "object of type %0 is not compatible with "
3520  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3521  InGroup<ObjCLiteralConversion>;
3522def warn_nsdictionary_duplicate_key : Warning<
3523  "duplicate key in dictionary literal">,
3524  InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3525def note_nsdictionary_duplicate_key_here : Note<
3526  "previous equal key is here">;
3527def err_swift_param_attr_not_swiftcall : Error<
3528  "'%0' parameter can only be used with swiftcall%select{ or swiftasynccall|}1 "
3529  "calling convention%select{|s}1">;
3530def err_swift_indirect_result_not_first : Error<
3531  "'swift_indirect_result' parameters must be first parameters of function">;
3532def err_swift_error_result_not_after_swift_context : Error<
3533  "'swift_error_result' parameter must follow 'swift_context' parameter">;
3534def err_swift_abi_parameter_wrong_type : Error<
3535  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3536  "type here is %2">;
3537
3538def err_attribute_argument_invalid : Error<
3539  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3540  "min must not be greater than max}1">;
3541def err_attribute_argument_is_zero : Error<
3542  "%0 attribute must be greater than 0">;
3543def warn_attribute_argument_n_negative : Warning<
3544  "%0 attribute parameter %1 is negative and will be ignored">,
3545  InGroup<CudaCompat>;
3546def err_property_function_in_objc_container : Error<
3547  "use of Objective-C property in function nested in Objective-C "
3548  "container not supported, move function outside its container">;
3549
3550let CategoryName = "Cocoa API Issue" in {
3551def warn_objc_redundant_literal_use : Warning<
3552  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3553}
3554
3555def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3556  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3557
3558def err_attr_codemodel_arg : Error<"code model '%0' is not supported on this target">;
3559
3560def err_aix_attr_unsupported : Error<"%0 attribute is not yet supported on AIX">;
3561
3562def err_tls_var_aligned_over_maximum : Error<
3563  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3564  "alignment (%2) for a thread-local variable on this target">;
3565
3566def err_only_annotate_after_access_spec : Error<
3567  "access specifier can only have annotation attributes">;
3568
3569def err_attribute_section_invalid_for_target : Error<
3570  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3571def err_pragma_section_invalid_for_target : Error<
3572  "argument to #pragma section is not valid for this target: %0">;
3573def warn_attribute_section_drectve : Warning<
3574  "#pragma %0(\".drectve\") has undefined behavior, "
3575  "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3576def warn_mismatched_section : Warning<
3577  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3578def warn_attribute_section_on_redeclaration : Warning<
3579  "section attribute is specified on redeclared variable">, InGroup<Section>;
3580def err_mismatched_code_seg_base : Error<
3581  "derived class must specify the same code segment as its base classes">;
3582def err_mismatched_code_seg_override : Error<
3583  "overriding virtual function must specify the same code segment as its overridden function">;
3584def err_conflicting_codeseg_attribute : Error<
3585  "conflicting code segment specifiers">;
3586def warn_duplicate_codeseg_attribute : Warning<
3587  "duplicate code segment specifiers">, InGroup<Section>;
3588
3589def err_anonymous_property: Error<
3590  "anonymous property is not supported">;
3591def err_property_is_variably_modified : Error<
3592  "property %0 has a variably modified type">;
3593def err_no_accessor_for_property : Error<
3594  "no %select{getter|setter}0 defined for property %1">;
3595def err_cannot_find_suitable_accessor : Error<
3596  "cannot find suitable %select{getter|setter}0 for property %1">;
3597
3598def warn_alloca : Warning<
3599  "use of function %0 is discouraged; there is no way to check for failure but "
3600  "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3601  InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3602
3603def warn_alloca_align_alignof : Warning<
3604  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3605  InGroup<DiagGroup<"alloca-with-align-alignof">>;
3606
3607def err_alignment_too_small : Error<
3608  "requested alignment must be %0 or greater">;
3609def err_alignment_too_big : Error<
3610  "requested alignment must be %0 or smaller">;
3611def err_alignment_not_power_of_two : Error<
3612  "requested alignment is not a power of 2">;
3613def warn_alignment_not_power_of_two : Warning<
3614  err_alignment_not_power_of_two.Summary>,
3615  InGroup<DiagGroup<"non-power-of-two-alignment">>;
3616def err_alignment_dependent_typedef_name : Error<
3617  "requested alignment is dependent but declaration is not dependent">;
3618def ext_c2y_alignof_incomplete_array : Extension<
3619  "'alignof' on an incomplete array type is a C2y extension">,
3620  InGroup<C2y>;
3621def warn_c2y_compat_alignof_incomplete_array : Warning<
3622  "'alignof' on an incomplete array type is incompatible with C standards "
3623  "before C2y">, InGroup<CPre2yCompat>, DefaultIgnore;
3624
3625def warn_alignment_builtin_useless : Warning<
3626  "%select{aligning a value|the result of checking whether a value is aligned}0"
3627  " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3628def err_attribute_aligned_too_great : Error<
3629  "requested alignment must be %0 bytes or smaller">;
3630def warn_assume_aligned_too_great
3631    : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3632              "alignment assumed">,
3633      InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3634def warn_not_xl_compatible
3635    : Warning<"alignment of 16 bytes for a struct member is not binary "
3636              "compatible with IBM XL C/C++ for AIX 16.1.0 or older">,
3637      InGroup<AIXCompat>;
3638def note_misaligned_member_used_here : Note<
3639    "passing byval argument %0 with potentially incompatible alignment here">;
3640def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3641  "%q0 redeclared without %1 attribute: previous %1 ignored">,
3642  InGroup<MicrosoftInconsistentDllImport>;
3643def warn_redeclaration_without_import_attribute : Warning<
3644  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3645  InGroup<MicrosoftInconsistentDllImport>;
3646def warn_dllimport_dropped_from_inline_function : Warning<
3647  "%q0 redeclared inline; %1 attribute ignored">,
3648  InGroup<IgnoredAttributes>;
3649def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3650  " exception specification; attribute ignored">,
3651  InGroup<IgnoredAttributes>;
3652def warn_attribute_ignored_on_non_definition :
3653  Warning<"%0 attribute ignored on a non-definition declaration">,
3654  InGroup<IgnoredAttributes>;
3655def warn_attribute_ignored_on_inline :
3656  Warning<"%0 attribute ignored on inline function">,
3657  InGroup<IgnoredAttributes>;
3658def warn_nocf_check_attribute_ignored :
3659  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3660  InGroup<IgnoredAttributes>;
3661def warn_attribute_after_definition_ignored : Warning<
3662  "attribute %0 after definition is ignored">,
3663   InGroup<IgnoredAttributes>;
3664def warn_attributes_likelihood_ifstmt_conflict
3665    : Warning<"conflicting attributes %0 are ignored">,
3666      InGroup<IgnoredAttributes>;
3667def warn_cxx11_gnu_attribute_on_type : Warning<
3668  "attribute %0 ignored, because it cannot be applied to a type">,
3669  InGroup<IgnoredAttributes>;
3670def warn_unhandled_ms_attribute_ignored : Warning<
3671  "__declspec attribute %0 is not supported">,
3672  InGroup<IgnoredAttributes>;
3673def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3674  "attribute %0 has no effect when annotating an infinite loop">,
3675   InGroup<IgnoredAttributes>;
3676def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3677  "annotating the infinite loop here">;
3678def warn_attribute_has_no_effect_on_compile_time_if : Warning<
3679  "attribute %0 has no effect when annotating an 'if %select{constexpr|consteval}1' statement">,
3680   InGroup<IgnoredAttributes>;
3681def note_attribute_has_no_effect_on_compile_time_if_here : Note<
3682  "annotating the 'if %select{constexpr|consteval}0' statement here">;
3683def err_decl_attribute_invalid_on_stmt : Error<
3684  "%0%select{ attribute|}1 cannot be applied to a statement">;
3685def err_attribute_invalid_on_decl : Error<
3686  "%0%select{ attribute|}1 cannot be applied to a declaration">;
3687def warn_type_attribute_deprecated_on_decl : Warning<
3688  "applying attribute %0 to a declaration is deprecated; apply it to the type instead">,
3689  InGroup<DeprecatedAttributes>;
3690def warn_declspec_attribute_ignored : Warning<
3691  "attribute %0 is ignored, place it after "
3692  "\"%select{class|struct|interface|union|enum|enum class|enum struct}1\" to apply attribute to "
3693  "type declaration">, InGroup<IgnoredAttributes>;
3694def err_declspec_keyword_has_no_effect : Error<
3695  "%0 cannot appear here, place it after "
3696  "\"%select{class|struct|interface|union|enum}1\" to apply it to the "
3697  "type declaration">;
3698def warn_attribute_precede_definition : Warning<
3699  "attribute declaration must precede definition">,
3700  InGroup<IgnoredAttributes>;
3701def warn_attribute_void_function_method : Warning<
3702  "attribute %0 cannot be applied to "
3703  "%select{functions|Objective-C method}1 without return value">,
3704  InGroup<IgnoredAttributes>;
3705def warn_attribute_weak_on_field : Warning<
3706  "__weak attribute cannot be specified on a field declaration">,
3707  InGroup<IgnoredAttributes>;
3708def warn_gc_attribute_weak_on_local : Warning<
3709  "Objective-C GC does not allow weak variables on the stack">,
3710  InGroup<IgnoredAttributes>;
3711def warn_nsobject_attribute : Warning<
3712  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3713  InGroup<NSobjectAttribute>;
3714def warn_independentclass_attribute : Warning<
3715  "'objc_independent_class' attribute may be put on a typedef only; "
3716  "attribute is ignored">,
3717  InGroup<IndependentClassAttribute>;
3718def warn_ptr_independentclass_attribute : Warning<
3719  "'objc_independent_class' attribute may be put on Objective-C object "
3720  "pointer type only; attribute is ignored">,
3721  InGroup<IndependentClassAttribute>;
3722def warn_attribute_weak_on_local : Warning<
3723  "__weak attribute cannot be specified on an automatic variable when ARC "
3724  "is not enabled">,
3725  InGroup<IgnoredAttributes>;
3726def warn_weak_identifier_undeclared : Warning<
3727  "weak identifier %0 never declared">;
3728def warn_attribute_cmse_entry_static : Warning<
3729  "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3730  InGroup<IgnoredAttributes>;
3731def warn_cmse_nonsecure_union : Warning<
3732  "passing union across security boundary via %select{parameter %1|return value}0 "
3733  "may leak information">,
3734  InGroup<DiagGroup<"cmse-union-leak">>;
3735def err_attribute_weak_static : Error<
3736  "weak declaration cannot have internal linkage">;
3737def err_attribute_selectany_non_extern_data : Error<
3738  "'selectany' can only be applied to data items with external linkage">;
3739def warn_attribute_hybrid_patchable_non_extern : Warning<
3740  "'hybrid_patchable' is ignored on functions without external linkage">,
3741  InGroup<IgnoredAttributes>;
3742def err_declspec_thread_on_thread_variable : Error<
3743  "'__declspec(thread)' applied to variable that already has a "
3744  "thread-local storage specifier">;
3745def err_attribute_dll_not_extern : Error<
3746  "%q0 must have external linkage when declared %q1">;
3747def err_attribute_dll_thread_local : Error<
3748  "%q0 cannot be thread local when declared %q1">;
3749def err_attribute_dll_lambda : Error<
3750  "lambda cannot be declared %0">;
3751def warn_attribute_invalid_on_definition : Warning<
3752  "'%0' attribute cannot be specified on a definition">,
3753  InGroup<IgnoredAttributes>;
3754def err_attribute_dll_redeclaration : Error<
3755  "redeclaration of %q0 cannot add %q1 attribute">;
3756def warn_attribute_dll_redeclaration : Warning<
3757  "redeclaration of %q0 should not add %q1 attribute">,
3758  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3759def err_attribute_dllimport_function_definition : Error<
3760  "dllimport cannot be applied to non-inline function definition">;
3761def err_attribute_dllimport_function_specialization_definition : Error<
3762  "cannot define non-inline dllimport template specialization">;
3763def err_attribute_dll_deleted : Error<
3764  "attribute %q0 cannot be applied to a deleted function">;
3765def err_attribute_dllimport_data_definition : Error<
3766  "definition of dllimport data">;
3767def err_attribute_dllimport_static_field_definition : Error<
3768  "definition of dllimport static field not allowed">;
3769def warn_attribute_dllimport_static_field_definition : Warning<
3770  "definition of dllimport static field">,
3771  InGroup<DiagGroup<"dllimport-static-field-def">>;
3772def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3773  "explicit instantiation declaration should not be 'dllexport'">,
3774  InGroup<DllexportExplicitInstantiationDecl>;
3775def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3776  "'dllexport' attribute ignored on explicit instantiation definition">,
3777  InGroup<IgnoredAttributes>;
3778def warn_attribute_exclude_from_explicit_instantiation_local_class : Warning<
3779  "%0 attribute ignored on local class%select{| member}1">,
3780  InGroup<IgnoredAttributes>;
3781def warn_invalid_initializer_from_system_header : Warning<
3782  "invalid constructor from class in system header, should not be explicit">,
3783  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3784def note_used_in_initialization_here : Note<"used in initialization here">;
3785def err_attribute_dll_member_of_dll_class : Error<
3786  "attribute %q0 cannot be applied to member of %q1 class">;
3787def warn_attribute_dll_instantiated_base_class : Warning<
3788  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3789  "base class template without dll attribute is not supported">,
3790  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3791def err_attribute_dll_ambiguous_default_ctor : Error<
3792  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3793def err_attribute_weakref_not_static : Error<
3794  "weakref declaration must have internal linkage">;
3795def err_attribute_weakref_not_global_context : Error<
3796  "weakref declaration of %0 must be in a global context">;
3797def err_attribute_weakref_without_alias : Error<
3798  "weakref declaration of %0 must also have an alias attribute">;
3799def err_alias_not_supported_on_darwin : Error <
3800  "aliases are not supported on darwin">;
3801def warn_attribute_wrong_decl_type_str : Warning<
3802  "%0%select{ attribute|}1 only applies to %2">, InGroup<IgnoredAttributes>;
3803def err_attribute_wrong_decl_type_str : Error<
3804  warn_attribute_wrong_decl_type_str.Summary>;
3805def warn_attribute_wrong_decl_type : Warning<
3806  "%0%select{ attribute|}1 only applies to %select{"
3807  "functions"
3808  "|unions"
3809  "|variables and functions"
3810  "|functions and methods"
3811  "|functions, methods and blocks"
3812  "|functions, methods, and parameters"
3813  "|variables"
3814  "|variables and fields"
3815  "|variables, data members and tag types"
3816  "|types and namespaces"
3817  "|variables, functions and classes"
3818  "|kernel functions"
3819  "|non-K&R-style functions"
3820  "|for loop statements"
3821  "|virtual functions"
3822  "|parameters and implicit object parameters"
3823  "|non-member functions"
3824  "|functions, classes, or enumerations"
3825  "|classes"
3826  "|typedefs}2">,
3827  InGroup<IgnoredAttributes>;
3828def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Summary>;
3829def warn_type_attribute_wrong_type : Warning<
3830  "'%0' only applies to %select{function|pointer|"
3831  "Objective-C object or block pointer}1 types; type here is %2">,
3832  InGroup<IgnoredAttributes>;
3833def err_type_attribute_wrong_type : Error<
3834  warn_type_attribute_wrong_type.Summary>;
3835def warn_incomplete_encoded_type : Warning<
3836  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3837  InGroup<DiagGroup<"encode-type">>;
3838def warn_gnu_inline_attribute_requires_inline : Warning<
3839  "'gnu_inline' attribute requires function to be marked 'inline',"
3840  " attribute ignored">,
3841  InGroup<IgnoredAttributes>;
3842def warn_gnu_inline_cplusplus_without_extern : Warning<
3843  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3844  " available, this changed in Clang 10">,
3845  InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3846def err_attribute_vecreturn_only_vector_member : Error<
3847  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3848def err_attribute_vecreturn_only_pod_record : Error<
3849  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3850def err_sme_attr_mismatch : Error<
3851  "function declared %0 was previously declared %1, which has different SME function attributes">;
3852def err_sme_call_in_non_sme_target : Error<
3853  "call to a streaming function requires 'sme'">;
3854def err_sme_za_call_no_za_state : Error<
3855  "call to a shared ZA function requires the caller to have ZA state">;
3856def err_sme_zt0_call_no_zt0_state : Error<
3857  "call to a shared ZT0 function requires the caller to have ZT0 state">;
3858def err_sme_unimplemented_za_save_restore : Error<
3859  "call to a function that shares state other than 'za' from a "
3860  "function that has live 'za' state requires a spill/fill of ZA, which is not yet "
3861  "implemented">;
3862def err_sme_unsupported_agnostic_new : Error<
3863  "__arm_agnostic(\"sme_za_state\") is not supported together with "
3864  "__arm_new(\"za\") or __arm_new(\"zt0\")">;
3865def note_sme_use_preserves_za : Note<
3866  "add '__arm_preserves(\"za\")' to the callee if it preserves ZA">;
3867def err_sme_definition_using_sm_in_non_sme_target : Error<
3868  "function executed in streaming-SVE mode requires 'sme'">;
3869def err_sme_definition_using_za_in_non_sme_target : Error<
3870  "function using ZA state requires 'sme'">;
3871def err_sme_definition_using_zt0_in_non_sme2_target : Error<
3872  "function using ZT0 state requires 'sme2'">;
3873def err_sme_openmp_captured_region : Error<
3874  "OpenMP captured regions are not yet supported in "
3875  "%select{streaming functions|functions with ZA state|functions with ZT0 state}0">;
3876def warn_sme_streaming_pass_return_vl_to_non_streaming : Warning<
3877  "%select{returning|passing}0 a VL-dependent argument %select{from|to}0 a function with a different"
3878  " streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime">,
3879  InGroup<AArch64SMEAttributes>, DefaultIgnore;
3880def warn_sme_locally_streaming_has_vl_args_returns : Warning<
3881  "%select{returning|passing}0 a VL-dependent argument %select{from|to}0 a locally streaming function is undefined"
3882  " behaviour when the streaming and non-streaming vector lengths are different at runtime">,
3883  InGroup<AArch64SMEAttributes>, DefaultIgnore;
3884def err_conflicting_attributes_arm_agnostic : Error<
3885  "__arm_agnostic(\"sme_za_state\") cannot share ZA state with its caller">;
3886def err_conflicting_attributes_arm_state : Error<
3887  "conflicting attributes for state '%0'">;
3888def err_unknown_arm_state : Error<
3889  "unknown state '%0'">;
3890def err_missing_arm_state : Error<
3891  "missing state for %0">;
3892def err_cconv_change : Error<
3893  "function declared '%0' here was previously declared "
3894  "%select{'%2'|without calling convention}1">;
3895def warn_cconv_unsupported : Warning<
3896  "%0 calling convention is not supported %select{"
3897  // Use CallingConventionIgnoredReason Enum to specify these.
3898  "for this target"
3899  "|on variadic function"
3900  "|on constructor/destructor"
3901  "|on builtin function"
3902  "}1">,
3903  InGroup<IgnoredAttributes>;
3904def error_cconv_unsupported : Error<warn_cconv_unsupported.Summary>;
3905def err_cconv_knr : Error<
3906  "function with no prototype cannot use the %0 calling convention">;
3907def warn_cconv_knr : Warning<
3908  err_cconv_knr.Summary>,
3909  InGroup<DiagGroup<"missing-prototype-for-cc">>;
3910def err_cconv_varargs : Error<
3911  "variadic function cannot use %0 calling convention">;
3912def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3913  "attribute was previously declared "
3914  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3915def err_function_attribute_mismatch : Error<
3916  "function declared with %0 attribute "
3917  "was previously declared without the %0 attribute">;
3918def err_objc_precise_lifetime_bad_type : Error<
3919  "objc_precise_lifetime only applies to retainable types; type here is %0">;
3920def warn_objc_precise_lifetime_meaningless : Error<
3921  "objc_precise_lifetime is not meaningful for "
3922  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3923def err_invalid_pcs : Error<"invalid PCS type">;
3924def warn_attribute_not_on_decl : Warning<
3925  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3926def err_base_specifier_attribute : Error<
3927  "%0%select{ attribute|}1 cannot be applied to a base specifier">;
3928def warn_declspec_allocator_nonpointer : Warning<
3929  "ignoring __declspec(allocator) because the function return type %0 is not "
3930  "a pointer or reference type">, InGroup<IgnoredAttributes>;
3931def err_cconv_incomplete_param_type : Error<
3932  "parameter %0 must have a complete type to use function %1 with the %2 "
3933  "calling convention">;
3934def err_attribute_output_parameter : Error<
3935  "attribute only applies to output parameters">;
3936
3937def ext_cannot_use_trivial_abi : ExtWarn<
3938  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3939def note_cannot_use_trivial_abi_reason : Note<
3940  "'trivial_abi' is disallowed on %0 because %select{"
3941  "its copy constructors and move constructors are all deleted|"
3942  "it is polymorphic|"
3943  "it has a base of a non-trivial class type|it has a virtual base|"
3944  "it has a __weak field|it has a field of a non-trivial class type}1">;
3945
3946// Availability attribute
3947def warn_availability_unknown_platform : Warning<
3948  "unknown platform %0 in availability macro">, InGroup<Availability>;
3949def warn_availability_unknown_environment : Warning<
3950  "unknown environment %0 in availability macro">, InGroup<Availability>;
3951
3952def warn_availability_version_ordering : Warning<
3953  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3954  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3955  "attribute ignored">, InGroup<Availability>;
3956def warn_mismatched_availability: Warning<
3957  "availability does not match previous declaration">, InGroup<Availability>;
3958def warn_mismatched_availability_override : Warning<
3959  "%select{|overriding }4method %select{introduced after|"
3960  "deprecated before|obsoleted before}0 "
3961  "%select{the protocol method it implements|overridden method}4 "
3962  "on %1 (%2 vs. %3)">, InGroup<Availability>;
3963def warn_mismatched_availability_override_unavail : Warning<
3964  "%select{|overriding }1method cannot be unavailable on %0 when "
3965  "%select{the protocol method it implements|its overridden method}1 is "
3966  "available">,
3967  InGroup<Availability>;
3968def warn_availability_on_static_initializer : Warning<
3969  "ignoring availability attribute %select{on '+load' method|"
3970  "with constructor attribute|with destructor attribute}0">,
3971  InGroup<Availability>;
3972def note_overridden_method : Note<
3973  "overridden method is here">;
3974def warn_availability_swift_unavailable_deprecated_only : Warning<
3975  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3976  InGroup<Availability>;
3977def note_protocol_method : Note<
3978  "protocol method is here">;
3979def warn_availability_fuchsia_unavailable_minor : Warning<
3980  "Fuchsia API Level prohibits specifying a minor or sub-minor version">,
3981  InGroup<Availability>;
3982def err_availability_unexpected_parameter: Error<
3983  "unexpected parameter '%0' in availability attribute, not permitted in %select{HLSL|C/C++}1">;
3984
3985def warn_unguarded_availability :
3986  Warning<"%0 is only available %select{|in %4 environment }3on %1 %2 or newer">,
3987  InGroup<UnguardedAvailability>, DefaultIgnore;
3988def warn_unguarded_availability_unavailable :
3989  Warning<"%0 is unavailable">,
3990  InGroup<UnguardedAvailability>, DefaultIgnore;
3991def warn_unguarded_availability_new :
3992  Warning<warn_unguarded_availability.Summary>,
3993  InGroup<UnguardedAvailabilityNew>;
3994def warn_unguarded_availability_unavailable_new :
3995  Warning<warn_unguarded_availability_unavailable.Summary>,
3996  InGroup<UnguardedAvailabilityNew>;
3997def note_decl_unguarded_availability_silence : Note<
3998  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3999def note_unguarded_available_silence : Note<
4000  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
4001  " this warning">;
4002def warn_at_available_unchecked_use : Warning<
4003  "%select{@available|__builtin_available}0 does not guard availability here; "
4004  "use if (%select{@available|__builtin_available}0) instead">,
4005  InGroup<DiagGroup<"unsupported-availability-guard">>;
4006
4007def warn_missing_sdksettings_for_availability_checking : Warning<
4008  "%0 availability is ignored without a valid 'SDKSettings.json' in the SDK">,
4009  InGroup<DiagGroup<"ignored-availability-without-sdk-settings">>;
4010
4011// Thread Safety Attributes
4012def warn_thread_attribute_ignored : Warning<
4013  "ignoring %0 attribute because its argument is invalid">,
4014  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
4015def warn_thread_attribute_not_on_non_static_member : Warning<
4016  "%0 attribute without capability arguments can only be applied to non-static "
4017  "methods of a class">,
4018  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
4019def warn_thread_attribute_not_on_capability_member : Warning<
4020  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
4021  "annotated with 'capability' or 'scoped_lockable' attribute">,
4022  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
4023def warn_thread_attribute_argument_not_lockable : Warning<
4024  "%0 attribute requires arguments whose type is annotated "
4025  "with 'capability' attribute; type here is %1">,
4026  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
4027def warn_thread_attribute_decl_not_lockable : Warning<
4028  "%0 attribute can only be applied in a context annotated "
4029  "with 'capability' attribute">,
4030  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
4031def warn_thread_attribute_decl_not_pointer : Warning<
4032  "%0 only applies to pointer types; type here is %1">,
4033  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
4034def warn_thread_attribute_not_on_scoped_lockable_param : Warning<
4035  "%0 attribute applies to function parameters only if their type is a "
4036  "reference to a 'scoped_lockable'-annotated type">,
4037  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
4038def err_attribute_argument_out_of_bounds_extra_info : Error<
4039  "%0 attribute parameter %1 is out of bounds: "
4040  "%plural{0:no parameters to index into|"
4041  "1:can only be 1, since there is one parameter|"
4042  ":must be between 1 and %2}2">;
4043
4044// Thread Safety Analysis
4045def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
4046  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4047def warn_unlock_kind_mismatch : Warning<
4048  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
4049  "%select{shared|exclusive}3 access">,
4050  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4051def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
4052  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4053def warn_no_unlock : Warning<
4054  "%0 '%1' is still held at the end of function">,
4055  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4056def warn_expecting_locked : Warning<
4057  "expecting %0 '%1' to be held at the end of function">,
4058  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4059// FIXME: improve the error message about locks not in scope
4060def warn_lock_some_predecessors : Warning<
4061  "%0 '%1' is not held on every path through here">,
4062  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4063def warn_expecting_lock_held_on_loop : Warning<
4064  "expecting %0 '%1' to be held at start of each loop">,
4065  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4066def note_locked_here : Note<"%0 acquired here">;
4067def note_unlocked_here : Note<"%0 released here">;
4068def warn_lock_exclusive_and_shared : Warning<
4069  "%0 '%1' is acquired exclusively and shared in the same scope">,
4070  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4071def note_lock_exclusive_and_shared : Note<
4072  "the other acquisition of %0 '%1' is here">;
4073def warn_variable_requires_any_lock : Warning<
4074  "%select{reading|writing}1 variable %0 requires holding "
4075  "%select{any mutex|any mutex exclusively}1">,
4076  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4077def warn_var_deref_requires_any_lock : Warning<
4078  "%select{reading|writing}1 the value pointed to by %0 requires holding "
4079  "%select{any mutex|any mutex exclusively}1">,
4080  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4081def warn_fun_excludes_mutex : Warning<
4082  "cannot call function '%1' while %0 '%2' is held">,
4083  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4084def warn_cannot_resolve_lock : Warning<
4085  "cannot resolve lock expression">,
4086  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4087def warn_acquired_before : Warning<
4088  "%0 '%1' must be acquired before '%2'">,
4089  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4090def warn_acquired_before_after_cycle : Warning<
4091  "cycle in acquired_before/after dependencies, starting with '%0'">,
4092  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4093def warn_unmatched_underlying_mutexes : Warning<
4094  "%0 managed by '%1' is '%3' instead of '%2'">,
4095  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4096def warn_expect_more_underlying_mutexes : Warning<
4097  "%0 '%2' not managed by '%1'">,
4098  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4099def warn_expect_fewer_underlying_mutexes : Warning<
4100  "did not expect %0 '%2' to be managed by '%1'">,
4101  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4102def note_managed_mismatch_here_for_param : Note<
4103  "see attribute on parameter here">;
4104
4105
4106// Thread safety warnings negative capabilities
4107def warn_acquire_requires_negative_cap : Warning<
4108  "acquiring %0 '%1' requires negative capability '%2'">,
4109  InGroup<ThreadSafetyNegative>, DefaultIgnore;
4110def warn_fun_requires_negative_cap : Warning<
4111  "calling function %0 requires negative capability '%1'">,
4112  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4113
4114// Thread safety warnings on pass/return by reference
4115def warn_guarded_pass_by_reference : Warning<
4116  "passing variable %1 by reference requires holding %0 "
4117  "%select{'%2'|'%2' exclusively}3">,
4118  InGroup<ThreadSafetyReference>, DefaultIgnore;
4119def warn_pt_guarded_pass_by_reference : Warning<
4120  "passing the value that %1 points to by reference requires holding %0 "
4121  "%select{'%2'|'%2' exclusively}3">,
4122  InGroup<ThreadSafetyReference>, DefaultIgnore;
4123def warn_guarded_return_by_reference : Warning<
4124  "returning variable %1 by reference requires holding %0 "
4125  "%select{'%2'|'%2' exclusively}3">,
4126  InGroup<ThreadSafetyReferenceReturn>, DefaultIgnore;
4127def warn_pt_guarded_return_by_reference : Warning<
4128  "returning the value that %1 points to by reference requires holding %0 "
4129  "%select{'%2'|'%2' exclusively}3">,
4130  InGroup<ThreadSafetyReferenceReturn>, DefaultIgnore;
4131
4132// Imprecise thread safety warnings
4133def warn_variable_requires_lock : Warning<
4134  "%select{reading|writing}3 variable %1 requires holding %0 "
4135  "%select{'%2'|'%2' exclusively}3">,
4136  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4137def warn_var_deref_requires_lock : Warning<
4138  "%select{reading|writing}3 the value pointed to by %1 requires "
4139  "holding %0 %select{'%2'|'%2' exclusively}3">,
4140  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4141def warn_fun_requires_lock : Warning<
4142  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
4143  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
4144
4145// Precise thread safety warnings
4146def warn_variable_requires_lock_precise :
4147  Warning<warn_variable_requires_lock.Summary>,
4148  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
4149def warn_var_deref_requires_lock_precise :
4150  Warning<warn_var_deref_requires_lock.Summary>,
4151  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
4152def warn_fun_requires_lock_precise :
4153  Warning<warn_fun_requires_lock.Summary>,
4154  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
4155def note_found_mutex_near_match : Note<"found near match '%0'">;
4156
4157// Verbose thread safety warnings
4158def warn_thread_safety_verbose : Warning<"thread safety verbose warning">,
4159  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
4160def note_thread_warning_in_fun : Note<"thread warning in function %0">;
4161def note_guarded_by_declared_here : Note<"guarded_by declared here">;
4162
4163// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
4164def warn_thread_safety_beta : Warning<"thread safety beta warning">,
4165  InGroup<ThreadSafetyBeta>, DefaultIgnore;
4166
4167// Consumed warnings
4168def warn_use_in_invalid_state : Warning<
4169  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
4170  "state">, InGroup<Consumed>, DefaultIgnore;
4171def warn_use_of_temp_in_invalid_state : Warning<
4172  "invalid invocation of method '%0' on a temporary object while it is in the "
4173  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
4174def warn_attr_on_unconsumable_class : Warning<
4175  "consumed analysis attribute is attached to member of class %0 which isn't "
4176  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
4177def warn_return_typestate_for_unconsumable_type : Warning<
4178  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
4179  DefaultIgnore;
4180def warn_return_typestate_mismatch : Warning<
4181  "return value not in expected state; expected '%0', observed '%1'">,
4182  InGroup<Consumed>, DefaultIgnore;
4183def warn_loop_state_mismatch : Warning<
4184  "state of variable '%0' must match at the entry and exit of loop">,
4185  InGroup<Consumed>, DefaultIgnore;
4186def warn_param_return_typestate_mismatch : Warning<
4187  "parameter '%0' not in expected state when the function returns: expected "
4188  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
4189def warn_param_typestate_mismatch : Warning<
4190  "argument not in expected state; expected '%0', observed '%1'">,
4191  InGroup<Consumed>, DefaultIgnore;
4192
4193// no_sanitize attribute
4194def warn_unknown_sanitizer_ignored : Warning<
4195  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
4196
4197def warn_impcast_vector_scalar : Warning<
4198  "implicit conversion turns vector to scalar: %0 to %1">,
4199  InGroup<Conversion>, DefaultIgnore;
4200def warn_impcast_complex_scalar : Warning<
4201  "implicit conversion discards imaginary component: %0 to %1">,
4202  InGroup<Conversion>, DefaultIgnore;
4203def err_impcast_complex_scalar : Error<
4204  "implicit conversion from %0 to %1 is not permitted in C++">;
4205def warn_impcast_float_precision : Warning<
4206  "implicit conversion loses floating-point precision: %0 to %1">,
4207  InGroup<ImplicitFloatConversion>, DefaultIgnore;
4208def warn_impcast_float_result_precision : Warning<
4209  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
4210  InGroup<ImplicitFloatConversion>, DefaultIgnore;
4211def warn_impcast_double_promotion : Warning<
4212  "implicit conversion increases floating-point precision: %0 to %1">,
4213  InGroup<DoublePromotion>, DefaultIgnore;
4214def warn_impcast_integer_sign : Warning<
4215  "implicit conversion changes signedness: %0 to %1">,
4216  InGroup<SignConversion>, DefaultIgnore;
4217def warn_impcast_integer_sign_conditional : Warning<
4218  "operand of ? changes signedness: %0 to %1">,
4219  InGroup<SignConversion>, DefaultIgnore;
4220def warn_impcast_integer_precision : Warning<
4221  "implicit conversion loses integer precision: %0 to %1">,
4222  InGroup<ImplicitIntConversion>, DefaultIgnore;
4223def warn_impcast_high_order_zero_bits : Warning<
4224  "higher order bits are zeroes after implicit conversion">,
4225  InGroup<ImplicitIntConversion>, DefaultIgnore;
4226def warn_impcast_nonnegative_result : Warning<
4227  "the resulting value is always non-negative after implicit conversion">,
4228  InGroup<SignConversion>, DefaultIgnore;
4229def warn_impcast_integer_64_32 : Warning<
4230  "implicit conversion loses integer precision: %0 to %1">,
4231  InGroup<Shorten64To32>, DefaultIgnore;
4232def warn_impcast_integer_precision_constant : Warning<
4233  "implicit conversion from %2 to %3 changes value from %0 to %1">,
4234  InGroup<ConstantConversion>;
4235def warn_impcast_single_bit_bitield_precision_constant : Warning<
4236  "implicit truncation from %2 to a one-bit wide bit-field changes value from "
4237  "%0 to %1">, InGroup<SingleBitBitFieldConstantConversion>;
4238def warn_impcast_bitfield_precision_constant : Warning<
4239  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
4240  InGroup<BitFieldConstantConversion>;
4241def warn_impcast_constant_value_to_objc_bool : Warning<
4242  "implicit conversion from constant value %0 to 'BOOL'; "
4243  "the only well defined values for 'BOOL' are YES and NO">,
4244  InGroup<ObjCBoolConstantConversion>;
4245
4246def warn_impcast_fixed_point_range : Warning<
4247  "implicit conversion from %0 cannot fit within the range of values for %1">,
4248  InGroup<ImplicitFixedPointConversion>;
4249
4250def warn_impcast_literal_float_to_integer : Warning<
4251  "implicit conversion from %0 to %1 changes value from %2 to %3">,
4252  InGroup<LiteralConversion>;
4253def warn_impcast_literal_float_to_integer_out_of_range : Warning<
4254  "implicit conversion of out of range value from %0 to %1 is undefined">,
4255  InGroup<LiteralConversion>;
4256def warn_impcast_float_integer : Warning<
4257  "implicit conversion turns floating-point number into integer: %0 to %1">,
4258  InGroup<FloatConversion>, DefaultIgnore;
4259def warn_impcast_float_to_objc_signed_char_bool : Warning<
4260  "implicit conversion from floating-point type %0 to 'BOOL'">,
4261  InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
4262def warn_impcast_int_to_objc_signed_char_bool : Warning<
4263  "implicit conversion from integral type %0 to 'BOOL'">,
4264  InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
4265
4266// Implicit int -> float conversion precision loss warnings.
4267def warn_impcast_integer_float_precision : Warning<
4268  "implicit conversion from %0 to %1 may lose precision">,
4269  InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
4270def warn_impcast_integer_float_precision_constant : Warning<
4271  "implicit conversion from %2 to %3 changes value from %0 to %1">,
4272  InGroup<ImplicitConstIntFloatConversion>;
4273
4274def warn_impcast_float_to_integer : Warning<
4275  "implicit conversion from %0 to %1 changes value from %2 to %3">,
4276  InGroup<FloatOverflowConversion>, DefaultIgnore;
4277def warn_impcast_float_to_integer_out_of_range : Warning<
4278  "implicit conversion of out of range value from %0 to %1 is undefined">,
4279  InGroup<FloatOverflowConversion>, DefaultIgnore;
4280def warn_impcast_float_to_integer_zero : Warning<
4281  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
4282  InGroup<FloatZeroConversion>, DefaultIgnore;
4283
4284def warn_impcast_string_literal_to_bool : Warning<
4285  "implicit conversion turns string literal into bool: %0 to %1">,
4286  InGroup<StringConversion>, DefaultIgnore;
4287def warn_impcast_different_enum_types : Warning<
4288  "implicit conversion from enumeration type %0 to different enumeration type "
4289  "%1">, InGroup<EnumConversion>;
4290def warn_impcast_bool_to_null_pointer : Warning<
4291    "initialization of pointer of type %0 to null from a constant boolean "
4292    "expression">, InGroup<BoolConversion>;
4293def warn_non_literal_null_pointer : Warning<
4294    "expression which evaluates to zero treated as a null pointer constant of "
4295    "type %0">, InGroup<NonLiteralNullConversion>;
4296def warn_pointer_compare : Warning<
4297    "comparing a pointer to a null character constant; did you mean "
4298    "to compare to %select{NULL|(void *)0}0?">,
4299    InGroup<DiagGroup<"pointer-compare">>;
4300def warn_impcast_null_pointer_to_integer : Warning<
4301    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
4302    InGroup<NullConversion>;
4303def warn_impcast_floating_point_to_bool : Warning<
4304    "implicit conversion turns floating-point number into bool: %0 to %1">,
4305    InGroup<ImplicitConversionFloatingPointToBool>;
4306def ext_ms_impcast_fn_obj : ExtWarn<
4307  "implicit conversion between pointer-to-function and pointer-to-object is a "
4308  "Microsoft extension">, InGroup<MicrosoftCast>;
4309
4310def warn_impcast_pointer_to_bool : Warning<
4311    "address of %select{'%1'|function '%1'|array '%1'|lambda function pointer "
4312    "conversion operator}0 will always evaluate to 'true'">,
4313    InGroup<PointerBoolConversion>;
4314def warn_cast_nonnull_to_bool : Warning<
4315    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
4316    "'true' on first encounter">,
4317    InGroup<PointerBoolConversion>;
4318def warn_this_bool_conversion : Warning<
4319  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
4320  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
4321def warn_address_of_reference_bool_conversion : Warning<
4322  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4323  "code; pointer may be assumed to always convert to true">,
4324  InGroup<UndefinedBoolConversion>;
4325
4326def warn_xor_used_as_pow : Warning<
4327  "result of '%0' is %1; did you mean exponentiation?">,
4328  InGroup<XorUsedAsPow>;
4329def warn_xor_used_as_pow_base_extra : Warning<
4330  "result of '%0' is %1; did you mean '%2' (%3)?">,
4331  InGroup<XorUsedAsPow>;
4332def warn_xor_used_as_pow_base : Warning<
4333  "result of '%0' is %1; did you mean '%2'?">,
4334  InGroup<XorUsedAsPow>;
4335def note_xor_used_as_pow_silence : Note<
4336  "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
4337
4338def warn_null_pointer_compare : Warning<
4339    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
4340    "equal to a null pointer is always %select{true|false}2">,
4341    InGroup<TautologicalPointerCompare>;
4342def warn_nonnull_expr_compare : Warning<
4343    "comparison of nonnull %select{function call|parameter}0 '%1' "
4344    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
4345    "encounter">,
4346    InGroup<TautologicalPointerCompare>;
4347def warn_this_null_compare : Warning<
4348  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
4349  "assumed to always evaluate to %select{true|false}0">,
4350  InGroup<TautologicalUndefinedCompare>;
4351def warn_address_of_reference_null_compare : Warning<
4352  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4353  "code; comparison may be assumed to always evaluate to "
4354  "%select{true|false}0">,
4355  InGroup<TautologicalUndefinedCompare>;
4356def note_reference_is_return_value : Note<"%0 returns a reference">;
4357
4358def note_pointer_declared_here : Note<
4359  "pointer %0 declared here">;
4360def warn_division_sizeof_ptr : Warning<
4361  "'%0' will return the size of the pointer, not the array itself">,
4362  InGroup<DiagGroup<"sizeof-pointer-div">>;
4363def warn_division_sizeof_array : Warning<
4364  "expression does not compute the number of elements in this array; element "
4365  "type is %0, not %1">,
4366  InGroup<DiagGroup<"sizeof-array-div">>;
4367
4368def note_function_warning_silence : Note<
4369    "prefix with the address-of operator to silence this warning">;
4370def note_function_to_function_call : Note<
4371    "suffix with parentheses to turn this into a function call">;
4372def warn_impcast_objective_c_literal_to_bool : Warning<
4373    "implicit boolean conversion of Objective-C object literal always "
4374    "evaluates to true">,
4375    InGroup<ObjCLiteralConversion>;
4376
4377def warn_cast_align : Warning<
4378  "cast from %0 to %1 increases required alignment from %2 to %3">,
4379  InGroup<CastAlign>, DefaultIgnore;
4380def warn_old_style_cast : Warning<
4381  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore,
4382  SuppressInSystemMacro;
4383
4384// Separate between casts to void* and non-void* pointers.
4385// Some APIs use (abuse) void* for something like a user context,
4386// and often that value is an integer even if it isn't a pointer itself.
4387// Having a separate warning flag allows users to control the warning
4388// for their workflow.
4389def warn_int_to_pointer_cast : Warning<
4390  "cast to %1 from smaller integer type %0">,
4391  InGroup<IntToPointerCast>;
4392def warn_int_to_void_pointer_cast : Warning<
4393  "cast to %1 from smaller integer type %0">,
4394  InGroup<IntToVoidPointerCast>;
4395def warn_pointer_to_int_cast : Warning<
4396  "cast to smaller integer type %1 from %0">,
4397  InGroup<PointerToIntCast>;
4398def warn_pointer_to_enum_cast : Warning<
4399  warn_pointer_to_int_cast.Summary>,
4400  InGroup<PointerToEnumCast>;
4401def warn_void_pointer_to_int_cast : Warning<
4402  "cast to smaller integer type %1 from %0">,
4403  InGroup<VoidPointerToIntCast>;
4404def warn_void_pointer_to_enum_cast : Warning<
4405  warn_void_pointer_to_int_cast.Summary>,
4406  InGroup<VoidPointerToEnumCast>;
4407
4408def warn_attribute_ignored_for_field_of_type : Warning<
4409  "%0 attribute ignored for field of type %1">,
4410  InGroup<IgnoredAttributes>;
4411def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
4412  "enums in the Microsoft ABI are signed integers by default; consider giving "
4413  "the enum %0 an unsigned underlying type to make this code portable">,
4414  InGroup<SignedEnumBitfield>, DefaultIgnore;
4415def warn_attribute_packed_for_bitfield : Warning<
4416  "'packed' attribute was ignored on bit-fields with single-byte alignment "
4417  "in older versions of GCC and Clang">,
4418  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
4419def warn_transparent_union_attribute_field_size_align : Warning<
4420  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
4421  "%select{alignment|size}0 of the first field in transparent union; "
4422  "transparent_union attribute ignored">,
4423  InGroup<IgnoredAttributes>;
4424def note_transparent_union_first_field_size_align : Note<
4425  "%select{alignment|size}0 of first field is %1 bits">;
4426def warn_transparent_union_attribute_not_definition : Warning<
4427  "transparent_union attribute can only be applied to a union definition; "
4428  "attribute ignored">,
4429  InGroup<IgnoredAttributes>;
4430def warn_transparent_union_attribute_floating : Warning<
4431  "first field of a transparent union cannot have %select{floating point|"
4432  "vector}0 type %1; transparent_union attribute ignored">,
4433  InGroup<IgnoredAttributes>;
4434def warn_transparent_union_attribute_zero_fields : Warning<
4435  "transparent union definition must contain at least one field; "
4436  "transparent_union attribute ignored">,
4437  InGroup<IgnoredAttributes>;
4438def warn_attribute_type_not_supported : Warning<
4439  "%0 attribute argument not supported: %1">,
4440  InGroup<IgnoredAttributes>;
4441def warn_attribute_type_not_supported_global : Warning<
4442  "%0 attribute argument '%1' not supported on a global variable">,
4443  InGroup<IgnoredAttributes>;
4444def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
4445  InGroup<IgnoredAttributes>;
4446def warn_attribute_protected_visibility :
4447  Warning<"target does not support 'protected' visibility; using 'default'">,
4448  InGroup<DiagGroup<"unsupported-visibility">>;
4449def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
4450def note_previous_attribute : Note<"previous attribute is here">;
4451def note_conflicting_attribute : Note<"conflicting attribute is here">;
4452def note_attribute : Note<"attribute is here">;
4453def err_mismatched_ms_inheritance : Error<
4454  "inheritance model does not match %select{definition|previous declaration}0">;
4455def warn_ignored_ms_inheritance : Warning<
4456  "inheritance model ignored on %select{primary template|partial specialization}0">,
4457  InGroup<IgnoredAttributes>;
4458def note_previous_ms_inheritance : Note<
4459  "previous inheritance model specified here">;
4460def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
4461def err_mode_not_primitive : Error<
4462  "mode attribute only supported for integer and floating-point types">;
4463def err_mode_wrong_type : Error<
4464  "type of machine mode does not match type of base type">;
4465def warn_vector_mode_deprecated : Warning<
4466  "specifying vector types with the 'mode' attribute is deprecated; "
4467  "use the 'vector_size' attribute instead">,
4468  InGroup<DeprecatedAttributes>;
4469def warn_deprecated_noreturn_spelling : Warning<
4470  "the '[[_Noreturn]]' attribute spelling is deprecated in C23; use "
4471  "'[[noreturn]]' instead">, InGroup<DeprecatedAttributes>;
4472def err_complex_mode_vector_type : Error<
4473  "type of machine mode does not support base vector types">;
4474def err_enum_mode_vector_type : Error<
4475  "mode %0 is not supported for enumeration types">;
4476def warn_attribute_nonnull_no_pointers : Warning<
4477  "'nonnull' attribute applied to function with no pointer arguments">,
4478  InGroup<IgnoredAttributes>;
4479def warn_attribute_nonnull_parm_no_args : Warning<
4480  "'nonnull' attribute when used on parameters takes no arguments">,
4481  InGroup<IgnoredAttributes>;
4482def warn_function_stmt_attribute_precedence : Warning<
4483  "statement attribute %0 has higher precedence than function attribute "
4484  "'%select{always_inline|flatten|noinline}1'">,
4485  InGroup<IgnoredAttributes>;
4486def note_declared_nonnull : Note<
4487  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
4488def warn_attribute_sentinel_named_arguments : Warning<
4489  "'sentinel' attribute requires named arguments">,
4490  InGroup<IgnoredAttributes>;
4491def warn_attribute_sentinel_not_variadic : Warning<
4492  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
4493  InGroup<IgnoredAttributes>;
4494def warn_deprecated_ignored_on_using : Warning<
4495  "%0 currently has no effect on a using declaration">,
4496  InGroup<IgnoredAttributes>;
4497def err_attribute_sentinel_less_than_zero : Error<
4498  "'sentinel' parameter 1 less than zero">;
4499def err_attribute_sentinel_not_zero_or_one : Error<
4500  "'sentinel' parameter 2 not 0 or 1">;
4501def warn_cleanup_ext : Warning<
4502  "GCC does not allow the 'cleanup' attribute argument to be anything other "
4503  "than a simple identifier">,
4504  InGroup<GccCompat>;
4505def err_attribute_cleanup_arg_not_function : Error<
4506  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
4507def err_attribute_cleanup_func_must_take_one_arg : Error<
4508  "'cleanup' function %0 must take 1 parameter">;
4509def err_attribute_cleanup_func_arg_incompatible_type : Error<
4510  "'cleanup' function %0 parameter has "
4511  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
4512def err_attribute_regparm_wrong_platform : Error<
4513  "'regparm' is not valid on this platform">;
4514def err_attribute_regparm_invalid_number : Error<
4515  "'regparm' parameter must be between 0 and %0 inclusive">;
4516def err_attribute_not_supported_in_lang : Error<
4517  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
4518def err_attribute_not_supported_on_arch
4519    : Error<"%0 attribute is not supported on '%1'">;
4520def warn_gcc_ignores_type_attr : Warning<
4521  "GCC does not allow the %0 attribute to be written on a type">,
4522  InGroup<GccCompat>;
4523def warn_gcc_requires_variadic_function : Warning<
4524  "GCC requires a function with the %0 attribute to be variadic">,
4525  InGroup<GccCompat>;
4526
4527// Clang-Specific Attributes
4528def warn_attribute_iboutlet : Warning<
4529  "%0 attribute can only be applied to instance variables or properties">,
4530  InGroup<IgnoredAttributes>;
4531def err_iboutletcollection_type : Error<
4532  "invalid type %0 as argument of iboutletcollection attribute">;
4533def err_iboutletcollection_builtintype : Error<
4534  "type argument of iboutletcollection attribute cannot be a builtin type">;
4535def warn_iboutlet_object_type : Warning<
4536  "%select{instance variable|property}2 with %0 attribute must "
4537  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
4538def warn_iboutletcollection_property_assign : Warning<
4539  "IBOutletCollection properties should be copy/strong and not assign">,
4540  InGroup<ObjCInvalidIBOutletProperty>;
4541
4542def err_attribute_overloadable_mismatch : Error<
4543  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
4544def note_attribute_overloadable_prev_overload : Note<
4545  "previous %select{unmarked |}0overload of function is here">;
4546def err_attribute_overloadable_no_prototype : Error<
4547  "'overloadable' function %0 must have a prototype">;
4548def err_attribute_overloadable_multiple_unmarked_overloads : Error<
4549  "at most one overload for a given name may lack the 'overloadable' "
4550  "attribute">;
4551def warn_attribute_no_builtin_invalid_builtin_name : Warning<
4552  "'%0' is not a valid builtin name for %1">,
4553  InGroup<DiagGroup<"invalid-no-builtin-names">>;
4554def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
4555  "empty %0 cannot be composed with named ones">;
4556def err_attribute_no_builtin_on_non_definition : Error<
4557  "%0 attribute is permitted on definitions only">;
4558def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
4559  "%0 attribute has no effect on defaulted or deleted functions">;
4560def warn_ns_attribute_wrong_return_type : Warning<
4561  "%0 attribute only applies to %select{functions|methods|properties}1 that "
4562  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
4563  InGroup<IgnoredAttributes>;
4564def err_ns_attribute_wrong_parameter_type : Error<
4565  "%0 attribute only applies to "
4566  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
4567def warn_ns_attribute_wrong_parameter_type : Warning<
4568  "%0 attribute only applies to "
4569  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
4570  InGroup<IgnoredAttributes>;
4571def warn_objc_requires_super_protocol : Warning<
4572  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
4573  InGroup<DiagGroup<"requires-super-attribute">>;
4574def note_protocol_decl : Note<
4575  "protocol is declared here">;
4576def note_protocol_decl_undefined : Note<
4577  "protocol %0 has no definition">;
4578def err_attribute_preferred_name_arg_invalid : Error<
4579  "argument %0 to 'preferred_name' attribute is not a typedef for "
4580  "a specialization of %1">;
4581def err_attribute_builtin_alias : Error<
4582  "%0 attribute can only be applied to a ARM, HLSL or RISC-V builtin">;
4583
4584// called-once attribute diagnostics.
4585def err_called_once_attribute_wrong_type : Error<
4586  "'called_once' attribute only applies to function-like parameters">;
4587
4588def warn_completion_handler_never_called : Warning<
4589  "%select{|captured }1completion handler is never called">,
4590  InGroup<CompletionHandler>, DefaultIgnore;
4591def warn_called_once_never_called : Warning<
4592  "%select{|captured }1%0 parameter marked 'called_once' is never called">,
4593  InGroup<CalledOnceParameter>;
4594
4595def warn_completion_handler_never_called_when : Warning<
4596  "completion handler is never %select{used|called}1 when "
4597  "%select{taking true branch|taking false branch|"
4598  "handling this case|none of the cases applies|"
4599  "entering the loop|skipping the loop|taking one of the branches}2">,
4600  InGroup<CompletionHandler>, DefaultIgnore;
4601def warn_called_once_never_called_when : Warning<
4602  "%0 parameter marked 'called_once' is never %select{used|called}1 when "
4603  "%select{taking true branch|taking false branch|"
4604  "handling this case|none of the cases applies|"
4605  "entering the loop|skipping the loop|taking one of the branches}2">,
4606  InGroup<CalledOnceParameter>;
4607
4608def warn_completion_handler_called_twice : Warning<
4609  "completion handler is called twice">,
4610  InGroup<CompletionHandler>, DefaultIgnore;
4611def warn_called_once_gets_called_twice : Warning<
4612  "%0 parameter marked 'called_once' is called twice">,
4613  InGroup<CalledOnceParameter>;
4614def note_called_once_gets_called_twice : Note<
4615  "previous call is here%select{; set to nil to indicate "
4616  "it cannot be called afterwards|}0">;
4617
4618// objc_designated_initializer attribute diagnostics.
4619def warn_objc_designated_init_missing_super_call : Warning<
4620  "designated initializer missing a 'super' call to a designated initializer of the super class">,
4621  InGroup<ObjCDesignatedInit>;
4622def note_objc_designated_init_marked_here : Note<
4623  "method marked as designated initializer of the class here">;
4624def warn_objc_designated_init_non_super_designated_init_call : Warning<
4625  "designated initializer should only invoke a designated initializer on 'super'">,
4626  InGroup<ObjCDesignatedInit>;
4627def warn_objc_designated_init_non_designated_init_call : Warning<
4628  "designated initializer invoked a non-designated initializer">,
4629  InGroup<ObjCDesignatedInit>;
4630def warn_objc_secondary_init_super_init_call : Warning<
4631  "convenience initializer should not invoke an initializer on 'super'">,
4632  InGroup<ObjCDesignatedInit>;
4633def warn_objc_secondary_init_missing_init_call : Warning<
4634  "convenience initializer missing a 'self' call to another initializer">,
4635  InGroup<ObjCDesignatedInit>;
4636def warn_objc_implementation_missing_designated_init_override : Warning<
4637  "method override for the designated initializer of the superclass %objcinstance0 not found">,
4638  InGroup<ObjCDesignatedInit>;
4639def err_designated_init_attr_non_init : Error<
4640  "'objc_designated_initializer' attribute only applies to init methods "
4641  "of interface or class extension declarations">;
4642
4643// objc_bridge attribute diagnostics.
4644def err_objc_attr_not_id : Error<
4645  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
4646def err_objc_attr_typedef_not_id : Error<
4647  "parameter of %0 attribute must be 'id' when used on a typedef">;
4648def err_objc_attr_typedef_not_void_pointer : Error<
4649  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
4650def err_objc_cf_bridged_not_interface : Error<
4651  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
4652def err_objc_ns_bridged_invalid_cfobject : Error<
4653  "Objective-C object of type %0 is bridged to %1, which is not valid CF object">;
4654def warn_objc_invalid_bridge : Warning<
4655  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
4656def warn_objc_invalid_bridge_to_cf : Warning<
4657  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
4658
4659// objc_bridge_related attribute diagnostics.
4660def err_objc_bridged_related_invalid_class : Error<
4661  "could not find Objective-C class %0 to convert %1 to %2">;
4662def err_objc_bridged_related_invalid_class_name : Error<
4663  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
4664def err_objc_bridged_related_known_method : Error<
4665 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
4666 "method for this conversion">;
4667
4668def err_objc_attr_protocol_requires_definition : Error<
4669  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
4670
4671// Swift attributes.
4672def warn_attr_swift_name_function
4673  : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
4674    InGroup<SwiftNameAttribute>;
4675def warn_attr_swift_name_invalid_identifier
4676  : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4677    InGroup<SwiftNameAttribute>;
4678def warn_attr_swift_name_decl_kind
4679  : Warning<"%0 attribute cannot be applied to this declaration">,
4680    InGroup<SwiftNameAttribute>;
4681def warn_attr_swift_name_subscript_invalid_parameter
4682  : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4683        "have at least one parameter|"
4684        "have a 'self:' parameter}1">,
4685    InGroup<SwiftNameAttribute>;
4686def warn_attr_swift_name_missing_parameters
4687  : Warning<"%0 attribute is missing parameter label clause">,
4688    InGroup<SwiftNameAttribute>;
4689def warn_attr_swift_name_setter_parameters
4690  : Warning<"%0 attribute for setter must have one parameter for new value">,
4691    InGroup<SwiftNameAttribute>;
4692def warn_attr_swift_name_multiple_selfs
4693  : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4694    InGroup<SwiftNameAttribute>;
4695def warn_attr_swift_name_getter_parameters
4696  : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4697    InGroup<SwiftNameAttribute>;
4698def warn_attr_swift_name_subscript_setter_no_newValue
4699  : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4700    InGroup<SwiftNameAttribute>;
4701def warn_attr_swift_name_subscript_setter_multiple_newValues
4702  : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4703    InGroup<SwiftNameAttribute>;
4704def warn_attr_swift_name_subscript_getter_newValue
4705  : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4706    InGroup<SwiftNameAttribute>;
4707def warn_attr_swift_name_num_params
4708  : Warning<"too %select{few|many}0 parameters in the signature specified by "
4709            "the %1 attribute (expected %2; got %3)">,
4710    InGroup<SwiftNameAttribute>;
4711def warn_attr_swift_name_decl_missing_params
4712  : Warning<"%0 attribute cannot be applied to a %select{function|method}1 "
4713            "with no parameters">,
4714    InGroup<SwiftNameAttribute>;
4715
4716def err_attr_swift_error_no_error_parameter : Error<
4717  "%0 attribute can only be applied to a %select{function|method}1 with an "
4718  "error parameter">;
4719def err_attr_swift_error_return_type : Error<
4720  "%0 attribute with '%1' convention can only be applied to a "
4721  "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4722
4723def err_swift_async_no_access : Error<
4724  "first argument to 'swift_async' must be either 'none', 'swift_private', or "
4725  "'not_swift_private'">;
4726def err_swift_async_bad_block_type : Error<
4727  "'swift_async' completion handler parameter must have block type returning"
4728  " 'void', type here is %0">;
4729
4730def err_swift_async_error_without_swift_async : Error<
4731  "%0 attribute must be applied to a %select{function|method}1 annotated "
4732  "with non-'none' attribute 'swift_async'">;
4733def err_swift_async_error_no_error_parameter : Error<
4734  "%0 attribute with 'nonnull_error' convention can only be applied to a "
4735  "%select{function|method}1 with a completion handler with an error "
4736  "parameter">;
4737def err_swift_async_error_non_integral : Error<
4738  "%0 attribute with '%1' convention must have an integral-typed parameter "
4739  "in completion handler at index %2, type here is %3">;
4740
4741def warn_ignored_objc_externally_retained : Warning<
4742  "'objc_externally_retained' can only be applied to local variables "
4743  "%select{of retainable type|with strong ownership}0">,
4744  InGroup<IgnoredAttributes>;
4745
4746// Function Parameter Semantic Analysis.
4747def err_param_with_void_type : Error<"argument may not have 'void' type">;
4748def err_void_only_param : Error<
4749  "'void' must be the first and only parameter if specified">;
4750def err_void_param_qualified : Error<
4751  "'void' as parameter must not have type qualifiers">;
4752def err_void_explicit_object_param : Error<
4753  "explicit object parameter cannot have 'void' type">;
4754def err_ident_list_in_fn_declaration : Error<
4755  "a parameter list without types is only allowed in a function definition">;
4756def ext_param_not_declared : ExtWarn<
4757  "parameter %0 was not declared, defaults to 'int'; ISO C99 and later do not "
4758  "support implicit int">, InGroup<ImplicitInt>, DefaultError;
4759def err_param_default_argument : Error<
4760  "C does not support default arguments">;
4761def err_param_default_argument_redefinition : Error<
4762  "redefinition of default argument">;
4763def ext_param_default_argument_redefinition : ExtWarn<
4764  err_param_default_argument_redefinition.Summary>,
4765  InGroup<MicrosoftDefaultArgRedefinition>;
4766def err_param_default_argument_missing : Error<
4767  "missing default argument on parameter">;
4768def err_param_default_argument_missing_name : Error<
4769  "missing default argument on parameter %0">;
4770def err_param_default_argument_references_param : Error<
4771  "default argument references parameter %0">;
4772def err_param_default_argument_references_local : Error<
4773  "default argument references local variable %0 of enclosing function">;
4774def err_param_default_argument_references_this : Error<
4775  "default argument references 'this'">;
4776def err_param_default_argument_nonfunc : Error<
4777  "default arguments can only be specified for parameters in a function "
4778  "declaration">;
4779def err_param_default_argument_template_redecl : Error<
4780  "default arguments cannot be added to a function template that has already "
4781  "been declared">;
4782def err_param_default_argument_member_template_redecl : Error<
4783  "default arguments cannot be added to an out-of-line definition of a member "
4784  "of a %select{class template|class template partial specialization|nested "
4785  "class in a template}0">;
4786def err_param_default_argument_on_parameter_pack : Error<
4787  "parameter pack cannot have a default argument">;
4788def err_uninitialized_member_for_assign : Error<
4789  "cannot define the implicit copy assignment operator for %0, because "
4790  "non-static %select{reference|const}1 member %2 cannot use copy "
4791  "assignment operator">;
4792def err_uninitialized_member_in_ctor : Error<
4793  "%select{constructor for %1|"
4794  "implicit default constructor for %1|"
4795  "cannot use constructor inherited from %1:}0 must explicitly "
4796  "initialize the %select{reference|const}2 member %3">;
4797def err_default_arg_makes_ctor_special : Error<
4798  "addition of default argument on redeclaration makes this constructor a "
4799  "%select{default|copy|move}0 constructor">;
4800def err_stmt_expr_in_default_arg : Error<
4801  "default %select{argument|non-type template argument}0 may not use a GNU "
4802  "statement expression">;
4803
4804def err_use_of_default_argument_to_function_declared_later : Error<
4805  "use of default argument to function %0 that is declared later in class %1">;
4806def note_default_argument_declared_here : Note<
4807  "default argument declared here">;
4808def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4809def note_recursive_default_argument_used_here : Note<
4810  "default argument used here">;
4811
4812def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4813  "%diff{promoted type $ of K&R function parameter is not compatible with the "
4814  "parameter type $|promoted type of K&R function parameter is not compatible "
4815  "with parameter type}0,1 declared in a previous prototype">,
4816  InGroup<KNRPromotedParameter>;
4817
4818
4819// C++ Overloading Semantic Analysis.
4820def err_ovl_diff_return_type : Error<
4821  "functions that differ only in their return type cannot be overloaded">;
4822def err_ovl_static_nonstatic_member : Error<
4823  "static and non-static member functions with the same parameter types "
4824  "cannot be overloaded">;
4825
4826let Deferrable = 1 in {
4827
4828def err_ovl_no_viable_function_in_call : Error<
4829  "no matching function for call to %0">;
4830def err_ovl_no_viable_member_function_in_call : Error<
4831  "no matching member function for call to %0">;
4832def err_ovl_ambiguous_call : Error<
4833  "call to %0 is ambiguous">;
4834def err_ovl_deleted_call : Error<"call to deleted"
4835  "%select{| member}0 function %1%select{|: %3}2">;
4836def err_ovl_ambiguous_member_call : Error<
4837  "call to member function %0 is ambiguous">;
4838def note_ovl_too_many_candidates : Note<
4839    "remaining %0 candidate%s0 omitted; "
4840    "pass -fshow-overloads=all to show them">;
4841
4842def select_ovl_candidate_kind : TextSubstitution<
4843  "%select{function|function|function (with reversed parameter order)|"
4844    "constructor|"
4845    "constructor (the implicit default constructor)|"
4846    "constructor (the implicit copy constructor)|"
4847    "constructor (the implicit move constructor)|"
4848    "function (the implicit copy assignment operator)|"
4849    "function (the implicit move assignment operator)|"
4850    "function (the implicit 'operator==' for this 'operator<=>)'|"
4851    "inherited constructor}0%select{| template| %2}1">;
4852
4853def note_ovl_candidate : Note<
4854    "candidate %sub{select_ovl_candidate_kind}0,1,3"
4855    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4856    "| has different number of parameters (expected %5 but has %6)"
4857    "| has type mismatch at %ordinal5 parameter"
4858    "%diff{ (expected $ but has $)|}6,7"
4859    "| has different return type%diff{ ($ expected but has $)|}5,6"
4860    "| has different qualifiers (expected %5 but found %6)"
4861    "| has different exception specification}4">;
4862
4863def note_ovl_candidate_explicit : Note<
4864    "explicit %select{constructor|conversion function|deduction guide}0 "
4865    "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4866def note_ovl_candidate_inherited_constructor : Note<
4867    "constructor from base class %0 inherited here">;
4868def note_ovl_candidate_inherited_constructor_slice : Note<
4869    "candidate %select{constructor|template}0 ignored: "
4870    "inherited constructor cannot be used to %select{copy|move}1 object">;
4871def note_ovl_candidate_illegal_constructor : Note<
4872    "candidate %select{constructor|template}0 ignored: "
4873    "instantiation %select{takes|would take}0 its own class type by value">;
4874def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4875    "candidate constructor ignored: cannot be used to construct an object "
4876    "in address space %0">;
4877def note_ovl_candidate_bad_deduction : Note<
4878    "candidate template ignored: failed template argument deduction">;
4879def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4880    "couldn't infer template argument %0">;
4881def note_ovl_candidate_incomplete_deduction_pack : Note<
4882    "candidate template ignored: "
4883    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4884    "expanded parameter in deduced argument pack %2">;
4885def note_ovl_candidate_inconsistent_deduction : Note<
4886    "candidate template ignored: deduced %select{conflicting types|"
4887    "conflicting values|conflicting templates|packs of different lengths}0 "
4888    "for parameter %1%diff{ ($ vs. $)|}2,3">;
4889def note_ovl_candidate_inconsistent_deduction_types : Note<
4890    "candidate template ignored: deduced values %diff{"
4891    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4892    "%1 and %3 of conflicting types for parameter %0}2,4">;
4893def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4894    "candidate template ignored: invalid explicitly-specified argument "
4895    "for template parameter %0">;
4896def note_ovl_candidate_unsatisfied_constraints : Note<
4897    "candidate template ignored: constraints not satisfied%0">;
4898def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4899    "candidate template ignored: invalid explicitly-specified argument "
4900    "for %ordinal0 template parameter">;
4901def note_ovl_candidate_instantiation_depth : Note<
4902    "candidate template ignored: substitution exceeded maximum template "
4903    "instantiation depth">;
4904def note_ovl_candidate_underqualified : Note<
4905    "candidate template ignored: cannot deduce a type for %0 that would "
4906    "make %2 equal %1">;
4907def note_ovl_candidate_substitution_failure : Note<
4908    "candidate template ignored: substitution failure%0%1">;
4909def note_ovl_candidate_disabled_by_enable_if : Note<
4910    "candidate template ignored: disabled by %0%1">;
4911def note_ovl_candidate_disabled_by_requirement : Note<
4912    "candidate template ignored: requirement '%0' was not satisfied%1">;
4913def note_ovl_candidate_has_pass_object_size_params: Note<
4914    "candidate address cannot be taken because parameter %0 has "
4915    "pass_object_size attribute">;
4916def err_diagnose_if_succeeded : Error<"%0">;
4917def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4918    ShowInSystemHeader;
4919def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4920    "candidate disabled: %0">;
4921def err_addrof_function_disabled_by_enable_if_attr : Error<
4922    "cannot take address of function %0 because it has one or more "
4923    "non-tautological enable_if conditions">;
4924def err_addrof_function_constraints_not_satisfied : Error<
4925    "cannot take address of function %0 because its constraints are not "
4926    "satisfied">;
4927def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4928    "candidate function made ineligible by enable_if">;
4929def note_ovl_candidate_deduced_mismatch : Note<
4930    "candidate template ignored: deduced type "
4931    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4932    "adjusted type $ of %select{|element of }4argument"
4933    "|of %select{|element of }4%ordinal0 parameter does not match "
4934    "adjusted type of %select{|element of }4argument}1,2%3">;
4935def note_ovl_candidate_non_deduced_mismatch : Note<
4936    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4937// This note is needed because the above note would sometimes print two
4938// different types with the same name.  Remove this note when the above note
4939// can handle that case properly.
4940def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4941    "candidate template ignored: could not match %q0 against %q1">;
4942
4943// Note that we don't treat templates differently for this diagnostic.
4944def note_ovl_candidate_arity : Note<"candidate "
4945    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4946    "requires%select{ at least| at most|}3 %4 "
4947    "%select{|non-object }6argument%s4, but %5 "
4948    "%plural{1:was|:were}5 provided">;
4949
4950def note_ovl_candidate_arity_one : Note<"candidate "
4951    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4952    "%select{requires at least|allows at most single|requires single}3 "
4953    "%select{|non-object }6"
4954    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4955
4956def note_ovl_candidate_deleted : Note<
4957    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4958    "%select{explicitly made unavailable|explicitly deleted|"
4959    "implicitly deleted}3">;
4960
4961// Giving the index of the bad argument really clutters this message, and
4962// it's relatively unimportant because 1) it's generally obvious which
4963// argument(s) are of the given object type and 2) the fix is usually
4964// to complete the type, which doesn't involve changes to the call line
4965// anyway.  If people complain, we can change it.
4966def note_ovl_candidate_bad_conv_incomplete : Note<
4967    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4968    "cannot convert argument of incomplete type "
4969    "%diff{$ to $|to parameter type}3,4 for "
4970    "%select{%ordinal6 argument|object argument}5"
4971    "%select{|; dereference the argument with *|"
4972    "; take the address of the argument with &|"
4973    "; remove *|"
4974    "; remove &}7">;
4975def note_ovl_candidate_bad_list_argument : Note<
4976    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4977    "%select{cannot convert initializer list|too few initializers in list"
4978    "|too many initializers in list}7 argument to %4">;
4979def note_ovl_candidate_bad_overload : Note<
4980    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4981    "no overload of %4 matching %3 for %ordinal5 argument">;
4982def note_ovl_candidate_bad_conv : Note<
4983    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4984    "no known conversion "
4985    "%diff{from $ to $|from argument type to parameter type}3,4 for "
4986    "%select{%ordinal6 argument|object argument}5"
4987    "%select{|; dereference the argument with *|"
4988    "; take the address of the argument with &|"
4989    "; remove *|"
4990    "; remove &}7">;
4991def note_ovl_candidate_bad_arc_conv : Note<
4992    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4993    "cannot implicitly convert argument "
4994    "%diff{of type $ to $|type to parameter type}3,4 for "
4995    "%select{%ordinal6 argument|object argument}5 under ARC">;
4996def note_ovl_candidate_bad_value_category : Note<
4997    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4998    "expects an %select{lvalue|rvalue}5 for "
4999    "%select{%ordinal4 argument|object argument}3">;
5000def note_ovl_candidate_bad_addrspace : Note<
5001    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5002    "cannot %select{pass pointer to|bind reference in}5 %3 "
5003    "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
5004    "argument">;
5005def note_ovl_candidate_bad_addrspace_this : Note<
5006    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5007    "'this' object is in %3, but method expects object in %4">;
5008def note_ovl_candidate_bad_gc : Note<
5009    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5010    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
5011    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
5012def note_ovl_candidate_bad_ownership : Note<
5013    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5014    "%select{%ordinal7|'this'}6 argument (%3) has "
5015    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
5016    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
5017    "__autoreleasing}5 ownership">;
5018def note_ovl_candidate_bad_cvr_this : Note<
5019    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5020    "'this' argument has type %3, but method is not marked "
5021    "%select{const|restrict|const or restrict|volatile|const or volatile|"
5022    "volatile or restrict|const, volatile, or restrict}4">;
5023def note_ovl_candidate_bad_cvr : Note<
5024    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5025    "%ordinal5 argument (%3) would lose "
5026    "%select{const|restrict|const and restrict|volatile|const and volatile|"
5027    "volatile and restrict|const, volatile, and restrict}4 qualifier"
5028    "%select{||s||s|s|s}4">;
5029def note_ovl_candidate_bad_base_to_derived_conv : Note<
5030    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5031    "cannot %select{convert from|convert from|bind}3 "
5032    "%select{base class pointer|superclass|base class object of type}3 %4 to "
5033    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
5034    "%ordinal6 argument">;
5035def note_ovl_candidate_bad_target : Note<
5036    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5037    "call to "
5038    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
5039    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
5040def note_ovl_candidate_constraints_not_satisfied : Note<
5041    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
5042    "not satisfied">;
5043def note_ovl_surrogate_constraints_not_satisfied : Note<
5044    "conversion candidate %0 not viable: constraints not satisfied">;
5045def note_implicit_member_target_infer_collision : Note<
5046    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
5047    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
5048    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
5049
5050def note_ambiguous_type_conversion: Note<
5051    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
5052def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
5053def err_ovl_no_viable_function_in_init : Error<
5054  "no matching constructor for initialization of %0">;
5055def err_ovl_no_conversion_in_cast : Error<
5056  "cannot convert %1 to %2 without a conversion operator">;
5057def err_ovl_no_viable_conversion_in_cast : Error<
5058  "no matching conversion for %select{|static_cast|reinterpret_cast|"
5059  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
5060def err_ovl_ambiguous_conversion_in_cast : Error<
5061  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
5062  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
5063def err_ovl_deleted_conversion_in_cast : Error<
5064  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
5065  "functional-style cast|}0 from %1 to %2 uses deleted function%select{|: %4}3">;
5066def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
5067def err_ref_init_ambiguous : Error<
5068  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
5069def err_ovl_deleted_init : Error<
5070  "call to deleted constructor of %0%select{|: %2}1">;
5071def err_ovl_deleted_special_init : Error<
5072  "call to implicitly-deleted %select{default constructor|copy constructor|"
5073  "move constructor|copy assignment operator|move assignment operator|"
5074  "destructor|function}0 of %1">;
5075def err_ovl_ambiguous_oper_unary : Error<
5076  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
5077def err_ovl_ambiguous_oper_binary : Error<
5078  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
5079def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
5080  "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
5081  "and %2) to be ambiguous despite there being a unique best viable function"
5082  "%select{ with non-reversed arguments|}3">,
5083  InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
5084def note_ovl_ambiguous_oper_binary_reversed_self : Note<
5085  "ambiguity is between a regular call to this operator and a call with the "
5086  "argument order reversed">;
5087def note_ovl_ambiguous_eqeq_reversed_self_non_const : Note<
5088  "mark 'operator==' as const or add a matching 'operator!=' to resolve the ambiguity">;
5089def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
5090  "candidate function with non-reversed arguments">;
5091def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
5092  "ambiguous candidate function with reversed arguments">;
5093def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
5094def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
5095def err_ovl_deleted_oper : Error<
5096  "overload resolution selected deleted operator '%0'%select{|: %2}1">;
5097def err_ovl_deleted_special_oper : Error<
5098  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
5099  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
5100  "implicitly deleted">;
5101def err_ovl_deleted_comparison : Error<
5102  "object of type %0 cannot be compared because its %1 is implicitly deleted">;
5103def err_ovl_rewrite_equalequal_not_bool : Error<
5104  "return type %0 of selected 'operator==' function for rewritten "
5105  "'%1' comparison is not 'bool'">;
5106def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
5107  "ISO C++20 requires return type of selected 'operator==' function for "
5108  "rewritten '%1' comparison to be 'bool', not %0">,
5109  InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
5110def err_ovl_no_viable_subscript :
5111    Error<"no viable overloaded operator[] for type %0">;
5112def err_ovl_no_oper :
5113    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
5114def err_ovl_unresolvable : Error<
5115  "reference to %select{overloaded|multiversioned}1 function could not be "
5116  "resolved; did you mean to call it%select{| with no arguments}0?">;
5117def err_bound_member_function : Error<
5118  "reference to non-static member function must be called"
5119  "%select{|; did you mean to call it with no arguments?}0">;
5120def note_possible_target_of_call : Note<"possible target for call">;
5121def err_no_viable_destructor : Error<
5122  "no viable destructor found for class %0">;
5123def err_ambiguous_destructor : Error<
5124  "destructor of class %0 is ambiguous">;
5125
5126def err_ovl_no_viable_object_call : Error<
5127  "no matching function for call to object of type %0">;
5128def err_ovl_ambiguous_object_call : Error<
5129  "call to object of type %0 is ambiguous">;
5130def err_ovl_ambiguous_subscript_call : Error<
5131  "call to subscript operator of type %0 is ambiguous">;
5132def err_ovl_deleted_object_call : Error<
5133  "call to deleted function call operator in type %0%select{|: %2}1">;
5134def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
5135def err_member_call_without_object : Error<
5136  "call to %select{non-static|explicit}0 member function without an object argument">;
5137
5138// C++ Address of Overloaded Function
5139def err_addr_ovl_no_viable : Error<
5140  "address of overloaded function %0 does not match required type %1">;
5141def err_addr_ovl_ambiguous : Error<
5142  "address of overloaded function %0 is ambiguous">;
5143def err_addr_ovl_not_func_ptrref : Error<
5144  "address of overloaded function %0 cannot be converted to type %1">;
5145def err_addr_ovl_no_qualifier : Error<
5146  "cannot form member pointer of type %0 without '&' and class name">;
5147
5148} // let Deferrable
5149
5150// C++11 Literal Operators
5151def err_ovl_no_viable_literal_operator : Error<
5152  "no matching literal operator for call to %0"
5153  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
5154  "%select{| or 'const char *'}4"
5155  "%select{|, and no matching literal operator template}5">;
5156
5157// C++ Template Declarations
5158def err_template_param_shadow : Error<
5159  "declaration of %0 shadows template parameter">;
5160def ext_template_param_shadow : ExtWarn<
5161  err_template_param_shadow.Summary>, InGroup<MicrosoftTemplateShadow>;
5162def ext_compat_template_param_shadow : ExtWarn<
5163  err_template_param_shadow.Summary>, InGroup<
5164  DiagGroup<"strict-primary-template-shadow">>, DefaultError;
5165def note_template_param_here : Note<"template parameter is declared here">;
5166def note_template_param_external : Note<
5167  "template parameter from hidden source: %0">;
5168def warn_template_export_unsupported : Warning<
5169  "exported templates are unsupported">;
5170def err_template_outside_namespace_or_class_scope : Error<
5171  "templates can only be declared in namespace or class scope">;
5172def err_template_inside_local_class : Error<
5173  "templates cannot be declared inside of a local class">;
5174def err_template_linkage : Error<"templates must have C++ linkage">;
5175def err_template_typedef : Error<"a typedef cannot be a template">;
5176def err_template_unnamed_class : Error<
5177  "cannot declare a class template with no name">;
5178def err_template_param_list_different_arity : Error<
5179  "%select{too few|too many}0 template parameters in template "
5180  "%select{|template parameter }1redeclaration">;
5181def note_template_param_list_different_arity : Note<
5182  "%select{too few|too many}0 template parameters in template template "
5183  "argument">;
5184def note_template_prev_declaration : Note<
5185  "previous template %select{declaration|template parameter}0 is here">;
5186def err_template_param_different_kind : Error<
5187  "template parameter has a different kind in template "
5188  "%select{|template parameter }0redeclaration">;
5189def note_template_param_different_kind : Note<
5190  "template parameter has a different kind in template argument">;
5191
5192def err_invalid_decl_specifier_in_nontype_parm : Error<
5193  "invalid declaration specifier in template non-type parameter">;
5194
5195def err_template_nontype_parm_different_type : Error<
5196  "template non-type parameter has a different type %0 in template "
5197  "%select{|template parameter }1redeclaration">;
5198
5199def note_template_nontype_parm_different_type : Note<
5200  "template non-type parameter has a different type %0 in template argument">;
5201def note_template_nontype_parm_prev_declaration : Note<
5202  "previous non-type template parameter with type %0 is here">;
5203def err_template_nontype_parm_bad_type : Error<
5204  "a non-type template parameter cannot have type %0">;
5205def err_template_nontype_parm_bad_structural_type : Error<
5206  "a non-type template parameter cannot have type %0 before C++20">;
5207def err_template_nontype_parm_incomplete : Error<
5208  "non-type template parameter has incomplete type %0">;
5209def err_template_nontype_parm_not_literal : Error<
5210  "non-type template parameter has non-literal type %0">;
5211def err_template_nontype_parm_rvalue_ref : Error<
5212  "non-type template parameter has rvalue reference type %0">;
5213def err_template_nontype_parm_not_structural : Error<
5214  "type %0 of non-type template parameter is not a structural type">;
5215def note_not_structural_non_public : Note<
5216  "%0 is not a structural type because it has a "
5217  "%select{non-static data member|base class}1 that is not public">;
5218def note_not_structural_mutable_field : Note<
5219  "%0 is not a structural type because it has a mutable "
5220  "non-static data member">;
5221def note_not_structural_rvalue_ref_field : Note<
5222  "%0 is not a structural type because it has a non-static data member "
5223  "of rvalue reference type">;
5224def note_not_structural_subobject : Note<
5225  "%0 is not a structural type because it has a "
5226  "%select{non-static data member|base class}1 of non-structural type %2">;
5227def warn_cxx17_compat_template_nontype_parm_type : Warning<
5228  "non-type template parameter of type %0 is incompatible with "
5229  "C++ standards before C++20">,
5230  DefaultIgnore, InGroup<CXXPre20Compat>;
5231def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
5232  "non-type template parameters declared with %0 are incompatible with C++ "
5233  "standards before C++17">,
5234  DefaultIgnore, InGroup<CXXPre17Compat>;
5235def err_template_param_default_arg_redefinition : Error<
5236  "template parameter redefines default argument">;
5237def err_template_param_default_arg_inconsistent_redefinition : Error<
5238  "template parameter default argument is inconsistent with previous definition">;
5239def note_template_param_prev_default_arg : Note<
5240  "previous default template argument defined here">;
5241def note_template_param_prev_default_arg_in_other_module : Note<
5242  "previous default template argument defined in module %0">;
5243def err_template_param_default_arg_missing : Error<
5244  "template parameter missing a default argument">;
5245def ext_template_parameter_default_in_function_template : ExtWarn<
5246  "default template arguments for a function template are a C++11 extension">,
5247  InGroup<CXX11>;
5248def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
5249  "default template arguments for a function template are incompatible with C++98">,
5250  InGroup<CXX98Compat>, DefaultIgnore;
5251def err_template_parameter_default_template_member : Error<
5252  "cannot add a default template argument to the definition of a member of a "
5253  "class template">;
5254def err_template_parameter_default_friend_template : Error<
5255  "default template argument not permitted on a friend template">;
5256def err_template_template_parm_no_parms : Error<
5257  "template template parameter must have its own template parameters">;
5258
5259def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
5260  InGroup<CXX14>;
5261def warn_cxx11_compat_variable_template : Warning<
5262  "variable templates are incompatible with C++ standards before C++14">,
5263  InGroup<CXXPre14Compat>, DefaultIgnore;
5264def err_template_variable_noparams : Error<
5265  "extraneous 'template<>' in declaration of variable %0">;
5266def err_template_member : Error<"non-static data member %0 cannot be declared as a template">;
5267def err_member_with_template_arguments : Error<"member %0 cannot have template arguments">;
5268def err_template_member_noparams : Error<
5269  "extraneous 'template<>' in declaration of member %0">;
5270def err_template_tag_noparams : Error<
5271  "extraneous 'template<>' in declaration of %0 %1">;
5272
5273def warn_cxx17_compat_adl_only_template_id : Warning<
5274  "use of function template name with no prior function template "
5275  "declaration in function call with explicit template arguments "
5276  "is incompatible with C++ standards before C++20">,
5277  InGroup<CXXPre20Compat>, DefaultIgnore;
5278def ext_adl_only_template_id : ExtWarn<
5279  "use of function template name with no prior declaration in function call "
5280  "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
5281
5282def warn_unqualified_call_to_std_cast_function : Warning<
5283  "unqualified call to '%0'">, InGroup<DiagGroup<"unqualified-std-cast-call">>;
5284
5285// C++ Template Argument Lists
5286def err_template_missing_args : Error<
5287  "use of "
5288  "%select{class template|function template|variable template|alias template|"
5289  "template template parameter|concept|template}0 %1 requires template "
5290  "arguments">;
5291def err_template_arg_list_different_arity : Error<
5292  "%select{too few|too many}0 template arguments for "
5293  "%select{class template|function template|variable template|alias template|"
5294  "template template parameter|concept|template}1 %2">;
5295def note_template_decl_here : Note<"template is declared here">;
5296def note_template_decl_external : Note<
5297  "template declaration from hidden source: %0">;
5298def err_template_arg_must_be_type : Error<
5299  "template argument for template type parameter must be a type">;
5300def err_template_arg_must_be_type_suggest : Error<
5301  "template argument for template type parameter must be a type; "
5302  "did you forget 'typename'?">;
5303def ext_ms_template_type_arg_missing_typename : ExtWarn<
5304  "template argument for template type parameter must be a type; "
5305  "omitted 'typename' is a Microsoft extension">,
5306  InGroup<MicrosoftTemplate>;
5307def err_template_arg_must_be_expr : Error<
5308  "template argument for non-type template parameter must be an expression">;
5309def err_template_arg_nontype_ambig : Error<
5310  "template argument for non-type template parameter is treated as function type %0">;
5311def err_template_arg_must_be_template : Error<
5312  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
5313def ext_template_arg_local_type : ExtWarn<
5314  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
5315def ext_template_arg_unnamed_type : ExtWarn<
5316  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
5317def warn_cxx98_compat_template_arg_local_type : Warning<
5318  "local type %0 as template argument is incompatible with C++98">,
5319  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
5320def warn_cxx98_compat_template_arg_unnamed_type : Warning<
5321  "unnamed type as template argument is incompatible with C++98">,
5322  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
5323def note_template_unnamed_type_here : Note<
5324  "unnamed type used in template argument was declared here">;
5325def err_template_arg_overload_type : Error<
5326  "template argument is the type of an unresolved overloaded function">;
5327def err_template_arg_not_valid_template : Error<
5328  "template argument does not refer to a class or alias template, or template "
5329  "template parameter">;
5330def note_template_arg_refers_here_func : Note<
5331  "template argument refers to function template %0, here">;
5332def err_template_arg_template_params_mismatch : Error<
5333  "template template argument has different template parameters than its "
5334  "corresponding template template parameter">;
5335def note_template_arg_template_params_mismatch : Note<
5336  "template template argument has different template parameters than its "
5337  "corresponding template template parameter">;
5338def err_non_deduced_mismatch : Error<
5339  "could not match %diff{$ against $|types}0,1">;
5340def err_inconsistent_deduction : Error<
5341  "conflicting deduction %diff{$ against $|types}0,1 for parameter">;
5342def err_template_arg_not_integral_or_enumeral : Error<
5343  "non-type template argument of type %0 must have an integral or enumeration"
5344  " type">;
5345def err_template_arg_not_ice : Error<
5346  "non-type template argument of type %0 is not an integral constant "
5347  "expression">;
5348def err_template_arg_not_address_constant : Error<
5349  "non-type template argument of type %0 is not a constant expression">;
5350def warn_cxx98_compat_template_arg_null : Warning<
5351  "use of null pointer as non-type template argument is incompatible with "
5352  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5353def err_template_arg_untyped_null_constant : Error<
5354  "null non-type template argument must be cast to template parameter type %0">;
5355def err_template_arg_wrongtype_null_constant : Error<
5356  "null non-type template argument of type %0 does not match template parameter "
5357  "of type %1">;
5358def err_non_type_template_parm_type_deduction_failure : Error<
5359  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
5360def err_deduced_non_type_template_arg_type_mismatch : Error<
5361  "deduced non-type template argument does not have the same type as the "
5362  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
5363def err_non_type_template_arg_subobject : Error<
5364  "non-type template argument refers to subobject '%0'">;
5365def err_non_type_template_arg_addr_label_diff : Error<
5366  "template argument / label address difference / what did you expect?">;
5367def err_template_arg_not_convertible : Error<
5368  "non-type template argument of type %0 cannot be converted to a value "
5369  "of type %1">;
5370def warn_template_arg_negative : Warning<
5371  "non-type template argument with value '%0' converted to '%1' for unsigned "
5372  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5373def warn_template_arg_too_large : Warning<
5374  "non-type template argument value '%0' truncated to '%1' for "
5375  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5376def err_template_arg_no_ref_bind : Error<
5377  "non-type template parameter of reference type "
5378  "%diff{$ cannot bind to template argument of type $"
5379  "|cannot bind to template of incompatible argument type}0,1">;
5380def err_template_arg_ref_bind_ignores_quals : Error<
5381  "reference binding of non-type template parameter "
5382  "%diff{of type $ to template argument of type $|to template argument}0,1 "
5383  "ignores qualifiers">;
5384def err_template_arg_not_decl_ref : Error<
5385  "non-type template argument does not refer to any declaration">;
5386def err_template_arg_not_address_of : Error<
5387  "non-type template argument for template parameter of pointer type %0 must "
5388  "have its address taken">;
5389def err_template_arg_address_of_non_pointer : Error<
5390  "address taken in non-type template argument for template parameter of "
5391  "reference type %0">;
5392def err_template_arg_reference_var : Error<
5393  "non-type template argument of reference type %0 is not an object">;
5394def err_template_arg_field : Error<
5395  "non-type template argument refers to non-static data member %0">;
5396def err_template_arg_method : Error<
5397  "non-type template argument refers to non-static member function %0">;
5398def err_template_arg_object_no_linkage : Error<
5399  "non-type template argument refers to %select{function|object}0 %1 that "
5400  "does not have linkage">;
5401def warn_cxx98_compat_template_arg_object_internal : Warning<
5402  "non-type template argument referring to %select{function|object}0 %1 with "
5403  "internal linkage is incompatible with C++98">,
5404  InGroup<CXX98Compat>, DefaultIgnore;
5405def ext_template_arg_object_internal : ExtWarn<
5406  "non-type template argument referring to %select{function|object}0 %1 with "
5407  "internal linkage is a C++11 extension">, InGroup<CXX11>;
5408def err_template_arg_thread_local : Error<
5409  "non-type template argument refers to thread-local object">;
5410def note_template_arg_internal_object : Note<
5411  "non-type template argument refers to %select{function|object}0 here">;
5412def note_template_arg_refers_here : Note<
5413  "non-type template argument refers here">;
5414def err_template_arg_not_object_or_func : Error<
5415  "non-type template argument does not refer to an object or function">;
5416def err_template_arg_not_pointer_to_member_form : Error<
5417  "non-type template argument is not a pointer to member constant">;
5418def err_template_arg_invalid : Error<
5419  "non-type template argument '%0' is invalid">;
5420def ext_template_arg_extra_parens : ExtWarn<
5421  "address non-type template argument cannot be surrounded by parentheses">;
5422def warn_cxx98_compat_template_arg_extra_parens : Warning<
5423  "redundant parentheses surrounding address non-type template argument are "
5424  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5425def err_pointer_to_member_type : Error<
5426  "invalid use of pointer to member type after %select{.*|->*}0">;
5427def err_pointer_to_member_call_drops_quals : Error<
5428  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
5429def err_pointer_to_member_oper_value_classify: Error<
5430  "pointer-to-member function type %0 can only be called on an "
5431  "%select{rvalue|lvalue}1">;
5432def ext_pointer_to_const_ref_member_on_rvalue : Extension<
5433  "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
5434  InGroup<CXX20>, SFINAEFailure;
5435def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
5436  "invoking a pointer to a 'const &' member function on an rvalue is "
5437  "incompatible with C++ standards before C++20">,
5438  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
5439def ext_ms_deref_template_argument: ExtWarn<
5440  "non-type template argument containing a dereference operation is a "
5441  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5442def ext_ms_delayed_template_argument: ExtWarn<
5443  "using the undeclared type %0 as a default template argument is a "
5444  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5445def err_template_arg_deduced_incomplete_pack : Error<
5446  "deduced incomplete pack %0 for template parameter %1">;
5447
5448// C++ template specialization
5449def err_template_spec_unknown_kind : Error<
5450  "can only provide an explicit specialization for a class template, function "
5451  "template, variable template, or a member function, static data member, "
5452  "%select{or member class|member class, or member enumeration}0 of a "
5453  "class template">;
5454def note_specialized_entity : Note<
5455  "explicitly specialized declaration is here">;
5456def err_template_spec_decl_function_scope : Error<
5457  "explicit specialization of %0 in function scope">;
5458def err_template_spec_decl_friend : Error<
5459  "cannot declare an explicit specialization in a friend">;
5460def err_template_spec_redecl_out_of_scope : Error<
5461  "%select{class template|class template partial|variable template|"
5462  "variable template partial|function template|member "
5463  "function|static data member|member class|member enumeration}0 "
5464  "specialization of %1 not in %select{a namespace enclosing %2|"
5465  "class %2 or an enclosing namespace}3">;
5466def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
5467  "%select{class template|class template partial|variable template|"
5468  "variable template partial|function template|member "
5469  "function|static data member|member class|member enumeration}0 "
5470  "specialization of %1 not in %select{a namespace enclosing %2|"
5471  "class %2 or an enclosing namespace}3 "
5472  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
5473def err_template_spec_redecl_global_scope : Error<
5474  "%select{class template|class template partial|variable template|"
5475  "variable template partial|function template|member "
5476  "function|static data member|member class|member enumeration}0 "
5477  "specialization of %1 must occur at global scope">;
5478def err_spec_member_not_instantiated : Error<
5479  "specialization of member %q0 does not specialize an instantiated member">;
5480def note_specialized_decl : Note<"attempt to specialize declaration here">;
5481def err_specialization_after_instantiation : Error<
5482  "explicit specialization of %0 after instantiation">;
5483def note_instantiation_required_here : Note<
5484  "%select{implicit|explicit}0 instantiation first required here">;
5485def err_template_spec_friend : Error<
5486  "template specialization declaration cannot be a friend">;
5487def err_template_spec_default_arg : Error<
5488  "default argument not permitted on an explicit "
5489  "%select{instantiation|specialization}0 of function %1">;
5490def err_not_class_template_specialization : Error<
5491  "cannot specialize a %select{dependent template|template template "
5492  "parameter}0">;
5493def ext_explicit_specialization_storage_class : ExtWarn<
5494  "explicit specialization cannot have a storage class">, InGroup<ExplicitSpecializationStorageClass>;
5495def err_dependent_function_template_spec_no_match : Error<
5496  "no candidate function template was found for dependent"
5497  " %select{member|friend}0 function template specialization">;
5498def note_dependent_function_template_spec_discard_reason : Note<
5499  "candidate ignored: %select{not a function template|"
5500  "not a member of the enclosing %select{class template|"
5501  "namespace; did you mean to explicitly qualify the specialization?}1}0">;
5502def warn_invalid_specialization : Warning<
5503  "%0 cannot be specialized%select{|: %2}1">,
5504  DefaultError, InGroup<DiagGroup<"invalid-specialization">>;
5505def note_marked_here : Note<"marked %0 here">;
5506
5507// C++ class template specializations and out-of-line definitions
5508def err_template_spec_needs_header : Error<
5509  "template specialization requires 'template<>'">;
5510def err_template_spec_needs_template_parameters : Error<
5511  "template specialization or definition requires a template parameter list "
5512  "corresponding to the nested type %0">;
5513def err_template_param_list_matches_nontemplate : Error<
5514  "template parameter list matching the non-templated nested type %0 should "
5515  "be empty ('template<>')">;
5516def err_alias_template_extra_headers : Error<
5517  "extraneous template parameter list in alias template declaration">;
5518def err_template_spec_extra_headers : Error<
5519  "extraneous template parameter list in template specialization or "
5520  "out-of-line template definition">;
5521def ext_template_spec_extra_headers : ExtWarn<
5522  "extraneous template parameter list in template specialization">,
5523   InGroup<DiagGroup<"extraneous-template-head">>, DefaultError;
5524def note_explicit_template_spec_does_not_need_header : Note<
5525  "'template<>' header not required for explicitly-specialized class %0 "
5526  "declared here">;
5527def err_template_qualified_declarator_no_match : Error<
5528  "nested name specifier '%0' for declaration does not refer into a class, "
5529  "class template or class template partial specialization">;
5530def err_specialize_member_of_template : Error<
5531  "cannot specialize %select{|(with 'template<>') }0a member of an "
5532  "unspecialized template">;
5533
5534// C++ Class Template Partial Specialization
5535def err_default_arg_in_partial_spec : Error<
5536    "default template argument in a class template partial specialization">;
5537def err_dependent_non_type_arg_in_partial_spec : Error<
5538    "type of specialized non-type template argument depends on a template "
5539    "parameter of the partial specialization">;
5540def note_dependent_non_type_default_arg_in_partial_spec : Note<
5541    "template parameter is used in default argument declared here">;
5542def err_dependent_typed_non_type_arg_in_partial_spec : Error<
5543    "non-type template argument specializes a template parameter with "
5544    "dependent type %0">;
5545def err_partial_spec_args_match_primary_template : Error<
5546    "%select{class|variable}0 template partial specialization does not "
5547    "specialize any template argument; to %select{declare|define}1 the "
5548    "primary template, remove the template argument list">;
5549def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
5550    "%select{class|variable}0 template partial specialization is not "
5551    "more specialized than the primary template">, DefaultError,
5552    InGroup<DiagGroup<"invalid-partial-specialization">>;
5553def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
5554def ext_partial_specs_not_deducible : ExtWarn<
5555    "%select{class|variable}0 template partial specialization contains "
5556    "%select{a template parameter|template parameters}1 that cannot be "
5557    "deduced; this partial specialization will never be used">,
5558    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
5559def note_non_deducible_parameter : Note<
5560    "non-deducible template parameter %0">;
5561def err_partial_spec_ordering_ambiguous : Error<
5562    "ambiguous partial specializations of %0">;
5563def note_partial_spec_match : Note<"partial specialization matches %0">;
5564def err_partial_spec_redeclared : Error<
5565  "class template partial specialization %0 cannot be redeclared">;
5566def note_prev_partial_spec_here : Note<
5567  "previous declaration of class template partial specialization %0 is here">;
5568def err_partial_spec_fully_specialized : Error<
5569  "partial specialization of %0 does not use any of its template parameters">;
5570
5571// C++ Variable Template Partial Specialization
5572def err_var_partial_spec_redeclared : Error<
5573  "variable template partial specialization %0 cannot be redefined">;
5574def note_var_prev_partial_spec_here : Note<
5575  "previous declaration of variable template partial specialization is here">;
5576def err_var_spec_no_template : Error<
5577  "no variable template matches%select{| partial}0 specialization">;
5578def err_var_spec_no_template_but_method : Error<
5579  "no variable template matches specialization; "
5580  "did you mean to use %0 as function template instead?">;
5581
5582// C++ Function template specializations
5583def err_function_template_spec_no_match : Error<
5584    "no function template matches function template specialization %0">;
5585def err_function_template_spec_ambiguous : Error<
5586    "function template specialization %0 ambiguously refers to more than one "
5587    "function template; explicitly specify%select{| additional}1 template "
5588    "arguments to identify a particular function template">;
5589def note_function_template_spec_matched : Note<
5590    "function template %q0 matches specialization %1">;
5591def err_function_template_partial_spec : Error<
5592    "function template partial specialization is not allowed">;
5593
5594def err_function_member_spec_ambiguous : Error<
5595    "ambiguous member function specialization %q0 of %q1">;
5596def note_function_member_spec_matched : Note<
5597    "member function specialization matches %0">;
5598
5599// C++ Template Instantiation
5600def err_template_recursion_depth_exceeded : Error<
5601  "recursive template instantiation exceeded maximum depth of %0">,
5602  DefaultFatal, NoSFINAE;
5603def err_constraint_depends_on_self : Error<
5604  "satisfaction of constraint '%0' depends on itself">, NoSFINAE;
5605def note_template_recursion_depth : Note<
5606  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
5607
5608def err_template_instantiate_within_definition : Error<
5609  "%select{implicit|explicit}0 instantiation of template %1 within its"
5610  " own definition">;
5611def err_template_instantiate_undefined : Error<
5612  "%select{implicit|explicit}0 instantiation of undefined template %1">;
5613def err_implicit_instantiate_member_undefined : Error<
5614  "implicit instantiation of undefined member %0">;
5615def note_template_class_instantiation_was_here : Note<
5616  "class template %0 was instantiated here">;
5617def note_template_class_explicit_specialization_was_here : Note<
5618  "class template %0 was explicitly specialized here">;
5619def note_template_class_instantiation_here : Note<
5620  "in instantiation of template class %q0 requested here">;
5621def note_template_member_class_here : Note<
5622  "in instantiation of member class %q0 requested here">;
5623def note_template_member_function_here : Note<
5624  "in instantiation of member function %q0 requested here">;
5625def note_function_template_spec_here : Note<
5626  "in instantiation of function template specialization %q0 requested here">;
5627def note_template_static_data_member_def_here : Note<
5628  "in instantiation of static data member %q0 requested here">;
5629def note_template_variable_def_here : Note<
5630  "in instantiation of variable template specialization %q0 requested here">;
5631def note_template_enum_def_here : Note<
5632  "in instantiation of enumeration %q0 requested here">;
5633def note_template_nsdmi_here : Note<
5634  "in instantiation of default member initializer %q0 requested here">;
5635def note_template_type_alias_instantiation_here : Note<
5636  "in instantiation of template type alias %0 requested here">;
5637def note_template_exception_spec_instantiation_here : Note<
5638  "in instantiation of exception specification for %0 requested here">;
5639def note_template_requirement_instantiation_here : Note<
5640  "in instantiation of requirement here">;
5641def note_template_requirement_params_instantiation_here : Note<
5642  "in instantiation of requirement parameters here">;
5643def warn_var_template_missing : Warning<"instantiation of variable %q0 "
5644  "required here, but no definition is available">,
5645  InGroup<UndefinedVarTemplate>;
5646def warn_func_template_missing : Warning<"instantiation of function %q0 "
5647  "required here, but no definition is available">,
5648  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
5649def note_forward_template_decl : Note<
5650  "forward declaration of template entity is here">;
5651def note_inst_declaration_hint : Note<"add an explicit instantiation "
5652  "declaration to suppress this warning if %q0 is explicitly instantiated in "
5653  "another translation unit">;
5654def note_evaluating_exception_spec_here : Note<
5655  "in evaluation of exception specification for %q0 needed here">;
5656
5657def note_default_arg_instantiation_here : Note<
5658  "in instantiation of default argument for '%0' required here">;
5659def note_default_function_arg_instantiation_here : Note<
5660  "in instantiation of default function argument expression "
5661  "for '%0' required here">;
5662def note_explicit_template_arg_substitution_here : Note<
5663  "while substituting explicitly-specified template arguments into function "
5664  "template %0 %1">;
5665def note_function_template_deduction_instantiation_here : Note<
5666  "while substituting deduced template arguments into function template %0 "
5667  "%1">;
5668def note_deduced_template_arg_substitution_here : Note<
5669  "during template argument deduction for %select{class|variable}0 template "
5670  "%select{partial specialization |}1%2 %3">;
5671def note_prior_template_arg_substitution : Note<
5672  "while substituting prior template arguments into %select{non-type|template}0"
5673  " template parameter%1 %2">;
5674def note_template_default_arg_checking : Note<
5675  "while checking a default template argument used here">;
5676def note_concept_specialization_here : Note<
5677  "while checking the satisfaction of concept '%0' requested here">;
5678def note_nested_requirement_here : Note<
5679  "while checking the satisfaction of nested requirement requested here">;
5680def note_checking_constraints_for_template_id_here : Note<
5681  "while checking constraint satisfaction for template '%0' required here">;
5682def note_checking_constraints_for_var_spec_id_here : Note<
5683  "while checking constraint satisfaction for variable template "
5684  "partial specialization '%0' required here">;
5685def note_checking_constraints_for_class_spec_id_here : Note<
5686  "while checking constraint satisfaction for class template partial "
5687  "specialization '%0' required here">;
5688def note_checking_constraints_for_function_here : Note<
5689  "while checking constraint satisfaction for function '%0' required here">;
5690def note_constraint_substitution_here : Note<
5691  "while substituting template arguments into constraint expression here">;
5692def note_constraint_normalization_here : Note<
5693  "while calculating associated constraint of template %0 here">;
5694def note_parameter_mapping_substitution_here : Note<
5695  "while substituting into concept arguments here; substitution failures not "
5696  "allowed in concept arguments">;
5697def note_building_deduction_guide_here : Note<
5698  "while building implicit deduction guide first needed here">;
5699def note_lambda_substitution_here : Note<
5700  "while substituting into a lambda expression here">;
5701def note_instantiation_contexts_suppressed : Note<
5702  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
5703  "see all)">;
5704
5705def err_field_instantiates_to_function : Error<
5706  "data member instantiated with function type %0">;
5707def err_variable_instantiates_to_function : Error<
5708  "%select{variable|static data member}0 instantiated with function type %1">;
5709def err_nested_name_spec_non_tag : Error<
5710  "type %0 cannot be used prior to '::' because it has no members">;
5711
5712def err_using_pack_expansion_empty : Error<
5713  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
5714
5715// C++ Explicit Instantiation
5716def err_explicit_instantiation_duplicate : Error<
5717    "duplicate explicit instantiation of %0">;
5718def ext_explicit_instantiation_duplicate : ExtWarn<
5719    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
5720    InGroup<MicrosoftTemplate>;
5721def note_previous_explicit_instantiation : Note<
5722    "previous explicit instantiation is here">;
5723def warn_explicit_instantiation_after_specialization : Warning<
5724  "explicit instantiation of %0 that occurs after an explicit "
5725  "specialization has no effect">,
5726  InGroup<DiagGroup<"instantiation-after-specialization">>;
5727def note_previous_template_specialization : Note<
5728    "previous template specialization is here">;
5729def err_explicit_instantiation_nontemplate_type : Error<
5730    "explicit instantiation of non-templated type %0">;
5731def note_nontemplate_decl_here : Note<
5732    "non-templated declaration is here">;
5733def err_explicit_instantiation_in_class : Error<
5734  "explicit instantiation of %0 in class scope">;
5735def err_explicit_instantiation_out_of_scope : Error<
5736  "explicit instantiation of %0 not in a namespace enclosing %1">;
5737def err_explicit_instantiation_must_be_global : Error<
5738  "explicit instantiation of %0 must occur at global scope">;
5739def warn_explicit_instantiation_out_of_scope_0x : Warning<
5740  "explicit instantiation of %0 not in a namespace enclosing %1">,
5741  InGroup<CXX11Compat>, DefaultIgnore;
5742def warn_explicit_instantiation_must_be_global_0x : Warning<
5743  "explicit instantiation of %0 must occur at global scope">,
5744  InGroup<CXX11Compat>, DefaultIgnore;
5745
5746def err_explicit_instantiation_requires_name : Error<
5747  "explicit instantiation declaration requires a name">;
5748def err_explicit_instantiation_of_typedef : Error<
5749  "explicit instantiation of typedef %0">;
5750def err_explicit_instantiation_storage_class : Error<
5751  "explicit instantiation cannot have a storage class">;
5752def err_explicit_instantiation_internal_linkage : Error<
5753  "explicit instantiation declaration of %0 with internal linkage">;
5754def err_explicit_instantiation_not_known : Error<
5755  "explicit instantiation of %0 does not refer to a function template, "
5756  "variable template, member function, member class, or static data member">;
5757def err_explicit_instantiation_no_candidate : Error<
5758    "no viable candidate for explicit instantiation of %0">;
5759def note_explicit_instantiation_here : Note<
5760  "explicit instantiation refers here">;
5761def err_explicit_instantiation_data_member_not_instantiated : Error<
5762  "explicit instantiation refers to static data member %q0 that is not an "
5763  "instantiation">;
5764def err_explicit_instantiation_member_function_not_instantiated : Error<
5765  "explicit instantiation refers to member function %q0 that is not an "
5766  "instantiation">;
5767def err_explicit_instantiation_ambiguous : Error<
5768  "partial ordering for explicit instantiation of %0 is ambiguous">;
5769def note_explicit_instantiation_candidate : Note<
5770  "explicit instantiation candidate function %q0 template here %1">;
5771def err_explicit_instantiation_inline : Error<
5772  "explicit instantiation cannot be 'inline'">;
5773def warn_explicit_instantiation_inline_0x : Warning<
5774  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5775  DefaultIgnore;
5776def err_explicit_instantiation_constexpr : Error<
5777  "explicit instantiation cannot be 'constexpr'">;
5778def ext_explicit_instantiation_without_qualified_id : Extension<
5779  "qualifier in explicit instantiation of %q0 requires a template-id "
5780  "(a typedef is not permitted)">;
5781def err_explicit_instantiation_without_template_id : Error<
5782  "explicit instantiation of %q0 must specify a template argument list">;
5783def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5784  "explicit instantiation of %q0 must occur in namespace %1">;
5785def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5786  "explicit instantiation of %q0 must occur in namespace %1">,
5787  InGroup<CXX11Compat>, DefaultIgnore;
5788def err_explicit_instantiation_undefined_member : Error<
5789  "explicit instantiation of undefined %select{member class|member function|"
5790  "static data member}0 %1 of class template %2">;
5791def err_explicit_instantiation_undefined_func_template : Error<
5792  "explicit instantiation of undefined function template %0">;
5793def err_explicit_instantiation_undefined_var_template : Error<
5794  "explicit instantiation of undefined variable template %q0">;
5795def err_explicit_instantiation_declaration_after_definition : Error<
5796  "explicit instantiation declaration (with 'extern') follows explicit "
5797  "instantiation definition (without 'extern')">;
5798def note_explicit_instantiation_definition_here : Note<
5799  "explicit instantiation definition is here">;
5800def err_invalid_var_template_spec_type : Error<"type %2 "
5801  "of %select{explicit instantiation|explicit specialization|"
5802  "partial specialization|redeclaration}0 of %1 does not match"
5803  " expected type %3">;
5804def err_mismatched_exception_spec_explicit_instantiation : Error<
5805  "exception specification in explicit instantiation does not match "
5806  "instantiated one">;
5807def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5808  err_mismatched_exception_spec_explicit_instantiation.Summary>,
5809  InGroup<MicrosoftExceptionSpec>;
5810def err_explicit_instantiation_dependent : Error<
5811  "explicit instantiation has dependent template arguments">;
5812
5813// C++ typename-specifiers
5814def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5815def err_typename_nested_not_found_enable_if : Error<
5816  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5817  "this declaration">;
5818def err_typename_nested_not_found_requirement : Error<
5819  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5820  "declaration">;
5821def err_typename_nested_not_type : Error<
5822    "typename specifier refers to non-type member %0 in %1">;
5823def err_typename_not_type : Error<
5824    "typename specifier refers to non-type %0">;
5825def note_typename_member_refers_here : Note<
5826    "referenced member %0 is declared here">;
5827def note_typename_refers_here : Note<
5828    "referenced %0 is declared here">;
5829def err_typename_missing : Error<
5830  "missing 'typename' prior to dependent type name '%0%1'">;
5831def err_typename_missing_template : Error<
5832  "missing 'typename' prior to dependent type template name '%0%1'">;
5833def ext_typename_missing : ExtWarn<
5834  "missing 'typename' prior to dependent type name '%0%1'">,
5835  InGroup<DiagGroup<"typename-missing">>;
5836def ext_typename_outside_of_template : ExtWarn<
5837  "'typename' occurs outside of a template">, InGroup<CXX11>;
5838def warn_cxx98_compat_typename_outside_of_template : Warning<
5839  "use of 'typename' outside of a template is incompatible with C++98">,
5840  InGroup<CXX98Compat>, DefaultIgnore;
5841def err_typename_refers_to_using_value_decl : Error<
5842  "typename specifier refers to a dependent using declaration for a value "
5843  "%0 in %1">;
5844def note_using_value_decl_missing_typename : Note<
5845  "add 'typename' to treat this using declaration as a type">;
5846def warn_cxx17_compat_implicit_typename : Warning<"use of implicit 'typename' is "
5847  "incompatible with C++ standards before C++20">, InGroup<CXX20Compat>,
5848  DefaultIgnore;
5849def ext_implicit_typename : ExtWarn<"missing 'typename' prior to dependent "
5850  "type name %0%1; implicit 'typename' is a C++20 extension">,
5851  InGroup<CXX20>;
5852
5853def err_template_kw_refers_to_non_template : Error<
5854  "%0%select{| following the 'template' keyword}1 "
5855  "does not refer to a template">;
5856def note_template_kw_refers_to_non_template : Note<
5857  "declared as a non-template here">;
5858def err_template_kw_refers_to_dependent_non_template : Error<
5859  "%0%select{| following the 'template' keyword}1 "
5860  "cannot refer to a dependent template">;
5861def err_template_kw_refers_to_type_template : Error<
5862  "'%0%1' is expected to be a non-type template, but instantiated to a %select{class|type alias}2 template">;
5863def note_referenced_type_template : Note<
5864  "%select{class|type alias}0 template declared here">;
5865def err_template_kw_missing : Error<
5866  "missing 'template' keyword prior to dependent template name '%0%1'">;
5867def ext_template_outside_of_template : ExtWarn<
5868  "'template' keyword outside of a template">, InGroup<CXX11>;
5869def warn_cxx98_compat_template_outside_of_template : Warning<
5870  "use of 'template' keyword outside of a template is incompatible with C++98">,
5871  InGroup<CXX98Compat>, DefaultIgnore;
5872
5873def err_non_type_template_in_nested_name_specifier : Error<
5874  "qualified name refers into a specialization of %select{function|variable}0 "
5875  "template %1">;
5876def err_template_id_not_a_type : Error<
5877  "template name refers to non-type template %0">;
5878def note_template_declared_here : Note<
5879  "%select{function template|class template|variable template"
5880  "|type alias template|template template parameter}0 "
5881  "%1 declared here">;
5882def err_template_expansion_into_fixed_list : Error<
5883  "pack expansion used as argument for non-pack parameter of %select{alias "
5884  "template|concept}0">;
5885def note_parameter_type : Note<
5886  "parameter of type %0 is declared here">;
5887
5888// C++11 Variadic Templates
5889def err_template_param_pack_default_arg : Error<
5890  "template parameter pack cannot have a default argument">;
5891def err_template_param_pack_must_be_last_template_parameter : Error<
5892  "template parameter pack must be the last template parameter">;
5893
5894def err_template_parameter_pack_non_pack : Error<
5895  "%select{template type|non-type template|template template}0 parameter"
5896  "%select{| pack}1 conflicts with previous %select{template type|"
5897  "non-type template|template template}0 parameter%select{ pack|}1">;
5898def note_template_parameter_pack_non_pack : Note<
5899  "%select{template type|non-type template|template template}0 parameter"
5900  "%select{| pack}1 does not match %select{template type|non-type template"
5901  "|template template}0 parameter%select{ pack|}1 in template argument">;
5902def note_template_parameter_pack_here : Note<
5903  "previous %select{template type|non-type template|template template}0 "
5904  "parameter%select{| pack}1 declared here">;
5905
5906def err_unexpanded_parameter_pack : Error<
5907  "%select{expression|base type|declaration type|data member type|bit-field "
5908  "size|static assertion|fixed underlying type|enumerator value|"
5909  "using declaration|friend declaration|qualifier|initializer|default argument|"
5910  "non-type template parameter type|exception type|explicit specialization|"
5911  "partial specialization|__if_exists name|__if_not_exists name|lambda|block|"
5912  "type constraint|requirement|requires clause}0 "
5913  "contains%plural{0: an|:}1 unexpanded parameter pack"
5914  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5915
5916def err_pack_expansion_without_parameter_packs : Error<
5917  "pack expansion does not contain any unexpanded parameter packs">;
5918def err_pack_expansion_length_conflict : Error<
5919  "pack expansion contains parameter packs %0 and %1 that have different "
5920  "lengths (%2 vs. %select{|at least }3%4)">;
5921def err_pack_expansion_length_conflict_multilevel : Error<
5922  "pack expansion contains parameter pack %0 that has a different "
5923  "length (%1 vs. %select{|at least }2%3) from outer parameter packs">;
5924def err_pack_expansion_length_conflict_partial : Error<
5925  "pack expansion contains parameter pack %0 that has a different "
5926  "length (at least %1 vs. %2) from outer parameter packs">;
5927def err_pack_expansion_member_init : Error<
5928  "pack expansion for initialization of member %0">;
5929
5930def err_function_parameter_pack_without_parameter_packs : Error<
5931  "type %0 of function parameter pack does not contain any unexpanded "
5932  "parameter packs">;
5933def err_ellipsis_in_declarator_not_parameter : Error<
5934  "only function and template parameters can be parameter packs">;
5935
5936def err_expected_name_of_pack : Error<
5937  "%0 does not refer to the name of a parameter pack">;
5938
5939def err_pack_index_out_of_bound : Error<
5940  "invalid index %0 for pack %1 of size %2">;
5941
5942def ext_pack_indexing : ExtWarn<
5943  "pack indexing is a C++2c extension">, InGroup<CXX26>;
5944def warn_cxx23_pack_indexing : Warning<
5945  "pack indexing is incompatible with C++ standards before C++2c">,
5946  DefaultIgnore, InGroup<CXXPre26Compat>;
5947
5948def err_pack_outside_template : Error<
5949  "pack declaration outside of template">;
5950
5951def err_fold_expression_packs_both_sides : Error<
5952  "binary fold expression has unexpanded parameter packs in both operands">;
5953def err_fold_expression_empty : Error<
5954  "unary fold expression has empty expansion for operator '%0' "
5955  "with no fallback value">;
5956def err_fold_expression_bad_operand : Error<
5957  "expression not permitted as operand of fold expression">;
5958def err_fold_expression_limit_exceeded: Error<
5959  "instantiating fold expression with %0 arguments exceeded expression nesting "
5960  "limit of %1">, DefaultFatal, NoSFINAE;
5961
5962def err_unexpected_typedef : Error<
5963  "unexpected type name %0: expected expression">;
5964def err_unexpected_namespace : Error<
5965  "unexpected namespace name %0: expected expression">;
5966def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5967def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5968  "use of undeclared identifier %0; "
5969  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5970  InGroup<MicrosoftTemplate>;
5971def err_found_in_dependent_base : Error<
5972  "explicit qualification required to use member %0 from dependent base class">;
5973def ext_found_in_dependent_base : ExtWarn<"use of member %0 "
5974  "found via unqualified lookup into dependent bases of class templates is a "
5975  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5976def err_found_later_in_class : Error<"member %0 used before its declaration">;
5977def ext_found_later_in_class : ExtWarn<
5978  "use of member %0 before its declaration is a Microsoft extension">,
5979  InGroup<MicrosoftTemplate>;
5980def ext_unqualified_base_class : ExtWarn<
5981  "unqualified base initializer of class templates is a Microsoft extension">,
5982  InGroup<MicrosoftTemplate>;
5983def note_dependent_member_use : Note<
5984  "must qualify identifier to find this declaration in dependent base class">;
5985def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5986    "visible in the template definition nor found by argument-dependent lookup">;
5987def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5988    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5989def err_undeclared_use : Error<"use of undeclared %0">;
5990def warn_deprecated : Warning<"%0 is deprecated">,
5991    InGroup<DeprecatedDeclarations>;
5992def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5993def warn_property_method_deprecated :
5994    Warning<"property access is using %0 method which is deprecated">,
5995    InGroup<DeprecatedDeclarations>;
5996def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5997    InGroup<DeprecatedDeclarations>;
5998def warn_deprecated_anonymous_namespace : Warning<
5999  "'deprecated' attribute on anonymous namespace ignored">,
6000  InGroup<IgnoredAttributes>;
6001def warn_deprecated_fwdclass_message : Warning<
6002    "%0 may be deprecated because the receiver type is unknown">,
6003    InGroup<DeprecatedDeclarations>;
6004def warn_deprecated_def : Warning<
6005  "implementing deprecated %select{method|class|category}0">,
6006  InGroup<DeprecatedImplementations>, DefaultIgnore;
6007def warn_unavailable_def : Warning<
6008  "implementing unavailable method">,
6009  InGroup<DeprecatedImplementations>, DefaultIgnore;
6010def warn_deprecated_builtin : Warning<
6011  "builtin %0 is deprecated; use %1 instead">,
6012  InGroup<DeprecatedBuiltins>;
6013def err_unavailable : Error<"%0 is unavailable">;
6014def err_property_method_unavailable :
6015    Error<"property access is using %0 method which is unavailable">;
6016def err_unavailable_message : Error<"%0 is unavailable: %1">;
6017def warn_unavailable_fwdclass_message : Warning<
6018    "%0 may be unavailable because the receiver type is unknown">,
6019    InGroup<UnavailableDeclarations>;
6020def note_availability_specified_here : Note<
6021  "%0 has been explicitly marked "
6022  "%select{unavailable|deleted|deprecated}1 here">;
6023def note_partial_availability_specified_here : Note<
6024  "%0 has been marked as being introduced in %1 %2 %select{|in %5 environment }4here, "
6025  "but the deployment target is %1 %3%select{| %6 environment }4">;
6026def note_implicitly_deleted : Note<
6027  "explicitly defaulted function was implicitly deleted here">;
6028def warn_not_enough_argument : Warning<
6029  "not enough variable arguments in %0 declaration to fit a sentinel">,
6030  InGroup<Sentinel>;
6031def warn_missing_sentinel : Warning <
6032  "missing sentinel in %select{function call|method dispatch|block call}0">,
6033  InGroup<Sentinel>;
6034def note_sentinel_here : Note<
6035  "%select{function|method|block}0 has been explicitly marked sentinel here">;
6036def warn_strict_uses_without_prototype : Warning<
6037  "passing arguments to %select{a function|%1}0 without a prototype is "
6038  "deprecated in all versions of C and is not supported in C23">,
6039  InGroup<DeprecatedNonPrototype>;
6040def warn_missing_prototype : Warning<
6041  "no previous prototype for function %0">,
6042  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
6043def note_declaration_not_a_prototype : Note<
6044  "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
6045  "to make it %select{a prototype for a zero-parameter function|one}0">;
6046// This is not actually an extension, but we only want it to be enabled in
6047// -pedantic mode and this is the most direct way of accomplishing that.
6048def warn_strict_prototypes : Extension<
6049  "a %select{function|block}0 declaration without a prototype is deprecated "
6050  "%select{in all versions of C|}0">, InGroup<StrictPrototypes>;
6051def warn_non_prototype_changes_behavior : Warning<
6052  "a function %select{declaration|definition}0 without a prototype is "
6053  "deprecated in all versions of C %select{and is not supported in C23|and is "
6054  "treated as a zero-parameter prototype in C23, conflicting with a "
6055  "%select{previous|subsequent}2 %select{declaration|definition}3}1">,
6056  InGroup<DeprecatedNonPrototype>;
6057def note_conflicting_prototype : Note<"conflicting prototype is here">;
6058def warn_missing_variable_declarations : Warning<
6059  "no previous extern declaration for non-static variable %0">,
6060  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
6061def note_static_for_internal_linkage : Note<
6062  "declare 'static' if the %select{variable|function}0 is not intended to be "
6063  "used outside of this translation unit">;
6064def err_static_data_member_reinitialization :
6065  Error<"static data member %0 already has an initializer">;
6066def err_redefinition : Error<"redefinition of %0">;
6067def err_alias_after_tentative :
6068  Error<"alias definition of %0 after tentative definition">;
6069def err_alias_is_definition :
6070  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
6071def err_definition_of_implicitly_declared_member : Error<
6072  "definition of implicitly declared %select{default constructor|copy "
6073  "constructor|move constructor|copy assignment operator|move assignment "
6074  "operator|destructor|function}1">;
6075def err_definition_of_explicitly_defaulted_member : Error<
6076  "definition of explicitly defaulted %select{default constructor|copy "
6077  "constructor|move constructor|copy assignment operator|move assignment "
6078  "operator|destructor|function}0">;
6079def err_redefinition_extern_inline : Error<
6080  "redefinition of a 'extern inline' function %0 is not supported in "
6081  "%select{C99 mode|C++}1">;
6082def warn_attr_abi_tag_namespace : Warning<
6083  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
6084  InGroup<IgnoredAttributes>;
6085def err_abi_tag_on_redeclaration : Error<
6086  "cannot add 'abi_tag' attribute in a redeclaration">;
6087def err_new_abi_tag_on_redeclaration : Error<
6088  "'abi_tag' %0 missing in original declaration">;
6089def note_use_ifdef_guards : Note<
6090  "unguarded header; consider using #ifdef guards or #pragma once">;
6091
6092def warn_var_decl_not_read_only : Warning<
6093  "object of type %0 cannot be placed in read-only memory">,
6094  InGroup<ReadOnlyPlacementChecks>;
6095def note_enforce_read_only_placement : Note<"type was declared read-only here">;
6096
6097
6098def note_deleted_dtor_no_operator_delete : Note<
6099  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
6100def note_deleted_special_member_class_subobject : Note<
6101  "%select{default constructor of|copy constructor of|move constructor of|"
6102  "copy assignment operator of|move assignment operator of|destructor of|"
6103  "constructor inherited by}0 "
6104  "%1 is implicitly deleted because "
6105  "%select{base class %3|%select{||||variant }4field %3}2 "
6106  "%select{has "
6107  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
6108  "%select{%select{default constructor|copy constructor|move constructor|copy "
6109  "assignment operator|move assignment operator|destructor|"
6110  "%select{default|corresponding|default|default|default}4 constructor}0|"
6111  "destructor}5"
6112  "%select{||s||}4"
6113  "|is an ObjC pointer}6">;
6114def note_deleted_default_ctor_uninit_field : Note<
6115  "%select{default constructor of|constructor inherited by}0 "
6116  "%1 is implicitly deleted because field %2 of "
6117  "%select{reference|const-qualified}4 type %3 would not be initialized">;
6118def note_deleted_default_ctor_all_const : Note<
6119  "%select{default constructor of|constructor inherited by}0 "
6120  "%1 is implicitly deleted because all "
6121  "%select{data members|data members of an anonymous union member}2"
6122  " are const-qualified">;
6123def note_deleted_copy_ctor_rvalue_reference : Note<
6124  "copy constructor of %0 is implicitly deleted because field %1 is of "
6125  "rvalue reference type %2">;
6126def note_deleted_copy_user_declared_move : Note<
6127  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
6128  " %1 has a user-declared move %select{constructor|assignment operator}2">;
6129def note_deleted_assign_field : Note<
6130  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
6131  "because field %2 is of %select{reference|const-qualified}4 type %3">;
6132
6133// These should be errors.
6134def warn_undefined_internal : ExtWarn<
6135  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
6136  InGroup<DiagGroup<"undefined-internal">>;
6137def err_undefined_internal_type : Error<
6138  "%select{function|variable}0 %q1 is used but not defined in this "
6139  "translation unit, and cannot be defined in any other translation unit "
6140  "because its type does not have linkage">;
6141def ext_undefined_internal_type : Extension<
6142  "ISO C++ requires a definition in this translation unit for "
6143  "%select{function|variable}0 %q1 because its type does not have linkage">,
6144  InGroup<DiagGroup<"undefined-internal-type">>;
6145def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
6146  InGroup<DiagGroup<"undefined-inline">>;
6147def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
6148def note_used_here : Note<"used here">;
6149
6150def err_attribute_missing_on_first_decl : Error<
6151  "%0 attribute does not appear on the first declaration">;
6152def warn_internal_linkage_local_storage : Warning<
6153  "'internal_linkage' attribute on a non-static local variable is ignored">,
6154  InGroup<IgnoredAttributes>;
6155
6156def ext_internal_in_extern_inline : ExtWarn<
6157  "static %select{function|variable}0 %1 is used in an inline function with "
6158  "external linkage">, InGroup<StaticInInline>;
6159def ext_internal_in_extern_inline_quiet : Extension<
6160  "static %select{function|variable}0 %1 is used in an inline function with "
6161  "external linkage">, InGroup<StaticInInline>;
6162def warn_static_local_in_extern_inline : Warning<
6163  "non-constant static local variable in inline function may be different "
6164  "in different files">, InGroup<StaticLocalInInline>;
6165def note_convert_inline_to_static : Note<
6166  "use 'static' to give inline function %0 internal linkage">;
6167
6168def ext_redefinition_of_typedef : ExtWarn<
6169  "redefinition of typedef %0 is a C11 feature">,
6170  InGroup<DiagGroup<"typedef-redefinition"> >;
6171def err_redefinition_variably_modified_typedef : Error<
6172  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
6173
6174def err_inline_decl_follows_def : Error<
6175  "inline declaration of %0 follows non-inline definition">;
6176def err_inline_declaration_block_scope : Error<
6177  "inline declaration of %0 not allowed in block scope">;
6178def err_static_non_static : Error<
6179  "static declaration of %0 follows non-static declaration">;
6180def err_different_language_linkage : Error<
6181  "declaration of %0 has a different language linkage">;
6182def ext_retained_language_linkage : Extension<
6183  "friend function %0 retaining previous language linkage is an extension">,
6184  InGroup<DiagGroup<"retained-language-linkage">>;
6185def err_extern_c_global_conflict : Error<
6186  "declaration of %1 %select{with C language linkage|in global scope}0 "
6187  "conflicts with declaration %select{in global scope|with C language linkage}0">;
6188def note_extern_c_global_conflict : Note<
6189  "declared %select{in global scope|with C language linkage}0 here">;
6190def note_extern_c_begins_here : Note<
6191  "extern \"C\" language linkage specification begins here">;
6192def warn_weak_import : Warning <
6193  "%0 cannot be declared 'weak_import' because its definition has been provided">;
6194def ext_static_non_static : Extension<
6195  "redeclaring non-static %0 as static is a Microsoft extension">,
6196  InGroup<MicrosoftRedeclareStatic>;
6197def err_non_static_static : Error<
6198  "non-static declaration of %0 follows static declaration">;
6199def err_extern_non_extern : Error<
6200  "extern declaration of %0 follows non-extern declaration">;
6201def err_non_extern_extern : Error<
6202  "non-extern declaration of %0 follows extern declaration">;
6203def err_non_thread_thread : Error<
6204  "non-thread-local declaration of %0 follows thread-local declaration">;
6205def err_thread_non_thread : Error<
6206  "thread-local declaration of %0 follows non-thread-local declaration">;
6207def err_thread_thread_different_kind : Error<
6208  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
6209  "follows declaration with %select{dynamic|static}1 initialization">;
6210def err_mismatched_owning_module : Error<
6211  "declaration of %0 in %select{the global module|module %2}1 follows "
6212  "declaration in %select{the global module|module %4}3">;
6213def err_multiple_decl_in_different_modules : Error<
6214  "declaration %0 attached to named module '%1' cannot be attached to "
6215  "other modules">;
6216def err_redefinition_different_type : Error<
6217  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
6218def err_redefinition_different_kind : Error<
6219  "redefinition of %0 as different kind of symbol">;
6220def err_redefinition_different_namespace_alias : Error<
6221  "redefinition of %0 as an alias for a different namespace">;
6222def note_previous_namespace_alias : Note<
6223  "previously defined as an alias for %0">;
6224def warn_forward_class_redefinition : Warning<
6225  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
6226  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
6227def err_redefinition_different_typedef : Error<
6228  "%select{typedef|type alias|type alias template}0 "
6229  "redefinition with different types%diff{ ($ vs $)|}1,2">;
6230def err_redefinition_different_concept : Error<
6231  "redefinition of concept %0 with different template parameters or requirements">;
6232def err_tag_reference_non_tag : Error<
6233  "%select{non-struct type|non-class type|non-union type|non-enum "
6234  "type|typedef|type alias|template|alias template|template "
6235  "template argument}1 %0 cannot be referenced with the '"
6236  "%select{struct|interface|union|class|enum}2' specifier">;
6237def err_tag_reference_conflict : Error<
6238  "implicit declaration introduced by elaborated type conflicts with a "
6239  "%select{non-struct type|non-class type|non-union type|non-enum "
6240  "type|typedef|type alias|template|type alias template|template "
6241  "template argument}0 of the same name">;
6242def err_dependent_tag_decl : Error<
6243  "%select{declaration|definition}0 of "
6244  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
6245def err_tag_definition_of_typedef : Error<
6246  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
6247def err_conflicting_types : Error<"conflicting types for %0">;
6248def err_different_pass_object_size_params : Error<
6249  "conflicting pass_object_size attributes on parameters">;
6250def err_late_asm_label_name : Error<
6251  "cannot apply asm label to %select{variable|function}0 after its first use">;
6252def err_different_asm_label : Error<"conflicting asm label">;
6253def err_nested_redefinition : Error<"nested redefinition of %0">;
6254def err_use_with_wrong_tag : Error<
6255  "use of %0 with tag type that does not match previous declaration">;
6256def warn_struct_class_tag_mismatch : Warning<
6257  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
6258  "declared as a %select{struct|interface|class}3%select{| template}1; "
6259  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
6260  InGroup<MismatchedTags>, DefaultIgnore;
6261def warn_struct_class_previous_tag_mismatch : Warning<
6262  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
6263  "here but previously declared as "
6264  "%select{a struct|an interface|a class}3%select{| template}1; "
6265  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
6266  InGroup<MismatchedTags>, DefaultIgnore;
6267def note_struct_class_suggestion : Note<
6268  "did you mean %select{struct|interface|class}0 here?">;
6269def ext_forward_ref_enum : Extension<
6270  "ISO C forbids forward references to 'enum' types">;
6271def err_forward_ref_enum : Error<
6272  "ISO C++ forbids forward references to 'enum' types">;
6273def ext_ms_forward_ref_enum : ExtWarn<
6274  "forward references to 'enum' types are a Microsoft extension">,
6275  InGroup<MicrosoftEnumForwardReference>;
6276def ext_forward_ref_enum_def : Extension<
6277  "redeclaration of already-defined enum %0 is a GNU extension">,
6278  InGroup<GNURedeclaredEnum>;
6279
6280def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
6281def err_duplicate_member : Error<"duplicate member %0">;
6282def err_misplaced_ivar : Error<
6283  "instance variables may not be placed in %select{categories|class extension}0">;
6284def warn_ivars_in_interface : Warning<
6285  "declaration of instance variables in the interface is deprecated">,
6286  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
6287def ext_c23_enum_value_not_int : Extension<
6288  "%select{|incremented }0enumerator value which exceeds the range of 'int' is "
6289  "a C23 extension (%1 is too %select{small|large}2)">, InGroup<C23>;
6290def warn_c17_compat_enum_value_not_int : Warning<
6291  "%select{|incremented }0enumerator value which exceeds the range of 'int' is "
6292  "incompatible with C standards before C23 (%1 is too %select{small|large}2)">,
6293  DefaultIgnore, InGroup<CPre23Compat>;
6294def ext_enum_too_large : ExtWarn<
6295  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
6296def ext_enumerator_increment_too_large : ExtWarn<
6297  "incremented enumerator value %0 is not representable in the "
6298  "largest integer type">, InGroup<EnumTooLarge>;
6299def warn_flag_enum_constant_out_of_range : Warning<
6300  "enumeration value %0 is out of range of flags in enumeration type %1">,
6301  InGroup<FlagEnum>;
6302
6303def err_vm_decl_in_file_scope : Error<
6304  "variably modified type declaration not allowed at file scope">;
6305def err_vm_decl_has_extern_linkage : Error<
6306  "variably modified type declaration cannot have 'extern' linkage">;
6307def err_typecheck_field_variable_size : Error<
6308  "fields must have a constant size: 'variable length array in structure' "
6309  "extension will never be supported">;
6310def err_vm_func_decl : Error<
6311  "function declaration cannot have variably modified type">;
6312def err_array_too_large : Error<
6313  "array is too large (%0 elements)">;
6314
6315def err_typecheck_negative_array_size : Error<"array size is negative">;
6316def warn_typecheck_function_qualifiers_ignored : Warning<
6317  "'%0' qualifier on function type %1 has no effect">,
6318  InGroup<IgnoredQualifiers>;
6319def ext_typecheck_function_qualifiers_unspecified : ExtWarn<
6320  "'%0' qualifier on function type %1 has no effect and is a Clang extension">,
6321  InGroup<IgnoredQualifiers>;
6322def warn_typecheck_reference_qualifiers : Warning<
6323  "'%0' qualifier on reference type %1 has no effect">,
6324  InGroup<IgnoredReferenceQualifiers>;
6325def err_typecheck_invalid_restrict_not_pointer : Error<
6326  "restrict requires a pointer or reference (%0 is invalid)">;
6327def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
6328  "restrict requires a pointer or reference">;
6329def err_typecheck_invalid_restrict_invalid_pointee : Error<
6330  "pointer to function type %0 may not be 'restrict' qualified">;
6331def ext_typecheck_zero_array_size : Extension<
6332  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
6333def err_typecheck_zero_array_size : Error<
6334  "zero-length arrays are not permitted in %select{C++|SYCL device code|HIP device code}0">;
6335def err_array_size_non_int : Error<"size of array has non-integer type %0">;
6336def err_init_element_not_constant : Error<
6337  "initializer element is not a compile-time constant">;
6338def ext_aggregate_init_not_constant : Extension<
6339  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
6340def err_local_cant_init : Error<
6341  "'__local' variable cannot have an initializer">;
6342def err_loader_uninitialized_cant_init
6343    : Error<"variable with 'loader_uninitialized' attribute cannot have an "
6344            "initializer">;
6345def err_loader_uninitialized_trivial_ctor
6346    : Error<"variable with 'loader_uninitialized' attribute must have a "
6347            "trivial default constructor">;
6348def err_loader_uninitialized_redeclaration
6349    : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
6350def err_loader_uninitialized_extern_decl
6351    : Error<"variable %0 cannot be declared both 'extern' and with the "
6352            "'loader_uninitialized' attribute">;
6353def err_block_extern_cant_init : Error<
6354  "declaration of block scope identifier with linkage cannot have an initializer">;
6355def warn_extern_init : Warning<"'extern' variable has an initializer">,
6356  InGroup<DiagGroup<"extern-initializer">>;
6357def err_variable_object_no_init : Error<
6358  "variable-sized object may not be initialized">;
6359def err_excess_initializers : Error<
6360  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
6361def ext_excess_initializers : ExtWarn<
6362  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
6363  InGroup<ExcessInitializers>;
6364def err_excess_initializers_for_sizeless_type : Error<
6365  "excess elements in initializer for indivisible sizeless type %0">;
6366def ext_excess_initializers_for_sizeless_type : ExtWarn<
6367  "excess elements in initializer for indivisible sizeless type %0">,
6368  InGroup<ExcessInitializers>;
6369def err_excess_initializers_in_char_array_initializer : Error<
6370  "excess elements in char array initializer">;
6371def ext_excess_initializers_in_char_array_initializer : ExtWarn<
6372  "excess elements in char array initializer">,
6373  InGroup<ExcessInitializers>;
6374def err_initializer_string_for_char_array_too_long : Error<
6375  "initializer-string for char array is too long, array size is %0 but initializer has size %1 (including the null terminating character)">;
6376def ext_initializer_string_for_char_array_too_long : ExtWarn<
6377  "initializer-string for char array is too long">,
6378  InGroup<ExcessInitializers>;
6379def warn_missing_field_initializers : Warning<
6380  "missing field %0 initializer">,
6381  InGroup<MissingFieldInitializers>, DefaultIgnore;
6382// The same warning, but another group is needed to disable it separately.
6383def warn_missing_designated_field_initializers : Warning<
6384  warn_missing_field_initializers.Summary>,
6385  InGroup<MissingDesignatedFieldInitializers>, DefaultIgnore;
6386def warn_braces_around_init : Warning<
6387  "braces around %select{scalar |}0initializer">,
6388  InGroup<DiagGroup<"braced-scalar-init">>;
6389def ext_many_braces_around_init : ExtWarn<
6390  "too many braces around %select{scalar |}0initializer">,
6391  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
6392def ext_complex_component_init : Extension<
6393  "complex initialization specifying real and imaginary components "
6394  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
6395def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
6396def err_empty_sizeless_initializer : Error<
6397  "initializer for sizeless type %0 cannot be empty">;
6398def warn_cxx98_compat_empty_scalar_initializer : Warning<
6399  "scalar initialized from empty initializer list is incompatible with C++98">,
6400  InGroup<CXX98Compat>, DefaultIgnore;
6401def warn_cxx98_compat_empty_sizeless_initializer : Warning<
6402  "initializing %0 from an empty initializer list is incompatible with C++98">,
6403  InGroup<CXX98Compat>, DefaultIgnore;
6404def warn_cxx98_compat_reference_list_init : Warning<
6405  "reference initialized from initializer list is incompatible with C++98">,
6406  InGroup<CXX98Compat>, DefaultIgnore;
6407def warn_cxx98_compat_initializer_list_init : Warning<
6408  "initialization of initializer_list object is incompatible with C++98">,
6409  InGroup<CXX98Compat>, DefaultIgnore;
6410def warn_cxx98_compat_ctor_list_init : Warning<
6411  "constructor call from initializer list is incompatible with C++98">,
6412  InGroup<CXX98Compat>, DefaultIgnore;
6413def err_illegal_initializer : Error<
6414  "illegal initializer (only variables can be initialized)">;
6415def err_illegal_initializer_type : Error<"illegal initializer type %0">;
6416def ext_init_list_type_narrowing : ExtWarn<
6417  "type %0 cannot be narrowed to %1 in initializer list">,
6418  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6419def ext_init_list_type_narrowing_const_reference : ExtWarn<
6420  ext_init_list_type_narrowing.Summary>,
6421  InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6422def ext_init_list_variable_narrowing : ExtWarn<
6423  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6424  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6425def ext_init_list_variable_narrowing_const_reference : ExtWarn<
6426  ext_init_list_variable_narrowing.Summary>, InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6427def ext_init_list_constant_narrowing : ExtWarn<
6428  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
6429  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6430def ext_init_list_constant_narrowing_const_reference : ExtWarn<
6431  ext_init_list_constant_narrowing.Summary>,
6432  InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6433def warn_init_list_type_narrowing : Warning<
6434  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
6435  InGroup<CXX11Narrowing>, DefaultIgnore;
6436def warn_init_list_variable_narrowing : Warning<
6437  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6438  "initializer list in C++11">,
6439  InGroup<CXX11Narrowing>, DefaultIgnore;
6440def warn_init_list_constant_narrowing : Warning<
6441  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
6442  "C++11">,
6443  InGroup<CXX11Narrowing>, DefaultIgnore;
6444def note_init_list_narrowing_silence : Note<
6445  "insert an explicit cast to silence this issue">;
6446def err_init_objc_class : Error<
6447  "cannot initialize Objective-C class type %0">;
6448def err_implicit_empty_initializer : Error<
6449  "initializer for aggregate with no elements requires explicit braces">;
6450def err_bitfield_has_negative_width : Error<
6451  "bit-field %0 has negative width (%1)">;
6452def err_anon_bitfield_has_negative_width : Error<
6453  "anonymous bit-field has negative width (%0)">;
6454def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
6455def err_bitfield_width_exceeds_type_width : Error<
6456  "width of%select{ anonymous|}0 bit-field%select{| %1}0 (%2 bits) exceeds the "
6457  "%select{width|size}3 of its type (%4 bit%s4)">;
6458def err_incorrect_number_of_vector_initializers : Error<
6459  "number of elements must be either one or match the size of the vector">;
6460
6461// Used by C++ which allows bit-fields that are wider than the type.
6462def warn_bitfield_width_exceeds_type_width: Warning<
6463  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
6464  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
6465def err_bitfield_too_wide : Error<
6466  "%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
6467def warn_bitfield_too_small_for_enum : Warning<
6468  "bit-field %0 is not wide enough to store all enumerators of %1">,
6469  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6470def note_widen_bitfield : Note<
6471  "widen this field to %0 bits to store all values of %1">;
6472def warn_unsigned_bitfield_assigned_signed_enum : Warning<
6473  "assigning value of signed enum type %1 to unsigned bit-field %0; "
6474  "negative enumerators of enum %1 will be converted to positive values">,
6475  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6476def warn_signed_bitfield_enum_conversion : Warning<
6477  "signed bit-field %0 needs an extra bit to represent the largest positive "
6478  "enumerators of %1">,
6479  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6480def note_change_bitfield_sign : Note<
6481  "consider making the bit-field type %select{unsigned|signed}0">;
6482
6483def warn_missing_braces : Warning<
6484  "suggest braces around initialization of subobject">,
6485  InGroup<MissingBraces>, DefaultIgnore;
6486
6487def err_redefinition_of_label : Error<"redefinition of label %0">;
6488def err_undeclared_label_use : Error<"use of undeclared label %0">;
6489def err_goto_ms_asm_label : Error<
6490  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
6491def note_goto_ms_asm_label : Note<
6492  "inline assembly label %0 declared here">;
6493def warn_unused_label : Warning<"unused label %0">,
6494  InGroup<UnusedLabel>, DefaultIgnore;
6495
6496def err_continue_from_cond_var_init : Error<
6497  "cannot jump from this continue statement to the loop increment; "
6498  "jump bypasses initialization of loop condition variable">;
6499def err_goto_into_protected_scope : Error<
6500  "cannot jump from this goto statement to its label">;
6501def ext_goto_into_protected_scope : ExtWarn<
6502  "jump from this goto statement to its label is a Microsoft extension">,
6503  InGroup<MicrosoftGoto>;
6504def warn_cxx98_compat_goto_into_protected_scope : Warning<
6505  "jump from this goto statement to its label is incompatible with C++98">,
6506  InGroup<CXX98Compat>, DefaultIgnore;
6507def err_switch_into_protected_scope : Error<
6508  "cannot jump from switch statement to this case label">;
6509def warn_cxx98_compat_switch_into_protected_scope : Warning<
6510  "jump from switch statement to this case label is incompatible with C++98">,
6511  InGroup<CXX98Compat>, DefaultIgnore;
6512def err_indirect_goto_without_addrlabel : Error<
6513  "indirect goto in function with no address-of-label expressions">;
6514def err_indirect_goto_in_protected_scope : Error<
6515  "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
6516def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
6517  "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
6518  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6519def note_indirect_goto_target : Note<
6520  "possible target of %select{indirect|asm}0 goto statement">;
6521def note_protected_by_variable_init : Note<
6522  "jump bypasses variable initialization">;
6523def note_protected_by_variable_nontriv_destructor : Note<
6524  "jump bypasses variable with a non-trivial destructor">;
6525def note_protected_by_variable_non_pod : Note<
6526  "jump bypasses initialization of non-POD variable">;
6527def note_protected_by_cleanup : Note<
6528  "jump bypasses initialization of variable with __attribute__((cleanup))">;
6529def note_protected_by_vla_typedef : Note<
6530  "jump bypasses initialization of VLA typedef">;
6531def note_protected_by_vla_type_alias : Note<
6532  "jump bypasses initialization of VLA type alias">;
6533def note_protected_by_constexpr_if : Note<
6534  "jump enters controlled statement of constexpr if">;
6535def note_protected_by_consteval_if : Note<
6536  "jump enters controlled statement of consteval if">;
6537def note_protected_by_if_available : Note<
6538  "jump enters controlled statement of if available">;
6539def note_protected_by_vla : Note<
6540  "jump bypasses initialization of variable length array">;
6541def note_protected_by_objc_fast_enumeration : Note<
6542  "jump enters Objective-C fast enumeration loop">;
6543def note_protected_by_objc_try : Note<
6544  "jump bypasses initialization of @try block">;
6545def note_protected_by_objc_catch : Note<
6546  "jump bypasses initialization of @catch block">;
6547def note_protected_by_objc_finally : Note<
6548  "jump bypasses initialization of @finally block">;
6549def note_protected_by_objc_synchronized : Note<
6550  "jump bypasses initialization of @synchronized block">;
6551def note_protected_by_objc_autoreleasepool : Note<
6552  "jump bypasses auto release push of @autoreleasepool block">;
6553def note_protected_by_cxx_try : Note<
6554  "jump bypasses initialization of try block">;
6555def note_protected_by_cxx_catch : Note<
6556  "jump bypasses initialization of catch block">;
6557def note_protected_by_seh_try : Note<
6558  "jump bypasses initialization of __try block">;
6559def note_protected_by_seh_except : Note<
6560  "jump bypasses initialization of __except block">;
6561def note_protected_by_seh_finally : Note<
6562  "jump bypasses initialization of __finally block">;
6563def note_protected_by___block : Note<
6564  "jump bypasses setup of __block variable">;
6565def note_protected_by_objc_strong_init : Note<
6566  "jump bypasses initialization of __strong variable">;
6567def note_protected_by_objc_weak_init : Note<
6568  "jump bypasses initialization of __weak variable">;
6569def note_protected_by_non_trivial_c_struct_init : Note<
6570  "jump bypasses initialization of variable of non-trivial C struct type">;
6571def note_enters_block_captures_cxx_obj : Note<
6572  "jump enters lifetime of block which captures a destructible C++ object">;
6573def note_enters_block_captures_strong : Note<
6574  "jump enters lifetime of block which strongly captures a variable">;
6575def note_enters_block_captures_weak : Note<
6576  "jump enters lifetime of block which weakly captures a variable">;
6577def note_enters_block_captures_non_trivial_c_struct : Note<
6578  "jump enters lifetime of block which captures a C struct that is non-trivial "
6579  "to destroy">;
6580def note_enters_compound_literal_scope : Note<
6581  "jump enters lifetime of a compound literal that is non-trivial to destruct">;
6582def note_enters_statement_expression : Note<
6583  "jump enters a statement expression">;
6584
6585def note_exits_cleanup : Note<
6586  "jump exits scope of variable with __attribute__((cleanup))">;
6587def note_exits_dtor : Note<
6588  "jump exits scope of variable with non-trivial destructor">;
6589def note_exits_temporary_dtor : Note<
6590  "jump exits scope of lifetime-extended temporary with non-trivial "
6591  "destructor">;
6592def note_exits___block : Note<
6593  "jump exits scope of __block variable">;
6594def note_exits_objc_try : Note<
6595  "jump exits @try block">;
6596def note_exits_objc_catch : Note<
6597  "jump exits @catch block">;
6598def note_exits_objc_finally : Note<
6599  "jump exits @finally block">;
6600def note_exits_objc_synchronized : Note<
6601  "jump exits @synchronized block">;
6602def note_exits_cxx_try : Note<
6603  "jump exits try block">;
6604def note_exits_cxx_catch : Note<
6605  "jump exits catch block">;
6606def note_exits_seh_try : Note<
6607  "jump exits __try block">;
6608def note_exits_seh_except : Note<
6609  "jump exits __except block">;
6610def note_exits_seh_finally : Note<
6611  "jump exits __finally block">;
6612def note_exits_objc_autoreleasepool : Note<
6613  "jump exits autoreleasepool block">;
6614def note_exits_objc_strong : Note<
6615  "jump exits scope of __strong variable">;
6616def note_exits_objc_weak : Note<
6617  "jump exits scope of __weak variable">;
6618def note_exits_block_captures_cxx_obj : Note<
6619  "jump exits lifetime of block which captures a destructible C++ object">;
6620def note_exits_block_captures_strong : Note<
6621  "jump exits lifetime of block which strongly captures a variable">;
6622def note_exits_block_captures_weak : Note<
6623  "jump exits lifetime of block which weakly captures a variable">;
6624def note_exits_block_captures_non_trivial_c_struct : Note<
6625  "jump exits lifetime of block which captures a C struct that is non-trivial "
6626  "to destroy">;
6627def note_exits_compound_literal_scope : Note<
6628  "jump exits lifetime of a compound literal that is non-trivial to destruct">;
6629
6630def err_func_returning_qualified_void : ExtWarn<
6631  "function cannot return qualified void type %0">,
6632  InGroup<DiagGroup<"qualified-void-return-type">>;
6633def err_func_returning_array_function : Error<
6634  "function cannot return %select{array|function}0 type %1">;
6635def err_field_declared_as_function : Error<"field %0 declared as a function">;
6636def err_field_incomplete_or_sizeless : Error<
6637  "field has %select{incomplete|sizeless}0 type %1">;
6638def ext_variable_sized_type_in_struct : ExtWarn<
6639  "field %0 with variable sized type %1 not at the end of a struct or class is"
6640  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
6641
6642def ext_c99_flexible_array_member : Extension<
6643  "flexible array members are a C99 feature">, InGroup<C99>;
6644def err_flexible_array_virtual_base : Error<
6645  "flexible array member %0 not allowed in "
6646  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
6647def err_flexible_array_has_nontrivial_dtor : Error<
6648  "flexible array member %0 of type %1 with non-trivial destruction">;
6649def ext_flexible_array_in_struct : Extension<
6650  "%0 may not be nested in a struct due to flexible array member">,
6651  InGroup<FlexibleArrayExtensions>;
6652def ext_flexible_array_in_array : Extension<
6653  "%0 may not be used as an array element due to flexible array member">,
6654  InGroup<FlexibleArrayExtensions>;
6655def err_flexible_array_init : Error<
6656  "initialization of flexible array member is not allowed">;
6657def ext_flexible_array_empty_aggregate_ms : Extension<
6658  "flexible array member %0 in otherwise empty "
6659  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
6660  InGroup<MicrosoftFlexibleArray>;
6661def ext_flexible_array_union_ms : Extension<
6662  "flexible array member %0 in a union is a Microsoft extension">,
6663  InGroup<MicrosoftFlexibleArray>;
6664def ext_flexible_array_empty_aggregate_gnu : Extension<
6665  "flexible array member %0 in otherwise empty "
6666  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
6667  InGroup<GNUEmptyStruct>;
6668def ext_flexible_array_union_gnu : Extension<
6669  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
6670
6671def err_flexible_array_not_at_end : Error<
6672  "flexible array member %0 with type %1 is not at the end of"
6673  " %select{struct|interface|union|class|enum}2">;
6674def err_objc_variable_sized_type_not_at_end : Error<
6675  "field %0 with variable sized type %1 is not at the end of class">;
6676def note_next_field_declaration : Note<
6677  "next field declaration is here">;
6678def note_next_ivar_declaration : Note<
6679  "next %select{instance variable declaration|synthesized instance variable}0"
6680  " is here">;
6681def err_synthesize_variable_sized_ivar : Error<
6682  "synthesized property with variable size type %0"
6683  " requires an existing instance variable">;
6684def err_flexible_array_arc_retainable : Error<
6685  "ARC forbids flexible array members with retainable object type">;
6686def warn_variable_sized_ivar_visibility : Warning<
6687  "field %0 with variable sized type %1 is not visible to subclasses and"
6688  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
6689def warn_superclass_variable_sized_type_not_at_end : Warning<
6690  "field %0 can overwrite instance variable %1 with variable sized type %2"
6691  " in superclass %3">, InGroup<ObjCFlexibleArray>;
6692
6693def err_count_attr_param_not_in_same_struct : Error<
6694  "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}1' field %0 isn't within the same struct as the annotated %select{pointer|flexible array}2">;
6695def err_count_attr_not_on_ptr_or_flexible_array_member : Error<
6696  "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}0' only applies to pointers%select{ or C99 flexible array members|||}0%select{|; did you mean to use 'counted_by'?}1">;
6697def err_counted_by_attr_on_array_not_flexible_array_member : Error<
6698  "'counted_by' on arrays only applies to C99 flexible array members">;
6699def err_counted_by_attr_refer_to_itself : Error<
6700  "'counted_by' cannot refer to the flexible array member %0">;
6701def err_count_attr_must_be_in_structure : Error<
6702  "field %0 in '%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}1' not inside structure">;
6703def err_count_attr_argument_not_integer : Error<
6704  "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}0' requires a non-boolean integer type argument">;
6705def err_count_attr_only_support_simple_decl_reference : Error<
6706  "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}0' argument must be a simple declaration reference">;
6707def err_count_attr_in_union : Error<
6708  "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}0' cannot be applied to a union member">;
6709def err_count_attr_refer_to_union : Error<
6710  "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}0' argument cannot refer to a union member">;
6711def note_flexible_array_counted_by_attr_field : Note<
6712  "field %0 declared here">;
6713def err_counted_by_attr_pointee_unknown_size : Error<
6714  "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}4' %select{cannot|should not}3 be applied to %select{"
6715    "a pointer with pointee|" // pointer
6716    "an array with element}0" // array
6717  " of unknown size because %1 is %select{"
6718    "an incomplete type|"  // CountedByInvalidPointeeTypeKind::INCOMPLETE
6719    "a sizeless type|"     // CountedByInvalidPointeeTypeKind::SIZELESS
6720    "a function type|"     // CountedByInvalidPointeeTypeKind::FUNCTION
6721    // CountedByInvalidPointeeTypeKind::FLEXIBLE_ARRAY_MEMBER
6722    "a struct type with a flexible array member"
6723    "%select{|. This will be an error in a future compiler version}3"
6724    ""
6725  "}2">;
6726
6727def warn_counted_by_attr_elt_type_unknown_size :
6728  Warning<err_counted_by_attr_pointee_unknown_size.Summary>,
6729  InGroup<BoundsSafetyCountedByEltTyUnknownSize>;
6730
6731// __builtin_counted_by_ref diagnostics:
6732def err_builtin_counted_by_ref_must_be_flex_array_member : Error<
6733  "'__builtin_counted_by_ref' argument must reference a flexible array member">;
6734def err_builtin_counted_by_ref_has_side_effects : Error<
6735  "'__builtin_counted_by_ref' argument cannot have side-effects">;
6736
6737def err_builtin_counted_by_ref_cannot_leak_reference : Error<
6738  "value returned by '__builtin_counted_by_ref' cannot be %select{assigned to a "
6739  "variable|passed into a function|returned from a function}0">;
6740def err_builtin_counted_by_ref_invalid_use : Error<
6741  "value returned by '__builtin_counted_by_ref' cannot be used in "
6742  "%select{an array subscript|a binary}0 expression">;
6743
6744let CategoryName = "ARC Semantic Issue" in {
6745
6746// ARC-mode diagnostics.
6747
6748let CategoryName = "ARC Weak References" in {
6749
6750def err_arc_weak_no_runtime : Error<
6751  "cannot create __weak reference because the current deployment target "
6752  "does not support weak references">;
6753def err_arc_weak_disabled : Error<
6754  "cannot create __weak reference in file using manual reference counting">;
6755def err_synthesizing_arc_weak_property_disabled : Error<
6756  "cannot synthesize weak property in file using manual reference counting">;
6757def err_synthesizing_arc_weak_property_no_runtime : Error<
6758  "cannot synthesize weak property because the current deployment target "
6759  "does not support weak references">;
6760def err_arc_unsupported_weak_class : Error<
6761  "class is incompatible with __weak references">;
6762def err_arc_weak_unavailable_assign : Error<
6763  "assignment of a weak-unavailable object to a __weak object">;
6764def err_arc_weak_unavailable_property : Error<
6765  "synthesizing __weak instance variable of type %0, which does not "
6766  "support weak references">;
6767def note_implemented_by_class : Note<
6768  "when implemented by class %0">;
6769def err_arc_convesion_of_weak_unavailable : Error<
6770  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
6771  " a __weak object of type %2">;
6772
6773} // end "ARC Weak References" category
6774
6775let CategoryName = "ARC Restrictions" in {
6776
6777def err_unavailable_in_arc : Error<
6778  "%0 is unavailable in ARC">;
6779def note_arc_forbidden_type : Note<
6780  "declaration uses type that is ill-formed in ARC">;
6781def note_performs_forbidden_arc_conversion : Note<
6782  "inline function performs a conversion which is forbidden in ARC">;
6783def note_arc_init_returns_unrelated : Note<
6784  "init method must return a type related to its receiver type">;
6785def note_arc_weak_disabled : Note<
6786  "declaration uses __weak, but ARC is disabled">;
6787def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
6788  "the current deployment target does not support">;
6789def note_arc_field_with_ownership : Note<
6790  "field has non-trivial ownership qualification">;
6791
6792def err_arc_illegal_explicit_message : Error<
6793  "ARC forbids explicit message send of %0">;
6794def err_arc_unused_init_message : Error<
6795  "the result of a delegate init call must be immediately returned "
6796  "or assigned to 'self'">;
6797def err_arc_mismatched_cast : Error<
6798  "%select{implicit conversion|cast}0 of "
6799  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
6800  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
6801  " to %3 is disallowed with ARC">;
6802def err_arc_nolifetime_behavior : Error<
6803  "explicit ownership qualifier on cast result has no effect">;
6804def err_arc_objc_property_default_assign_on_object : Error<
6805  "ARC forbids synthesizing a property of an Objective-C object "
6806  "with unspecified ownership or storage attribute">;
6807def err_arc_illegal_selector : Error<
6808  "ARC forbids use of %0 in a @selector">;
6809def err_arc_illegal_method_def : Error<
6810  "ARC forbids %select{implementation|synthesis}0 of %1">;
6811def warn_arc_strong_pointer_objc_pointer : Warning<
6812  "method parameter of type %0 with no explicit ownership">,
6813  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
6814
6815} // end "ARC Restrictions" category
6816
6817def err_arc_lost_method_convention : Error<
6818  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
6819  "method, but its implementation doesn't match because %select{"
6820  "its result type is not an object pointer|"
6821  "its result type is unrelated to its receiver type}1">;
6822def note_arc_lost_method_convention : Note<"declaration in interface">;
6823def err_arc_gained_method_convention : Error<
6824  "method implementation does not match its declaration">;
6825def note_arc_gained_method_convention : Note<
6826  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
6827  "family because %select{its result type is not an object pointer|"
6828  "its result type is unrelated to its receiver type}1">;
6829def err_typecheck_arc_assign_self : Error<
6830  "cannot assign to 'self' outside of a method in the init family">;
6831def err_typecheck_arc_assign_self_class_method : Error<
6832  "cannot assign to 'self' in a class method">;
6833def err_typecheck_arr_assign_enumeration : Error<
6834  "fast enumeration variables cannot be modified in ARC by default; "
6835  "declare the variable __strong to allow this">;
6836def err_typecheck_arc_assign_externally_retained : Error<
6837  "variable declared with 'objc_externally_retained' "
6838  "cannot be modified in ARC">;
6839def warn_arc_retained_assign : Warning<
6840  "assigning retained object to %select{weak|unsafe_unretained}0 "
6841  "%select{property|variable}1"
6842  "; object will be released after assignment">,
6843  InGroup<ARCUnsafeRetainedAssign>;
6844def warn_arc_retained_property_assign : Warning<
6845  "assigning retained object to unsafe property"
6846  "; object will be released after assignment">,
6847  InGroup<ARCUnsafeRetainedAssign>;
6848def warn_arc_literal_assign : Warning<
6849  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
6850  " to a weak %select{property|variable}1"
6851  "; object will be released after assignment">,
6852  InGroup<ARCUnsafeRetainedAssign>;
6853def err_arc_new_array_without_ownership : Error<
6854  "'new' cannot allocate an array of %0 with no explicit ownership">;
6855def err_arc_autoreleasing_var : Error<
6856  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
6857  "__autoreleasing ownership">;
6858def err_arc_autoreleasing_capture : Error<
6859  "cannot capture __autoreleasing variable in a "
6860  "%select{block|lambda by copy}0">;
6861def err_arc_thread_ownership : Error<
6862  "thread-local variable has non-trivial ownership: type is %0">;
6863def err_arc_indirect_no_ownership : Error<
6864  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6865def err_arc_array_param_no_ownership : Error<
6866  "must explicitly describe intended ownership of an object array parameter">;
6867def err_arc_pseudo_dtor_inconstant_quals : Error<
6868  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6869  "type %1">;
6870def err_arc_init_method_unrelated_result_type : Error<
6871  "init methods must return a type related to the receiver type">;
6872def err_arc_nonlocal_writeback : Error<
6873  "passing address of %select{non-local|non-scalar}0 object to "
6874  "__autoreleasing parameter for write-back">;
6875def err_arc_method_not_found : Error<
6876  "no known %select{instance|class}1 method for selector %0">;
6877def err_arc_receiver_forward_class : Error<
6878  "receiver %0 for class message is a forward declaration">;
6879def err_arc_may_not_respond : Error<
6880  "no visible @interface for %0 declares the selector %1">;
6881def err_arc_receiver_forward_instance : Error<
6882  "receiver type %0 for instance message is a forward declaration">;
6883def warn_receiver_forward_instance : Warning<
6884  "receiver type %0 for instance message is a forward declaration">,
6885  InGroup<ForwardClassReceiver>, DefaultIgnore;
6886def err_arc_collection_forward : Error<
6887  "collection expression type %0 is a forward declaration">;
6888def err_arc_multiple_method_decl : Error<
6889  "multiple methods named %0 found with mismatched result, "
6890  "parameter type or attributes">;
6891def warn_arc_lifetime_result_type : Warning<
6892  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6893  "lifetime qualifier on return type is ignored">,
6894  InGroup<IgnoredQualifiers>;
6895def warn_excess_precision_not_supported : Warning<
6896  "excess precision is requested but the target does not support excess "
6897  "precision which may result in observable differences in complex division "
6898  "behavior%select{|, additional uses where the requested higher precision "
6899  "cannot be honored were found but not diagnosed}0">,
6900  InGroup<DiagGroup<"higher-precision-for-complex-division">>;
6901
6902let CategoryName = "ARC Retain Cycle" in {
6903
6904def warn_arc_retain_cycle : Warning<
6905  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6906  InGroup<ARCRetainCycles>;
6907def note_arc_retain_cycle_owner : Note<
6908  "block will be retained by %select{the captured object|an object strongly "
6909  "retained by the captured object}0">;
6910
6911} // end "ARC Retain Cycle" category
6912
6913def warn_arc_object_memaccess : Warning<
6914  "%select{destination for|source of}0 this %1 call is a pointer to "
6915  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6916
6917let CategoryName = "ARC and @properties" in {
6918
6919def err_arc_strong_property_ownership : Error<
6920  "existing instance variable %1 for strong property %0 may not be "
6921  "%select{|__unsafe_unretained||__weak}2">;
6922def err_arc_assign_property_ownership : Error<
6923  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6924  "attribute must be __unsafe_unretained">;
6925def err_arc_inconsistent_property_ownership : Error<
6926  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6927  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6928
6929} // end "ARC and @properties" category
6930
6931def warn_block_capture_autoreleasing : Warning<
6932  "block captures an autoreleasing out-parameter, which may result in "
6933  "use-after-free bugs">,
6934  InGroup<BlockCaptureAutoReleasing>;
6935def note_declare_parameter_strong : Note<
6936  "declare the parameter __strong or capture a __block __strong variable to "
6937  "keep values alive across autorelease pools">;
6938
6939def err_arc_atomic_ownership : Error<
6940  "cannot perform atomic operation on a pointer to type %0: type has "
6941  "non-trivial ownership">;
6942
6943let CategoryName = "ARC Casting Rules" in {
6944
6945def err_arc_bridge_cast_incompatible : Error<
6946  "incompatible types casting %0 to %1 with a %select{__bridge|"
6947  "__bridge_transfer|__bridge_retained}2 cast">;
6948def err_arc_bridge_cast_wrong_kind : Error<
6949  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6950  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6951  "__bridge_transfer|__bridge_retained}4">;
6952def err_arc_cast_requires_bridge : Error<
6953  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6954  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6955  "requires a bridged cast">;
6956def note_arc_bridge : Note<
6957  "use __bridge to convert directly (no change in ownership)">;
6958def note_arc_cstyle_bridge : Note<
6959  "use __bridge with C-style cast to convert directly (no change in ownership)">;
6960def note_arc_bridge_transfer : Note<
6961  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6962  "ownership of a +1 %0 into ARC">;
6963def note_arc_cstyle_bridge_transfer : Note<
6964  "use __bridge_transfer with C-style cast to transfer "
6965  "ownership of a +1 %0 into ARC">;
6966def note_arc_bridge_retained : Note<
6967  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6968  "ARC object available as a +1 %0">;
6969def note_arc_cstyle_bridge_retained : Note<
6970  "use __bridge_retained with C-style cast to make an "
6971  "ARC object available as a +1 %0">;
6972
6973} // ARC Casting category
6974
6975} // ARC category name
6976
6977def err_flexible_array_init_needs_braces : Error<
6978  "flexible array requires brace-enclosed initializer">;
6979def err_illegal_decl_array_of_functions : Error<
6980  "'%0' declared as array of functions of type %1">;
6981def err_array_incomplete_or_sizeless_type : Error<
6982  "array has %select{incomplete|sizeless}0 element type %1">;
6983def err_illegal_message_expr_incomplete_type : Error<
6984  "Objective-C message has incomplete result type %0">;
6985def err_illegal_decl_array_of_references : Error<
6986  "'%0' declared as array of references of type %1">;
6987def err_decl_negative_array_size : Error<
6988  "'%0' declared as an array with a negative size">;
6989def err_array_static_outside_prototype : Error<
6990  "%0 used in array declarator outside of function prototype">;
6991def err_array_static_not_outermost : Error<
6992  "%0 used in non-outermost array type derivation">;
6993def err_array_star_outside_prototype : Error<
6994  "star modifier used outside of function prototype">;
6995def err_illegal_decl_pointer_to_reference : Error<
6996  "'%0' declared as a pointer to a reference of type %1">;
6997def err_illegal_decl_mempointer_to_reference : Error<
6998  "'%0' declared as a member pointer to a reference of type %1">;
6999def err_illegal_decl_mempointer_to_void : Error<
7000  "'%0' declared as a member pointer to void">;
7001def err_illegal_decl_mempointer_in_nonclass : Error<
7002  "'%0' does not point into a class">;
7003def err_mempointer_in_nonclass_type : Error<
7004  "member pointer refers into non-class type %0">;
7005def err_reference_to_void : Error<"cannot form a reference to 'void'">;
7006def err_nonfunction_block_type : Error<
7007  "block pointer to non-function type is invalid">;
7008def err_return_block_has_expr : Error<"void block should not return a value">;
7009def err_block_return_missing_expr : Error<
7010  "non-void block should return a value">;
7011def err_func_def_incomplete_result : Error<
7012  "incomplete result type %0 in function definition">;
7013def err_atomic_specifier_bad_type
7014    : Error<"_Atomic cannot be applied to "
7015            "%select{incomplete |array |function |reference |atomic |qualified "
7016            "|sizeless ||integer |}0type "
7017            "%1 %select{|||||||which is not trivially copyable||in C23}0">;
7018def warn_atomic_member_access : Warning<
7019  "accessing a member of an atomic structure or union is undefined behavior">,
7020  InGroup<DiagGroup<"atomic-access">>, DefaultError;
7021
7022// Expressions.
7023def err_using_placeholder_variable : Error<
7024  "ambiguous reference to placeholder '_', which is defined multiple times">;
7025def note_reference_placeholder : Note<
7026  "placeholder declared here">;
7027def ext_placeholder_var_definition : ExtWarn<
7028  "placeholder variables are a C++2c extension">, InGroup<CXX26>;
7029def warn_cxx23_placeholder_var_definition : Warning<
7030  "placeholder variables are incompatible with C++ standards before C++2c">,
7031  DefaultIgnore, InGroup<CXXPre26Compat>;
7032
7033def ext_sizeof_alignof_function_type : Extension<
7034  "invalid application of '%0' to a function type">, InGroup<PointerArith>;
7035def ext_sizeof_alignof_void_type : Extension<
7036  "invalid application of '%0' to a void type">, InGroup<PointerArith>;
7037def err_opencl_sizeof_alignof_type : Error<
7038  "invalid application of '%0' to a void type">;
7039def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
7040  "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
7041def err_sizeof_alignof_function_type : Error<
7042  "invalid application of '%0' to a function type">;
7043def err_openmp_default_simd_align_expr : Error<
7044  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
7045def err_sizeof_alignof_typeof_bitfield : Error<
7046  "invalid application of '%select{sizeof|alignof|typeof|typeof_unqual}0' to "
7047  "bit-field">;
7048def err_alignof_member_of_incomplete_type : Error<
7049  "invalid application of 'alignof' to a field of a class still being defined">;
7050def err_vecstep_non_scalar_vector_type : Error<
7051  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
7052def err_offsetof_incomplete_type : Error<
7053  "offsetof of incomplete type %0">;
7054def err_offsetof_record_type : Error<
7055  "offsetof requires struct, union, or class type, %0 invalid">;
7056def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
7057def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
7058  InGroup<InvalidOffsetof>;
7059def ext_offsetof_non_standardlayout_type : ExtWarn<
7060  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
7061def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
7062def err_offsetof_field_of_virtual_base : Error<
7063  "invalid application of 'offsetof' to a field of a virtual base">;
7064def warn_sub_ptr_zero_size_types : Warning<
7065  "subtraction of pointers to type %0 of zero size has undefined behavior">,
7066  InGroup<PointerArith>;
7067def warn_pointer_arith_null_ptr : Warning<
7068  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
7069  InGroup<NullPointerArithmetic>, DefaultIgnore;
7070def warn_gnu_null_ptr_arith : Extension<
7071  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
7072  InGroup<GNUNullPointerArithmetic>;
7073def warn_pointer_sub_null_ptr : Warning<
7074  "performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior">,
7075  InGroup<NullPointerSubtraction>, DefaultIgnore;
7076
7077def warn_floatingpoint_eq : Warning<
7078  "comparing floating point with == or != is unsafe">,
7079  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
7080
7081def err_setting_eval_method_used_in_unsafe_context : Error <
7082  "%select{'#pragma clang fp eval_method'|option 'ffp-eval-method'}0 cannot be used with "
7083  "%select{option 'fapprox-func'|option 'mreassociate'|option 'freciprocal'|option 'ffp-eval-method'|'#pragma clang fp reassociate'|'#pragma clang fp reciprocal'}1">;
7084
7085def warn_remainder_division_by_zero : Warning<
7086  "%select{remainder|division}0 by zero is undefined">,
7087  InGroup<DivZero>;
7088def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
7089  InGroup<DiagGroup<"shift-negative-value">>;
7090def warn_shift_negative : Warning<"shift count is negative">,
7091  InGroup<DiagGroup<"shift-count-negative">>;
7092def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
7093  InGroup<DiagGroup<"shift-count-overflow">>;
7094def warn_shift_result_gt_typewidth : Warning<
7095  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
7096  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
7097def warn_shift_result_sets_sign_bit : Warning<
7098  "signed shift result (%0) sets the sign bit of the shift expression's "
7099  "type (%1) and becomes negative">,
7100  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
7101
7102def warn_precedence_bitwise_rel : Warning<
7103  "%0 has lower precedence than %1; %1 will be evaluated first">,
7104  InGroup<Parentheses>;
7105def note_precedence_bitwise_first : Note<
7106  "place parentheses around the %0 expression to evaluate it first">;
7107def note_precedence_silence : Note<
7108  "place parentheses around the '%0' expression to silence this warning">;
7109
7110def warn_precedence_conditional : Warning<
7111  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
7112  InGroup<Parentheses>;
7113def warn_precedence_bitwise_conditional : Warning<
7114  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
7115  InGroup<BitwiseConditionalParentheses>;
7116def note_precedence_conditional_first : Note<
7117  "place parentheses around the '?:' expression to evaluate it first">;
7118
7119def warn_consecutive_comparison : Warning<
7120  "comparisons like 'X<=Y<=Z' don't have their mathematical meaning">,
7121  InGroup<Parentheses>;
7122
7123def warn_enum_constant_in_bool_context : Warning<
7124  "converting the enum constant to a boolean">,
7125  InGroup<IntInBoolContext>, DefaultIgnore;
7126def warn_left_shift_in_bool_context : Warning<
7127  "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
7128  InGroup<IntInBoolContext>, DefaultIgnore;
7129def warn_logical_instead_of_bitwise : Warning<
7130  "use of logical '%0' with constant operand">,
7131  InGroup<DiagGroup<"constant-logical-operand">>;
7132def note_logical_instead_of_bitwise_change_operator : Note<
7133  "use '%0' for a bitwise operation">;
7134def note_logical_instead_of_bitwise_remove_constant : Note<
7135  "remove constant to silence this warning">;
7136
7137def warn_bitwise_op_in_bitwise_op : Warning<
7138  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
7139
7140def warn_logical_and_in_logical_or : Warning<
7141  "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
7142
7143def warn_overloaded_shift_in_comparison :Warning<
7144  "overloaded operator %select{>>|<<}0 has higher precedence than "
7145  "comparison operator">,
7146  InGroup<OverloadedShiftOpParentheses>;
7147def note_evaluate_comparison_first :Note<
7148  "place parentheses around comparison expression to evaluate it first">;
7149
7150def note_concatenated_string_literal_silence :Note<
7151  "place parentheses around the string literal to silence warning">;
7152
7153def warn_addition_in_bitshift : Warning<
7154  "operator '%0' has lower precedence than '%1'; "
7155  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
7156
7157def warn_self_assignment_builtin : Warning<
7158  "explicitly assigning value of variable of type %0 to itself%select{|; did "
7159  "you mean to assign to member %2?}1">,
7160  InGroup<SelfAssignment>, DefaultIgnore;
7161def warn_self_assignment_overloaded : Warning<
7162  "explicitly assigning value of variable of type %0 to itself%select{|; did "
7163  "you mean to assign to member %2?}1">,
7164  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
7165def warn_self_move : Warning<
7166  "explicitly moving variable of type %0 to itself%select{|; did you mean to "
7167  "move to member %2?}1">,
7168  InGroup<SelfMove>, DefaultIgnore;
7169
7170def err_builtin_move_forward_unsupported : Error<
7171  "unsupported signature for %q0">;
7172def err_use_of_unaddressable_function : Error<
7173  "taking address of non-addressable standard library function">;
7174// FIXME: This should also be in -Wc++23-compat once we have it.
7175def warn_cxx20_compat_use_of_unaddressable_function : Warning<
7176  "taking address of non-addressable standard library function "
7177  "is incompatible with C++20">, InGroup<CXX20Compat>;
7178
7179def warn_redundant_move_on_return : Warning<
7180  "redundant move in return statement">,
7181  InGroup<RedundantMove>, DefaultIgnore;
7182def warn_pessimizing_move_on_return : Warning<
7183  "moving a local object in a return statement prevents copy elision">,
7184  InGroup<PessimizingMove>, DefaultIgnore;
7185def warn_pessimizing_move_on_initialization : Warning<
7186  "moving a temporary object prevents copy elision">,
7187  InGroup<PessimizingMove>, DefaultIgnore;
7188def note_remove_move : Note<"remove std::move call here">;
7189
7190def warn_string_plus_int : Warning<
7191  "adding %0 to a string does not append to the string">,
7192  InGroup<StringPlusInt>;
7193def warn_string_plus_char : Warning<
7194  "adding %0 to a string pointer does not append to the string">,
7195  InGroup<StringPlusChar>;
7196def note_string_plus_scalar_silence : Note<
7197  "use array indexing to silence this warning">;
7198
7199def warn_sizeof_array_param : Warning<
7200  "sizeof on array function parameter will return size of %0 instead of %1">,
7201  InGroup<SizeofArrayArgument>;
7202
7203def warn_sizeof_array_decay : Warning<
7204  "sizeof on pointer operation will return size of %0 instead of %1">,
7205  InGroup<SizeofArrayDecay>;
7206
7207def err_sizeof_nonfragile_interface : Error<
7208  "application of '%select{alignof|sizeof}1' to interface %0 is "
7209  "not supported on this architecture and platform">;
7210def err_atdef_nonfragile_interface : Error<
7211  "use of @defs is not supported on this architecture and platform">;
7212def err_subscript_nonfragile_interface : Error<
7213  "subscript requires size of interface %0, which is not constant for "
7214  "this architecture and platform">;
7215
7216def err_arithmetic_nonfragile_interface : Error<
7217  "arithmetic on pointer to interface %0, which is not a constant size for "
7218  "this architecture and platform">;
7219
7220def warn_deprecated_comma_subscript : Warning<
7221  "top-level comma expression in array subscript is deprecated "
7222  "in C++20 and unsupported in C++23">,
7223  InGroup<DeprecatedCommaSubscript>;
7224
7225def ext_subscript_non_lvalue : Extension<
7226  "ISO C90 does not allow subscripting non-lvalue array">;
7227def err_typecheck_subscript_value : Error<
7228  "subscripted value is not an array, pointer, or vector">;
7229def err_typecheck_subscript_not_integer : Error<
7230  "array subscript is not an integer">;
7231def err_subscript_function_type : Error<
7232  "subscript of pointer to function type %0">;
7233def err_subscript_incomplete_or_sizeless_type : Error<
7234  "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
7235def err_subscript_svbool_t : Error<
7236  "subscript of svbool_t is not allowed">;
7237def err_dereference_incomplete_type : Error<
7238  "dereference of pointer to incomplete type %0">;
7239def ext_gnu_subscript_void_type : Extension<
7240  "subscript of a pointer to void is a GNU extension">,
7241  InGroup<GNUPointerArith>;
7242def err_typecheck_member_reference_struct_union : Error<
7243  "member reference base type %0 is not a structure or union">;
7244def err_typecheck_member_reference_ivar : Error<
7245  "%0 does not have a member named %1">;
7246def err_arc_weak_ivar_access : Error<
7247  "dereferencing a __weak pointer is not allowed due to possible "
7248  "null value caused by race condition, assign it to strong variable first">;
7249def err_typecheck_member_reference_arrow : Error<
7250  "member reference type %0 is not a pointer">;
7251def err_typecheck_member_reference_suggestion : Error<
7252  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
7253def note_typecheck_member_reference_suggestion : Note<
7254  "did you mean to use '.' instead?">;
7255def note_member_reference_arrow_from_operator_arrow : Note<
7256  "'->' applied to return value of the operator->() declared here">;
7257def err_typecheck_member_reference_type : Error<
7258  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
7259def err_typecheck_member_reference_unknown : Error<
7260  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
7261def err_member_reference_needs_call : Error<
7262  "base of member reference is a function; perhaps you meant to call "
7263  "it%select{| with no arguments}0?">;
7264def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
7265  InGroup<CharSubscript>, DefaultIgnore;
7266
7267def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
7268def err_no_member : Error<"no member named %0 in %1">;
7269def err_no_member_overloaded_arrow : Error<
7270  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
7271
7272def err_member_not_yet_instantiated : Error<
7273  "no member %0 in %1; it has not yet been instantiated">;
7274def note_non_instantiated_member_here : Note<
7275  "not-yet-instantiated member is declared here">;
7276
7277def err_enumerator_does_not_exist : Error<
7278  "enumerator %0 does not exist in instantiation of %1">;
7279def note_enum_specialized_here : Note<
7280  "enum %0 was explicitly specialized here">;
7281
7282def err_specialization_not_primary_template : Error<
7283  "cannot reference member of primary template because deduced class "
7284  "template specialization %0 is %select{instantiated from a partial|"
7285  "an explicit}1 specialization">;
7286
7287def err_member_redeclared : Error<"class member cannot be redeclared">;
7288def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
7289  InGroup<RedeclaredClassMember>;
7290def err_member_redeclared_in_instantiation : Error<
7291  "multiple overloads of %0 instantiate to the same signature %1">;
7292def err_member_name_of_class : Error<"member %0 has the same name as its class">;
7293def err_member_def_undefined_record : Error<
7294  "out-of-line definition of %0 from class %1 without definition">;
7295def err_member_decl_does_not_match : Error<
7296  "out-of-line %select{declaration|definition}2 of %0 "
7297  "does not match any declaration in %1">;
7298def err_friend_decl_with_def_arg_must_be_def : Error<
7299  "friend declaration specifying a default argument must be a definition">;
7300def err_friend_decl_with_enclosing_temp_constraint_must_be_def : Error<
7301  "friend declaration with a constraint that depends on an enclosing "
7302  "template parameter must be a definition">;
7303def err_non_temp_friend_decl_with_requires_clause_must_be_def : Error<
7304  "non-template friend declaration with a requires clause must be a definition">;
7305def err_friend_decl_with_def_arg_redeclared : Error<
7306  "friend declaration specifying a default argument must be the only declaration">;
7307def err_friend_decl_does_not_match : Error<
7308  "friend declaration of %0 does not match any declaration in %1">;
7309def err_member_decl_does_not_match_suggest : Error<
7310  "out-of-line %select{declaration|definition}2 of %0 "
7311  "does not match any declaration in %1; did you mean %3?">;
7312def err_member_def_does_not_match_ret_type : Error<
7313  "return type of out-of-line definition of %q0 differs from "
7314  "that in the declaration">;
7315def err_nonstatic_member_out_of_line : Error<
7316  "non-static data member defined out-of-line">;
7317def err_qualified_typedef_declarator : Error<
7318  "typedef declarator cannot be qualified">;
7319def err_qualified_param_declarator : Error<
7320  "parameter declarator cannot be qualified">;
7321def ext_out_of_line_declaration : ExtWarn<
7322  "out-of-line declaration of a member must be a definition">,
7323  InGroup<OutOfLineDeclaration>, DefaultError;
7324def err_member_extra_qualification : Error<
7325  "extra qualification on member %0">;
7326def warn_member_extra_qualification : Warning<
7327  err_member_extra_qualification.Summary>, InGroup<MicrosoftExtraQualification>;
7328def warn_namespace_member_extra_qualification : Warning<
7329  "extra qualification on member %0">,
7330  InGroup<DiagGroup<"extra-qualification">>;
7331def err_member_qualification : Error<
7332  "non-friend class member %0 cannot have a qualified name">;
7333def note_member_def_close_match : Note<"member declaration nearly matches">;
7334def note_member_def_close_const_match : Note<
7335  "member declaration does not match because "
7336  "it %select{is|is not}0 const qualified">;
7337def note_member_def_close_param_match : Note<
7338  "type of %ordinal0 parameter of member declaration does not match definition"
7339  "%diff{ ($ vs $)|}1,2">;
7340def note_local_decl_close_match : Note<"local declaration nearly matches">;
7341def note_local_decl_close_param_match : Note<
7342  "type of %ordinal0 parameter of local declaration does not match definition"
7343  "%diff{ ($ vs $)|}1,2">;
7344def err_typecheck_ivar_variable_size : Error<
7345  "instance variables must have a constant size">;
7346def err_ivar_reference_type : Error<
7347  "instance variables cannot be of reference type">;
7348def err_typecheck_illegal_increment_decrement : Error<
7349  "cannot %select{decrement|increment}1 value of type %0">;
7350def err_typecheck_expect_int : Error<
7351  "used type %0 where integer is required">;
7352def err_typecheck_expect_hlsl_resource : Error<
7353  "used type %0 where __hlsl_resource_t is required">;
7354def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
7355  "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
7356def err_typecheck_pointer_arith_function_type : Error<
7357  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
7358  "function type%select{|s}2 %1%select{| and %3}2">;
7359def err_typecheck_pointer_arith_void_type : Error<
7360  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
7361def err_typecheck_decl_incomplete_type : Error<
7362  "variable has incomplete type %0">;
7363def ext_typecheck_decl_incomplete_type : ExtWarn<
7364  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
7365  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
7366def err_tentative_def_incomplete_type : Error<
7367  "tentative definition has type %0 that is never completed">;
7368def warn_tentative_incomplete_array : Warning<
7369  "tentative array definition assumed to have one element">,
7370  InGroup<DiagGroup<"tentative-definition-array">>;
7371def err_typecheck_incomplete_array_needs_initializer : Error<
7372  "definition of variable with array type needs an explicit size "
7373  "or an initializer">;
7374def err_array_init_not_init_list : Error<
7375  "array initializer must be an initializer "
7376  "list%select{| or string literal| or wide string literal}0">;
7377def err_array_init_narrow_string_into_wchar : Error<
7378  "initializing wide char array with non-wide string literal">;
7379def err_array_init_wide_string_into_char : Error<
7380  "initializing char array with wide string literal">;
7381def err_array_init_incompat_wide_string_into_wchar : Error<
7382  "initializing wide char array with incompatible wide string literal">;
7383def err_array_init_plain_string_into_char8_t : Error<
7384  "initializing 'char8_t' array with plain string literal">;
7385def note_array_init_plain_string_into_char8_t : Note<
7386  "add 'u8' prefix to form a 'char8_t' string literal">;
7387def err_array_init_utf8_string_into_char : Error<
7388  "initialization of %select{|signed }0char array with "
7389  "UTF-8 string literal is not permitted by %select{'-fchar8_t'|C++20}1">;
7390def warn_cxx20_compat_utf8_string : Warning<
7391  "type of UTF-8 string literal will change from array of const char to "
7392  "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
7393def warn_c23_compat_utf8_string : Warning<
7394  "type of UTF-8 string literal will change from array of char to "
7395  "array of char8_t in C23">, InGroup<C23Compat>, DefaultIgnore;
7396def note_cxx20_c23_compat_utf8_string_remove_u8 : Note<
7397  "remove 'u8' prefix to avoid a change of behavior; "
7398  "Clang encodes unprefixed narrow string literals as UTF-8">;
7399def err_array_init_different_type : Error<
7400  "cannot initialize array %diff{of type $ with array of type $|"
7401  "with different type of array}0,1">;
7402def err_array_init_non_constant_array : Error<
7403  "cannot initialize array %diff{of type $ with non-constant array of type $|"
7404  "with different type of array}0,1">;
7405def ext_array_init_copy : Extension<
7406  "initialization of an array "
7407  "%diff{of type $ from a compound literal of type $|"
7408  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
7409// This is intentionally not disabled by -Wno-gnu.
7410def ext_array_init_parens : ExtWarn<
7411  "parenthesized initialization of a member array is a GNU extension">,
7412  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
7413def warn_deprecated_string_literal_conversion : Warning<
7414  "conversion from string literal to %0 is deprecated">,
7415  InGroup<CXX11CompatDeprecatedWritableStr>;
7416def ext_deprecated_string_literal_conversion : ExtWarn<
7417  "ISO C++11 does not allow conversion from string literal to %0">,
7418  InGroup<WritableStrings>, SFINAEFailure;
7419def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
7420def err_typecheck_sclass_fscope : Error<
7421  "illegal storage class on file-scoped variable">;
7422def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
7423  InGroup<MissingDeclarations>;
7424def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
7425  "of a type">, InGroup<MissingDeclarations>;
7426def err_standalone_class_nested_name_specifier : Error<
7427  "forward declaration of %0 cannot have a nested name specifier">;
7428def err_typecheck_sclass_func : Error<"illegal storage class on function">;
7429def err_static_block_func : Error<
7430  "function declared in block scope cannot have 'static' storage class">;
7431def err_typecheck_address_of : Error<"address of %select{bit-field"
7432  "|vector element|property expression|register variable|matrix element}0 requested">;
7433def ext_typecheck_addrof_void : Extension<
7434  "ISO C forbids taking the address of an expression of type 'void'">;
7435def err_unqualified_pointer_member_function : Error<
7436  "must explicitly qualify name of member function when taking its address">;
7437def err_invalid_form_pointer_member_function : Error<
7438  "cannot create a non-constant pointer to member function">;
7439def err_address_of_function_with_pass_object_size_params: Error<
7440  "cannot take address of function %0 because parameter %1 has "
7441  "pass_object_size attribute">;
7442def err_parens_pointer_member_function : Error<
7443  "cannot parenthesize the name of a method when forming a member pointer">;
7444def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
7445  "extra '&' taking address of overloaded function">;
7446def err_typecheck_invalid_lvalue_addrof : Error<
7447  "cannot take the address of an rvalue of type %0">;
7448def ext_typecheck_addrof_temporary : ExtWarn<
7449  "taking the address of a temporary object of type %0">,
7450  InGroup<AddressOfTemporary>, DefaultError;
7451def err_typecheck_addrof_temporary : Error<
7452  "taking the address of a temporary object of type %0">;
7453def err_typecheck_addrof_dtor : Error<
7454  "taking the address of a destructor">;
7455def err_typecheck_unary_expr : Error<
7456  "invalid argument type %0 to unary expression">;
7457def err_typecheck_indirection_requires_pointer : Error<
7458  "indirection requires pointer operand (%0 invalid)">;
7459def ext_typecheck_indirection_through_void_pointer : ExtWarn<
7460  "ISO C does not allow indirection on operand of type %0">,
7461  InGroup<VoidPointerDeref>;
7462def err_typecheck_indirection_through_void_pointer_cpp
7463    : Error<"indirection not permitted on operand of type %0">;
7464def warn_indirection_through_null : Warning<
7465  "indirection of non-volatile null pointer will be deleted, not trap">,
7466  InGroup<NullDereference>;
7467def warn_binding_null_to_reference : Warning<
7468  "binding dereferenced null pointer to reference has undefined behavior">,
7469  InGroup<NullDereference>;
7470def note_indirection_through_null : Note<
7471  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
7472def warn_pointer_indirection_from_incompatible_type : Warning<
7473  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
7474  "behavior">,
7475  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7476def warn_taking_address_of_packed_member : Warning<
7477  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
7478  InGroup<DiagGroup<"address-of-packed-member">>;
7479def warn_param_mismatched_alignment : Warning<
7480  "passing %0-byte aligned argument to %1-byte aligned parameter %2%select{| of %4}3 may result in an unaligned pointer access">,
7481  InGroup<DiagGroup<"align-mismatch">>;
7482
7483def err_objc_object_assignment : Error<
7484  "cannot assign to class object (%0 invalid)">;
7485def err_typecheck_invalid_operands : Error<
7486  "invalid operands to binary expression (%0 and %1)">, Deferrable;
7487def note_typecheck_invalid_operands_converted : Note<
7488  "%select{first|second}0 operand was implicitly converted to type %1">;
7489def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
7490  "logical expression with vector %select{type %1 and non-vector type %2|types"
7491  " %1 and %2}0 is only supported in C++">;
7492def err_typecheck_sub_ptr_compatible : Error<
7493  "%diff{$ and $ are not pointers to compatible types|"
7494  "pointers to incompatible types}0,1">;
7495def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
7496  "ordered comparison between pointer and integer (%0 and %1)">;
7497def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
7498  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
7499def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
7500  "ordered comparison between pointer and zero (%0 and %1)">;
7501def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
7502  "three-way comparison between pointer and zero">;
7503def ext_typecheck_compare_complete_incomplete_pointers : Extension<
7504  "pointer comparisons before C11 "
7505  "need to be between two complete or two incomplete types; "
7506  "%0 is %select{|in}2complete and "
7507  "%1 is %select{|in}3complete">,
7508  InGroup<C11>;
7509def warn_typecheck_ordered_comparison_of_function_pointers : Warning<
7510  "ordered comparison of function pointers (%0 and %1)">,
7511  InGroup<OrderedCompareFunctionPointers>;
7512def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
7513  "ordered comparison of function pointers (%0 and %1)">,
7514  InGroup<OrderedCompareFunctionPointers>;
7515def err_typecheck_ordered_comparison_of_function_pointers : Error<
7516  "ordered comparison of function pointers (%0 and %1)">;
7517def ext_typecheck_comparison_of_fptr_to_void : Extension<
7518  "equality comparison between function pointer and void pointer (%0 and %1)">;
7519def err_typecheck_comparison_of_fptr_to_void : Error<
7520  "equality comparison between function pointer and void pointer (%0 and %1)">;
7521def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
7522  "comparison between pointer and integer (%0 and %1)">,
7523  InGroup<DiagGroup<"pointer-integer-compare">>;
7524def err_typecheck_comparison_of_pointer_integer : Error<
7525  "comparison between pointer and integer (%0 and %1)">;
7526def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
7527  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
7528  InGroup<CompareDistinctPointerType>;
7529def ext_typecheck_cond_incompatible_operands : ExtWarn<
7530  "incompatible operand types (%0 and %1)">;
7531def err_cond_voidptr_arc : Error <
7532  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
7533  "in ARC mode">;
7534def err_typecheck_comparison_of_distinct_pointers : Error<
7535  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
7536def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
7537  "%select{comparison between %diff{ ($ and $)|}0,1"
7538  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
7539  "|conditional operator with the second and third operands of type "
7540  "%diff{ ($ and $)|}0,1}2"
7541  " which are pointers to non-overlapping address spaces">;
7542
7543def select_arith_conv_kind : TextSubstitution<
7544  "%select{arithmetic between|bitwise operation between|comparison of|"
7545  "conditional expression between|compound assignment of}0">;
7546def warn_arith_conv_enum_float : Warning<
7547  "%sub{select_arith_conv_kind}0 "
7548  "%select{floating-point|enumeration}1 type %2 "
7549  "%plural{2:with|4:from|:and}0 "
7550  "%select{enumeration|floating-point}1 type %3">,
7551  InGroup<EnumFloatConversion>, DefaultIgnore;
7552def warn_arith_conv_enum_float_cxx20 : Warning<
7553  "%sub{select_arith_conv_kind}0 "
7554  "%select{floating-point|enumeration}1 type %2 "
7555  "%plural{2:with|4:from|:and}0 "
7556  "%select{enumeration|floating-point}1 type %3 is deprecated">,
7557  InGroup<DeprecatedEnumFloatConversion>;
7558def err_arith_conv_enum_float_cxx26 : Error<
7559  "invalid %sub{select_arith_conv_kind}0 "
7560  "%select{floating-point|enumeration}1 type %2 "
7561  "%plural{2:with|4:from|:and}0 "
7562  "%select{enumeration|floating-point}1 type %3">;
7563def warn_arith_conv_mixed_enum_types : Warning<
7564  "%sub{select_arith_conv_kind}0 "
7565  "different enumeration types%diff{ ($ and $)|}1,2">,
7566  InGroup<EnumEnumConversion>, DefaultIgnore;
7567def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
7568  "%sub{select_arith_conv_kind}0 "
7569  "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
7570  InGroup<DeprecatedEnumEnumConversion>;
7571def err_conv_mixed_enum_types_cxx26 : Error<
7572  "invalid %sub{select_arith_conv_kind}0 "
7573  "different enumeration types%diff{ ($ and $)|}1,2">;
7574
7575def warn_arith_conv_mixed_anon_enum_types : Warning<
7576  warn_arith_conv_mixed_enum_types.Summary>,
7577  InGroup<AnonEnumEnumConversion>, DefaultIgnore;
7578def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
7579  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7580  InGroup<DeprecatedAnonEnumEnumConversion>;
7581def warn_conditional_mixed_enum_types : Warning<
7582  warn_arith_conv_mixed_enum_types.Summary>,
7583  InGroup<EnumCompareConditional>, DefaultIgnore;
7584def warn_conditional_mixed_enum_types_cxx20 : Warning<
7585  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7586  InGroup<DeprecatedEnumCompareConditional>;
7587def warn_comparison_mixed_enum_types : Warning<
7588  warn_arith_conv_mixed_enum_types.Summary>,
7589  InGroup<EnumCompare>;
7590def warn_comparison_mixed_enum_types_cxx20 : Warning<
7591  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7592  InGroup<DeprecatedEnumCompare>;
7593def warn_comparison_of_mixed_enum_types_switch : Warning<
7594  "comparison of different enumeration types in switch statement"
7595  "%diff{ ($ and $)|}0,1">,
7596  InGroup<EnumCompareSwitch>;
7597
7598def err_typecheck_assign_const : Error<
7599  "%select{"
7600  "cannot assign to return value because function %1 returns a const value|"
7601  "cannot assign to variable %1 with const-qualified type %2|"
7602  "cannot assign to %select{non-|}1static data member %2 "
7603  "with const-qualified type %3|"
7604  "cannot assign to non-static data member within const member function %1|"
7605  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
7606  "with %select{|nested }3const-qualified data member %4|"
7607  "read-only variable is not assignable}0">;
7608
7609def note_typecheck_assign_const : Note<
7610  "%select{"
7611  "function %1 which returns const-qualified type %2 declared here|"
7612  "variable %1 declared const here|"
7613  "%select{non-|}1static data member %2 declared const here|"
7614  "member function %q1 is declared const here|"
7615  "%select{|nested }1data member %2 declared const here}0">;
7616
7617def warn_unsigned_always_true_comparison : Warning<
7618  "result of comparison of %select{%3|unsigned expression}0 %2 "
7619  "%select{unsigned expression|%3}0 is always %4">,
7620  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
7621def warn_unsigned_char_always_true_comparison : Warning<
7622  "result of comparison of %select{%3|char expression}0 %2 "
7623  "%select{char expression|%3}0 is always %4, since char is interpreted as "
7624  "unsigned">, InGroup<TautologicalUnsignedCharZeroCompare>, DefaultIgnore;
7625def warn_unsigned_enum_always_true_comparison : Warning<
7626  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
7627  "%select{unsigned enum expression|%3}0 is always %4">,
7628  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
7629def warn_tautological_constant_compare : Warning<
7630  "result of comparison %select{%3|%1}0 %2 "
7631  "%select{%1|%3}0 is always %4">,
7632  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
7633def warn_tautological_compare_objc_bool : Warning<
7634  "result of comparison of constant %0 with expression of type 'BOOL'"
7635  " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
7636  InGroup<TautologicalObjCBoolCompare>;
7637def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
7638def warn_tautological_compare_value_range : Warning<
7639  "result of comparison of "
7640  "%select{%4|%sub{subst_int_range}1,2}0 %3 "
7641  "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
7642  InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
7643
7644def warn_mixed_sign_comparison : Warning<
7645  "comparison of integers of different signs: %0 and %1">,
7646  InGroup<SignCompare>, DefaultIgnore;
7647def warn_out_of_range_compare : Warning<
7648  "result of comparison of %select{constant %0|true|false}1 with "
7649  "%select{expression of type %2|boolean expression}3 is always %4">,
7650  InGroup<TautologicalOutOfRangeCompare>;
7651def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Summary>,
7652  InGroup<TautologicalConstantCompare>;
7653def warn_integer_constants_in_conditional_always_true : Warning<
7654  "converting the result of '?:' with integer constants to a boolean always "
7655  "evaluates to 'true'">,
7656  InGroup<TautologicalConstantCompare>;
7657def warn_left_shift_always : Warning<
7658  "converting the result of '<<' to a boolean always evaluates "
7659  "to %select{false|true}0">,
7660  InGroup<TautologicalConstantCompare>;
7661def warn_null_in_arithmetic_operation : Warning<
7662  "use of NULL in arithmetic operation">,
7663  InGroup<NullArithmetic>;
7664def warn_null_in_comparison_operation : Warning<
7665  "comparison between NULL and non-pointer "
7666  "%select{(%1 and NULL)|(NULL and %1)}0">,
7667  InGroup<NullArithmetic>;
7668def err_shift_rhs_only_vector : Error<
7669  "requested shift is a vector of type %0 but the first operand is not a "
7670  "vector (%1)">;
7671
7672def warn_logical_not_on_lhs_of_check : Warning<
7673  "logical not is only applied to the left hand side of this "
7674  "%select{comparison|bitwise operator}0">,
7675  InGroup<LogicalNotParentheses>;
7676def note_logical_not_fix : Note<
7677  "add parentheses after the '!' to evaluate the "
7678  "%select{comparison|bitwise operator}0 first">;
7679def note_logical_not_silence_with_parens : Note<
7680  "add parentheses around left hand side expression to silence this warning">;
7681
7682def err_invalid_this_use : Error<
7683  "invalid use of 'this' %select{outside of a non-static member function"
7684  "|in a function with an explicit object parameter}0">;
7685def err_this_static_member_func : Error<
7686  "'this' cannot be%select{| implicitly}0 used in a static member function "
7687  "declaration">;
7688def err_invalid_member_use_in_method : Error<
7689  "invalid use of member %0 in %select{static|explicit object}1 member function">;
7690
7691def err_invalid_qualified_function_type : Error<
7692  "%select{non-member function|static member function|explicit object member function|deduction guide}0 "
7693  "%select{of type %2 |}1cannot have '%3' qualifier">;
7694def err_compound_qualified_function_type : Error<
7695  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
7696  "cannot have '%3' qualifier">;
7697def err_qualified_function_typeid : Error<
7698  "type operand %0 of 'typeid' cannot have '%1' qualifier">;
7699
7700def err_cxx20_deducing_this  : Error<
7701  "explicit object parameters are incompatible with C++ standards before C++2b">;
7702def err_explicit_object_default_arg: Error<
7703  "the explicit object parameter cannot have a default argument">;
7704def err_explicit_object_parameter_pack: Error<
7705  "the explicit object parameter cannot be a function parameter pack">;
7706def err_explicit_object_parameter_must_be_first: Error<
7707  "an explicit object parameter can only appear as the first parameter "
7708  "of the %select{function|lambda}0">;
7709def err_explicit_object_parameter_nonmember: Error<
7710  "an explicit object parameter cannot appear in a "
7711  "%select{static|virtual|non-member}0 %select{function|lambda}1">;
7712def err_explicit_object_parameter_constructor: Error<
7713  "an explicit object parameter cannot appear in a %select{constructor|destructor}0">;
7714def err_explicit_object_parameter_mutable: Error<
7715  "a lambda with an explicit object parameter cannot be mutable">;
7716def err_invalid_explicit_object_type_in_lambda: Error<
7717  "invalid explicit object parameter type %0 in lambda with capture; "
7718  "the type must be the same as, or derived from, the lambda">;
7719def err_explicit_object_lambda_ambiguous_base : Error<
7720  "lambda %0 is inaccessible due to ambiguity:%1">;
7721def err_explicit_object_lambda_inaccessible_base : Error<
7722  "invalid explicit object parameter type %0 in lambda with capture; "
7723  "the type must derive publicly from the lambda">;
7724def err_explicit_object_parameter_invalid: Error<
7725  "an explicit object parameter can only appear as the first parameter of a member function">;
7726
7727def err_ref_qualifier_overload : Error<
7728  "cannot overload a member function %select{without a ref-qualifier|with "
7729  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
7730  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
7731
7732def err_invalid_non_static_member_use : Error<
7733  "invalid use of non-static data member %0">;
7734def err_nested_non_static_member_use : Error<
7735  "%select{call to non-static member function|use of non-static data member}0 "
7736  "%2 of %1 from nested type %3">;
7737def warn_cxx98_compat_non_static_member_use : Warning<
7738  "use of non-static data member %0 in an unevaluated context is "
7739  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
7740def err_invalid_incomplete_type_use : Error<
7741  "invalid use of incomplete type %0">;
7742def err_builtin_func_cast_more_than_one_arg : Error<
7743  "function-style cast to a builtin type can only take one argument">;
7744def err_value_init_for_array_type : Error<
7745  "array types cannot be value-initialized">;
7746def err_init_for_function_type : Error<
7747  "cannot create object of function type %0">;
7748def warn_format_nonliteral_noargs : Warning<
7749  "format string is not a string literal (potentially insecure)">,
7750  InGroup<FormatSecurity>;
7751def warn_format_nonliteral : Warning<
7752  "format string is not a string literal">,
7753  InGroup<FormatNonLiteral>, DefaultIgnore;
7754
7755def err_unexpected_interface : Error<
7756  "unexpected interface name %0: expected expression">;
7757def err_ref_non_value : Error<"%0 does not refer to a value">;
7758def err_ref_vm_type : Error<
7759  "cannot refer to declaration with a variably modified type inside block">;
7760def err_ref_flexarray_type : Error<
7761  "cannot refer to declaration of structure variable with flexible array member "
7762  "inside block">;
7763def err_ref_array_type : Error<
7764  "cannot refer to declaration with an array type inside block">;
7765def err_property_not_found : Error<
7766  "property %0 not found on object of type %1">;
7767def err_invalid_property_name : Error<
7768  "%0 is not a valid property name (accessing an object of type %1)">;
7769def err_getter_not_found : Error<
7770  "no getter method for read from property">;
7771def err_objc_subscript_method_not_found : Error<
7772  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
7773  "found on object of type %0">;
7774def err_objc_subscript_index_type : Error<
7775  "method index parameter type %0 is not integral type">;
7776def err_objc_subscript_key_type : Error<
7777  "method key parameter type %0 is not object type">;
7778def err_objc_subscript_dic_object_type : Error<
7779  "method object parameter type %0 is not object type">;
7780def err_objc_subscript_object_type : Error<
7781  "cannot assign to this %select{dictionary|array}1 because assigning method's "
7782  "2nd parameter of type %0 is not an Objective-C pointer type">;
7783def err_objc_subscript_base_type : Error<
7784  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
7785def err_objc_multiple_subscript_type_conversion : Error<
7786  "indexing expression is invalid because subscript type %0 has "
7787  "multiple type conversion functions">;
7788def err_objc_subscript_type_conversion : Error<
7789  "indexing expression is invalid because subscript type %0 is not an integral"
7790  " or Objective-C pointer type">;
7791def err_objc_subscript_pointer : Error<
7792  "indexing expression is invalid because subscript type %0 is not an"
7793  " Objective-C pointer">;
7794def err_objc_indexing_method_result_type : Error<
7795  "method for accessing %select{dictionary|array}1 element must have Objective-C"
7796  " object return type instead of %0">;
7797def err_objc_index_incomplete_class_type : Error<
7798  "Objective-C index expression has incomplete class type %0">;
7799def err_illegal_container_subscripting_op : Error<
7800  "illegal operation on Objective-C container subscripting">;
7801def err_property_not_found_forward_class : Error<
7802  "property %0 cannot be found in forward class object %1">;
7803def err_property_not_as_forward_class : Error<
7804  "property %0 refers to an incomplete Objective-C class %1 "
7805  "(with no @interface available)">;
7806def note_forward_class : Note<
7807  "forward declaration of class here">;
7808def err_duplicate_property : Error<
7809  "property has a previous declaration">;
7810def ext_gnu_void_ptr : Extension<
7811  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
7812  InGroup<GNUPointerArith>;
7813def ext_gnu_ptr_func_arith : Extension<
7814  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
7815  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
7816  InGroup<GNUPointerArith>;
7817def err_readonly_message_assignment : Error<
7818  "assigning to 'readonly' return result of an Objective-C message not allowed">;
7819def ext_c2y_increment_complex : Extension<
7820  "'%select{--|++}0' on an object of complex type is a C2y extension">,
7821  InGroup<C2y>;
7822def warn_c2y_compat_increment_complex : Warning<
7823  "'%select{--|++}0' on an object of complex type is incompatible with C "
7824  "standards before C2y">, InGroup<CPre2yCompat>, DefaultIgnore;
7825def ext_integer_complement_complex : Extension<
7826  "ISO C does not support '~' for complex conjugation of %0">;
7827def err_nosetter_property_assignment : Error<
7828  "%select{assignment to readonly property|"
7829  "no setter method %1 for assignment to property}0">;
7830def err_nosetter_property_incdec : Error<
7831  "%select{%select{increment|decrement}1 of readonly property|"
7832  "no setter method %2 for %select{increment|decrement}1 of property}0">;
7833def err_nogetter_property_compound_assignment : Error<
7834  "a getter method is needed to perform a compound assignment on a property">;
7835def err_nogetter_property_incdec : Error<
7836  "no getter method %1 for %select{increment|decrement}0 of property">;
7837def err_no_subobject_property_setting : Error<
7838  "expression is not assignable">;
7839def err_qualified_objc_access : Error<
7840  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
7841
7842def ext_freestanding_complex : Extension<
7843  "complex numbers are an extension in a freestanding C99 implementation">;
7844
7845def err_imaginary_not_supported : Error<"imaginary types are not supported">;
7846
7847// Obj-c expressions
7848def warn_root_inst_method_not_found : Warning<
7849  "instance method %0 is being used on 'Class' which is not in the root class">,
7850  InGroup<MethodAccess>;
7851def warn_class_method_not_found : Warning<
7852  "class method %objcclass0 not found (return type defaults to 'id')">,
7853  InGroup<MethodAccess>;
7854def warn_instance_method_on_class_found : Warning<
7855  "instance method %0 found instead of class method %1">,
7856  InGroup<MethodAccess>;
7857def warn_inst_method_not_found : Warning<
7858  "instance method %objcinstance0 not found (return type defaults to 'id')">,
7859  InGroup<MethodAccess>;
7860def warn_instance_method_not_found_with_typo : Warning<
7861  "instance method %objcinstance0 not found (return type defaults to 'id')"
7862  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
7863def warn_class_method_not_found_with_typo : Warning<
7864  "class method %objcclass0 not found (return type defaults to 'id')"
7865  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
7866def err_method_not_found_with_typo : Error<
7867  "%select{instance|class}1 method %0 not found "
7868  "; did you mean %2?">;
7869def err_no_super_class_message : Error<
7870  "no @interface declaration found in class messaging of %0">;
7871def err_root_class_cannot_use_super : Error<
7872  "%0 cannot use 'super' because it is a root class">;
7873def err_invalid_receiver_to_message_super : Error<
7874  "'super' is only valid in a method body">;
7875def err_invalid_receiver_class_message : Error<
7876  "receiver type %0 is not an Objective-C class">;
7877def err_missing_open_square_message_send : Error<
7878  "missing '[' at start of message send expression">;
7879def warn_bad_receiver_type : Warning<
7880  "receiver type %0 is not 'id' or interface pointer, consider "
7881  "casting it to 'id'">,InGroup<ObjCReceiver>;
7882def err_bad_receiver_type : Error<"bad receiver type %0">;
7883def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
7884def err_unknown_receiver_suggest : Error<
7885  "unknown receiver %0; did you mean %1?">;
7886def err_objc_throw_expects_object : Error<
7887  "@throw requires an Objective-C object type (%0 invalid)">;
7888def err_objc_synchronized_expects_object : Error<
7889  "@synchronized requires an Objective-C object type (%0 invalid)">;
7890def err_rethrow_used_outside_catch : Error<
7891  "@throw (rethrow) used outside of a @catch block">;
7892def err_attribute_multiple_objc_gc : Error<
7893  "multiple garbage collection attributes specified for type">;
7894def err_catch_param_not_objc_type : Error<
7895  "@catch parameter is not a pointer to an interface type">;
7896def err_illegal_qualifiers_on_catch_parm : Error<
7897  "illegal qualifiers on @catch parameter">;
7898def err_storage_spec_on_catch_parm : Error<
7899  "@catch parameter cannot have storage specifier '%0'">;
7900def warn_register_objc_catch_parm : Warning<
7901  "'register' storage specifier on @catch parameter will be ignored">;
7902def err_qualified_objc_catch_parm : Error<
7903  "@catch parameter declarator cannot be qualified">;
7904def warn_objc_pointer_cxx_catch_fragile : Warning<
7905  "cannot catch an exception thrown with @throw in C++ in the non-unified "
7906  "exception model">, InGroup<ObjCNonUnifiedException>;
7907def err_objc_object_catch : Error<
7908  "cannot catch an Objective-C object by value">;
7909def err_incomplete_type_objc_at_encode : Error<
7910  "'@encode' of incomplete type %0">;
7911def warn_objc_circular_container : Warning<
7912  "adding %0 to %1 might cause circular dependency in container">,
7913  InGroup<DiagGroup<"objc-circular-container">>;
7914def note_objc_circular_container_declared_here : Note<"%0 declared here">;
7915def warn_objc_unsafe_perform_selector : Warning<
7916  "%0 is incompatible with selectors that return a "
7917  "%select{struct|union|vector}1 type">,
7918  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
7919def note_objc_unsafe_perform_selector_method_declared_here :  Note<
7920  "method %0 that returns %1 declared here">;
7921def err_attribute_arm_builtin_alias : Error<
7922  "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
7923def err_attribute_arm_mve_polymorphism : Error<
7924  "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
7925def err_attribute_webassembly_funcref : Error<
7926  "'__funcref' attribute can only be applied to a function pointer type">;
7927
7928def warn_setter_getter_impl_required : Warning<
7929  "property %0 requires method %1 to be defined - "
7930  "use @synthesize, @dynamic or provide a method implementation "
7931  "in this class implementation">,
7932  InGroup<ObjCPropertyImpl>;
7933def warn_setter_getter_impl_required_in_category : Warning<
7934  "property %0 requires method %1 to be defined - "
7935  "use @dynamic or provide a method implementation in this category">,
7936  InGroup<ObjCPropertyImpl>;
7937def note_parameter_named_here : Note<
7938  "passing argument to parameter %0 here">;
7939def note_parameter_here : Note<
7940  "passing argument to parameter here">;
7941def note_method_return_type_change : Note<
7942  "compiler has implicitly changed method %0 return type">;
7943
7944def warn_impl_required_for_class_property : Warning<
7945  "class property %0 requires method %1 to be defined - "
7946  "use @dynamic or provide a method implementation "
7947  "in this class implementation">,
7948  InGroup<ObjCPropertyImpl>;
7949def warn_impl_required_in_category_for_class_property : Warning<
7950  "class property %0 requires method %1 to be defined - "
7951  "use @dynamic or provide a method implementation in this category">,
7952  InGroup<ObjCPropertyImpl>;
7953
7954// C++ casts
7955// These messages adhere to the TryCast pattern: %0 is an int specifying the
7956// cast type, %1 is the source type, %2 is the destination type.
7957def err_bad_reinterpret_cast_overload : Error<
7958  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
7959
7960def warn_reinterpret_different_from_static : Warning<
7961  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
7962  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
7963  "'static_cast'">, InGroup<ReinterpretBaseClass>;
7964def note_reinterpret_updowncast_use_static: Note<
7965  "use 'static_cast' to adjust the pointer correctly while "
7966  "%select{upcasting|downcasting}0">;
7967
7968def err_bad_static_cast_overload : Error<
7969  "address of overloaded function %0 cannot be static_cast to type %1">;
7970
7971def err_bad_cstyle_cast_overload : Error<
7972  "address of overloaded function %0 cannot be cast to type %1">;
7973
7974
7975def err_bad_cxx_cast_generic : Error<
7976  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7977  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7978def err_bad_cxx_cast_unrelated_class : Error<
7979  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7980  "functional-style cast|}0 from %1 to %2, which are not related by "
7981  "inheritance, is not allowed">;
7982def note_type_incomplete : Note<"%0 is incomplete">;
7983def err_bad_cxx_cast_rvalue : Error<
7984  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7985  "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7986def err_bad_cxx_cast_bitfield : Error<
7987  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7988  "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7989def err_bad_cxx_cast_qualifiers_away : Error<
7990  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7991  "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7992def err_bad_cxx_cast_addr_space_mismatch : Error<
7993  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7994  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7995  " spaces">;
7996def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7997  "ISO C++ does not allow "
7998  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7999  "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
8000  "even though the source and destination types are unrelated">,
8001  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
8002def err_bad_const_cast_dest : Error<
8003  "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
8004  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
8005def ext_cast_fn_obj : Extension<
8006  "cast between pointer-to-function and pointer-to-object is an extension">;
8007def ext_ms_cast_fn_obj : ExtWarn<
8008  "static_cast between pointer-to-function and pointer-to-object is a "
8009  "Microsoft extension">, InGroup<MicrosoftCast>;
8010def warn_cxx98_compat_cast_fn_obj : Warning<
8011  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
8012  InGroup<CXX98CompatPedantic>, DefaultIgnore;
8013def err_bad_reinterpret_cast_small_int : Error<
8014  "cast from pointer to smaller type %2 loses information">;
8015def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
8016  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
8017  "to scalar %2 of different size">;
8018def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
8019  "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
8020  "to vector %2 of different size">;
8021def err_bad_cxx_cast_vector_to_vector_different_size : Error<
8022  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
8023  "to vector %2 of different size">;
8024def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
8025  "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
8026  "changes address space of nested pointers">,
8027  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8028def err_bad_lvalue_to_rvalue_cast : Error<
8029  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
8030  "not compatible">;
8031def err_bad_rvalue_to_rvalue_cast : Error<
8032  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
8033  "not compatible">;
8034def err_bad_static_cast_pointer_nonpointer : Error<
8035  "cannot cast from type %1 to pointer type %2">;
8036def err_bad_static_cast_member_pointer_nonmp : Error<
8037  "cannot cast from type %1 to member pointer type %2">;
8038def err_bad_cxx_cast_member_pointer_size : Error<
8039  "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
8040  "type %1 to member pointer type %2 of different size">;
8041def err_bad_reinterpret_cast_reference : Error<
8042  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
8043def warn_undefined_reinterpret_cast : Warning<
8044  "reinterpret_cast from %0 to %1 has undefined behavior">,
8045  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
8046
8047// These messages don't adhere to the pattern.
8048// FIXME: Display the path somehow better.
8049def err_ambiguous_base_to_derived_cast : Error<
8050  "ambiguous cast from base %0 to derived %1:%2">;
8051def err_static_downcast_via_virtual : Error<
8052  "cannot cast %0 to %1 via virtual base %2">;
8053def err_downcast_from_inaccessible_base : Error<
8054  "cannot cast %select{private|protected}2 base class %1 to %0">;
8055def err_upcast_to_inaccessible_base : Error<
8056  "cannot cast %0 to its %select{private|protected}2 base class %1">;
8057def err_bad_dynamic_cast_not_ref_or_ptr : Error<
8058  "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
8059def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
8060def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
8061def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
8062def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
8063
8064// Other C++ expressions
8065def err_need_header_before_typeid : Error<
8066  "you need to include <typeinfo> before using the 'typeid' operator">;
8067def err_need_header_before_placement_new : Error<
8068  "no matching %0 function for non-allocating placement new expression; "
8069  "include <new>">;
8070def err_ms___leave_not_in___try : Error<
8071  "'__leave' statement not in __try block">;
8072def err_uuidof_without_guid : Error<
8073  "cannot call operator __uuidof on a type with no GUID">;
8074def err_uuidof_with_multiple_guids : Error<
8075  "cannot call operator __uuidof on a type with multiple GUIDs">;
8076def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
8077def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
8078def err_static_illegal_in_new : Error<
8079  "the 'static' modifier for the array size is not legal in new expressions">;
8080def err_array_new_needs_size : Error<
8081  "array size must be specified in new expression with no initializer">;
8082def err_bad_new_type : Error<
8083  "cannot allocate %select{function|reference}1 type %0 with new">;
8084def err_new_incomplete_or_sizeless_type : Error<
8085  "allocation of %select{incomplete|sizeless}0 type %1">;
8086def err_new_array_nonconst : Error<
8087  "only the first dimension of an allocated array may have dynamic size">;
8088def err_new_array_size_unknown_from_init : Error<
8089  "cannot determine allocated array size from initializer">;
8090def err_new_array_init_args : Error<
8091  "array 'new' cannot have initialization arguments">;
8092def ext_new_paren_array_nonconst : ExtWarn<
8093  "when type is in parentheses, array cannot have dynamic size">;
8094def err_placement_new_non_placement_delete : Error<
8095  "'new' expression with placement arguments refers to non-placement "
8096  "'operator delete'">;
8097def err_array_size_not_integral : Error<
8098  "array size expression must have integral or %select{|unscoped }0"
8099  "enumeration type, not %1">;
8100def err_array_size_incomplete_type : Error<
8101  "array size expression has incomplete class type %0">;
8102def err_array_size_explicit_conversion : Error<
8103  "array size expression of type %0 requires explicit conversion to type %1">;
8104def note_array_size_conversion : Note<
8105  "conversion to %select{integral|enumeration}0 type %1 declared here">;
8106def err_array_size_ambiguous_conversion : Error<
8107  "ambiguous conversion of array size expression of type %0 to an integral or "
8108  "enumeration type">;
8109def ext_array_size_conversion : Extension<
8110  "implicit conversion from array size expression of type %0 to "
8111  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
8112  InGroup<CXX11>;
8113def warn_cxx98_compat_array_size_conversion : Warning<
8114  "implicit conversion from array size expression of type %0 to "
8115  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
8116  InGroup<CXX98CompatPedantic>, DefaultIgnore;
8117def err_address_space_qualified_new : Error<
8118  "'new' cannot allocate objects of type %0 in address space '%1'">;
8119def err_address_space_qualified_delete : Error<
8120  "'delete' cannot delete objects of type %0 in address space '%1'">;
8121
8122def err_default_init_const : Error<
8123  "default initialization of an object of const type %0"
8124  "%select{| without a user-provided default constructor}1">;
8125def ext_default_init_const : ExtWarn<
8126  "default initialization of an object of const type %0"
8127  "%select{| without a user-provided default constructor}1 "
8128  "is a Microsoft extension">,
8129  InGroup<MicrosoftConstInit>;
8130def err_delete_operand : Error<"cannot delete expression of type %0">;
8131def ext_delete_void_ptr_operand : ExtWarn<
8132  "cannot delete expression with pointer-to-'void' type %0">,
8133  InGroup<DeleteIncomplete>;
8134def err_ambiguous_delete_operand : Error<
8135  "ambiguous conversion of delete expression of type %0 to a pointer">;
8136def warn_delete_incomplete : Warning<
8137  "deleting pointer to incomplete type %0 is incompatible with C++2c"
8138  " and may cause undefined behavior">,
8139  InGroup<DeleteIncomplete>;
8140def err_delete_incomplete : Error<
8141  "cannot delete pointer to incomplete type %0">;
8142def err_delete_incomplete_class_type : Error<
8143  "deleting incomplete class type %0; no conversions to pointer type">;
8144def err_delete_explicit_conversion : Error<
8145  "converting delete expression from type %0 to type %1 invokes an explicit "
8146  "conversion function">;
8147def note_delete_conversion : Note<"conversion to pointer type %0">;
8148def warn_delete_array_type : Warning<
8149  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
8150def warn_mismatched_delete_new : Warning<
8151  "'delete%select{|[]}0' applied to a pointer that was allocated with "
8152  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
8153  InGroup<DiagGroup<"mismatched-new-delete">>;
8154def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
8155def err_no_suitable_delete_member_function_found : Error<
8156  "no suitable member %0 in %1">;
8157def err_ambiguous_suitable_delete_member_function_found : Error<
8158  "multiple suitable %0 functions in %1">;
8159def warn_ambiguous_suitable_delete_function_found : Warning<
8160  "multiple suitable %0 functions for %1; no 'operator delete' function "
8161  "will be invoked if initialization throws an exception">,
8162  InGroup<DiagGroup<"ambiguous-delete">>;
8163def note_member_declared_here : Note<
8164  "member %0 declared here">;
8165def note_member_first_declared_here : Note<
8166  "member %0 first declared here">;
8167def warn_bitwise_instead_of_logical : Warning<
8168  "use of bitwise '%0' with boolean operands">,
8169  InGroup<BitwiseInsteadOfLogical>, DefaultIgnore;
8170def warn_bitwise_negation_bool : Warning<
8171  "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
8172  "did you mean logical negation?">,
8173  InGroup<BoolOperation>, DefaultIgnore;
8174def err_decrement_bool : Error<"cannot decrement expression of type bool">;
8175def warn_increment_bool : Warning<
8176  "incrementing expression of type bool is deprecated and "
8177  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
8178def ext_increment_bool : ExtWarn<
8179  "ISO C++17 does not allow incrementing expression of type bool">,
8180  DefaultError, SFINAEFailure, InGroup<IncrementBool>;
8181def err_increment_decrement_enum : Error<
8182  "cannot %select{decrement|increment}0 expression of enum type %1">;
8183
8184def warn_deprecated_increment_decrement_volatile : Warning<
8185  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
8186  "is deprecated">, InGroup<DeprecatedVolatile>;
8187def warn_deprecated_simple_assign_volatile : Warning<
8188  "use of result of assignment to object of volatile-qualified type %0 "
8189  "is deprecated">, InGroup<DeprecatedVolatile>;
8190def warn_deprecated_volatile_return : Warning<
8191  "volatile-qualified return type %0 is deprecated">,
8192  InGroup<DeprecatedVolatile>;
8193def warn_deprecated_volatile_param : Warning<
8194  "volatile-qualified parameter type %0 is deprecated">,
8195  InGroup<DeprecatedVolatile>;
8196def warn_deprecated_volatile_structured_binding : Warning<
8197  "volatile qualifier in structured binding declaration is deprecated">,
8198  InGroup<DeprecatedVolatile>;
8199
8200def warn_deprecated_altivec_src_compat : Warning<
8201  "current handling of vector bool and vector pixel types in this context are "
8202  "deprecated; the default behaviour will soon change to that implied by the "
8203  "'-altivec-compat=xl' option">,
8204  InGroup<DiagGroup<"deprecated-altivec-src-compat">>;
8205
8206def warn_deprecated_lax_vec_conv_all : Warning<
8207  "implicit conversion between vector types ('%0' and '%1') is deprecated; "
8208  "in the future, the behavior implied by '-fno-lax-vector-conversions' "
8209  "will be the default">,
8210  InGroup<DiagGroup<"deprecate-lax-vec-conv-all">>;
8211
8212def err_catch_incomplete_ptr : Error<
8213  "cannot catch pointer to incomplete type %0">;
8214def err_catch_incomplete_ref : Error<
8215  "cannot catch reference to incomplete type %0">;
8216def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
8217def err_catch_sizeless : Error<
8218  "cannot catch %select{|reference to }0sizeless type %1">;
8219def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
8220def err_catch_variably_modified : Error<
8221  "cannot catch variably modified type %0">;
8222def err_qualified_catch_declarator : Error<
8223  "exception declarator cannot be qualified">;
8224def err_early_catch_all : Error<"catch-all handler must come last">;
8225def err_bad_memptr_rhs : Error<
8226  "right hand operand to %0 has non-pointer-to-member type %1">;
8227def err_bad_memptr_lhs : Error<
8228  "left hand operand to %0 must be a %select{|pointer to }1class "
8229  "compatible with the right hand operand, but is %2">;
8230def err_memptr_incomplete : Error<
8231  "member pointer has incomplete base type %0">;
8232def warn_exception_caught_by_earlier_handler : Warning<
8233  "exception of type %0 will be caught by earlier handler">,
8234  InGroup<Exceptions>;
8235def note_previous_exception_handler : Note<"for type %0">;
8236def err_exceptions_disabled : Error<
8237  "cannot use '%0' with exceptions disabled">;
8238def err_objc_exceptions_disabled : Error<
8239  "cannot use '%0' with Objective-C exceptions disabled">;
8240def warn_throw_in_noexcept_func : Warning<
8241  "%0 has a non-throwing exception specification but can still throw">,
8242  InGroup<Exceptions>;
8243def note_throw_in_dtor : Note<
8244  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
8245  "non-throwing}1 exception specification">;
8246def note_throw_in_function : Note<"function declared non-throwing here">;
8247def err_seh_try_outside_functions : Error<
8248  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
8249def err_mixing_cxx_try_seh_try : Error<
8250  "cannot use %select{C++ 'try'|Objective-C '@try'}0 "
8251  "in the same function as SEH '__try'">;
8252def err_seh_try_unsupported : Error<
8253  "SEH '__try' is not supported on this target">;
8254def note_conflicting_try_here : Note<
8255  "conflicting %0 here">;
8256def warn_jump_out_of_seh_finally : Warning<
8257  "jump out of __finally block has undefined behavior">,
8258  InGroup<DiagGroup<"jump-seh-finally">>;
8259def warn_non_virtual_dtor : Warning<
8260  "%0 has virtual functions but non-virtual destructor">,
8261  InGroup<NonVirtualDtor>, DefaultIgnore;
8262def warn_delete_non_virtual_dtor : Warning<
8263  "%select{delete|destructor}0 called on non-final %1 that has "
8264  "virtual functions but non-virtual destructor">,
8265  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
8266def note_delete_non_virtual : Note<
8267  "qualify call to silence this warning">;
8268def warn_delete_abstract_non_virtual_dtor : Warning<
8269  "%select{delete|destructor}0 called on %1 that is abstract but has "
8270  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
8271def warn_overloaded_virtual : Warning<
8272  "%q0 hides overloaded virtual %select{function|functions}1">,
8273  InGroup<OverloadedVirtual>, DefaultIgnore;
8274def note_hidden_overloaded_virtual_declared_here : Note<
8275  "hidden overloaded virtual function %q0 declared here"
8276  "%select{|: different classes%diff{ ($ vs $)|}2,3"
8277  "|: different number of parameters (%2 vs %3)"
8278  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
8279  "|: different return type%diff{ ($ vs $)|}2,3"
8280  "|: different qualifiers (%2 vs %3)"
8281  "|: different exception specifications}1">;
8282def warn_using_directive_in_header : Warning<
8283  "using namespace directive in global context in header">,
8284  InGroup<HeaderHygiene>, DefaultIgnore;
8285def warn_overaligned_type : Warning<
8286  "type %0 requires %1 bytes of alignment and the default allocator only "
8287  "guarantees %2 bytes">,
8288  InGroup<OveralignedType>, DefaultIgnore;
8289def err_array_element_alignment : Error<
8290  "size of array element of type %0 (%1 bytes) isn't a multiple of its alignment (%2 bytes)">;
8291def err_aligned_allocation_unavailable : Error<
8292  "aligned %select{allocation|deallocation}0 function of type '%1' is "
8293  "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
8294def note_silence_aligned_allocation_unavailable : Note<
8295  "if you supply your own aligned allocation functions, use "
8296  "-faligned-allocation to silence this diagnostic">;
8297
8298def err_conditional_void_nonvoid : Error<
8299  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
8300  "is of type %0">;
8301def err_conditional_ambiguous : Error<
8302  "conditional expression is ambiguous; "
8303  "%diff{$ can be converted to $ and vice versa|"
8304  "types can be convert to each other}0,1">;
8305def err_conditional_ambiguous_ovl : Error<
8306  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
8307  "can be converted to several common types">;
8308def err_conditional_vector_size : Error<
8309  "vector condition type %0 and result type %1 do not have the same number "
8310  "of elements">;
8311def err_conditional_vector_element_size : Error<
8312  "vector condition type %0 and result type %1 do not have elements of the "
8313  "same size">;
8314def err_conditional_vector_has_void : Error<
8315  "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
8316def err_conditional_vector_operand_type
8317    : Error<"enumeration type %0 is not allowed in a vector conditional">;
8318def err_conditional_vector_cond_result_mismatch
8319    : Error<"cannot mix vectors and extended vectors in a vector conditional">;
8320def err_conditional_vector_mismatched
8321    : Error<"vector operands to the vector conditional must be the same type "
8322            "%diff{($ and $)|}0,1}">;
8323
8324def err_throw_incomplete : Error<
8325  "cannot throw object of incomplete type %0">;
8326def err_throw_incomplete_ptr : Error<
8327  "cannot throw pointer to object of incomplete type %0">;
8328def err_throw_sizeless : Error<
8329  "cannot throw object of sizeless type %0">;
8330def warn_throw_underaligned_obj : Warning<
8331  "underaligned exception object thrown">,
8332  InGroup<UnderalignedExceptionObject>;
8333def note_throw_underaligned_obj : Note<
8334  "required alignment of type %0 (%1 bytes) is larger than the supported "
8335  "alignment of C++ exception objects on this target (%2 bytes)">;
8336def err_return_in_constructor_handler : Error<
8337  "return in the catch of a function try block of a constructor is illegal">;
8338def warn_cdtor_function_try_handler_mem_expr : Warning<
8339  "cannot refer to a non-static member from the handler of a "
8340  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
8341def err_throw_object_throwing_dtor : Error<
8342  "cannot throw object of type %0 with a potentially-throwing destructor">;
8343
8344let CategoryName = "Lambda Issue" in {
8345  def err_capture_more_than_once : Error<
8346    "%0 can appear only once in a capture list">;
8347  def err_reference_capture_with_reference_default : Error<
8348    "'&' cannot precede a capture when the capture default is '&'">;
8349  def err_copy_capture_with_copy_default : Error<
8350    "'&' must precede a capture when the capture default is '='">;
8351  def err_capture_does_not_name_variable : Error<
8352    "%0 in capture list does not name a variable">;
8353  def err_capture_class_member_does_not_name_variable : Error<
8354    "class member %0 cannot appear in capture list as it is not a variable">;
8355  def err_capture_non_automatic_variable : Error<
8356    "%0 cannot be captured because it does not have automatic storage "
8357    "duration">;
8358  def err_this_capture : Error<
8359    "'this' cannot be %select{implicitly |}0captured in this context">;
8360  def note_lambda_this_capture_fixit : Note<
8361    "explicitly capture 'this'">;
8362  def err_lambda_capture_anonymous_var : Error<
8363    "unnamed variable cannot be implicitly captured in a lambda expression">;
8364  def err_lambda_capture_flexarray_type : Error<
8365    "variable %0 with flexible array member cannot be captured in "
8366    "a lambda expression">;
8367  def err_lambda_impcap : Error<
8368    "variable %0 cannot be implicitly captured in a lambda with no "
8369    "capture-default specified">;
8370  def note_lambda_variable_capture_fixit : Note<
8371    "capture %0 by %select{value|reference}1">;
8372  def note_lambda_default_capture_fixit : Note<
8373    "default capture by %select{value|reference}0">;
8374  def note_lambda_decl : Note<"lambda expression begins here">;
8375  def err_lambda_unevaluated_operand : Error<
8376    "lambda expression in an unevaluated operand">;
8377  def err_lambda_in_constant_expression : Error<
8378    "a lambda expression may not appear inside of a constant expression">;
8379  def err_lambda_in_invalid_context : Error<
8380    "a lambda expression cannot appear in this context">;
8381  def err_lambda_return_init_list : Error<
8382    "cannot deduce lambda return type from initializer list">;
8383  def err_lambda_capture_default_arg : Error<
8384    "lambda expression in default argument cannot capture any entity">;
8385  def err_lambda_incomplete_result : Error<
8386    "incomplete result type %0 in lambda expression">;
8387  def err_noreturn_lambda_has_return_expr : Error<
8388    "lambda declared 'noreturn' should not return">;
8389  def warn_maybe_falloff_nonvoid_lambda : Warning<
8390    "non-void lambda does not return a value in all control paths">,
8391    InGroup<ReturnType>;
8392  def warn_falloff_nonvoid_lambda : Warning<
8393    "non-void lambda does not return a value">,
8394    InGroup<ReturnType>;
8395  def err_access_lambda_capture : Error<
8396    // The ERRORs represent other special members that aren't constructors, in
8397    // hopes that someone will bother noticing and reporting if they appear
8398    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
8399    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
8400    AccessControl;
8401  def note_lambda_to_block_conv : Note<
8402    "implicit capture of lambda object due to conversion to block pointer "
8403    "here">;
8404  def note_var_explicitly_captured_here : Note<"variable %0 is"
8405    "%select{| explicitly}1 captured here">;
8406
8407  // C++14 lambda init-captures.
8408  def warn_cxx11_compat_init_capture : Warning<
8409    "initialized lambda captures are incompatible with C++ standards "
8410    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
8411  def ext_init_capture : ExtWarn<
8412    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
8413  def err_init_capture_no_expression : Error<
8414    "initializer missing for lambda capture %0">;
8415  def err_init_capture_multiple_expressions : Error<
8416    "initializer for lambda capture %0 contains multiple expressions">;
8417  def err_init_capture_paren_braces : Error<
8418    "cannot deduce type for lambda capture %1 from "
8419    "%select{parenthesized|nested}0 initializer list">;
8420  def err_init_capture_deduction_failure : Error<
8421    "cannot deduce type for lambda capture %0 from initializer of type %2">;
8422  def err_init_capture_deduction_failure_from_init_list : Error<
8423    "cannot deduce type for lambda capture %0 from initializer list">;
8424  def warn_cxx17_compat_init_capture_pack : Warning<
8425    "initialized lambda capture packs are incompatible with C++ standards "
8426    "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8427  def ext_init_capture_pack : ExtWarn<
8428    "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
8429
8430  // C++14 generic lambdas.
8431  def warn_cxx11_compat_generic_lambda : Warning<
8432    "generic lambdas are incompatible with C++11">,
8433    InGroup<CXXPre14Compat>, DefaultIgnore;
8434  def err_lambda_explicit_spec : Error<
8435    "lambda call operator should not be explicitly specialized or instantiated">;
8436
8437  // C++17 '*this' captures.
8438  def warn_cxx14_compat_star_this_lambda_capture : Warning<
8439    "by value capture of '*this' is incompatible with C++ standards before C++17">,
8440     InGroup<CXXPre17Compat>, DefaultIgnore;
8441  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
8442    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
8443
8444  // C++17 parameter shadows capture
8445  def err_parameter_shadow_capture : Error<
8446    "a lambda parameter cannot shadow an explicitly captured entity">;
8447
8448  // C++20 [=, this] captures.
8449  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
8450    "explicit capture of 'this' with a capture default of '=' is incompatible "
8451    "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8452  def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
8453    "explicit capture of 'this' with a capture default of '=' "
8454    "is a C++20 extension">, InGroup<CXX20>;
8455  def warn_deprecated_this_capture : Warning<
8456    "implicit capture of 'this' with a capture default of '=' is deprecated">,
8457    InGroup<DeprecatedThisCapture>;
8458  def note_deprecated_this_capture : Note<
8459    "add an explicit capture of 'this' to capture '*this' by reference">;
8460
8461  // C++20 default constructible / assignable lambdas.
8462  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
8463    "%select{default construction|assignment}0 of lambda is incompatible with "
8464    "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8465
8466  // C++20 class template argument deduction for alias templates.
8467  def warn_cxx17_compat_ctad_for_alias_templates : Warning<
8468  "class template argument deduction for alias templates is incompatible with "
8469  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8470}
8471
8472def err_return_in_captured_stmt : Error<
8473  "cannot return from %0">;
8474def err_capture_block_variable : Error<
8475  "__block variable %0 cannot be captured in a "
8476  "%select{lambda expression|captured statement}1">;
8477
8478def err_operator_arrow_circular : Error<
8479  "circular pointer delegation detected">;
8480def err_operator_arrow_depth_exceeded : Error<
8481  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
8482  "'operator->' calls">;
8483def note_operator_arrow_here : Note<
8484  "'operator->' declared here produces an object of type %0">;
8485def note_operator_arrows_suppressed : Note<
8486  "(skipping %0 'operator->'%s0 in backtrace)">;
8487def note_operator_arrow_depth : Note<
8488  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
8489
8490def err_pseudo_dtor_base_not_scalar : Error<
8491  "object expression of non-scalar type %0 cannot be used in a "
8492  "pseudo-destructor expression">;
8493def ext_pseudo_dtor_on_void : ExtWarn<
8494  "pseudo-destructors on type void are a Microsoft extension">,
8495  InGroup<MicrosoftVoidPseudoDtor>;
8496def err_pseudo_dtor_type_mismatch : Error<
8497  "the type of object expression "
8498  "%diff{($) does not match the type being destroyed ($)|"
8499  "does not match the type being destroyed}0,1 "
8500  "in pseudo-destructor expression">;
8501def err_pseudo_dtor_call_with_args : Error<
8502  "call to pseudo-destructor cannot have any arguments">;
8503def err_dtor_expr_without_call : Error<
8504  "reference to %select{destructor|pseudo-destructor}0 must be called"
8505  "%select{|; did you mean to call it with no arguments?}1">;
8506def err_pseudo_dtor_destructor_non_type : Error<
8507  "%0 does not refer to a type name in pseudo-destructor expression; expected "
8508  "the name of type %1">;
8509def err_invalid_use_of_function_type : Error<
8510  "a function type is not allowed here">;
8511def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
8512def err_typecheck_bool_condition : Error<
8513  "value of type %0 is not contextually convertible to 'bool'">;
8514def err_typecheck_ambiguous_condition : Error<
8515  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
8516def err_typecheck_nonviable_condition : Error<
8517  "no viable conversion%select{%diff{ from $ to $|}1,2|"
8518  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
8519def err_typecheck_nonviable_condition_incomplete : Error<
8520  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
8521def err_typecheck_deleted_function : Error<
8522  "conversion function %diff{from $ to $|between types}0,1 "
8523  "invokes a deleted function%select{|: %3}2">;
8524
8525def err_expected_class_or_namespace : Error<"%0 is not a class"
8526  "%select{ or namespace|, namespace, or enumeration}1">;
8527def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
8528  "because namespace %1 does not enclose namespace %2">;
8529def err_export_non_namespace_scope_name : Error<
8530  "cannot export %0 as it is not at namespace scope">;
8531def err_redeclaration_non_exported : Error <
8532  "cannot export redeclaration %0 here since the previous declaration "
8533  "%select{is not exported|has internal linkage|has module linkage}1">;
8534def err_invalid_declarator_global_scope : Error<
8535  "definition or redeclaration of %0 cannot name the global scope">;
8536def err_invalid_declarator_in_function : Error<
8537  "definition or redeclaration of %0 not allowed inside a function">;
8538def err_invalid_declarator_in_block : Error<
8539  "definition or redeclaration of %0 not allowed inside a block">;
8540def err_not_tag_in_scope : Error<
8541  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
8542def ext_template_after_declarative_nns : ExtWarn<
8543    "'template' cannot be used after a declarative nested name specifier">,
8544    InGroup<DiagGroup<"template-in-declaration-name">>;
8545def ext_alias_template_in_declarative_nns : ExtWarn<
8546  "a declarative nested name specifier cannot name an alias template">,
8547  InGroup<DiagGroup<"alias-template-in-declaration-name">>;
8548def err_computed_type_in_declarative_nns  : Error<
8549  "a %select{pack indexing|'decltype'}0 specifier cannot be used in "
8550  "a declarative nested name specifier">;
8551
8552def err_no_typeid_with_fno_rtti : Error<
8553  "use of typeid requires -frtti">;
8554def err_no_dynamic_cast_with_fno_rtti : Error<
8555  "use of dynamic_cast requires -frtti">;
8556def warn_no_dynamic_cast_with_rtti_disabled: Warning<
8557  "dynamic_cast will not work since RTTI data is disabled by "
8558  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8559def warn_no_typeid_with_rtti_disabled: Warning<
8560  "typeid will not work since RTTI data is disabled by "
8561  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8562
8563def err_cannot_form_pointer_to_member_of_reference_type : Error<
8564  "cannot form a pointer-to-member to member %0 of reference type %1">;
8565def err_incomplete_object_call : Error<
8566  "incomplete type in call to object of type %0">;
8567
8568def warn_condition_is_assignment : Warning<"using the result of an "
8569  "assignment as a condition without parentheses">,
8570  InGroup<Parentheses>;
8571def warn_free_nonheap_object
8572  : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
8573    InGroup<FreeNonHeapObject>;
8574
8575// Completely identical except off by default.
8576def warn_condition_is_idiomatic_assignment : Warning<"using the result "
8577  "of an assignment as a condition without parentheses">,
8578  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
8579def note_condition_assign_to_comparison : Note<
8580  "use '==' to turn this assignment into an equality comparison">;
8581def note_condition_or_assign_to_comparison : Note<
8582  "use '!=' to turn this compound assignment into an inequality comparison">;
8583def note_condition_assign_silence : Note<
8584  "place parentheses around the assignment to silence this warning">;
8585
8586def warn_equality_with_extra_parens : Warning<"equality comparison with "
8587  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
8588def note_equality_comparison_to_assign : Note<
8589  "use '=' to turn this equality comparison into an assignment">;
8590def note_equality_comparison_silence : Note<
8591  "remove extraneous parentheses around the comparison to silence this warning">;
8592
8593// assignment related diagnostics (also for argument passing, returning, etc).
8594// In most of these diagnostics the %2 is a value from the
8595// Sema::AssignmentAction enumeration
8596def err_typecheck_convert_incompatible : Error<
8597  "%select{%diff{assigning to $ from incompatible type $|"
8598  "assigning to type from incompatible type}0,1"
8599  "|%diff{passing $ to parameter of incompatible type $|"
8600  "passing type to parameter of incompatible type}0,1"
8601  "|%diff{returning $ from a function with incompatible result type $|"
8602  "returning type from a function with incompatible result type}0,1"
8603  "|%diff{converting $ to incompatible type $|"
8604  "converting type to incompatible type}0,1"
8605  "|%diff{initializing $ with an expression of incompatible type $|"
8606  "initializing type with an expression of incompatible type}0,1"
8607  "|%diff{sending $ to parameter of incompatible type $|"
8608  "sending type to parameter of incompatible type}0,1"
8609  "|%diff{casting $ to incompatible type $|"
8610  "casting type to incompatible type}0,1}2"
8611  "%select{|; dereference with *|"
8612  "; take the address with &|"
8613  "; remove *|"
8614  "; remove &}3"
8615  "%select{|: different classes%diff{ ($ vs $)|}5,6"
8616  "|: different number of parameters (%5 vs %6)"
8617  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
8618  "|: different return type%diff{ ($ vs $)|}5,6"
8619  "|: different qualifiers (%5 vs %6)"
8620  "|: different exception specifications}4">;
8621def err_typecheck_missing_return_type_incompatible : Error<
8622  "%diff{return type $ must match previous return type $|"
8623  "return type must match previous return type}0,1 when %select{block "
8624  "literal|lambda expression}2 has unspecified explicit return type">;
8625
8626def note_incomplete_class_and_qualified_id : Note<
8627  "conformance of forward class %0 to protocol %1 cannot be confirmed">;
8628def warn_incompatible_qualified_id : Warning<
8629  "%select{%diff{assigning to $ from incompatible type $|"
8630  "assigning to type from incompatible type}0,1"
8631  "|%diff{passing $ to parameter of incompatible type $|"
8632  "passing type to parameter of incompatible type}0,1"
8633  "|%diff{returning $ from a function with incompatible result type $|"
8634  "returning type from a function with incompatible result type}0,1"
8635  "|%diff{converting $ to incompatible type $|"
8636  "converting type to incompatible type}0,1"
8637  "|%diff{initializing $ with an expression of incompatible type $|"
8638  "initializing type with an expression of incompatible type}0,1"
8639  "|%diff{sending $ to parameter of incompatible type $|"
8640  "sending type to parameter of incompatible type}0,1"
8641  "|%diff{casting $ to incompatible type $|"
8642  "casting type to incompatible type}0,1}2">;
8643def err_incompatible_qualified_id : Error<
8644  "%select{%diff{assigning to $ from incompatible type $|"
8645  "assigning to type from incompatible type}0,1"
8646  "|%diff{passing $ to parameter of incompatible type $|"
8647  "passing type to parameter of incompatible type}0,1"
8648  "|%diff{returning $ from a function with incompatible result type $|"
8649  "returning type from a function with incompatible result type}0,1"
8650  "|%diff{converting $ to incompatible type $|"
8651  "converting type to incompatible type}0,1"
8652  "|%diff{initializing $ with an expression of incompatible type $|"
8653  "initializing type with an expression of incompatible type}0,1"
8654  "|%diff{sending $ to parameter of incompatible type $|"
8655  "sending type to parameter of incompatible type}0,1"
8656  "|%diff{casting $ to incompatible type $|"
8657  "casting type to incompatible type}0,1}2">;
8658def err_typecheck_convert_pointer_int : Error<
8659  "incompatible pointer to integer conversion "
8660  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8661  "|%diff{passing $ to parameter of type $|"
8662  "passing to parameter of different type}0,1"
8663  "|%diff{returning $ from a function with result type $|"
8664  "returning from function with different return type}0,1"
8665  "|%diff{converting $ to type $|converting between types}0,1"
8666  "|%diff{initializing $ with an expression of type $|"
8667  "initializing with expression of different type}0,1"
8668  "|%diff{sending $ to parameter of type $|"
8669  "sending to parameter of different type}0,1"
8670  "|%diff{casting $ to type $|casting between types}0,1}2"
8671  "%select{|; dereference with *|"
8672  "; take the address with &|"
8673  "; remove *|"
8674  "; remove &}3">;
8675def ext_typecheck_convert_pointer_int : ExtWarn<
8676  err_typecheck_convert_pointer_int.Summary>,
8677  InGroup<IntConversion>, DefaultError;
8678def err_typecheck_convert_int_pointer : Error<
8679  "incompatible integer to pointer conversion "
8680  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8681  "|%diff{passing $ to parameter of type $|"
8682  "passing to parameter of different type}0,1"
8683  "|%diff{returning $ from a function with result type $|"
8684  "returning from function with different return type}0,1"
8685  "|%diff{converting $ to type $|converting between types}0,1"
8686  "|%diff{initializing $ with an expression of type $|"
8687  "initializing with expression of different type}0,1"
8688  "|%diff{sending $ to parameter of type $|"
8689  "sending to parameter of different type}0,1"
8690  "|%diff{casting $ to type $|casting between types}0,1}2"
8691  "%select{|; dereference with *|"
8692  "; take the address with &|"
8693  "; remove *|"
8694  "; remove &}3">;
8695def ext_typecheck_convert_int_pointer : ExtWarn<
8696  err_typecheck_convert_int_pointer.Summary>,
8697  InGroup<IntConversion>, DefaultError;
8698def ext_typecheck_convert_pointer_void_func : Extension<
8699  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8700  "|%diff{passing $ to parameter of type $|"
8701  "passing to parameter of different type}0,1"
8702  "|%diff{returning $ from a function with result type $|"
8703  "returning from function with different return type}0,1"
8704  "|%diff{converting $ to type $|converting between types}0,1"
8705  "|%diff{initializing $ with an expression of type $|"
8706  "initializing with expression of different type}0,1"
8707  "|%diff{sending $ to parameter of type $|"
8708  "sending to parameter of different type}0,1"
8709  "|%diff{casting $ to type $|casting between types}0,1}2"
8710  " converts between void pointer and function pointer">;
8711def err_typecheck_convert_pointer_void_func : Error<
8712  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8713  "|%diff{passing $ to parameter of type $|"
8714  "passing to parameter of different type}0,1"
8715  "|%diff{returning $ from a function with result type $|"
8716  "returning from function with different return type}0,1"
8717  "|%diff{converting $ to type $|converting between types}0,1"
8718  "|%diff{initializing $ with an expression of type $|"
8719  "initializing with expression of different type}0,1"
8720  "|%diff{sending $ to parameter of type $|"
8721  "sending to parameter of different type}0,1"
8722  "|%diff{casting $ to type $|casting between types}0,1}2"
8723  " converts between void pointer and function pointer">;
8724def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
8725  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8726  "|%diff{passing $ to parameter of type $|"
8727  "passing to parameter of different type}0,1"
8728  "|%diff{returning $ from a function with result type $|"
8729  "returning from function with different return type}0,1"
8730  "|%diff{converting $ to type $|converting between types}0,1"
8731  "|%diff{initializing $ with an expression of type $|"
8732  "initializing with expression of different type}0,1"
8733  "|%diff{sending $ to parameter of type $|"
8734  "sending to parameter of different type}0,1"
8735  "|%diff{casting $ to type $|casting between types}0,1}2"
8736  " converts between pointers to integer types %select{with different sign|"
8737  "where one is of the unique plain 'char' type and the other is not}3">,
8738  InGroup<DiagGroup<"pointer-sign">>;
8739def err_typecheck_convert_incompatible_pointer_sign :
8740  Error<ext_typecheck_convert_incompatible_pointer_sign.Summary>;
8741def ext_typecheck_convert_incompatible_pointer : ExtWarn<
8742  "incompatible pointer types "
8743  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8744  "|%diff{passing $ to parameter of type $|"
8745  "passing to parameter of different type}0,1"
8746  "|%diff{returning $ from a function with result type $|"
8747  "returning from function with different return type}0,1"
8748  "|%diff{converting $ to type $|converting between types}0,1"
8749  "|%diff{initializing $ with an expression of type $|"
8750  "initializing with expression of different type}0,1"
8751  "|%diff{sending $ to parameter of type $|"
8752  "sending to parameter of different type}0,1"
8753  "|%diff{casting $ to type $|casting between types}0,1}2"
8754  "%select{|; dereference with *|"
8755  "; take the address with &|"
8756  "; remove *|"
8757  "; remove &}3">,
8758  InGroup<IncompatiblePointerTypes>;
8759def err_typecheck_convert_incompatible_pointer : Error<
8760  "incompatible pointer types "
8761  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8762  "|%diff{passing $ to parameter of type $|"
8763  "passing to parameter of different type}0,1"
8764  "|%diff{returning $ from a function with result type $|"
8765  "returning from function with different return type}0,1"
8766  "|%diff{converting $ to type $|converting between types}0,1"
8767  "|%diff{initializing $ with an expression of type $|"
8768  "initializing with expression of different type}0,1"
8769  "|%diff{sending $ to parameter of type $|"
8770  "sending to parameter of different type}0,1"
8771  "|%diff{casting $ to type $|casting between types}0,1}2"
8772  "%select{|; dereference with *|"
8773  "; take the address with &|"
8774  "; remove *|"
8775  "; remove &}3">;
8776def err_typecheck_convert_incompatible_function_pointer : Error<
8777  "incompatible function pointer types "
8778  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8779  "|%diff{passing $ to parameter of type $|"
8780  "passing to parameter of different type}0,1"
8781  "|%diff{returning $ from a function with result type $|"
8782  "returning from function with different return type}0,1"
8783  "|%diff{converting $ to type $|converting between types}0,1"
8784  "|%diff{initializing $ with an expression of type $|"
8785  "initializing with expression of different type}0,1"
8786  "|%diff{sending $ to parameter of type $|"
8787  "sending to parameter of different type}0,1"
8788  "|%diff{casting $ to type $|casting between types}0,1}2"
8789  "%select{|; dereference with *|"
8790  "; take the address with &|"
8791  "; remove *|"
8792  "; remove &}3">;
8793def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
8794  err_typecheck_convert_incompatible_function_pointer.Summary>,
8795  InGroup<IncompatibleFunctionPointerTypes>, DefaultError;
8796def warn_typecheck_convert_incompatible_function_pointer_strict : Warning<
8797  err_typecheck_convert_incompatible_function_pointer.Summary>,
8798  InGroup<DiagGroup<"incompatible-function-pointer-types-strict">>, DefaultIgnore;
8799def ext_typecheck_convert_discards_qualifiers : ExtWarn<
8800  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8801  "|%diff{passing $ to parameter of type $|"
8802  "passing to parameter of different type}0,1"
8803  "|%diff{returning $ from a function with result type $|"
8804  "returning from function with different return type}0,1"
8805  "|%diff{converting $ to type $|converting between types}0,1"
8806  "|%diff{initializing $ with an expression of type $|"
8807  "initializing with expression of different type}0,1"
8808  "|%diff{sending $ to parameter of type $|"
8809  "sending to parameter of different type}0,1"
8810  "|%diff{casting $ to type $|casting between types}0,1}2"
8811  " discards qualifiers">,
8812  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8813def err_typecheck_convert_discards_qualifiers : Error<
8814  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8815  "|%diff{passing $ to parameter of type $|"
8816  "passing to parameter of different type}0,1"
8817  "|%diff{returning $ from a function with result type $|"
8818  "returning from function with different return type}0,1"
8819  "|%diff{converting $ to type $|converting between types}0,1"
8820  "|%diff{initializing $ with an expression of type $|"
8821  "initializing with expression of different type}0,1"
8822  "|%diff{sending $ to parameter of type $|"
8823  "sending to parameter of different type}0,1"
8824  "|%diff{casting $ to type $|casting between types}0,1}2"
8825  " discards qualifiers">;
8826def ext_nested_pointer_qualifier_mismatch : ExtWarn<
8827  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8828  "|%diff{passing $ to parameter of type $|"
8829  "passing to parameter of different type}0,1"
8830  "|%diff{returning $ from a function with result type $|"
8831  "returning from function with different return type}0,1"
8832  "|%diff{converting $ to type $|converting between types}0,1"
8833  "|%diff{initializing $ with an expression of type $|"
8834  "initializing with expression of different type}0,1"
8835  "|%diff{sending $ to parameter of type $|"
8836  "sending to parameter of different type}0,1"
8837  "|%diff{casting $ to type $|casting between types}0,1}2"
8838  " discards qualifiers in nested pointer types">,
8839  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8840def err_nested_pointer_qualifier_mismatch : Error<
8841  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8842  "|%diff{passing $ to parameter of type $|"
8843  "passing to parameter of different type}0,1"
8844  "|%diff{returning $ from a function with result type $|"
8845  "returning from function with different return type}0,1"
8846  "|%diff{converting $ to type $|converting between types}0,1"
8847  "|%diff{initializing $ with an expression of type $|"
8848  "initializing with expression of different type}0,1"
8849  "|%diff{sending $ to parameter of type $|"
8850  "sending to parameter of different type}0,1"
8851  "|%diff{casting $ to type $|casting between types}0,1}2"
8852  " discards qualifiers in nested pointer types">;
8853def warn_incompatible_vectors : Warning<
8854  "incompatible vector types "
8855  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8856  "|%diff{passing $ to parameter of type $|"
8857  "passing to parameter of different type}0,1"
8858  "|%diff{returning $ from a function with result type $|"
8859  "returning from function with different return type}0,1"
8860  "|%diff{converting $ to type $|converting between types}0,1"
8861  "|%diff{initializing $ with an expression of type $|"
8862  "initializing with expression of different type}0,1"
8863  "|%diff{sending $ to parameter of type $|"
8864  "sending to parameter of different type}0,1"
8865  "|%diff{casting $ to type $|casting between types}0,1}2">,
8866  InGroup<VectorConversion>, DefaultIgnore;
8867def err_incompatible_vectors : Error<
8868  "incompatible vector types "
8869  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8870  "|%diff{passing $ to parameter of type $|"
8871  "passing to parameter of different type}0,1"
8872  "|%diff{returning $ from a function with result type $|"
8873  "returning from function with different return type}0,1"
8874  "|%diff{converting $ to type $|converting between types}0,1"
8875  "|%diff{initializing $ with an expression of type $|"
8876  "initializing with expression of different type}0,1"
8877  "|%diff{sending $ to parameter of type $|"
8878  "sending to parameter of different type}0,1"
8879  "|%diff{casting $ to type $|casting between types}0,1}2">;
8880def err_int_to_block_pointer : Error<
8881  "invalid block pointer conversion "
8882  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8883  "|%diff{passing $ to parameter of type $|"
8884  "passing to parameter of different type}0,1"
8885  "|%diff{returning $ from a function with result type $|"
8886  "returning from function with different return type}0,1"
8887  "|%diff{converting $ to type $|converting between types}0,1"
8888  "|%diff{initializing $ with an expression of type $|"
8889  "initializing with expression of different type}0,1"
8890  "|%diff{sending $ to parameter of type $|"
8891  "sending to parameter of different type}0,1"
8892  "|%diff{casting $ to type $|casting between types}0,1}2">;
8893def err_typecheck_convert_incompatible_block_pointer : Error<
8894  "incompatible block pointer types "
8895  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8896  "|%diff{passing $ to parameter of type $|"
8897  "passing to parameter of different type}0,1"
8898  "|%diff{returning $ from a function with result type $|"
8899  "returning from function with different return type}0,1"
8900  "|%diff{converting $ to type $|converting between types}0,1"
8901  "|%diff{initializing $ with an expression of type $|"
8902  "initializing with expression of different type}0,1"
8903  "|%diff{sending $ to parameter of type $|"
8904  "sending to parameter of different type}0,1"
8905  "|%diff{casting $ to type $|casting between types}0,1}2">;
8906def err_typecheck_incompatible_address_space : Error<
8907  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8908  "|%diff{passing $ to parameter of type $|"
8909  "passing to parameter of different type}0,1"
8910  "|%diff{returning $ from a function with result type $|"
8911  "returning from function with different return type}0,1"
8912  "|%diff{converting $ to type $|converting between types}0,1"
8913  "|%diff{initializing $ with an expression of type $|"
8914  "initializing with expression of different type}0,1"
8915  "|%diff{sending $ to parameter of type $|"
8916  "sending to parameter of different type}0,1"
8917  "|%diff{casting $ to type $|casting between types}0,1}2"
8918  " changes address space of pointer">;
8919def err_typecheck_incompatible_nested_address_space : Error<
8920  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8921  "|%diff{passing $ to parameter of type $|"
8922  "passing to parameter of different type}0,1"
8923  "|%diff{returning $ from a function with result type $|"
8924  "returning from function with different return type}0,1"
8925  "|%diff{converting $ to type $|converting between types}0,1"
8926  "|%diff{initializing $ with an expression of type $|"
8927  "initializing with expression of different type}0,1"
8928  "|%diff{sending $ to parameter of type $|"
8929  "sending to parameter of different type}0,1"
8930  "|%diff{casting $ to type $|casting between types}0,1}2"
8931  " changes address space of nested pointer">;
8932def err_typecheck_incompatible_ownership : Error<
8933  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8934  "|%diff{passing $ to parameter of type $|"
8935  "passing to parameter of different type}0,1"
8936  "|%diff{returning $ from a function with result type $|"
8937  "returning from function with different return type}0,1"
8938  "|%diff{converting $ to type $|converting between types}0,1"
8939  "|%diff{initializing $ with an expression of type $|"
8940  "initializing with expression of different type}0,1"
8941  "|%diff{sending $ to parameter of type $|"
8942  "sending to parameter of different type}0,1"
8943  "|%diff{casting $ to type $|casting between types}0,1}2"
8944  " changes retain/release properties of pointer">;
8945def err_typecheck_comparison_of_distinct_blocks : Error<
8946  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
8947
8948def err_typecheck_array_not_modifiable_lvalue : Error<
8949  "array type %0 is not assignable">;
8950def err_typecheck_non_object_not_modifiable_lvalue : Error<
8951  "non-object type %0 is not assignable">;
8952def err_typecheck_expression_not_modifiable_lvalue : Error<
8953  "expression is not assignable">;
8954def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
8955  "incomplete type %0 is not assignable">;
8956def err_typecheck_lvalue_casts_not_supported : Error<
8957  "assignment to cast is illegal, lvalue casts are not supported">;
8958
8959def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
8960  "vector is not assignable (contains duplicate components)">;
8961def err_block_decl_ref_not_modifiable_lvalue : Error<
8962  "variable is not assignable (missing __block type specifier)">;
8963def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8964  "cannot assign to a variable captured by copy in a non-mutable lambda">;
8965def err_typecheck_call_not_function : Error<
8966  "called object type %0 is not a function or function pointer">;
8967def err_call_incomplete_return : Error<
8968  "calling function with incomplete return type %0">;
8969def err_call_function_incomplete_return : Error<
8970  "calling %0 with incomplete return type %1">;
8971def err_call_incomplete_argument : Error<
8972  "argument type %0 is incomplete">;
8973def err_typecheck_call_too_few_args : Error<
8974  "too few %select{|||execution configuration }0"
8975  "%select{|non-object }3arguments to "
8976  "%select{function|block|method|kernel function}0 call, "
8977  "expected %1, have %2">;
8978def err_typecheck_call_too_few_args_one : Error<
8979  "too few %select{|||execution configuration }0"
8980  "%select{|non-object }2arguments to "
8981  "%select{function|block|method|kernel function}0 call, "
8982  "single argument %1 was not specified">;
8983def err_typecheck_call_too_few_args_at_least : Error<
8984  "too few %select{|||execution configuration }0"
8985  "%select{|non-object }3arguments to "
8986  "%select{function|block|method|kernel function}0 call, "
8987  "expected at least %1, have %2">;
8988def err_typecheck_call_too_few_args_at_least_one : Error<
8989  "too few %select{|||execution configuration }0"
8990  "%select{|non-object }2arguments to "
8991  "%select{function|block|method|kernel function}0 call, "
8992  "at least argument %1 must be specified">;
8993def err_typecheck_call_too_few_args_suggest : Error<
8994  "too few %select{|||execution configuration }0"
8995  "%select{|non-object }3arguments to "
8996  "%select{function|block|method|kernel function}0 call, "
8997  "expected %1, have %2; did you mean %4?">;
8998def err_typecheck_call_too_few_args_at_least_suggest : Error<
8999  "too few %select{|||execution configuration }0"
9000  "%select{|non-object }3arguments to "
9001  "%select{function|block|method|kernel function}0 call, "
9002  "expected at least %1, have %2; did you mean %4?">;
9003def err_typecheck_call_too_many_args : Error<
9004  "too many %select{|||execution configuration }0"
9005  "%select{|non-object }3arguments to "
9006  "%select{function|block|method|kernel function}0 call, "
9007  "expected %1, have %2">;
9008def err_typecheck_call_too_many_args_one : Error<
9009  "too many %select{|||execution configuration }0"
9010  "%select{|non-object }3arguments to "
9011  "%select{function|block|method|kernel function}0 call, "
9012  "expected single argument %1, have %2 arguments">;
9013def err_typecheck_call_too_many_args_at_most : Error<
9014  "too many %select{|||execution configuration }0"
9015  "%select{|non-object }3arguments to "
9016  "%select{function|block|method|kernel function}0 call, "
9017  "expected at most %1, have %2">;
9018def err_typecheck_call_too_many_args_at_most_one : Error<
9019  "too many %select{|||execution configuration }0arguments to "
9020  "%select{function|block|method|kernel function}0 call, "
9021  "expected at most single %select{|non-object }3argument %1, "
9022  "have %2%select{|non-object}3 arguments">;
9023def err_typecheck_call_too_many_args_suggest : Error<
9024  "too many %select{|||execution configuration }0"
9025  "%select{|non-object }3arguments to "
9026  "%select{function|block|method|kernel function}0 call, "
9027  "expected %1, have %2; did you mean %4?">;
9028def err_typecheck_call_too_many_args_at_most_suggest : Error<
9029  "too many %select{|||execution configuration }0"
9030  "%select{|non-object }3arguments to "
9031  "%select{function|block|method|kernel function}0 call, "
9032  "expected at most %1, have %2; did you mean %4?">;
9033
9034def err_arc_typecheck_convert_incompatible_pointer : Error<
9035  "incompatible pointer types passing retainable parameter of type %0"
9036  "to a CF function expecting %1 type">;
9037
9038def err_builtin_fn_use : Error<"builtin functions must be directly called">;
9039
9040def warn_call_wrong_number_of_arguments : Warning<
9041  "too %select{few|many}0 arguments in call to %1">;
9042
9043def err_atomic_builtin_must_be_pointer : Error<
9044  "address argument to atomic builtin must be a pointer %select{|to a non-zero-sized object }1(%0 invalid)">;
9045
9046def err_atomic_builtin_must_be_pointer_intptr : Error<
9047  "address argument to atomic builtin must be a pointer to integer or pointer"
9048  " (%0 invalid)">;
9049def err_atomic_builtin_cannot_be_const : Error<
9050  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
9051def err_atomic_builtin_must_be_pointer_intfltptr : Error<
9052  "address argument to atomic builtin must be a pointer to integer,"
9053  " floating-point or pointer (%0 invalid)">;
9054def err_atomic_builtin_pointer_size : Error<
9055  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
9056  "type (%0 invalid)">;
9057def err_atomic_exclusive_builtin_pointer_size : Error<
9058  "address argument to load or store exclusive builtin must be a pointer to"
9059  " 1,2,4 or 8 byte type (%0 invalid)">;
9060def err_atomic_builtin_ext_int_size : Error<
9061  "atomic memory operand must have a power-of-two size">;
9062def err_atomic_builtin_bit_int_prohibit : Error<
9063  "argument to atomic builtin of type '_BitInt' is not supported">;
9064def err_atomic_op_needs_atomic : Error<
9065  "address argument to atomic operation must be a pointer to _Atomic "
9066  "type (%0 invalid)">;
9067def err_atomic_op_needs_non_const_atomic : Error<
9068  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
9069  "type (%1 invalid)">;
9070def err_atomic_op_needs_non_const_pointer : Error<
9071  "address argument to atomic operation must be a pointer to non-const "
9072  "type (%0 invalid)">;
9073def err_atomic_op_needs_trivial_copy : Error<
9074  "address argument to atomic operation must be a pointer to a "
9075  "trivially-copyable type (%0 invalid)">;
9076def err_atomic_op_needs_atomic_int_ptr_or_fp : Error<
9077  "address argument to atomic operation must be a pointer to %select{|atomic }0"
9078  "integer, pointer or supported floating point type (%1 invalid)">;
9079def err_atomic_op_needs_atomic_int_or_ptr : Error<
9080  "address argument to atomic operation must be a pointer to %select{|atomic }0"
9081  "integer or pointer (%1 invalid)">;
9082def err_atomic_op_needs_atomic_int_or_fp : Error<
9083  "address argument to atomic operation must be a pointer to %select{|atomic }0"
9084  "integer or supported floating point type (%1 invalid)">;
9085def err_atomic_op_needs_atomic_int : Error<
9086  "address argument to atomic operation must be a pointer to "
9087  "%select{|atomic }0integer (%1 invalid)">;
9088def warn_atomic_op_has_invalid_memory_order : Warning<
9089  "%select{|success |failure }0memory order argument to atomic operation is invalid">,
9090  InGroup<DiagGroup<"atomic-memory-ordering">>;
9091def err_atomic_op_has_invalid_synch_scope : Error<
9092  "synchronization scope argument to atomic operation is invalid">;
9093def warn_atomic_implicit_seq_cst : Warning<
9094  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
9095  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
9096def err_atomic_unsupported : Error<
9097  "atomic types are not supported in '%0'">;
9098
9099def err_overflow_builtin_must_be_int : Error<
9100  "operand argument to %select{overflow builtin|checked integer operation}0 "
9101  "must be an integer type %select{|other than plain 'char', 'bool', bit-precise, "
9102  "or an enumeration }0(%1 invalid)">;
9103def err_overflow_builtin_must_be_ptr_int : Error<
9104  "result argument to %select{overflow builtin|checked integer operation}0 "
9105  "must be a pointer to a non-const integer type %select{|other than plain 'char', "
9106  "'bool', bit-precise, or an enumeration }0(%1 invalid)">;
9107def err_overflow_builtin_bit_int_max_size : Error<
9108  "__builtin_mul_overflow does not support 'signed _BitInt' operands of more "
9109  "than %0 bits">;
9110def err_expected_struct_pointer_argument : Error<
9111  "expected pointer to struct as %ordinal0 argument to %1, found %2">;
9112def err_expected_callable_argument : Error<
9113  "expected a callable expression as %ordinal0 argument to %1, found %2">;
9114def note_building_builtin_dump_struct_call : Note<
9115  "in call to printing function with arguments '(%0)' while dumping struct">;
9116def err_builtin_verbose_trap_arg : Error<
9117  "argument to __builtin_verbose_trap must %select{be a pointer to a constant string|not contain $}0">;
9118
9119def err_atomic_load_store_uses_lib : Error<
9120  "atomic %select{load|store}0 requires runtime support that is not "
9121  "available for this target">;
9122
9123def err_nontemporal_builtin_must_be_pointer : Error<
9124  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
9125def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
9126  "address argument to nontemporal builtin must be a pointer to integer, float, "
9127  "pointer, or a vector of such types (%0 invalid)">;
9128
9129def err_deleted_function_use : Error<"attempt to use a deleted function%select{|: %1}0">;
9130def err_deleted_inherited_ctor_use : Error<
9131  "constructor inherited by %0 from base class %1 is implicitly deleted">;
9132
9133def note_called_by : Note<"called by %0">;
9134def err_kern_type_not_void_return : Error<
9135  "kernel function type %0 must have void return type">;
9136def err_kern_is_nonstatic_method : Error<
9137  "kernel function %0 must be a free function or static member function">;
9138def err_config_scalar_return : Error<
9139  "CUDA special function '%0' must have scalar return type">;
9140def err_kern_call_not_global_function : Error<
9141  "kernel call to non-global function %0">;
9142def err_global_call_not_config : Error<
9143  "call to global function %0 not configured">;
9144def err_ref_bad_target : Error<
9145  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
9146  "%select{function|variable}1 %2 in %select{__device__|__global__|__host__|__host__ __device__}3 function">;
9147def note_cuda_const_var_unpromoted : Note<
9148  "const variable cannot be emitted on device side due to dynamic initialization">;
9149def note_cuda_host_var : Note<
9150  "host variable declared here">;
9151def err_ref_bad_target_global_initializer : Error<
9152  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
9153  "function %1 in global initializer">;
9154def err_capture_bad_target : Error<
9155  "capture host variable %0 by reference in device or host device lambda function">;
9156def warn_maybe_capture_bad_target_this_ptr : Warning<
9157  "capture host side class data member by this pointer in device or host device lambda function "
9158  "may result in invalid memory access if this pointer is not accessible on device side">,
9159  InGroup<DiagGroup<"gpu-maybe-wrong-side">>;
9160def warn_kern_is_method : Extension<
9161  "kernel function %0 is a member function; this may not be accepted by nvcc">,
9162  InGroup<CudaCompat>;
9163def warn_kern_is_inline : Warning<
9164  "ignored 'inline' attribute on kernel function %0">,
9165  InGroup<CudaCompat>;
9166def err_variadic_device_fn : Error<
9167  "CUDA device code does not support variadic functions">;
9168def err_va_arg_in_device : Error<
9169"CUDA device code does not support va_arg">;
9170def err_alias_not_supported_on_nvptx : Error<"CUDA older than 10.0 does not support .alias">;
9171def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
9172  "constexpr function %0 without __host__ or __device__ attributes cannot "
9173  "overload __device__ function with the same signature; add a __host__ "
9174  "attribute, or build with -fno-cuda-host-device-constexpr">;
9175def note_cuda_conflicting_device_function_declared_here : Note<
9176  "conflicting __device__ function declared here">;
9177def err_cuda_device_exceptions : Error<
9178  "cannot use '%0' in "
9179  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
9180def err_dynamic_var_init : Error<
9181    "dynamic initialization is not supported for "
9182    "__device__, __constant__, __shared__, and __managed__ variables">;
9183def err_shared_var_init : Error<
9184    "initialization is not supported for __shared__ variables">;
9185def err_cuda_vla : Error<
9186    "cannot use variable-length arrays in "
9187    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
9188def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
9189def err_cuda_host_shared : Error<
9190    "__shared__ local variables not allowed in "
9191    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
9192def err_cuda_nonstatic_constdev: Error<"__constant__, __device__, and "
9193    "__managed__ are not allowed on non-static local variables">;
9194def err_cuda_grid_constant_not_allowed : Error<
9195  "__grid_constant__ is only allowed on const-qualified kernel parameters">;
9196def err_cuda_ovl_target : Error<
9197  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
9198  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
9199def note_cuda_ovl_candidate_target_mismatch : Note<
9200    "candidate template ignored: target attributes do not match">;
9201def warn_offload_incompatible_redeclare : Warning<
9202  "target-attribute based function overloads are not supported by NVCC and will be treated as a function redeclaration:"
9203  "new declaration is %select{__device__|__global__|__host__|__host__ __device__}0 function, "
9204  "old declaration is %select{__device__|__global__|__host__|__host__ __device__}1 function">,
9205  InGroup<DiagGroup<"nvcc-compat">>, DefaultIgnore;
9206
9207def err_cuda_device_builtin_surftex_cls_template : Error<
9208    "illegal device builtin %select{surface|texture}0 reference "
9209    "class template %1 declared here">;
9210def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
9211    "%0 needs to have exactly %1 template parameters">;
9212def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
9213    "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
9214    "%select{a type|an integer or enum value}2">;
9215
9216def err_cuda_device_builtin_surftex_ref_decl : Error<
9217    "illegal device builtin %select{surface|texture}0 reference "
9218    "type %1 declared here">;
9219def note_cuda_device_builtin_surftex_should_be_template_class : Note<
9220    "%0 needs to be instantiated from a class template with proper "
9221    "template arguments">;
9222
9223def err_hip_invalid_args_builtin_mangled_name : Error<
9224    "invalid argument: symbol must be a device-side function or global variable">;
9225
9226def warn_hip_omp_target_directives : Warning<
9227  "HIP does not support OpenMP target directives; directive has been ignored">,
9228  InGroup<HIPOpenMPOffloading>, DefaultError;
9229
9230def warn_non_pod_vararg_with_format_string : Warning<
9231  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
9232  "%select{function|block|method|constructor}2; expected type from format "
9233  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
9234// The arguments to this diagnostic should match the warning above.
9235def err_cannot_pass_objc_interface_to_vararg_format : Error<
9236  "cannot pass object with interface type %1 by value to variadic "
9237  "%select{function|block|method|constructor}2; expected type from format "
9238  "string was %3">;
9239def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
9240  "cannot pass non-trivial C object of type %0 by value to variadic "
9241  "%select{function|block|method|constructor}1">;
9242
9243
9244def err_cannot_pass_objc_interface_to_vararg : Error<
9245  "cannot pass object with interface type %0 by value through variadic "
9246  "%select{function|block|method|constructor}1">;
9247def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
9248  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
9249  " %select{function|block|method|constructor}2; call will abort at runtime">,
9250  InGroup<NonPODVarargs>, DefaultError;
9251def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
9252  "passing object of trivial but non-POD type %0 through variadic"
9253  " %select{function|block|method|constructor}1 is incompatible with C++98">,
9254  InGroup<CXX98Compat>, DefaultIgnore;
9255def warn_pass_class_arg_to_vararg : Warning<
9256  "passing object of class type %0 through variadic "
9257  "%select{function|block|method|constructor}1"
9258  "%select{|; did you mean to call '%3'?}2">,
9259  InGroup<ClassVarargs>, DefaultIgnore;
9260def err_cannot_pass_to_vararg : Error<
9261  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
9262  "%select{function|block|method|constructor}2">;
9263def err_cannot_pass_to_vararg_format : Error<
9264  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
9265  "%select{function|block|method|constructor}2; expected type from format "
9266  "string was %3">;
9267
9268def err_typecheck_call_invalid_ordered_compare : Error<
9269  "ordered compare requires two args of floating point type"
9270  "%diff{ ($ and $)|}0,1">;
9271def err_typecheck_call_invalid_unary_fp : Error<
9272  "floating point classification requires argument of floating point type "
9273  "(passed in %0)">;
9274def err_typecheck_cond_expect_int_float : Error<
9275  "used type %0 where integer or floating point type is required">;
9276def err_typecheck_cond_expect_scalar : Error<
9277  "used type %0 where arithmetic or pointer type is required">;
9278def err_typecheck_cond_expect_nonfloat : Error<
9279  "used type %0 where floating point type is not allowed">;
9280def ext_typecheck_cond_one_void : Extension<
9281  "C99 forbids conditional expressions with only one void side">;
9282def err_typecheck_cast_to_incomplete : Error<
9283  "cast to incomplete type %0">;
9284def ext_typecheck_cast_nonscalar : Extension<
9285  "C99 forbids casting nonscalar type %0 to the same type">;
9286def ext_typecheck_cast_to_union : Extension<
9287  "cast to union type is a GNU extension">,
9288  InGroup<GNUUnionCast>;
9289def err_typecheck_cast_to_union_no_type : Error<
9290  "cast to union type from type %0 not present in union">;
9291def err_cast_pointer_from_non_pointer_int : Error<
9292  "operand of type %0 cannot be cast to a pointer type">;
9293def warn_cast_pointer_from_sel : Warning<
9294  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
9295  InGroup<SelTypeCast>;
9296def warn_function_def_in_objc_container : Warning<
9297  "function definition inside an Objective-C container is deprecated">,
9298  InGroup<FunctionDefInObjCContainer>;
9299def err_typecheck_call_requires_real_fp : Error<
9300  "argument type %0 is not a real floating point type">;
9301def err_typecheck_call_different_arg_types : Error<
9302  "arguments are of different types%diff{ ($ vs $)|}0,1">;
9303
9304def warn_cast_calling_conv : Warning<
9305  "cast between incompatible calling conventions '%0' and '%1'; "
9306  "calls through this pointer may abort at runtime">,
9307  InGroup<DiagGroup<"cast-calling-convention">>;
9308def note_change_calling_conv_fixit : Note<
9309  "consider defining %0 with the '%1' calling convention">;
9310def warn_bad_function_cast : Warning<
9311  "cast from function call of type %0 to non-matching type %1">,
9312  InGroup<BadFunctionCast>, DefaultIgnore;
9313def warn_cast_function_type : Warning<
9314  "cast %diff{from $ to $ |}0,1converts to incompatible function type">,
9315  InGroup<CastFunctionTypeMismatch>, DefaultIgnore;
9316def warn_cast_function_type_strict : Warning<warn_cast_function_type.Summary>,
9317  InGroup<CastFunctionTypeStrict>, DefaultIgnore;
9318def err_cast_pointer_to_non_pointer_int : Error<
9319  "pointer cannot be cast to type %0">;
9320def err_nullptr_cast : Error<
9321  "cannot cast an object of type %select{'nullptr_t' to %1|%1 to 'nullptr_t'}0"
9322>;
9323def err_typecheck_expect_scalar_operand : Error<
9324  "operand of type %0 where arithmetic or pointer type is required">;
9325def err_typecheck_cond_incompatible_operands : Error<
9326  "incompatible operand types%diff{ ($ and $)|}0,1">;
9327def err_typecheck_expect_scalar_or_vector : Error<
9328  "invalid operand of type %0 where %1 or "
9329  "a vector of such type is required">;
9330def err_typecheck_expect_any_scalar_or_vector : Error<
9331  "invalid operand of type %0%select{| where a scalar or vector is required}1">;
9332def err_typecheck_expect_flt_or_vector : Error<
9333  "invalid operand of type %0 where floating, complex or "
9334  "a vector of such types is required">;
9335def err_cast_selector_expr : Error<
9336  "cannot type cast @selector expression">;
9337def err_make_signed_integral_only : Error<
9338  "'%select{make_unsigned|make_signed}0' is only compatible with "
9339  "non-%select{bool|_BitInt(1)}1 integers and enum types, but was given "
9340  "%2%select{| whose underlying type is %4}3">;
9341def ext_typecheck_cond_incompatible_pointers : ExtWarn<
9342  "pointer type mismatch%diff{ ($ and $)|}0,1">,
9343  InGroup<DiagGroup<"pointer-type-mismatch">>;
9344def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
9345  "pointer/integer type mismatch in conditional expression"
9346  "%diff{ ($ and $)|}0,1">,
9347  InGroup<DiagGroup<"conditional-type-mismatch">>;
9348def err_typecheck_choose_expr_requires_constant : Error<
9349  "'__builtin_choose_expr' requires a constant expression">;
9350def warn_unused_expr : Warning<"expression result unused">,
9351  InGroup<UnusedValue>;
9352def warn_unused_comma_left_operand : Warning<
9353  "left operand of comma operator has no effect">,
9354  InGroup<UnusedValue>;
9355def warn_unused_voidptr : Warning<
9356  "expression result unused; should this cast be to 'void'?">,
9357  InGroup<UnusedValue>;
9358def warn_unused_property_expr : Warning<
9359 "property access result unused - getters should not be used for side effects">,
9360  InGroup<UnusedGetterReturnValue>;
9361def warn_unused_container_subscript_expr : Warning<
9362 "container access result unused - container access should not be used for side effects">,
9363  InGroup<UnusedValue>;
9364def warn_unused_call : Warning<
9365  "ignoring return value of function declared with %0 attribute">,
9366  InGroup<UnusedValue>;
9367def warn_unused_return_type : Warning<
9368  "ignoring %select{return value|temporary}0 of type %2 declared with %1 attribute%select{|: %4}3">,
9369  InGroup<UnusedValue>;
9370def warn_unused_constructor : Warning<
9371  "ignoring temporary created by a constructor declared with %0 attribute%select{|: %2}1">,
9372  InGroup<UnusedValue>;
9373def warn_side_effects_unevaluated_context : Warning<
9374  "expression with side effects has no effect in an unevaluated context">,
9375  InGroup<UnevaluatedExpression>;
9376def warn_side_effects_typeid : Warning<
9377  "expression with side effects will be evaluated despite being used as an "
9378  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
9379def warn_unused_result : Warning<
9380  "ignoring return value of function declared with %0 attribute%select{|: %2}1">,
9381  InGroup<UnusedResult>;
9382def warn_unused_result_typedef_unsupported_spelling : Warning<
9383  "'[[%select{nodiscard|gnu::warn_unused_result}0]]' attribute ignored when "
9384  "applied to a typedef; consider using '__attribute__((warn_unused_result))' "
9385  "or '[[clang::warn_unused_result]]' instead">, InGroup<IgnoredAttributes>;
9386def warn_unused_volatile : Warning<
9387  "expression result unused; assign into a variable to force a volatile load">,
9388  InGroup<DiagGroup<"unused-volatile-lvalue">>;
9389
9390def ext_cxx14_attr : Extension<
9391  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14Attrs>;
9392def ext_cxx17_attr : Extension<
9393  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17Attrs>;
9394def ext_cxx20_attr : Extension<
9395  "use of the %0 attribute is a C++20 extension">, InGroup<CXX20Attrs>;
9396def ext_cxx23_attr : Extension<
9397  "use of the %0 attribute is a C++23 extension">, InGroup<CXX23Attrs>;
9398
9399def warn_unused_comparison : Warning<
9400  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
9401  InGroup<UnusedComparison>;
9402def note_inequality_comparison_to_or_assign : Note<
9403  "use '|=' to turn this inequality comparison into an or-assignment">;
9404
9405def err_incomplete_type_used_in_type_trait_expr : Error<
9406  "incomplete type %0 used in type trait expression">, NoSFINAE;
9407
9408// C++20 constinit and require_constant_initialization attribute
9409def warn_cxx20_compat_constinit : Warning<
9410  "'constinit' specifier is incompatible with C++ standards before C++20">,
9411  InGroup<CXX20Compat>, DefaultIgnore;
9412def err_constinit_local_variable : Error<
9413  "local variable cannot be declared 'constinit'">;
9414def err_require_constant_init_failed : Error<
9415  "variable does not have a constant initializer">;
9416def note_declared_required_constant_init_here : Note<
9417  "required by %select{'require_constant_initialization' attribute|"
9418  "'constinit' specifier}0 here">;
9419def ext_constinit_missing : ExtWarn<
9420  "'constinit' specifier missing on initializing declaration of %0">,
9421  InGroup<DiagGroup<"missing-constinit">>;
9422def note_constinit_specified_here : Note<"variable declared constinit here">;
9423def err_constinit_added_too_late : Error<
9424  "'constinit' specifier added after initialization of variable">;
9425def warn_require_const_init_added_too_late : Warning<
9426  "'require_constant_initialization' attribute added after initialization "
9427  "of variable">, InGroup<IgnoredAttributes>;
9428def note_constinit_missing_here : Note<
9429  "add the "
9430  "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
9431  "to the initializing declaration here">;
9432
9433def err_dimension_expr_not_constant_integer : Error<
9434  "dimension expression does not evaluate to a constant unsigned int">;
9435
9436def err_typecheck_cond_incompatible_operands_null : Error<
9437  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
9438def ext_empty_struct_union : Extension<
9439  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
9440def ext_no_named_members_in_struct_union : Extension<
9441  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
9442def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
9443  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
9444  InGroup<CXXCompat>, DefaultIgnore;
9445def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
9446  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
9447  InGroup<ExternCCompat>;
9448def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
9449  "volatile qualifiers|const qualifier|volatile qualifier}2">,
9450  InGroup<CastQual>, DefaultIgnore;
9451def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
9452  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
9453def warn_redefine_extname_not_applied : Warning<
9454  "#pragma redefine_extname is applicable to external C declarations only; "
9455  "not applied to %select{function|variable}0 %1">,
9456  InGroup<Pragmas>;
9457} // End of general sema category.
9458
9459// inline asm.
9460let CategoryName = "Inline Assembly Issue" in {
9461  def err_asm_pmf_through_constraint_not_permitted
9462    : Error<"cannot pass a pointer-to-member through register-constrained "
9463            "inline assembly parameter">;
9464  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
9465  def err_asm_invalid_output_constraint : Error<
9466    "invalid output constraint '%0' in asm">;
9467  def err_asm_invalid_lvalue_in_input : Error<
9468    "invalid lvalue in asm input for constraint '%0'">;
9469  def err_asm_invalid_input_constraint : Error<
9470    "invalid input constraint '%0' in asm">;
9471  def err_asm_tying_incompatible_types : Error<
9472    "unsupported inline asm: input with type "
9473    "%diff{$ matching output with type $|}0,1">;
9474  def err_asm_unexpected_constraint_alternatives : Error<
9475    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
9476  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
9477  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
9478  def err_asm_unwind_and_goto : Error<"unwind clobber cannot be used with asm goto">;
9479  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
9480    "global register variables on this target">;
9481  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
9482    "match variable size">;
9483  def err_asm_unsupported_register_type : Error<
9484    "unsupported type for named register variable">;
9485  def err_asm_invalid_input_size : Error<
9486    "invalid input size for constraint '%0'">;
9487  def err_asm_invalid_output_size : Error<
9488    "invalid output size for constraint '%0'">;
9489  def err_invalid_asm_value_for_constraint
9490      : Error <"value '%0' out of range for constraint '%1'">;
9491  def err_asm_non_addr_value_in_memory_constraint : Error <
9492    "reference to a %select{bit-field|vector element|global register variable}0"
9493    " in asm %select{input|output}1 with a memory constraint '%2'">;
9494  def err_asm_input_duplicate_match : Error<
9495    "more than one input constraint matches the same output '%0'">;
9496  def err_store_value_to_reg : Error<
9497    "impossible constraint in asm: cannot store value into a register">;
9498
9499  def warn_asm_label_on_auto_decl : Warning<
9500    "ignored asm label '%0' on automatic variable">;
9501  def warn_invalid_asm_cast_lvalue : Warning<
9502    "invalid use of a cast in an inline asm context requiring an lvalue">,
9503    InGroup<DiagGroup<"invalid-gnu-asm-cast">>, DefaultError;
9504  def warn_asm_mismatched_size_modifier : Warning<
9505    "value size does not match register size specified by the constraint "
9506    "and modifier">,
9507    InGroup<ASMOperandWidths>;
9508
9509  def note_asm_missing_constraint_modifier : Note<
9510    "use constraint modifier \"%0\"">;
9511  def note_asm_input_duplicate_first : Note<
9512    "constraint '%0' is already present here">;
9513 def error_duplicate_asm_operand_name : Error<
9514    "duplicate use of asm operand name \"%0\"">;
9515 def note_duplicate_asm_operand_name : Note<
9516    "asm operand name \"%0\" first referenced here">;
9517}
9518
9519  def error_inoutput_conflict_with_clobber : Error<
9520    "asm-specifier for input or output variable conflicts with asm"
9521    " clobber list">;
9522
9523let CategoryName = "Semantic Issue" in {
9524
9525def err_invalid_conversion_between_matrixes : Error<
9526  "conversion between matrix types%diff{ $ and $|}0,1 of different size is not allowed">;
9527
9528def err_invalid_conversion_between_matrix_and_type : Error<
9529  "conversion between matrix type %0 and incompatible type %1 is not allowed">;
9530
9531def err_invalid_conversion_between_vectors : Error<
9532  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
9533  "size">;
9534def err_invalid_conversion_between_vector_and_integer : Error<
9535  "invalid conversion between vector type %0 and integer type %1 "
9536  "of different size">;
9537
9538def err_opencl_function_pointer : Error<
9539  "%select{pointers|references}0 to functions are not allowed">;
9540
9541def err_opencl_taking_address_capture : Error<
9542  "taking address of a capture is not allowed">;
9543
9544def err_invalid_conversion_between_vector_and_scalar : Error<
9545  "invalid conversion between vector type %0 and scalar type %1">;
9546
9547// C++ member initializers.
9548def err_only_constructors_take_base_inits : Error<
9549  "only constructors take base initializers">;
9550
9551def err_multiple_mem_initialization : Error <
9552  "multiple initializations given for non-static member %0">;
9553def err_multiple_mem_union_initialization : Error <
9554  "initializing multiple members of union">;
9555def err_multiple_base_initialization : Error <
9556  "multiple initializations given for base %0">;
9557
9558def err_mem_init_not_member_or_class : Error<
9559  "member initializer %0 does not name a non-static data member or base "
9560  "class">;
9561
9562def warn_initializer_out_of_order : Warning<
9563  "%select{field|base class}0 %1 will be initialized after "
9564  "%select{field|base}2 %3">,
9565  InGroup<ReorderCtor>, DefaultIgnore;
9566
9567def warn_some_initializers_out_of_order : Warning<
9568  "initializer order does not match the declaration order">,
9569  InGroup<ReorderCtor>, DefaultIgnore;
9570
9571def note_initializer_out_of_order : Note<
9572  "%select{field|base class}0 %1 will be initialized after "
9573  "%select{field|base}2 %3">;
9574
9575def warn_abstract_vbase_init_ignored : Warning<
9576  "initializer for virtual base class %0 of abstract class %1 "
9577  "will never be used">,
9578  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
9579
9580def err_base_init_does_not_name_class : Error<
9581  "constructor initializer %0 does not name a class">;
9582def err_base_init_direct_and_virtual : Error<
9583  "base class initializer %0 names both a direct base class and an "
9584  "inherited virtual base class">;
9585def err_not_direct_base_or_virtual : Error<
9586  "type %0 is not a direct or virtual base of %1">;
9587
9588def err_in_class_initializer_non_const : Error<
9589  "non-const static data member must be initialized out of line">;
9590def err_in_class_initializer_volatile : Error<
9591  "static const volatile data member must be initialized out of line">;
9592def err_in_class_initializer_bad_type : Error<
9593  "static data member of type %0 must be initialized out of line">;
9594def ext_in_class_initializer_float_type : ExtWarn<
9595  "in-class initializer for static data member of type %0 is a GNU extension">,
9596  InGroup<GNUStaticFloatInit>;
9597def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
9598  "in-class initializer for static data member of type %0 requires "
9599  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
9600def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
9601def err_in_class_initializer_literal_type : Error<
9602  "in-class initializer for static data member of type %0 requires "
9603  "'constexpr' specifier">;
9604def err_in_class_initializer_non_constant : Error<
9605  "in-class initializer for static data member is not a constant expression">;
9606def err_default_member_initializer_not_yet_parsed : Error<
9607  "default member initializer for %1 needed within definition of enclosing "
9608  "class %0 outside of member functions">;
9609def note_default_member_initializer_not_yet_parsed : Note<
9610  "default member initializer declared here">;
9611def err_default_member_initializer_cycle
9612    : Error<"default member initializer for %0 uses itself">;
9613
9614def ext_in_class_initializer_non_constant : Extension<
9615  "in-class initializer for static data member is not a constant expression; "
9616  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
9617
9618def err_thread_dynamic_init : Error<
9619  "initializer for thread-local variable must be a constant expression">;
9620def err_thread_nontrivial_dtor : Error<
9621  "type of thread-local variable has non-trivial destruction">;
9622def note_use_thread_local : Note<
9623  "use 'thread_local' to allow this">;
9624
9625// C++ anonymous unions and GNU anonymous structs/unions
9626def ext_anonymous_union : Extension<
9627  "anonymous unions are a C11 extension">, InGroup<C11>;
9628def ext_gnu_anonymous_struct : Extension<
9629  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
9630def ext_c11_anonymous_struct : Extension<
9631  "anonymous structs are a C11 extension">, InGroup<C11>;
9632def err_anonymous_union_not_static : Error<
9633  "anonymous unions at namespace or global scope must be declared 'static'">;
9634def err_anonymous_union_with_storage_spec : Error<
9635  "anonymous union at class scope must not have a storage specifier">;
9636def err_anonymous_struct_not_member : Error<
9637  "anonymous %select{structs|structs and classes}0 must be "
9638  "%select{struct or union|class}0 members">;
9639def err_anonymous_record_member_redecl : Error<
9640  "member of anonymous %select{struct|union}0 redeclares %1">;
9641def err_anonymous_record_with_type : Error<
9642  "types cannot be declared in an anonymous %select{struct|union}0">;
9643def ext_anonymous_record_with_type : Extension<
9644  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
9645  "extension">, InGroup<MicrosoftAnonTag>;
9646def ext_anonymous_record_with_anonymous_type : Extension<
9647  "anonymous types declared in an anonymous %select{struct|union}0 "
9648  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
9649def err_anonymous_record_with_function : Error<
9650  "functions cannot be declared in an anonymous %select{struct|union}0">;
9651def err_anonymous_record_with_static : Error<
9652  "static members cannot be declared in an anonymous %select{struct|union}0">;
9653def err_anonymous_record_bad_member : Error<
9654  "anonymous %select{struct|union}0 can only contain non-static data members">;
9655def err_anonymous_record_nonpublic_member : Error<
9656  "anonymous %select{struct|union}0 cannot contain a "
9657  "%select{private|protected}1 data member">;
9658def ext_ms_anonymous_record : ExtWarn<
9659  "anonymous %select{structs|unions}0 are a Microsoft extension">,
9660  InGroup<MicrosoftAnonTag>;
9661
9662// C++ local classes
9663def err_reference_to_local_in_enclosing_context : Error<
9664  "reference to local %select{variable|binding}1 %0 declared in enclosing "
9665  "%select{%3|block literal|lambda expression|context}2">;
9666def err_capture_binding_openmp : Error<
9667  "capturing a structured binding is not yet supported in OpenMP">;
9668def ext_capture_binding : ExtWarn<
9669  "captured structured bindings are a C++20 extension">, InGroup<CXX20>;
9670def warn_cxx17_compat_capture_binding : Warning<
9671  "captured structured bindings are incompatible with "
9672  "C++ standards before C++20">,
9673  InGroup<CXXPre20Compat>, DefaultIgnore;
9674
9675def err_static_data_member_not_allowed_in_local_class : Error<
9676  "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
9677
9678// C++ derived classes
9679def err_base_clause_on_union : Error<"unions cannot have base classes">;
9680def err_base_must_be_class : Error<"base specifier must name a class">;
9681def err_union_as_base_class : Error<"unions cannot be base classes">;
9682def err_base_class_has_flexible_array_member : Error<
9683  "base class %0 has a flexible array member">;
9684def err_incomplete_base_class : Error<"base class has incomplete type">;
9685def err_duplicate_base_class : Error<
9686  "base class %0 specified more than once as a direct base class">;
9687def warn_inaccessible_base_class : Warning<
9688  "direct base %0 is inaccessible due to ambiguity:%1">,
9689  InGroup<DiagGroup<"inaccessible-base">>;
9690// FIXME: better way to display derivation?  Pass entire thing into diagclient?
9691def err_ambiguous_derived_to_base_conv : Error<
9692  "ambiguous conversion from derived class %0 to base class %1:%2">;
9693def err_ambiguous_memptr_conv : Error<
9694  "ambiguous conversion from pointer to member of %select{base|derived}0 "
9695  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
9696def ext_ms_ambiguous_direct_base : ExtWarn<
9697  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
9698  InGroup<MicrosoftInaccessibleBase>;
9699
9700def err_memptr_conv_via_virtual : Error<
9701  "conversion from pointer to member of class %0 to pointer to member "
9702  "of class %1 via virtual base %2 is not allowed">;
9703
9704// C++ member name lookup
9705def err_ambiguous_member_multiple_subobjects : Error<
9706  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
9707def err_ambiguous_member_multiple_subobject_types : Error<
9708  "member %0 found in multiple base classes of different types">;
9709def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
9710def note_ambiguous_member_type_found : Note<
9711  "member type %0 found by ambiguous name lookup">;
9712def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
9713def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
9714def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
9715  "declaration in a different namespace">;
9716def note_hidden_tag : Note<"type declaration hidden">;
9717def note_hiding_object : Note<"declaration hides type">;
9718
9719// C++ operator overloading
9720def err_operator_overload_needs_class_or_enum : Error<
9721  "overloaded %0 must have at least one parameter of class "
9722  "or enumeration type">;
9723
9724def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
9725def warn_cxx20_compat_operator_overload_static : Warning<
9726  "declaring overloaded %0 as 'static' is incompatible with C++ standards "
9727  "before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
9728def ext_operator_overload_static : ExtWarn<
9729  "declaring overloaded %0 as 'static' is a C++23 extension">, InGroup<CXX23>;
9730def err_operator_overload_static : Error<
9731  "overloaded %0 cannot be a static member function">;
9732def err_operator_overload_default_arg : Error<
9733  "parameter of overloaded %0 cannot have a default argument">;
9734
9735def ext_subscript_overload : Warning<
9736  "overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a "
9737  "C++23 extension">, InGroup<CXXPre23Compat>, DefaultIgnore;
9738def error_subscript_overload : Error<
9739  "overloaded %0 cannot have %select{no|a defaulted|more than one}1 parameter before C++23">;
9740
9741def err_operator_overload_must_be : Error<
9742  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
9743  "(has %1 parameter%s1)">;
9744
9745def err_operator_overload_must_be_member : Error<
9746  "overloaded %0 must be a non-static member function">;
9747def err_operator_overload_post_incdec_must_be_int : Error<
9748  "parameter of overloaded post-%select{increment|decrement}1 operator must "
9749  "have type 'int' (not %0)">;
9750
9751// C++ allocation and deallocation functions.
9752def err_operator_new_delete_declared_in_namespace : Error<
9753  "%0 cannot be declared inside a namespace">;
9754def err_operator_new_delete_declared_static : Error<
9755  "%0 cannot be declared static in global scope">;
9756def ext_operator_new_delete_declared_inline : ExtWarn<
9757  "replacement function %0 cannot be declared 'inline'">,
9758  InGroup<DiagGroup<"inline-new-delete">>;
9759def err_operator_new_delete_invalid_result_type : Error<
9760  "%0 must return type %1">;
9761def err_operator_new_delete_dependent_result_type : Error<
9762  "%0 cannot have a dependent return type; use %1 instead">;
9763def err_operator_new_delete_too_few_parameters : Error<
9764  "%0 must have at least one parameter">;
9765def err_operator_new_delete_template_too_few_parameters : Error<
9766  "%0 template must have at least two parameters">;
9767def warn_operator_new_returns_null : Warning<
9768  "%0 should not return a null pointer unless it is declared 'throw()'"
9769  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
9770
9771def err_operator_new_dependent_param_type : Error<
9772  "%0 cannot take a dependent type as first parameter; "
9773  "use size_t (%1) instead">;
9774def err_operator_new_param_type : Error<
9775  "%0 takes type size_t (%1) as first parameter">;
9776def err_operator_new_default_arg: Error<
9777  "parameter of %0 cannot have a default argument">;
9778def err_operator_delete_dependent_param_type : Error<
9779  "%0 cannot take a dependent type as first parameter; use %1 instead">;
9780def err_operator_delete_param_type : Error<
9781  "first parameter of %0 must have type %1">;
9782def err_destroying_operator_delete_not_usual : Error<
9783  "destroying operator delete can have only an optional size and optional "
9784  "alignment parameter">;
9785def note_implicit_delete_this_in_destructor_here : Note<
9786  "while checking implicit 'delete this' for virtual destructor">;
9787def err_builtin_operator_new_delete_not_usual : Error<
9788  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
9789  "selects non-usual %select{allocation|deallocation}0 function">;
9790def note_non_usual_function_declared_here : Note<
9791  "non-usual %0 declared here">;
9792
9793// C++ literal operators
9794def err_literal_operator_outside_namespace : Error<
9795  "literal operator %0 must be in a namespace or global scope">;
9796def err_literal_operator_id_outside_namespace : Error<
9797  "non-namespace scope '%0' cannot have a literal operator member">;
9798def err_literal_operator_default_argument : Error<
9799  "literal operator cannot have a default argument">;
9800def err_literal_operator_bad_param_count : Error<
9801  "non-template literal operator must have one or two parameters">;
9802def err_literal_operator_invalid_param : Error<
9803  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
9804def err_literal_operator_param : Error<
9805  "invalid literal operator parameter type %0, did you mean %1?">;
9806def err_literal_operator_template_with_params : Error<
9807  "literal operator template cannot have any parameters">;
9808def err_literal_operator_template : Error<
9809  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
9810def err_literal_operator_extern_c : Error<
9811  "literal operator must have C++ linkage">;
9812def ext_string_literal_operator_template : ExtWarn<
9813  "string literal operator templates are a GNU extension">,
9814  InGroup<GNUStringLiteralOperatorTemplate>;
9815def warn_user_literal_reserved : Warning<
9816  "user-defined literal suffixes %select{<ERROR>|not starting with '_'|containing '__'}0 are reserved"
9817  "%select{; no literal will invoke this operator|}1">,
9818  InGroup<UserDefinedLiterals>;
9819
9820// C++ conversion functions
9821def err_conv_function_not_member : Error<
9822  "conversion function must be a non-static member function">;
9823def err_conv_function_return_type : Error<
9824  "conversion function cannot have a return type">;
9825def err_conv_function_with_params : Error<
9826  "conversion function cannot have any parameters">;
9827def err_conv_function_variadic : Error<
9828  "conversion function cannot be variadic">;
9829def err_conv_function_to_array : Error<
9830  "conversion function cannot convert to an array type">;
9831def err_conv_function_to_function : Error<
9832  "conversion function cannot convert to a function type">;
9833def err_conv_function_with_complex_decl : Error<
9834  "cannot specify any part of a return type in the "
9835  "declaration of a conversion function"
9836  "%select{"
9837  "; put the complete type after 'operator'|"
9838  "; use a typedef to declare a conversion to %1|"
9839  "; use an alias template to declare a conversion to %1|"
9840  "}0">;
9841def err_conv_function_redeclared : Error<
9842  "conversion function cannot be redeclared">;
9843def warn_conv_to_self_not_used : Warning<
9844  "conversion function converting %0 to itself will never be used">,
9845  InGroup<ClassConversion>;
9846def warn_conv_to_base_not_used : Warning<
9847  "conversion function converting %0 to its base class %1 will never be used">,
9848  InGroup<ClassConversion>;
9849def warn_conv_to_void_not_used : Warning<
9850  "conversion function converting %0 to %1 will never be used">,
9851  InGroup<ClassConversion>;
9852
9853def warn_not_compound_assign : Warning<
9854  "use of unary operator that may be intended as compound assignment (%0=)">;
9855
9856// C++11 explicit conversion operators
9857def ext_explicit_conversion_functions : ExtWarn<
9858  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
9859def warn_cxx98_compat_explicit_conversion_functions : Warning<
9860  "explicit conversion functions are incompatible with C++98">,
9861  InGroup<CXX98Compat>, DefaultIgnore;
9862
9863// C++11 defaulted functions
9864def err_defaulted_special_member_params : Error<
9865  "an explicitly-defaulted %sub{select_special_member_kind}0 cannot "
9866  "have default arguments">;
9867def err_defaulted_special_member_variadic : Error<
9868  "an explicitly-defaulted %sub{select_special_member_kind}0 cannot "
9869  "be variadic">;
9870def err_defaulted_special_member_return_type : Error<
9871  "explicitly-defaulted %select{copy|move}0 assignment operator must "
9872  "return %1">;
9873def err_defaulted_special_member_quals : Error<
9874  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
9875  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
9876def err_defaulted_special_member_explicit_object_mismatch : Error<
9877  "the type of the explicit object parameter of an explicitly-defaulted "
9878  "%select{copy|move}0 assignment operator should be reference to %1">;
9879def err_defaulted_special_member_volatile_param : Error<
9880  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
9881  "may not be volatile">;
9882def err_defaulted_special_member_move_const_param : Error<
9883  "the parameter for an explicitly-defaulted move "
9884  "%select{constructor|assignment operator}0 may not be const">;
9885def err_defaulted_special_member_copy_const_param : Error<
9886  "the parameter for this explicitly-defaulted copy "
9887  "%select{constructor|assignment operator}0 is const, but a member or base "
9888  "requires it to be non-const">;
9889def err_defaulted_copy_assign_not_ref : Error<
9890  "the parameter for an explicitly-defaulted copy assignment operator must be an "
9891  "lvalue reference type">;
9892def err_incorrect_defaulted_constexpr : Error<
9893  "defaulted definition of %sub{select_special_member_kind}0 cannot be marked %select{constexpr|consteval}1 "
9894  "before C++23">;
9895def err_incorrect_defaulted_constexpr_with_vb: Error<
9896  "%sub{select_special_member_kind}0 cannot be 'constexpr' in a class with virtual base class">;
9897def warn_defaulted_method_deleted : Warning<
9898  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
9899  "deleted">, InGroup<DefaultedFunctionDeleted>;
9900def note_replace_equals_default_to_delete : Note<
9901  "replace 'default' with 'delete'">;
9902def err_out_of_line_default_deletes : Error<
9903  "defaulting this %sub{select_special_member_kind}0 "
9904  "would delete it after its first declaration">;
9905def note_deleted_type_mismatch : Note<
9906  "function is implicitly deleted because its declared type does not match "
9907  "the type of an implicit %sub{select_special_member_kind}0">;
9908def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
9909  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
9910  "different from the implicit type is incompatible with C++ standards before "
9911  "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9912def warn_vbase_moved_multiple_times : Warning<
9913  "defaulted move assignment operator of %0 will move assign virtual base "
9914  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
9915def note_vbase_moved_here : Note<
9916  "%select{%1 is a virtual base class of base class %2 declared here|"
9917  "virtual base class %1 declared here}0">;
9918
9919// C++20 defaulted comparisons
9920// This corresponds to values of Sema::DefaultedComparisonKind.
9921def select_defaulted_comparison_kind : TextSubstitution<
9922  "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
9923  "operator">;
9924def ext_defaulted_comparison : ExtWarn<
9925  "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
9926def warn_cxx17_compat_defaulted_comparison : Warning<
9927  "defaulted comparison operators are incompatible with C++ standards "
9928  "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9929def err_defaulted_comparison_template : Error<
9930  "comparison operator template cannot be defaulted">;
9931def err_defaulted_comparison_num_args : Error<
9932  "%select{non-member|member}0 %sub{select_defaulted_comparison_kind}1"
9933  " must have %select{2|1}0 parameters">;
9934def err_defaulted_comparison_param : Error<
9935  "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
9936  "; found %1, expected %2%select{| or %4}3">;
9937def err_defaulted_comparison_param_unknown : Error<
9938  "invalid parameter type for non-member defaulted"
9939  " %sub{select_defaulted_comparison_kind}0"
9940  "; found %1, expected class or reference to a constant class">;
9941def err_defaulted_comparison_param_mismatch : Error<
9942  "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
9943  "must have the same type%diff{ (found $ vs $)|}1,2">;
9944def err_defaulted_comparison_not_friend : Error<
9945  "%sub{select_defaulted_comparison_kind}0 is not a friend of"
9946  " %select{|incomplete class }1%2">;
9947def err_defaulted_comparison_non_const : Error<
9948  "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
9949  "const-qualified">;
9950def err_defaulted_comparison_return_type_not_bool : Error<
9951  "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9952  "must be 'bool', not %1">;
9953def err_defaulted_comparison_deduced_return_type_not_auto : Error<
9954  "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9955  "must be 'auto', not %1">;
9956def warn_defaulted_comparison_deleted : Warning<
9957  "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
9958  "deleted">, InGroup<DefaultedFunctionDeleted>;
9959def err_non_first_default_compare_deletes : Error<
9960  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
9961  "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
9962  "would delete it after its first declaration">;
9963def err_non_first_default_compare_in_class : Error<
9964  "defaulting this %sub{select_defaulted_comparison_kind}0 "
9965  "is not allowed because it was already declared outside the class">;
9966def note_defaulted_comparison_union : Note<
9967  "defaulted %0 is implicitly deleted because "
9968  "%2 is a %select{union-like class|union}1 with variant members">;
9969def note_defaulted_comparison_reference_member : Note<
9970  "defaulted %0 is implicitly deleted because "
9971  "class %1 has a reference member">;
9972def note_defaulted_comparison_ambiguous : Note<
9973  "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
9974  "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
9975def note_defaulted_comparison_inaccessible : Note<
9976  "defaulted %0 is implicitly deleted because it would invoke a "
9977  "%select{private|protected}3 %4%select{ member of %6|"
9978  " member of %6 to compare member %2| to compare base class %2}1">;
9979def note_defaulted_comparison_calls_deleted : Note<
9980  "defaulted %0 is implicitly deleted because it would invoke a deleted "
9981  "comparison function%select{| for member %2| for base class %2}1">;
9982def note_defaulted_comparison_no_viable_function : Note<
9983  "defaulted %0 is implicitly deleted because there is no viable "
9984  "%select{three-way comparison function|'operator=='}1 for "
9985  "%select{|member |base class }2%3">;
9986def note_defaulted_comparison_no_viable_function_synthesized : Note<
9987  "three-way comparison cannot be synthesized because there is no viable "
9988  "function for %select{'=='|'<'}0 comparison">;
9989def note_defaulted_comparison_not_rewritten_callee : Note<
9990  "defaulted %0 is implicitly deleted because this non-rewritten comparison "
9991  "function would be the best match for the comparison">;
9992def note_defaulted_comparison_not_rewritten_conversion : Note<
9993  "defaulted %0 is implicitly deleted because a builtin comparison function "
9994  "using this conversion would be the best match for the comparison">;
9995def note_defaulted_comparison_cannot_deduce : Note<
9996  "return type of defaulted 'operator<=>' cannot be deduced because "
9997  "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
9998  "is not a standard comparison category type">;
9999def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
10000  "return type of defaulted 'operator<=>' cannot be deduced because "
10001  "three-way comparison for %select{|member|base class}0 %1 "
10002  "has a deduced return type and is not yet defined">;
10003def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
10004  "%select{|member|base class}0 %1 declared here">;
10005def note_defaulted_comparison_cannot_deduce_callee : Note<
10006  "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
10007def err_defaulted_comparison_constexpr_mismatch : Error<
10008  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
10009  "three-way comparison operator}0 cannot be "
10010  "declared %select{constexpr|consteval}2 because "
10011  "%select{it|for which the corresponding implicit 'operator==' }0 "
10012  "invokes a non-constexpr comparison function">;
10013def note_defaulted_comparison_not_constexpr : Note<
10014  "non-constexpr comparison function would be used to compare "
10015  "%select{|member %1|base class %1}0">;
10016def note_defaulted_comparison_not_constexpr_here : Note<
10017  "non-constexpr comparison function declared here">;
10018def note_in_declaration_of_implicit_equality_comparison : Note<
10019  "while declaring the corresponding implicit 'operator==' "
10020  "for this defaulted 'operator<=>'">;
10021def err_volatile_comparison_operator : Error<
10022  "defaulted comparison function must not be volatile">;
10023def err_ref_qualifier_comparison_operator : Error<
10024  "ref-qualifier '&&' is not allowed on a defaulted comparison operator">;
10025
10026def ext_implicit_exception_spec_mismatch : ExtWarn<
10027  "function previously declared with an %select{explicit|implicit}0 exception "
10028  "specification redeclared with an %select{implicit|explicit}0 exception "
10029  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
10030
10031def warn_ptr_arith_precedes_bounds : Warning<
10032  "the pointer decremented by %0 refers before the beginning of the array">,
10033  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
10034def warn_ptr_arith_exceeds_bounds : Warning<
10035  "the pointer incremented by %0 refers past the end of the array (that has type %1)">,
10036  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
10037def warn_array_index_precedes_bounds : Warning<
10038  "array index %0 is before the beginning of the array">,
10039  InGroup<ArrayBounds>;
10040def warn_array_index_exceeds_bounds : Warning<
10041  "array index %0 is past the end of the array (that has type %1%select{|, cast to %3}2)">,
10042  InGroup<ArrayBounds>;
10043def warn_ptr_arith_exceeds_max_addressable_bounds : Warning<
10044  "the pointer incremented by %0 refers past the last possible element for an array in %1-bit "
10045  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
10046  InGroup<ArrayBounds>;
10047def warn_array_index_exceeds_max_addressable_bounds : Warning<
10048  "array index %0 refers past the last possible element for an array in %1-bit "
10049  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
10050  InGroup<ArrayBounds>;
10051def note_array_declared_here : Note<
10052  "array %0 declared here">;
10053
10054def warn_inconsistent_array_form : Warning<
10055  "argument %0 of type %1 with mismatched bound">,
10056  InGroup<ArrayParameter>, DefaultIgnore;
10057def note_previous_declaration_as : Note<
10058  "previously declared as %0 here">;
10059
10060def warn_printf_insufficient_data_args : Warning<
10061  "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
10062def warn_printf_data_arg_not_used : Warning<
10063  "data argument not used by format string">, InGroup<FormatExtraArgs>;
10064def warn_format_invalid_conversion : Warning<
10065  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
10066def warn_printf_incomplete_specifier : Warning<
10067  "incomplete format specifier">, InGroup<Format>;
10068def warn_missing_format_string : Warning<
10069  "format string missing">, InGroup<Format>;
10070def warn_scanf_nonzero_width : Warning<
10071  "zero field width in scanf format string is unused">,
10072  InGroup<Format>;
10073def warn_format_conversion_argument_type_mismatch : Warning<
10074  "format specifies type %0 but the argument has "
10075  "%select{type|underlying type}2 %1">,
10076  InGroup<Format>;
10077def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
10078  warn_format_conversion_argument_type_mismatch.Summary>,
10079  InGroup<FormatPedantic>;
10080def warn_format_conversion_argument_type_mismatch_signedness : Warning<
10081  warn_format_conversion_argument_type_mismatch.Summary>,
10082  InGroup<FormatSignedness>, DefaultIgnore;
10083def warn_format_conversion_argument_type_mismatch_confusion : Warning<
10084  warn_format_conversion_argument_type_mismatch.Summary>,
10085  InGroup<FormatTypeConfusion>, DefaultIgnore;
10086def warn_format_argument_needs_cast : Warning<
10087  "%select{values of type|enum values with underlying type}2 '%0' should not "
10088  "be used as format arguments; add an explicit cast to %1 instead">,
10089  InGroup<Format>;
10090def warn_format_argument_needs_cast_pedantic : Warning<
10091  warn_format_argument_needs_cast.Summary>,
10092  InGroup<FormatPedantic>, DefaultIgnore;
10093def warn_printf_positional_arg_exceeds_data_args : Warning <
10094  "data argument position '%0' exceeds the number of data arguments (%1)">,
10095  InGroup<Format>;
10096def warn_format_zero_positional_specifier : Warning<
10097  "position arguments in format strings start counting at 1 (not 0)">,
10098  InGroup<Format>;
10099def warn_format_invalid_positional_specifier : Warning<
10100  "invalid position specified for %select{field width|field precision}0">,
10101  InGroup<Format>;
10102def warn_format_mix_positional_nonpositional_args : Warning<
10103  "cannot mix positional and non-positional arguments in format string">,
10104  InGroup<Format>;
10105def warn_static_array_too_small : Warning<
10106  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
10107  " callee requires at least %1">,
10108  InGroup<ArrayBounds>;
10109def note_callee_static_array : Note<
10110  "callee declares array parameter as static here">;
10111def warn_empty_format_string : Warning<
10112  "format string is empty">, InGroup<FormatZeroLength>;
10113def warn_format_string_is_wide_literal : Warning<
10114  "format string should not be a wide string">, InGroup<Format>;
10115def warn_printf_format_string_contains_null_char : Warning<
10116  "format string contains '\\0' within the string body">, InGroup<Format>;
10117def warn_printf_format_string_not_null_terminated : Warning<
10118  "format string is not null-terminated">, InGroup<Format>;
10119def warn_printf_asterisk_missing_arg : Warning<
10120  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
10121  InGroup<Format>;
10122def warn_printf_asterisk_wrong_type : Warning<
10123  "field %select{width|precision}0 should have type %1, but argument has type %2">,
10124  InGroup<Format>;
10125def warn_printf_nonsensical_optional_amount: Warning<
10126  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
10127  InGroup<Format>;
10128def warn_printf_nonsensical_flag: Warning<
10129  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
10130  InGroup<Format>;
10131def warn_format_nonsensical_length: Warning<
10132  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
10133  InGroup<Format>;
10134def warn_format_non_standard_positional_arg: Warning<
10135  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
10136def warn_format_non_standard: Warning<
10137  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
10138  InGroup<FormatNonStandard>, DefaultIgnore;
10139def warn_format_non_standard_conversion_spec: Warning<
10140  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
10141  InGroup<FormatNonStandard>, DefaultIgnore;
10142def err_invalid_mask_type_size : Error<
10143  "mask type size must be between 1-byte and 8-bytes">;
10144def warn_format_invalid_annotation : Warning<
10145  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
10146  InGroup<Format>;
10147def warn_format_P_no_precision : Warning<
10148  "using '%%P' format specifier without precision">,
10149  InGroup<Format>;
10150def warn_format_P_with_objc_pointer : Warning<
10151  "using '%%P' format specifier with an Objective-C pointer results in dumping runtime object structure, not object value">,
10152  InGroup<Format>;
10153def warn_printf_ignored_flag: Warning<
10154  "flag '%0' is ignored when flag '%1' is present">,
10155  InGroup<Format>;
10156def warn_printf_empty_objc_flag: Warning<
10157  "missing object format flag">,
10158  InGroup<Format>;
10159def warn_printf_ObjCflags_without_ObjCConversion: Warning<
10160  "object format flags cannot be used with '%0' conversion specifier">,
10161  InGroup<Format>;
10162def warn_printf_invalid_objc_flag: Warning<
10163    "'%0' is not a valid object format flag">,
10164    InGroup<Format>;
10165def warn_printf_narg_not_supported : Warning<
10166    "'%%n' specifier not supported on this platform">,
10167    InGroup<Format>;
10168def warn_scanf_scanlist_incomplete : Warning<
10169  "no closing ']' for '%%[' in scanf format string">,
10170  InGroup<Format>;
10171def warn_format_bool_as_character : Warning<
10172  "using '%0' format specifier, but argument has boolean value">,
10173  InGroup<Format>;
10174def note_format_string_defined : Note<"format string is defined here">;
10175def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
10176def note_printf_c_str: Note<"did you mean to call the %0 method?">;
10177def note_format_security_fixit: Note<
10178  "treat the string as an argument to avoid this">;
10179
10180def warn_null_arg : Warning<
10181  "null passed to a callee that requires a non-null argument">,
10182  InGroup<NonNull>;
10183def warn_null_ret : Warning<
10184  "null returned from %select{function|method}0 that requires a non-null return value">,
10185  InGroup<NonNull>;
10186
10187def err_lifetimebound_no_object_param : Error<
10188  "'lifetimebound' attribute cannot be applied; "
10189  "%select{non-|static |explicit object }0"
10190  "member function has no implicit object parameter">;
10191def err_lifetimebound_ctor_dtor : Error<
10192  "'lifetimebound' attribute cannot be applied to a "
10193  "%select{constructor|destructor}0">;
10194def err_lifetimebound_parameter_void_return_type : Error<
10195  "'lifetimebound' attribute cannot be applied to a parameter of a function "
10196  "that returns void; did you mean 'lifetime_capture_by(X)'">;
10197def err_lifetimebound_implicit_object_parameter_void_return_type : Error<
10198  "'lifetimebound' attribute cannot be applied to an implicit object "
10199  "parameter of a function that returns void; "
10200  "did you mean 'lifetime_capture_by(X)'">;
10201
10202// CHECK: returning address/reference of stack memory
10203def warn_ret_stack_addr_ref : Warning<
10204  "%select{address of|reference to}0 stack memory associated with "
10205  "%select{local variable|parameter|compound literal}2 %1 "
10206  "%select{returned|passed to musttail function}3">,
10207  InGroup<ReturnStackAddress>;
10208def warn_ret_local_temp_addr_ref : Warning<
10209  "returning %select{address of|reference to}0 local temporary object">,
10210  InGroup<ReturnStackAddress>;
10211def warn_musttail_local_temp_addr_ref : Warning<
10212  "passing %select{address of|reference to}0 local temporary object to musttail function">,
10213  InGroup<ReturnStackAddress>;
10214def err_ret_local_temp_ref : Error<
10215  "returning reference to local temporary object">;
10216def warn_ret_addr_label : Warning<
10217  "returning address of label, which is local">,
10218  InGroup<ReturnStackAddress>;
10219def err_ret_local_block : Error<
10220  "returning block that lives on the local stack">;
10221def note_local_var_initializer : Note<
10222  "%select{via initialization of|binding reference}0 variable "
10223  "%select{%2 |}1here">;
10224def note_lambda_capture_initializer : Note<
10225  "%select{implicitly |}2captured%select{| by reference}3"
10226  "%select{%select{ due to use|}2 here|"
10227  " via initialization of lambda capture %0}1">;
10228def note_init_with_default_member_initializer : Note<
10229  "initializing field %0 with default member initializer">;
10230def note_init_with_default_argument : Note<
10231  "initializing parameter %0 with default argument">;
10232
10233// Check for initializing a member variable with the address or a reference to
10234// a constructor parameter.
10235def warn_bind_ref_member_to_parameter : Warning<
10236  "binding reference member %0 to stack allocated "
10237  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
10238def warn_init_ptr_member_to_parameter_addr : Warning<
10239  "initializing pointer member %0 with the stack address of "
10240  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
10241def note_ref_or_ptr_member_declared_here : Note<
10242  "%select{reference|pointer}0 member declared here">;
10243
10244def err_dangling_member : Error<
10245  "%select{reference|backing array for 'std::initializer_list'}2 "
10246  "%select{|subobject of }1member %0 "
10247  "%select{binds to|is}2 a temporary object "
10248  "whose lifetime would be shorter than the lifetime of "
10249  "the constructed object">;
10250def warn_dangling_member : Warning<
10251  "%select{reference|backing array for 'std::initializer_list'}2 "
10252  "%select{|subobject of }1member %0 "
10253  "%select{binds to|is}2 a temporary object "
10254  "whose lifetime is shorter than the lifetime of the constructed object">,
10255  InGroup<DanglingField>;
10256def warn_dangling_lifetime_pointer_member : Warning<
10257  "initializing pointer member %0 to point to a temporary object "
10258  "whose lifetime is shorter than the lifetime of the constructed object">,
10259  InGroup<DanglingGsl>;
10260def note_lifetime_extending_member_declared_here : Note<
10261  "%select{%select{reference|'std::initializer_list'}0 member|"
10262  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
10263  "declared here">;
10264def warn_dangling_variable : Warning<
10265  "%select{temporary %select{whose address is used as value of|"
10266  "%select{|implicitly }2bound to}4 "
10267  "%select{%select{|reference }4member of local variable|"
10268  "local %select{variable|reference}4}1|"
10269  "array backing "
10270  "%select{initializer list subobject of local variable|"
10271  "local initializer list}1}0 "
10272  "%select{%3 |}2will be destroyed at the end of the full-expression">,
10273  InGroup<Dangling>;
10274def warn_new_dangling_reference : Warning<
10275  "temporary bound to reference member of allocated object "
10276  "will be destroyed at the end of the full-expression">,
10277  InGroup<DanglingField>;
10278def warn_dangling_lifetime_pointer : Warning<
10279  "object backing the pointer "
10280  "will be destroyed at the end of the full-expression">,
10281  InGroup<DanglingGsl>;
10282def warn_dangling_lifetime_pointer_assignment : Warning<"object backing the "
10283  "pointer %0 will be destroyed at the end of the full-expression">,
10284  InGroup<DanglingAssignmentGsl>;
10285def warn_new_dangling_initializer_list : Warning<
10286  "array backing "
10287  "%select{initializer list subobject of the allocated object|"
10288  "the allocated initializer list}0 "
10289  "will be destroyed at the end of the full-expression">,
10290  InGroup<DanglingInitializerList>;
10291def warn_dangling_pointer_assignment : Warning<
10292   "object backing %select{|the pointer }0%1 "
10293   "will be destroyed at the end of the full-expression">,
10294   InGroup<DanglingAssignment>;
10295def warn_dangling_reference_captured : Warning<
10296   "object whose reference is captured by '%0' will be destroyed at the end of "
10297   "the full-expression">, InGroup<DanglingCapture>;
10298def warn_dangling_reference_captured_by_unknown : Warning<
10299   "object whose reference is captured will be destroyed at the end of "
10300   "the full-expression">, InGroup<DanglingCapture>;
10301
10302// For non-floating point, expressions of the form x == x or x != x
10303// should result in a warning, since these always evaluate to a constant.
10304// Array comparisons have similar warnings
10305def warn_comparison_always : Warning<
10306  "%select{self-|array |pointer }0comparison always evaluates to "
10307  "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
10308  InGroup<TautologicalCompare>;
10309def warn_comparison_bitwise_always : Warning<
10310  "bitwise comparison always evaluates to %select{false|true}0">,
10311  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
10312def warn_comparison_bitwise_or : Warning<
10313  "bitwise or with non-zero value always evaluates to true">,
10314  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
10315def warn_tautological_negation_and_compare: Warning<
10316  "'&&' of a value and its negation always evaluates to false">,
10317  InGroup<TautologicalNegationCompare>, DefaultIgnore;
10318def warn_tautological_negation_or_compare: Warning<
10319  "'||' of a value and its negation always evaluates to true">,
10320  InGroup<TautologicalNegationCompare>, DefaultIgnore;
10321def warn_tautological_overlap_comparison : Warning<
10322  "overlapping comparisons always evaluate to %select{false|true}0">,
10323  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
10324def warn_depr_array_comparison : Warning<
10325  "comparison between two arrays is deprecated; "
10326  "to compare array addresses, use unary '+' to decay operands to pointers">,
10327  InGroup<DeprecatedArrayCompare>;
10328
10329def warn_array_comparison : Warning<
10330  "comparison between two arrays compare their addresses and will be deprecated in c++20; "
10331  "to compare array addresses, use unary '+' to decay operands to pointers">,
10332  InGroup<DiagGroup<"array-compare">>;
10333
10334def warn_array_comparison_cxx26 : Warning<
10335  "comparison between two arrays is ill-formed in C++26; "
10336  "to compare array addresses, use unary '+' to decay operands to pointers">,
10337  InGroup<DiagGroup<"array-compare-cxx26">>, DefaultError;
10338
10339def warn_stringcompare : Warning<
10340  "result of comparison against %select{a string literal|@encode}0 is "
10341  "unspecified (use an explicit string comparison function instead)">,
10342  InGroup<StringCompare>;
10343
10344def warn_identity_field_assign : Warning<
10345  "assigning %select{field|instance variable}0 to itself">,
10346  InGroup<SelfAssignmentField>;
10347
10348// Type safety attributes
10349def err_type_tag_for_datatype_not_ice : Error<
10350  "'type_tag_for_datatype' attribute requires the initializer to be "
10351  "an %select{integer|integral}0 constant expression">;
10352def err_type_tag_for_datatype_too_large : Error<
10353  "'type_tag_for_datatype' attribute requires the initializer to be "
10354  "an %select{integer|integral}0 constant expression "
10355  "that can be represented by a 64 bit integer">;
10356def err_tag_index_out_of_range : Error<
10357  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
10358def warn_type_tag_for_datatype_wrong_kind : Warning<
10359  "this type tag was not designed to be used with this function">,
10360  InGroup<TypeSafety>;
10361def warn_type_safety_type_mismatch : Warning<
10362  "argument type %0 doesn't match specified %1 type tag "
10363  "%select{that requires %3|}2">, InGroup<TypeSafety>;
10364def warn_type_safety_null_pointer_required : Warning<
10365  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
10366
10367// Generic selections.
10368def err_assoc_type_incomplete : Error<
10369  "type %0 in generic association incomplete">;
10370def err_assoc_type_nonobject : Error<
10371  "type %0 in generic association not an object type">;
10372def err_assoc_type_variably_modified : Error<
10373  "type %0 in generic association is a variably modified type">;
10374def err_assoc_compatible_types : Error<
10375  "type %0 in generic association compatible with previously specified type %1">;
10376def note_compat_assoc : Note<
10377  "compatible type %0 specified here">;
10378def err_generic_sel_no_match : Error<
10379  "controlling expression type %0 not compatible with any generic association type">;
10380def err_generic_sel_multi_match : Error<
10381  "controlling expression type %0 compatible with %1 generic association types">;
10382
10383
10384// Blocks
10385def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
10386  " or %select{pick a deployment target that supports them|for OpenCL C 2.0"
10387  " or OpenCL C 3.0 with __opencl_c_device_enqueue feature}0">;
10388def err_block_returning_array_function : Error<
10389  "block cannot return %select{array|function}0 type %1">;
10390
10391// Builtin annotation
10392def err_builtin_annotation_first_arg : Error<
10393  "first argument to __builtin_annotation must be an integer">;
10394def err_builtin_annotation_second_arg : Error<
10395  "second argument to __builtin_annotation must be a non-wide string constant">;
10396def err_msvc_annotation_wide_str : Error<
10397  "arguments to __annotation must be wide string constants">;
10398
10399// CFString checking
10400def err_cfstring_literal_not_string_constant : Error<
10401  "CFString literal is not a string constant">;
10402def warn_cfstring_truncated : Warning<
10403  "input conversion stopped due to an input byte that does not "
10404  "belong to the input codeset UTF-8">,
10405  InGroup<DiagGroup<"CFString-literal">>;
10406
10407// os_log checking
10408// TODO: separate diagnostic for os_trace()
10409def err_os_log_format_not_string_constant : Error<
10410  "os_log() format argument is not a string constant">;
10411def err_os_log_argument_too_big : Error<
10412  "os_log() argument %0 is too big (%1 bytes, max %2)">;
10413def warn_os_log_format_narg : Error<
10414 "os_log() '%%n' format specifier is not allowed">, DefaultError;
10415
10416// Statements.
10417def err_continue_not_in_loop : Error<
10418  "'continue' statement not in loop statement">;
10419def err_break_not_in_loop_or_switch : Error<
10420  "'break' statement not in loop or switch statement">;
10421def warn_loop_ctrl_binds_to_inner : Warning<
10422  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
10423  InGroup<GccCompat>;
10424def err_omp_bind_required_on_loop : Error<
10425  "expected 'bind' clause for 'loop' construct without an enclosing OpenMP "
10426  "construct">;
10427def err_omp_loop_reduction_clause : Error<
10428  "'reduction' clause not allowed with '#pragma omp loop bind(teams)'">;
10429def warn_break_binds_to_switch : Warning<
10430  "'break' is bound to loop, GCC binds it to switch">,
10431  InGroup<GccCompat>;
10432def err_default_not_in_switch : Error<
10433  "'default' statement not in switch statement">;
10434def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
10435def warn_bool_switch_condition : Warning<
10436  "switch condition has boolean value">, InGroup<SwitchBool>;
10437def warn_case_value_overflow : Warning<
10438  "overflow converting case value to switch condition type (%0 to %1)">,
10439  InGroup<Switch>;
10440def err_duplicate_case : Error<"duplicate case value '%0'">;
10441def err_duplicate_case_differing_expr : Error<
10442  "duplicate case value: '%0' and '%1' both equal '%2'">;
10443def warn_case_empty_range : Warning<"empty case range specified">;
10444def warn_missing_case_for_condition :
10445  Warning<"no case matching constant switch condition '%0'">;
10446def err_loop_attr_conflict : Error<
10447  "conflicting loop attribute %0">;
10448def err_attribute_power_of_two_in_range : Error<
10449  "%0 attribute requires an integer argument which is a constant power of two "
10450  "between %1 and %2 inclusive; provided argument was %3">;
10451
10452def warn_def_missing_case : Warning<"%plural{"
10453  "1:enumeration value %1 not explicitly handled in switch|"
10454  "2:enumeration values %1 and %2 not explicitly handled in switch|"
10455  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
10456  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
10457  InGroup<SwitchEnum>, DefaultIgnore;
10458
10459def warn_missing_case : Warning<"%plural{"
10460  "1:enumeration value %1 not handled in switch|"
10461  "2:enumeration values %1 and %2 not handled in switch|"
10462  "3:enumeration values %1, %2, and %3 not handled in switch|"
10463  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
10464  InGroup<Switch>;
10465def warn_switch_default : Warning<"'switch' missing 'default' label">,
10466  InGroup<SwitchDefault>, DefaultIgnore;
10467
10468def warn_unannotated_fallthrough : Warning<
10469  "unannotated fall-through between switch labels">,
10470  InGroup<ImplicitFallthrough>, DefaultIgnore;
10471def warn_unannotated_fallthrough_per_function : Warning<
10472  "unannotated fall-through between switch labels in partly-annotated "
10473  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
10474def note_insert_fallthrough_fixit : Note<
10475  "insert '%0;' to silence this warning">;
10476def note_insert_break_fixit : Note<
10477  "insert 'break;' to avoid fall-through">;
10478def err_fallthrough_attr_wrong_target : Error<
10479  "%0 attribute is only allowed on empty statements">;
10480def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
10481def err_fallthrough_attr_outside_switch : Error<
10482  "fallthrough annotation is outside switch statement">;
10483def err_fallthrough_attr_invalid_placement : Error<
10484  "fallthrough annotation does not directly precede switch label">;
10485
10486def warn_unreachable_default : Warning<
10487  "default label in switch which covers all enumeration values">,
10488  InGroup<CoveredSwitchDefault>, DefaultIgnore;
10489def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
10490  InGroup<Switch>;
10491def warn_not_in_enum_assignment : Warning<"integer constant not in range "
10492  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
10493def err_typecheck_statement_requires_scalar : Error<
10494  "statement requires expression of scalar type (%0 invalid)">;
10495def err_typecheck_statement_requires_integer : Error<
10496  "statement requires expression of integer type (%0 invalid)">;
10497def err_multiple_default_labels_defined : Error<
10498  "multiple default labels in one switch">;
10499def err_switch_multiple_conversions : Error<
10500  "multiple conversions from switch condition type %0 to an integral or "
10501  "enumeration type">;
10502def note_switch_conversion : Note<
10503  "conversion to %select{integral|enumeration}0 type %1">;
10504def err_switch_explicit_conversion : Error<
10505  "switch condition type %0 requires explicit conversion to %1">;
10506def err_switch_incomplete_class_type : Error<
10507  "switch condition has incomplete class type %0">;
10508
10509def warn_empty_if_body : Warning<
10510  "if statement has empty body">, InGroup<EmptyBody>;
10511def warn_empty_for_body : Warning<
10512  "for loop has empty body">, InGroup<EmptyBody>;
10513def warn_empty_range_based_for_body : Warning<
10514  "range-based for loop has empty body">, InGroup<EmptyBody>;
10515def warn_empty_while_body : Warning<
10516  "while loop has empty body">, InGroup<EmptyBody>;
10517def warn_empty_switch_body : Warning<
10518  "switch statement has empty body">, InGroup<EmptyBody>;
10519def note_empty_body_on_separate_line : Note<
10520  "put the semicolon on a separate line to silence this warning">;
10521
10522def err_va_start_captured_stmt : Error<
10523  "'va_start' cannot be used in a captured statement">;
10524def err_va_start_outside_function : Error<
10525  "'va_start' cannot be used outside a function">;
10526def err_va_start_fixed_function : Error<
10527  "'va_start' used in function with fixed args">;
10528def err_va_start_used_in_wrong_abi_function : Error<
10529  "'va_start' used in %select{System V|Win64}0 ABI function">;
10530def err_ms_va_start_used_in_sysv_function : Error<
10531  "'__builtin_ms_va_start' used in System V ABI function">;
10532def warn_second_arg_of_va_start_not_last_named_param : Warning<
10533  "second argument to 'va_start' is not the last named parameter">,
10534  InGroup<Varargs>;
10535def warn_c17_compat_ellipsis_only_parameter : Warning<
10536  "'...' as the only parameter of a function is incompatible with C standards "
10537  "before C23">, DefaultIgnore, InGroup<CPre23Compat>;
10538def warn_va_start_type_is_undefined : Warning<
10539  "passing %select{an object that undergoes default argument promotion|"
10540  "an object of reference type|a parameter declared with the 'register' "
10541  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
10542def err_first_argument_to_va_arg_not_of_type_va_list : Error<
10543  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
10544def err_second_parameter_to_va_arg_incomplete: Error<
10545  "second argument to 'va_arg' is of incomplete type %0">;
10546def err_second_parameter_to_va_arg_abstract: Error<
10547  "second argument to 'va_arg' is of abstract type %0">;
10548def warn_second_parameter_to_va_arg_not_pod : Warning<
10549  "second argument to 'va_arg' is of non-POD type %0">,
10550  InGroup<NonPODVarargs>, DefaultError;
10551def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
10552  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
10553  InGroup<NonPODVarargs>, DefaultError;
10554def warn_second_parameter_to_va_arg_never_compatible : Warning<
10555  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
10556  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
10557def warn_second_parameter_to_va_arg_array : Warning<
10558  "second argument to 'va_arg' is of array type %0; "
10559  "this va_arg has undefined behavior because arguments "
10560  "will never be compatible with array type">, InGroup<Varargs>;
10561
10562def warn_return_missing_expr : Warning<
10563  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
10564  InGroup<ReturnMismatch>;
10565def ext_return_missing_expr : ExtWarn<
10566  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
10567  InGroup<ReturnMismatch>;
10568def ext_return_has_expr : ExtWarn<
10569  "%select{void function|void method|constructor|destructor}1 %0 "
10570  "should not return a value">,
10571  DefaultError, InGroup<ReturnMismatch>;
10572def ext_return_has_void_expr : Extension<
10573  "void %select{function|method|block}1 %0 should not return void expression">;
10574def err_return_init_list : Error<
10575  "%select{void function|void method|constructor|destructor}1 %0 "
10576  "must not return a value">;
10577def err_ctor_dtor_returns_void : Error<
10578  "%select{constructor|destructor}1 %0 must not return void expression">;
10579def warn_noreturn_function_has_return_expr : Warning<
10580  "function %0 declared 'noreturn' should not return">,
10581  InGroup<InvalidNoreturn>;
10582def warn_falloff_noreturn_function : Warning<
10583  "function declared 'noreturn' should not return">,
10584  InGroup<InvalidNoreturn>;
10585def err_noreturn_block_has_return_expr : Error<
10586  "block declared 'noreturn' should not return">;
10587def err_carries_dependency_missing_on_first_decl : Error<
10588  "%select{function|parameter}0 declared '[[carries_dependency]]' "
10589  "after its first declaration">;
10590def note_carries_dependency_missing_first_decl : Note<
10591  "declaration missing '[[carries_dependency]]' attribute is here">;
10592def err_carries_dependency_param_not_function_decl : Error<
10593  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
10594  "declaration or lambda">;
10595def err_block_on_nonlocal : Error<
10596  "__block attribute not allowed, only allowed on local variables">;
10597def err_block_on_vm : Error<
10598  "__block attribute not allowed on declaration with a variably modified type">;
10599def err_sizeless_nonlocal : Error<
10600  "non-local variable with sizeless type %0">;
10601
10602def err_vec_builtin_non_vector : Error<
10603 "%select{first two|all}1 arguments to %0 must be vectors">;
10604def err_vec_builtin_incompatible_vector : Error<
10605  "%select{first two|all}1 arguments to %0 must have the same type">;
10606def err_vsx_builtin_nonconstant_argument : Error<
10607  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
10608
10609def err_shufflevector_nonconstant_argument : Error<
10610  "index for __builtin_shufflevector must be a constant integer">;
10611def err_shufflevector_argument_too_large : Error<
10612  "index for __builtin_shufflevector must be less than the total number "
10613  "of vector elements">;
10614def err_shufflevector_minus_one_is_undefined_behavior_constexpr : Error<
10615  "index for __builtin_shufflevector not within the bounds of the input vectors; index of -1 found at position %0 is not permitted in a constexpr context">;
10616
10617def err_convertvector_non_vector : Error<
10618  "first argument to __builtin_convertvector must be a vector">;
10619def err_convertvector_constexpr_unsupported_vector_cast : Error<
10620  "unsupported vector cast from %0 to %1 in a constant expression">;
10621def err_builtin_non_vector_type : Error<
10622  "%0 argument to %1 must be of vector type">;
10623def err_convertvector_incompatible_vector : Error<
10624  "first two arguments to __builtin_convertvector must have the same number of elements">;
10625
10626def err_first_argument_to_cwsc_not_call : Error<
10627  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
10628def err_first_argument_to_cwsc_block_call : Error<
10629  "first argument to __builtin_call_with_static_chain must not be a block call">;
10630def err_first_argument_to_cwsc_builtin_call : Error<
10631  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
10632def err_first_argument_to_cwsc_pdtor_call : Error<
10633  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
10634def err_second_argument_to_cwsc_not_pointer : Error<
10635  "second argument to __builtin_call_with_static_chain must be of pointer type">;
10636
10637def err_vector_incorrect_num_elements : Error<
10638  "%select{too many|too few}0 elements in vector %select{initialization|operand}3 (expected %1 elements, have %2)">;
10639def err_altivec_empty_initializer : Error<"expected initializer">;
10640
10641def err_invalid_neon_type_code : Error<
10642  "incompatible constant for this __builtin_neon function">;
10643def err_argument_invalid_range : Error<
10644  "argument value %0 is outside the valid range [%1, %2]">;
10645def warn_argument_invalid_range : Warning<
10646  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
10647  InGroup<DiagGroup<"argument-outside-range">>;
10648def warn_argument_undefined_behaviour : Warning<
10649  "argument value %0 will result in undefined behaviour">,
10650  InGroup<DiagGroup<"argument-undefined-behaviour">>;
10651def err_argument_not_multiple : Error<
10652  "argument should be a multiple of %0">;
10653def err_argument_not_power_of_2 : Error<
10654  "argument should be a power of 2">;
10655def err_argument_not_shifted_byte : Error<
10656  "argument should be an 8-bit value shifted by a multiple of 8 bits">;
10657def err_argument_not_shifted_byte_or_xxff : Error<
10658  "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
10659def err_argument_not_contiguous_bit_field : Error<
10660  "argument %0 value should represent a contiguous bit field">;
10661def err_rotation_argument_to_cadd : Error<
10662  "argument should be the value 90 or 270">;
10663def err_rotation_argument_to_cmla : Error<
10664  "argument should be the value 0, 90, 180 or 270">;
10665def warn_neon_vector_initializer_non_portable : Warning<
10666  "vector initializers are not compatible with NEON intrinsics in big endian "
10667  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
10668def note_neon_vector_initializer_non_portable : Note<
10669  "consider using vld1_%0%1() to initialize a vector from memory, or "
10670  "vcreate_%0%1() to initialize from an integer constant">;
10671def note_neon_vector_initializer_non_portable_q : Note<
10672  "consider using vld1q_%0%1() to initialize a vector from memory, or "
10673  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
10674  "constants">;
10675def err_systemz_invalid_tabort_code : Error<
10676  "invalid transaction abort code">;
10677def err_64_bit_builtin_32_bit_tgt : Error<
10678  "this builtin is only available on 64-bit targets">;
10679def err_32_bit_builtin_64_bit_tgt : Error<
10680  "this builtin is only available on 32-bit targets">;
10681def err_builtin_x64_aarch64_only : Error<
10682  "this builtin is only available on x86-64 and aarch64 targets">;
10683def err_mips_builtin_requires_dsp : Error<
10684  "this builtin requires 'dsp' ASE, please use -mdsp">;
10685def err_mips_builtin_requires_dspr2 : Error<
10686  "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
10687def err_mips_builtin_requires_msa : Error<
10688  "this builtin requires 'msa' ASE, please use -mmsa">;
10689def err_ppc_builtin_requires_abi : Error<
10690  "this builtin requires ABI -mabi=%0">;
10691def err_ppc_invalid_use_mma_type : Error<
10692  "invalid use of PPC MMA type">;
10693def err_ppc_invalid_test_data_class_type : Error<
10694  "expected a 'float', 'double' or '__float128' for the first argument">;
10695def err_x86_builtin_invalid_rounding : Error<
10696  "invalid rounding argument">;
10697def err_x86_builtin_invalid_scale : Error<
10698  "scale argument must be 1, 2, 4, or 8">;
10699def err_x86_builtin_tile_arg_duplicate : Error<
10700  "tile arguments must refer to different tiles">;
10701
10702def err_builtin_target_unsupported : Error<
10703  "builtin is not supported on this target">;
10704def err_builtin_aix_os_unsupported : Error<
10705  "this builtin is available only on AIX 7.2 and later operating systems">;
10706def err_builtin_longjmp_unsupported : Error<
10707  "__builtin_longjmp is not supported for the current target">;
10708def err_builtin_setjmp_unsupported : Error<
10709  "__builtin_setjmp is not supported for the current target">;
10710
10711def err_builtin_longjmp_invalid_val : Error<
10712  "argument to __builtin_longjmp must be a constant 1">;
10713def err_builtin_requires_language : Error<"'%0' is only available in %1">;
10714
10715def err_constant_integer_arg_type : Error<
10716  "argument to %0 must be a constant integer">;
10717
10718def ext_mixed_decls_code : Extension<
10719  "mixing declarations and code is a C99 extension">,
10720  InGroup<DeclarationAfterStatement>;
10721def warn_mixed_decls_code : Warning<
10722  "mixing declarations and code is incompatible with standards before C99">,
10723  InGroup<DeclarationAfterStatement>, DefaultIgnore;
10724
10725def err_non_local_variable_decl_in_for : Error<
10726  "declaration of non-local variable in 'for' loop">;
10727def err_non_variable_decl_in_for : Error<
10728  "non-variable declaration in 'for' loop">;
10729def err_toomany_element_decls : Error<
10730  "only one element declaration is allowed">;
10731def err_selector_element_not_lvalue : Error<
10732  "selector element is not a valid lvalue">;
10733def err_selector_element_type : Error<
10734  "selector element type %0 is not a valid object">;
10735def err_selector_element_const_type : Error<
10736  "selector element of type %0 cannot be a constant lvalue expression">;
10737def err_collection_expr_type : Error<
10738  "the type %0 is not a pointer to a fast-enumerable object">;
10739def warn_collection_expr_type : Warning<
10740  "collection expression type %0 may not respond to %1">;
10741
10742def err_invalid_conversion_between_ext_vectors : Error<
10743  "invalid conversion between ext-vector type %0 and %1">;
10744
10745def warn_duplicate_attribute_exact : Warning<
10746  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
10747
10748def warn_duplicate_attribute : Warning<
10749  "attribute %0 is already applied with different arguments">,
10750  InGroup<IgnoredAttributes>;
10751def err_disallowed_duplicate_attribute : Error<
10752  "attribute %0 cannot appear more than once on a declaration">;
10753
10754def warn_sync_fetch_and_nand_semantics_change : Warning<
10755  "the semantics of this intrinsic changed with GCC "
10756  "version 4.4 - the newer semantics are provided here">,
10757  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
10758
10759// Type
10760def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
10761  InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
10762def warn_receiver_forward_class : Warning<
10763  "receiver %0 is a forward class and corresponding @interface may not exist">,
10764  InGroup<ForwardClassReceiver>;
10765def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
10766def ext_missing_type_specifier : ExtWarn<
10767  "type specifier missing, defaults to 'int'; ISO C99 and later do not support "
10768  "implicit int">, InGroup<ImplicitInt>, DefaultError;
10769def err_missing_type_specifier : Error<
10770  "a type specifier is required for all declarations">;
10771def err_decimal_unsupported : Error<
10772  "GNU decimal type extension not supported">;
10773def err_objc_array_of_interfaces : Error<
10774  "array of interface %0 is invalid (probably should be an array of pointers)">;
10775def ext_c99_array_usage : Extension<
10776  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10777  "feature">, InGroup<C99>;
10778def err_c99_array_usage_cxx : Error<
10779  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10780  "feature, not permitted in C++">;
10781def err_type_unsupported : Error<
10782  "%0 is not supported on this target">;
10783def err_nsconsumed_attribute_mismatch : Error<
10784  "overriding method has mismatched ns_consumed attribute on its"
10785  " parameter">;
10786def err_nsreturns_retained_attribute_mismatch : Error<
10787  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
10788  " attributes">;
10789def err_nserrordomain_invalid_decl : Error<
10790  "domain argument %select{|%1 }0does not refer to global constant">;
10791def err_nserrordomain_wrong_type : Error<
10792  "domain argument %0 does not point to an NSString or CFString constant">;
10793
10794def warn_nsconsumed_attribute_mismatch : Warning<
10795  err_nsconsumed_attribute_mismatch.Summary>, InGroup<NSConsumedMismatch>;
10796def warn_nsreturns_retained_attribute_mismatch : Warning<
10797  err_nsreturns_retained_attribute_mismatch.Summary>, InGroup<NSReturnsMismatch>;
10798
10799def note_getter_unavailable : Note<
10800  "or because setter is declared here, but no getter method %0 is found">;
10801def err_invalid_protocol_qualifiers : Error<
10802  "invalid protocol qualifiers on non-ObjC type">;
10803def warn_ivar_use_hidden : Warning<
10804  "local declaration of %0 hides instance variable">,
10805   InGroup<ShadowIvar>;
10806def warn_direct_initialize_call : Warning<
10807  "explicit call to +initialize results in duplicate call to +initialize">,
10808   InGroup<ExplicitInitializeCall>;
10809def warn_direct_super_initialize_call : Warning<
10810  "explicit call to [super initialize] should only be in implementation "
10811  "of +initialize">,
10812   InGroup<ExplicitInitializeCall>;
10813def err_ivar_use_in_class_method : Error<
10814  "instance variable %0 accessed in class method">;
10815def err_private_ivar_access : Error<"instance variable %0 is private">,
10816  AccessControl;
10817def err_protected_ivar_access : Error<"instance variable %0 is protected">,
10818  AccessControl;
10819def warn_maynot_respond : Warning<"%0 may not respond to %1">;
10820def ext_typecheck_base_super : Warning<
10821  "method parameter type "
10822  "%diff{$ does not match super class method parameter type $|"
10823  "does not match super class method parameter type}0,1">,
10824   InGroup<SuperSubClassMismatch>, DefaultIgnore;
10825def warn_missing_method_return_type : Warning<
10826  "method has no return type specified; defaults to 'id'">,
10827  InGroup<MissingMethodReturnType>, DefaultIgnore;
10828def warn_direct_ivar_access : Warning<"instance variable %0 is being "
10829  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
10830
10831// Spell-checking diagnostics
10832def err_unknown_typename : Error<
10833  "unknown type name %0">;
10834def err_unknown_type_or_class_name_suggest : Error<
10835  "unknown %select{type|class}1 name %0; did you mean %2?">;
10836def err_unknown_typename_suggest : Error<
10837  "unknown type name %0; did you mean %1?">;
10838def err_unknown_nested_typename_suggest : Error<
10839  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
10840def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
10841def err_undeclared_use_suggest : Error<
10842  "use of undeclared %0; did you mean %1?">;
10843def err_undeclared_var_use_suggest : Error<
10844  "use of undeclared identifier %0; did you mean %1?">;
10845def err_no_template : Error<"no template named %0">;
10846def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
10847def err_no_member_template : Error<"no template named %0 in %1">;
10848def err_no_member_template_suggest : Error<
10849  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
10850def err_non_template_in_template_id : Error<
10851  "%0 does not name a template but is followed by template arguments">;
10852def err_non_template_in_template_id_suggest : Error<
10853  "%0 does not name a template but is followed by template arguments; "
10854  "did you mean %1?">;
10855def err_non_template_in_member_template_id_suggest : Error<
10856  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
10857def note_non_template_in_template_id_found : Note<
10858  "non-template declaration found by name lookup">;
10859def err_mem_init_not_member_or_class_suggest : Error<
10860  "initializer %0 does not name a non-static data member or base "
10861  "class; did you mean the %select{base class|member}1 %2?">;
10862def err_field_designator_unknown_suggest : Error<
10863  "field designator %0 does not refer to any field in type %1; did you mean "
10864  "%2?">;
10865def err_typecheck_member_reference_ivar_suggest : Error<
10866  "%0 does not have a member named %1; did you mean %2?">;
10867def err_property_not_found_suggest : Error<
10868  "property %0 not found on object of type %1; did you mean %2?">;
10869def err_class_property_found : Error<
10870  "property %0 is a class property; did you mean to access it with class '%1'?">;
10871def err_ivar_access_using_property_syntax_suggest : Error<
10872  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
10873def warn_property_access_suggest : Warning<
10874"property %0 not found on object of type %1; did you mean to access property %2?">,
10875InGroup<PropertyAccessDotSyntax>;
10876def err_property_found_suggest : Error<
10877  "property %0 found on object of type %1; did you mean to access "
10878  "it with the \".\" operator?">;
10879def err_undef_interface_suggest : Error<
10880  "cannot find interface declaration for %0; did you mean %1?">;
10881def warn_undef_interface_suggest : Warning<
10882  "cannot find interface declaration for %0; did you mean %1?">;
10883def err_undef_superclass_suggest : Error<
10884  "cannot find interface declaration for %0, superclass of %1; did you mean "
10885  "%2?">;
10886def err_undeclared_protocol_suggest : Error<
10887  "cannot find protocol declaration for %0; did you mean %1?">;
10888def note_base_class_specified_here : Note<
10889  "base class %0 specified here">;
10890def err_using_directive_suggest : Error<
10891  "no namespace named %0; did you mean %1?">;
10892def err_using_directive_member_suggest : Error<
10893  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
10894def note_namespace_defined_here : Note<"namespace %0 defined here">;
10895def err_sizeof_pack_no_pack_name_suggest : Error<
10896  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
10897def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
10898
10899def err_uncasted_use_of_unknown_any : Error<
10900  "%0 has unknown type; cast it to its declared type to use it">;
10901def err_uncasted_call_of_unknown_any : Error<
10902  "%0 has unknown return type; cast the call to its declared return type">;
10903def err_uncasted_send_to_unknown_any_method : Error<
10904  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
10905  "message send to the method's return type">;
10906def err_unsupported_unknown_any_decl : Error<
10907  "%0 has unknown type, which is not supported for this kind of declaration">;
10908def err_unsupported_unknown_any_expr : Error<
10909  "unsupported expression with unknown type">;
10910def err_unsupported_unknown_any_call : Error<
10911  "call to unsupported expression with unknown type">;
10912def err_unknown_any_addrof : Error<
10913  "the address of a declaration with unknown type "
10914  "can only be cast to a pointer type">;
10915def err_unknown_any_addrof_call : Error<
10916  "address-of operator cannot be applied to a call to a function with "
10917  "unknown return type">;
10918def err_unknown_any_var_function_type : Error<
10919  "variable %0 with unknown type cannot be given a function type">;
10920def err_unknown_any_function : Error<
10921  "function %0 with unknown type must be given a function type">;
10922
10923def err_filter_expression_integral : Error<
10924  "filter expression has non-integral type %0">;
10925
10926def err_non_asm_stmt_in_naked_function : Error<
10927  "non-ASM statement in naked function is not supported">;
10928def err_asm_naked_this_ref : Error<
10929  "'this' pointer references not allowed in naked functions">;
10930def err_asm_naked_parm_ref : Error<
10931  "parameter references not allowed in naked functions">;
10932
10933// OpenCL warnings and errors.
10934def err_invalid_astype_of_different_size : Error<
10935  "invalid reinterpretation: sizes of %0 and %1 must match">;
10936def err_static_kernel : Error<
10937  "kernel functions cannot be declared static">;
10938def err_method_kernel : Error<
10939  "kernel functions cannot be class members">;
10940def err_template_kernel : Error<
10941  "kernel functions cannot be used in a template declaration, instantiation or specialization">;
10942def err_opencl_ptrptr_kernel_param : Error<
10943  "kernel parameter cannot be declared as a pointer to a pointer">;
10944def err_kernel_arg_address_space : Error<
10945  "pointer arguments to kernel functions must reside in '__global', "
10946  "'__constant' or '__local' address space">;
10947def err_opencl_ext_vector_component_invalid_length : Error<
10948  "vector component access has invalid length %0; supported lengths are: 1,2,3,4,8,16">;
10949def err_opencl_function_variable : Error<
10950  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
10951def err_opencl_addrspace_scope : Error<
10952  "variables in the %0 address space can only be declared in the outermost "
10953  "scope of a kernel function">;
10954def err_static_function_scope : Error<
10955  "variables in function scope cannot be declared static">;
10956def err_opencl_bitfields : Error<
10957  "bit-fields are not supported in OpenCL">;
10958def err_opencl_vla : Error<
10959  "variable length arrays are not supported in OpenCL">;
10960def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
10961    "scalar operand type has greater rank than the type of the vector "
10962    "element. (%0 and %1)">;
10963def err_bad_kernel_param_type : Error<
10964  "%0 cannot be used as the type of a kernel parameter">;
10965def err_record_with_pointers_kernel_param : Error<
10966  "%select{struct|union}0 kernel parameters may not contain pointers">;
10967def note_within_field_of_type : Note<
10968  "within field of type %0 declared here">;
10969def note_illegal_field_declared_here : Note<
10970  "field of illegal %select{type|pointer type}0 %1 declared here">;
10971def err_opencl_type_struct_or_union_field : Error<
10972  "the %0 type cannot be used to declare a structure or union field">;
10973def err_event_t_addr_space_qual : Error<
10974  "the event_t type can only be used with __private address space qualifier">;
10975def err_expected_kernel_void_return_type : Error<
10976  "kernel must have void return type">;
10977def err_sampler_initializer_not_integer : Error<
10978  "sampler_t initialization requires 32-bit integer, not %0">;
10979def warn_sampler_initializer_invalid_bits : Warning<
10980  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
10981def err_sampler_argument_required : Error<
10982  "sampler_t variable required - got %0">;
10983def err_wrong_sampler_addressspace: Error<
10984  "sampler type cannot be used with the __local and __global address space qualifiers">;
10985def err_opencl_nonconst_global_sampler : Error<
10986  "global sampler requires a const or constant address space qualifier">;
10987def err_opencl_cast_non_zero_to_event_t : Error<
10988  "cannot cast non-zero value '%0' to 'event_t'">;
10989def err_opencl_global_invalid_addr_space : Error<
10990  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
10991def err_missing_actual_pipe_type : Error<
10992  "missing actual type specifier for pipe">;
10993def err_reference_pipe_type : Error <
10994  "pipes packet types cannot be of reference type">;
10995def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
10996def err_opencl_kernel_attr :
10997  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
10998def err_return_value_with_address_space : Error<
10999  "return type cannot be qualified with address space">;
11000def err_opencl_constant_no_init : Error<
11001  "variable in constant address space must be initialized">;
11002def err_opencl_atomic_init: Error<
11003  "atomic variable can be %select{assigned|initialized}0 to a variable only "
11004  "in global address space">;
11005def err_opencl_implicit_vector_conversion : Error<
11006  "implicit conversions between vector types (%0 and %1) are not permitted">;
11007def err_opencl_invalid_type_array : Error<
11008  "array of %0 type is invalid in OpenCL">;
11009def err_opencl_ternary_with_block : Error<
11010  "block type cannot be used as expression in ternary expression in OpenCL">;
11011def err_opencl_pointer_to_type : Error<
11012  "pointer to type %0 is invalid in OpenCL">;
11013def err_opencl_type_can_only_be_used_as_function_parameter : Error <
11014  "type %0 can only be used as a function parameter in OpenCL">;
11015def err_opencl_type_not_found : Error<
11016  "%0 type %1 not found; include the base header with -finclude-default-header">;
11017def warn_opencl_attr_deprecated_ignored : Warning <
11018  "%0 attribute is deprecated and ignored in %1">, InGroup<IgnoredAttributes>;
11019def err_opencl_variadic_function : Error<
11020  "invalid prototype, variadic arguments are not allowed in OpenCL">;
11021def err_opencl_requires_extension : Error<
11022  "use of %select{type|declaration}0 %1 requires %2 support">;
11023def ext_opencl_double_without_pragma : Extension<
11024  "Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is"
11025  " supported">;
11026def warn_opencl_generic_address_space_arg : Warning<
11027  "passing non-generic address space pointer to %0"
11028  " may cause dynamic conversion affecting performance">,
11029  InGroup<Conversion>, DefaultIgnore;
11030
11031// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
11032def err_opencl_builtin_pipe_first_arg : Error<
11033  "first argument to %0 must be a pipe type">;
11034def err_opencl_builtin_pipe_arg_num : Error<
11035  "invalid number of arguments to function: %0">;
11036def err_opencl_builtin_pipe_invalid_arg : Error<
11037  "invalid argument type to function %0 (expecting %1 having %2)">;
11038def err_opencl_builtin_pipe_invalid_access_modifier : Error<
11039  "invalid pipe access modifier (expecting %0)">;
11040
11041// OpenCL access qualifier
11042def err_opencl_invalid_access_qualifier : Error<
11043  "access qualifier can only be used for pipe and image type">;
11044def err_opencl_invalid_read_write : Error<
11045  "access qualifier %0 cannot be used for %1 %select{|prior to OpenCL C version 2.0 or in version 3.0 "
11046  "and without __opencl_c_read_write_images feature}2">;
11047def err_opencl_multiple_access_qualifiers : Error<
11048  "multiple access qualifiers">;
11049def note_opencl_typedef_access_qualifier : Note<
11050  "previously declared '%0' here">;
11051
11052// OpenCL v2.0 s6.12.5 Blocks restrictions
11053def err_opencl_block_storage_type : Error<
11054  "the __block storage type is not permitted">;
11055def err_opencl_invalid_block_declaration : Error<
11056  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
11057def err_opencl_extern_block_declaration : Error<
11058  "invalid block variable declaration - using 'extern' storage class is disallowed">;
11059def err_opencl_block_ref_block : Error<
11060  "cannot refer to a block inside block">;
11061
11062// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
11063def err_opencl_builtin_to_addr_invalid_arg : Error<
11064  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
11065
11066// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
11067def err_opencl_enqueue_kernel_incorrect_args : Error<
11068  "illegal call to enqueue_kernel, incorrect argument types">;
11069def err_opencl_enqueue_kernel_local_size_args : Error<
11070  "mismatch in number of block parameters and local size arguments passed">;
11071def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
11072  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
11073def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
11074  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
11075def err_opencl_enqueue_kernel_blocks_no_args : Error<
11076  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
11077
11078def err_opencl_builtin_expected_type : Error<
11079  "illegal call to %0, expected %1 argument type">;
11080
11081// OpenCL v3.0 s6.3.7 - Vector Components
11082def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
11083  "vector component name '%0' is a feature from OpenCL version 3.0 onwards">,
11084  InGroup<OpenCLUnsupportedRGBA>;
11085
11086def err_openclcxx_placement_new : Error<
11087  "use of placement new requires explicit declaration">;
11088
11089// MIG routine annotations.
11090def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
11091  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
11092  InGroup<IgnoredAttributes>;
11093
11094def warn_imp_cast_drops_unaligned : Warning<
11095  "implicit cast from type %0 to type %1 drops __unaligned qualifier">,
11096  InGroup<DiagGroup<"unaligned-qualifier-implicit-cast">>;
11097
11098// Function effects
11099def warn_func_effect_violation : Warning<
11100  "%select{function|constructor|destructor|lambda|block|member initializer of constructor}0 "
11101  "with '%1' attribute "
11102  "must not %select{allocate or deallocate memory|throw or catch exceptions|"
11103  "have static local variables|use thread-local variables|access ObjC methods or properties}2">,
11104  InGroup<FunctionEffects>, DefaultIgnore;
11105def note_func_effect_violation : Note<
11106  "%select{function|constructor|destructor|lambda|block|member initializer}0 "
11107  "cannot be inferred '%1' because it "
11108  "%select{allocates or deallocates memory|throws or catches exceptions|"
11109  "has a static local variable|uses a thread-local variable|"
11110  "accesses an ObjC method or property}2">;
11111def warn_func_effect_calls_func_without_effect : Warning<
11112  "%select{function|constructor|destructor|lambda|block|member initializer of constructor}0 "
11113  "with '%1' attribute "
11114  "must not call non-'%1' "
11115  "%select{function|constructor|destructor|lambda|block}2 "
11116  "'%3'">,
11117  InGroup<FunctionEffects>, DefaultIgnore;
11118def note_func_effect_calls_func_without_effect : Note<
11119  "%select{function|constructor|destructor|lambda|block|member initializer}0 "
11120  "cannot be inferred '%1' because it calls non-'%1' "
11121  "%select{function|constructor|destructor|lambda|block}2 "
11122  "'%3'">;
11123def warn_func_effect_calls_expr_without_effect : Warning<
11124  "%select{function|constructor|destructor|lambda|block|member initializer of constructor}0 "
11125  "with '%1' attribute "
11126  "must not call non-'%1' expression">,
11127  InGroup<FunctionEffects>, DefaultIgnore;
11128def note_func_effect_call_extern : Note<
11129  "declaration cannot be inferred '%0' because it has no definition in this translation unit">;
11130def note_func_effect_call_disallows_inference : Note<
11131  "%select{function|constructor|destructor|lambda|block}0 "
11132  "does not permit inference of '%1' because it is declared '%2'">;
11133def note_func_effect_call_indirect : Note<
11134  "%select{virtual method|function pointer}0 cannot be inferred '%1'">;
11135def warn_perf_constraint_implies_noexcept : Warning<
11136  "%select{function|constructor|destructor|lambda|block}0 "
11137  "with '%1' attribute should be declared noexcept">,
11138  InGroup<PerfConstraintImpliesNoexcept>, DefaultIgnore;
11139
11140// FIXME: It would be nice if we could provide fuller template expansion notes.
11141def note_func_effect_from_template : Note<
11142  "in template expansion here">;
11143def note_func_effect_in_constructor : Note<
11144  "in%select{| implicit}0 constructor here">;
11145def note_in_evaluating_default_argument : Note<
11146  "in evaluating default argument here">;
11147
11148// spoofing nonblocking/nonallocating
11149def warn_invalid_add_func_effects : Warning<
11150  "attribute '%0' should not be added via type conversion">,
11151  InGroup<FunctionEffects>, DefaultIgnore;
11152def warn_mismatched_func_effect_override : Warning<
11153  "attribute '%0' on overriding function does not match base declaration">,
11154  InGroup<FunctionEffects>, DefaultIgnore;
11155def warn_mismatched_func_effect_redeclaration : Warning<
11156  "attribute '%0' on function does not match previous declaration">,
11157  InGroup<FunctionEffects>, DefaultIgnore;
11158def warn_conflicting_func_effects : Warning<
11159  "effects conflict when merging declarations; kept '%0', discarded '%1'">,
11160  InGroup<FunctionEffects>, DefaultIgnore;
11161def err_func_with_effects_no_prototype : Error<
11162  "'%0' function must have a prototype">;
11163
11164} // end of sema category
11165
11166let CategoryName = "API Notes Issue" in {
11167
11168def err_incompatible_replacement_type : Error<
11169  "API notes replacement type %0 has a different size from original type %1">;
11170
11171} // end of API Notes category
11172
11173let CategoryName = "OpenMP Issue" in {
11174// OpenMP support.
11175def err_omp_expected_var_arg : Error<
11176  "%0 is not a global variable, static local variable or static data member">;
11177def err_omp_expected_var_arg_suggest : Error<
11178  "%0 is not a global variable, static local variable or static data member; "
11179  "did you mean %1">;
11180def err_omp_global_var_arg : Error<
11181  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
11182def err_omp_ref_type_arg : Error<
11183  "arguments of '#pragma omp %0' cannot be of reference type %1">;
11184def err_omp_region_not_file_context : Error<
11185  "directive must be at file or namespace scope">;
11186def err_omp_var_scope : Error<
11187  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
11188def err_omp_var_used : Error<
11189  "'#pragma omp %0' must precede all references to variable %q1">;
11190def err_omp_var_thread_local : Error<
11191  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
11192def err_omp_private_incomplete_type : Error<
11193  "a private variable with incomplete type %0">;
11194def err_omp_firstprivate_incomplete_type : Error<
11195  "a firstprivate variable with incomplete type %0">;
11196def err_omp_lastprivate_incomplete_type : Error<
11197  "a lastprivate variable with incomplete type %0">;
11198def err_omp_reduction_incomplete_type : Error<
11199  "a reduction list item with incomplete type %0">;
11200def warn_omp_minus_in_reduction_deprecated : Warning<
11201  "minus(-) operator for reductions is deprecated; use + or user defined reduction instead">,
11202  InGroup<Deprecated>;
11203def err_omp_unexpected_clause_value : Error<
11204  "expected %0 in OpenMP clause '%1'">;
11205def err_omp_unexpected_call_to_omp_runtime_api
11206    : Error<"calls to OpenMP runtime API are not allowed within a region that "
11207            "corresponds to a construct with an order clause that specifies "
11208            "concurrent">;
11209def err_omp_expected_var_name_member_expr : Error<
11210  "expected variable name%select{| or data member of current class}0">;
11211def err_omp_expected_var_name_member_expr_with_type : Error<
11212  "expected variable%select{| or static data member|, static data member, "
11213  "or non-static data member of current class}0 of type '%1'">;
11214def err_omp_expected_var_name_member_expr_or_array_item : Error<
11215  "expected variable name%select{|, data member of current class}0, array element or array section">;
11216def err_omp_expected_addressable_lvalue_or_array_item : Error<
11217  "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">;
11218def err_omp_expected_named_var_member_or_array_expression: Error<
11219  "expected expression containing only member accesses and/or array sections based on named variables">;
11220def err_omp_bit_fields_forbidden_in_clause : Error<
11221  "bit fields cannot be used to specify storage in a '%0' clause">;
11222def err_array_section_does_not_specify_contiguous_storage : Error<
11223  "array section does not specify contiguous storage">;
11224def err_array_section_does_not_specify_length : Error<
11225  "array section does not specify length for outermost dimension">;
11226def err_omp_union_type_not_allowed : Error<
11227  "mapping of union members is not allowed">;
11228def err_omp_expected_access_to_data_field : Error<
11229  "expected access to data field">;
11230def err_omp_multiple_array_items_in_map_clause : Error<
11231  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
11232def err_omp_duplicate_map_type_modifier : Error<
11233  "same map type modifier has been specified more than once">;
11234def err_omp_duplicate_motion_modifier : Error<
11235  "same motion modifier has been specified more than once">;
11236def err_omp_pointer_mapped_along_with_derived_section : Error<
11237  "pointer cannot be mapped along with a section derived from itself">;
11238def err_omp_original_storage_is_shared_and_does_not_contain : Error<
11239  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
11240def err_omp_same_pointer_dereferenced : Error<
11241  "same pointer dereferenced in multiple different ways in map clause expressions">;
11242def note_omp_task_predetermined_firstprivate_here : Note<
11243  "predetermined as a firstprivate in a task construct here">;
11244def err_omp_threadprivate_incomplete_type : Error<
11245  "threadprivate variable with incomplete type %0">;
11246def err_omp_no_dsa_for_variable : Error<
11247  "variable %0 must have explicitly specified data sharing attributes">;
11248def err_omp_defaultmap_no_attr_for_variable : Error<
11249  "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
11250def note_omp_default_dsa_none : Note<
11251  "explicit data sharing attribute requested here">;
11252def note_omp_defaultmap_attr_none : Note<
11253  "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
11254def err_omp_wrong_dsa : Error<
11255  "%0 variable cannot be %1">;
11256def err_omp_variably_modified_type_not_supported : Error<
11257  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
11258def note_omp_explicit_dsa : Note<
11259  "defined as %0">;
11260def note_omp_predetermined_dsa : Note<
11261  "%select{static data member is predetermined as shared|"
11262  "variable with static storage duration is predetermined as shared|"
11263  "loop iteration variable is predetermined as private|"
11264  "loop iteration variable is predetermined as linear|"
11265  "loop iteration variable is predetermined as lastprivate|"
11266  "constant variable is predetermined as shared|"
11267  "global variable is predetermined as shared|"
11268  "non-shared variable in a task construct is predetermined as firstprivate|"
11269  "variable with automatic storage duration is predetermined as private}0"
11270  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
11271def note_omp_implicit_dsa : Note<
11272  "implicitly determined as %0">;
11273def err_omp_loop_var_dsa : Error<
11274  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
11275def err_omp_not_for : Error<
11276  "%select{statement after '#pragma omp %1' must be a for loop|"
11277  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
11278def note_omp_collapse_ordered_expr : Note<
11279  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
11280def err_omp_negative_expression_in_clause : Error<
11281  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
11282def err_omp_not_integral : Error<
11283  "expression must have integral or unscoped enumeration "
11284  "type, not %0">;
11285def err_omp_threadprivate_in_target : Error<
11286  "threadprivate variables cannot be used in target constructs">;
11287def err_omp_incomplete_type : Error<
11288  "expression has incomplete class type %0">;
11289def err_omp_explicit_conversion : Error<
11290  "expression requires explicit conversion from %0 to %1">;
11291def note_omp_conversion_here : Note<
11292  "conversion to %select{integral|enumeration}0 type %1 declared here">;
11293def err_omp_ambiguous_conversion : Error<
11294  "ambiguous conversion from type %0 to an integral or unscoped "
11295  "enumeration type">;
11296def err_omp_iterator_not_integral_or_pointer : Error<
11297  "expected integral or pointer type as the iterator-type, not %0">;
11298def err_omp_iterator_step_not_integral : Error<
11299  "iterator step expression %0 is not the integral expression">;
11300def err_omp_iterator_step_constant_zero : Error<
11301  "iterator step expression %0 evaluates to 0">;
11302def err_omp_required_access : Error<
11303  "%0 variable must be %1">;
11304def err_omp_const_variable : Error<
11305  "const-qualified variable cannot be %0">;
11306def err_omp_const_not_mutable_variable : Error<
11307  "const-qualified variable without mutable fields cannot be %0">;
11308def err_omp_const_list_item : Error<
11309  "const-qualified list item cannot be %0">;
11310def err_omp_linear_incomplete_type : Error<
11311  "a linear variable with incomplete type %0">;
11312def err_omp_linear_expected_int_or_ptr : Error<
11313  "argument of a linear clause should be of integral or pointer "
11314  "type, not %0">;
11315def warn_omp_linear_step_zero : Warning<
11316  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
11317  InGroup<OpenMPClauses>;
11318def warn_omp_alignment_not_power_of_two : Warning<
11319  "aligned clause will be ignored because the requested alignment is not a power of 2">,
11320  InGroup<OpenMPClauses>;
11321def err_omp_invalid_target_decl : Error<
11322  "%0 used in declare target directive is not a variable or a function name">;
11323def err_omp_declare_target_to_and_link : Error<
11324  "%0 must not appear in both clauses 'to' and 'link'">;
11325def warn_omp_not_in_target_context : Warning<
11326  "declaration is not declared in any declare target region">,
11327  InGroup<OpenMPTarget>;
11328def err_omp_function_in_link_clause : Error<
11329  "function name is not allowed in 'link' clause">;
11330def err_omp_aligned_expected_array_or_ptr : Error<
11331  "argument of aligned clause should be array"
11332  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
11333  ", not %0">;
11334def err_omp_used_in_clause_twice : Error<
11335  "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
11336def err_omp_local_var_in_threadprivate_init : Error<
11337  "variable with local storage in initial value of threadprivate variable">;
11338def err_omp_loop_not_canonical_init : Error<
11339  "initialization clause of OpenMP for loop is not in canonical form "
11340  "('var = init' or 'T var = init')">;
11341def ext_omp_loop_not_canonical_init : ExtWarn<
11342  "initialization clause of OpenMP for loop is not in canonical form "
11343  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
11344def err_omp_loop_not_canonical_cond : Error<
11345  "condition of OpenMP for loop must be a relational comparison "
11346  "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
11347def err_omp_loop_not_canonical_incr : Error<
11348  "increment clause of OpenMP for loop must perform simple addition "
11349  "or subtraction on loop variable %0">;
11350def err_omp_loop_variable_type : Error<
11351  "variable must be of integer or %select{pointer|random access iterator}0 type">;
11352def err_omp_loop_incr_not_compatible : Error<
11353  "increment expression must cause %0 to %select{decrease|increase}1 "
11354  "on each iteration of OpenMP for loop">;
11355def note_omp_loop_cond_requires_compatible_incr : Note<
11356  "loop step is expected to be %select{negative|positive}0 due to this condition">;
11357def err_omp_loop_diff_cxx : Error<
11358  "could not calculate number of iterations calling 'operator-' with "
11359  "upper and lower loop bounds">;
11360def err_omp_loop_cannot_use_stmt : Error<
11361  "'%0' statement cannot be used in OpenMP for loop">;
11362def err_omp_loop_bad_collapse_var : Error<
11363  "cannot use variable %1 in collapsed imperfectly-nested loop %select{init|condition|increment}0 statement">;
11364def err_omp_simd_region_cannot_use_stmt : Error<
11365  "'%0' statement cannot be used in OpenMP simd region">;
11366def warn_omp_loop_64_bit_var : Warning<
11367  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
11368  InGroup<OpenMPLoopForm>;
11369def err_omp_unknown_reduction_identifier_prior_omp_6_0 : Error<
11370  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
11371  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
11372def err_omp_unknown_reduction_identifier_since_omp_6_0 : Error<
11373  "incorrect reduction identifier, expected one of '+', '*', '&', '|', '^', "
11374  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
11375def err_omp_not_resolved_reduction_identifier : Error<
11376  "unable to resolve declare reduction construct for type %0">;
11377def err_omp_reduction_ref_type_arg : Error<
11378  "argument of OpenMP clause '%0' must reference the same object in all threads">;
11379def err_omp_clause_not_arithmetic_type_arg : Error<
11380  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
11381def err_omp_clause_floating_type_arg : Error<
11382  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
11383def err_omp_once_referenced : Error<
11384  "variable can appear only once in OpenMP '%0' clause">;
11385def err_omp_once_referenced_in_target_update : Error<
11386  "variable can appear only once in OpenMP 'target update' construct">;
11387def note_omp_referenced : Note<
11388  "previously referenced here">;
11389def err_omp_reduction_in_task : Error<
11390  "reduction variables may not be accessed in an explicit task">;
11391def err_omp_reduction_id_not_compatible : Error<
11392  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
11393def err_omp_reduction_identifier_mismatch : Error<
11394  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
11395def note_omp_previous_reduction_identifier : Note<
11396  "previously marked as task_reduction with different reduction operation">;
11397def err_omp_prohibited_region : Error<
11398  "region cannot be%select{| closely}0 nested inside '%1' region"
11399  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
11400  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
11401  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
11402  "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
11403  "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
11404def err_omp_prohibited_region_simd : Error<
11405  "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
11406def err_omp_prohibited_region_atomic : Error<
11407  "OpenMP constructs may not be nested inside an atomic region">;
11408def err_omp_prohibited_region_order
11409    : Error<"construct '%0' not allowed in a region associated with a "
11410            "directive with 'order' clause">;
11411def err_omp_prohibited_region_critical_same_name : Error<
11412  "cannot nest 'critical' regions having the same name %0">;
11413def note_omp_previous_critical_region : Note<
11414  "previous 'critical' region starts here">;
11415def err_omp_several_directives_in_region : Error<
11416  "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
11417def note_omp_previous_directive : Note<
11418  "previous '%0' directive used here">;
11419def err_omp_sections_not_compound_stmt : Error<
11420  "the statement for '#pragma omp %0' must be a compound statement">;
11421def err_omp_orphaned_section_directive : Error<
11422  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
11423  " must be closely nested to a sections region%select{|, not a %1 region}0">;
11424def err_omp_sections_substmt_not_section : Error<
11425  "statement in 'omp %0' directive must be enclosed into a section region">;
11426def err_omp_parallel_reduction_in_task_firstprivate : Error<
11427  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
11428def err_omp_atomic_read_not_expression_statement : Error<
11429  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
11430  " where v and x are both lvalue expressions with scalar type">;
11431def note_omp_atomic_read_write: Note<
11432  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
11433def err_omp_atomic_write_not_expression_statement : Error<
11434  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
11435  " where x is a lvalue expression with scalar type">;
11436def err_omp_atomic_update_not_expression_statement : Error<
11437  "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',"
11438  " where x is an lvalue expression with scalar type">;
11439def err_omp_atomic_not_expression_statement : Error<
11440  "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',"
11441  " where x is an lvalue expression with scalar type">;
11442def note_omp_atomic_update: Note<
11443  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
11444  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
11445  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
11446def err_omp_atomic_capture_not_expression_statement : Error<
11447  "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',"
11448  " where x and v are both lvalue expressions with scalar type">;
11449def err_omp_atomic_capture_not_compound_statement : Error<
11450  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
11451  " '{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;}',"
11452  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
11453  " where x is an lvalue expression with scalar type">;
11454def note_omp_atomic_capture: Note<
11455  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
11456def err_omp_atomic_compare : Error<
11457  "the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}',"
11458  " '{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;}',"
11459  " 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type,"
11460  " and 'ordop' is one of '<' or '>'">;
11461def err_omp_atomic_compare_capture : Error<
11462  "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;}}',"
11463  " '{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;}',"
11464  " '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,"
11465  " and 'ordop' is one of '<' or '>'">;
11466def note_omp_atomic_compare: Note<
11467  "%select{expected compound statement|expected exactly one expression statement|expected assignment statement|expected conditional operator|expect result value to be at false expression|"
11468  "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'|"
11469  "expect lvalue for result value|expect scalar value|expect integer value|unexpected 'else' statement|expect '==' operator|expect an assignment statement 'v = x'|"
11470  "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">;
11471def err_omp_atomic_fail_wrong_or_no_clauses : Error<"expected a memory order clause">;
11472def err_omp_atomic_no_compare : Error<"expected 'compare' clause with the '%0' modifier">;
11473def err_omp_atomic_weak_no_equality : Error<"expected '==' operator for 'weak' clause">;
11474def err_omp_atomic_several_clauses : Error<
11475  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
11476def err_omp_several_mem_order_clauses : Error<
11477  "directive '#pragma omp %0' cannot contain more than one 'seq_cst',%select{ 'relaxed',|}1 'acq_rel', 'acquire' or 'release' clause">;
11478def err_omp_atomic_incompatible_mem_order_clause : Error<
11479  "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
11480def note_omp_previous_mem_order_clause : Note<
11481  "'%0' clause used here">;
11482def err_omp_target_contains_not_only_teams : Error<
11483  "target construct with nested teams region contains statements outside of the teams construct">;
11484def note_omp_nested_teams_construct_here : Note<
11485  "nested teams construct here">;
11486def note_omp_nested_statement_here : Note<
11487  "%select{statement|directive}0 outside teams construct here">;
11488def err_omp_single_copyprivate_with_nowait : Error<
11489  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
11490def err_omp_nowait_clause_without_depend: Error<
11491  "directive '#pragma omp taskwait' cannot use 'nowait' clause without 'depend' clause">;
11492def note_omp_nowait_clause_here : Note<
11493  "'nowait' clause is here">;
11494def err_omp_single_decl_in_declare_simd_variant : Error<
11495  "single declaration is expected after 'declare %select{simd|variant}0' directive">;
11496def err_omp_function_expected : Error<
11497  "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
11498def err_omp_wrong_cancel_region : Error<
11499  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
11500def err_omp_parent_cancel_region_nowait : Error<
11501  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
11502def err_omp_parent_cancel_region_ordered : Error<
11503  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
11504def 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">;
11505def 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">;
11506def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
11507def err_omp_mapper_wrong_type : Error<
11508  "mapper type must be of struct, union or class type">;
11509def err_omp_declare_mapper_wrong_var : Error<
11510  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
11511def err_omp_declare_mapper_redefinition : Error<
11512  "redefinition of user-defined mapper for type %0 with name %1">;
11513def err_omp_invalid_mapper: Error<
11514  "cannot find a valid user-defined mapper for type %0 with name %1">;
11515def err_array_section_use : Error<"%select{OpenACC sub-array|OpenMP array section}0 is not allowed here">;
11516def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
11517def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
11518def err_omp_typecheck_section_value : Error<
11519  "subscripted value is not an array or pointer">;
11520def err_omp_typecheck_section_not_integer : Error<
11521  "array section %select{lower bound|length}0 is not an integer">;
11522def err_omp_typecheck_shaping_not_integer : Error<
11523  "array shaping operation dimension is not an integer">;
11524def err_omp_shaping_dimension_not_positive : Error<
11525  "array shaping dimension is evaluated to a non-positive value %0">;
11526def err_omp_section_function_type : Error<
11527  "section of pointer to function type %0">;
11528def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
11529  InGroup<CharSubscript>, DefaultIgnore;
11530def err_omp_section_incomplete_type : Error<
11531  "section of pointer to incomplete type %0">;
11532def err_omp_section_not_subset_of_array : Error<
11533  "array section must be a subset of the original array">;
11534def err_omp_section_length_negative : Error<
11535  "section length is evaluated to a negative value %0">;
11536def err_omp_section_stride_non_positive : Error<
11537  "section stride is evaluated to a non-positive value %0">;
11538def err_omp_section_length_undefined : Error<
11539  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
11540def err_omp_wrong_linear_modifier : Error<
11541  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
11542def err_omp_wrong_linear_modifier_non_reference : Error<
11543  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
11544def err_omp_step_simple_modifier_exclusive : Error<
11545  "step simple modifier is exclusive and cannot be use with 'val', 'uval' or 'ref' modifier">;
11546def err_omp_wrong_simdlen_safelen_values : Error<
11547  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
11548def err_omp_wrong_if_directive_name_modifier : Error<
11549  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
11550def err_omp_no_more_if_clause : Error<
11551  "no more 'if' clause is allowed">;
11552def err_omp_unnamed_if_clause : Error<
11553  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
11554def note_omp_previous_named_if_clause : Note<
11555  "previous clause with directive name modifier specified here">;
11556def err_omp_ordered_directive_with_param : Error<
11557  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
11558def err_omp_ordered_directive_without_param : Error<
11559  "'ordered' directive with '%0' clause cannot be closely nested inside ordered region without specified parameter">;
11560def note_omp_ordered_param : Note<
11561  "'ordered' clause%select{| with specified parameter}0">;
11562def err_omp_expected_base_var_name : Error<
11563  "expected variable name as a base of the array %select{subscript|section}0">;
11564def err_omp_map_shared_storage : Error<
11565  "variable already marked as mapped in current construct">;
11566def err_omp_invalid_map_type_for_directive : Error<
11567  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
11568def err_omp_invalid_map_type_modifier_for_directive : Error<
11569  "map type modifier '%0' is not allowed for '#pragma omp %1'">;
11570def err_omp_no_clause_for_directive : Error<
11571  "expected at least one %0 clause for '#pragma omp %1'">;
11572def err_omp_threadprivate_in_clause : Error<
11573  "threadprivate variables are not allowed in '%0' clause">;
11574def err_omp_wrong_ordered_loop_count : Error<
11575  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
11576def note_collapse_loop_count : Note<
11577  "parameter of the 'collapse' clause">;
11578def err_omp_clauses_mutually_exclusive : Error<
11579  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
11580def note_omp_previous_clause : Note<
11581  "'%0' clause is specified here">;
11582def err_omp_hint_clause_no_name : Error<
11583  "the name of the construct must be specified in presence of 'hint' clause">;
11584def err_omp_critical_with_hint : Error<
11585  "constructs with the same name must have a 'hint' clause with the same value">;
11586def note_omp_critical_hint_here : Note<
11587  "%select{|previous }0'hint' clause with value '%1'">;
11588def note_omp_critical_no_hint : Note<
11589  "%select{|previous }0directive with no 'hint' clause specified">;
11590def err_omp_depend_clause_thread_simd : Error<
11591  "'%0' clauses cannot be mixed with '%1' clause">;
11592def err_omp_depend_sink_expected_loop_iteration : Error<
11593  "expected%select{| %1}0 loop iteration variable">;
11594def err_omp_depend_sink_unexpected_expr : Error<
11595  "unexpected expression: number of expressions is larger than the number of associated loops">;
11596def err_omp_depend_sink_expected_plus_minus : Error<
11597  "expected '+' or '-' operation">;
11598def err_omp_taskwait_depend_mutexinoutset_not_allowed : Error<
11599  "'mutexinoutset' modifier not allowed in 'depend' clause on 'taskwait' directive">;
11600def err_omp_sink_and_source_not_allowed : Error<
11601  "'%0(%select{source|sink:vec}1)' clause%select{|s}1 cannot be mixed with '%0(%select{sink:vec|source}1)' clause%select{s|}1">;
11602def err_omp_depend_zero_length_array_section_not_allowed : Error<
11603  "zero-length array section is not allowed in 'depend' clause">;
11604def err_omp_depend_sink_source_with_modifier : Error<
11605  "depend modifier cannot be used with 'sink' or 'source' depend type">;
11606def err_omp_depend_modifier_not_iterator : Error<
11607  "expected iterator specification as depend modifier">;
11608def err_omp_map_modifier_not_iterator : Error<
11609  "expected iterator specification as map modifier">;
11610def err_omp_linear_ordered : Error<
11611  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
11612def err_omp_unexpected_schedule_modifier : Error<
11613  "modifier '%0' cannot be used along with modifier '%1'">;
11614def err_omp_schedule_nonmonotonic_static : Error<
11615  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
11616def err_omp_simple_clause_incompatible_with_ordered : Error<
11617  "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
11618def err_omp_ordered_simd : Error<
11619  "'ordered' clause with a parameter cannot be specified in '#pragma omp %0' directive">;
11620def err_omp_variable_in_given_clause_and_dsa : Error<
11621  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
11622def err_omp_param_or_this_in_clause : Error<
11623  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
11624def err_omp_expected_uniform_param : Error<
11625  "expected a reference to a parameter specified in a 'uniform' clause">;
11626def err_omp_expected_int_param : Error<
11627  "expected a reference to an integer-typed parameter">;
11628def err_omp_at_least_one_motion_clause_required : Error<
11629  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
11630def err_omp_cannot_update_with_internal_linkage : Error<
11631  "the host cannot update a declare target variable that is not externally visible">;
11632def err_omp_usedeviceptr_not_a_pointer : Error<
11633  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
11634def err_omp_argument_type_isdeviceptr : Error <
11635  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
11636def warn_omp_nesting_simd : Warning<
11637  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
11638  InGroup<SourceUsesOpenMP>;
11639def err_omp_orphaned_device_directive : Error<
11640  "orphaned 'omp %0' directives are prohibited"
11641  "; perhaps you forget to enclose the directive into a "
11642  "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
11643def err_omp_reduction_non_addressable_expression : Error<
11644  "expected addressable reduction item for the task-based directives">;
11645def err_omp_reduction_with_nogroup : Error<
11646  "'reduction' clause cannot be used with 'nogroup' clause">;
11647def err_omp_reduction_vla_unsupported : Error<
11648  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
11649def err_omp_linear_distribute_var_non_loop_iteration : Error<
11650  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
11651def warn_omp_non_trivial_type_mapped : Warning<
11652  "type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
11653  InGroup<OpenMPMapping>;
11654def err_omp_requires_clause_redeclaration : Error <
11655  "only one %0 clause can appear on a requires directive in a single translation unit">;
11656def note_omp_requires_previous_clause : Note <
11657  "%0 clause previously used here">;
11658def err_omp_directive_before_requires : Error <
11659  "'%0' region encountered before requires directive with '%1' clause">;
11660def note_omp_requires_encountered_directive : Note <
11661  "'%0' previously encountered here">;
11662def err_omp_device_ancestor_without_requires_reverse_offload : Error <
11663  "device clause with ancestor device-modifier used without specifying 'requires reverse_offload'">;
11664def err_omp_invalid_scope : Error <
11665  "'#pragma omp %0' directive must appear only in file scope">;
11666def note_omp_invalid_length_on_this_ptr_mapping : Note <
11667  "expected length on mapping of 'this' array section expression to be '1'">;
11668def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
11669  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
11670def note_omp_invalid_subscript_on_this_ptr_map : Note <
11671  "expected 'this' subscript expression on map clause to be 'this[0]'">;
11672def err_omp_invalid_map_this_expr : Error <
11673  "invalid 'this' expression on 'map' clause">;
11674def err_omp_implied_type_not_found : Error<
11675  "'%0' type not found; include <omp.h>">;
11676def err_omp_expected_omp_depend_t_lvalue : Error<
11677  "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
11678def err_omp_depobj_expected : Error<
11679  "expected depobj expression">;
11680def err_omp_depobj_single_clause_expected : Error<
11681  "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
11682def err_omp_scan_single_clause_expected : Error<
11683  "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
11684def err_omp_inclusive_exclusive_not_reduction : Error<
11685  "the list item must appear in 'reduction' clause with the 'inscan' modifier "
11686  "of the parent directive">;
11687def err_omp_reduction_not_inclusive_exclusive : Error<
11688  "the inscan reduction list item must appear as a list item in an 'inclusive' or"
11689  " 'exclusive' clause on an inner 'omp scan' directive">;
11690def err_omp_wrong_inscan_reduction : Error<
11691  "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
11692  " 'omp parallel for', or 'omp parallel for simd' directive">;
11693def err_omp_inscan_reduction_expected : Error<
11694  "expected 'reduction' clause with the 'inscan' modifier">;
11695def note_omp_previous_inscan_reduction : Note<
11696  "'reduction' clause with 'inscan' modifier is used here">;
11697def err_omp_expected_predefined_allocator : Error<
11698  "expected one of the predefined allocators for the variables with the static "
11699  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
11700  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
11701  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
11702def warn_omp_used_different_allocator : Warning<
11703  "allocate directive specifies %select{default|'%1'}0 allocator while "
11704  "previously used %select{default|'%3'}2">,
11705  InGroup<OpenMPClauses>;
11706def note_omp_previous_allocator : Note<
11707  "previous allocator is specified here">;
11708def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
11709  "inside of the target region; provide an 'allocator' clause or use 'requires'"
11710  " directive with the 'dynamic_allocators' clause">;
11711def err_expected_allocator_expression : Error<"expected an allocator expression "
11712  "inside of the target region; provide an allocator expression or use 'requires'"
11713  " directive with the 'dynamic_allocators' clause">;
11714def warn_omp_allocate_thread_on_task_target_directive : Warning<
11715  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
11716  InGroup<OpenMPClauses>;
11717def err_omp_expected_private_copy_for_allocate : Error<
11718  "the referenced item is not found in any private clause on the same directive">;
11719def err_omp_stmt_depends_on_loop_counter : Error<
11720  "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
11721def err_omp_invariant_dependency : Error<
11722  "expected loop invariant expression">;
11723def err_omp_invariant_or_linear_dependency : Error<
11724  "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
11725def err_omp_wrong_dependency_iterator_type : Error<
11726  "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
11727def err_target_unsupported_type
11728    : Error<"%0 requires %select{|%2 bit size}1 %3 %select{|return }4type support,"
11729            " but target '%5' does not support it">;
11730def err_omp_lambda_capture_in_declare_target_not_to : Error<
11731  "variable captured in declare target region must appear in a to clause">;
11732def err_omp_device_type_mismatch : Error<
11733  "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
11734def err_omp_wrong_device_function_call : Error<
11735  "function with 'device_type(%0)' is not available on %select{device|host}1">;
11736def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
11737def err_omp_declare_target_has_local_vars : Error<
11738  "local variable '%0' should not be used in 'declare target' directive;">;
11739def warn_omp_declare_target_after_first_use : Warning<
11740  "declaration marked as declare target after first use, it may lead to incorrect results">,
11741  InGroup<OpenMPTarget>;
11742def err_omp_declare_variant_incompat_attributes : Error<
11743  "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
11744def warn_omp_declare_variant_score_not_constant
11745    : Warning<"score expressions in the OpenMP context selector need to be "
11746              "constant; %0 is not and will be ignored">,
11747      InGroup<SourceUsesOpenMP>;
11748def err_omp_declare_variant_user_condition_not_constant
11749    : Error<"the user condition in the OpenMP context selector needs to be "
11750            "constant; %0 is not">;
11751def warn_omp_declare_variant_after_used : Warning<
11752  "'#pragma omp declare variant' cannot be applied for function after first "
11753  "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
11754def warn_omp_declare_variant_after_emitted : Warning<
11755  "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
11756  " the original function might be used">, InGroup<SourceUsesOpenMP>;
11757def err_omp_declare_variant_doesnt_support : Error<
11758  "'#pragma omp declare variant' does not "
11759  "support %select{function templates|virtual functions|"
11760  "deduced return types|constructors|destructors|deleted functions|"
11761  "defaulted functions|constexpr functions|consteval function}0">;
11762def err_omp_declare_variant_diff : Error<
11763  "function with '#pragma omp declare variant' has a different %select{calling convention"
11764  "|return type|constexpr specification|inline specification|storage class|"
11765  "linkage}0">;
11766def err_omp_declare_variant_prototype_required : Error<
11767  "function with '#pragma omp declare variant' must have a prototype when "
11768  "'append_args' is used">;
11769def err_omp_interop_type_not_found : Error<
11770  "'omp_interop_t' must be defined when 'append_args' clause is used; include <omp.h>">;
11771def err_omp_declare_variant_incompat_types : Error<
11772  "variant in '#pragma omp declare variant' with type %0 is incompatible with"
11773  " type %1%select{| with appended arguments}2">;
11774def err_omp_declare_variant_same_base_function : Error<
11775  "variant in '#pragma omp declare variant' is the same as the base function">;
11776def warn_omp_declare_variant_marked_as_declare_variant : Warning<
11777  "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
11778  >, InGroup<SourceUsesOpenMP>;
11779def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
11780def err_omp_one_defaultmap_each_category: Error<
11781  "at most one defaultmap clause for each variable-category can appear on the directive">;
11782def err_omp_lastprivate_conditional_non_scalar : Error<
11783  "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
11784  >;
11785def err_omp_flush_order_clause_and_list : Error<
11786  "'flush' directive with memory order clause '%0' cannot have the list">;
11787def note_omp_flush_order_clause_here : Note<
11788  "memory order clause '%0' is specified here">;
11789def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
11790  "expected addressable lvalue in '%0' clause">;
11791def err_omp_var_expected : Error<
11792  "expected variable of the '%0' type%select{|, not %2}1">;
11793def err_omp_non_pointer_type_array_shaping_base : Error<
11794  "expected expression with a pointer to a complete type as a base of an array "
11795  "shaping operation">;
11796def err_omp_reduction_task_not_parallel_or_worksharing : Error<
11797  "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
11798  " worksharing constructs">;
11799def err_omp_expected_array_alloctraits : Error<
11800  "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
11801def err_omp_predefined_allocator_with_traits : Error<
11802  "predefined allocator cannot have traits specified">;
11803def note_omp_predefined_allocator : Note<
11804  "predefined trait '%0' used here">;
11805def err_omp_nonpredefined_allocator_without_traits : Error<
11806  "non-predefined allocator must have traits specified">;
11807def err_omp_allocator_used_in_clauses : Error<
11808  "allocators used in 'uses_allocators' clause cannot appear in other "
11809  "data-sharing or data-mapping attribute clauses">;
11810def err_omp_allocator_not_in_uses_allocators : Error<
11811  "allocator must be specified in the 'uses_allocators' clause">;
11812def note_omp_protected_structured_block
11813    : Note<"jump bypasses OpenMP structured block">;
11814def note_omp_exits_structured_block
11815    : Note<"jump exits scope of OpenMP structured block">;
11816def err_omp_lastprivate_loop_var_non_loop_iteration : Error<
11817  "only loop iteration variables are allowed in 'lastprivate' clause in "
11818  "'omp %0' directives">;
11819def err_omp_interop_variable_expected : Error<
11820  "expected%select{| non-const}0 variable of type 'omp_interop_t'">;
11821def err_omp_interop_variable_wrong_type : Error<
11822  "interop variable must be of type 'omp_interop_t'">;
11823def err_omp_interop_prefer_type : Error<
11824  "prefer_list item must be a string literal or constant integral "
11825  "expression">;
11826def err_omp_interop_bad_depend_clause : Error<
11827  "'depend' clause requires the 'targetsync' interop type">;
11828def err_omp_interop_var_multiple_actions : Error<
11829  "interop variable %0 used in multiple action clauses">;
11830def err_omp_dispatch_statement_call
11831    : Error<"statement after '#pragma omp dispatch' must be a direct call"
11832            " to a target function or an assignment to one">;
11833def err_omp_unroll_full_variable_trip_count : Error<
11834  "loop to be fully unrolled must have a constant trip count">;
11835def err_omp_interchange_permutation_value_range : Error<
11836  "permutation index must be at least 1 and at most %0">;
11837def err_omp_interchange_permutation_value_repeated : Error<
11838  "index %0 must appear exactly once in the permutation clause">;
11839def note_omp_directive_here : Note<"'%0' directive found here">;
11840def err_omp_instantiation_not_supported
11841    : Error<"instantiation of '%0' not supported yet">;
11842def err_omp_adjust_arg_multiple_clauses : Error<
11843  "'adjust_arg' argument %0 used in multiple clauses">;
11844def err_omp_clause_requires_dispatch_construct : Error<
11845  "'%0' clause requires 'dispatch' context selector">;
11846def err_omp_append_args_with_varargs : Error<
11847  "'append_args' is not allowed with varargs functions">;
11848def err_openmp_vla_in_task_untied : Error<
11849  "variable length arrays are not supported in OpenMP tasking regions with 'untied' clause">;
11850def warn_omp_unterminated_declare_target : Warning<
11851  "expected '#pragma omp end declare target' at end of file to match '#pragma omp %0'">,
11852  InGroup<SourceUsesOpenMP>;
11853def err_ompx_bare_no_grid : Error<
11854  "'ompx_bare' clauses requires explicit grid size via 'num_teams' and 'thread_limit' clauses">;
11855def err_omp_multi_expr_not_allowed: Error<"only one expression allowed in '%0' clause">;
11856def err_ompx_more_than_three_expr_not_allowed: Error<"at most three expressions are allowed in '%0' clause in 'target teams ompx_bare' construct">;
11857} // end of OpenMP category
11858
11859let CategoryName = "Related Result Type Issue" in {
11860// Objective-C related result type compatibility
11861def warn_related_result_type_compatibility_class : Warning<
11862  "method is expected to return an instance of its class type "
11863  "%diff{$, but is declared to return $|"
11864  ", but is declared to return different type}0,1">;
11865def warn_related_result_type_compatibility_protocol : Warning<
11866  "protocol method is expected to return an instance of the implementing "
11867  "class, but is declared to return %0">;
11868def note_related_result_type_family : Note<
11869  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
11870  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
11871  "self}1' method family%select{| and is expected to return an instance of its "
11872  "class type}0">;
11873def note_related_result_type_overridden : Note<
11874  "overridden method returns an instance of its class type">;
11875def note_related_result_type_inferred : Note<
11876  "%select{class|instance}0 method %1 is assumed to return an instance of "
11877  "its receiver type (%2)">;
11878def note_related_result_type_explicit : Note<
11879  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
11880  "%select{| and is expected to return an instance of its class type}0">;
11881def err_invalid_type_for_program_scope_var : Error<
11882  "the %0 type cannot be used to declare a program scope variable">;
11883
11884}
11885
11886let CategoryName = "Modules Issue" in {
11887def err_module_decl_in_module_map_module : Error<
11888  "'module' declaration found while building module from module map">;
11889def err_module_decl_in_header_unit : Error<
11890  "'module' declaration found while building header unit">;
11891def err_module_interface_implementation_mismatch : Error<
11892  "missing 'export' specifier in module declaration while "
11893  "building module interface">;
11894def err_current_module_name_mismatch : Error<
11895  "module name '%0' specified on command line does not match name of module">;
11896def err_module_redefinition : Error<
11897  "redefinition of module '%0'">;
11898def note_prev_module_definition : Note<"previously defined here">;
11899def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
11900def err_module_not_defined : Error<
11901  "definition of module '%0' is not available; use -fmodule-file= to specify "
11902  "path to precompiled module interface">;
11903def err_module_redeclaration : Error<
11904  "translation unit contains multiple module declarations">;
11905def note_prev_module_declaration : Note<"previous module declaration is here">;
11906def err_module_declaration_missing : Error<
11907  "missing 'export module' declaration in module interface unit">;
11908def err_module_declaration_missing_after_global_module_introducer : Error<
11909  "missing 'module' declaration at end of global module fragment "
11910  "introduced here">;
11911def err_module_private_specialization : Error<
11912  "%select{template|partial|member}0 specialization cannot be "
11913  "declared __module_private__">;
11914def err_module_private_local : Error<
11915  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
11916  "__module_private__">;
11917def err_module_private_local_class : Error<
11918  "local %select{struct|interface|union|class|enum}0 cannot be declared "
11919  "__module_private__">;
11920def err_module_unimported_use : Error<
11921  "%select{declaration|definition|default argument|"
11922  "explicit specialization|partial specialization}0 of %1 must be imported "
11923  "from module '%2' before it is required">;
11924def err_module_unimported_use_header : Error<
11925  "%select{missing '#include'|missing '#include %3'}2; "
11926  "%select{||default argument of |explicit specialization of |"
11927  "partial specialization of }0%1 must be "
11928  "%select{declared|defined|defined|declared|declared}0 "
11929  "before it is used">;
11930def err_module_unimported_use_multiple : Error<
11931  "%select{declaration|definition|default argument|"
11932  "explicit specialization|partial specialization}0 of %1 must be imported "
11933  "from one of the following modules before it is required:%2">;
11934def note_unreachable_entity : Note<
11935  "%select{declaration|definition|default argument declared|"
11936  "explicit specialization declared|partial specialization declared}0 here "
11937  "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
11938def ext_module_import_in_extern_c : ExtWarn<
11939  "import of C++ module '%0' appears within extern \"C\" language linkage "
11940  "specification">, DefaultError,
11941  InGroup<DiagGroup<"module-import-in-extern-c">>;
11942def err_module_import_not_at_top_level_fatal : Error<
11943  "import of module '%0' appears within %1">, DefaultFatal;
11944def ext_module_import_not_at_top_level_noop : ExtWarn<
11945  "redundant #include of module '%0' appears within %1">, DefaultError,
11946  InGroup<DiagGroup<"modules-import-nested-redundant">>;
11947def note_module_import_not_at_top_level : Note<"%0 begins here">;
11948def err_module_self_import : Error<
11949  "import of module '%0' appears within same top-level module '%1'">;
11950def err_module_self_import_cxx20 : Error<
11951  "import of module '%0' appears within its own %select{interface|implementation}1">;
11952def err_module_import_in_implementation : Error<
11953  "@import of module '%0' in implementation of '%1'; use #import">;
11954
11955// C++ Modules
11956def err_module_import_non_interface_nor_parition : Error<
11957  "import of module '%0' imported non C++20 importable modules">;
11958def err_module_decl_not_at_start : Error<
11959  "module declaration must occur at the start of the translation unit">;
11960def note_global_module_introducer_missing : Note<
11961  "add 'module;' to the start of the file to introduce a "
11962  "global module fragment">;
11963def err_export_within_anonymous_namespace : Error<
11964  "export declaration appears within anonymous namespace">;
11965def note_anonymous_namespace : Note<"anonymous namespace begins here">;
11966def note_export : Note<"export block begins here">;
11967def err_export_within_export : Error<
11968  "export declaration appears within another export declaration">;
11969def err_export_anon_ns_internal : Error<
11970  "anonymous namespaces cannot be exported">;
11971def err_export_internal : Error<
11972  "declaration of %0 with internal linkage cannot be exported">;
11973def err_export_using_internal : Error<
11974  "using declaration referring to %1 with %select{internal|module|unknown}0 "
11975  "linkage cannot be exported">;
11976def err_export_not_in_module_interface : Error<
11977  "export declaration can only be used within a module purview">;
11978def err_export_inline_not_defined : Error<
11979  "inline function not defined%select{| before the private module fragment}0">;
11980def err_export_partition_impl : Error<
11981  "module partition implementations cannot be exported">;
11982def err_export_in_private_module_fragment : Error<
11983  "export declaration cannot be used in a private module fragment">;
11984def note_private_module_fragment : Note<
11985  "private module fragment begins here">;
11986def err_private_module_fragment_not_module : Error<
11987  "private module fragment declaration with no preceding module declaration">;
11988def err_private_module_fragment_redefined : Error<
11989  "private module fragment redefined">;
11990def err_private_module_fragment_not_module_interface : Error<
11991  "private module fragment in module implementation unit">;
11992def note_not_module_interface_add_export : Note<
11993  "add 'export' here if this is intended to be a module interface unit">;
11994def err_invalid_module_name : Error<"%0 is an invalid name for a module">;
11995def err_extern_def_in_header_unit : Error<
11996  "non-inline external definitions are not permitted in C++ header units">;
11997
11998def warn_experimental_header_unit : Warning<
11999  "the implementation of header units is in an experimental phase">,
12000  InGroup<DiagGroup<"experimental-header-units">>;
12001
12002def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
12003  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
12004  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
12005def note_equivalent_internal_linkage_decl : Note<
12006  "declared here%select{ in module '%1'|}0">;
12007
12008def note_redefinition_modules_same_file : Note<
12009  "'%0' included multiple times, additional include site in header from module '%1'">;
12010def note_redefinition_include_same_file : Note<
12011  "'%0' included multiple times, additional include site here">;
12012}
12013
12014let CategoryName = "Coroutines Issue" in {
12015def err_return_in_coroutine : Error<
12016  "return statement not allowed in coroutine; did you mean 'co_return'?">;
12017def note_declared_coroutine_here : Note<
12018  "function is a coroutine due to use of '%0' here">;
12019def err_coroutine_objc_method : Error<
12020  "Objective-C methods as coroutines are not yet supported">;
12021def err_coroutine_unevaluated_context : Error<
12022  "'%0' cannot be used in an unevaluated context">;
12023def err_coroutine_within_handler : Error<
12024  "'%0' cannot be used in the handler of a try block">;
12025def err_coroutine_outside_function : Error<
12026  "'%0' cannot be used outside a function">;
12027def err_coroutine_invalid_func_context : Error<
12028  "'%1' cannot be used in %select{a constructor|a destructor"
12029  "|the 'main' function|a constexpr function"
12030  "|a function with a deduced return type|a varargs function"
12031  "|a consteval function}0">;
12032def err_implied_coroutine_type_not_found : Error<
12033  "%0 type was not found; include <coroutine> before defining "
12034  "a coroutine">;
12035def err_implicit_coroutine_std_nothrow_type_not_found : Error<
12036  "std::nothrow was not found; include <new> before defining a coroutine which "
12037  "uses get_return_object_on_allocation_failure()">;
12038def err_malformed_std_nothrow : Error<
12039  "std::nothrow must be a valid variable declaration">;
12040def err_malformed_std_coroutine_handle : Error<
12041  "std::coroutine_handle isn't a class template">;
12042def err_coroutine_handle_missing_member : Error<
12043  "std::coroutine_handle must have a member named '%0'">;
12044def err_malformed_std_coroutine_traits : Error<
12045  "std::coroutine_traits isn't a class template">;
12046def err_implied_std_coroutine_traits_promise_type_not_found : Error<
12047  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
12048def err_implied_std_coroutine_traits_promise_type_not_class : Error<
12049  "this function cannot be a coroutine: %0 is not a class">;
12050def err_coroutine_promise_type_incomplete : Error<
12051  "this function cannot be a coroutine: %0 is an incomplete type">;
12052def err_coroutine_type_missing_specialization : Error<
12053  "this function cannot be a coroutine: missing definition of "
12054  "specialization %0">;
12055def err_coroutine_promise_incompatible_return_functions : Error<
12056  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
12057def note_coroutine_promise_implicit_await_transform_required_here : Note<
12058  "call to 'await_transform' implicitly required by 'co_await' here">;
12059def note_coroutine_promise_suspend_implicitly_required : Note<
12060  "call to '%select{initial_suspend|final_suspend}0' implicitly "
12061  "required by the %select{initial suspend point|final suspend point}0">;
12062def err_coroutine_promise_unhandled_exception_required : Error<
12063  "%0 is required to declare the member 'unhandled_exception()'">;
12064def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
12065  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
12066  InGroup<CoroutineMissingUnhandledException>;
12067def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
12068  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
12069def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
12070  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
12071def err_coroutine_promise_new_requires_nothrow : Error<
12072  "%0 is required to have a non-throwing noexcept specification when the promise "
12073   "type declares 'get_return_object_on_allocation_failure()'">;
12074def note_coroutine_promise_call_implicitly_required : Note<
12075  "call to %0 implicitly required by coroutine function here">;
12076def err_await_suspend_invalid_return_type : Error<
12077  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
12078>;
12079def note_await_ready_no_bool_conversion : Note<
12080  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
12081>;
12082def warn_coroutine_handle_address_invalid_return_type : Warning <
12083  "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API">,
12084  InGroup<Coroutine>;
12085def err_coroutine_promise_final_suspend_requires_nothrow : Error<
12086  "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
12087>;
12088def note_coroutine_function_declare_noexcept : Note<
12089  "must be declared with 'noexcept'"
12090>;
12091def warn_always_inline_coroutine : Warning<
12092  "this coroutine may be split into pieces; not every piece is guaranteed to be inlined"
12093  >,
12094  InGroup<AlwaysInlineCoroutine>;
12095def err_coroutine_unusable_new : Error<
12096  "'operator new' provided by %0 is not usable with the function signature of %1"
12097>;
12098def err_coroutine_unfound_nothrow_new : Error <
12099  "unable to find %select{'::operator new(size_t, nothrow_t)'|"
12100  "'::operator new(size_t, align_val_t, nothrow_t)'}1 for %0"
12101>;
12102def warn_non_aligned_allocation_function : Warning <
12103  "under -fcoro-aligned-allocation, the non-aligned allocation function "
12104  "for the promise type %0 has higher precedence than the global aligned "
12105  "allocation function">,
12106  InGroup<CoroNonAlignedAllocationFunction>;
12107def err_conflicting_aligned_options : Error <
12108  "conflicting option '-fcoro-aligned-allocation' and '-fno-aligned-allocation'"
12109>;
12110def err_coro_invalid_addr_of_label : Error<
12111  "the GNU address of label extension is not allowed in coroutines"
12112>;
12113def err_coroutine_return_type : Error<
12114  "function returns a type %0 marked with [[clang::coro_return_type]] but is neither a coroutine nor a coroutine wrapper; "
12115  "non-coroutines should be marked with [[clang::coro_wrapper]] to allow returning coroutine return type"
12116>;
12117} // end of coroutines issue category
12118
12119let CategoryName = "Documentation Issue" in {
12120def warn_not_a_doxygen_trailing_member_comment : Warning<
12121  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
12122def warn_splice_in_doxygen_comment : Warning<
12123  "line splicing in Doxygen comments are not supported">, InGroup<Documentation>, DefaultIgnore;
12124} // end of documentation issue category
12125
12126let CategoryName = "Nullability Issue" in {
12127
12128def warn_mismatched_nullability_attr : Warning<
12129  "nullability specifier %0 conflicts with existing specifier %1">,
12130  InGroup<Nullability>;
12131
12132def warn_nullability_declspec : Warning<
12133  "nullability specifier %0 cannot be applied "
12134  "to non-pointer type %1; did you mean to apply the specifier to the "
12135  "%select{pointer|block pointer|member pointer|function pointer|"
12136  "member function pointer}2?">,
12137  InGroup<NullabilityDeclSpec>,
12138  DefaultError;
12139
12140def note_nullability_here : Note<"%0 specified here">;
12141
12142def err_nullability_nonpointer : Error<
12143  "nullability specifier %0 cannot be applied to non-pointer type %1">;
12144
12145def warn_nullability_lost : Warning<
12146  "implicit conversion from nullable pointer %0 to non-nullable pointer "
12147  "type %1">,
12148  InGroup<NullableToNonNullConversion>, DefaultIgnore;
12149def warn_zero_as_null_pointer_constant : Warning<
12150  "zero as null pointer constant">,
12151  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
12152
12153def err_nullability_cs_multilevel : Error<
12154  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
12155def note_nullability_type_specifier : Note<
12156  "use nullability type specifier %0 to affect the innermost "
12157  "pointer type of %1">;
12158
12159def warn_null_resettable_setter : Warning<
12160  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
12161  InGroup<Nullability>;
12162
12163def warn_nullability_missing : Warning<
12164  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
12165  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
12166  InGroup<NullabilityCompleteness>;
12167def warn_nullability_missing_array : Warning<
12168  "array parameter is missing a nullability type specifier (_Nonnull, "
12169  "_Nullable, or _Null_unspecified)">,
12170  InGroup<NullabilityCompletenessOnArrays>;
12171def note_nullability_fix_it : Note<
12172  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
12173  "%select{pointer|block pointer|member pointer|array parameter}1 "
12174  "%select{should never be null|may be null|should not declare nullability}0">;
12175
12176def warn_nullability_inferred_on_nested_type : Warning<
12177  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
12178  "deprecated">,
12179  InGroup<NullabilityInferredOnNestedType>;
12180
12181def err_objc_type_arg_explicit_nullability : Error<
12182  "type argument %0 cannot explicitly specify nullability">;
12183
12184def err_objc_type_param_bound_explicit_nullability : Error<
12185  "type parameter %0 bound %1 cannot explicitly specify nullability">;
12186
12187}
12188
12189let CategoryName = "Generics Issue" in {
12190
12191def err_objc_type_param_bound_nonobject : Error<
12192  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
12193
12194def err_objc_type_param_bound_missing_pointer : Error<
12195  "missing '*' in type bound %0 for type parameter %1">;
12196def err_objc_type_param_bound_qualified : Error<
12197  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
12198
12199def err_objc_type_param_redecl : Error<
12200  "redeclaration of type parameter %0">;
12201
12202def err_objc_type_param_arity_mismatch : Error<
12203  "%select{forward class declaration|class definition|category|extension}0 has "
12204  "too %select{few|many}1 type parameters (expected %2, have %3)">;
12205
12206def err_objc_type_param_bound_conflict : Error<
12207  "type bound %0 for type parameter %1 conflicts with "
12208  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
12209
12210def err_objc_type_param_variance_conflict : Error<
12211  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
12212  "%select{in|co|contra}2variant type parameter %3">;
12213
12214def note_objc_type_param_here : Note<"type parameter %0 declared here">;
12215
12216def err_objc_type_param_bound_missing : Error<
12217  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
12218
12219def err_objc_parameterized_category_nonclass : Error<
12220  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
12221  "parameters">;
12222
12223def err_objc_parameterized_forward_class : Error<
12224  "forward declaration of non-parameterized class %0 cannot have type "
12225  "parameters">;
12226
12227def err_objc_parameterized_forward_class_first : Error<
12228  "class %0 previously declared with type parameters">;
12229
12230def err_objc_type_arg_missing_star : Error<
12231  "type argument %0 must be a pointer (requires a '*')">;
12232def err_objc_type_arg_qualified : Error<
12233  "type argument %0 cannot be qualified with '%1'">;
12234
12235def err_objc_type_arg_missing : Error<
12236  "no type or protocol named %0">;
12237
12238def err_objc_type_args_and_protocols : Error<
12239  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
12240  "%select{protocol|type}0 (%2)">;
12241
12242def err_objc_type_args_non_class : Error<
12243  "type arguments cannot be applied to non-class type %0">;
12244
12245def err_objc_type_args_non_parameterized_class : Error<
12246  "type arguments cannot be applied to non-parameterized class %0">;
12247
12248def err_objc_type_args_specialized_class : Error<
12249  "type arguments cannot be applied to already-specialized class type %0">;
12250
12251def err_objc_type_args_wrong_arity : Error<
12252  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
12253}
12254
12255def err_type_available_only_in_default_eval_method : Error<
12256  "cannot use type '%0' within '#pragma clang fp eval_method'; type is set "
12257  "according to the default eval method for the translation unit">;
12258
12259def err_objc_type_arg_not_id_compatible : Error<
12260  "type argument %0 is neither an Objective-C object nor a block type">;
12261
12262def err_objc_type_arg_does_not_match_bound : Error<
12263  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
12264
12265def warn_objc_redundant_qualified_class_type : Warning<
12266  "parameterized class %0 already conforms to the protocols listed; did you "
12267  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
12268
12269def warn_block_literal_attributes_on_omitted_return_type : Warning<
12270  "attribute %0 ignored, because it cannot be applied to omitted return type">,
12271  InGroup<IgnoredAttributes>;
12272
12273def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
12274  "'%0' qualifier on omitted return type %1 has no effect">,
12275  InGroup<IgnoredQualifiers>;
12276
12277def warn_shadow_field : Warning<
12278  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
12279  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
12280def note_shadow_field : Note<"declared here">;
12281
12282def err_multiversion_required_in_redecl : Error<
12283  "function declaration is missing %select{'target'|'cpu_specific' or "
12284  "'cpu_dispatch'|'target_version'}0 attribute in a multiversioned function">;
12285def note_multiversioning_caused_here : Note<
12286  "function multiversioning caused by this declaration">;
12287def err_multiversion_after_used : Error<
12288  "function declaration cannot become a multiversioned function after first "
12289  "usage">;
12290def err_bad_multiversion_option : Error<
12291  "function multiversioning doesn't support %select{feature|architecture}0 "
12292  "'%1'">;
12293def err_multiversion_duplicate : Error<
12294  "multiversioned function redeclarations require identical target attributes">;
12295def err_multiversion_noproto : Error<
12296  "multiversioned function must have a prototype">;
12297def err_multiversion_disallowed_other_attr
12298    : Error<"attribute "
12299            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
12300            "multiversioning cannot be combined"
12301            " with attribute %1">;
12302def err_multiversion_diff : Error<
12303  "multiversioned function declaration has a different %select{calling convention"
12304  "|return type|constexpr specification|inline specification|linkage|"
12305  "language linkage}0">;
12306def err_multiversion_doesnt_support
12307    : Error<"attribute "
12308            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
12309            "multiversioned functions do not "
12310            "yet support %select{function templates|virtual functions|"
12311            "deduced return types|constructors|destructors|deleted functions|"
12312            "defaulted functions|constexpr functions|consteval "
12313            "function|lambdas}1">;
12314def err_multiversion_not_allowed_on_main : Error<
12315  "'main' cannot be a multiversioned function">;
12316def err_multiversion_not_supported : Error<
12317 "function multiversioning is not supported on the current target">;
12318def err_multiversion_types_mixed : Error<
12319  "multiversioning attributes cannot be combined">;
12320def err_cpu_dispatch_mismatch : Error<
12321 "'cpu_dispatch' function redeclared with different CPUs">;
12322def err_cpu_specific_multiple_defs : Error<
12323 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
12324def warn_multiversion_duplicate_entries : Warning<
12325 "CPU list contains duplicate entries; attribute ignored">,
12326  InGroup<FunctionMultiVersioning>;
12327def warn_dispatch_body_ignored : Warning<
12328  "body of cpu_dispatch function will be ignored">,
12329  InGroup<FunctionMultiVersioning>;
12330def err_target_clone_must_have_default
12331    : Error<"'target_clones' multiversioning requires a default target">;
12332def err_target_clone_doesnt_match
12333    : Error<"'target_clones' attribute does not match previous declaration">;
12334def warn_target_clone_mixed_values
12335    : ExtWarn<
12336          "mixing 'target_clones' specifier mechanisms is permitted for GCC "
12337          "compatibility; use a comma separated sequence of string literals, "
12338          "or a string literal containing a comma-separated list of versions">,
12339      InGroup<TargetClonesMixedSpecifiers>;
12340def warn_target_clone_duplicate_options
12341    : Warning<"version list contains duplicate entries">,
12342      InGroup<FunctionMultiVersioning>;
12343def warn_target_clone_no_impact_options
12344    : Warning<"version list contains entries that don't impact code generation">,
12345      InGroup<FunctionMultiVersioning>;
12346
12347// three-way comparison operator diagnostics
12348def err_implied_comparison_category_type_not_found : Error<
12349  "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
12350  "because type '%0' was not found; include <compare>">;
12351def err_spaceship_argument_narrowing : Error<
12352  "argument to 'operator<=>' "
12353  "%select{cannot be narrowed from type %1 to %2|"
12354  "evaluates to %1, which cannot be narrowed to type %2}0">;
12355def err_std_compare_type_not_supported : Error<
12356  "standard library implementation of %0 is not supported; "
12357   "%select{member '%2' does not have expected form|"
12358   "member '%2' is missing|"
12359   "the type is not trivially copyable|"
12360   "the type does not have the expected form}1">;
12361def note_rewriting_operator_as_spaceship : Note<
12362  "while rewriting comparison as call to 'operator<=>' declared here">;
12363def err_three_way_vector_comparison : Error<
12364  "three-way comparison between vectors is not supported">;
12365
12366// Memory Tagging Extensions (MTE) diagnostics
12367def err_memtag_arg_null_or_pointer : Error<
12368  "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
12369def err_memtag_any2arg_pointer : Error<
12370  "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
12371def err_memtag_arg_must_be_pointer : Error<
12372  "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
12373def err_memtag_arg_must_be_integer : Error<
12374  "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
12375
12376def warn_dereference_of_noderef_type : Warning<
12377  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
12378def warn_dereference_of_noderef_type_no_decl : Warning<
12379  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
12380def warn_noderef_on_non_pointer_or_array : Warning<
12381  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
12382def warn_noderef_to_dereferenceable_pointer : Warning<
12383  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
12384
12385def err_builtin_launder_invalid_arg : Error<
12386  "%select{non-pointer|function pointer|void pointer}0 argument to "
12387  "'__builtin_launder' is not allowed">;
12388def err_builtin_assume_aligned_invalid_arg : Error<
12389  "non-pointer argument to '__builtin_assume_aligned' is not allowed">;
12390
12391def err_builtin_is_within_lifetime_invalid_arg : Error<
12392  "%select{non-|function }0pointer argument to '__builtin_is_within_lifetime' "
12393  "is not allowed">;
12394
12395def err_builtin_invalid_arg_type: Error <
12396  "%ordinal0 argument must be "
12397  "%select{a vector, integer or floating point type|a matrix|"
12398  "a pointer to a valid matrix element type|"
12399  "a signed integer or floating point type|a vector type|"
12400  "a floating point type|"
12401  "a vector of integers|"
12402  "an unsigned integer|"
12403  "an 'int'|"
12404  "a vector of floating points}1 (was %2)">;
12405
12406def err_builtin_matrix_disabled: Error<
12407  "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
12408def err_matrix_index_not_integer: Error<
12409  "matrix %select{row|column}0 index is not an integer">;
12410def err_matrix_index_outside_range: Error<
12411  "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
12412def err_matrix_incomplete_index: Error<
12413  "single subscript expressions are not allowed for matrix values">;
12414def err_matrix_separate_incomplete_index: Error<
12415  "matrix row and column subscripts cannot be separated by any expression">;
12416def err_matrix_subscript_comma: Error<
12417  "comma expressions are not allowed as indices in matrix subscript expressions">;
12418def err_builtin_matrix_scalar_unsigned_arg: Error<
12419  "%0 argument must be a constant unsigned integer expression">;
12420def err_builtin_matrix_pointer_arg_mismatch: Error<
12421  "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
12422def err_builtin_matrix_store_to_const: Error<
12423  "cannot store matrix to read-only pointer">;
12424def err_builtin_matrix_stride_too_small: Error<
12425  "stride must be greater or equal to the number of rows">;
12426def err_builtin_matrix_invalid_dimension: Error<
12427  "%0 dimension is outside the allowed range [1, %1]">;
12428
12429def warn_mismatched_import : Warning<
12430  "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
12431  "previous declaration">,
12432  InGroup<IgnoredAttributes>;
12433def warn_import_on_definition : Warning<
12434  "import %select{module|name}0 cannot be applied to a function with a definition">,
12435  InGroup<IgnoredAttributes>;
12436
12437def err_preserve_field_info_not_field : Error<
12438  "__builtin_preserve_field_info argument %0 not a field access">;
12439def err_preserve_field_info_not_const: Error<
12440  "__builtin_preserve_field_info argument %0 not a constant">;
12441def err_btf_type_id_not_const: Error<
12442  "__builtin_btf_type_id argument %0 not a constant">;
12443def err_preserve_type_info_invalid : Error<
12444  "__builtin_preserve_type_info argument %0 invalid">;
12445def err_preserve_type_info_not_const: Error<
12446  "__builtin_preserve_type_info argument %0 not a constant">;
12447def err_preserve_enum_value_invalid : Error<
12448  "__builtin_preserve_enum_value argument %0 invalid">;
12449def err_preserve_enum_value_not_const: Error<
12450  "__builtin_preserve_enum_value argument %0 not a constant">;
12451
12452def err_bit_cast_non_trivially_copyable : Error<
12453  "'__builtin_bit_cast' %select{source|destination}0 type must be trivially copyable">;
12454def err_bit_cast_type_size_mismatch : Error<
12455  "size of '__builtin_bit_cast' source type %0 does not match destination type %1 (%2 vs %3 bytes)">;
12456
12457// SYCL-specific diagnostics
12458def warn_sycl_kernel_num_of_template_params : Warning<
12459  "'sycl_kernel' attribute only applies to a function template with at least"
12460  " two template parameters">, InGroup<IgnoredAttributes>;
12461def warn_sycl_kernel_invalid_template_param_type : Warning<
12462  "template parameter of a function template with the 'sycl_kernel' attribute"
12463  " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
12464def warn_sycl_kernel_num_of_function_params : Warning<
12465  "function template with 'sycl_kernel' attribute must have a single parameter">,
12466  InGroup<IgnoredAttributes>;
12467def warn_sycl_kernel_return_type : Warning<
12468  "function template with 'sycl_kernel' attribute must have a 'void' return type">,
12469  InGroup<IgnoredAttributes>;
12470def err_sycl_special_type_num_init_method : Error<
12471  "types with 'sycl_special_class' attribute must have one and only one '__init' "
12472  "method defined">;
12473
12474// SYCL kernel entry point diagnostics
12475def err_sycl_entry_point_invalid : Error<
12476  "'sycl_kernel_entry_point' attribute cannot be applied to a"
12477  " %select{non-static member function|variadic function|deleted function|"
12478           "defaulted function|constexpr function|consteval function|"
12479           "function declared with the 'noreturn' attribute|coroutine|"
12480           "function defined with a function try block}0">;
12481def err_sycl_entry_point_invalid_redeclaration : Error<
12482  "'sycl_kernel_entry_point' kernel name argument does not match prior"
12483  " declaration%diff{: $ vs $|}0,1">;
12484def err_sycl_kernel_name_conflict : Error<
12485  "'sycl_kernel_entry_point' kernel name argument conflicts with a previous"
12486  " declaration">;
12487def warn_sycl_kernel_name_not_a_class_type : Warning<
12488  "%0 is not a valid SYCL kernel name type; a non-union class type is required">,
12489  InGroup<DiagGroup<"nonportable-sycl">>, DefaultError;
12490def warn_sycl_entry_point_redundant_declaration : Warning<
12491  "redundant 'sycl_kernel_entry_point' attribute">, InGroup<RedundantAttribute>;
12492def err_sycl_entry_point_after_definition : Error<
12493  "'sycl_kernel_entry_point' attribute cannot be added to a function after the"
12494  " function is defined">;
12495def err_sycl_entry_point_return_type : Error<
12496  "'sycl_kernel_entry_point' attribute only applies to functions with a"
12497  " 'void' return type">;
12498def err_sycl_entry_point_deduced_return_type : Error<
12499  "'sycl_kernel_entry_point' attribute only applies to functions with a"
12500  " non-deduced 'void' return type">;
12501
12502def warn_cuda_maxclusterrank_sm_90 : Warning<
12503  "maxclusterrank requires sm_90 or higher, CUDA arch provided: %0, ignoring "
12504  "%1 attribute">, InGroup<IgnoredAttributes>;
12505
12506// VTable pointer authentication errors
12507def err_non_polymorphic_vtable_pointer_auth : Error<
12508  "cannot set vtable pointer authentication on monomorphic type %0">;
12509def err_incomplete_type_vtable_pointer_auth : Error<
12510  "cannot set vtable pointer authentication on an incomplete type %0">;
12511def err_non_top_level_vtable_pointer_auth : Error<
12512  "cannot set vtable pointer authentication on %0 which is a subclass of polymorphic type %1">;
12513def err_duplicated_vtable_pointer_auth : Error<
12514  "multiple vtable pointer authentication policies on %0">;
12515def err_invalid_authentication_key : Error<
12516  "invalid authentication key %0">;
12517def err_invalid_address_discrimination : Error<
12518  "invalid address discrimination mode %0">;
12519def err_invalid_extra_discrimination : Error<
12520  "invalid extra discrimination selection %0">;
12521def err_invalid_custom_discrimination : Error<
12522  "invalid custom discrimination">;
12523def err_missing_custom_discrimination : Error<
12524  "missing custom discrimination">;
12525def err_no_default_vtable_pointer_auth : Error<
12526  "cannot specify a default vtable pointer authentication "
12527  "%select{key|address discrimination mode|discriminator}0 with no default set"
12528>;
12529
12530def err_bit_int_bad_size : Error<"%select{signed|unsigned}0 _BitInt must "
12531                                 "have a bit size of at least %select{2|1}0">;
12532def err_bit_int_max_size : Error<"%select{signed|unsigned}0 _BitInt of bit "
12533                                 "sizes greater than %1 not supported">;
12534
12535// errors of expect.with.probability
12536def err_probability_not_constant_float : Error<
12537   "probability argument to __builtin_expect_with_probability must be constant "
12538   "floating-point expression">;
12539def err_probability_out_of_range : Error<
12540   "probability argument to __builtin_expect_with_probability is outside the "
12541   "range [0.0, 1.0]">;
12542
12543// TCB warnings
12544def err_tcb_conflicting_attributes : Error<
12545  "attributes '%0(\"%2\")' and '%1(\"%2\")' are mutually exclusive">;
12546def warn_tcb_enforcement_violation : Warning<
12547  "calling %0 is a violation of trusted computing base '%1'">,
12548  InGroup<DiagGroup<"tcb-enforcement">>;
12549
12550// RISC-V builtin required extension warning
12551def err_riscv_builtin_requires_extension : Error<
12552  "builtin requires%select{| at least one of the following extensions}0: %1">;
12553def err_riscv_builtin_invalid_lmul : Error<
12554  "LMUL argument must be in the range [0,3] or [5,7]">;
12555def err_riscv_type_requires_extension : Error<
12556  "RISC-V type %0 requires the '%1' extension"
12557>;
12558
12559def err_std_source_location_impl_not_found : Error<
12560  "'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called">;
12561def err_std_source_location_impl_malformed : Error<
12562  "'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'">;
12563
12564def err_std_initializer_list_malformed : Error<
12565  "%0 layout not recognized. Must be a non-polymorphic class type with no bases and two fields: a 'const E *' and either another 'const E *' or a 'std::size_t'">;
12566
12567// HLSL Diagnostics
12568def err_hlsl_attr_unsupported_in_stage : Error<"attribute %0 is unsupported in '%1' shaders, requires %select{|one of the following: }2%3">;
12569def err_hlsl_attr_invalid_type : Error<
12570   "attribute %0 only applies to a field or parameter of type '%1'">;
12571def err_hlsl_attr_invalid_ast_node : Error<
12572   "attribute %0 only applies to %1">;
12573def err_hlsl_entry_shader_attr_mismatch : Error<
12574   "%0 attribute on entry function does not match the target profile">;
12575def err_hlsl_numthreads_argument_oor : Error<"argument '%select{X|Y|Z}0' to numthreads attribute cannot exceed %1">;
12576def err_hlsl_numthreads_invalid : Error<"total number of threads cannot exceed %0">;
12577def err_hlsl_missing_numthreads : Error<"missing numthreads attribute for %0 shader entry">;
12578def err_hlsl_attribute_param_mismatch : Error<"%0 attribute parameters do not match the previous declaration">;
12579def err_hlsl_duplicate_parameter_modifier : Error<"duplicate parameter modifier %0">;
12580def err_hlsl_missing_semantic_annotation : Error<
12581  "semantic annotations must be present for all parameters of an entry "
12582  "function or patch constant function">;
12583def err_hlsl_init_priority_unsupported : Error<
12584  "initializer priorities are not supported in HLSL">;
12585
12586def warn_hlsl_user_defined_type_missing_member: Warning<"binding type '%select{t|u|b|s|c}0' only applies to types containing %select{SRV resources|UAV resources|constant buffer resources|sampler state|numeric types}0">, InGroup<LegacyConstantRegisterBinding>;
12587def err_hlsl_binding_type_mismatch: Error<"binding type '%select{t|u|b|s|c}0' only applies to %select{SRV resources|UAV resources|constant buffer resources|sampler state|numeric variables in the global scope}0">;
12588def err_hlsl_binding_type_invalid: Error<"binding type '%0' is invalid">;
12589def err_hlsl_duplicate_register_annotation: Error<"binding type '%select{t|u|b|s|c|i}0' cannot be applied more than once">;
12590def warn_hlsl_register_type_c_packoffset: Warning<"binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?">, InGroup<LegacyConstantRegisterBinding>, DefaultError;
12591def warn_hlsl_deprecated_register_type_b: Warning<"binding type 'b' only applies to constant buffers. The 'bool constant' binding type is no longer supported">, InGroup<LegacyConstantRegisterBinding>, DefaultError;
12592def warn_hlsl_deprecated_register_type_i: Warning<"binding type 'i' ignored. The 'integer constant' binding type is no longer supported">, InGroup<LegacyConstantRegisterBinding>, DefaultError;
12593def err_hlsl_unsupported_register_number : Error<"register number should be an integer">;
12594def err_hlsl_expected_space : Error<"invalid space specifier '%0' used; expected 'space' followed by an integer, like space1">;
12595def err_hlsl_space_on_global_constant : Error<"register space cannot be specified on global constants">;
12596def warn_hlsl_packoffset_mix : Warning<"cannot mix packoffset elements with nonpackoffset elements in a cbuffer">,
12597    InGroup<HLSLMixPackOffset>;
12598def err_hlsl_packoffset_overlap : Error<"packoffset overlap between %0, %1">;
12599def err_hlsl_packoffset_cross_reg_boundary : Error<"packoffset cannot cross register boundary">;
12600def err_hlsl_packoffset_alignment_mismatch : Error<"packoffset at 'y' not match alignment %0 required by %1">;
12601def err_hlsl_pointers_unsupported : Error<
12602  "%select{pointers|references}0 are unsupported in HLSL">;
12603def err_hlsl_missing_resource_class : Error<"HLSL resource needs to have [[hlsl::resource_class()]] attribute">;
12604def err_hlsl_attribute_needs_intangible_type: Error<"attribute %0 can be used only on HLSL intangible type %1">;
12605
12606def err_hlsl_operator_unsupported : Error<
12607  "the '%select{&|*|->}0' operator is unsupported in HLSL">;
12608
12609def err_hlsl_param_qualifier_mismatch :
12610  Error<"conflicting parameter qualifier %0 on parameter %1">;
12611def err_hlsl_vector_compound_assignment_truncation : Error<
12612  "left hand operand of type %0 to compound assignment cannot be truncated "
12613  "when used with right hand operand of type %1">;
12614
12615def warn_hlsl_impcast_vector_truncation : Warning<
12616  "implicit conversion truncates vector: %0 to %1">, InGroup<Conversion>;
12617
12618def warn_hlsl_availability : Warning<
12619  "%0 is only available %select{|in %4 environment }3on %1 %2 or newer">,
12620  InGroup<HLSLAvailability>, DefaultError;
12621def warn_hlsl_availability_unavailable :
12622  Warning<err_unavailable.Summary>,
12623  InGroup<HLSLAvailability>, DefaultError;
12624def error_hlsl_inout_scalar_extension : Error<"illegal scalar extension cast on argument %0 to %select{|in}1out paramemter">;
12625def error_hlsl_inout_lvalue : Error<"cannot bind non-lvalue argument %0 to %select{|in}1out paramemter">;
12626
12627def err_hlsl_export_not_on_function : Error<
12628  "export declaration can only be used on functions">;
12629
12630def err_hlsl_attribute_in_wrong_shader_model: Error<
12631  "attribute %0 requires shader model %1 or greater">;
12632
12633def warn_attr_min_eq_max:  Warning<
12634  "%0 attribute minimum and maximum arguments are equal">,
12635  InGroup<HLSLAttributeStatement>, DefaultError;
12636
12637def err_hlsl_attribute_number_arguments_insufficient_shader_model: Error<
12638  "attribute %0 with %1 arguments requires shader model %2 or greater">;
12639def err_hlsl_expect_arg_const_int_one_or_neg_one: Error<
12640  "argument %0 must be constant integer 1 or -1">;
12641def err_invalid_hlsl_resource_type: Error<
12642  "invalid __hlsl_resource_t type attributes">;
12643
12644// Layout randomization diagnostics.
12645def err_non_designated_init_used : Error<
12646  "a randomized struct can only be initialized with a designated initializer">;
12647def err_cast_from_randomized_struct : Error<
12648  "casting from randomized structure pointer type %0 to %1">;
12649
12650// Unsafe buffer usage diagnostics.
12651def warn_unsafe_buffer_variable : Warning<
12652  "%0 is an %select{unsafe pointer used for buffer access|unsafe buffer that "
12653  "does not perform bounds checks}1">,
12654  InGroup<UnsafeBufferUsage>, DefaultIgnore;
12655def warn_unsafe_buffer_operation : Warning<
12656  "%select{unsafe pointer operation|unsafe pointer arithmetic|"
12657  "unsafe buffer access|function introduces unsafe buffer manipulation|unsafe invocation of %1|"
12658  "field %1 prone to unsafe buffer manipulation}0">,
12659  InGroup<UnsafeBufferUsage>, DefaultIgnore;
12660def warn_unsafe_buffer_libc_call : Warning<
12661  "function %0 is unsafe">,
12662  InGroup<UnsafeBufferUsageInLibcCall>, DefaultIgnore;
12663def note_unsafe_buffer_printf_call : Note<
12664  "%select{|change to 'snprintf' for explicit bounds checking | buffer pointer and size may not match"
12665          "|string argument is not guaranteed to be null-terminated"
12666          "|'va_list' is unsafe}0">;
12667def note_unsafe_buffer_operation : Note<
12668  "used%select{| in pointer arithmetic| in buffer access}0 here">;
12669def note_unsafe_buffer_variable_fixit_group : Note<
12670  "change type of %0 to '%select{std::span' to preserve bounds information|std::array' to label it for hardening|std::span::iterator' to preserve bounds information}1%select{|, and change %2 to '%select{std::span|std::array|std::span::iterator}1' to propagate bounds information between them}3">;
12671def note_unsafe_buffer_variable_fixit_together : Note<
12672  "change type of %0 to '%select{std::span' to preserve bounds information|std::array' to label it for hardening|std::span::iterator' to preserve bounds information}1"
12673  "%select{|, and change %2 to safe types to make function %4 bounds-safe}3">;
12674def note_safe_buffer_usage_suggestions_disabled : Note<
12675  "pass -fsafe-buffer-usage-suggestions to receive code hardening suggestions">;
12676def warn_unsafe_buffer_usage_in_container : Warning<
12677  "the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information">,
12678  InGroup<UnsafeBufferUsageInContainer>, DefaultIgnore;
12679#ifndef NDEBUG
12680// Not a user-facing diagnostic. Useful for debugging false negatives in
12681// -fsafe-buffer-usage-suggestions (i.e. lack of -Wunsafe-buffer-usage fixits).
12682def note_safe_buffer_debug_mode : Note<"safe buffers debug: %0">;
12683#endif
12684
12685def err_builtin_pass_in_regs_non_class : Error<
12686  "argument %0 is not an unqualified class type">;
12687
12688
12689// WebAssembly reference type and table diagnostics.
12690def err_wasm_reference_pr : Error<
12691  "%select{pointer|reference}0 to WebAssembly reference type is not allowed">;
12692def err_wasm_ca_reference : Error<
12693  "cannot %select{capture|take address of}0 WebAssembly reference">;
12694def err_wasm_funcref_not_wasm : Error<
12695  "invalid use of '__funcref' keyword outside the WebAssembly triple">;
12696def err_wasm_table_pr : Error<
12697  "cannot form a %select{pointer|reference}0 to a WebAssembly table">;
12698def err_typecheck_wasm_table_must_have_zero_length : Error<
12699  "only zero-length WebAssembly tables are currently supported">;
12700def err_wasm_table_in_function : Error<
12701  "WebAssembly table cannot be declared within a function">;
12702def err_wasm_table_as_function_parameter : Error<
12703  "cannot use WebAssembly table as a function parameter">;
12704def err_wasm_table_invalid_uett_operand : Error<
12705  "invalid application of '%0' to WebAssembly table">;
12706def err_wasm_cast_table : Error<
12707  "cannot cast %select{to|from}0 a WebAssembly table">;
12708def err_wasm_table_conditional_expression : Error<
12709  "cannot use a WebAssembly table within a branch of a conditional expression">;
12710def err_wasm_table_art : Error<
12711  "cannot %select{assign|return|throw|subscript}0 a WebAssembly table">;
12712def err_wasm_reftype_tc : Error<
12713  "cannot %select{throw|catch}0 a WebAssembly reference type">;
12714def err_wasm_reftype_exception_spec : Error<
12715  "WebAssembly reference type not allowed in exception specification">;
12716def err_wasm_table_must_be_static : Error<
12717  "WebAssembly table must be static">;
12718def err_wasm_reftype_multidimensional_array : Error<
12719  "multi-dimensional arrays of WebAssembly references are not allowed">;
12720def err_wasm_builtin_arg_must_be_table_type : Error <
12721  "%ordinal0 argument must be a WebAssembly table">;
12722def err_wasm_builtin_arg_must_match_table_element_type : Error <
12723  "%ordinal0 argument must match the element type of the WebAssembly table in the %ordinal1 argument">;
12724def err_wasm_builtin_arg_must_be_integer_type : Error <
12725  "%ordinal0 argument must be an integer">;
12726
12727// OpenACC diagnostics.
12728def warn_acc_construct_unimplemented
12729    : Warning<"OpenACC construct '%0' not yet implemented, pragma ignored">,
12730      InGroup<SourceUsesOpenACC>;
12731def warn_acc_clause_unimplemented
12732    : Warning<"OpenACC clause '%0' not yet implemented, clause ignored">,
12733      InGroup<SourceUsesOpenACC>;
12734def err_acc_construct_appertainment
12735    : Error<"OpenACC construct '%0' cannot be used here; it can only "
12736            "be used in a statement context">;
12737def err_acc_clause_appertainment
12738    : Error<"OpenACC '%1' clause is not valid on '%0' directive">;
12739def err_acc_duplicate_clause_disallowed
12740    : Error<"OpenACC '%1' clause cannot appear more than once on a '%0' "
12741            "directive">;
12742def note_acc_previous_clause_here : Note<"previous clause is here">;
12743def note_acc_previous_expr_here : Note<"previous expression is here">;
12744def err_acc_branch_in_out_compute_construct
12745    : Error<"invalid %select{branch|return|throw}0 %select{out of|into}1 "
12746            "OpenACC Compute/Combined Construct">;
12747def note_acc_branch_into_compute_construct
12748    : Note<"invalid branch into OpenACC Compute/Combined Construct">;
12749def note_acc_branch_out_of_compute_construct
12750    : Note<"invalid branch out of OpenACC Compute/Combined Construct">;
12751def warn_acc_if_self_conflict
12752    : Warning<"OpenACC construct 'self' has no effect when an 'if' clause "
12753              "evaluates to true">,
12754      InGroup<DiagGroup<"openacc-self-if-potential-conflict">>;
12755def err_acc_int_expr_requires_integer
12756    : Error<"OpenACC %select{clause '%1'|directive '%2'|sub-array bound}0 "
12757            "requires expression of integer type (%3 invalid)">;
12758def err_acc_int_expr_incomplete_class_type
12759    : Error<"OpenACC integer expression has incomplete class type %0">;
12760def err_acc_int_expr_explicit_conversion
12761    : Error<"OpenACC integer expression requires explicit conversion "
12762            "from %0 to %1">;
12763def note_acc_int_expr_conversion
12764    : Note<"conversion to %select{integral|enumeration}0 type %1">;
12765def err_acc_int_expr_multiple_conversions
12766    : Error<"multiple conversions from expression type %0 to an integral type">;
12767def err_acc_num_gangs_num_args
12768    : Error<"%select{no|too many}0 integer expression arguments provided to "
12769            "OpenACC 'num_gangs' "
12770            "%select{|clause: '%1' directive expects maximum of %2, %3 were "
12771            "provided}0">;
12772def err_acc_not_a_var_ref
12773    : Error<"OpenACC variable is not a valid variable name, sub-array, array "
12774            "element,%select{| member of a composite variable,}0 or composite "
12775            "variable member">;
12776def err_acc_not_a_var_ref_use_device
12777    : Error<"OpenACC variable in 'use_device' clause is not a valid variable "
12778            "name or array name">;
12779def err_acc_typecheck_subarray_value
12780    : Error<"OpenACC sub-array subscripted value is not an array or pointer">;
12781def err_acc_subarray_function_type
12782    : Error<"OpenACC sub-array cannot be of function type %0">;
12783def err_acc_subarray_incomplete_type
12784    : Error<"OpenACC sub-array base is of incomplete type %0">;
12785def err_acc_subarray_no_length
12786    : Error<"OpenACC sub-array length is unspecified and cannot be inferred "
12787            "because the subscripted value is %select{not an array|an array of "
12788            "unknown bound}0">;
12789def err_acc_subarray_negative
12790    : Error<"OpenACC sub-array %select{lower bound|length}0 evaluated to "
12791            "negative value %1">;
12792def err_acc_subarray_out_of_range
12793    : Error<"OpenACC sub-array %select{lower bound|length}0 evaluated to a "
12794            "value (%1) that would be out of the range of the subscripted "
12795            "array size of %2">;
12796def err_acc_subarray_base_plus_length_out_of_range
12797    : Error<"OpenACC sub-array specified range [%0:%1] would be out of the "
12798            "range of the subscripted array size of %2">;
12799def warn_acc_deprecated_alias_name
12800    : Warning<"OpenACC clause name '%0' is a deprecated clause name and is "
12801              "now an alias for '%1'">,
12802      InGroup<DiagGroup<"openacc-deprecated-clause-alias">>;
12803def err_acc_var_not_pointer_type
12804    : Error<"expected pointer in '%0' clause, type is %1">;
12805def note_acc_expected_pointer_var : Note<"expected variable of pointer type">;
12806def err_acc_clause_after_device_type
12807    : Error<"OpenACC clause '%0' may not follow a '%1' clause in a "
12808            "'%2' construct">;
12809def err_acc_clause_cannot_combine
12810    : Error<"OpenACC clause '%0' may not appear on the same construct as a "
12811            "'%1' clause on a '%2' construct">;
12812def err_acc_reduction_num_gangs_conflict
12813    : Error<"OpenACC '%1' clause %select{|with more than 1 argument }0may not "
12814            "appear on a '%2' construct "
12815            "with a '%3' clause%select{ with more than 1 argument|}0">;
12816def err_acc_reduction_type
12817    : Error<"OpenACC 'reduction' variable must be of scalar type, sub-array, or a "
12818            "composite of scalar types;%select{| sub-array base}1 type is %0">;
12819def err_acc_reduction_composite_type
12820    : Error<"OpenACC 'reduction' variable must be a composite of scalar types; "
12821            "%1 %select{is not a class or struct|is incomplete|is not an "
12822            "aggregate}0">;
12823def err_acc_reduction_composite_member_type :Error<
12824    "OpenACC 'reduction' composite variable must not have non-scalar field">;
12825def note_acc_reduction_composite_member_loc : Note<"invalid field is here">;
12826def err_acc_loop_not_for_loop
12827    : Error<"OpenACC '%0' construct can only be applied to a 'for' loop">;
12828def note_acc_construct_here : Note<"'%0' construct is here">;
12829def err_acc_loop_spec_conflict
12830    : Error<"OpenACC clause '%0' on '%1' construct conflicts with previous "
12831            "data dependence clause">;
12832def err_acc_collapse_loop_count
12833    : Error<"OpenACC 'collapse' clause loop count must be a %select{constant "
12834            "expression|positive integer value, evaluated to %1}0">;
12835def err_acc_size_expr_value
12836    : Error<
12837          "OpenACC 'tile' clause size expression must be %select{an asterisk "
12838          "or a constant expression|positive integer value, evaluated to %1}0">;
12839def err_acc_invalid_in_loop
12840    : Error<"%select{OpenACC '%3' construct|while loop|do loop}0 cannot appear "
12841            "in intervening code of a '%1' with a '%2' clause">;
12842def note_acc_active_clause_here
12843    : Note<"active '%0' clause defined here">;
12844def err_acc_clause_multiple_loops
12845    : Error<"more than one for-loop in a loop associated with OpenACC '%0' "
12846            "construct with a '%1' clause">;
12847def err_acc_insufficient_loops
12848    : Error<"'%0' clause specifies a loop count greater than the number "
12849            "of available loops">;
12850def err_acc_intervening_code
12851    : Error<"inner loops must be tightly nested inside a '%0' clause on "
12852            "a '%1' construct">;
12853def err_acc_gang_multiple_elt
12854    : Error<"OpenACC 'gang' clause may have at most one %select{unnamed or "
12855            "'num'|'dim'|'static'}0 argument">;
12856def err_acc_int_arg_invalid
12857    : Error<"'%0' argument on '%1' clause is not permitted on a%select{|n "
12858            "orphaned}2 '%3' construct%select{| associated with a '%5' compute "
12859            "construct}4">;
12860def err_acc_gang_dim_value
12861    : Error<"argument to 'gang' clause dimension must be %select{a constant "
12862            "expression|1, 2, or 3: evaluated to %1}0">;
12863def err_acc_num_arg_conflict
12864    : Error<"'%0' argument to '%1' clause not allowed on a '%2' "
12865            "construct%select{| associated with a '%4' construct}3 that has a "
12866            "'%5' clause">;
12867def err_acc_num_arg_conflict_reverse
12868    : Error<"'%0' clause not allowed on a 'kernels loop' construct that "
12869            "has a '%1' clause with a%select{n| 'num'}2 argument">;
12870def err_acc_clause_in_clause_region
12871    : Error<"loop with a '%0' clause may not exist in the region of a '%1' "
12872            "clause%select{| on a '%3' construct}2">;
12873def err_acc_gang_reduction_conflict
12874    : Error<"%select{OpenACC 'gang' clause with a 'dim' value greater than "
12875            "1|OpenACC 'reduction' clause}0 cannot "
12876            "appear on the same '%1' construct as a %select{'reduction' "
12877            "clause|'gang' clause with a 'dim' value greater than 1}0">;
12878def err_acc_gang_reduction_numgangs_conflict
12879    : Error<"OpenACC '%0' clause cannot appear on the same '%2' construct as a "
12880            "'%1' clause %select{inside a compute construct with a|and a}3 "
12881            "'num_gangs' clause with more than one argument">;
12882
12883    def err_reduction_op_mismatch
12884    : Error<"OpenACC 'reduction' variable must have the same operator in all "
12885            "nested constructs (%0 vs %1)">;
12886def err_acc_loop_variable_type
12887    : Error<"loop variable of loop associated with an OpenACC '%0' construct "
12888            "must be of integer, pointer, or random-access-iterator type (is "
12889            "%1)">;
12890def err_acc_loop_variable
12891    : Error<"OpenACC '%0' construct must have initialization clause in "
12892            "canonical form ('var = init' or 'T var = init')">;
12893def err_acc_loop_terminating_condition
12894    : Error<"OpenACC '%0' construct must have a terminating condition">;
12895def err_acc_loop_not_monotonic
12896    : Error<"OpenACC '%0' variable must monotonically increase or decrease "
12897            "('++', '--', or compound assignment)">;
12898def err_acc_construct_one_clause_of
12899    : Error<"OpenACC '%0' construct must have at least one %1 clause">;
12900def err_acc_update_as_body
12901    : Error<"OpenACC 'update' construct may not appear in place of the "
12902            "statement following a%select{n if statement| while statement| do "
12903            "statement| switch statement| label statement}0">;
12904
12905// AMDGCN builtins diagnostics
12906def err_amdgcn_global_load_lds_size_invalid_value : Error<"invalid size value">;
12907def note_amdgcn_global_load_lds_size_valid_value : Note<"size must be %select{1, 2, or 4|1, 2, 4, 12 or 16}0">;
12908} // end of sema component.
12909