xref: /freebsd/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1//==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Semantic Analysis
11//===----------------------------------------------------------------------===//
12
13let Component = "Sema" in {
14let CategoryName = "Semantic Issue" in {
15def note_previous_decl : Note<"%0 declared here">;
16def note_entity_declared_at : Note<"%0 declared here">;
17def note_callee_decl : Note<"%0 declared here">;
18def note_defined_here : Note<"%0 defined here">;
19
20// For loop analysis
21def warn_variables_not_in_loop_body : Warning<
22  "variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 "
23  "used in loop condition not modified in loop body">,
24  InGroup<ForLoopAnalysis>, DefaultIgnore;
25def warn_redundant_loop_iteration : Warning<
26  "variable %0 is %select{decremented|incremented}1 both in the loop header "
27  "and in the loop body">,
28  InGroup<ForLoopAnalysis>, DefaultIgnore;
29def note_loop_iteration_here : Note<"%select{decremented|incremented}0 here">;
30
31def warn_duplicate_enum_values : Warning<
32  "element %0 has been implicitly assigned %1 which another element has "
33  "been assigned">, InGroup<DiagGroup<"duplicate-enum">>, DefaultIgnore;
34def note_duplicate_element : Note<"element %0 also has value %1">;
35
36// Absolute value functions
37def warn_unsigned_abs : Warning<
38  "taking the absolute value of unsigned type %0 has no effect">,
39  InGroup<AbsoluteValue>;
40def note_remove_abs : Note<
41  "remove the call to '%0' since unsigned values cannot be negative">;
42def warn_abs_too_small : Warning<
43  "absolute value function %0 given an argument of type %1 but has parameter "
44  "of type %2 which may cause truncation of value">, InGroup<AbsoluteValue>;
45def warn_wrong_absolute_value_type : Warning<
46  "using %select{integer|floating point|complex}1 absolute value function %0 "
47  "when argument is of %select{integer|floating point|complex}2 type">,
48  InGroup<AbsoluteValue>;
49def note_replace_abs_function : Note<"use function '%0' instead">;
50def warn_pointer_abs : Warning<
51  "taking the absolute value of %select{pointer|function|array}0 type %1 is suspicious">,
52  InGroup<AbsoluteValue>;
53
54def warn_max_unsigned_zero : Warning<
55  "taking the max of "
56  "%select{a value and unsigned zero|unsigned zero and a value}0 "
57  "is always equal to the other value">,
58  InGroup<MaxUnsignedZero>;
59def note_remove_max_call : Note<
60  "remove call to max function and unsigned zero argument">;
61
62def warn_infinite_recursive_function : Warning<
63  "all paths through this function will call itself">,
64  InGroup<InfiniteRecursion>, DefaultIgnore;
65
66def warn_comma_operator : Warning<"possible misuse of comma operator here">,
67  InGroup<DiagGroup<"comma">>, DefaultIgnore;
68def note_cast_to_void : Note<"cast expression to void to silence warning">;
69def note_cast_operand_to_int : Note<"cast one or both operands to int to silence this warning">;
70
71// Constant expressions
72def err_expr_not_ice : Error<
73  "expression is not an %select{integer|integral}0 constant expression">;
74def ext_expr_not_ice : Extension<
75  "expression is not an %select{integer|integral}0 constant expression; "
76  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
77def err_typecheck_converted_constant_expression : Error<
78  "value of type %0 is not implicitly convertible to %1">;
79def err_typecheck_converted_constant_expression_disallowed : Error<
80  "conversion from %0 to %1 is not allowed in a converted constant expression">;
81def err_typecheck_converted_constant_expression_indirect : Error<
82  "conversion from %0 to %1 in converted constant expression would "
83  "bind reference to a temporary">;
84def err_expr_not_cce : Error<
85  "%select{case value|enumerator value|non-type template argument|"
86  "array size|explicit specifier argument|noexcept specifier argument|"
87  "call to 'size()'|call to 'data()'}0 is not a constant expression">;
88def ext_cce_narrowing : ExtWarn<
89  "%select{case value|enumerator value|non-type template argument|"
90  "array size|explicit specifier argument|noexcept specifier argument}0 "
91  "%select{cannot be narrowed from type %2 to %3|"
92  "evaluates to %2, which cannot be narrowed to type %3}1">,
93  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
94def err_ice_not_integral : Error<
95  "%select{integer|integral}1 constant expression must have "
96  "%select{integer|integral or unscoped enumeration}1 type, not %0">;
97def err_ice_incomplete_type : Error<
98  "integral constant expression has incomplete class type %0">;
99def err_ice_explicit_conversion : Error<
100  "integral constant expression requires explicit conversion from %0 to %1">;
101def note_ice_conversion_here : Note<
102  "conversion to %select{integral|enumeration}0 type %1 declared here">;
103def err_ice_ambiguous_conversion : Error<
104  "ambiguous conversion from type %0 to an integral or unscoped "
105  "enumeration type">;
106def err_ice_too_large : Error<
107  "integer constant expression evaluates to value %0 that cannot be "
108  "represented in a %1-bit %select{signed|unsigned}2 integer type">;
109def err_expr_not_string_literal : Error<"expression is not a string literal">;
110
111// Semantic analysis of constant literals.
112def ext_predef_outside_function : Warning<
113  "predefined identifier is only valid inside function">,
114  InGroup<DiagGroup<"predefined-identifier-outside-function">>;
115def ext_init_from_predefined : ExtWarn<
116  "initializing an array from a '%0' predefined identifier is a Microsoft extension">,
117  InGroup<MicrosoftInitFromPredefined>;
118def ext_string_literal_from_predefined : ExtWarn<
119  "expansion of predefined identifier '%0' to a string literal is a Microsoft extension">,
120  InGroup<MicrosoftStringLiteralFromPredefined>;
121def warn_float_overflow : Warning<
122  "magnitude of floating-point constant too large for type %0; maximum is %1">,
123   InGroup<LiteralRange>;
124def warn_float_underflow : Warning<
125  "magnitude of floating-point constant too small for type %0; minimum is %1">,
126  InGroup<LiteralRange>;
127def warn_float_compare_literal : Warning<
128  "floating-point comparison is always %select{true|false}0; "
129  "constant cannot be represented exactly in type %1">,
130  InGroup<LiteralRange>;
131def warn_double_const_requires_fp64 : Warning<
132  "double precision constant requires %select{cl_khr_fp64|cl_khr_fp64 and __opencl_c_fp64}0, "
133  "casting to single precision">;
134def err_half_const_requires_fp16 : Error<
135  "half precision constant requires cl_khr_fp16">;
136
137// C99 variable-length arrays
138def ext_vla : Extension<"variable length arrays are a C99 feature">,
139  InGroup<VLAExtension>;
140// In C++ language modes, we warn by default as an extension, while in GNU++
141// language modes, we warn as an extension but add the warning group to -Wall.
142def ext_vla_cxx : ExtWarn<
143  "variable length arrays in C++ are a Clang extension">,
144  InGroup<VLACxxExtension>;
145def ext_vla_cxx_in_gnu_mode : Extension<ext_vla_cxx.Summary>,
146  InGroup<VLACxxExtension>;
147def ext_vla_cxx_static_assert : ExtWarn<
148  "variable length arrays in C++ are a Clang extension; did you mean to use "
149  "'static_assert'?">, InGroup<VLAUseStaticAssert>;
150def ext_vla_cxx_in_gnu_mode_static_assert : Extension<
151  ext_vla_cxx_static_assert.Summary>, InGroup<VLAUseStaticAssert>;
152def warn_vla_used : Warning<"variable length array used">,
153  InGroup<VLA>, DefaultIgnore;
154def err_vla_in_sfinae : Error<
155  "variable length array cannot be formed during template argument deduction">;
156def err_array_star_in_function_definition : Error<
157  "variable length array must be bound in function definition">;
158def err_vla_decl_in_file_scope : Error<
159  "variable length array declaration not allowed at file scope">;
160def err_vla_decl_has_static_storage : Error<
161  "variable length array declaration cannot have 'static' storage duration">;
162def err_vla_decl_has_extern_linkage : Error<
163  "variable length array declaration cannot have 'extern' linkage">;
164def ext_vla_folded_to_constant : ExtWarn<
165  "variable length array folded to constant array as an extension">,
166  InGroup<GNUFoldingConstant>;
167def err_vla_unsupported : Error<
168  "variable length arrays are not supported for %select{the current target|'%1'}0">;
169def err_vla_in_coroutine_unsupported : Error<
170  "variable length arrays in a coroutine are not supported">;
171def note_vla_unsupported : Note<
172  "variable length arrays are not supported for the current target">;
173
174// C99 variably modified types
175def err_variably_modified_template_arg : Error<
176  "variably modified type %0 cannot be used as a template argument">;
177def err_variably_modified_nontype_template_param : Error<
178  "non-type template parameter of variably modified type %0">;
179def err_variably_modified_new_type : Error<
180  "'new' cannot allocate object of variably modified type %0">;
181
182// C99 Designated Initializers
183def ext_designated_init : Extension<
184  "designated initializers are a C99 feature">, InGroup<C99Designator>;
185def err_array_designator_negative : Error<
186  "array designator value '%0' is negative">;
187def err_array_designator_empty_range : Error<
188  "array designator range [%0, %1] is empty">;
189def err_array_designator_non_array : Error<
190  "array designator cannot initialize non-array type %0">;
191def err_array_designator_too_large : Error<
192  "array designator index (%0) exceeds array bounds (%1)">;
193def err_field_designator_non_aggr : Error<
194  "field designator cannot initialize a "
195  "%select{non-struct, non-union|non-class}0 type %1">;
196def err_field_designator_unknown : Error<
197  "field designator %0 does not refer to any field in type %1">;
198def err_field_designator_nonfield : Error<
199  "field designator %0 does not refer to a non-static data member">;
200def note_field_designator_found : Note<"field designator refers here">;
201def err_designator_for_scalar_or_sizeless_init : Error<
202  "designator in initializer for %select{scalar|indivisible sizeless}0 "
203  "type %1">;
204def warn_initializer_overrides : Warning<
205  "initializer %select{partially |}0overrides prior initialization of "
206  "this subobject">, InGroup<InitializerOverrides>;
207def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Summary>,
208  InGroup<InitializerOverrides>, SFINAEFailure;
209def ext_initializer_union_overrides : ExtWarn<warn_initializer_overrides.Summary>,
210  InGroup<InitializerOverrides>, DefaultError, SFINAEFailure;
211def err_initializer_overrides_destructed : Error<
212  "initializer would partially override prior initialization of object of "
213  "type %1 with non-trivial destruction">;
214def note_previous_initializer : Note<
215  "previous initialization %select{|with side effects }0is here"
216  "%select{| (side effects will not occur at run time)}0">;
217def err_designator_into_flexible_array_member : Error<
218  "designator into flexible array member subobject">;
219def note_flexible_array_member : Note<
220  "initialized flexible array member %0 is here">;
221def ext_flexible_array_init : Extension<
222  "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
223
224// C++20 designated initializers
225def ext_cxx_designated_init : Extension<
226  "designated initializers are a C++20 extension">, InGroup<CXX20Designator>,
227  SuppressInSystemMacro;
228def warn_cxx17_compat_designated_init : Warning<
229  "designated initializers are incompatible with C++ standards before C++20">,
230  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
231def ext_designated_init_mixed : ExtWarn<
232  "mixture of designated and non-designated initializers in the same "
233  "initializer list is a C99 extension">, InGroup<C99Designator>;
234def note_designated_init_mixed : Note<
235  "first non-designated initializer is here">;
236def ext_designated_init_array : ExtWarn<
237  "array designators are a C99 extension">, InGroup<C99Designator>;
238def ext_designated_init_nested : ExtWarn<
239  "nested designators are a C99 extension">, InGroup<C99Designator>;
240def ext_designated_init_reordered : ExtWarn<
241  "ISO C++ requires field designators to be specified in declaration order; "
242  "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
243  SFINAEFailure;
244def note_previous_field_init : Note<
245  "previous initialization for field %0 is here">;
246def ext_designated_init_brace_elision : ExtWarn<
247  "brace elision for designated initializer is a C99 extension">,
248  InGroup<C99Designator>, SFINAEFailure;
249
250// Declarations.
251def ext_plain_complex : ExtWarn<
252  "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
253def ext_imaginary_constant : Extension<
254  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
255def ext_integer_complex : Extension<
256  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
257def ext_c23_auto_non_plain_identifier : Extension<
258  "type inference of a declaration other than a plain identifier with optional "
259  "trailing attributes is a Clang extension">,
260  InGroup<DiagGroup<"auto-decl-extensions">>;
261
262def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
263  "'_Fract' or '_Accum', not '%0'">;
264def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
265def err_invalid_width_spec : Error<
266  "'%select{|short|long|long long}0 %1' is invalid">;
267def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
268
269def ext_auto_type_specifier : ExtWarn<
270  "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
271def warn_auto_storage_class : Warning<
272  "'auto' storage class specifier is redundant and incompatible with C++11">,
273  InGroup<CXX11Compat>, DefaultIgnore;
274
275def warn_deprecated_register : Warning<
276  "'register' storage class specifier is deprecated "
277  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
278def ext_register_storage_class : ExtWarn<
279  "ISO C++17 does not allow 'register' storage class specifier">,
280  DefaultError, InGroup<Register>;
281
282def err_invalid_decl_spec_combination : Error<
283  "cannot combine with previous '%0' declaration specifier">;
284def err_invalid_vector_decl_spec_combination : Error<
285  "cannot combine with previous '%0' declaration specifier. "
286  "'__vector' must be first">;
287def err_invalid_pixel_decl_spec_combination : Error<
288  "'__pixel' must be preceded by '__vector'.  "
289  "'%0' declaration specifier not allowed here">;
290def err_invalid_vector_bool_decl_spec : Error<
291  "cannot use '%0' with '__vector bool'">;
292def err_invalid_vector_long_decl_spec : Error<
293  "cannot use 'long' with '__vector'">;
294def err_invalid_vector_float_decl_spec : Error<
295  "cannot use 'float' with '__vector'">;
296def err_invalid_vector_double_decl_spec : Error <
297  "use of 'double' with '__vector' requires VSX support to be enabled "
298  "(available on POWER7 or later)">;
299def err_invalid_vector_bool_int128_decl_spec : Error <
300  "use of '__int128' with '__vector bool' requires VSX support enabled (on "
301  "POWER10 or later)">;
302def err_invalid_vector_int128_decl_spec : Error<
303  "use of '__int128' with '__vector' requires extended Altivec support"
304  " (available on POWER8 or later)">;
305def err_invalid_vector_long_long_decl_spec : Error <
306  "use of 'long long' with '__vector' requires VSX support (available on "
307  "POWER7 or later) to be enabled">;
308def err_invalid_vector_long_double_decl_spec : Error<
309  "cannot use 'long double' with '__vector'">;
310def warn_vector_long_decl_spec_combination : Warning<
311  "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
312
313def err_redeclaration_different_type : Error<
314  "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
315def err_bad_variable_name : Error<
316  "%0 cannot be the name of a variable or data member">;
317def err_bad_parameter_name : Error<
318  "%0 cannot be the name of a parameter">;
319def err_bad_parameter_name_template_id : Error<
320  "parameter name cannot have template arguments">;
321def ext_parameter_name_omitted_c23 : ExtWarn<
322  "omitting the parameter name in a function definition is a C23 extension">,
323  InGroup<C23>;
324def err_anyx86_interrupt_attribute : Error<
325  "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
326  "have %select{a 'void' return type|"
327  "only a pointer parameter optionally followed by an integer parameter|"
328  "a pointer as the first parameter|a %2 type as the second parameter}1">;
329def err_anyx86_interrupt_called : Error<
330  "interrupt service routine cannot be called directly">;
331def warn_anyx86_excessive_regsave : Warning<
332  "%select{interrupt service routine|function with attribute"
333  " 'no_caller_saved_registers'}0 should only call a function"
334  " with attribute 'no_caller_saved_registers'"
335  " or be compiled with '-mgeneral-regs-only'">,
336  InGroup<DiagGroup<"excessive-regsave">>;
337def warn_arm_interrupt_calling_convention : Warning<
338   "call to function without interrupt attribute could clobber interruptee's VFP registers">,
339   InGroup<Extra>;
340def warn_interrupt_attribute_invalid : Warning<
341   "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
342   "functions that have %select{no parameters|a 'void' return type}1">,
343   InGroup<IgnoredAttributes>;
344def warn_riscv_repeated_interrupt_attribute : Warning<
345  "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
346def note_riscv_repeated_interrupt_attribute : Note<
347  "repeated RISC-V 'interrupt' attribute is here">;
348def warn_unused_parameter : Warning<"unused parameter %0">,
349  InGroup<UnusedParameter>, DefaultIgnore;
350def warn_unused_but_set_parameter : Warning<"parameter %0 set but not used">,
351  InGroup<UnusedButSetParameter>, DefaultIgnore;
352def warn_unused_variable : Warning<"unused variable %0">,
353  InGroup<UnusedVariable>, DefaultIgnore;
354def warn_unused_but_set_variable : Warning<"variable %0 set but not used">,
355  InGroup<UnusedButSetVariable>, DefaultIgnore;
356def warn_unused_local_typedef : Warning<
357  "unused %select{typedef|type alias}0 %1">,
358  InGroup<UnusedLocalTypedef>, DefaultIgnore;
359def warn_unused_property_backing_ivar :
360  Warning<"ivar %0 which backs the property is not "
361  "referenced in this property's accessor">,
362  InGroup<UnusedPropertyIvar>, DefaultIgnore;
363def warn_unused_const_variable : Warning<"unused variable %0">,
364  InGroup<UnusedConstVariable>, DefaultIgnore;
365def warn_unused_exception_param : Warning<"unused exception parameter %0">,
366  InGroup<UnusedExceptionParameter>, DefaultIgnore;
367def warn_decl_in_param_list : Warning<
368  "declaration of %0 will not be visible outside of this function">,
369  InGroup<Visibility>;
370def warn_redefinition_in_param_list : Warning<
371  "redefinition of %0 will not be visible outside of this function">,
372  InGroup<Visibility>;
373def warn_empty_parens_are_function_decl : Warning<
374  "empty parentheses interpreted as a function declaration">,
375  InGroup<VexingParse>;
376def warn_parens_disambiguated_as_function_declaration : Warning<
377  "parentheses were disambiguated as a function declaration">,
378  InGroup<VexingParse>;
379def warn_parens_disambiguated_as_variable_declaration : Warning<
380  "parentheses were disambiguated as redundant parentheses around declaration "
381  "of variable named %0">, InGroup<VexingParse>;
382def warn_redundant_parens_around_declarator : Warning<
383  "redundant parentheses surrounding declarator">,
384  InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
385def note_additional_parens_for_variable_declaration : Note<
386  "add a pair of parentheses to declare a variable">;
387def note_raii_guard_add_name : Note<
388  "add a variable name to declare a %0 initialized with %1">;
389def note_function_style_cast_add_parentheses : Note<
390  "add enclosing parentheses to perform a function-style cast">;
391def note_remove_parens_for_variable_declaration : Note<
392  "remove parentheses to silence this warning">;
393def note_empty_parens_function_call : Note<
394  "change this ',' to a ';' to call %0">;
395def note_empty_parens_default_ctor : Note<
396  "remove parentheses to declare a variable">;
397def note_empty_parens_zero_initialize : Note<
398  "replace parentheses with an initializer to declare a variable">;
399def warn_unused_function : Warning<"unused function %0">,
400  InGroup<UnusedFunction>, DefaultIgnore;
401def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
402  InGroup<UnusedTemplate>, DefaultIgnore;
403def warn_unused_member_function : Warning<"unused member function %0">,
404  InGroup<UnusedMemberFunction>, DefaultIgnore;
405def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
406  InGroup<UsedButMarkedUnused>, DefaultIgnore;
407def warn_unneeded_internal_decl : Warning<
408  "%select{function|variable}0 %1 is not needed and will not be emitted">,
409  InGroup<UnneededInternalDecl>, DefaultIgnore;
410def warn_unneeded_static_internal_decl : Warning<
411  "'static' function %0 declared in header file "
412  "should be declared 'static inline'">,
413  InGroup<UnneededInternalDecl>, DefaultIgnore;
414def warn_unneeded_member_function : Warning<
415  "member function %0 is not needed and will not be emitted">,
416  InGroup<UnneededMemberFunction>, DefaultIgnore;
417def warn_unused_private_field: Warning<"private field %0 is not used">,
418  InGroup<UnusedPrivateField>, DefaultIgnore;
419def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
420  "%select{used|required to be captured for this use}1">,
421  InGroup<UnusedLambdaCapture>, DefaultIgnore;
422
423def warn_reserved_extern_symbol: Warning<
424  "identifier %0 is reserved because %select{"
425  "<ERROR>|" // ReservedIdentifierStatus::NotReserved
426  "it starts with '_' at global scope|"
427  "it starts with '_' and has C language linkage|"
428  "it starts with '__'|"
429  "it starts with '_' followed by a capital letter|"
430  "it contains '__'}1">,
431  InGroup<ReservedIdentifier>, DefaultIgnore;
432def warn_deprecated_literal_operator_id: Warning<
433  "identifier %0 preceded by whitespace in a literal operator declaration "
434  "is deprecated">, InGroup<DeprecatedLiteralOperator>, DefaultIgnore;
435def warn_reserved_module_name : Warning<
436  "%0 is a reserved name for a module">, InGroup<ReservedModuleIdentifier>;
437
438def warn_parameter_size: Warning<
439  "%0 is a large (%1 bytes) pass-by-value argument; "
440  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
441def warn_return_value_size: Warning<
442  "return value of %0 is a large (%1 bytes) pass-by-value object; "
443  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
444def warn_return_value_udt: Warning<
445  "%0 has C-linkage specified, but returns user-defined type %1 which is "
446  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
447def warn_return_value_udt_incomplete: Warning<
448  "%0 has C-linkage specified, but returns incomplete type %1 which could be "
449  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
450def warn_implicit_function_decl : Warning<
451  "implicit declaration of function %0">,
452  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
453def ext_implicit_function_decl_c99 : ExtWarn<
454  "call to undeclared function %0; ISO C99 and later do not support implicit "
455  "function declarations">, InGroup<ImplicitFunctionDeclare>;
456def note_function_suggestion : Note<"did you mean %0?">;
457
458def err_ellipsis_first_param : Error<
459  "ISO C requires a named parameter before '...'">;
460def err_declarator_need_ident : Error<"declarator requires an identifier">;
461def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
462def ext_use_out_of_scope_declaration : ExtWarn<
463  "use of out-of-scope declaration of %0%select{| whose type is not "
464  "compatible with that of an implicit declaration}1">,
465  InGroup<DiagGroup<"out-of-scope-function">>;
466def err_inline_non_function : Error<
467  "'inline' can only appear on functions%select{| and non-local variables}0">;
468def err_noreturn_non_function : Error<
469  "'_Noreturn' can only appear on functions">;
470def warn_qual_return_type : Warning<
471  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
472  InGroup<IgnoredQualifiers>, DefaultIgnore;
473def warn_deprecated_redundant_constexpr_static_def : Warning<
474  "out-of-line definition of constexpr static data member is redundant "
475  "in C++17 and is deprecated">,
476  InGroup<DeprecatedRedundantConstexprStaticDef>, DefaultIgnore;
477
478def warn_decl_shadow :
479  Warning<"declaration shadows a %select{"
480          "local variable|"
481          "variable in %2|"
482          "static data member of %2|"
483          "field of %2|"
484          "typedef in %2|"
485          "type alias in %2|"
486          "structured binding}1">,
487  InGroup<Shadow>, DefaultIgnore, SuppressInSystemMacro;
488def warn_decl_shadow_uncaptured_local :
489  Warning<warn_decl_shadow.Summary>,
490  InGroup<ShadowUncapturedLocal>, DefaultIgnore;
491def warn_ctor_parm_shadows_field:
492  Warning<"constructor parameter %0 shadows the field %1 of %2">,
493  InGroup<ShadowFieldInConstructor>, DefaultIgnore;
494def warn_modifying_shadowing_decl :
495  Warning<"modifying constructor parameter %0 that shadows a "
496          "field of %1">,
497  InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
498
499// C++ decomposition declarations
500def err_decomp_decl_context : Error<
501  "decomposition declaration not permitted in this context">;
502def warn_cxx14_compat_decomp_decl : Warning<
503  "decomposition declarations are incompatible with "
504  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
505def ext_decomp_decl : ExtWarn<
506  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
507def ext_decomp_decl_cond : ExtWarn<
508  "ISO C++17 does not permit structured binding declaration in a condition">,
509  InGroup<DiagGroup<"binding-in-condition">>;
510def err_decomp_decl_spec : Error<
511  "decomposition declaration cannot be declared "
512  "%plural{1:'%1'|:with '%1' specifiers}0">;
513def ext_decomp_decl_spec : ExtWarn<
514  "decomposition declaration declared "
515  "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
516  InGroup<CXX20>;
517def warn_cxx17_compat_decomp_decl_spec : Warning<
518  "decomposition declaration declared "
519  "%plural{1:'%1'|:with '%1' specifiers}0 "
520  "is incompatible with C++ standards before C++20">,
521  InGroup<CXXPre20Compat>, DefaultIgnore;
522def err_decomp_decl_type : Error<
523  "decomposition declaration cannot be declared with type %0; "
524  "declared type must be 'auto' or reference to 'auto'">;
525def err_decomp_decl_constraint : Error<
526  "decomposition declaration cannot be declared with constrained 'auto'">;
527def err_decomp_decl_parens : Error<
528  "decomposition declaration cannot be declared with parentheses">;
529def err_decomp_decl_template : Error<
530  "decomposition declaration template not supported">;
531def err_decomp_decl_not_alone : Error<
532  "decomposition declaration must be the only declaration in its group">;
533def err_decomp_decl_requires_init : Error<
534  "decomposition declaration %0 requires an initializer">;
535def err_decomp_decl_wrong_number_bindings : Error<
536  "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
537  "%select{%plural{0:no|:only %1}1|%1}4 "
538  "%plural{1:name was|:names were}1 provided">;
539def err_decomp_decl_unbindable_type : Error<
540  "cannot decompose %select{union|non-class, non-array}1 type %2">;
541def err_decomp_decl_multiple_bases_with_members : Error<
542  "cannot decompose class type %1: "
543  "%select{its base classes %2 and|both it and its base class}0 %3 "
544  "have non-static data members">;
545def err_decomp_decl_ambiguous_base : Error<
546  "cannot decompose members of ambiguous base class %1 of %0:%2">;
547def err_decomp_decl_inaccessible_base : Error<
548  "cannot decompose members of inaccessible base class %1 of %0">,
549  AccessControl;
550def err_decomp_decl_inaccessible_field : Error<
551  "cannot decompose %select{private|protected}0 member %1 of %3">,
552  AccessControl;
553def err_decomp_decl_lambda : Error<
554  "cannot decompose lambda closure type">;
555def err_decomp_decl_anon_union_member : Error<
556  "cannot decompose class type %0 because it has an anonymous "
557  "%select{struct|union}1 member">;
558def err_decomp_decl_std_tuple_element_not_specialized : Error<
559  "cannot decompose this type; 'std::tuple_element<%0>::type' "
560  "does not name a type">;
561def err_decomp_decl_std_tuple_size_not_constant : Error<
562  "cannot decompose this type; 'std::tuple_size<%0>::value' "
563  "is not a valid integral constant expression">;
564def note_in_binding_decl_init : Note<
565  "in implicit initialization of binding declaration %0">;
566
567def err_std_type_trait_not_class_template : Error<
568  "unsupported standard library implementation: "
569  "'std::%0' is not a class template">;
570
571// C++ using declarations
572def err_using_requires_qualname : Error<
573  "using declaration requires a qualified name">;
574def err_using_typename_non_type : Error<
575  "'typename' keyword used on a non-type">;
576def err_using_dependent_value_is_type : Error<
577  "dependent using declaration resolved to type without 'typename'">;
578def err_using_decl_nested_name_specifier_is_not_class : Error<
579  "using declaration in class refers into '%0', which is not a class">;
580def warn_cxx17_compat_using_decl_non_member_enumerator : Warning<
581  "member using declaration naming non-class '%0' enumerator is "
582  "incompatible with C++ standards before C++20">, InGroup<CXXPre20Compat>,
583  DefaultIgnore;
584def err_using_decl_nested_name_specifier_is_current_class : Error<
585  "using declaration refers to its own class">;
586def err_using_decl_nested_name_specifier_is_not_base_class : Error<
587  "using declaration refers into '%0', which is not a base class of %1">;
588def err_using_decl_constructor_not_in_direct_base : Error<
589  "%0 is not a direct base of %1, cannot inherit constructors">;
590def err_using_decl_can_not_refer_to_class_member : Error<
591  "using declaration cannot refer to class member">;
592def warn_cxx17_compat_using_decl_class_member_enumerator : Warning<
593  "member using declaration naming a non-member enumerator is incompatible "
594  "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
595def err_using_enum_is_dependent : Error<
596  "using-enum cannot name a dependent type">;
597def err_using_enum_not_enum : Error<
598  "%0 is not an enumerated type">;
599def err_ambiguous_inherited_constructor : Error<
600  "constructor of %0 inherited from multiple base class subobjects">;
601def note_ambiguous_inherited_constructor_using : Note<
602  "inherited from base class %0 here">;
603def note_using_decl_class_member_workaround : Note<
604  "use %select{an alias declaration|a typedef declaration|a reference|"
605  "a const variable|a constexpr variable}0 instead">;
606def err_using_decl_can_not_refer_to_namespace : Error<
607  "using declaration cannot refer to a namespace">;
608def warn_cxx17_compat_using_decl_scoped_enumerator: Warning<
609  "using declaration naming a scoped enumerator is incompatible with "
610  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
611def ext_using_decl_scoped_enumerator : ExtWarn<
612  "using declaration naming a scoped enumerator is a C++20 extension">,
613  InGroup<CXX20>;
614def err_using_decl_constructor : Error<
615  "using declaration cannot refer to a constructor">;
616def warn_cxx98_compat_using_decl_constructor : Warning<
617  "inheriting constructors are incompatible with C++98">,
618  InGroup<CXX98Compat>, DefaultIgnore;
619def err_using_decl_destructor : Error<
620  "using declaration cannot refer to a destructor">;
621def err_using_decl_template_id : Error<
622  "using declaration cannot refer to a template specialization">;
623def note_using_decl_target : Note<"target of using declaration">;
624def note_using_decl_conflict : Note<"conflicting declaration">;
625def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
626def err_using_decl_conflict : Error<
627  "target of using declaration conflicts with declaration already in scope">;
628def err_using_decl_conflict_reverse : Error<
629  "declaration conflicts with target of using declaration already in scope">;
630def note_using_decl : Note<"%select{|previous }0using declaration">;
631def err_using_decl_redeclaration_expansion : Error<
632  "using declaration pack expansion at block scope produces multiple values">;
633def err_use_of_empty_using_if_exists : Error<
634  "reference to unresolved using declaration">;
635def note_empty_using_if_exists_here : Note<
636  "using declaration annotated with 'using_if_exists' here">;
637def err_using_if_exists_on_ctor : Error<
638  "'using_if_exists' attribute cannot be applied to an inheriting constructor">;
639def err_using_enum_decl_redeclaration : Error<
640  "redeclaration of using-enum declaration">;
641def note_using_enum_decl : Note<"%select{|previous }0using-enum declaration">;
642
643def warn_access_decl_deprecated : Warning<
644  "access declarations are deprecated; use using declarations instead">,
645  InGroup<Deprecated>;
646def err_access_decl : Error<
647  "ISO C++11 does not allow access declarations; "
648  "use using declarations instead">;
649def warn_deprecated_copy : Warning<
650  "definition of implicit copy %select{constructor|assignment operator}1 "
651  "for %0 is deprecated because it has a user-declared copy "
652  "%select{assignment operator|constructor}1">,
653  InGroup<DeprecatedCopy>, DefaultIgnore;
654def warn_deprecated_copy_with_dtor : Warning<
655  "definition of implicit copy %select{constructor|assignment operator}1 "
656  "for %0 is deprecated because it has a user-declared destructor">,
657  InGroup<DeprecatedCopyWithDtor>, DefaultIgnore;
658def warn_deprecated_copy_with_user_provided_copy: Warning<
659  "definition of implicit copy %select{constructor|assignment operator}1 "
660  "for %0 is deprecated because it has a user-provided copy "
661  "%select{assignment operator|constructor}1">,
662  InGroup<DeprecatedCopyWithUserProvidedCopy>, DefaultIgnore;
663def warn_deprecated_copy_with_user_provided_dtor : Warning<
664  "definition of implicit copy %select{constructor|assignment operator}1 "
665  "for %0 is deprecated because it has a user-provided destructor">,
666  InGroup<DeprecatedCopyWithUserProvidedDtor>, DefaultIgnore;
667def warn_cxx17_compat_exception_spec_in_signature : Warning<
668  "mangled name of %0 will change in C++17 due to non-throwing exception "
669  "specification in function signature">, InGroup<CXX17CompatMangling>;
670
671def warn_global_constructor : Warning<
672  "declaration requires a global constructor">,
673  InGroup<GlobalConstructors>, DefaultIgnore;
674def warn_global_destructor : Warning<
675  "declaration requires a global destructor">,
676   InGroup<GlobalConstructors>, DefaultIgnore;
677def warn_exit_time_destructor : Warning<
678  "declaration requires an exit-time destructor">,
679  InGroup<ExitTimeDestructors>, DefaultIgnore;
680
681def err_invalid_thread : Error<
682  "'%0' is only allowed on variable declarations">;
683def err_thread_non_global : Error<
684  "'%0' variables must have global storage">;
685def err_thread_unsupported : Error<
686  "thread-local storage is not supported for the current target">;
687
688// FIXME: Combine fallout warnings to just one warning.
689def warn_maybe_falloff_nonvoid_function : Warning<
690  "non-void function does not return a value in all control paths">,
691  InGroup<ReturnType>;
692def warn_falloff_nonvoid_function : Warning<
693  "non-void function does not return a value">,
694  InGroup<ReturnType>;
695def err_maybe_falloff_nonvoid_block : Error<
696  "non-void block does not return a value in all control paths">;
697def err_falloff_nonvoid_block : Error<
698  "non-void block does not return a value">;
699def warn_maybe_falloff_nonvoid_coroutine : Warning<
700  "non-void coroutine does not return a value in all control paths">,
701  InGroup<ReturnType>;
702def warn_falloff_nonvoid_coroutine : Warning<
703  "non-void coroutine does not return a value">,
704  InGroup<ReturnType>;
705def warn_suggest_noreturn_function : Warning<
706  "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
707  InGroup<MissingNoreturn>, DefaultIgnore;
708def warn_suggest_noreturn_block : Warning<
709  "block could be declared with attribute 'noreturn'">,
710  InGroup<MissingNoreturn>, DefaultIgnore;
711
712// Unreachable code.
713def warn_unreachable : Warning<
714  "code will never be executed">,
715  InGroup<UnreachableCode>, DefaultIgnore;
716def warn_unreachable_break : Warning<
717  "'break' will never be executed">,
718  InGroup<UnreachableCodeBreak>, DefaultIgnore;
719def warn_unreachable_return : Warning<
720  "'return' will never be executed">,
721  InGroup<UnreachableCodeReturn>, DefaultIgnore;
722def warn_unreachable_loop_increment : Warning<
723  "loop will run at most once (loop increment never executed)">,
724  InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
725def warn_unreachable_fallthrough_attr : Warning<
726  "fallthrough annotation in unreachable code">,
727  InGroup<UnreachableCodeFallthrough>, DefaultIgnore;
728def note_unreachable_silence : Note<
729  "silence by adding parentheses to mark code as explicitly dead">;
730def warn_unreachable_association : Warning<
731  "due to lvalue conversion of the controlling expression, association of type "
732  "%0 will never be selected because it is %select{of array type|qualified}1">,
733  InGroup<UnreachableCodeGenericAssoc>;
734
735/// Built-in functions.
736def ext_implicit_lib_function_decl : ExtWarn<
737  "implicitly declaring library function '%0' with type %1">,
738  InGroup<ImplicitFunctionDeclare>;
739def ext_implicit_lib_function_decl_c99 : ExtWarn<
740  "call to undeclared library function '%0' with type %1; ISO C99 and later "
741  "do not support implicit function declarations">,
742  InGroup<ImplicitFunctionDeclare>;
743def note_include_header_or_declare : Note<
744  "include the header <%0> or explicitly provide a declaration for '%1'">;
745def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
746def warn_implicit_decl_no_jmp_buf
747    : Warning<"declaration of built-in function '%0' requires the declaration"
748    " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
749      InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
750def warn_implicit_decl_requires_sysheader : Warning<
751  "declaration of built-in function '%1' requires inclusion of the header <%0>">,
752  InGroup<BuiltinRequiresHeader>;
753def warn_redecl_library_builtin : Warning<
754  "incompatible redeclaration of library function %0">,
755  InGroup<DiagGroup<"incompatible-library-redeclaration">>;
756def err_builtin_definition : Error<"definition of builtin function %0">;
757def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
758def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
759def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
760  "%select{GCP|CDE}1">;
761def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
762def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
763def err_invalid_cpu_specific_dispatch_value : Error<
764"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
765def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
766  InGroup<ImplicitFunctionDeclare>, DefaultError;
767def warn_cstruct_memaccess : Warning<
768  "%select{destination for|source of|first operand of|second operand of}0 this "
769  "%1 call is a pointer to record %2 that is not trivial to "
770  "%select{primitive-default-initialize|primitive-copy}3">,
771  InGroup<NonTrivialMemaccess>;
772def note_nontrivial_field : Note<
773  "field is non-trivial to %select{copy|default-initialize}0">;
774def err_non_trivial_c_union_in_invalid_context : Error<
775  "cannot %select{"
776  "use type %1 for a function/method parameter|"
777  "use type %1 for function/method return|"
778  "default-initialize an object of type %1|"
779  "declare an automatic variable of type %1|"
780  "copy-initialize an object of type %1|"
781  "assign to a variable of type %1|"
782  "construct an automatic compound literal of type %1|"
783  "capture a variable of type %1|"
784  "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
785  "}3 "
786  "since it %select{contains|is}2 a union that is non-trivial to "
787  "%select{default-initialize|destruct|copy}0">;
788def note_non_trivial_c_union : Note<
789  "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
790  "non-trivial to %select{default-initialize|destruct|copy}1">;
791def warn_dyn_class_memaccess : Warning<
792  "%select{destination for|source of|first operand of|second operand of}0 this "
793  "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
794  "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
795  InGroup<DynamicClassMemaccess>;
796def note_bad_memaccess_silence : Note<
797  "explicitly cast the pointer to silence this warning">;
798def warn_sizeof_pointer_expr_memaccess : Warning<
799  "'%0' call operates on objects of type %1 while the size is based on a "
800  "different type %2">,
801  InGroup<SizeofPointerMemaccess>;
802def warn_sizeof_pointer_expr_memaccess_note : Note<
803  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
804  "it by the number of elements)|remove the addressof in the argument to "
805  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
806  "length}0?">;
807def warn_sizeof_pointer_type_memaccess : Warning<
808  "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
809  "%select{destination|source}2; expected %3 or an explicit length">,
810  InGroup<SizeofPointerMemaccess>;
811def warn_strlcpycat_wrong_size : Warning<
812  "size argument in %0 call appears to be size of the source; "
813  "expected the size of the destination">,
814  InGroup<DiagGroup<"strlcpy-strlcat-size">>;
815def note_strlcpycat_wrong_size : Note<
816  "change size argument to be the size of the destination">;
817def warn_memsize_comparison : Warning<
818  "size argument in %0 call is a comparison">,
819  InGroup<DiagGroup<"memsize-comparison">>;
820def note_memsize_comparison_paren : Note<
821  "did you mean to compare the result of %0 instead?">;
822def note_memsize_comparison_cast_silence : Note<
823  "explicitly cast the argument to size_t to silence this warning">;
824def warn_suspicious_sizeof_memset : Warning<
825  "%select{'size' argument to memset is '0'|"
826  "setting buffer to a 'sizeof' expression}0"
827  "; did you mean to transpose the last two arguments?">,
828  InGroup<MemsetTransposedArgs>;
829def note_suspicious_sizeof_memset_silence : Note<
830  "%select{parenthesize the third argument|"
831  "cast the second argument to 'int'}0 to silence">;
832def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
833  InGroup<SuspiciousBzero>;
834def note_suspicious_bzero_size_silence : Note<
835  "parenthesize the second argument to silence">;
836
837def warn_strncat_large_size : Warning<
838  "the value of the size argument in 'strncat' is too large, might lead to a "
839  "buffer overflow">, InGroup<StrncatSize>;
840def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
841  "to be size of the source">, InGroup<StrncatSize>;
842def warn_strncat_wrong_size : Warning<
843  "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
844def note_strncat_wrong_size : Note<
845  "change the argument to be the free space in the destination buffer minus "
846  "the terminating null byte">;
847
848def warn_assume_side_effects : Warning<
849  "the argument to %0 has side effects that will be discarded">,
850  InGroup<DiagGroup<"assume">>;
851def warn_assume_attribute_string_unknown : Warning<
852  "unknown assumption string '%0'; attribute is potentially ignored">,
853  InGroup<UnknownAssumption>;
854def warn_assume_attribute_string_unknown_suggested : Warning<
855  "unknown assumption string '%0' may be misspelled; attribute is potentially "
856  "ignored, did you mean '%1'?">,
857  InGroup<MisspelledAssumption>;
858
859def warn_builtin_chk_overflow : Warning<
860  "'%0' will always overflow; destination buffer has size %1,"
861  " but size argument is %2">,
862  InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
863
864def warn_fortify_source_overflow
865  : Warning<warn_builtin_chk_overflow.Summary>, InGroup<FortifySource>;
866def warn_fortify_source_size_mismatch : Warning<
867  "'%0' size argument is too large; destination buffer has size %1,"
868  " but size argument is %2">, InGroup<FortifySource>;
869
870def warn_fortify_strlen_overflow: Warning<
871  "'%0' will always overflow; destination buffer has size %1,"
872  " but the source string has length %2 (including NUL byte)">,
873  InGroup<FortifySource>;
874
875def subst_format_overflow : TextSubstitution<
876  "'%0' will always overflow; destination buffer has size %1,"
877  " but format string expands to at least %2">;
878
879def warn_format_overflow : Warning<
880  "%sub{subst_format_overflow}0,1,2">,
881  InGroup<FormatOverflow>;
882
883def warn_format_overflow_non_kprintf : Warning<
884  "%sub{subst_format_overflow}0,1,2">,
885  InGroup<FormatOverflowNonKprintf>;
886
887def subst_format_truncation: TextSubstitution<
888  "'%0' will always be truncated; specified size is %1,"
889  " but format string expands to at least %2">;
890
891def warn_format_truncation: Warning<
892  "%sub{subst_format_truncation}0,1,2">,
893  InGroup<FormatTruncation>;
894
895def warn_format_truncation_non_kprintf: Warning<
896  "%sub{subst_format_truncation}0,1,2">,
897  InGroup<FormatTruncationNonKprintf>;
898
899def warn_fortify_scanf_overflow : Warning<
900  "'%0' may overflow; destination buffer in argument %1 has size "
901  "%2, but the corresponding specifier may require size %3">,
902  InGroup<FortifySource>;
903
904def err_function_start_invalid_type: Error<
905  "argument must be a function">;
906
907/// main()
908// static main() is not an error in C, just in C++.
909def warn_static_main : Warning<"'main' should not be declared static">,
910    InGroup<Main>;
911def err_static_main : Error<"'main' is not allowed to be declared static">;
912def err_inline_main : Error<"'main' is not allowed to be declared inline">;
913def ext_variadic_main : ExtWarn<
914  "'main' is not allowed to be declared variadic">, InGroup<Main>;
915def ext_noreturn_main : ExtWarn<
916  "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
917def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
918def err_constexpr_main : Error<
919  "'main' is not allowed to be declared %select{constexpr|consteval}0">;
920def err_deleted_main : Error<"'main' is not allowed to be deleted">;
921def err_mainlike_template_decl : Error<"%0 cannot be a template">;
922def err_main_returns_nonint : Error<"'main' must return 'int'">;
923def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
924    InGroup<MainReturnType>;
925def note_main_change_return_type : Note<"change return type to 'int'">;
926def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
927    "must be 0, 2, or 3">;
928def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
929    InGroup<Main>;
930def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
931    "parameter of 'main' (%select{argument count|argument array|environment|"
932    "platform-specific data}0) must be of type %1">;
933def warn_main_returns_bool_literal : Warning<"bool literal returned from "
934    "'main'">, InGroup<Main>;
935def err_main_global_variable :
936    Error<"main cannot be declared as global variable">;
937def warn_main_redefined : Warning<"variable named 'main' with external linkage "
938    "has undefined behavior">, InGroup<Main>;
939def ext_main_used : Extension<
940  "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
941
942/// parser diagnostics
943def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
944  InGroup<MissingDeclarations>;
945def err_no_declarators : Error<"declaration does not declare anything">;
946def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
947  InGroup<MissingDeclarations>;
948def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
949
950def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
951  "anonymous non-C-compatible type given name for linkage purposes "
952  "by %select{typedef|alias}0 declaration; "
953  "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
954def err_non_c_like_anon_struct_in_typedef : Error<
955  "anonymous non-C-compatible type given name for linkage purposes "
956  "by %select{typedef|alias}0 declaration after its linkage was computed; "
957  "add a tag name here to establish linkage prior to definition">;
958def err_typedef_changes_linkage : Error<
959  "unsupported: anonymous type given name for linkage purposes "
960  "by %select{typedef|alias}0 declaration after its linkage was computed; "
961  "add a tag name here to establish linkage prior to definition">;
962def note_non_c_like_anon_struct : Note<
963  "type is not C-compatible due to this "
964  "%select{base class|default member initializer|lambda expression|"
965  "friend declaration|member declaration}0">;
966def note_typedef_for_linkage_here : Note<
967  "type is given name %0 for linkage purposes by this "
968  "%select{typedef|alias}1 declaration">;
969
970def err_statically_allocated_object : Error<
971  "interface type cannot be statically allocated">;
972def err_object_cannot_be_passed_returned_by_value : Error<
973  "interface type %1 cannot be %select{returned|passed}0 by value"
974  "; did you forget * in %1?">;
975def err_parameters_retval_cannot_have_fp16_type : Error<
976  "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
977def err_opencl_half_load_store : Error<
978  "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
979  "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
980def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
981def err_opencl_half_declaration : Error<
982  "declaring variable of type %0 is not allowed">;
983def err_opencl_invalid_param : Error<
984  "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
985def err_opencl_invalid_return : Error<
986  "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
987def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
988def warn_pragma_options_align_reset_failed : Warning<
989  "#pragma options align=reset failed: %0">,
990  InGroup<IgnoredPragmas>;
991def err_pragma_options_align_mac68k_target_unsupported : Error<
992  "mac68k alignment pragma is not supported on this target">;
993def warn_pragma_align_not_xl_compatible : Warning<
994  "#pragma align(packed) may not be compatible with objects generated with AIX XL C/C++">,
995  InGroup<AIXCompat>;
996def warn_pragma_pack_invalid_alignment : Warning<
997  "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
998  InGroup<IgnoredPragmas>;
999def err_pragma_pack_invalid_alignment : Error<
1000  warn_pragma_pack_invalid_alignment.Summary>;
1001def warn_pragma_pack_non_default_at_include : Warning<
1002  "non-default #pragma pack value changes the alignment of struct or union "
1003  "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
1004  DefaultIgnore;
1005def warn_pragma_pack_modified_after_include : Warning<
1006  "the current #pragma pack alignment value is modified in the included "
1007  "file">, InGroup<PragmaPack>;
1008def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
1009  "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
1010def note_pragma_pack_here : Note<
1011  "previous '#pragma pack' directive that modifies alignment is here">;
1012def note_pragma_pack_pop_instead_reset : Note<
1013  "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
1014// Follow the Microsoft implementation.
1015def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
1016def warn_pragma_pack_pop_identifier_and_alignment : Warning<
1017  "specifying both a name and alignment to 'pop' is undefined">;
1018def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
1019  InGroup<IgnoredPragmas>;
1020def err_pragma_fc_pp_scope : Error<
1021  "'#pragma float_control push/pop' can only appear at file or namespace scope "
1022  "or within a language linkage specification">;
1023def err_pragma_fc_noprecise_requires_nofenv : Error<
1024  "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
1025def err_pragma_fc_except_requires_precise : Error<
1026  "'#pragma float_control(except, on)' is illegal when precise is disabled">;
1027def err_pragma_fc_noprecise_requires_noexcept : Error<
1028  "'#pragma float_control(precise, off)' is illegal when except is enabled">;
1029def err_pragma_fenv_requires_precise : Error<
1030  "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
1031def warn_cxx_ms_struct :
1032  Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
1033          "with base classes or virtual functions">,
1034  DefaultError, InGroup<IncompatibleMSStruct>;
1035def err_pragma_pack_identifer_not_supported : Error<
1036  "specifying an identifier within `#pragma pack` is not supported on this target">;
1037def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
1038def warn_section_msvc_compat : Warning<"`#pragma const_seg` for section %1 will"
1039  " not apply to %0 due to the presence of a %select{mutable field||non-trivial constructor|non-trivial destructor}2">,
1040  InGroup<IncompatibleMSPragmaSection>;
1041def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
1042def err_invalid_super_scope : Error<"invalid use of '__super', "
1043  "this keyword can only be used inside class or member function scope">;
1044def err_super_in_lambda_unsupported : Error<
1045  "use of '__super' inside a lambda is unsupported">;
1046
1047def err_pragma_expected_file_scope : Error<
1048  "'#pragma %0' can only appear at file scope">;
1049def err_pragma_alloc_text_c_linkage: Error<
1050  "'#pragma alloc_text' is applicable only to functions with C linkage">;
1051def err_pragma_alloc_text_not_function: Error<
1052  "'#pragma alloc_text' is applicable only to functions">;
1053
1054def warn_pragma_unused_undeclared_var : Warning<
1055  "undeclared variable %0 used as an argument for '#pragma unused'">,
1056  InGroup<IgnoredPragmas>;
1057def warn_atl_uuid_deprecated : Warning<
1058  "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
1059  InGroup<DeprecatedDeclarations>;
1060def warn_pragma_unused_expected_var_arg : Warning<
1061  "only variables can be arguments to '#pragma unused'">,
1062  InGroup<IgnoredPragmas>;
1063def err_pragma_push_visibility_mismatch : Error<
1064  "#pragma visibility push with no matching #pragma visibility pop">;
1065def note_surrounding_namespace_ends_here : Note<
1066  "surrounding namespace with visibility attribute ends here">;
1067def err_pragma_pop_visibility_mismatch : Error<
1068  "#pragma visibility pop with no matching #pragma visibility push">;
1069def note_surrounding_namespace_starts_here : Note<
1070  "surrounding namespace with visibility attribute starts here">;
1071def err_pragma_loop_invalid_argument_type : Error<
1072  "invalid argument of type %0; expected an integer type">;
1073def err_pragma_loop_invalid_argument_value : Error<
1074  "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
1075def err_pragma_loop_compatibility : Error<
1076  "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
1077def err_pragma_loop_precedes_nonloop : Error<
1078  "expected a for, while, or do-while loop to follow '%0'">;
1079
1080def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
1081  "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
1082  "those declarations">;
1083def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
1084  "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
1085def err_pragma_attribute_invalid_matchers : Error<
1086  "attribute %0 can't be applied to %1">;
1087def err_pragma_attribute_stack_mismatch : Error<
1088  "'#pragma clang attribute %select{%1.|}0pop' with no matching"
1089  " '#pragma clang attribute %select{%1.|}0push'">;
1090def warn_pragma_attribute_unused : Warning<
1091  "unused attribute %0 in '#pragma clang attribute push' region">,
1092  InGroup<PragmaClangAttribute>;
1093def note_pragma_attribute_region_ends_here : Note<
1094  "'#pragma clang attribute push' regions ends here">;
1095def err_pragma_attribute_no_pop_eof : Error<"unterminated "
1096  "'#pragma clang attribute push' at end of file">;
1097def note_pragma_attribute_applied_decl_here : Note<
1098  "when applied to this declaration">;
1099def err_pragma_attr_attr_no_push : Error<
1100  "'#pragma clang attribute' attribute with no matching "
1101  "'#pragma clang attribute push'">;
1102
1103/// Objective-C parser diagnostics
1104def err_duplicate_class_def : Error<
1105  "duplicate interface definition for class %0">;
1106def err_undef_superclass : Error<
1107  "cannot find interface declaration for %0, superclass of %1">;
1108def err_forward_superclass : Error<
1109  "attempting to use the forward class %0 as superclass of %1">;
1110def err_no_nsconstant_string_class : Error<
1111  "cannot find interface declaration for %0">;
1112def err_recursive_superclass : Error<
1113  "trying to recursively use %0 as superclass of %1">;
1114def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
1115def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
1116def warn_duplicate_protocol_def : Warning<
1117  "duplicate protocol definition of %0 is ignored">,
1118  InGroup<DiagGroup<"duplicate-protocol">>;
1119def err_protocol_has_circular_dependency : Error<
1120  "protocol has circular dependency">;
1121def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
1122def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
1123def err_atprotocol_protocol : Error<
1124  "@protocol is using a forward protocol declaration of %0">;
1125def warn_readonly_property : Warning<
1126  "attribute 'readonly' of property %0 restricts attribute "
1127  "'readwrite' of property inherited from %1">,
1128  InGroup<PropertyAttr>;
1129
1130def warn_property_attribute : Warning<
1131  "'%1' attribute on property %0 does not match the property inherited from %2">,
1132  InGroup<PropertyAttr>;
1133def warn_property_types_are_incompatible : Warning<
1134  "property type %0 is incompatible with type %1 inherited from %2">,
1135  InGroup<DiagGroup<"incompatible-property-type">>;
1136def warn_protocol_property_mismatch : Warning<
1137  "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
1138  "getter %1|with setter %1}0 was selected for synthesis">,
1139  InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
1140def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Summary>;
1141def err_undef_interface : Error<"cannot find interface declaration for %0">;
1142def err_category_forward_interface : Error<
1143  "cannot define %select{category|class extension}0 for undefined class %1">;
1144def err_class_extension_after_impl : Error<
1145  "cannot declare class extension for %0 after class implementation">;
1146def note_implementation_declared : Note<
1147  "class implementation is declared here">;
1148def note_while_in_implementation : Note<
1149  "detected while default synthesizing properties in class implementation">;
1150def note_class_declared : Note<
1151  "class is declared here">;
1152def note_receiver_class_declared : Note<
1153  "receiver is instance of class declared here">;
1154def note_receiver_expr_here : Note<
1155  "receiver expression is here">;
1156def note_receiver_is_id : Note<
1157  "receiver is treated with 'id' type for purpose of method lookup">;
1158def note_suppressed_class_declare : Note<
1159  "class with specified objc_requires_property_definitions attribute is declared here">;
1160def err_objc_root_class_subclass : Error<
1161  "objc_root_class attribute may only be specified on a root class declaration">;
1162def err_restricted_superclass_mismatch : Error<
1163  "cannot subclass a class that was declared with the "
1164  "'objc_subclassing_restricted' attribute">;
1165def err_class_stub_subclassing_mismatch : Error<
1166  "'objc_class_stub' attribute cannot be specified on a class that does not "
1167  "have the 'objc_subclassing_restricted' attribute">;
1168def err_implementation_of_class_stub : Error<
1169  "cannot declare implementation of a class declared with the "
1170  "'objc_class_stub' attribute">;
1171def warn_objc_root_class_missing : Warning<
1172  "class %0 defined without specifying a base class">,
1173  InGroup<ObjCRootClass>;
1174def err_objc_runtime_visible_category : Error<
1175  "cannot implement a category for class %0 that is only visible via the "
1176  "Objective-C runtime">;
1177def err_objc_runtime_visible_subclass : Error<
1178  "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1179  "Objective-C runtime">;
1180def note_objc_needs_superclass : Note<
1181  "add a super class to fix this problem">;
1182def err_conflicting_super_class : Error<"conflicting super class name %0">;
1183def err_dup_implementation_class : Error<"reimplementation of class %0">;
1184def err_dup_implementation_category : Error<
1185  "reimplementation of category %1 for class %0">;
1186def err_conflicting_ivar_type : Error<
1187  "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1188def err_duplicate_ivar_declaration : Error<
1189  "instance variable is already declared">;
1190def warn_on_superclass_use : Warning<
1191  "class implementation may not have super class">;
1192def err_conflicting_ivar_bitwidth : Error<
1193  "instance variable %0 has conflicting bit-field width">;
1194def err_conflicting_ivar_name : Error<
1195  "conflicting instance variable names: %0 vs %1">;
1196def err_inconsistent_ivar_count : Error<
1197  "inconsistent number of instance variables specified">;
1198def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1199  InGroup<DiagGroup<"incomplete-implementation">>;
1200def warn_objc_boxing_invalid_utf8_string : Warning<
1201  "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1202  InGroup<ObjCBoxing>;
1203
1204def err_objc_non_runtime_protocol_in_protocol_expr : Error<
1205  "cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression">;
1206def err_objc_direct_on_protocol : Error<
1207  "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1208  "declared in an Objective-C protocol">;
1209def err_objc_direct_duplicate_decl : Error<
1210  "%select{|direct }0%select{method|property}1 declaration conflicts "
1211  "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1212def err_objc_direct_impl_decl_mismatch : Error<
1213  "direct method was declared in %select{the primary interface|an extension|a category}0 "
1214  "but is implemented in %select{the primary interface|a category|a different category}1">;
1215def err_objc_direct_missing_on_decl : Error<
1216  "direct method implementation was previously declared not direct">;
1217def err_objc_direct_on_override : Error<
1218  "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1219def err_objc_override_direct_method : Error<
1220  "cannot override a method that is declared direct by a superclass">;
1221def warn_objc_direct_ignored : Warning<
1222  "%0 attribute isn't implemented by this Objective-C runtime">,
1223  InGroup<IgnoredAttributes>;
1224def warn_objc_direct_property_ignored : Warning<
1225  "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1226  InGroup<IgnoredAttributes>;
1227def err_objc_direct_dynamic_property : Error<
1228  "direct property cannot be @dynamic">;
1229def err_objc_direct_protocol_conformance : Error<
1230  "%select{category %1|class extension}0 cannot conform to protocol %2 because "
1231  "of direct members declared in interface %3">;
1232def note_direct_member_here : Note<"direct member declared here">;
1233
1234def warn_conflicting_overriding_ret_types : Warning<
1235  "conflicting return type in "
1236  "declaration of %0%diff{: $ vs $|}1,2">,
1237  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1238
1239def warn_conflicting_ret_types : Warning<
1240  "conflicting return type in "
1241  "implementation of %0%diff{: $ vs $|}1,2">,
1242  InGroup<MismatchedReturnTypes>;
1243
1244def warn_conflicting_overriding_ret_type_modifiers : Warning<
1245  "conflicting distributed object modifiers on return type "
1246  "in declaration of %0">,
1247  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1248
1249def warn_conflicting_ret_type_modifiers : Warning<
1250  "conflicting distributed object modifiers on return type "
1251  "in implementation of %0">,
1252  InGroup<DistributedObjectModifiers>;
1253
1254def warn_non_covariant_overriding_ret_types : Warning<
1255  "conflicting return type in "
1256  "declaration of %0: %1 vs %2">,
1257  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1258
1259def warn_non_covariant_ret_types : Warning<
1260  "conflicting return type in "
1261  "implementation of %0: %1 vs %2">,
1262  InGroup<MethodSignatures>, DefaultIgnore;
1263
1264def warn_conflicting_overriding_param_types : Warning<
1265  "conflicting parameter types in "
1266  "declaration of %0%diff{: $ vs $|}1,2">,
1267  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1268
1269def warn_conflicting_param_types : Warning<
1270  "conflicting parameter types in "
1271  "implementation of %0%diff{: $ vs $|}1,2">,
1272  InGroup<MismatchedParameterTypes>;
1273
1274def warn_conflicting_param_modifiers : Warning<
1275  "conflicting distributed object modifiers on parameter type "
1276  "in implementation of %0">,
1277  InGroup<DistributedObjectModifiers>;
1278
1279def warn_conflicting_overriding_param_modifiers : Warning<
1280  "conflicting distributed object modifiers on parameter type "
1281  "in declaration of %0">,
1282  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1283
1284def warn_non_contravariant_overriding_param_types : Warning<
1285  "conflicting parameter types in "
1286  "declaration of %0: %1 vs %2">,
1287  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1288
1289def warn_non_contravariant_param_types : Warning<
1290  "conflicting parameter types in "
1291  "implementation of %0: %1 vs %2">,
1292  InGroup<MethodSignatures>, DefaultIgnore;
1293
1294def warn_conflicting_overriding_variadic :Warning<
1295  "conflicting variadic declaration of method and its "
1296  "implementation">,
1297  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1298
1299def warn_conflicting_variadic :Warning<
1300  "conflicting variadic declaration of method and its "
1301  "implementation">;
1302
1303def warn_category_method_impl_match:Warning<
1304  "category is implementing a method which will also be implemented"
1305  " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1306
1307def warn_implements_nscopying : Warning<
1308"default assign attribute on property %0 which implements "
1309"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1310
1311def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1312  InGroup<ObjCMultipleMethodNames>;
1313def warn_strict_multiple_method_decl : Warning<
1314  "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1315def warn_accessor_property_type_mismatch : Warning<
1316  "type of property %0 does not match type of accessor %1">;
1317def note_conv_function_declared_at : Note<"type conversion function declared here">;
1318def note_method_declared_at : Note<"method %0 declared here">;
1319def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1320def note_property_attribute : Note<"property %0 is declared "
1321  "%select{deprecated|unavailable|partial}1 here">;
1322def err_setter_type_void : Error<"type of setter must be void">;
1323def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1324def warn_duplicate_method_decl :
1325  Warning<"multiple declarations of method %0 found and ignored">,
1326  InGroup<MethodDuplicate>, DefaultIgnore;
1327def warn_objc_cdirective_format_string :
1328  Warning<"using %0 directive in %select{NSString|CFString}1 "
1329          "which is being passed as a formatting argument to the formatting "
1330          "%select{method|CFfunction}2">,
1331  InGroup<ObjCCStringFormat>, DefaultIgnore;
1332def err_objc_var_decl_inclass :
1333    Error<"cannot declare variable inside @interface or @protocol">;
1334def err_missing_method_context : Error<
1335  "missing context for method declaration">;
1336def err_objc_property_attr_mutually_exclusive : Error<
1337  "property attributes '%0' and '%1' are mutually exclusive">;
1338def err_objc_property_requires_object : Error<
1339  "property with '%0' attribute must be of object type">;
1340def warn_objc_property_assign_on_object : Warning<
1341  "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1342  InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1343def warn_objc_property_no_assignment_attribute : Warning<
1344  "no 'assign', 'retain', or 'copy' attribute is specified - "
1345  "'assign' is assumed">,
1346  InGroup<ObjCPropertyNoAttribute>;
1347def warn_objc_isa_use : Warning<
1348  "direct access to Objective-C's isa is deprecated in favor of "
1349  "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1350def warn_objc_isa_assign : Warning<
1351  "assignment to Objective-C's isa is deprecated in favor of "
1352  "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1353def warn_objc_pointer_masking : Warning<
1354  "bitmasking for introspection of Objective-C object pointers is strongly "
1355  "discouraged">,
1356  InGroup<ObjCPointerIntrospect>;
1357def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Summary>,
1358  InGroup<ObjCPointerIntrospectPerformSelector>;
1359def warn_objc_property_default_assign_on_object : Warning<
1360  "default property attribute 'assign' not appropriate for object">,
1361  InGroup<ObjCPropertyNoAttribute>;
1362def warn_property_attr_mismatch : Warning<
1363  "property attribute in class extension does not match the primary class">,
1364  InGroup<PropertyAttr>;
1365def warn_property_implicitly_mismatched : Warning <
1366  "primary property declaration is implicitly strong while redeclaration "
1367  "in class extension is weak">,
1368  InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1369def warn_objc_property_copy_missing_on_block : Warning<
1370    "'copy' attribute must be specified for the block property "
1371    "when -fobjc-gc-only is specified">;
1372def warn_objc_property_retain_of_block : Warning<
1373    "retain'ed block property does not copy the block "
1374    "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1375def warn_objc_readonly_property_has_setter : Warning<
1376    "setter cannot be specified for a readonly property">,
1377    InGroup<ObjCReadonlyPropertyHasSetter>;
1378def warn_atomic_property_rule : Warning<
1379  "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1380  "with a user defined %select{getter|setter}2">,
1381  InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1382def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1383  "synthesized, or both be user defined, or the property must be nonatomic">;
1384def err_atomic_property_nontrivial_assign_op : Error<
1385  "atomic property of reference type %0 cannot have non-trivial assignment"
1386  " operator">;
1387def warn_cocoa_naming_owned_rule : Warning<
1388  "property follows Cocoa naming"
1389  " convention for returning 'owned' objects">,
1390  InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1391def err_cocoa_naming_owned_rule : Error<
1392  "property follows Cocoa naming"
1393  " convention for returning 'owned' objects">;
1394def note_cocoa_naming_declare_family : Note<
1395  "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1396  "object">;
1397def warn_auto_synthesizing_protocol_property :Warning<
1398  "auto property synthesis will not synthesize property %0"
1399  " declared in protocol %1">,
1400  InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1401def note_add_synthesize_directive : Note<
1402  "add a '@synthesize' directive">;
1403def warn_no_autosynthesis_shared_ivar_property : Warning <
1404  "auto property synthesis will not synthesize property "
1405  "%0 because it cannot share an ivar with another synthesized property">,
1406  InGroup<ObjCNoPropertyAutoSynthesis>;
1407def warn_no_autosynthesis_property : Warning<
1408  "auto property synthesis will not synthesize property "
1409  "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1410  "via another property">,
1411  InGroup<ObjCNoPropertyAutoSynthesis>;
1412def warn_autosynthesis_property_in_superclass : Warning<
1413  "auto property synthesis will not synthesize property "
1414  "%0; it will be implemented by its superclass, use @dynamic to "
1415  "acknowledge intention">,
1416  InGroup<ObjCNoPropertyAutoSynthesis>;
1417def warn_autosynthesis_property_ivar_match :Warning<
1418  "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1419  "%2, not existing instance variable %3">,
1420  InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1421def warn_missing_explicit_synthesis : Warning <
1422  "auto property synthesis is synthesizing property not explicitly synthesized">,
1423  InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1424def warn_property_getter_owning_mismatch : Warning<
1425  "property declared as returning non-retained objects"
1426  "; getter returning retained objects">;
1427def warn_property_redecl_getter_mismatch : Warning<
1428  "getter name mismatch between property redeclaration (%1) and its original "
1429  "declaration (%0)">, InGroup<PropertyAttr>;
1430def err_property_setter_ambiguous_use : Error<
1431  "synthesized properties %0 and %1 both claim setter %2 -"
1432  " use of this setter will cause unexpected behavior">;
1433def warn_default_atomic_custom_getter_setter : Warning<
1434  "atomic by default property %0 has a user defined %select{getter|setter}1 "
1435  "(property should be marked 'atomic' if this is intended)">,
1436  InGroup<CustomAtomic>, DefaultIgnore;
1437def err_use_continuation_class : Error<
1438  "illegal redeclaration of property in class extension %0"
1439  " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1440def err_type_mismatch_continuation_class : Error<
1441  "type of property %0 in class extension does not match "
1442  "property type in primary class">;
1443def err_use_continuation_class_redeclaration_readwrite : Error<
1444  "illegal redeclaration of 'readwrite' property in class extension %0"
1445  " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1446  "'readonly' public property?)">;
1447def err_continuation_class : Error<"class extension has no primary class">;
1448def err_property_type : Error<"property cannot have array or function type %0">;
1449def err_missing_property_context : Error<
1450  "missing context for property implementation declaration">;
1451def err_bad_property_decl : Error<
1452  "property implementation must have its declaration in interface %0 or one of "
1453  "its extensions">;
1454def err_category_property : Error<
1455  "property declared in category %0 cannot be implemented in "
1456  "class implementation">;
1457def note_property_declare : Note<
1458  "property declared here">;
1459def note_protocol_property_declare : Note<
1460  "it could also be property "
1461  "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1462  "%1|with setter %1}0 declared here">;
1463def note_property_synthesize : Note<
1464  "property synthesized here">;
1465def err_synthesize_category_decl : Error<
1466  "@synthesize not allowed in a category's implementation">;
1467def err_synthesize_on_class_property : Error<
1468  "@synthesize not allowed on a class property %0">;
1469def err_missing_property_interface : Error<
1470  "property implementation in a category with no category declaration">;
1471def err_bad_category_property_decl : Error<
1472  "property implementation must have its declaration in the category %0">;
1473def err_bad_property_context : Error<
1474  "property implementation must be in a class or category implementation">;
1475def err_missing_property_ivar_decl : Error<
1476  "synthesized property %0 must either be named the same as a compatible"
1477  " instance variable or must explicitly name an instance variable">;
1478def err_arc_perform_selector_retains : Error<
1479  "performSelector names a selector which retains the object">;
1480def warn_arc_perform_selector_leaks : Warning<
1481  "performSelector may cause a leak because its selector is unknown">,
1482  InGroup<DiagGroup<"arc-performSelector-leaks">>;
1483def warn_dealloc_in_category : Warning<
1484"-dealloc is being overridden in a category">,
1485InGroup<DeallocInCategory>;
1486def err_gc_weak_property_strong_type : Error<
1487  "weak attribute declared on a __strong type property in GC mode">;
1488def warn_arc_repeated_use_of_weak : Warning <
1489  "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1490  "accessed multiple times in this %select{function|method|block|lambda}2 "
1491  "but may be unpredictably set to nil; assign to a strong variable to keep "
1492  "the object alive">,
1493  InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1494def warn_implicitly_retains_self : Warning <
1495  "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1496  "this is intended behavior">,
1497  InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1498def warn_arc_possible_repeated_use_of_weak : Warning <
1499  "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1500  "be accessed multiple times in this %select{function|method|block|lambda}2 "
1501  "and may be unpredictably set to nil; assign to a strong variable to keep "
1502  "the object alive">,
1503  InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1504def note_arc_weak_also_accessed_here : Note<
1505  "also accessed here">;
1506def err_incomplete_synthesized_property : Error<
1507  "cannot synthesize property %0 with incomplete type %1">;
1508
1509def err_property_ivar_type : Error<
1510  "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1511def err_property_accessor_type : Error<
1512  "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1513def err_ivar_in_superclass_use : Error<
1514  "property %0 attempting to use instance variable %1 declared in super class %2">;
1515def err_weak_property : Error<
1516  "existing instance variable %1 for __weak property %0 must be __weak">;
1517def err_strong_property : Error<
1518  "existing instance variable %1 for strong property %0 may not be __weak">;
1519def err_dynamic_property_ivar_decl : Error<
1520  "dynamic property cannot have instance variable specification">;
1521def err_duplicate_ivar_use : Error<
1522  "synthesized properties %0 and %1 both claim instance variable %2">;
1523def err_property_implemented : Error<"property %0 is already implemented">;
1524def warn_objc_missing_super_call : Warning<
1525  "method possibly missing a [super %0] call">,
1526  InGroup<ObjCMissingSuperCalls>;
1527def err_dealloc_bad_result_type : Error<
1528  "dealloc return type must be correctly specified as 'void' under ARC, "
1529  "instead of %0">;
1530def warn_undeclared_selector : Warning<
1531  "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1532def warn_undeclared_selector_with_typo : Warning<
1533  "undeclared selector %0; did you mean %1?">,
1534  InGroup<UndeclaredSelector>, DefaultIgnore;
1535def warn_implicit_atomic_property : Warning<
1536  "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1537def note_auto_readonly_iboutlet_fixup_suggest : Note<
1538  "property should be changed to be readwrite">;
1539def warn_auto_readonly_iboutlet_property : Warning<
1540  "readonly IBOutlet property %0 when auto-synthesized may "
1541  "not work correctly with 'nib' loader">,
1542  InGroup<DiagGroup<"readonly-iboutlet-property">>;
1543def warn_auto_implicit_atomic_property : Warning<
1544  "property is assumed atomic when auto-synthesizing the property">,
1545  InGroup<ImplicitAtomic>, DefaultIgnore;
1546def warn_unimplemented_selector:  Warning<
1547  "no method with selector %0 is implemented in this translation unit">,
1548  InGroup<Selector>, DefaultIgnore;
1549def warn_unimplemented_protocol_method : Warning<
1550  "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1551def warn_multiple_selectors: Warning<
1552  "several methods with selector %0 of mismatched types are found "
1553  "for the @selector expression">,
1554  InGroup<SelectorTypeMismatch>, DefaultIgnore;
1555def err_direct_selector_expression : Error<
1556  "@selector expression formed with direct selector %0">;
1557def warn_potentially_direct_selector_expression : Warning<
1558  "@selector expression formed with potentially direct selector %0">,
1559  InGroup<ObjCPotentiallyDirectSelector>;
1560def warn_strict_potentially_direct_selector_expression : Warning<
1561  warn_potentially_direct_selector_expression.Summary>,
1562  InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1563
1564def err_objc_kindof_nonobject : Error<
1565  "'__kindof' specifier cannot be applied to non-object type %0">;
1566def err_objc_kindof_wrong_position : Error<
1567  "'__kindof' type specifier must precede the declarator">;
1568
1569def err_objc_method_unsupported_param_ret_type : Error<
1570  "%0 %select{parameter|return}1 type is unsupported; "
1571  "support for vector types for this target is introduced in %2">;
1572
1573def warn_messaging_unqualified_id : Warning<
1574  "messaging unqualified id">, DefaultIgnore,
1575  InGroup<DiagGroup<"objc-messaging-id">>;
1576def err_messaging_unqualified_id_with_direct_method : Error<
1577  "messaging unqualified id with a method that is possibly direct">;
1578def err_messaging_super_with_direct_method : Error<
1579  "messaging super with a direct method">;
1580def err_messaging_class_with_direct_method : Error<
1581  "messaging a Class with a method that is possibly direct">;
1582
1583// C++ declarations
1584def err_static_assert_expression_is_not_constant : Error<
1585  "static assertion expression is not an integral constant expression">;
1586def err_constexpr_if_condition_expression_is_not_constant : Error<
1587  "constexpr if condition is not a constant expression">;
1588def err_static_assert_failed : Error<"static assertion failed%select{: %1|}0">;
1589def err_static_assert_requirement_failed : Error<
1590  "static assertion failed due to requirement '%0'%select{: %2|}1">;
1591def note_expr_evaluates_to : Note<
1592  "expression evaluates to '%0 %1 %2'">;
1593def err_static_assert_invalid_message : Error<
1594  "the message in a static assertion must be a string literal or an "
1595  "object with 'data()' and 'size()' member functions">;
1596def err_static_assert_missing_member_function : Error<
1597  "the message object in this static assertion is missing %select{"
1598  "a 'size()' member function|"
1599  "a 'data()' member function|"
1600  "'data()' and 'size()' member functions}0">;
1601def err_static_assert_invalid_mem_fn_ret_ty : Error<
1602  "the message in a static assertion must have a '%select{size|data}0()' member "
1603  "function returning an object convertible to '%select{std::size_t|const char *}0'">;
1604def warn_static_assert_message_constexpr : Warning<
1605  "the message in this static assertion is not a "
1606  "constant expression">,
1607  DefaultError, InGroup<DiagGroup<"invalid-static-assert-message">>;
1608def err_static_assert_message_constexpr : Error<
1609  "the message in a static assertion must be produced by a "
1610  "constant expression">;
1611
1612def warn_consteval_if_always_true : Warning<
1613  "consteval if is always true in an %select{unevaluated|immediate}0 context">,
1614  InGroup<DiagGroup<"redundant-consteval-if">>;
1615
1616def ext_inline_variable : ExtWarn<
1617  "inline variables are a C++17 extension">, InGroup<CXX17>;
1618def warn_cxx14_compat_inline_variable : Warning<
1619  "inline variables are incompatible with C++ standards before C++17">,
1620  DefaultIgnore, InGroup<CXXPre17Compat>;
1621
1622def warn_inline_namespace_reopened_noninline : Warning<
1623  "inline namespace reopened as a non-inline namespace">,
1624  InGroup<InlineNamespaceReopenedNoninline>;
1625def err_inline_namespace_mismatch : Error<
1626  "non-inline namespace cannot be reopened as inline">;
1627def err_inline_namespace_std : Error<
1628  "cannot declare the namespace 'std' to be inline">;
1629
1630def err_unexpected_friend : Error<
1631  "friends can only be classes or functions">;
1632def ext_enum_friend : ExtWarn<
1633  "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1634def warn_cxx98_compat_enum_friend : Warning<
1635  "befriending enumeration type %0 is incompatible with C++98">,
1636  InGroup<CXX98Compat>, DefaultIgnore;
1637def ext_nonclass_type_friend : ExtWarn<
1638  "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1639def warn_cxx98_compat_nonclass_type_friend : Warning<
1640  "non-class friend type %0 is incompatible with C++98">,
1641  InGroup<CXX98Compat>, DefaultIgnore;
1642def err_friend_is_member : Error<
1643  "friends cannot be members of the declaring class">;
1644def warn_cxx98_compat_friend_is_member : Warning<
1645  "friend declaration naming a member of the declaring class is incompatible "
1646  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1647def ext_unelaborated_friend_type : ExtWarn<
1648  "unelaborated friend declaration is a C++11 extension; specify "
1649  "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1650  InGroup<CXX11>;
1651def warn_cxx98_compat_unelaborated_friend_type : Warning<
1652  "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1653  "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1654def err_qualified_friend_no_match : Error<
1655  "friend declaration of %0 does not match any declaration in %1">;
1656def err_introducing_special_friend : Error<
1657  "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1658  " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1659  "as a friend">;
1660def err_tagless_friend_type_template : Error<
1661  "friend type templates must use an elaborated type">;
1662def err_no_matching_local_friend : Error<
1663  "no matching function found in local scope">;
1664def err_no_matching_local_friend_suggest : Error<
1665  "no matching function %0 found in local scope; did you mean %3?">;
1666def err_partial_specialization_friend : Error<
1667  "partial specialization cannot be declared as a friend">;
1668def err_qualified_friend_def : Error<
1669  "friend function definition cannot be qualified with '%0'">;
1670def err_friend_def_in_local_class : Error<
1671  "friend function cannot be defined in a local class">;
1672def err_friend_specialization_def : Error<
1673  "friend function specialization cannot be defined">;
1674def err_friend_not_first_in_declaration : Error<
1675  "'friend' must appear first in a non-function declaration">;
1676def err_using_decl_friend : Error<
1677  "cannot befriend target of using declaration">;
1678def warn_template_qualified_friend_unsupported : Warning<
1679  "dependent nested name specifier '%0' for friend class declaration is "
1680  "not supported; turning off access control for %1">,
1681  InGroup<UnsupportedFriend>;
1682def warn_template_qualified_friend_ignored : Warning<
1683  "dependent nested name specifier '%0' for friend template declaration is "
1684  "not supported; ignoring this friend declaration">,
1685  InGroup<UnsupportedFriend>;
1686def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1687  "unqualified friend declaration referring to type outside of the nearest "
1688  "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1689  InGroup<MicrosoftUnqualifiedFriend>;
1690def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1691
1692def err_invalid_base_in_interface : Error<
1693  "interface type cannot inherit from "
1694  "%select{struct|non-public interface|class}0 %1">;
1695
1696def err_abstract_type_in_decl : Error<
1697  "%select{return|parameter|variable|field|instance variable|"
1698  "synthesized instance variable}0 type %1 is an abstract class">;
1699def err_allocation_of_abstract_type : Error<
1700  "allocating an object of abstract class type %0">;
1701def err_throw_abstract_type : Error<
1702  "cannot throw an object of abstract type %0">;
1703def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1704def err_capture_of_abstract_type : Error<
1705  "by-copy capture of value of abstract type %0">;
1706def err_capture_of_incomplete_or_sizeless_type : Error<
1707  "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1708def err_capture_default_non_local : Error<
1709  "non-local lambda expression cannot have a capture-default">;
1710
1711def err_multiple_final_overriders : Error<
1712  "virtual function %q0 has more than one final overrider in %1">;
1713def note_final_overrider : Note<"final overrider of %q0 in %1">;
1714
1715def err_type_defined_in_type_specifier : Error<
1716  "%0 cannot be defined in a type specifier">;
1717def err_type_defined_in_result_type : Error<
1718  "%0 cannot be defined in the result type of a function">;
1719def err_type_defined_in_param_type : Error<
1720  "%0 cannot be defined in a parameter type">;
1721def err_type_defined_in_alias_template : Error<
1722  "%0 cannot be defined in a type alias template">;
1723def err_type_defined_in_condition : Error<
1724  "%0 cannot be defined in a condition">;
1725def err_type_defined_in_enum : Error<
1726  "%0 cannot be defined in an enumeration">;
1727def ext_type_defined_in_offsetof : Extension<
1728  "defining a type within '%select{__builtin_offsetof|offsetof}0' is a Clang "
1729  "extension">, InGroup<GNUOffsetofExtensions>;
1730
1731def note_pure_virtual_function : Note<
1732  "unimplemented pure virtual method %0 in %1">;
1733
1734def note_pure_qualified_call_kext : Note<
1735  "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1736
1737def err_deleted_decl_not_first : Error<
1738  "deleted definition must be first declaration">;
1739
1740def err_deleted_override : Error<
1741  "deleted function %0 cannot override a non-deleted function">;
1742def err_non_deleted_override : Error<
1743  "non-deleted function %0 cannot override a deleted function">;
1744def err_consteval_override : Error<
1745  "consteval function %0 cannot override a non-consteval function">;
1746def err_non_consteval_override : Error<
1747  "non-consteval function %0 cannot override a consteval function">;
1748
1749def warn_weak_vtable : Warning<
1750  "%0 has no out-of-line virtual method definitions; its vtable will be "
1751  "emitted in every translation unit">,
1752  InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1753def warn_weak_template_vtable : Warning<
1754  "this warning is no longer in use and will be removed in the next release">,
1755  InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1756
1757def ext_using_undefined_std : ExtWarn<
1758  "using directive refers to implicitly-defined namespace 'std'">;
1759
1760// C++ exception specifications
1761def err_exception_spec_in_typedef : Error<
1762  "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1763def err_distant_exception_spec : Error<
1764  "exception specifications are not allowed beyond a single level "
1765  "of indirection">;
1766def err_incomplete_in_exception_spec : Error<
1767  "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1768  "in exception specification">;
1769def err_sizeless_in_exception_spec : Error<
1770  "%select{|reference to }0sizeless type %1 is not allowed "
1771  "in exception specification">;
1772def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Summary>,
1773  InGroup<MicrosoftExceptionSpec>;
1774def err_rref_in_exception_spec : Error<
1775  "rvalue reference type %0 is not allowed in exception specification">;
1776def err_mismatched_exception_spec : Error<
1777  "exception specification in declaration does not match previous declaration">;
1778def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Summary>,
1779  InGroup<MicrosoftExceptionSpec>;
1780def err_override_exception_spec : Error<
1781  "exception specification of overriding function is more lax than "
1782  "base version">;
1783def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Summary>,
1784  InGroup<MicrosoftExceptionSpec>;
1785def err_incompatible_exception_specs : Error<
1786  "target exception specification is not superset of source">;
1787def warn_incompatible_exception_specs : Warning<
1788  err_incompatible_exception_specs.Summary>, InGroup<IncompatibleExceptionSpec>;
1789def err_deep_exception_specs_differ : Error<
1790  "exception specifications of %select{return|argument}0 types differ">;
1791def warn_deep_exception_specs_differ : Warning<
1792  err_deep_exception_specs_differ.Summary>, InGroup<IncompatibleExceptionSpec>;
1793def err_missing_exception_specification : Error<
1794  "%0 is missing exception specification '%1'">;
1795def ext_missing_exception_specification : ExtWarn<
1796  err_missing_exception_specification.Summary>,
1797  InGroup<DiagGroup<"missing-exception-spec">>;
1798def err_exception_spec_not_parsed : Error<
1799  "exception specification is not available until end of class definition">;
1800def err_exception_spec_cycle : Error<
1801  "exception specification of %0 uses itself">;
1802def err_exception_spec_incomplete_type : Error<
1803  "exception specification needed for member of incomplete class %0">;
1804def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1805  "dynamic exception specifications with types are currently ignored in wasm">,
1806  InGroup<WebAssemblyExceptionSpec>;
1807
1808// C++ access checking
1809def err_class_redeclared_with_different_access : Error<
1810  "%0 redeclared with '%1' access">;
1811def err_access : Error<
1812  "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1813def ext_ms_using_declaration_inaccessible : ExtWarn<
1814  "using declaration referring to inaccessible member '%0' (which refers "
1815  "to accessible member '%1') is a Microsoft compatibility extension">,
1816    AccessControl, InGroup<MicrosoftUsingDecl>;
1817def err_access_ctor : Error<
1818  "calling a %select{private|protected}0 constructor of class %2">,
1819  AccessControl;
1820def ext_rvalue_to_reference_access_ctor : Extension<
1821  "C++98 requires an accessible copy constructor for class %2 when binding "
1822  "a reference to a temporary; was %select{private|protected}0">,
1823  AccessControl, InGroup<BindToTemporaryCopy>;
1824def err_access_base_ctor : Error<
1825  // The ERRORs represent other special members that aren't constructors, in
1826  // hopes that someone will bother noticing and reporting if they appear
1827  "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1828  "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1829  "|*ERROR*|}2constructor">, AccessControl;
1830def err_access_field_ctor : Error<
1831  // The ERRORs represent other special members that aren't constructors, in
1832  // hopes that someone will bother noticing and reporting if they appear
1833  "field of type %0 has %select{private|protected}2 "
1834  "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1835  AccessControl;
1836def err_access_friend_function : Error<
1837  "friend function %1 is a %select{private|protected}0 member of %3">,
1838  AccessControl;
1839
1840def err_access_dtor : Error<
1841  "calling a %select{private|protected}1 destructor of class %0">,
1842  AccessControl;
1843def err_access_dtor_base :
1844    Error<"base class %0 has %select{private|protected}1 destructor">,
1845    AccessControl;
1846def err_access_dtor_vbase :
1847    Error<"inherited virtual base class %1 has "
1848    "%select{private|protected}2 destructor">,
1849    AccessControl;
1850def err_access_dtor_temp :
1851    Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1852    AccessControl;
1853def err_access_dtor_exception :
1854    Error<"exception object of type %0 has %select{private|protected}1 "
1855          "destructor">, AccessControl;
1856def err_access_dtor_field :
1857    Error<"field of type %1 has %select{private|protected}2 destructor">,
1858    AccessControl;
1859def err_access_dtor_var :
1860    Error<"variable of type %1 has %select{private|protected}2 destructor">,
1861    AccessControl;
1862def err_access_dtor_ivar :
1863    Error<"instance variable of type %0 has %select{private|protected}1 "
1864          "destructor">,
1865    AccessControl;
1866def note_previous_access_declaration : Note<
1867  "previously declared '%1' here">;
1868def note_access_natural : Note<
1869  "%select{|implicitly }1declared %select{private|protected}0 here">;
1870def note_access_constrained_by_path : Note<
1871  "constrained by %select{|implicitly }1%select{private|protected}0"
1872  " inheritance here">;
1873def note_access_protected_restricted_noobject : Note<
1874  "must name member using the type of the current context %0">;
1875def note_access_protected_restricted_ctordtor : Note<
1876  "protected %select{constructor|destructor}0 can only be used to "
1877  "%select{construct|destroy}0 a base class subobject">;
1878def note_access_protected_restricted_object : Note<
1879  "can only access this member on an object of type %0">;
1880def warn_cxx98_compat_sfinae_access_control : Warning<
1881  "substitution failure due to access control is incompatible with C++98">,
1882  InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1883
1884// C++ name lookup
1885def err_incomplete_nested_name_spec : Error<
1886  "incomplete type %0 named in nested name specifier">;
1887def err_incomplete_enum : Error<
1888  "enumeration %0 is incomplete">;
1889def err_dependent_nested_name_spec : Error<
1890  "nested name specifier for a declaration cannot depend on a template "
1891  "parameter">;
1892def err_nested_name_member_ref_lookup_ambiguous : Error<
1893  "lookup of %0 in member access expression is ambiguous">;
1894def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1895  "lookup of %0 in member access expression is ambiguous; using member of %1">,
1896  InGroup<AmbigMemberTemplate>;
1897def note_ambig_member_ref_object_type : Note<
1898  "lookup in the object type %0 refers here">;
1899def note_ambig_member_ref_scope : Note<
1900  "lookup from the current scope refers here">;
1901def err_qualified_member_nonclass : Error<
1902  "qualified member access refers to a member in %0">;
1903def err_incomplete_member_access : Error<
1904  "member access into incomplete type %0">;
1905def err_incomplete_type : Error<
1906  "incomplete type %0 where a complete type is required">;
1907def warn_cxx98_compat_enum_nested_name_spec : Warning<
1908  "enumeration type in nested name specifier is incompatible with C++98">,
1909  InGroup<CXX98Compat>, DefaultIgnore;
1910def err_nested_name_spec_is_not_class : Error<
1911  "%0 cannot appear before '::' because it is not a class"
1912  "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1913def ext_nested_name_spec_is_enum : ExtWarn<
1914  "use of enumeration in a nested name specifier is a C++11 extension">,
1915  InGroup<CXX11>;
1916def err_out_of_line_qualified_id_type_names_constructor : Error<
1917  "qualified reference to %0 is a constructor name rather than a "
1918  "%select{template name|type}1 in this context">;
1919def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1920  "ISO C++ specifies that "
1921  "qualified reference to %0 is a constructor name rather than a "
1922  "%select{template name|type}1 in this context, despite preceding "
1923  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1924  InGroup<DiagGroup<"injected-class-name">>;
1925
1926// C++ class members
1927def err_storageclass_invalid_for_member : Error<
1928  "storage class specified for a member declaration">;
1929def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1930def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1931def ext_mutable_reference : ExtWarn<
1932  "'mutable' on a reference type is a Microsoft extension">,
1933  InGroup<MicrosoftMutableReference>;
1934def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1935def err_mutable_nonmember : Error<
1936  "'mutable' can only be applied to member variables">;
1937def err_virtual_in_union : Error<
1938  "unions cannot have virtual functions">;
1939def err_virtual_non_function : Error<
1940  "'virtual' can only appear on non-static member functions">;
1941def err_virtual_out_of_class : Error<
1942  "'virtual' can only be specified inside the class definition">;
1943def err_virtual_member_function_template : Error<
1944  "'virtual' cannot be specified on member function templates">;
1945def err_static_overrides_virtual : Error<
1946  "'static' member function %0 overrides a virtual function in a base class">;
1947def err_explicit_non_function : Error<
1948  "'explicit' can only appear on non-static member functions">;
1949def err_explicit_out_of_class : Error<
1950  "'explicit' can only be specified inside the class definition">;
1951def err_explicit_non_ctor_or_conv_function : Error<
1952  "'explicit' can only be applied to a constructor or conversion function">;
1953def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1954def err_static_out_of_line : Error<
1955  "'static' can only be specified inside the class definition">;
1956def ext_static_out_of_line : ExtWarn<
1957  err_static_out_of_line.Summary>,
1958  InGroup<MicrosoftTemplate>;
1959def err_storage_class_for_static_member : Error<
1960  "static data member definition cannot specify a storage class">;
1961def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1962def err_not_integral_type_bitfield : Error<
1963  "bit-field %0 has non-integral type %1">;
1964def err_not_integral_type_anon_bitfield : Error<
1965  "anonymous bit-field has non-integral type %0">;
1966def err_anon_bitfield_qualifiers : Error<
1967  "anonymous bit-field cannot have qualifiers">;
1968def err_member_function_initialization : Error<
1969  "initializer on function does not look like a pure-specifier">;
1970def err_non_virtual_pure : Error<
1971  "%0 is not virtual and cannot be declared pure">;
1972def ext_pure_function_definition : ExtWarn<
1973  "function definition with pure-specifier is a Microsoft extension">,
1974  InGroup<MicrosoftPureDefinition>;
1975def err_qualified_member_of_unrelated : Error<
1976  "%q0 is not a member of class %1">;
1977
1978def err_member_function_call_bad_cvr : Error<
1979  "'this' argument to member function %0 has type %1, but function is not marked "
1980  "%select{const|restrict|const or restrict|volatile|const or volatile|"
1981  "volatile or restrict|const, volatile, or restrict}2">;
1982def err_member_function_call_bad_ref : Error<
1983  "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1984  "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1985def err_member_function_call_bad_type : Error<
1986  "cannot initialize object parameter of type %0 with an expression "
1987  "of type %1">;
1988
1989def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1990  "call to pure virtual member function %0 has undefined behavior; "
1991  "overrides of %0 in subclasses are not available in the "
1992  "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1993
1994def select_special_member_kind : TextSubstitution<
1995  "%select{default constructor|copy constructor|move constructor|"
1996  "copy assignment operator|move assignment operator|destructor}0">;
1997
1998def note_member_declared_at : Note<"member is declared here">;
1999def note_ivar_decl : Note<"instance variable is declared here">;
2000def note_bitfield_decl : Note<"bit-field is declared here">;
2001def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
2002def note_member_synthesized_at : Note<
2003  "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
2004  "first required here">;
2005def note_comparison_synthesized_at : Note<
2006  "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
2007  "first required here">;
2008def err_missing_default_ctor : Error<
2009  "%select{constructor for %1 must explicitly initialize the|"
2010  "implicit default constructor for %1 must explicitly initialize the|"
2011  "cannot use constructor inherited from base class %4;}0 "
2012  "%select{base class|member}2 %3 %select{which|which|of %1}0 "
2013  "does not have a default constructor">;
2014def note_due_to_dllexported_class : Note<
2015  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
2016
2017def err_illegal_union_or_anon_struct_member : Error<
2018  "%select{anonymous struct|union}0 member %1 has a non-trivial "
2019  "%sub{select_special_member_kind}2">;
2020
2021def warn_frame_address : Warning<
2022  "calling '%0' with a nonzero argument is unsafe">,
2023  InGroup<FrameAddress>, DefaultIgnore;
2024
2025def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
2026  "%select{anonymous struct|union}0 member %1 with a non-trivial "
2027  "%sub{select_special_member_kind}2 is incompatible with C++98">,
2028  InGroup<CXX98Compat>, DefaultIgnore;
2029
2030def note_nontrivial_virtual_dtor : Note<
2031  "destructor for %0 is not trivial because it is virtual">;
2032def note_nontrivial_has_virtual : Note<
2033  "because type %0 has a virtual %select{member function|base class}1">;
2034def note_nontrivial_no_def_ctor : Note<
2035  "because %select{base class of |field of |}0type %1 has no "
2036  "default constructor">;
2037def note_user_declared_ctor : Note<
2038  "implicit default constructor suppressed by user-declared constructor">;
2039def note_nontrivial_no_copy : Note<
2040  "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
2041  "assignment operator|<<ERROR>>}2 can be used to "
2042  "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
2043  "%select{base class|field|an object}0 of type %3">;
2044def note_nontrivial_user_provided : Note<
2045  "because %select{base class of |field of |}0type %1 has a user-provided "
2046  "%sub{select_special_member_kind}2">;
2047def note_nontrivial_default_member_init : Note<
2048  "because field %0 has an initializer">;
2049def note_nontrivial_param_type : Note<
2050  "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
2051def note_nontrivial_default_arg : Note<"because it has a default argument">;
2052def note_nontrivial_variadic : Note<"because it is a variadic function">;
2053def note_nontrivial_subobject : Note<
2054  "because the function selected to %select{construct|copy|move|copy|move|"
2055  "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
2056def note_nontrivial_objc_ownership : Note<
2057  "because type %0 has a member with %select{no|no|__strong|__weak|"
2058  "__autoreleasing}1 ownership">;
2059
2060/// Selector for a TagTypeKind value.
2061def select_tag_type_kind : TextSubstitution<
2062  "%select{struct|interface|union|class|enum}0">;
2063
2064def err_static_data_member_not_allowed_in_anon_struct : Error<
2065  "static data member %0 not allowed in anonymous "
2066  "%sub{select_tag_type_kind}1">;
2067def ext_static_data_member_in_union : ExtWarn<
2068  "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
2069def warn_cxx98_compat_static_data_member_in_union : Warning<
2070  "static data member %0 in union is incompatible with C++98">,
2071  InGroup<CXX98Compat>, DefaultIgnore;
2072def ext_union_member_of_reference_type : ExtWarn<
2073  "union member %0 has reference type %1, which is a Microsoft extension">,
2074  InGroup<MicrosoftUnionMemberReference>;
2075def err_union_member_of_reference_type : Error<
2076  "union member %0 has reference type %1">;
2077def ext_anonymous_struct_union_qualified : Extension<
2078  "anonymous %select{struct|union}0 cannot be '%1'">;
2079def err_different_return_type_for_overriding_virtual_function : Error<
2080  "virtual function %0 has a different return type "
2081  "%diff{($) than the function it overrides (which has return type $)|"
2082  "than the function it overrides}1,2">;
2083def note_overridden_virtual_function : Note<
2084  "overridden virtual function is here">;
2085def err_conflicting_overriding_attributes : Error<
2086  "virtual function %0 has different attributes "
2087  "%diff{($) than the function it overrides (which has $)|"
2088  "than the function it overrides}1,2">;
2089def err_conflicting_overriding_cc_attributes : Error<
2090  "virtual function %0 has different calling convention attributes "
2091  "%diff{($) than the function it overrides (which has calling convention $)|"
2092  "than the function it overrides}1,2">;
2093def warn_overriding_method_missing_noescape : Warning<
2094  "parameter of overriding method should be annotated with "
2095  "__attribute__((noescape))">, InGroup<MissingNoEscape>;
2096def note_overridden_marked_noescape : Note<
2097  "parameter of overridden method is annotated with __attribute__((noescape))">;
2098def note_cat_conform_to_noescape_prot : Note<
2099  "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
2100
2101def err_covariant_return_inaccessible_base : Error<
2102  "invalid covariant return for virtual function: %1 is a "
2103  "%select{private|protected}2 base class of %0">, AccessControl;
2104def err_covariant_return_ambiguous_derived_to_base_conv : Error<
2105  "return type of virtual function %3 is not covariant with the return type of "
2106  "the function it overrides (ambiguous conversion from derived class "
2107  "%0 to base class %1:%2)">;
2108def err_covariant_return_not_derived : Error<
2109  "return type of virtual function %0 is not covariant with the return type of "
2110  "the function it overrides (%1 is not derived from %2)">;
2111def err_covariant_return_incomplete : Error<
2112  "return type of virtual function %0 is not covariant with the return type of "
2113  "the function it overrides (%1 is incomplete)">;
2114def err_covariant_return_type_different_qualifications : Error<
2115  "return type of virtual function %0 is not covariant with the return type of "
2116  "the function it overrides (%1 has different qualifiers than %2)">;
2117def err_covariant_return_type_class_type_more_qualified : Error<
2118  "return type of virtual function %0 is not covariant with the return type of "
2119  "the function it overrides (class type %1 is more qualified than class "
2120  "type %2">;
2121
2122// C++ implicit special member functions
2123def note_in_declaration_of_implicit_special_member : Note<
2124  "while declaring the implicit %sub{select_special_member_kind}1"
2125  " for %0">;
2126
2127// C++ constructors
2128def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
2129def err_invalid_qualified_constructor : Error<
2130  "'%0' qualifier is not allowed on a constructor">;
2131def err_ref_qualifier_constructor : Error<
2132  "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
2133
2134def err_constructor_return_type : Error<
2135  "constructor cannot have a return type">;
2136def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
2137def err_constructor_byvalue_arg : Error<
2138  "copy constructor must pass its first argument by reference">;
2139def warn_no_constructor_for_refconst : Warning<
2140  "%select{struct|interface|union|class|enum}0 %1 does not declare any "
2141  "constructor to initialize its non-modifiable members">;
2142def note_refconst_member_not_initialized : Note<
2143  "%select{const|reference}0 member %1 will never be initialized">;
2144def ext_ms_explicit_constructor_call : ExtWarn<
2145  "explicit constructor calls are a Microsoft extension">,
2146  InGroup<MicrosoftExplicitConstructorCall>;
2147
2148// C++ destructors
2149def err_destructor_not_member : Error<
2150  "destructor must be a non-static member function">;
2151def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
2152def err_invalid_qualified_destructor : Error<
2153  "'%0' qualifier is not allowed on a destructor">;
2154def err_ref_qualifier_destructor : Error<
2155  "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
2156def err_destructor_return_type : Error<"destructor cannot have a return type">;
2157def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
2158def err_destructor_with_params : Error<"destructor cannot have any parameters">;
2159def err_destructor_variadic : Error<"destructor cannot be variadic">;
2160def ext_destructor_typedef_name : ExtWarn<
2161  "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
2162  "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
2163def err_undeclared_destructor_name : Error<
2164  "undeclared identifier %0 in destructor name">;
2165def err_destructor_name : Error<
2166  "expected the class name after '~' to name the enclosing class">;
2167def err_destructor_name_nontype : Error<
2168  "identifier %0 after '~' in destructor name does not name a type">;
2169def err_destructor_expr_mismatch : Error<
2170  "identifier %0 in object destruction expression does not name the type "
2171  "%1 of the object being destroyed">;
2172def err_destructor_expr_nontype : Error<
2173  "identifier %0 in object destruction expression does not name a type">;
2174def err_destructor_expr_type_mismatch : Error<
2175  "destructor type %0 in object destruction expression does not match the "
2176  "type %1 of the object being destroyed">;
2177def note_destructor_type_here : Note<
2178  "type %0 found by destructor name lookup">;
2179def note_destructor_nontype_here : Note<
2180  "non-type declaration found by destructor name lookup">;
2181def ext_dtor_named_in_wrong_scope : Extension<
2182  "ISO C++ requires the name after '::~' to be found in the same scope as "
2183  "the name before '::~'">, InGroup<DtorName>;
2184def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
2185  "qualified destructor name only found in lexical scope; omit the qualifier "
2186  "to find this type name by unqualified lookup">, InGroup<DtorName>;
2187def ext_dtor_name_ambiguous : Extension<
2188  "ISO C++ considers this destructor name lookup to be ambiguous">,
2189  InGroup<DtorName>;
2190
2191def err_destroy_attr_on_non_static_var : Error<
2192  "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
2193  " variable with static or thread storage duration">;
2194
2195def err_destructor_template : Error<
2196  "destructor cannot be declared as a template">;
2197
2198// C++ initialization
2199def err_init_conversion_failed : Error<
2200  "cannot initialize %select{a variable|a parameter|template parameter|"
2201  "return object|statement expression result|an "
2202  "exception object|a member subobject|an array element|a new value|a value|a "
2203  "base class|a constructor delegation|a vector element|a block element|a "
2204  "block element|a complex element|a lambda capture|a compound literal "
2205  "initializer|a related result|a parameter of CF audited function|a "
2206  "structured binding|a member subobject}0 "
2207  "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2208  "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2209  "%select{|: different classes%diff{ ($ vs $)|}5,6"
2210  "|: different number of parameters (%5 vs %6)"
2211  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2212  "|: different return type%diff{ ($ vs $)|}5,6"
2213  "|: different qualifiers (%5 vs %6)"
2214  "|: different exception specifications}4">;
2215def note_forward_class_conversion : Note<"%0 is not defined, but forward "
2216  "declared here; conversion would be valid if it was derived from %1">;
2217
2218def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2219  "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2220def err_lvalue_reference_bind_to_initlist : Error<
2221  "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2222  "initializer list temporary">;
2223def err_lvalue_reference_bind_to_temporary : Error<
2224  "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2225  "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2226def err_lvalue_reference_bind_to_unrelated : Error<
2227  "%select{non-const|volatile}0 lvalue reference "
2228  "%diff{to type $ cannot bind to a value of unrelated type $|"
2229  "cannot bind to a value of unrelated type}1,2">;
2230def err_reference_bind_drops_quals : Error<
2231  "binding reference %diff{of type $ to value of type $|to value}0,1 "
2232  "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2233  "not permitted due to incompatible qualifiers}2">;
2234def err_reference_bind_failed : Error<
2235  "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2236  "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2237  "incompatible type}0,3">;
2238def err_reference_bind_temporary_addrspace : Error<
2239  "reference of type %0 cannot bind to a temporary object because of "
2240  "address space mismatch">;
2241def err_reference_bind_init_list : Error<
2242  "reference to type %0 cannot bind to an initializer list">;
2243def err_init_list_bad_dest_type : Error<
2244  "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2245  "list">;
2246def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2247  "aggregate initialization of type %0 with user-declared constructors "
2248  "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2249def warn_cxx17_compat_aggregate_init_paren_list : Warning<
2250  "aggregate initialization of type %0 from a parenthesized list of values "
2251  "is a C++20 extension">, DefaultIgnore, InGroup<CXX20>;
2252
2253def err_reference_bind_to_bitfield : Error<
2254  "%select{non-const|volatile}0 reference cannot bind to "
2255  "bit-field%select{| %1}2">;
2256def err_reference_bind_to_vector_element : Error<
2257  "%select{non-const|volatile}0 reference cannot bind to vector element">;
2258def err_reference_bind_to_matrix_element : Error<
2259  "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2260def err_reference_var_requires_init : Error<
2261  "declaration of reference variable %0 requires an initializer">;
2262def err_reference_without_init : Error<
2263  "reference to type %0 requires an initializer">;
2264def note_value_initialization_here : Note<
2265  "in value-initialization of type %0 here">;
2266def err_reference_has_multiple_inits : Error<
2267  "reference cannot be initialized with multiple values">;
2268def err_init_non_aggr_init_list : Error<
2269  "initialization of non-aggregate type %0 with an initializer list">;
2270def err_designated_init_for_non_aggregate : Error<
2271  "initialization of non-aggregate type %0 with a designated initializer list">;
2272def err_init_reference_member_uninitialized : Error<
2273  "reference member of type %0 uninitialized">;
2274def note_uninit_reference_member : Note<
2275  "uninitialized reference member is here">;
2276def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2277  InGroup<Uninitialized>;
2278def warn_base_class_is_uninit : Warning<
2279  "base class %0 is uninitialized when used here to access %q1">,
2280  InGroup<Uninitialized>;
2281def warn_reference_field_is_uninit : Warning<
2282  "reference %0 is not yet bound to a value when used here">,
2283  InGroup<Uninitialized>;
2284def note_uninit_in_this_constructor : Note<
2285  "during field initialization in %select{this|the implicit default}0 "
2286  "constructor">;
2287def warn_static_self_reference_in_init : Warning<
2288  "static variable %0 is suspiciously used within its own initialization">,
2289  InGroup<UninitializedStaticSelfInit>;
2290def warn_uninit_self_reference_in_init : Warning<
2291  "variable %0 is uninitialized when used within its own initialization">,
2292  InGroup<Uninitialized>;
2293def warn_uninit_self_reference_in_reference_init : Warning<
2294  "reference %0 is not yet bound to a value when used within its own"
2295  " initialization">,
2296  InGroup<Uninitialized>;
2297def warn_uninit_var : Warning<
2298  "variable %0 is uninitialized when %select{used here|captured by block}1">,
2299  InGroup<Uninitialized>, DefaultIgnore;
2300def warn_sometimes_uninit_var : Warning<
2301  "variable %0 is %select{used|captured}1 uninitialized whenever "
2302  "%select{'%3' condition is %select{true|false}4|"
2303  "'%3' loop %select{is entered|exits because its condition is false}4|"
2304  "'%3' loop %select{condition is true|exits because its condition is false}4|"
2305  "switch %3 is taken|"
2306  "its declaration is reached|"
2307  "%3 is called}2">,
2308  InGroup<UninitializedSometimes>, DefaultIgnore;
2309def warn_maybe_uninit_var : Warning<
2310  "variable %0 may be uninitialized when "
2311  "%select{used here|captured by block}1">,
2312  InGroup<UninitializedMaybe>, DefaultIgnore;
2313def note_var_declared_here : Note<"variable %0 is declared here">;
2314def note_uninit_var_use : Note<
2315  "%select{uninitialized use occurs|variable is captured by block}0 here">;
2316def warn_uninit_byref_blockvar_captured_by_block : Warning<
2317  "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2318  "block">, InGroup<Uninitialized>, DefaultIgnore;
2319def note_block_var_fixit_add_initialization : Note<
2320  "did you mean to use __block %0?">;
2321def note_in_omitted_aggregate_initializer : Note<
2322  "in implicit initialization of %select{"
2323  "array element %1 with omitted initializer|"
2324  "field %1 with omitted initializer|"
2325  "trailing array elements in runtime-sized array new}0">;
2326def note_in_reference_temporary_list_initializer : Note<
2327  "in initialization of temporary of type %0 created to "
2328  "list-initialize this reference">;
2329def note_var_fixit_add_initialization : Note<
2330  "initialize the variable %0 to silence this warning">;
2331def note_uninit_fixit_remove_cond : Note<
2332  "remove the %select{'%1' if its condition|condition if it}0 "
2333  "is always %select{false|true}2">;
2334def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2335def err_list_init_in_parens : Error<
2336  "cannot initialize %select{non-class|reference}0 type %1 with a "
2337  "parenthesized initializer list">;
2338
2339def warn_uninit_const_reference : Warning<
2340  "variable %0 is uninitialized when passed as a const reference argument "
2341  "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2342
2343def warn_unsequenced_mod_mod : Warning<
2344  "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2345def warn_unsequenced_mod_use : Warning<
2346  "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2347
2348def select_initialized_entity_kind : TextSubstitution<
2349  "%select{copying variable|copying parameter|initializing template parameter|"
2350  "returning object|initializing statement expression result|"
2351  "throwing object|copying member subobject|copying array element|"
2352  "allocating object|copying temporary|initializing base subobject|"
2353  "initializing vector element|capturing value}0">;
2354
2355def err_temp_copy_no_viable : Error<
2356  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2357def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2358  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2359  "C++98 requires a copy constructor when binding a reference to a temporary">,
2360  InGroup<BindToTemporaryCopy>;
2361def err_temp_copy_ambiguous : Error<
2362  "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2363  "of type %1">;
2364def err_temp_copy_deleted : Error<
2365  "%sub{select_initialized_entity_kind}0 of type %1 "
2366  "invokes deleted constructor">;
2367def err_temp_copy_incomplete : Error<
2368  "copying a temporary object of incomplete type %0">;
2369def warn_cxx98_compat_temp_copy : Warning<
2370  "%sub{select_initialized_entity_kind}1 "
2371  "of type %2 when binding a reference to a temporary would %select{invoke "
2372  "an inaccessible constructor|find no viable constructor|find ambiguous "
2373  "constructors|invoke a deleted constructor}0 in C++98">,
2374  InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2375def err_selected_explicit_constructor : Error<
2376  "chosen constructor is explicit in copy-initialization">;
2377def note_explicit_ctor_deduction_guide_here : Note<
2378  "explicit %select{constructor|deduction guide}0 declared here">;
2379
2380// C++11 decltype
2381def err_decltype_in_declarator : Error<
2382    "'decltype' cannot be used to name a declaration">;
2383
2384// C++11 auto
2385def warn_cxx98_compat_auto_type_specifier : Warning<
2386  "'auto' type specifier is incompatible with C++98">,
2387  InGroup<CXX98Compat>, DefaultIgnore;
2388def err_auto_variable_cannot_appear_in_own_initializer : Error<
2389  "variable %0 declared with deduced type %1 "
2390  "cannot appear in its own initializer">;
2391def err_binding_cannot_appear_in_own_initializer : Error<
2392  "binding %0 cannot appear in the initializer of its own "
2393  "decomposition declaration">;
2394def err_new_array_of_auto : Error<
2395  "cannot allocate array of 'auto'">;
2396def err_auto_not_allowed : Error<
2397  "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2398  "use of "
2399  "%select{class template|function template|variable template|alias template|"
2400  "template template parameter|concept|template}2 %3 requires template "
2401  "arguments; argument deduction}0 not allowed "
2402  "%select{in function prototype"
2403  "|in non-static struct member|in struct member"
2404  "|in non-static union member|in union member"
2405  "|in non-static class member|in interface member"
2406  "|in exception declaration|in template parameter until C++17|in block literal"
2407  "|in template argument|in typedef|in type alias|in function return type"
2408  "|in conversion function type|here|in lambda parameter"
2409  "|in type allocated by 'new'|in K&R-style function parameter"
2410  "|in template parameter|in friend declaration|in function prototype that is "
2411  "not a function declaration|in requires expression parameter"
2412  "|in array declaration}1">;
2413def err_dependent_deduced_tst : Error<
2414  "typename specifier refers to "
2415  "%select{class template|function template|variable template|alias template|"
2416  "template template parameter|template}0 member in %1; "
2417  "argument deduction not allowed here">;
2418def err_deduced_tst : Error<
2419  "typename specifier refers to "
2420  "%select{class template|function template|variable template|alias template|"
2421  "template template parameter|template}0; argument deduction not allowed "
2422  "here">;
2423def err_auto_not_allowed_var_inst : Error<
2424  "'auto' variable template instantiation is not allowed">;
2425def err_auto_var_requires_init : Error<
2426  "declaration of variable %0 with deduced type %1 requires an initializer">;
2427def err_auto_new_requires_ctor_arg : Error<
2428  "new expression for type %0 requires a constructor argument">;
2429def ext_auto_new_list_init : Extension<
2430  "ISO C++ standards before C++17 do not allow new expression for "
2431  "type %0 to use list-initialization">, InGroup<CXX17>;
2432def err_auto_var_init_no_expression : Error<
2433  "initializer for variable %0 with type %1 is empty">;
2434def err_auto_expr_init_no_expression : Error<
2435  "initializer for functional-style cast to %0 is empty">;
2436def err_auto_var_init_multiple_expressions : Error<
2437  "initializer for variable %0 with type %1 contains multiple expressions">;
2438def err_auto_expr_init_multiple_expressions : Error<
2439  "initializer for functional-style cast to %0 contains multiple expressions">;
2440def err_auto_var_init_paren_braces : Error<
2441  "cannot deduce type for variable %1 with type %2 from "
2442  "%select{parenthesized|nested}0 initializer list">;
2443def err_auto_new_ctor_multiple_expressions : Error<
2444  "new expression for type %0 contains multiple constructor arguments">;
2445def err_auto_expr_init_paren_braces : Error<
2446  "cannot deduce actual type for %1 from "
2447  "%select{parenthesized|nested}0 initializer list">;
2448def warn_cxx20_compat_auto_expr : Warning<
2449  "'auto' as a functional-style cast is incompatible with C++ standards "
2450  "before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
2451def err_auto_missing_trailing_return : Error<
2452  "'auto' return without trailing return type; deduced return types are a "
2453  "C++14 extension">;
2454def err_deduced_return_type : Error<
2455  "deduced return types are a C++14 extension">;
2456def err_trailing_return_without_auto : Error<
2457  "function with trailing return type must specify return type 'auto', not %0">;
2458def err_trailing_return_in_parens : Error<
2459  "trailing return type may not be nested within parentheses">;
2460def err_auto_var_deduction_failure : Error<
2461  "variable %0 with type %1 has incompatible initializer of type %2">;
2462def err_auto_var_deduction_failure_from_init_list : Error<
2463  "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2464def err_auto_expr_deduction_failure : Error<
2465  "functional-style cast to %0 has incompatible initializer of type %1">;
2466def err_auto_new_deduction_failure : Error<
2467  "new expression for type %0 has incompatible constructor argument of type %1">;
2468def err_auto_inconsistent_deduction : Error<
2469  "deduced conflicting types %diff{($ vs $) |}0,1"
2470  "for initializer list element type">;
2471def err_auto_different_deductions : Error<
2472  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2473  "deduced as %1 in declaration of %2 and "
2474  "deduced as %3 in declaration of %4">;
2475def err_auto_non_deduced_not_alone : Error<
2476  "%select{function with deduced return type|"
2477  "declaration with trailing return type}0 "
2478  "must be the only declaration in its group">;
2479def err_implied_std_initializer_list_not_found : Error<
2480  "cannot deduce type of initializer list because std::initializer_list was "
2481  "not found; include <initializer_list>">;
2482def err_malformed_std_initializer_list : Error<
2483  "std::initializer_list must be a class template with a single type parameter">;
2484def err_auto_init_list_from_c : Error<
2485  "cannot use %select{'auto'|<ERROR>|'__auto_type'}0 with "
2486  "%select{initializer list|array}1 in C">;
2487def err_auto_bitfield : Error<
2488  "cannot pass bit-field as __auto_type initializer in C">;
2489
2490// C++1y decltype(auto) type
2491def err_decltype_auto_invalid : Error<
2492  "'decltype(auto)' not allowed here">;
2493def err_decltype_auto_cannot_be_combined : Error<
2494  "'decltype(auto)' cannot be combined with other type specifiers">;
2495def err_decltype_auto_function_declarator_not_declaration : Error<
2496  "'decltype(auto)' can only be used as a return type "
2497  "in a function declaration">;
2498def err_decltype_auto_compound_type : Error<
2499  "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2500def err_decltype_auto_initializer_list : Error<
2501  "cannot deduce 'decltype(auto)' from initializer list">;
2502
2503// C++17 deduced class template specialization types
2504def err_deduced_class_template_compound_type : Error<
2505  "cannot %select{form pointer to|form reference to|form array of|"
2506  "form function returning|use parentheses when declaring variable with}0 "
2507  "deduced class template specialization type">;
2508def err_deduced_non_class_template_specialization_type : Error<
2509  "%select{<error>|function template|variable template|alias template|"
2510  "template template parameter|concept|template}0 %1 requires template "
2511  "arguments; argument deduction only allowed for class templates">;
2512def err_deduced_class_template_ctor_ambiguous : Error<
2513  "ambiguous deduction for template arguments of %0">;
2514def err_deduced_class_template_ctor_no_viable : Error<
2515  "no viable constructor or deduction guide for deduction of "
2516  "template arguments of %0">;
2517def err_deduced_class_template_incomplete : Error<
2518  "template %0 has no definition and no %select{|viable }1deduction guides "
2519  "for deduction of template arguments">;
2520def err_deduced_class_template_deleted : Error<
2521  "class template argument deduction for %0 selected a deleted constructor">;
2522def err_deduced_class_template_explicit : Error<
2523  "class template argument deduction for %0 selected an explicit "
2524  "%select{constructor|deduction guide}1 for copy-list-initialization">;
2525def err_deduction_guide_no_trailing_return_type : Error<
2526  "deduction guide declaration without trailing return type">;
2527def err_deduction_guide_bad_trailing_return_type : Error<
2528  "deduced type %1 of deduction guide is not %select{|written as }2"
2529  "a specialization of template %0">;
2530def err_deduction_guide_with_complex_decl : Error<
2531  "cannot specify any part of a return type in the "
2532  "declaration of a deduction guide">;
2533def err_deduction_guide_invalid_specifier : Error<
2534  "deduction guide cannot be declared '%0'">;
2535def err_deduction_guide_name_not_class_template : Error<
2536  "cannot specify deduction guide for "
2537  "%select{<error>|function template|variable template|alias template|"
2538  "template template parameter|concept|dependent template name}0 %1">;
2539def err_deduction_guide_wrong_scope : Error<
2540  "deduction guide must be declared in the same scope as template %q0">;
2541def err_deduction_guide_defines_function : Error<
2542  "deduction guide cannot have a function definition">;
2543def err_deduction_guide_redeclared : Error<
2544  "redeclaration of deduction guide">;
2545def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2546  "%select{explicitly instantiated|explicitly specialized}0">;
2547def err_deduction_guide_template_not_deducible : Error<
2548  "deduction guide template contains "
2549  "%select{a template parameter|template parameters}0 that cannot be "
2550  "deduced">;
2551def err_deduction_guide_wrong_access : Error<
2552  "deduction guide has different access from the corresponding "
2553  "member template">;
2554def note_deduction_guide_template_access : Note<
2555  "member template declared %0 here">;
2556def note_deduction_guide_access : Note<
2557  "deduction guide declared %0 by intervening access specifier">;
2558def warn_cxx14_compat_class_template_argument_deduction : Warning<
2559  "class template argument deduction is incompatible with C++ standards "
2560  "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2561  InGroup<CXXPre17Compat>, DefaultIgnore;
2562def warn_ctad_maybe_unsupported : Warning<
2563  "%0 may not intend to support class template argument deduction">,
2564  InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2565def note_suppress_ctad_maybe_unsupported : Note<
2566  "add a deduction guide to suppress this warning">;
2567
2568
2569// C++14 deduced return types
2570def err_auto_fn_deduction_failure : Error<
2571  "cannot deduce return type %0 from returned value of type %1">;
2572def err_auto_fn_different_deductions : Error<
2573  "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2574  "deduced as %2 in earlier return statement">;
2575def err_auto_fn_used_before_defined : Error<
2576  "function %0 with deduced return type cannot be used before it is defined">;
2577def err_auto_fn_no_return_but_not_auto : Error<
2578  "cannot deduce return type %0 for function with no return statements">;
2579def err_auto_fn_return_void_but_not_auto : Error<
2580  "cannot deduce return type %0 from omitted return expression">;
2581def err_auto_fn_return_init_list : Error<
2582  "cannot deduce return type from initializer list">;
2583def err_auto_fn_virtual : Error<
2584  "function with deduced return type cannot be virtual">;
2585def warn_cxx11_compat_deduced_return_type : Warning<
2586  "return type deduction is incompatible with C++ standards before C++14">,
2587  InGroup<CXXPre14Compat>, DefaultIgnore;
2588
2589// C++11 override control
2590def override_keyword_only_allowed_on_virtual_member_functions : Error<
2591  "only virtual member functions can be marked '%0'">;
2592def override_keyword_hides_virtual_member_function : Error<
2593  "non-virtual member function marked '%0' hides virtual member "
2594  "%select{function|functions}1">;
2595def err_function_marked_override_not_overriding : Error<
2596  "%0 marked 'override' but does not override any member functions">;
2597def warn_destructor_marked_not_override_overriding : TextSubstitution <
2598  "%0 overrides a destructor but is not marked 'override'">;
2599def warn_function_marked_not_override_overriding : TextSubstitution <
2600  "%0 overrides a member function but is not marked 'override'">;
2601def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2602  "%sub{warn_destructor_marked_not_override_overriding}0">,
2603  InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2604def warn_inconsistent_function_marked_not_override_overriding : Warning <
2605  "%sub{warn_function_marked_not_override_overriding}0">,
2606  InGroup<CXX11WarnInconsistentOverrideMethod>;
2607def warn_suggest_destructor_marked_not_override_overriding : Warning <
2608  "%sub{warn_destructor_marked_not_override_overriding}0">,
2609  InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2610def warn_suggest_function_marked_not_override_overriding : Warning <
2611  "%sub{warn_function_marked_not_override_overriding}0">,
2612  InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2613def err_class_marked_final_used_as_base : Error<
2614  "base %0 is marked '%select{final|sealed}1'">;
2615def warn_abstract_final_class : Warning<
2616  "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2617def warn_final_dtor_non_final_class : Warning<
2618  "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2619  InGroup<FinalDtorNonFinalClass>;
2620def note_final_dtor_non_final_class_silence : Note<
2621  "mark %0 as '%select{final|sealed}1' to silence this warning">;
2622
2623// C++11 attributes
2624def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2625
2626// C++11 final
2627def err_final_function_overridden : Error<
2628  "declaration of %0 overrides a '%select{final|sealed}1' function">;
2629
2630// C++11 scoped enumerations
2631def err_enum_invalid_underlying : Error<
2632  "%select{non-integral type %0|%0}1 is an invalid underlying type">;
2633def err_enumerator_too_large : Error<
2634  "enumerator value is not representable in the underlying type %0">;
2635def ext_enumerator_too_large : Extension<
2636  "enumerator value is not representable in the underlying type %0">,
2637  InGroup<MicrosoftEnumValue>;
2638def err_enumerator_wrapped : Error<
2639  "enumerator value %0 is not representable in the underlying type %1">;
2640def err_enum_redeclare_type_mismatch : Error<
2641  "enumeration redeclared with different underlying type %0 (was %1)">;
2642def err_enum_redeclare_fixed_mismatch : Error<
2643  "enumeration previously declared with %select{non|}0fixed underlying type">;
2644def err_enum_redeclare_scoped_mismatch : Error<
2645  "enumeration previously declared as %select{un|}0scoped">;
2646def err_only_enums_have_underlying_types : Error<
2647  "only enumeration types have underlying types">;
2648def err_underlying_type_of_incomplete_enum : Error<
2649  "cannot determine underlying type of incomplete enumeration type %0">;
2650
2651// C++11 delegating constructors
2652def err_delegating_ctor : Error<
2653  "delegating constructors are permitted only in C++11">;
2654def warn_cxx98_compat_delegating_ctor : Warning<
2655  "delegating constructors are incompatible with C++98">,
2656  InGroup<CXX98Compat>, DefaultIgnore;
2657def err_delegating_initializer_alone : Error<
2658  "an initializer for a delegating constructor must appear alone">;
2659def warn_delegating_ctor_cycle : Warning<
2660  "constructor for %0 creates a delegation cycle">, DefaultError,
2661  InGroup<DelegatingCtorCycles>;
2662def note_it_delegates_to : Note<"it delegates to">;
2663def note_which_delegates_to : Note<"which delegates to">;
2664
2665// C++11 range-based for loop
2666def err_for_range_decl_must_be_var : Error<
2667  "for range declaration must declare a variable">;
2668def err_for_range_storage_class : Error<
2669  "loop variable %0 may not be declared %select{'extern'|'static'|"
2670  "'__private_extern__'|'auto'|'register'|'constexpr'|'thread_local'}1">;
2671def err_type_defined_in_for_range : Error<
2672  "types may not be defined in a for range declaration">;
2673def err_for_range_deduction_failure : Error<
2674  "cannot use type %0 as a range">;
2675def err_for_range_incomplete_type : Error<
2676  "cannot use incomplete type %0 as a range">;
2677def err_for_range_iter_deduction_failure : Error<
2678  "cannot use type %0 as an iterator">;
2679def ext_for_range_begin_end_types_differ : ExtWarn<
2680  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2681  InGroup<CXX17>;
2682def warn_for_range_begin_end_types_differ : Warning<
2683  "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2684  "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2685def note_in_for_range: Note<
2686  "when looking up '%select{begin|end}0' function for range expression "
2687  "of type %1">;
2688def err_for_range_invalid: Error<
2689  "invalid range expression of type %0; no viable '%select{begin|end}1' "
2690  "function available">;
2691def note_for_range_member_begin_end_ignored : Note<
2692  "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2693def err_range_on_array_parameter : Error<
2694  "cannot build range expression with array function parameter %0 since "
2695  "parameter with array type %1 is treated as pointer type %2">;
2696def err_for_range_dereference : Error<
2697  "invalid range expression of type %0; did you mean to dereference it "
2698  "with '*'?">;
2699def note_for_range_invalid_iterator : Note <
2700  "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2701def note_for_range_begin_end : Note<
2702  "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2703def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2704  "loop variable %0 "
2705  "%diff{of type $ binds to a temporary constructed from type $"
2706  "|binds to a temporary constructed from a different type}1,2">,
2707  InGroup<RangeLoopConstruct>, DefaultIgnore;
2708def note_use_type_or_non_reference : Note<
2709  "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2710def warn_for_range_ref_binds_ret_temp : Warning<
2711  "loop variable %0 binds to a temporary value produced by a range of type %1">,
2712  InGroup<RangeLoopBindReference>, DefaultIgnore;
2713def note_use_non_reference_type : Note<"use non-reference type %0">;
2714def warn_for_range_copy : Warning<
2715  "loop variable %0 creates a copy from type %1">,
2716  InGroup<RangeLoopConstruct>, DefaultIgnore;
2717def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2718def err_objc_for_range_init_stmt : Error<
2719  "initialization statement is not supported when iterating over Objective-C "
2720  "collection">;
2721
2722// C++11 constexpr
2723def warn_cxx98_compat_constexpr : Warning<
2724  "'constexpr' specifier is incompatible with C++98">,
2725  InGroup<CXX98Compat>, DefaultIgnore;
2726// FIXME: Maybe this should also go in -Wc++14-compat?
2727def warn_cxx14_compat_constexpr_not_const : Warning<
2728  "'constexpr' non-static member function will not be implicitly 'const' "
2729  "in C++14; add 'const' to avoid a change in behavior">,
2730  InGroup<DiagGroup<"constexpr-not-const">>;
2731def err_invalid_consteval_take_address : Error<
2732  "cannot take address of %select{immediate|consteval}2 "
2733  "%select{function|call operator of}1 %0 outside"
2734  " of an immediate invocation">;
2735def err_invalid_consteval_call : Error<
2736  "call to %select{immediate|consteval}1 function "
2737  "%q0 is not a constant expression">;
2738
2739def err_immediate_function_used_before_definition : Error<
2740  "immediate function %0 used before it is defined">;
2741
2742def note_immediate_function_reason : Note<
2743  "%0 is an immediate %select{function|constructor}5 because "
2744  "%select{its body|the%select{| default}7 initializer of %8}6 "
2745  "%select{evaluates the address of %select{an immediate|a consteval}2 "
2746  "function %1|contains a call to %select{an immediate|a consteval}2 "
2747  "%select{function|constructor}4 %1 and that call is not a constant "
2748  "expression}3">;
2749
2750def note_invalid_consteval_initializer : Note<
2751  "in the default initializer of %0">;
2752def note_invalid_consteval_initializer_here : Note<
2753  "initialized here %0">;
2754def err_invalid_consteval_decl_kind : Error<
2755  "%0 cannot be declared consteval">;
2756def err_invalid_constexpr : Error<
2757  "%select{function parameter|typedef}0 "
2758  "cannot be %sub{select_constexpr_spec_kind}1">;
2759def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2760  "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2761def err_constexpr_tag : Error<
2762  "%select{class|struct|interface|union|enum|enum class|enum struct}0 "
2763  "cannot be marked %sub{select_constexpr_spec_kind}1">;
2764def err_constexpr_dtor : Error<
2765  "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2766def err_constexpr_dtor_subobject : Error<
2767  "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2768  "%select{data member %2|base class %3}1 does not have a "
2769  "constexpr destructor">;
2770def note_constexpr_dtor_subobject : Note<
2771  "%select{data member %1|base class %2}0 declared here">;
2772def err_constexpr_wrong_decl_kind : Error<
2773  "%sub{select_constexpr_spec_kind}0 can only be used "
2774  "in %select{|variable and function|function|variable}0 declarations">;
2775def err_invalid_constexpr_var_decl : Error<
2776  "constexpr variable declaration must be a definition">;
2777def err_constexpr_static_mem_var_requires_init : Error<
2778  "declaration of constexpr static data member %0 requires an initializer">;
2779def err_constexpr_var_non_literal : Error<
2780  "constexpr variable cannot have non-literal type %0">;
2781def err_constexpr_var_requires_const_init : Error<
2782  "constexpr variable %0 must be initialized by a constant expression">;
2783def err_constexpr_var_requires_const_destruction : Error<
2784  "constexpr variable %0 must have constant destruction">;
2785def err_constexpr_redecl_mismatch : Error<
2786  "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2787  " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2788def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2789def warn_cxx17_compat_constexpr_virtual : Warning<
2790  "virtual constexpr functions are incompatible with "
2791  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2792def err_constexpr_virtual_base : Error<
2793  "constexpr %select{member function|constructor}0 not allowed in "
2794  "%select{struct|interface|class}1 with virtual base "
2795  "%plural{1:class|:classes}2">;
2796def note_non_literal_incomplete : Note<
2797  "incomplete type %0 is not a literal type">;
2798def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2799  "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2800def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2801def err_constexpr_non_literal_return : Error<
2802  "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2803def err_constexpr_non_literal_param : Error<
2804  "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2805  "not a literal type">;
2806def err_constexpr_body_invalid_stmt : Error<
2807  "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2808def ext_constexpr_body_invalid_stmt : ExtWarn<
2809  "use of this statement in a constexpr %select{function|constructor}0 "
2810  "is a C++14 extension">, InGroup<CXX14>;
2811def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2812  "use of this statement in a constexpr %select{function|constructor}0 "
2813  "is incompatible with C++ standards before C++14">,
2814  InGroup<CXXPre14Compat>, DefaultIgnore;
2815def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2816  "use of this statement in a constexpr %select{function|constructor}0 "
2817  "is a C++20 extension">, InGroup<CXX20>;
2818def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2819  "use of this statement in a constexpr %select{function|constructor}0 "
2820  "is incompatible with C++ standards before C++20">,
2821  InGroup<CXXPre20Compat>, DefaultIgnore;
2822def ext_constexpr_body_invalid_stmt_cxx23 : ExtWarn<
2823  "use of this statement in a constexpr %select{function|constructor}0 "
2824  "is a C++23 extension">, InGroup<CXX23>;
2825def warn_cxx20_compat_constexpr_body_invalid_stmt : Warning<
2826  "use of this statement in a constexpr %select{function|constructor}0 "
2827  "is incompatible with C++ standards before C++23">,
2828  InGroup<CXXPre23Compat>, DefaultIgnore;
2829def ext_constexpr_type_definition : ExtWarn<
2830  "type definition in a constexpr %select{function|constructor}0 "
2831  "is a C++14 extension">, InGroup<CXX14>;
2832def warn_cxx11_compat_constexpr_type_definition : Warning<
2833  "type definition in a constexpr %select{function|constructor}0 "
2834  "is incompatible with C++ standards before C++14">,
2835  InGroup<CXXPre14Compat>, DefaultIgnore;
2836def err_constexpr_vla : Error<
2837  "variably-modified type %0 cannot be used in a constexpr "
2838  "%select{function|constructor}1">;
2839def ext_constexpr_local_var : ExtWarn<
2840  "variable declaration in a constexpr %select{function|constructor}0 "
2841  "is a C++14 extension">, InGroup<CXX14>;
2842def warn_cxx11_compat_constexpr_local_var : Warning<
2843  "variable declaration in a constexpr %select{function|constructor}0 "
2844  "is incompatible with C++ standards before C++14">,
2845  InGroup<CXXPre14Compat>, DefaultIgnore;
2846def ext_constexpr_static_var : ExtWarn<
2847  "definition of a %select{static|thread_local}1 variable "
2848  "in a constexpr %select{function|constructor}0 "
2849  "is a C++23 extension">, InGroup<CXX23>;
2850def warn_cxx20_compat_constexpr_var : Warning<
2851  "definition of a %select{static variable|thread_local variable|variable "
2852  "of non-literal type}1 in a constexpr %select{function|constructor}0 "
2853  "is incompatible with C++ standards before C++23">,
2854  InGroup<CXXPre23Compat>, DefaultIgnore;
2855def err_constexpr_local_var_non_literal_type : Error<
2856  "variable of non-literal type %1 cannot be defined in a constexpr "
2857  "%select{function|constructor}0 before C++23">;
2858def ext_constexpr_local_var_no_init : ExtWarn<
2859  "uninitialized variable in a constexpr %select{function|constructor}0 "
2860  "is a C++20 extension">, InGroup<CXX20>;
2861def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2862  "uninitialized variable in a constexpr %select{function|constructor}0 "
2863  "is incompatible with C++ standards before C++20">,
2864  InGroup<CXXPre20Compat>, DefaultIgnore;
2865def ext_constexpr_function_never_constant_expr : ExtWarn<
2866  "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2867  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2868def err_attr_cond_never_constant_expr : Error<
2869  "%0 attribute expression never produces a constant expression">;
2870def err_diagnose_if_invalid_diagnostic_type : Error<
2871  "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2872  "instead">;
2873def err_constexpr_body_no_return : Error<
2874  "no return statement in %select{constexpr|consteval}0 function">;
2875def err_constexpr_return_missing_expr : Error<
2876  "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2877def warn_cxx11_compat_constexpr_body_no_return : Warning<
2878  "constexpr function with no return statements is incompatible with C++ "
2879  "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2880def ext_constexpr_body_multiple_return : ExtWarn<
2881  "multiple return statements in constexpr function is a C++14 extension">,
2882  InGroup<CXX14>;
2883def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2884  "multiple return statements in constexpr function "
2885  "is incompatible with C++ standards before C++14">,
2886  InGroup<CXXPre14Compat>, DefaultIgnore;
2887def note_constexpr_body_previous_return : Note<
2888  "previous return statement is here">;
2889def err_ms_constexpr_cannot_be_applied : Error<
2890  "attribute 'msvc::constexpr' cannot be applied to the %select{constexpr|consteval|virtual}0 function %1">;
2891
2892// C++20 function try blocks in constexpr
2893def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2894  "function try block in constexpr %select{function|constructor}0 is "
2895  "a C++20 extension">, InGroup<CXX20>;
2896def warn_cxx17_compat_constexpr_function_try_block : Warning<
2897  "function try block in constexpr %select{function|constructor}0 is "
2898  "incompatible with C++ standards before C++20">,
2899  InGroup<CXXPre20Compat>, DefaultIgnore;
2900
2901def ext_constexpr_union_ctor_no_init : ExtWarn<
2902  "constexpr union constructor that does not initialize any member "
2903  "is a C++20 extension">, InGroup<CXX20>;
2904def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2905  "constexpr union constructor that does not initialize any member "
2906  "is incompatible with C++ standards before C++20">,
2907  InGroup<CXXPre20Compat>, DefaultIgnore;
2908def ext_constexpr_ctor_missing_init : ExtWarn<
2909  "constexpr constructor that does not initialize all members "
2910  "is a C++20 extension">, InGroup<CXX20>;
2911def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2912  "constexpr constructor that does not initialize all members "
2913  "is incompatible with C++ standards before C++20">,
2914  InGroup<CXXPre20Compat>, DefaultIgnore;
2915def note_constexpr_ctor_missing_init : Note<
2916  "member not initialized by constructor">;
2917def note_non_literal_no_constexpr_ctors : Note<
2918  "%0 is not literal because it is not an aggregate and has no constexpr "
2919  "constructors other than copy or move constructors">;
2920def note_non_literal_base_class : Note<
2921  "%0 is not literal because it has base class %1 of non-literal type">;
2922def note_non_literal_field : Note<
2923  "%0 is not literal because it has data member %1 of "
2924  "%select{non-literal|volatile}3 type %2">;
2925def note_non_literal_user_provided_dtor : Note<
2926  "%0 is not literal because it has a user-provided destructor">;
2927def note_non_literal_nontrivial_dtor : Note<
2928  "%0 is not literal because it has a non-trivial destructor">;
2929def note_non_literal_non_constexpr_dtor : Note<
2930  "%0 is not literal because its destructor is not constexpr">;
2931def note_non_literal_lambda : Note<
2932  "lambda closure types are non-literal types before C++17">;
2933def warn_private_extern : Warning<
2934  "use of __private_extern__ on a declaration may not produce external symbol "
2935  "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2936def note_private_extern : Note<
2937  "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2938
2939// C++ Concepts
2940def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2941  "concept declarations may only appear in global or namespace scope">;
2942def err_concept_no_parameters : Error<
2943  "concept template parameter list must have at least one parameter; explicit "
2944  "specialization of concepts is not allowed">;
2945def err_concept_extra_headers : Error<
2946  "extraneous template parameter list in concept definition">;
2947def err_concept_no_associated_constraints : Error<
2948  "concept cannot have associated constraints">;
2949def err_non_constant_constraint_expression : Error<
2950  "substitution into constraint expression resulted in a non-constant "
2951  "expression">;
2952def err_non_bool_atomic_constraint : Error<
2953  "atomic constraint must be of type 'bool' (found %0)">;
2954def err_template_arg_list_constraints_not_satisfied : Error<
2955  "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2956  "template template parameter|template}0 %1%2">;
2957def note_substituted_constraint_expr_is_ill_formed : Note<
2958  "because substituted constraint expression is ill-formed%0">;
2959def note_constraint_references_error
2960    : Note<"constraint depends on a previously diagnosed expression">;
2961def note_atomic_constraint_evaluated_to_false : Note<
2962  "%select{and|because}0 '%1' evaluated to false">;
2963def note_concept_specialization_constraint_evaluated_to_false : Note<
2964  "%select{and|because}0 '%1' evaluated to false">;
2965def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2966  "%select{and|because}0 %1 does not satisfy %2">;
2967def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2968  "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2969def err_constrained_virtual_method : Error<
2970  "virtual function cannot have a requires clause">;
2971def err_trailing_requires_clause_on_deduction_guide : Error<
2972  "deduction guide cannot have a requires clause">;
2973def err_constrained_non_templated_function
2974    : Error<"non-templated function cannot have a requires clause">;
2975def err_reference_to_function_with_unsatisfied_constraints : Error<
2976  "invalid reference to function %0: constraints not satisfied">;
2977def err_requires_expr_local_parameter_default_argument : Error<
2978  "default arguments not allowed for parameters of a requires expression">;
2979def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2980  "constraint variable %0 cannot be used in an evaluated context">;
2981def note_expr_requirement_expr_substitution_error : Note<
2982  "%select{and|because}0 '%1' would be invalid: %2">;
2983def note_expr_requirement_expr_unknown_substitution_error : Note<
2984  "%select{and|because}0 '%1' would be invalid">;
2985def note_expr_requirement_noexcept_not_met : Note<
2986  "%select{and|because}0 '%1' may throw an exception">;
2987def note_expr_requirement_type_requirement_substitution_error : Note<
2988  "%select{and|because}0 '%1' would be invalid: %2">;
2989def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
2990  "%select{and|because}0 '%1' would be invalid">;
2991def note_expr_requirement_constraints_not_satisfied : Note<
2992  "%select{and|because}0 type constraint '%1' was not satisfied:">;
2993def note_expr_requirement_constraints_not_satisfied_simple : Note<
2994  "%select{and|because}0 %1 does not satisfy %2:">;
2995def note_type_requirement_substitution_error : Note<
2996  "%select{and|because}0 '%1' would be invalid: %2">;
2997def note_type_requirement_unknown_substitution_error : Note<
2998  "%select{and|because}0 '%1' would be invalid">;
2999def note_nested_requirement_substitution_error : Note<
3000  "%select{and|because}0 '%1' would be invalid%2">;
3001def note_nested_requirement_unknown_substitution_error : Note<
3002  "%select{and|because}0 '%1' would be invalid">;
3003def note_ambiguous_atomic_constraints : Note<
3004  "similar constraint expressions not considered equivalent; constraint "
3005  "expressions cannot be considered equivalent unless they originate from the "
3006  "same concept">;
3007def note_ambiguous_atomic_constraints_similar_expression : Note<
3008  "similar constraint expression here">;
3009def err_unsupported_placeholder_constraint : Error<
3010  "constrained placeholder types other than simple 'auto' on non-type template "
3011  "parameters not supported yet">;
3012
3013def err_template_different_requires_clause : Error<
3014  "requires clause differs in template redeclaration">;
3015def err_template_different_type_constraint : Error<
3016  "type constraint differs in template redeclaration">;
3017def err_template_template_parameter_not_at_least_as_constrained : Error<
3018  "template template argument %0 is more constrained than template template "
3019  "parameter %1">;
3020
3021def err_type_constraint_non_type_concept : Error<
3022  "concept named in type constraint is not a type concept">;
3023def err_type_constraint_missing_arguments : Error<
3024  "%0 requires more than 1 template argument; provide the remaining arguments "
3025  "explicitly to use it here">;
3026def err_placeholder_constraints_not_satisfied : Error<
3027  "deduced type %0 does not satisfy %1">;
3028
3029// C++11 char16_t/char32_t
3030def warn_cxx98_compat_unicode_type : Warning<
3031  "'%0' type specifier is incompatible with C++98">,
3032  InGroup<CXX98Compat>, DefaultIgnore;
3033def warn_cxx17_compat_unicode_type : Warning<
3034  "'char8_t' type specifier is incompatible with C++ standards before C++20">,
3035  InGroup<CXXPre20Compat>, DefaultIgnore;
3036
3037// __make_integer_seq
3038def err_integer_sequence_negative_length : Error<
3039  "integer sequences must have non-negative sequence length">;
3040def err_integer_sequence_integral_element_type : Error<
3041  "integer sequences must have integral element type">;
3042
3043// __type_pack_element
3044def err_type_pack_element_out_of_bounds : Error<
3045  "a parameter pack may not be accessed at an out of bounds index">;
3046
3047// Objective-C++
3048def err_objc_decls_may_only_appear_in_global_scope : Error<
3049  "Objective-C declarations may only appear in global scope">;
3050def warn_auto_var_is_id : Warning<
3051  "'auto' deduced as 'id' in declaration of %0">,
3052  InGroup<DiagGroup<"auto-var-id">>;
3053
3054// Attributes
3055def warn_attribute_ignored_no_calls_in_stmt: Warning<
3056  "%0 attribute is ignored because there exists no call expression inside the "
3057  "statement">,
3058  InGroup<IgnoredAttributes>;
3059
3060def warn_attribute_ignored_non_function_pointer: Warning<
3061  "%0 attribute is ignored because %1 is not a function pointer">,
3062  InGroup<IgnoredAttributes>;
3063
3064def warn_function_attribute_ignored_in_stmt : Warning<
3065  "attribute is ignored on this statement as it only applies to functions; "
3066  "use '%0' on statements">,
3067  InGroup<IgnoredAttributes>;
3068
3069def err_musttail_needs_trivial_args : Error<
3070  "tail call requires that the return value, all parameters, and any "
3071  "temporaries created by the expression are trivially destructible">;
3072def err_musttail_needs_call : Error<
3073  "%0 attribute requires that the return value is the result of a function call"
3074  >;
3075def err_musttail_needs_prototype : Error<
3076  "%0 attribute requires that both caller and callee functions have a "
3077  "prototype">;
3078def note_musttail_fix_non_prototype : Note<
3079  "add 'void' to the parameter list to turn an old-style K&R function "
3080  "declaration into a prototype">;
3081def err_musttail_structors_forbidden : Error<"cannot perform a tail call "
3082  "%select{from|to}0 a %select{constructor|destructor}1">;
3083def note_musttail_structors_forbidden : Note<"target "
3084  "%select{constructor|destructor}0 is declared here">;
3085def err_musttail_forbidden_from_this_context : Error<
3086  "%0 attribute cannot be used from "
3087  "%select{a block|an Objective-C function|this context}1">;
3088def err_musttail_member_mismatch : Error<
3089  "%select{non-member|static member|non-static member}0 "
3090  "function cannot perform a tail call to "
3091  "%select{non-member|static member|non-static member|pointer-to-member}1 "
3092  "function%select{| %3}2">;
3093def note_musttail_callee_defined_here : Note<"%0 declared here">;
3094def note_tail_call_required : Note<"tail call required by %0 attribute here">;
3095def err_musttail_mismatch : Error<
3096  "cannot perform a tail call to function%select{| %1}0 because its signature "
3097  "is incompatible with the calling function">;
3098def note_musttail_mismatch : Note<
3099    "target function "
3100    "%select{is a member of different class%diff{ (expected $ but has $)|}1,2"
3101    "|has different number of parameters (expected %1 but has %2)"
3102    "|has type mismatch at %ordinal3 parameter"
3103    "%diff{ (expected $ but has $)|}1,2"
3104    "|has different return type%diff{ ($ expected but has $)|}1,2}0">;
3105def err_musttail_callconv_mismatch : Error<
3106  "cannot perform a tail call to function%select{| %1}0 because it uses an "
3107  "incompatible calling convention">;
3108def note_musttail_callconv_mismatch : Note<
3109  "target function has calling convention %1 (expected %0)">;
3110def err_musttail_scope : Error<
3111  "cannot perform a tail call from this return statement">;
3112def err_musttail_no_variadic : Error<
3113  "%0 attribute may not be used with variadic functions">;
3114
3115def err_nsobject_attribute : Error<
3116  "'NSObject' attribute is for pointer types only">;
3117def err_attributes_are_not_compatible : Error<
3118  "%0 and %1%select{ attributes|}2 are not compatible">;
3119def err_attribute_invalid_argument : Error<
3120  "%select{a reference type|an array type|a non-vector or "
3121  "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
3122def err_attribute_wrong_number_arguments : Error<
3123  "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
3124  ":requires exactly %1 arguments}1">;
3125def err_attribute_wrong_number_arguments_for : Error <
3126  "%0 attribute references function %1, which %plural{0:takes no arguments|1:takes one argument|"
3127  ":takes exactly %2 arguments}2">;
3128def err_attribute_bounds_for_function : Error<
3129  "%0 attribute references parameter %1, but the function %2 has only %3 parameters">;
3130def err_attribute_no_member_function : Error<
3131  "%0 attribute cannot be applied to non-static member functions">;
3132def err_attribute_parameter_types : Error<
3133  "%0 attribute parameter types do not match: parameter %1 of function %2 has type %3, "
3134  "but parameter %4 of function %5 has type %6">;
3135
3136def err_attribute_too_many_arguments : Error<
3137  "%0 attribute takes no more than %1 argument%s1">;
3138def err_attribute_too_few_arguments : Error<
3139  "%0 attribute takes at least %1 argument%s1">;
3140def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
3141def err_attribute_invalid_bitint_vector_type : Error<
3142  "'_BitInt' vector element width must be %select{a power of 2|"
3143  "at least as wide as 'CHAR_BIT'}0">;
3144def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
3145def err_attribute_bad_neon_vector_size : Error<
3146  "Neon vector size must be 64 or 128 bits">;
3147def err_attribute_invalid_sve_type : Error<
3148  "%0 attribute applied to non-SVE type %1">;
3149def err_attribute_bad_sve_vector_size : Error<
3150  "invalid SVE vector size '%0', must match value set by "
3151  "'-msve-vector-bits' ('%1')">;
3152def err_attribute_arm_feature_sve_bits_unsupported : Error<
3153  "%0 is only supported when '-msve-vector-bits=<bits>' is specified with a "
3154  "value of 128, 256, 512, 1024 or 2048.">;
3155def warn_attribute_arm_sm_incompat_builtin : Warning<
3156  "builtin call has undefined behaviour when called from a %0 function">,
3157  InGroup<DiagGroup<"undefined-arm-streaming">>;
3158def err_sve_vector_in_non_sve_target : Error<
3159  "SVE vector type %0 cannot be used in a target without sve">;
3160def err_attribute_riscv_rvv_bits_unsupported : Error<
3161  "%0 is only supported when '-mrvv-vector-bits=<bits>' is specified with a "
3162  "value of \"zvl\" or a power 2 in the range [64,65536]">;
3163def err_attribute_bad_rvv_vector_size : Error<
3164  "invalid RVV vector size '%0', expected size is '%1' based on LMUL of type "
3165  "and '-mrvv-vector-bits'">;
3166def err_attribute_invalid_rvv_type : Error<
3167  "%0 attribute applied to non-RVV type %1">;
3168def err_attribute_requires_positive_integer : Error<
3169  "%0 attribute requires a %select{positive|non-negative}1 "
3170  "integral compile time constant expression">;
3171def err_attribute_requires_opencl_version : Error<
3172  "attribute %0 is supported in the OpenCL version %1%select{| onwards}2">;
3173def err_invalid_branch_protection_spec : Error<
3174  "invalid or misplaced branch protection specification '%0'">;
3175def warn_unsupported_branch_protection_spec : Warning<
3176  "unsupported branch protection specification '%0'">, InGroup<BranchProtection>;
3177
3178def warn_unsupported_target_attribute
3179    : Warning<"%select{unsupported|duplicate|unknown}0%select{| CPU|"
3180              " tune CPU}1 '%2' in the '%select{target|target_clones|target_version}3' "
3181              "attribute string; '%select{target|target_clones|target_version}3' "
3182              "attribute ignored">,
3183      InGroup<IgnoredAttributes>;
3184def err_attribute_unsupported
3185    : Error<"%0 attribute is not supported on targets missing %1;"
3186            " specify an appropriate -march= or -mcpu=">;
3187def err_duplicate_target_attribute
3188    : Error<"%select{unsupported|duplicate|unknown}0%select{| CPU|"
3189              " tune CPU}1 '%2' in the '%select{target|target_clones|target_version}3' "
3190              "attribute string; ">;
3191// The err_*_attribute_argument_not_int are separate because they're used by
3192// VerifyIntegerConstantExpression.
3193def err_aligned_attribute_argument_not_int : Error<
3194  "'aligned' attribute requires integer constant">;
3195def err_align_value_attribute_argument_not_int : Error<
3196  "'align_value' attribute requires integer constant">;
3197def err_alignas_attribute_wrong_decl_type : Error<
3198  "%0 attribute cannot be applied to %select{a function parameter|"
3199  "a variable with 'register' storage class|a 'catch' variable|a bit-field|"
3200  "an enumeration}1">;
3201def err_alignas_missing_on_definition : Error<
3202  "%0 must be specified on definition if it is specified on any declaration">;
3203def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
3204def err_alignas_mismatch : Error<
3205  "redeclaration has different alignment requirement (%1 vs %0)">;
3206def err_alignas_underaligned : Error<
3207  "requested alignment is less than minimum alignment of %1 for type %0">;
3208def warn_aligned_attr_underaligned : Warning<err_alignas_underaligned.Summary>,
3209  InGroup<IgnoredAttributes>;
3210def err_attribute_sizeless_type : Error<
3211  "%0 attribute cannot be applied to sizeless type %1">;
3212def err_attribute_argument_n_type : Error<
3213  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
3214  "constant|a string|an identifier|a constant expression|a builtin function}2">;
3215def err_attribute_argument_type : Error<
3216  "%0 attribute requires %select{int or bool|an integer "
3217  "constant|a string|an identifier}1">;
3218def err_attribute_argument_out_of_range : Error<
3219  "%0 attribute requires integer constant between %1 and %2 inclusive">;
3220def err_init_priority_object_attr : Error<
3221  "can only use 'init_priority' attribute on file-scope definitions "
3222  "of objects of class type">;
3223def err_attribute_argument_out_of_bounds : Error<
3224  "%0 attribute parameter %1 is out of bounds">;
3225def err_attribute_only_once_per_parameter : Error<
3226  "%0 attribute can only be applied once per parameter">;
3227def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
3228def note_previous_uuid : Note<"previous uuid specified here">;
3229def warn_attribute_pointers_only : Warning<
3230  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
3231  InGroup<IgnoredAttributes>;
3232def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Summary>;
3233def err_attribute_integers_only : Error<
3234  "%0 attribute argument may only refer to a function parameter of integer "
3235  "type">;
3236def warn_attribute_return_pointers_only : Warning<
3237  "%0 attribute only applies to return values that are pointers">,
3238  InGroup<IgnoredAttributes>;
3239def warn_attribute_return_pointers_refs_only : Warning<
3240  "%0 attribute only applies to return values that are pointers or references">,
3241  InGroup<IgnoredAttributes>;
3242def warn_attribute_pointer_or_reference_only : Warning<
3243  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
3244  InGroup<IgnoredAttributes>;
3245def err_attribute_no_member_pointers : Error<
3246  "%0 attribute cannot be used with pointers to members">;
3247def err_attribute_invalid_implicit_this_argument : Error<
3248  "%0 attribute is invalid for the implicit this argument">;
3249def err_ownership_type : Error<
3250  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
3251def err_ownership_returns_index_mismatch : Error<
3252  "'ownership_returns' attribute index does not match; here it is %0">;
3253def note_ownership_returns_index_mismatch : Note<
3254  "declared with index %0 here">;
3255def err_format_strftime_third_parameter : Error<
3256  "strftime format attribute requires 3rd parameter to be 0">;
3257def err_format_attribute_not : Error<"format argument not a string type">;
3258def err_format_attribute_result_not : Error<"function does not return %0">;
3259def err_format_attribute_implicit_this_format_string : Error<
3260  "format attribute cannot specify the implicit this argument as the format "
3261  "string">;
3262def err_callback_attribute_no_callee : Error<
3263  "'callback' attribute specifies no callback callee">;
3264def err_callback_attribute_invalid_callee : Error<
3265  "'callback' attribute specifies invalid callback callee">;
3266def err_callback_attribute_multiple : Error<
3267  "multiple 'callback' attributes specified">;
3268def err_callback_attribute_argument_unknown : Error<
3269  "'callback' attribute argument %0 is not a known function parameter">;
3270def err_callback_callee_no_function_type : Error<
3271  "'callback' attribute callee does not have function type">;
3272def err_callback_callee_is_variadic : Error<
3273  "'callback' attribute callee may not be variadic">;
3274def err_callback_implicit_this_not_available : Error<
3275  "'callback' argument at position %0 references unavailable implicit 'this'">;
3276def err_init_method_bad_return_type : Error<
3277  "init methods must return an object pointer type, not %0">;
3278def err_attribute_invalid_size : Error<
3279  "vector size not an integral multiple of component size">;
3280def err_attribute_zero_size : Error<"zero %0 size">;
3281def err_attribute_size_too_large : Error<"%0 size too large">;
3282def err_typecheck_sve_rvv_ambiguous : Error<
3283  "cannot combine fixed-length and sizeless %select{SVE|RVV}0 vectors "
3284  "in expression, result is ambiguous (%1 and %2)">;
3285def err_typecheck_sve_rvv_gnu_ambiguous : Error<
3286  "cannot combine GNU and %select{SVE|RVV}0 vectors in expression, result is ambiguous (%1 and %2)">;
3287def err_typecheck_vector_not_convertable_implict_truncation : Error<
3288   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
3289   " %2 as implicit conversion would cause truncation">;
3290def err_typecheck_vector_not_convertable : Error<
3291  "cannot convert between vector values of different size (%0 and %1)">;
3292def err_typecheck_vector_not_convertable_non_scalar : Error<
3293  "cannot convert between vector and non-scalar values (%0 and %1)">;
3294def err_typecheck_vector_lengths_not_equal : Error<
3295  "vector operands do not have the same number of elements (%0 and %1)">;
3296def warn_typecheck_vector_element_sizes_not_equal : Warning<
3297  "vector operands do not have the same elements sizes (%0 and %1)">,
3298  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
3299def err_ext_vector_component_exceeds_length : Error<
3300  "vector component access exceeds type %0">;
3301def err_ext_vector_component_name_illegal : Error<
3302  "illegal vector component name '%0'">;
3303def err_attribute_address_space_negative : Error<
3304  "address space is negative">;
3305def err_attribute_address_space_too_high : Error<
3306  "address space is larger than the maximum supported (%0)">;
3307def err_attribute_address_multiple_qualifiers : Error<
3308  "multiple address spaces specified for type">;
3309def warn_attribute_address_multiple_identical_qualifiers : Warning<
3310  "multiple identical address spaces specified for type">,
3311  InGroup<DuplicateDeclSpecifier>;
3312def err_attribute_not_clinkage : Error<
3313  "function type with %0 attribute must have C linkage">;
3314def err_function_decl_cmse_ns_call : Error<
3315  "functions may not be declared with 'cmse_nonsecure_call' attribute">;
3316def err_attribute_address_function_type : Error<
3317  "function type may not be qualified with an address space">;
3318def err_as_qualified_auto_decl : Error<
3319  "automatic variable qualified with an%select{| invalid}0 address space">;
3320def err_arg_with_address_space : Error<
3321  "parameter may not be qualified with an address space">;
3322def err_field_with_address_space : Error<
3323  "field may not be qualified with an address space">;
3324def err_compound_literal_with_address_space : Error<
3325  "compound literal in function scope may not be qualified with an address space">;
3326def err_address_space_mismatch_templ_inst : Error<
3327  "conflicting address space qualifiers are provided between types %0 and %1">;
3328def err_attr_objc_ownership_redundant : Error<
3329  "the type %0 is already explicitly ownership-qualified">;
3330def err_invalid_nsnumber_type : Error<
3331  "%0 is not a valid literal type for NSNumber">;
3332def err_objc_illegal_boxed_expression_type : Error<
3333  "illegal type %0 used in a boxed expression">;
3334def err_objc_non_trivially_copyable_boxed_expression_type : Error<
3335  "non-trivially copyable type %0 cannot be used in a boxed expression">;
3336def err_objc_incomplete_boxed_expression_type : Error<
3337  "incomplete type %0 used in a boxed expression">;
3338def err_undeclared_objc_literal_class : Error<
3339  "definition of class %0 must be available to use Objective-C "
3340  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
3341  "string literals}1">;
3342def err_undeclared_boxing_method : Error<
3343  "declaration of %0 is missing in %1 class">;
3344def err_objc_literal_method_sig : Error<
3345  "literal construction method %0 has incompatible signature">;
3346def note_objc_literal_method_param : Note<
3347  "%select{first|second|third}0 parameter has unexpected type %1 "
3348  "(should be %2)">;
3349def note_objc_literal_method_return : Note<
3350  "method returns unexpected type %0 (should be an object type)">;
3351def err_invalid_collection_element : Error<
3352  "collection element of type %0 is not an Objective-C object">;
3353def err_box_literal_collection : Error<
3354  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3355  "in a collection">;
3356def warn_objc_literal_comparison : Warning<
3357  "direct comparison of %select{an array literal|a dictionary literal|"
3358  "a numeric literal|a boxed expression|}0 has undefined behavior">,
3359  InGroup<ObjCLiteralComparison>;
3360def err_missing_atsign_prefix : Error<
3361  "%select{string|numeric}0 literal must be prefixed by '@'">;
3362def warn_objc_string_literal_comparison : Warning<
3363  "direct comparison of a string literal has undefined behavior">,
3364  InGroup<ObjCStringComparison>;
3365def warn_concatenated_literal_array_init : Warning<
3366  "suspicious concatenation of string literals in an array initialization; "
3367  "did you mean to separate the elements with a comma?">,
3368  InGroup<StringConcatation>, DefaultIgnore;
3369def warn_concatenated_nsarray_literal : Warning<
3370  "concatenated NSString literal for an NSArray expression - "
3371  "possibly missing a comma">,
3372  InGroup<ObjCStringConcatenation>;
3373def note_objc_literal_comparison_isequal : Note<
3374  "use 'isEqual:' instead">;
3375def warn_objc_collection_literal_element : Warning<
3376  "object of type %0 is not compatible with "
3377  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3378  InGroup<ObjCLiteralConversion>;
3379def warn_nsdictionary_duplicate_key : Warning<
3380  "duplicate key in dictionary literal">,
3381  InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3382def note_nsdictionary_duplicate_key_here : Note<
3383  "previous equal key is here">;
3384def err_swift_param_attr_not_swiftcall : Error<
3385  "'%0' parameter can only be used with swiftcall%select{ or swiftasynccall|}1 "
3386  "calling convention%select{|s}1">;
3387def err_swift_indirect_result_not_first : Error<
3388  "'swift_indirect_result' parameters must be first parameters of function">;
3389def err_swift_error_result_not_after_swift_context : Error<
3390  "'swift_error_result' parameter must follow 'swift_context' parameter">;
3391def err_swift_abi_parameter_wrong_type : Error<
3392  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3393  "type here is %2">;
3394
3395def err_attribute_argument_invalid : Error<
3396  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3397  "min must not be greater than max}1">;
3398def err_attribute_argument_is_zero : Error<
3399  "%0 attribute must be greater than 0">;
3400def warn_attribute_argument_n_negative : Warning<
3401  "%0 attribute parameter %1 is negative and will be ignored">,
3402  InGroup<CudaCompat>;
3403def err_property_function_in_objc_container : Error<
3404  "use of Objective-C property in function nested in Objective-C "
3405  "container not supported, move function outside its container">;
3406
3407let CategoryName = "Cocoa API Issue" in {
3408def warn_objc_redundant_literal_use : Warning<
3409  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3410}
3411
3412def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3413  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3414
3415def err_aix_attr_unsupported_tls_model : Error<"TLS model '%0' is not yet supported on AIX">;
3416
3417def err_tls_var_aligned_over_maximum : Error<
3418  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3419  "alignment (%2) for a thread-local variable on this target">;
3420
3421def err_only_annotate_after_access_spec : Error<
3422  "access specifier can only have annotation attributes">;
3423
3424def err_attribute_section_invalid_for_target : Error<
3425  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3426def err_pragma_section_invalid_for_target : Error<
3427  "argument to #pragma section is not valid for this target: %0">;
3428def warn_attribute_section_drectve : Warning<
3429  "#pragma %0(\".drectve\") has undefined behavior, "
3430  "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3431def warn_mismatched_section : Warning<
3432  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3433def warn_attribute_section_on_redeclaration : Warning<
3434  "section attribute is specified on redeclared variable">, InGroup<Section>;
3435def err_mismatched_code_seg_base : Error<
3436  "derived class must specify the same code segment as its base classes">;
3437def err_mismatched_code_seg_override : Error<
3438  "overriding virtual function must specify the same code segment as its overridden function">;
3439def err_conflicting_codeseg_attribute : Error<
3440  "conflicting code segment specifiers">;
3441def warn_duplicate_codeseg_attribute : Warning<
3442  "duplicate code segment specifiers">, InGroup<Section>;
3443
3444def err_anonymous_property: Error<
3445  "anonymous property is not supported">;
3446def err_property_is_variably_modified : Error<
3447  "property %0 has a variably modified type">;
3448def err_no_accessor_for_property : Error<
3449  "no %select{getter|setter}0 defined for property %1">;
3450def err_cannot_find_suitable_accessor : Error<
3451  "cannot find suitable %select{getter|setter}0 for property %1">;
3452
3453def warn_alloca : Warning<
3454  "use of function %0 is discouraged; there is no way to check for failure but "
3455  "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3456  InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3457
3458def warn_alloca_align_alignof : Warning<
3459  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3460  InGroup<DiagGroup<"alloca-with-align-alignof">>;
3461
3462def err_alignment_too_small : Error<
3463  "requested alignment must be %0 or greater">;
3464def err_alignment_too_big : Error<
3465  "requested alignment must be %0 or smaller">;
3466def err_alignment_not_power_of_two : Error<
3467  "requested alignment is not a power of 2">;
3468def warn_alignment_not_power_of_two : Warning<
3469  err_alignment_not_power_of_two.Summary>,
3470  InGroup<DiagGroup<"non-power-of-two-alignment">>;
3471def err_alignment_dependent_typedef_name : Error<
3472  "requested alignment is dependent but declaration is not dependent">;
3473
3474def warn_alignment_builtin_useless : Warning<
3475  "%select{aligning a value|the result of checking whether a value is aligned}0"
3476  " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3477def err_attribute_aligned_too_great : Error<
3478  "requested alignment must be %0 bytes or smaller">;
3479def warn_assume_aligned_too_great
3480    : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3481              "alignment assumed">,
3482      InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3483def warn_not_xl_compatible
3484    : Warning<"alignment of 16 bytes for a struct member is not binary "
3485              "compatible with IBM XL C/C++ for AIX 16.1.0 or older">,
3486      InGroup<AIXCompat>;
3487def note_misaligned_member_used_here : Note<
3488    "passing byval argument %0 with potentially incompatible alignment here">;
3489def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3490  "%q0 redeclared without %1 attribute: previous %1 ignored">,
3491  InGroup<MicrosoftInconsistentDllImport>;
3492def warn_redeclaration_without_import_attribute : Warning<
3493  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3494  InGroup<MicrosoftInconsistentDllImport>;
3495def warn_dllimport_dropped_from_inline_function : Warning<
3496  "%q0 redeclared inline; %1 attribute ignored">,
3497  InGroup<IgnoredAttributes>;
3498def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3499  " exception specification; attribute ignored">,
3500  InGroup<IgnoredAttributes>;
3501def warn_attribute_ignored_on_non_definition :
3502  Warning<"%0 attribute ignored on a non-definition declaration">,
3503  InGroup<IgnoredAttributes>;
3504def warn_attribute_ignored_on_inline :
3505  Warning<"%0 attribute ignored on inline function">,
3506  InGroup<IgnoredAttributes>;
3507def warn_nocf_check_attribute_ignored :
3508  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3509  InGroup<IgnoredAttributes>;
3510def warn_attribute_after_definition_ignored : Warning<
3511  "attribute %0 after definition is ignored">,
3512   InGroup<IgnoredAttributes>;
3513def warn_attributes_likelihood_ifstmt_conflict
3514    : Warning<"conflicting attributes %0 are ignored">,
3515      InGroup<IgnoredAttributes>;
3516def warn_cxx11_gnu_attribute_on_type : Warning<
3517  "attribute %0 ignored, because it cannot be applied to a type">,
3518  InGroup<IgnoredAttributes>;
3519def warn_unhandled_ms_attribute_ignored : Warning<
3520  "__declspec attribute %0 is not supported">,
3521  InGroup<IgnoredAttributes>;
3522def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3523  "attribute %0 has no effect when annotating an infinite loop">,
3524   InGroup<IgnoredAttributes>;
3525def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3526  "annotating the infinite loop here">;
3527def warn_attribute_has_no_effect_on_compile_time_if : Warning<
3528  "attribute %0 has no effect when annotating an 'if %select{constexpr|consteval}1' statement">,
3529   InGroup<IgnoredAttributes>;
3530def note_attribute_has_no_effect_on_compile_time_if_here : Note<
3531  "annotating the 'if %select{constexpr|consteval}0' statement here">;
3532def err_decl_attribute_invalid_on_stmt : Error<
3533  "%0%select{ attribute|}1 cannot be applied to a statement">;
3534def err_attribute_invalid_on_decl : Error<
3535  "%0%select{ attribute|}1 cannot be applied to a declaration">;
3536def warn_type_attribute_deprecated_on_decl : Warning<
3537  "applying attribute %0 to a declaration is deprecated; apply it to the type instead">,
3538  InGroup<DeprecatedAttributes>;
3539def warn_declspec_attribute_ignored : Warning<
3540  "attribute %0 is ignored, place it after "
3541  "\"%select{class|struct|interface|union|enum|enum class|enum struct}1\" to apply attribute to "
3542  "type declaration">, InGroup<IgnoredAttributes>;
3543def err_declspec_keyword_has_no_effect : Error<
3544  "%0 cannot appear here, place it after "
3545  "\"%select{class|struct|interface|union|enum}1\" to apply it to the "
3546  "type declaration">;
3547def warn_attribute_precede_definition : Warning<
3548  "attribute declaration must precede definition">,
3549  InGroup<IgnoredAttributes>;
3550def warn_attribute_void_function_method : Warning<
3551  "attribute %0 cannot be applied to "
3552  "%select{functions|Objective-C method}1 without return value">,
3553  InGroup<IgnoredAttributes>;
3554def warn_attribute_weak_on_field : Warning<
3555  "__weak attribute cannot be specified on a field declaration">,
3556  InGroup<IgnoredAttributes>;
3557def warn_gc_attribute_weak_on_local : Warning<
3558  "Objective-C GC does not allow weak variables on the stack">,
3559  InGroup<IgnoredAttributes>;
3560def warn_nsobject_attribute : Warning<
3561  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3562  InGroup<NSobjectAttribute>;
3563def warn_independentclass_attribute : Warning<
3564  "'objc_independent_class' attribute may be put on a typedef only; "
3565  "attribute is ignored">,
3566  InGroup<IndependentClassAttribute>;
3567def warn_ptr_independentclass_attribute : Warning<
3568  "'objc_independent_class' attribute may be put on Objective-C object "
3569  "pointer type only; attribute is ignored">,
3570  InGroup<IndependentClassAttribute>;
3571def warn_attribute_weak_on_local : Warning<
3572  "__weak attribute cannot be specified on an automatic variable when ARC "
3573  "is not enabled">,
3574  InGroup<IgnoredAttributes>;
3575def warn_weak_identifier_undeclared : Warning<
3576  "weak identifier %0 never declared">;
3577def warn_attribute_cmse_entry_static : Warning<
3578  "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3579  InGroup<IgnoredAttributes>;
3580def warn_cmse_nonsecure_union : Warning<
3581  "passing union across security boundary via %select{parameter %1|return value}0 "
3582  "may leak information">,
3583  InGroup<DiagGroup<"cmse-union-leak">>;
3584def err_attribute_weak_static : Error<
3585  "weak declaration cannot have internal linkage">;
3586def err_attribute_selectany_non_extern_data : Error<
3587  "'selectany' can only be applied to data items with external linkage">;
3588def err_declspec_thread_on_thread_variable : Error<
3589  "'__declspec(thread)' applied to variable that already has a "
3590  "thread-local storage specifier">;
3591def err_attribute_dll_not_extern : Error<
3592  "%q0 must have external linkage when declared %q1">;
3593def err_attribute_dll_thread_local : Error<
3594  "%q0 cannot be thread local when declared %q1">;
3595def err_attribute_dll_lambda : Error<
3596  "lambda cannot be declared %0">;
3597def warn_attribute_invalid_on_definition : Warning<
3598  "'%0' attribute cannot be specified on a definition">,
3599  InGroup<IgnoredAttributes>;
3600def err_attribute_dll_redeclaration : Error<
3601  "redeclaration of %q0 cannot add %q1 attribute">;
3602def warn_attribute_dll_redeclaration : Warning<
3603  "redeclaration of %q0 should not add %q1 attribute">,
3604  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3605def err_attribute_dllimport_function_definition : Error<
3606  "dllimport cannot be applied to non-inline function definition">;
3607def err_attribute_dllimport_function_specialization_definition : Error<
3608  "cannot define non-inline dllimport template specialization">;
3609def err_attribute_dll_deleted : Error<
3610  "attribute %q0 cannot be applied to a deleted function">;
3611def err_attribute_dllimport_data_definition : Error<
3612  "definition of dllimport data">;
3613def err_attribute_dllimport_static_field_definition : Error<
3614  "definition of dllimport static field not allowed">;
3615def warn_attribute_dllimport_static_field_definition : Warning<
3616  "definition of dllimport static field">,
3617  InGroup<DiagGroup<"dllimport-static-field-def">>;
3618def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3619  "explicit instantiation declaration should not be 'dllexport'">,
3620  InGroup<DllexportExplicitInstantiationDecl>;
3621def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3622  "'dllexport' attribute ignored on explicit instantiation definition">,
3623  InGroup<IgnoredAttributes>;
3624def warn_invalid_initializer_from_system_header : Warning<
3625  "invalid constructor from class in system header, should not be explicit">,
3626  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3627def note_used_in_initialization_here : Note<"used in initialization here">;
3628def err_attribute_dll_member_of_dll_class : Error<
3629  "attribute %q0 cannot be applied to member of %q1 class">;
3630def warn_attribute_dll_instantiated_base_class : Warning<
3631  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3632  "base class template without dll attribute is not supported">,
3633  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3634def err_attribute_dll_ambiguous_default_ctor : Error<
3635  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3636def err_attribute_weakref_not_static : Error<
3637  "weakref declaration must have internal linkage">;
3638def err_attribute_weakref_not_global_context : Error<
3639  "weakref declaration of %0 must be in a global context">;
3640def err_attribute_weakref_without_alias : Error<
3641  "weakref declaration of %0 must also have an alias attribute">;
3642def err_alias_not_supported_on_darwin : Error <
3643  "aliases are not supported on darwin">;
3644def warn_attribute_wrong_decl_type_str : Warning<
3645  "%0%select{ attribute|}1 only applies to %2">, InGroup<IgnoredAttributes>;
3646def err_attribute_wrong_decl_type_str : Error<
3647  warn_attribute_wrong_decl_type_str.Summary>;
3648def warn_attribute_wrong_decl_type : Warning<
3649  "%0%select{ attribute|}1 only applies to %select{"
3650  "functions"
3651  "|unions"
3652  "|variables and functions"
3653  "|functions and methods"
3654  "|functions, methods and blocks"
3655  "|functions, methods, and parameters"
3656  "|variables"
3657  "|variables and fields"
3658  "|variables, data members and tag types"
3659  "|types and namespaces"
3660  "|variables, functions and classes"
3661  "|kernel functions"
3662  "|non-K&R-style functions}2">,
3663  InGroup<IgnoredAttributes>;
3664def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Summary>;
3665def warn_type_attribute_wrong_type : Warning<
3666  "'%0' only applies to %select{function|pointer|"
3667  "Objective-C object or block pointer}1 types; type here is %2">,
3668  InGroup<IgnoredAttributes>;
3669def err_type_attribute_wrong_type : Error<
3670  warn_type_attribute_wrong_type.Summary>;
3671def warn_incomplete_encoded_type : Warning<
3672  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3673  InGroup<DiagGroup<"encode-type">>;
3674def warn_gnu_inline_attribute_requires_inline : Warning<
3675  "'gnu_inline' attribute requires function to be marked 'inline',"
3676  " attribute ignored">,
3677  InGroup<IgnoredAttributes>;
3678def warn_gnu_inline_cplusplus_without_extern : Warning<
3679  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3680  " available, this changed in Clang 10">,
3681  InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3682def err_attribute_vecreturn_only_vector_member : Error<
3683  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3684def err_attribute_vecreturn_only_pod_record : Error<
3685  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3686def err_sme_attr_mismatch : Error<
3687  "function declared %0 was previously declared %1, which has different SME function attributes">;
3688def err_sme_call_in_non_sme_target : Error<
3689  "call to a streaming function requires 'sme'">;
3690def err_sme_za_call_no_za_state : Error<
3691  "call to a shared ZA function requires the caller to have ZA state">;
3692def err_sme_definition_using_sm_in_non_sme_target : Error<
3693  "function executed in streaming-SVE mode requires 'sme'">;
3694def err_sme_definition_using_za_in_non_sme_target : Error<
3695  "function using ZA state requires 'sme'">;
3696def err_cconv_change : Error<
3697  "function declared '%0' here was previously declared "
3698  "%select{'%2'|without calling convention}1">;
3699def warn_cconv_unsupported : Warning<
3700  "%0 calling convention is not supported %select{"
3701  // Use CallingConventionIgnoredReason Enum to specify these.
3702  "for this target"
3703  "|on variadic function"
3704  "|on constructor/destructor"
3705  "|on builtin function"
3706  "}1">,
3707  InGroup<IgnoredAttributes>;
3708def error_cconv_unsupported : Error<warn_cconv_unsupported.Summary>;
3709def err_cconv_knr : Error<
3710  "function with no prototype cannot use the %0 calling convention">;
3711def warn_cconv_knr : Warning<
3712  err_cconv_knr.Summary>,
3713  InGroup<DiagGroup<"missing-prototype-for-cc">>;
3714def err_cconv_varargs : Error<
3715  "variadic function cannot use %0 calling convention">;
3716def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3717  "attribute was previously declared "
3718  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3719def err_function_attribute_mismatch : Error<
3720  "function declared with %0 attribute "
3721  "was previously declared without the %0 attribute">;
3722def err_objc_precise_lifetime_bad_type : Error<
3723  "objc_precise_lifetime only applies to retainable types; type here is %0">;
3724def warn_objc_precise_lifetime_meaningless : Error<
3725  "objc_precise_lifetime is not meaningful for "
3726  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3727def err_invalid_pcs : Error<"invalid PCS type">;
3728def warn_attribute_not_on_decl : Warning<
3729  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3730def err_base_specifier_attribute : Error<
3731  "%0%select{ attribute|}1 cannot be applied to a base specifier">;
3732def warn_declspec_allocator_nonpointer : Warning<
3733  "ignoring __declspec(allocator) because the function return type %0 is not "
3734  "a pointer or reference type">, InGroup<IgnoredAttributes>;
3735def err_cconv_incomplete_param_type : Error<
3736  "parameter %0 must have a complete type to use function %1 with the %2 "
3737  "calling convention">;
3738def err_attribute_output_parameter : Error<
3739  "attribute only applies to output parameters">;
3740
3741def ext_cannot_use_trivial_abi : ExtWarn<
3742  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3743def note_cannot_use_trivial_abi_reason : Note<
3744  "'trivial_abi' is disallowed on %0 because %select{"
3745  "its copy constructors and move constructors are all deleted|"
3746  "it is polymorphic|"
3747  "it has a base of a non-trivial class type|it has a virtual base|"
3748  "it has a __weak field|it has a field of a non-trivial class type}1">;
3749
3750// Availability attribute
3751def warn_availability_unknown_platform : Warning<
3752  "unknown platform %0 in availability macro">, InGroup<Availability>;
3753def warn_availability_version_ordering : Warning<
3754  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3755  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3756  "attribute ignored">, InGroup<Availability>;
3757def warn_mismatched_availability: Warning<
3758  "availability does not match previous declaration">, InGroup<Availability>;
3759def warn_mismatched_availability_override : Warning<
3760  "%select{|overriding }4method %select{introduced after|"
3761  "deprecated before|obsoleted before}0 "
3762  "%select{the protocol method it implements|overridden method}4 "
3763  "on %1 (%2 vs. %3)">, InGroup<Availability>;
3764def warn_mismatched_availability_override_unavail : Warning<
3765  "%select{|overriding }1method cannot be unavailable on %0 when "
3766  "%select{the protocol method it implements|its overridden method}1 is "
3767  "available">,
3768  InGroup<Availability>;
3769def warn_availability_on_static_initializer : Warning<
3770  "ignoring availability attribute %select{on '+load' method|"
3771  "with constructor attribute|with destructor attribute}0">,
3772  InGroup<Availability>;
3773def note_overridden_method : Note<
3774  "overridden method is here">;
3775def warn_availability_swift_unavailable_deprecated_only : Warning<
3776  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3777  InGroup<Availability>;
3778def note_protocol_method : Note<
3779  "protocol method is here">;
3780def warn_availability_fuchsia_unavailable_minor : Warning<
3781  "Fuchsia API Level prohibits specifying a minor or sub-minor version">,
3782  InGroup<Availability>;
3783
3784def warn_unguarded_availability :
3785  Warning<"%0 is only available on %1 %2 or newer">,
3786  InGroup<UnguardedAvailability>, DefaultIgnore;
3787def warn_unguarded_availability_new :
3788  Warning<warn_unguarded_availability.Summary>,
3789  InGroup<UnguardedAvailabilityNew>;
3790def note_decl_unguarded_availability_silence : Note<
3791  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3792def note_unguarded_available_silence : Note<
3793  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3794  " this warning">;
3795def warn_at_available_unchecked_use : Warning<
3796  "%select{@available|__builtin_available}0 does not guard availability here; "
3797  "use if (%select{@available|__builtin_available}0) instead">,
3798  InGroup<DiagGroup<"unsupported-availability-guard">>;
3799
3800def warn_missing_sdksettings_for_availability_checking : Warning<
3801  "%0 availability is ignored without a valid 'SDKSettings.json' in the SDK">,
3802  InGroup<DiagGroup<"ignored-availability-without-sdk-settings">>;
3803
3804// Thread Safety Attributes
3805def warn_thread_attribute_ignored : Warning<
3806  "ignoring %0 attribute because its argument is invalid">,
3807  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3808def warn_thread_attribute_not_on_non_static_member : Warning<
3809  "%0 attribute without capability arguments can only be applied to non-static "
3810  "methods of a class">,
3811  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3812def warn_thread_attribute_not_on_capability_member : Warning<
3813  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3814  "annotated with 'capability' or 'scoped_lockable' attribute">,
3815  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3816def warn_thread_attribute_argument_not_lockable : Warning<
3817  "%0 attribute requires arguments whose type is annotated "
3818  "with 'capability' attribute; type here is %1">,
3819  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3820def warn_thread_attribute_decl_not_lockable : Warning<
3821  "%0 attribute can only be applied in a context annotated "
3822  "with 'capability' attribute">,
3823  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3824def warn_thread_attribute_decl_not_pointer : Warning<
3825  "%0 only applies to pointer types; type here is %1">,
3826  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3827def err_attribute_argument_out_of_bounds_extra_info : Error<
3828  "%0 attribute parameter %1 is out of bounds: "
3829  "%plural{0:no parameters to index into|"
3830  "1:can only be 1, since there is one parameter|"
3831  ":must be between 1 and %2}2">;
3832
3833// Thread Safety Analysis
3834def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3835  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3836def warn_unlock_kind_mismatch : Warning<
3837  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3838  "%select{shared|exclusive}3 access">,
3839  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3840def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3841  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3842def warn_no_unlock : Warning<
3843  "%0 '%1' is still held at the end of function">,
3844  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3845def warn_expecting_locked : Warning<
3846  "expecting %0 '%1' to be held at the end of function">,
3847  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3848// FIXME: improve the error message about locks not in scope
3849def warn_lock_some_predecessors : Warning<
3850  "%0 '%1' is not held on every path through here">,
3851  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3852def warn_expecting_lock_held_on_loop : Warning<
3853  "expecting %0 '%1' to be held at start of each loop">,
3854  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3855def note_locked_here : Note<"%0 acquired here">;
3856def note_unlocked_here : Note<"%0 released here">;
3857def warn_lock_exclusive_and_shared : Warning<
3858  "%0 '%1' is acquired exclusively and shared in the same scope">,
3859  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3860def note_lock_exclusive_and_shared : Note<
3861  "the other acquisition of %0 '%1' is here">;
3862def warn_variable_requires_any_lock : Warning<
3863  "%select{reading|writing}1 variable %0 requires holding "
3864  "%select{any mutex|any mutex exclusively}1">,
3865  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3866def warn_var_deref_requires_any_lock : Warning<
3867  "%select{reading|writing}1 the value pointed to by %0 requires holding "
3868  "%select{any mutex|any mutex exclusively}1">,
3869  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3870def warn_fun_excludes_mutex : Warning<
3871  "cannot call function '%1' while %0 '%2' is held">,
3872  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3873def warn_cannot_resolve_lock : Warning<
3874  "cannot resolve lock expression">,
3875  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3876def warn_acquired_before : Warning<
3877  "%0 '%1' must be acquired before '%2'">,
3878  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3879def warn_acquired_before_after_cycle : Warning<
3880  "Cycle in acquired_before/after dependencies, starting with '%0'">,
3881  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3882
3883
3884// Thread safety warnings negative capabilities
3885def warn_acquire_requires_negative_cap : Warning<
3886  "acquiring %0 '%1' requires negative capability '%2'">,
3887  InGroup<ThreadSafetyNegative>, DefaultIgnore;
3888def warn_fun_requires_negative_cap : Warning<
3889  "calling function %0 requires negative capability '%1'">,
3890  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3891
3892// Thread safety warnings on pass/return by reference
3893def warn_guarded_pass_by_reference : Warning<
3894  "passing variable %1 by reference requires holding %0 "
3895  "%select{'%2'|'%2' exclusively}3">,
3896  InGroup<ThreadSafetyReference>, DefaultIgnore;
3897def warn_pt_guarded_pass_by_reference : Warning<
3898  "passing the value that %1 points to by reference requires holding %0 "
3899  "%select{'%2'|'%2' exclusively}3">,
3900  InGroup<ThreadSafetyReference>, DefaultIgnore;
3901def warn_guarded_return_by_reference : Warning<
3902  "returning variable %1 by reference requires holding %0 "
3903  "%select{'%2'|'%2' exclusively}3">,
3904  InGroup<ThreadSafetyReferenceReturn>, DefaultIgnore;
3905def warn_pt_guarded_return_by_reference : Warning<
3906  "returning the value that %1 points to by reference requires holding %0 "
3907  "%select{'%2'|'%2' exclusively}3">,
3908  InGroup<ThreadSafetyReferenceReturn>, DefaultIgnore;
3909
3910// Imprecise thread safety warnings
3911def warn_variable_requires_lock : Warning<
3912  "%select{reading|writing}3 variable %1 requires holding %0 "
3913  "%select{'%2'|'%2' exclusively}3">,
3914  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3915def warn_var_deref_requires_lock : Warning<
3916  "%select{reading|writing}3 the value pointed to by %1 requires "
3917  "holding %0 %select{'%2'|'%2' exclusively}3">,
3918  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3919def warn_fun_requires_lock : Warning<
3920  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3921  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3922
3923// Precise thread safety warnings
3924def warn_variable_requires_lock_precise :
3925  Warning<warn_variable_requires_lock.Summary>,
3926  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3927def warn_var_deref_requires_lock_precise :
3928  Warning<warn_var_deref_requires_lock.Summary>,
3929  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3930def warn_fun_requires_lock_precise :
3931  Warning<warn_fun_requires_lock.Summary>,
3932  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3933def note_found_mutex_near_match : Note<"found near match '%0'">;
3934
3935// Verbose thread safety warnings
3936def warn_thread_safety_verbose : Warning<"thread safety verbose warning">,
3937  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3938def note_thread_warning_in_fun : Note<"thread warning in function %0">;
3939def note_guarded_by_declared_here : Note<"guarded_by declared here">;
3940
3941// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3942def warn_thread_safety_beta : Warning<"thread safety beta warning">,
3943  InGroup<ThreadSafetyBeta>, DefaultIgnore;
3944
3945// Consumed warnings
3946def warn_use_in_invalid_state : Warning<
3947  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3948  "state">, InGroup<Consumed>, DefaultIgnore;
3949def warn_use_of_temp_in_invalid_state : Warning<
3950  "invalid invocation of method '%0' on a temporary object while it is in the "
3951  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3952def warn_attr_on_unconsumable_class : Warning<
3953  "consumed analysis attribute is attached to member of class %0 which isn't "
3954  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3955def warn_return_typestate_for_unconsumable_type : Warning<
3956  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3957  DefaultIgnore;
3958def warn_return_typestate_mismatch : Warning<
3959  "return value not in expected state; expected '%0', observed '%1'">,
3960  InGroup<Consumed>, DefaultIgnore;
3961def warn_loop_state_mismatch : Warning<
3962  "state of variable '%0' must match at the entry and exit of loop">,
3963  InGroup<Consumed>, DefaultIgnore;
3964def warn_param_return_typestate_mismatch : Warning<
3965  "parameter '%0' not in expected state when the function returns: expected "
3966  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3967def warn_param_typestate_mismatch : Warning<
3968  "argument not in expected state; expected '%0', observed '%1'">,
3969  InGroup<Consumed>, DefaultIgnore;
3970
3971// no_sanitize attribute
3972def warn_unknown_sanitizer_ignored : Warning<
3973  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3974
3975def warn_impcast_vector_scalar : Warning<
3976  "implicit conversion turns vector to scalar: %0 to %1">,
3977  InGroup<Conversion>, DefaultIgnore;
3978def warn_impcast_complex_scalar : Warning<
3979  "implicit conversion discards imaginary component: %0 to %1">,
3980  InGroup<Conversion>, DefaultIgnore;
3981def err_impcast_complex_scalar : Error<
3982  "implicit conversion from %0 to %1 is not permitted in C++">;
3983def warn_impcast_float_precision : Warning<
3984  "implicit conversion loses floating-point precision: %0 to %1">,
3985  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3986def warn_impcast_float_result_precision : Warning<
3987  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3988  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3989def warn_impcast_double_promotion : Warning<
3990  "implicit conversion increases floating-point precision: %0 to %1">,
3991  InGroup<DoublePromotion>, DefaultIgnore;
3992def warn_impcast_integer_sign : Warning<
3993  "implicit conversion changes signedness: %0 to %1">,
3994  InGroup<SignConversion>, DefaultIgnore;
3995def warn_impcast_integer_sign_conditional : Warning<
3996  "operand of ? changes signedness: %0 to %1">,
3997  InGroup<SignConversion>, DefaultIgnore;
3998def warn_impcast_integer_precision : Warning<
3999  "implicit conversion loses integer precision: %0 to %1">,
4000  InGroup<ImplicitIntConversion>, DefaultIgnore;
4001def warn_impcast_high_order_zero_bits : Warning<
4002  "higher order bits are zeroes after implicit conversion">,
4003  InGroup<ImplicitIntConversion>, DefaultIgnore;
4004def warn_impcast_nonnegative_result : Warning<
4005  "the resulting value is always non-negative after implicit conversion">,
4006  InGroup<SignConversion>, DefaultIgnore;
4007def warn_impcast_integer_64_32 : Warning<
4008  "implicit conversion loses integer precision: %0 to %1">,
4009  InGroup<Shorten64To32>, DefaultIgnore;
4010def warn_impcast_integer_precision_constant : Warning<
4011  "implicit conversion from %2 to %3 changes value from %0 to %1">,
4012  InGroup<ConstantConversion>;
4013def warn_impcast_single_bit_bitield_precision_constant : Warning<
4014  "implicit truncation from %2 to a one-bit wide bit-field changes value from "
4015  "%0 to %1">, InGroup<SingleBitBitFieldConstantConversion>;
4016def warn_impcast_bitfield_precision_constant : Warning<
4017  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
4018  InGroup<BitFieldConstantConversion>;
4019def warn_impcast_constant_value_to_objc_bool : Warning<
4020  "implicit conversion from constant value %0 to 'BOOL'; "
4021  "the only well defined values for 'BOOL' are YES and NO">,
4022  InGroup<ObjCBoolConstantConversion>;
4023
4024def warn_impcast_fixed_point_range : Warning<
4025  "implicit conversion from %0 cannot fit within the range of values for %1">,
4026  InGroup<ImplicitFixedPointConversion>;
4027
4028def warn_impcast_literal_float_to_integer : Warning<
4029  "implicit conversion from %0 to %1 changes value from %2 to %3">,
4030  InGroup<LiteralConversion>;
4031def warn_impcast_literal_float_to_integer_out_of_range : Warning<
4032  "implicit conversion of out of range value from %0 to %1 is undefined">,
4033  InGroup<LiteralConversion>;
4034def warn_impcast_float_integer : Warning<
4035  "implicit conversion turns floating-point number into integer: %0 to %1">,
4036  InGroup<FloatConversion>, DefaultIgnore;
4037def warn_impcast_float_to_objc_signed_char_bool : Warning<
4038  "implicit conversion from floating-point type %0 to 'BOOL'">,
4039  InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
4040def warn_impcast_int_to_objc_signed_char_bool : Warning<
4041  "implicit conversion from integral type %0 to 'BOOL'">,
4042  InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
4043
4044// Implicit int -> float conversion precision loss warnings.
4045def warn_impcast_integer_float_precision : Warning<
4046  "implicit conversion from %0 to %1 may lose precision">,
4047  InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
4048def warn_impcast_integer_float_precision_constant : Warning<
4049  "implicit conversion from %2 to %3 changes value from %0 to %1">,
4050  InGroup<ImplicitConstIntFloatConversion>;
4051
4052def warn_impcast_float_to_integer : Warning<
4053  "implicit conversion from %0 to %1 changes value from %2 to %3">,
4054  InGroup<FloatOverflowConversion>, DefaultIgnore;
4055def warn_impcast_float_to_integer_out_of_range : Warning<
4056  "implicit conversion of out of range value from %0 to %1 is undefined">,
4057  InGroup<FloatOverflowConversion>, DefaultIgnore;
4058def warn_impcast_float_to_integer_zero : Warning<
4059  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
4060  InGroup<FloatZeroConversion>, DefaultIgnore;
4061
4062def warn_impcast_string_literal_to_bool : Warning<
4063  "implicit conversion turns string literal into bool: %0 to %1">,
4064  InGroup<StringConversion>, DefaultIgnore;
4065def warn_impcast_different_enum_types : Warning<
4066  "implicit conversion from enumeration type %0 to different enumeration type "
4067  "%1">, InGroup<EnumConversion>;
4068def warn_impcast_bool_to_null_pointer : Warning<
4069    "initialization of pointer of type %0 to null from a constant boolean "
4070    "expression">, InGroup<BoolConversion>;
4071def warn_non_literal_null_pointer : Warning<
4072    "expression which evaluates to zero treated as a null pointer constant of "
4073    "type %0">, InGroup<NonLiteralNullConversion>;
4074def warn_pointer_compare : Warning<
4075    "comparing a pointer to a null character constant; did you mean "
4076    "to compare to %select{NULL|(void *)0}0?">,
4077    InGroup<DiagGroup<"pointer-compare">>;
4078def warn_impcast_null_pointer_to_integer : Warning<
4079    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
4080    InGroup<NullConversion>;
4081def warn_impcast_floating_point_to_bool : Warning<
4082    "implicit conversion turns floating-point number into bool: %0 to %1">,
4083    InGroup<ImplicitConversionFloatingPointToBool>;
4084def ext_ms_impcast_fn_obj : ExtWarn<
4085  "implicit conversion between pointer-to-function and pointer-to-object is a "
4086  "Microsoft extension">, InGroup<MicrosoftCast>;
4087
4088def warn_impcast_pointer_to_bool : Warning<
4089    "address of%select{| function| array}0 '%1' will always evaluate to "
4090    "'true'">,
4091    InGroup<PointerBoolConversion>;
4092def warn_cast_nonnull_to_bool : Warning<
4093    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
4094    "'true' on first encounter">,
4095    InGroup<PointerBoolConversion>;
4096def warn_this_bool_conversion : Warning<
4097  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
4098  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
4099def warn_address_of_reference_bool_conversion : Warning<
4100  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4101  "code; pointer may be assumed to always convert to true">,
4102  InGroup<UndefinedBoolConversion>;
4103
4104def warn_xor_used_as_pow : Warning<
4105  "result of '%0' is %1; did you mean exponentiation?">,
4106  InGroup<XorUsedAsPow>;
4107def warn_xor_used_as_pow_base_extra : Warning<
4108  "result of '%0' is %1; did you mean '%2' (%3)?">,
4109  InGroup<XorUsedAsPow>;
4110def warn_xor_used_as_pow_base : Warning<
4111  "result of '%0' is %1; did you mean '%2'?">,
4112  InGroup<XorUsedAsPow>;
4113def note_xor_used_as_pow_silence : Note<
4114  "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
4115
4116def warn_null_pointer_compare : Warning<
4117    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
4118    "equal to a null pointer is always %select{true|false}2">,
4119    InGroup<TautologicalPointerCompare>;
4120def warn_nonnull_expr_compare : Warning<
4121    "comparison of nonnull %select{function call|parameter}0 '%1' "
4122    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
4123    "encounter">,
4124    InGroup<TautologicalPointerCompare>;
4125def warn_this_null_compare : Warning<
4126  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
4127  "assumed to always evaluate to %select{true|false}0">,
4128  InGroup<TautologicalUndefinedCompare>;
4129def warn_address_of_reference_null_compare : Warning<
4130  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4131  "code; comparison may be assumed to always evaluate to "
4132  "%select{true|false}0">,
4133  InGroup<TautologicalUndefinedCompare>;
4134def note_reference_is_return_value : Note<"%0 returns a reference">;
4135
4136def note_pointer_declared_here : Note<
4137  "pointer %0 declared here">;
4138def warn_division_sizeof_ptr : Warning<
4139  "'%0' will return the size of the pointer, not the array itself">,
4140  InGroup<DiagGroup<"sizeof-pointer-div">>;
4141def warn_division_sizeof_array : Warning<
4142  "expression does not compute the number of elements in this array; element "
4143  "type is %0, not %1">,
4144  InGroup<DiagGroup<"sizeof-array-div">>;
4145
4146def note_function_warning_silence : Note<
4147    "prefix with the address-of operator to silence this warning">;
4148def note_function_to_function_call : Note<
4149    "suffix with parentheses to turn this into a function call">;
4150def warn_impcast_objective_c_literal_to_bool : Warning<
4151    "implicit boolean conversion of Objective-C object literal always "
4152    "evaluates to true">,
4153    InGroup<ObjCLiteralConversion>;
4154
4155def warn_cast_align : Warning<
4156  "cast from %0 to %1 increases required alignment from %2 to %3">,
4157  InGroup<CastAlign>, DefaultIgnore;
4158def warn_old_style_cast : Warning<
4159  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore,
4160  SuppressInSystemMacro;
4161
4162// Separate between casts to void* and non-void* pointers.
4163// Some APIs use (abuse) void* for something like a user context,
4164// and often that value is an integer even if it isn't a pointer itself.
4165// Having a separate warning flag allows users to control the warning
4166// for their workflow.
4167def warn_int_to_pointer_cast : Warning<
4168  "cast to %1 from smaller integer type %0">,
4169  InGroup<IntToPointerCast>;
4170def warn_int_to_void_pointer_cast : Warning<
4171  "cast to %1 from smaller integer type %0">,
4172  InGroup<IntToVoidPointerCast>;
4173def warn_pointer_to_int_cast : Warning<
4174  "cast to smaller integer type %1 from %0">,
4175  InGroup<PointerToIntCast>;
4176def warn_pointer_to_enum_cast : Warning<
4177  warn_pointer_to_int_cast.Summary>,
4178  InGroup<PointerToEnumCast>;
4179def warn_void_pointer_to_int_cast : Warning<
4180  "cast to smaller integer type %1 from %0">,
4181  InGroup<VoidPointerToIntCast>;
4182def warn_void_pointer_to_enum_cast : Warning<
4183  warn_void_pointer_to_int_cast.Summary>,
4184  InGroup<VoidPointerToEnumCast>;
4185
4186def warn_attribute_ignored_for_field_of_type : Warning<
4187  "%0 attribute ignored for field of type %1">,
4188  InGroup<IgnoredAttributes>;
4189def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
4190  "enums in the Microsoft ABI are signed integers by default; consider giving "
4191  "the enum %0 an unsigned underlying type to make this code portable">,
4192  InGroup<SignedEnumBitfield>, DefaultIgnore;
4193def warn_attribute_packed_for_bitfield : Warning<
4194  "'packed' attribute was ignored on bit-fields with single-byte alignment "
4195  "in older versions of GCC and Clang">,
4196  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
4197def warn_transparent_union_attribute_field_size_align : Warning<
4198  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
4199  "%select{alignment|size}0 of the first field in transparent union; "
4200  "transparent_union attribute ignored">,
4201  InGroup<IgnoredAttributes>;
4202def note_transparent_union_first_field_size_align : Note<
4203  "%select{alignment|size}0 of first field is %1 bits">;
4204def warn_transparent_union_attribute_not_definition : Warning<
4205  "transparent_union attribute can only be applied to a union definition; "
4206  "attribute ignored">,
4207  InGroup<IgnoredAttributes>;
4208def warn_transparent_union_attribute_floating : Warning<
4209  "first field of a transparent union cannot have %select{floating point|"
4210  "vector}0 type %1; transparent_union attribute ignored">,
4211  InGroup<IgnoredAttributes>;
4212def warn_transparent_union_attribute_zero_fields : Warning<
4213  "transparent union definition must contain at least one field; "
4214  "transparent_union attribute ignored">,
4215  InGroup<IgnoredAttributes>;
4216def warn_attribute_type_not_supported : Warning<
4217  "%0 attribute argument not supported: %1">,
4218  InGroup<IgnoredAttributes>;
4219def warn_attribute_type_not_supported_global : Warning<
4220  "%0 attribute argument '%1' not supported on a global variable">,
4221  InGroup<IgnoredAttributes>;
4222def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
4223  InGroup<IgnoredAttributes>;
4224def warn_attribute_protected_visibility :
4225  Warning<"target does not support 'protected' visibility; using 'default'">,
4226  InGroup<DiagGroup<"unsupported-visibility">>;
4227def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
4228def note_previous_attribute : Note<"previous attribute is here">;
4229def note_conflicting_attribute : Note<"conflicting attribute is here">;
4230def note_attribute : Note<"attribute is here">;
4231def err_mismatched_ms_inheritance : Error<
4232  "inheritance model does not match %select{definition|previous declaration}0">;
4233def warn_ignored_ms_inheritance : Warning<
4234  "inheritance model ignored on %select{primary template|partial specialization}0">,
4235  InGroup<IgnoredAttributes>;
4236def note_previous_ms_inheritance : Note<
4237  "previous inheritance model specified here">;
4238def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
4239def err_mode_not_primitive : Error<
4240  "mode attribute only supported for integer and floating-point types">;
4241def err_mode_wrong_type : Error<
4242  "type of machine mode does not match type of base type">;
4243def warn_vector_mode_deprecated : Warning<
4244  "specifying vector types with the 'mode' attribute is deprecated; "
4245  "use the 'vector_size' attribute instead">,
4246  InGroup<DeprecatedAttributes>;
4247def warn_deprecated_noreturn_spelling : Warning<
4248  "the '[[_Noreturn]]' attribute spelling is deprecated in C23; use "
4249  "'[[noreturn]]' instead">, InGroup<DeprecatedAttributes>;
4250def err_complex_mode_vector_type : Error<
4251  "type of machine mode does not support base vector types">;
4252def err_enum_mode_vector_type : Error<
4253  "mode %0 is not supported for enumeration types">;
4254def warn_attribute_nonnull_no_pointers : Warning<
4255  "'nonnull' attribute applied to function with no pointer arguments">,
4256  InGroup<IgnoredAttributes>;
4257def warn_attribute_nonnull_parm_no_args : Warning<
4258  "'nonnull' attribute when used on parameters takes no arguments">,
4259  InGroup<IgnoredAttributes>;
4260def warn_function_stmt_attribute_precedence : Warning<
4261  "statement attribute %0 has higher precedence than function attribute "
4262  "'%select{always_inline|flatten|noinline}1'">,
4263  InGroup<IgnoredAttributes>;
4264def note_declared_nonnull : Note<
4265  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
4266def warn_attribute_sentinel_named_arguments : Warning<
4267  "'sentinel' attribute requires named arguments">,
4268  InGroup<IgnoredAttributes>;
4269def warn_attribute_sentinel_not_variadic : Warning<
4270  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
4271  InGroup<IgnoredAttributes>;
4272def warn_deprecated_ignored_on_using : Warning<
4273  "%0 currently has no effect on a using declaration">,
4274  InGroup<IgnoredAttributes>;
4275def err_attribute_sentinel_less_than_zero : Error<
4276  "'sentinel' parameter 1 less than zero">;
4277def err_attribute_sentinel_not_zero_or_one : Error<
4278  "'sentinel' parameter 2 not 0 or 1">;
4279def warn_cleanup_ext : Warning<
4280  "GCC does not allow the 'cleanup' attribute argument to be anything other "
4281  "than a simple identifier">,
4282  InGroup<GccCompat>;
4283def err_attribute_cleanup_arg_not_function : Error<
4284  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
4285def err_attribute_cleanup_func_must_take_one_arg : Error<
4286  "'cleanup' function %0 must take 1 parameter">;
4287def err_attribute_cleanup_func_arg_incompatible_type : Error<
4288  "'cleanup' function %0 parameter has "
4289  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
4290def err_attribute_regparm_wrong_platform : Error<
4291  "'regparm' is not valid on this platform">;
4292def err_attribute_regparm_invalid_number : Error<
4293  "'regparm' parameter must be between 0 and %0 inclusive">;
4294def err_attribute_not_supported_in_lang : Error<
4295  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
4296def err_attribute_not_supported_on_arch
4297    : Error<"%0 attribute is not supported on '%1'">;
4298def warn_gcc_ignores_type_attr : Warning<
4299  "GCC does not allow the %0 attribute to be written on a type">,
4300  InGroup<GccCompat>;
4301def warn_gcc_requires_variadic_function : Warning<
4302  "GCC requires a function with the %0 attribute to be variadic">,
4303  InGroup<GccCompat>;
4304
4305// Clang-Specific Attributes
4306def warn_attribute_iboutlet : Warning<
4307  "%0 attribute can only be applied to instance variables or properties">,
4308  InGroup<IgnoredAttributes>;
4309def err_iboutletcollection_type : Error<
4310  "invalid type %0 as argument of iboutletcollection attribute">;
4311def err_iboutletcollection_builtintype : Error<
4312  "type argument of iboutletcollection attribute cannot be a builtin type">;
4313def warn_iboutlet_object_type : Warning<
4314  "%select{instance variable|property}2 with %0 attribute must "
4315  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
4316def warn_iboutletcollection_property_assign : Warning<
4317  "IBOutletCollection properties should be copy/strong and not assign">,
4318  InGroup<ObjCInvalidIBOutletProperty>;
4319
4320def err_attribute_overloadable_mismatch : Error<
4321  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
4322def note_attribute_overloadable_prev_overload : Note<
4323  "previous %select{unmarked |}0overload of function is here">;
4324def err_attribute_overloadable_no_prototype : Error<
4325  "'overloadable' function %0 must have a prototype">;
4326def err_attribute_overloadable_multiple_unmarked_overloads : Error<
4327  "at most one overload for a given name may lack the 'overloadable' "
4328  "attribute">;
4329def warn_attribute_no_builtin_invalid_builtin_name : Warning<
4330  "'%0' is not a valid builtin name for %1">,
4331  InGroup<DiagGroup<"invalid-no-builtin-names">>;
4332def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
4333  "empty %0 cannot be composed with named ones">;
4334def err_attribute_no_builtin_on_non_definition : Error<
4335  "%0 attribute is permitted on definitions only">;
4336def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
4337  "%0 attribute has no effect on defaulted or deleted functions">;
4338def warn_ns_attribute_wrong_return_type : Warning<
4339  "%0 attribute only applies to %select{functions|methods|properties}1 that "
4340  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
4341  InGroup<IgnoredAttributes>;
4342def err_ns_attribute_wrong_parameter_type : Error<
4343  "%0 attribute only applies to "
4344  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
4345def warn_ns_attribute_wrong_parameter_type : Warning<
4346  "%0 attribute only applies to "
4347  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
4348  InGroup<IgnoredAttributes>;
4349def warn_objc_requires_super_protocol : Warning<
4350  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
4351  InGroup<DiagGroup<"requires-super-attribute">>;
4352def note_protocol_decl : Note<
4353  "protocol is declared here">;
4354def note_protocol_decl_undefined : Note<
4355  "protocol %0 has no definition">;
4356def err_attribute_preferred_name_arg_invalid : Error<
4357  "argument %0 to 'preferred_name' attribute is not a typedef for "
4358  "a specialization of %1">;
4359def err_attribute_builtin_alias : Error<
4360  "%0 attribute can only be applied to a ARM, HLSL or RISC-V builtin">;
4361
4362// called-once attribute diagnostics.
4363def err_called_once_attribute_wrong_type : Error<
4364  "'called_once' attribute only applies to function-like parameters">;
4365
4366def warn_completion_handler_never_called : Warning<
4367  "%select{|captured }1completion handler is never called">,
4368  InGroup<CompletionHandler>, DefaultIgnore;
4369def warn_called_once_never_called : Warning<
4370  "%select{|captured }1%0 parameter marked 'called_once' is never called">,
4371  InGroup<CalledOnceParameter>;
4372
4373def warn_completion_handler_never_called_when : Warning<
4374  "completion handler is never %select{used|called}1 when "
4375  "%select{taking true branch|taking false branch|"
4376  "handling this case|none of the cases applies|"
4377  "entering the loop|skipping the loop|taking one of the branches}2">,
4378  InGroup<CompletionHandler>, DefaultIgnore;
4379def warn_called_once_never_called_when : Warning<
4380  "%0 parameter marked 'called_once' is never %select{used|called}1 when "
4381  "%select{taking true branch|taking false branch|"
4382  "handling this case|none of the cases applies|"
4383  "entering the loop|skipping the loop|taking one of the branches}2">,
4384  InGroup<CalledOnceParameter>;
4385
4386def warn_completion_handler_called_twice : Warning<
4387  "completion handler is called twice">,
4388  InGroup<CompletionHandler>, DefaultIgnore;
4389def warn_called_once_gets_called_twice : Warning<
4390  "%0 parameter marked 'called_once' is called twice">,
4391  InGroup<CalledOnceParameter>;
4392def note_called_once_gets_called_twice : Note<
4393  "previous call is here%select{; set to nil to indicate "
4394  "it cannot be called afterwards|}0">;
4395
4396// objc_designated_initializer attribute diagnostics.
4397def warn_objc_designated_init_missing_super_call : Warning<
4398  "designated initializer missing a 'super' call to a designated initializer of the super class">,
4399  InGroup<ObjCDesignatedInit>;
4400def note_objc_designated_init_marked_here : Note<
4401  "method marked as designated initializer of the class here">;
4402def warn_objc_designated_init_non_super_designated_init_call : Warning<
4403  "designated initializer should only invoke a designated initializer on 'super'">,
4404  InGroup<ObjCDesignatedInit>;
4405def warn_objc_designated_init_non_designated_init_call : Warning<
4406  "designated initializer invoked a non-designated initializer">,
4407  InGroup<ObjCDesignatedInit>;
4408def warn_objc_secondary_init_super_init_call : Warning<
4409  "convenience initializer should not invoke an initializer on 'super'">,
4410  InGroup<ObjCDesignatedInit>;
4411def warn_objc_secondary_init_missing_init_call : Warning<
4412  "convenience initializer missing a 'self' call to another initializer">,
4413  InGroup<ObjCDesignatedInit>;
4414def warn_objc_implementation_missing_designated_init_override : Warning<
4415  "method override for the designated initializer of the superclass %objcinstance0 not found">,
4416  InGroup<ObjCDesignatedInit>;
4417def err_designated_init_attr_non_init : Error<
4418  "'objc_designated_initializer' attribute only applies to init methods "
4419  "of interface or class extension declarations">;
4420
4421// objc_bridge attribute diagnostics.
4422def err_objc_attr_not_id : Error<
4423  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
4424def err_objc_attr_typedef_not_id : Error<
4425  "parameter of %0 attribute must be 'id' when used on a typedef">;
4426def err_objc_attr_typedef_not_void_pointer : Error<
4427  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
4428def err_objc_cf_bridged_not_interface : Error<
4429  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
4430def err_objc_ns_bridged_invalid_cfobject : Error<
4431  "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
4432def warn_objc_invalid_bridge : Warning<
4433  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
4434def warn_objc_invalid_bridge_to_cf : Warning<
4435  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
4436
4437// objc_bridge_related attribute diagnostics.
4438def err_objc_bridged_related_invalid_class : Error<
4439  "could not find Objective-C class %0 to convert %1 to %2">;
4440def err_objc_bridged_related_invalid_class_name : Error<
4441  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
4442def err_objc_bridged_related_known_method : Error<
4443 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
4444 "method for this conversion">;
4445
4446def err_objc_attr_protocol_requires_definition : Error<
4447  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
4448
4449// Swift attributes.
4450def warn_attr_swift_name_function
4451  : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
4452    InGroup<SwiftNameAttribute>;
4453def warn_attr_swift_name_invalid_identifier
4454  : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4455    InGroup<SwiftNameAttribute>;
4456def warn_attr_swift_name_decl_kind
4457  : Warning<"%0 attribute cannot be applied to this declaration">,
4458    InGroup<SwiftNameAttribute>;
4459def warn_attr_swift_name_subscript_invalid_parameter
4460  : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4461        "have at least one parameter|"
4462        "have a 'self:' parameter}1">,
4463    InGroup<SwiftNameAttribute>;
4464def warn_attr_swift_name_missing_parameters
4465  : Warning<"%0 attribute is missing parameter label clause">,
4466    InGroup<SwiftNameAttribute>;
4467def warn_attr_swift_name_setter_parameters
4468  : Warning<"%0 attribute for setter must have one parameter for new value">,
4469    InGroup<SwiftNameAttribute>;
4470def warn_attr_swift_name_multiple_selfs
4471  : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4472    InGroup<SwiftNameAttribute>;
4473def warn_attr_swift_name_getter_parameters
4474  : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4475    InGroup<SwiftNameAttribute>;
4476def warn_attr_swift_name_subscript_setter_no_newValue
4477  : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4478    InGroup<SwiftNameAttribute>;
4479def warn_attr_swift_name_subscript_setter_multiple_newValues
4480  : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4481    InGroup<SwiftNameAttribute>;
4482def warn_attr_swift_name_subscript_getter_newValue
4483  : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4484    InGroup<SwiftNameAttribute>;
4485def warn_attr_swift_name_num_params
4486  : Warning<"too %select{few|many}0 parameters in the signature specified by "
4487            "the %1 attribute (expected %2; got %3)">,
4488    InGroup<SwiftNameAttribute>;
4489def warn_attr_swift_name_decl_missing_params
4490  : Warning<"%0 attribute cannot be applied to a %select{function|method}1 "
4491            "with no parameters">,
4492    InGroup<SwiftNameAttribute>;
4493
4494def err_attr_swift_error_no_error_parameter : Error<
4495  "%0 attribute can only be applied to a %select{function|method}1 with an "
4496  "error parameter">;
4497def err_attr_swift_error_return_type : Error<
4498  "%0 attribute with '%1' convention can only be applied to a "
4499  "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4500
4501def err_swift_async_no_access : Error<
4502  "first argument to 'swift_async' must be either 'none', 'swift_private', or "
4503  "'not_swift_private'">;
4504def err_swift_async_bad_block_type : Error<
4505  "'swift_async' completion handler parameter must have block type returning"
4506  " 'void', type here is %0">;
4507
4508def err_swift_async_error_without_swift_async : Error<
4509  "%0 attribute must be applied to a %select{function|method}1 annotated "
4510  "with non-'none' attribute 'swift_async'">;
4511def err_swift_async_error_no_error_parameter : Error<
4512  "%0 attribute with 'nonnull_error' convention can only be applied to a "
4513  "%select{function|method}1 with a completion handler with an error "
4514  "parameter">;
4515def err_swift_async_error_non_integral : Error<
4516  "%0 attribute with '%1' convention must have an integral-typed parameter "
4517  "in completion handler at index %2, type here is %3">;
4518
4519def warn_ignored_objc_externally_retained : Warning<
4520  "'objc_externally_retained' can only be applied to local variables "
4521  "%select{of retainable type|with strong ownership}0">,
4522  InGroup<IgnoredAttributes>;
4523
4524// Function Parameter Semantic Analysis.
4525def err_param_with_void_type : Error<"argument may not have 'void' type">;
4526def err_void_only_param : Error<
4527  "'void' must be the first and only parameter if specified">;
4528def err_void_param_qualified : Error<
4529  "'void' as parameter must not have type qualifiers">;
4530def err_ident_list_in_fn_declaration : Error<
4531  "a parameter list without types is only allowed in a function definition">;
4532def ext_param_not_declared : ExtWarn<
4533  "parameter %0 was not declared, defaults to 'int'; ISO C99 and later do not "
4534  "support implicit int">, InGroup<ImplicitInt>;
4535def err_param_default_argument : Error<
4536  "C does not support default arguments">;
4537def err_param_default_argument_redefinition : Error<
4538  "redefinition of default argument">;
4539def ext_param_default_argument_redefinition : ExtWarn<
4540  err_param_default_argument_redefinition.Summary>,
4541  InGroup<MicrosoftDefaultArgRedefinition>;
4542def err_param_default_argument_missing : Error<
4543  "missing default argument on parameter">;
4544def err_param_default_argument_missing_name : Error<
4545  "missing default argument on parameter %0">;
4546def err_param_default_argument_references_param : Error<
4547  "default argument references parameter %0">;
4548def err_param_default_argument_references_local : Error<
4549  "default argument references local variable %0 of enclosing function">;
4550def err_param_default_argument_references_this : Error<
4551  "default argument references 'this'">;
4552def err_param_default_argument_nonfunc : Error<
4553  "default arguments can only be specified for parameters in a function "
4554  "declaration">;
4555def err_param_default_argument_template_redecl : Error<
4556  "default arguments cannot be added to a function template that has already "
4557  "been declared">;
4558def err_param_default_argument_member_template_redecl : Error<
4559  "default arguments cannot be added to an out-of-line definition of a member "
4560  "of a %select{class template|class template partial specialization|nested "
4561  "class in a template}0">;
4562def err_param_default_argument_on_parameter_pack : Error<
4563  "parameter pack cannot have a default argument">;
4564def err_uninitialized_member_for_assign : Error<
4565  "cannot define the implicit copy assignment operator for %0, because "
4566  "non-static %select{reference|const}1 member %2 cannot use copy "
4567  "assignment operator">;
4568def err_uninitialized_member_in_ctor : Error<
4569  "%select{constructor for %1|"
4570  "implicit default constructor for %1|"
4571  "cannot use constructor inherited from %1:}0 must explicitly "
4572  "initialize the %select{reference|const}2 member %3">;
4573def err_default_arg_makes_ctor_special : Error<
4574  "addition of default argument on redeclaration makes this constructor a "
4575  "%select{default|copy|move}0 constructor">;
4576def err_stmt_expr_in_default_arg : Error<
4577  "default %select{argument|non-type template argument}0 may not use a GNU "
4578  "statement expression">;
4579
4580def err_use_of_default_argument_to_function_declared_later : Error<
4581  "use of default argument to function %0 that is declared later in class %1">;
4582def note_default_argument_declared_here : Note<
4583  "default argument declared here">;
4584def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4585def note_recursive_default_argument_used_here : Note<
4586  "default argument used here">;
4587
4588def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4589  "%diff{promoted type $ of K&R function parameter is not compatible with the "
4590  "parameter type $|promoted type of K&R function parameter is not compatible "
4591  "with parameter type}0,1 declared in a previous prototype">,
4592  InGroup<KNRPromotedParameter>;
4593
4594
4595// C++ Overloading Semantic Analysis.
4596def err_ovl_diff_return_type : Error<
4597  "functions that differ only in their return type cannot be overloaded">;
4598def err_ovl_static_nonstatic_member : Error<
4599  "static and non-static member functions with the same parameter types "
4600  "cannot be overloaded">;
4601
4602let Deferrable = 1 in {
4603
4604def err_ovl_no_viable_function_in_call : Error<
4605  "no matching function for call to %0">;
4606def err_ovl_no_viable_member_function_in_call : Error<
4607  "no matching member function for call to %0">;
4608def err_ovl_ambiguous_call : Error<
4609  "call to %0 is ambiguous">;
4610def err_ovl_deleted_call : Error<"call to deleted function %0">;
4611def err_ovl_ambiguous_member_call : Error<
4612  "call to member function %0 is ambiguous">;
4613def err_ovl_deleted_member_call : Error<
4614  "call to deleted member function %0">;
4615def note_ovl_too_many_candidates : Note<
4616    "remaining %0 candidate%s0 omitted; "
4617    "pass -fshow-overloads=all to show them">;
4618
4619def select_ovl_candidate_kind : TextSubstitution<
4620  "%select{function|function|function (with reversed parameter order)|"
4621    "constructor|"
4622    "constructor (the implicit default constructor)|"
4623    "constructor (the implicit copy constructor)|"
4624    "constructor (the implicit move constructor)|"
4625    "function (the implicit copy assignment operator)|"
4626    "function (the implicit move assignment operator)|"
4627    "function (the implicit 'operator==' for this 'operator<=>)'|"
4628    "inherited constructor}0%select{| template| %2}1">;
4629
4630def note_ovl_candidate : Note<
4631    "candidate %sub{select_ovl_candidate_kind}0,1,3"
4632    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4633    "| has different number of parameters (expected %5 but has %6)"
4634    "| has type mismatch at %ordinal5 parameter"
4635    "%diff{ (expected $ but has $)|}6,7"
4636    "| has different return type%diff{ ($ expected but has $)|}5,6"
4637    "| has different qualifiers (expected %5 but found %6)"
4638    "| has different exception specification}4">;
4639
4640def note_ovl_candidate_explicit : Note<
4641    "explicit %select{constructor|conversion function|deduction guide}0 "
4642    "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4643def note_ovl_candidate_inherited_constructor : Note<
4644    "constructor from base class %0 inherited here">;
4645def note_ovl_candidate_inherited_constructor_slice : Note<
4646    "candidate %select{constructor|template}0 ignored: "
4647    "inherited constructor cannot be used to %select{copy|move}1 object">;
4648def note_ovl_candidate_illegal_constructor : Note<
4649    "candidate %select{constructor|template}0 ignored: "
4650    "instantiation %select{takes|would take}0 its own class type by value">;
4651def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4652    "candidate constructor ignored: cannot be used to construct an object "
4653    "in address space %0">;
4654def note_ovl_candidate_bad_deduction : Note<
4655    "candidate template ignored: failed template argument deduction">;
4656def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4657    "couldn't infer template argument %0">;
4658def note_ovl_candidate_incomplete_deduction_pack : Note<
4659    "candidate template ignored: "
4660    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4661    "expanded parameter in deduced argument pack %2">;
4662def note_ovl_candidate_inconsistent_deduction : Note<
4663    "candidate template ignored: deduced %select{conflicting types|"
4664    "conflicting values|conflicting templates|packs of different lengths}0 "
4665    "for parameter %1%diff{ ($ vs. $)|}2,3">;
4666def note_ovl_candidate_inconsistent_deduction_types : Note<
4667    "candidate template ignored: deduced values %diff{"
4668    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4669    "%1 and %3 of conflicting types for parameter %0}2,4">;
4670def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4671    "candidate template ignored: invalid explicitly-specified argument "
4672    "for template parameter %0">;
4673def note_ovl_candidate_unsatisfied_constraints : Note<
4674    "candidate template ignored: constraints not satisfied%0">;
4675def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4676    "candidate template ignored: invalid explicitly-specified argument "
4677    "for %ordinal0 template parameter">;
4678def note_ovl_candidate_instantiation_depth : Note<
4679    "candidate template ignored: substitution exceeded maximum template "
4680    "instantiation depth">;
4681def note_ovl_candidate_underqualified : Note<
4682    "candidate template ignored: cannot deduce a type for %0 that would "
4683    "make %2 equal %1">;
4684def note_ovl_candidate_substitution_failure : Note<
4685    "candidate template ignored: substitution failure%0%1">;
4686def note_ovl_candidate_disabled_by_enable_if : Note<
4687    "candidate template ignored: disabled by %0%1">;
4688def note_ovl_candidate_disabled_by_requirement : Note<
4689    "candidate template ignored: requirement '%0' was not satisfied%1">;
4690def note_ovl_candidate_has_pass_object_size_params: Note<
4691    "candidate address cannot be taken because parameter %0 has "
4692    "pass_object_size attribute">;
4693def err_diagnose_if_succeeded : Error<"%0">;
4694def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4695    ShowInSystemHeader;
4696def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4697    "candidate disabled: %0">;
4698def err_addrof_function_disabled_by_enable_if_attr : Error<
4699    "cannot take address of function %0 because it has one or more "
4700    "non-tautological enable_if conditions">;
4701def err_addrof_function_constraints_not_satisfied : Error<
4702    "cannot take address of function %0 because its constraints are not "
4703    "satisfied">;
4704def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4705    "candidate function made ineligible by enable_if">;
4706def note_ovl_candidate_deduced_mismatch : Note<
4707    "candidate template ignored: deduced type "
4708    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4709    "adjusted type $ of %select{|element of }4argument"
4710    "|of %select{|element of }4%ordinal0 parameter does not match "
4711    "adjusted type of %select{|element of }4argument}1,2%3">;
4712def note_ovl_candidate_non_deduced_mismatch : Note<
4713    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4714// This note is needed because the above note would sometimes print two
4715// different types with the same name.  Remove this note when the above note
4716// can handle that case properly.
4717def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4718    "candidate template ignored: could not match %q0 against %q1">;
4719
4720// Note that we don't treat templates differently for this diagnostic.
4721def note_ovl_candidate_arity : Note<"candidate "
4722    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4723    "requires%select{ at least| at most|}3 %4 "
4724    "%select{|non-object }6argument%s4, but %5 "
4725    "%plural{1:was|:were}5 provided">;
4726
4727def note_ovl_candidate_arity_one : Note<"candidate "
4728    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4729    "%select{requires at least|allows at most single|requires single}3 "
4730    "%select{|non-object }6"
4731    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4732
4733def note_ovl_candidate_deleted : Note<
4734    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4735    "%select{explicitly made unavailable|explicitly deleted|"
4736    "implicitly deleted}3">;
4737
4738// Giving the index of the bad argument really clutters this message, and
4739// it's relatively unimportant because 1) it's generally obvious which
4740// argument(s) are of the given object type and 2) the fix is usually
4741// to complete the type, which doesn't involve changes to the call line
4742// anyway.  If people complain, we can change it.
4743def note_ovl_candidate_bad_conv_incomplete : Note<
4744    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4745    "cannot convert argument of incomplete type "
4746    "%diff{$ to $|to parameter type}3,4 for "
4747    "%select{%ordinal6 argument|object argument}5"
4748    "%select{|; dereference the argument with *|"
4749    "; take the address of the argument with &|"
4750    "; remove *|"
4751    "; remove &}7">;
4752def note_ovl_candidate_bad_list_argument : Note<
4753    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4754    "%select{cannot convert initializer list|too few initializers in list"
4755    "|too many initializers in list}7 argument to %4">;
4756def note_ovl_candidate_bad_overload : Note<
4757    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4758    "no overload of %4 matching %3 for %ordinal5 argument">;
4759def note_ovl_candidate_bad_conv : Note<
4760    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4761    "no known conversion "
4762    "%diff{from $ to $|from argument type to parameter type}3,4 for "
4763    "%select{%ordinal6 argument|object argument}5"
4764    "%select{|; dereference the argument with *|"
4765    "; take the address of the argument with &|"
4766    "; remove *|"
4767    "; remove &}7">;
4768def note_ovl_candidate_bad_arc_conv : Note<
4769    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4770    "cannot implicitly convert argument "
4771    "%diff{of type $ to $|type to parameter type}3,4 for "
4772    "%select{%ordinal6 argument|object argument}5 under ARC">;
4773def note_ovl_candidate_bad_value_category : Note<
4774    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4775    "expects an %select{lvalue|rvalue}5 for "
4776    "%select{%ordinal4 argument|object argument}3">;
4777def note_ovl_candidate_bad_addrspace : Note<
4778    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4779    "cannot %select{pass pointer to|bind reference in}5 %3 "
4780    "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4781    "argument">;
4782def note_ovl_candidate_bad_addrspace_this : Note<
4783    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4784    "'this' object is in %3, but method expects object in %4">;
4785def note_ovl_candidate_bad_gc : Note<
4786    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4787    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4788    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4789def note_ovl_candidate_bad_ownership : Note<
4790    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4791    "%select{%ordinal7|'this'}6 argument (%3) has "
4792    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4793    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4794    "__autoreleasing}5 ownership">;
4795def note_ovl_candidate_bad_cvr_this : Note<
4796    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4797    "'this' argument has type %3, but method is not marked "
4798    "%select{const|restrict|const or restrict|volatile|const or volatile|"
4799    "volatile or restrict|const, volatile, or restrict}4">;
4800def note_ovl_candidate_bad_cvr : Note<
4801    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4802    "%ordinal5 argument (%3) would lose "
4803    "%select{const|restrict|const and restrict|volatile|const and volatile|"
4804    "volatile and restrict|const, volatile, and restrict}4 qualifier"
4805    "%select{||s||s|s|s}4">;
4806def note_ovl_candidate_bad_base_to_derived_conv : Note<
4807    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4808    "cannot %select{convert from|convert from|bind}3 "
4809    "%select{base class pointer|superclass|base class object of type}3 %4 to "
4810    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4811    "%ordinal6 argument">;
4812def note_ovl_candidate_bad_target : Note<
4813    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4814    "call to "
4815    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4816    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4817def note_ovl_candidate_constraints_not_satisfied : Note<
4818    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4819    "not satisfied">;
4820def note_ovl_surrogate_constraints_not_satisfied : Note<
4821    "conversion candidate %0 not viable: constraints not satisfied">;
4822def note_implicit_member_target_infer_collision : Note<
4823    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4824    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4825    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4826
4827def note_ambiguous_type_conversion: Note<
4828    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4829def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4830def err_ovl_no_viable_function_in_init : Error<
4831  "no matching constructor for initialization of %0">;
4832def err_ovl_no_conversion_in_cast : Error<
4833  "cannot convert %1 to %2 without a conversion operator">;
4834def err_ovl_no_viable_conversion_in_cast : Error<
4835  "no matching conversion for %select{|static_cast|reinterpret_cast|"
4836  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4837def err_ovl_ambiguous_conversion_in_cast : Error<
4838  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4839  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4840def err_ovl_deleted_conversion_in_cast : Error<
4841  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4842  "functional-style cast|}0 from %1 to %2 uses deleted function">;
4843def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4844def err_ref_init_ambiguous : Error<
4845  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4846def err_ovl_deleted_init : Error<
4847  "call to deleted constructor of %0">;
4848def err_ovl_deleted_special_init : Error<
4849  "call to implicitly-deleted %select{default constructor|copy constructor|"
4850  "move constructor|copy assignment operator|move assignment operator|"
4851  "destructor|function}0 of %1">;
4852def err_ovl_ambiguous_oper_unary : Error<
4853  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4854def err_ovl_ambiguous_oper_binary : Error<
4855  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4856def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4857  "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4858  "and %2) to be ambiguous despite there being a unique best viable function"
4859  "%select{ with non-reversed arguments|}3">,
4860  InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4861def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4862  "ambiguity is between a regular call to this operator and a call with the "
4863  "argument order reversed">;
4864def note_ovl_ambiguous_eqeq_reversed_self_non_const : Note<
4865  "mark 'operator==' as const or add a matching 'operator!=' to resolve the ambiguity">;
4866def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4867  "candidate function with non-reversed arguments">;
4868def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4869  "ambiguous candidate function with reversed arguments">;
4870def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4871def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4872def err_ovl_deleted_oper : Error<
4873  "overload resolution selected deleted operator '%0'">;
4874def err_ovl_deleted_special_oper : Error<
4875  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4876  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4877  "implicitly deleted">;
4878def err_ovl_deleted_comparison : Error<
4879  "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4880def err_ovl_rewrite_equalequal_not_bool : Error<
4881  "return type %0 of selected 'operator==' function for rewritten "
4882  "'%1' comparison is not 'bool'">;
4883def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4884  "ISO C++20 requires return type of selected 'operator==' function for "
4885  "rewritten '%1' comparison to be 'bool', not %0">,
4886  InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4887def err_ovl_no_viable_subscript :
4888    Error<"no viable overloaded operator[] for type %0">;
4889def err_ovl_no_oper :
4890    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4891def err_ovl_unresolvable : Error<
4892  "reference to %select{overloaded|multiversioned}1 function could not be "
4893  "resolved; did you mean to call it%select{| with no arguments}0?">;
4894def err_bound_member_function : Error<
4895  "reference to non-static member function must be called"
4896  "%select{|; did you mean to call it with no arguments?}0">;
4897def note_possible_target_of_call : Note<"possible target for call">;
4898def err_no_viable_destructor : Error<
4899  "no viable destructor found for class %0">;
4900def err_ambiguous_destructor : Error<
4901  "destructor of class %0 is ambiguous">;
4902
4903def err_ovl_no_viable_object_call : Error<
4904  "no matching function for call to object of type %0">;
4905def err_ovl_ambiguous_object_call : Error<
4906  "call to object of type %0 is ambiguous">;
4907def err_ovl_ambiguous_subscript_call : Error<
4908  "call to subscript operator of type %0 is ambiguous">;
4909def err_ovl_deleted_object_call : Error<
4910  "call to deleted function call operator in type %0">;
4911def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4912def err_member_call_without_object : Error<
4913  "call to %select{non-static|explicit}0 member function without an object argument">;
4914
4915// C++ Address of Overloaded Function
4916def err_addr_ovl_no_viable : Error<
4917  "address of overloaded function %0 does not match required type %1">;
4918def err_addr_ovl_ambiguous : Error<
4919  "address of overloaded function %0 is ambiguous">;
4920def err_addr_ovl_not_func_ptrref : Error<
4921  "address of overloaded function %0 cannot be converted to type %1">;
4922def err_addr_ovl_no_qualifier : Error<
4923  "cannot form member pointer of type %0 without '&' and class name">;
4924
4925} // let Deferrable
4926
4927// C++11 Literal Operators
4928def err_ovl_no_viable_literal_operator : Error<
4929  "no matching literal operator for call to %0"
4930  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4931  "%select{| or 'const char *'}4"
4932  "%select{|, and no matching literal operator template}5">;
4933
4934// C++ Template Declarations
4935def err_template_param_shadow : Error<
4936  "declaration of %0 shadows template parameter">;
4937def ext_template_param_shadow : ExtWarn<
4938  err_template_param_shadow.Summary>, InGroup<MicrosoftTemplateShadow>;
4939def note_template_param_here : Note<"template parameter is declared here">;
4940def note_template_param_external : Note<
4941  "template parameter from hidden source: %0">;
4942def warn_template_export_unsupported : Warning<
4943  "exported templates are unsupported">;
4944def err_template_outside_namespace_or_class_scope : Error<
4945  "templates can only be declared in namespace or class scope">;
4946def err_template_inside_local_class : Error<
4947  "templates cannot be declared inside of a local class">;
4948def err_template_linkage : Error<"templates must have C++ linkage">;
4949def err_template_typedef : Error<"a typedef cannot be a template">;
4950def err_template_unnamed_class : Error<
4951  "cannot declare a class template with no name">;
4952def err_template_param_list_different_arity : Error<
4953  "%select{too few|too many}0 template parameters in template "
4954  "%select{|template parameter }1redeclaration">;
4955def note_template_param_list_different_arity : Note<
4956  "%select{too few|too many}0 template parameters in template template "
4957  "argument">;
4958def note_template_prev_declaration : Note<
4959  "previous template %select{declaration|template parameter}0 is here">;
4960def err_template_param_different_kind : Error<
4961  "template parameter has a different kind in template "
4962  "%select{|template parameter }0redeclaration">;
4963def note_template_param_different_kind : Note<
4964  "template parameter has a different kind in template argument">;
4965
4966def err_invalid_decl_specifier_in_nontype_parm : Error<
4967  "invalid declaration specifier in template non-type parameter">;
4968
4969def err_template_nontype_parm_different_type : Error<
4970  "template non-type parameter has a different type %0 in template "
4971  "%select{|template parameter }1redeclaration">;
4972
4973def note_template_nontype_parm_different_type : Note<
4974  "template non-type parameter has a different type %0 in template argument">;
4975def note_template_nontype_parm_prev_declaration : Note<
4976  "previous non-type template parameter with type %0 is here">;
4977def err_template_nontype_parm_bad_type : Error<
4978  "a non-type template parameter cannot have type %0">;
4979def err_template_nontype_parm_bad_structural_type : Error<
4980  "a non-type template parameter cannot have type %0 before C++20">;
4981def err_template_nontype_parm_incomplete : Error<
4982  "non-type template parameter has incomplete type %0">;
4983def err_template_nontype_parm_not_literal : Error<
4984  "non-type template parameter has non-literal type %0">;
4985def err_template_nontype_parm_rvalue_ref : Error<
4986  "non-type template parameter has rvalue reference type %0">;
4987def err_template_nontype_parm_not_structural : Error<
4988  "type %0 of non-type template parameter is not a structural type">;
4989def note_not_structural_non_public : Note<
4990  "%0 is not a structural type because it has a "
4991  "%select{non-static data member|base class}1 that is not public">;
4992def note_not_structural_mutable_field : Note<
4993  "%0 is not a structural type because it has a mutable "
4994  "non-static data member">;
4995def note_not_structural_rvalue_ref_field : Note<
4996  "%0 is not a structural type because it has a non-static data member "
4997  "of rvalue reference type">;
4998def note_not_structural_subobject : Note<
4999  "%0 is not a structural type because it has a "
5000  "%select{non-static data member|base class}1 of non-structural type %2">;
5001def warn_cxx17_compat_template_nontype_parm_type : Warning<
5002  "non-type template parameter of type %0 is incompatible with "
5003  "C++ standards before C++20">,
5004  DefaultIgnore, InGroup<CXXPre20Compat>;
5005def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
5006  "non-type template parameters declared with %0 are incompatible with C++ "
5007  "standards before C++17">,
5008  DefaultIgnore, InGroup<CXXPre17Compat>;
5009def err_template_param_default_arg_redefinition : Error<
5010  "template parameter redefines default argument">;
5011def err_template_param_default_arg_inconsistent_redefinition : Error<
5012  "template parameter default argument is inconsistent with previous definition">;
5013def note_template_param_prev_default_arg : Note<
5014  "previous default template argument defined here">;
5015def note_template_param_prev_default_arg_in_other_module : Note<
5016  "previous default template argument defined in module %0">;
5017def err_template_param_default_arg_missing : Error<
5018  "template parameter missing a default argument">;
5019def ext_template_parameter_default_in_function_template : ExtWarn<
5020  "default template arguments for a function template are a C++11 extension">,
5021  InGroup<CXX11>;
5022def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
5023  "default template arguments for a function template are incompatible with C++98">,
5024  InGroup<CXX98Compat>, DefaultIgnore;
5025def err_template_parameter_default_template_member : Error<
5026  "cannot add a default template argument to the definition of a member of a "
5027  "class template">;
5028def err_template_parameter_default_friend_template : Error<
5029  "default template argument not permitted on a friend template">;
5030def err_template_template_parm_no_parms : Error<
5031  "template template parameter must have its own template parameters">;
5032
5033def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
5034  InGroup<CXX14>;
5035def warn_cxx11_compat_variable_template : Warning<
5036  "variable templates are incompatible with C++ standards before C++14">,
5037  InGroup<CXXPre14Compat>, DefaultIgnore;
5038def err_template_variable_noparams : Error<
5039  "extraneous 'template<>' in declaration of variable %0">;
5040def err_template_member : Error<"member %0 declared as a template">;
5041def err_member_with_template_arguments : Error<"member %0 cannot have template arguments">;
5042def err_template_member_noparams : Error<
5043  "extraneous 'template<>' in declaration of member %0">;
5044def err_template_tag_noparams : Error<
5045  "extraneous 'template<>' in declaration of %0 %1">;
5046
5047def warn_cxx17_compat_adl_only_template_id : Warning<
5048  "use of function template name with no prior function template "
5049  "declaration in function call with explicit template arguments "
5050  "is incompatible with C++ standards before C++20">,
5051  InGroup<CXXPre20Compat>, DefaultIgnore;
5052def ext_adl_only_template_id : ExtWarn<
5053  "use of function template name with no prior declaration in function call "
5054  "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
5055
5056def warn_unqualified_call_to_std_cast_function : Warning<
5057  "unqualified call to '%0'">, InGroup<DiagGroup<"unqualified-std-cast-call">>;
5058
5059// C++ Template Argument Lists
5060def err_template_missing_args : Error<
5061  "use of "
5062  "%select{class template|function template|variable template|alias template|"
5063  "template template parameter|concept|template}0 %1 requires template "
5064  "arguments">;
5065def err_template_arg_list_different_arity : Error<
5066  "%select{too few|too many}0 template arguments for "
5067  "%select{class template|function template|variable template|alias template|"
5068  "template template parameter|concept|template}1 %2">;
5069def note_template_decl_here : Note<"template is declared here">;
5070def note_template_decl_external : Note<
5071  "template declaration from hidden source: %0">;
5072def err_template_arg_must_be_type : Error<
5073  "template argument for template type parameter must be a type">;
5074def err_template_arg_must_be_type_suggest : Error<
5075  "template argument for template type parameter must be a type; "
5076  "did you forget 'typename'?">;
5077def ext_ms_template_type_arg_missing_typename : ExtWarn<
5078  "template argument for template type parameter must be a type; "
5079  "omitted 'typename' is a Microsoft extension">,
5080  InGroup<MicrosoftTemplate>;
5081def err_template_arg_must_be_expr : Error<
5082  "template argument for non-type template parameter must be an expression">;
5083def err_template_arg_nontype_ambig : Error<
5084  "template argument for non-type template parameter is treated as function type %0">;
5085def err_template_arg_must_be_template : Error<
5086  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
5087def ext_template_arg_local_type : ExtWarn<
5088  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
5089def ext_template_arg_unnamed_type : ExtWarn<
5090  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
5091def warn_cxx98_compat_template_arg_local_type : Warning<
5092  "local type %0 as template argument is incompatible with C++98">,
5093  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
5094def warn_cxx98_compat_template_arg_unnamed_type : Warning<
5095  "unnamed type as template argument is incompatible with C++98">,
5096  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
5097def note_template_unnamed_type_here : Note<
5098  "unnamed type used in template argument was declared here">;
5099def err_template_arg_overload_type : Error<
5100  "template argument is the type of an unresolved overloaded function">;
5101def err_template_arg_not_valid_template : Error<
5102  "template argument does not refer to a class or alias template, or template "
5103  "template parameter">;
5104def note_template_arg_refers_here_func : Note<
5105  "template argument refers to function template %0, here">;
5106def err_template_arg_template_params_mismatch : Error<
5107  "template template argument has different template parameters than its "
5108  "corresponding template template parameter">;
5109def err_template_arg_not_integral_or_enumeral : Error<
5110  "non-type template argument of type %0 must have an integral or enumeration"
5111  " type">;
5112def err_template_arg_not_ice : Error<
5113  "non-type template argument of type %0 is not an integral constant "
5114  "expression">;
5115def err_template_arg_not_address_constant : Error<
5116  "non-type template argument of type %0 is not a constant expression">;
5117def warn_cxx98_compat_template_arg_null : Warning<
5118  "use of null pointer as non-type template argument is incompatible with "
5119  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5120def err_template_arg_untyped_null_constant : Error<
5121  "null non-type template argument must be cast to template parameter type %0">;
5122def err_template_arg_wrongtype_null_constant : Error<
5123  "null non-type template argument of type %0 does not match template parameter "
5124  "of type %1">;
5125def err_non_type_template_parm_type_deduction_failure : Error<
5126  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
5127def err_deduced_non_type_template_arg_type_mismatch : Error<
5128  "deduced non-type template argument does not have the same type as the "
5129  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
5130def err_non_type_template_arg_subobject : Error<
5131  "non-type template argument refers to subobject '%0'">;
5132def err_non_type_template_arg_addr_label_diff : Error<
5133  "template argument / label address difference / what did you expect?">;
5134def err_non_type_template_arg_unsupported : Error<
5135  "sorry, non-type template argument of type %0 is not yet supported">;
5136def err_template_arg_not_convertible : Error<
5137  "non-type template argument of type %0 cannot be converted to a value "
5138  "of type %1">;
5139def warn_template_arg_negative : Warning<
5140  "non-type template argument with value '%0' converted to '%1' for unsigned "
5141  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5142def warn_template_arg_too_large : Warning<
5143  "non-type template argument value '%0' truncated to '%1' for "
5144  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5145def err_template_arg_no_ref_bind : Error<
5146  "non-type template parameter of reference type "
5147  "%diff{$ cannot bind to template argument of type $"
5148  "|cannot bind to template of incompatible argument type}0,1">;
5149def err_template_arg_ref_bind_ignores_quals : Error<
5150  "reference binding of non-type template parameter "
5151  "%diff{of type $ to template argument of type $|to template argument}0,1 "
5152  "ignores qualifiers">;
5153def err_template_arg_not_decl_ref : Error<
5154  "non-type template argument does not refer to any declaration">;
5155def err_template_arg_not_address_of : Error<
5156  "non-type template argument for template parameter of pointer type %0 must "
5157  "have its address taken">;
5158def err_template_arg_address_of_non_pointer : Error<
5159  "address taken in non-type template argument for template parameter of "
5160  "reference type %0">;
5161def err_template_arg_reference_var : Error<
5162  "non-type template argument of reference type %0 is not an object">;
5163def err_template_arg_field : Error<
5164  "non-type template argument refers to non-static data member %0">;
5165def err_template_arg_method : Error<
5166  "non-type template argument refers to non-static member function %0">;
5167def err_template_arg_object_no_linkage : Error<
5168  "non-type template argument refers to %select{function|object}0 %1 that "
5169  "does not have linkage">;
5170def warn_cxx98_compat_template_arg_object_internal : Warning<
5171  "non-type template argument referring to %select{function|object}0 %1 with "
5172  "internal linkage is incompatible with C++98">,
5173  InGroup<CXX98Compat>, DefaultIgnore;
5174def ext_template_arg_object_internal : ExtWarn<
5175  "non-type template argument referring to %select{function|object}0 %1 with "
5176  "internal linkage is a C++11 extension">, InGroup<CXX11>;
5177def err_template_arg_thread_local : Error<
5178  "non-type template argument refers to thread-local object">;
5179def note_template_arg_internal_object : Note<
5180  "non-type template argument refers to %select{function|object}0 here">;
5181def note_template_arg_refers_here : Note<
5182  "non-type template argument refers here">;
5183def err_template_arg_not_object_or_func : Error<
5184  "non-type template argument does not refer to an object or function">;
5185def err_template_arg_not_pointer_to_member_form : Error<
5186  "non-type template argument is not a pointer to member constant">;
5187def err_template_arg_member_ptr_base_derived_not_supported : Error<
5188  "sorry, non-type template argument of pointer-to-member type %1 that refers "
5189  "to member %q0 of a different class is not supported yet">;
5190def err_template_arg_invalid : Error<
5191  "non-type template argument '%0' is invalid">;
5192def ext_template_arg_extra_parens : ExtWarn<
5193  "address non-type template argument cannot be surrounded by parentheses">;
5194def warn_cxx98_compat_template_arg_extra_parens : Warning<
5195  "redundant parentheses surrounding address non-type template argument are "
5196  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5197def err_pointer_to_member_type : Error<
5198  "invalid use of pointer to member type after %select{.*|->*}0">;
5199def err_pointer_to_member_call_drops_quals : Error<
5200  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
5201def err_pointer_to_member_oper_value_classify: Error<
5202  "pointer-to-member function type %0 can only be called on an "
5203  "%select{rvalue|lvalue}1">;
5204def ext_pointer_to_const_ref_member_on_rvalue : Extension<
5205  "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
5206  InGroup<CXX20>, SFINAEFailure;
5207def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
5208  "invoking a pointer to a 'const &' member function on an rvalue is "
5209  "incompatible with C++ standards before C++20">,
5210  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
5211def ext_ms_deref_template_argument: ExtWarn<
5212  "non-type template argument containing a dereference operation is a "
5213  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5214def ext_ms_delayed_template_argument: ExtWarn<
5215  "using the undeclared type %0 as a default template argument is a "
5216  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5217def err_template_arg_deduced_incomplete_pack : Error<
5218  "deduced incomplete pack %0 for template parameter %1">;
5219
5220// C++ template specialization
5221def err_template_spec_unknown_kind : Error<
5222  "can only provide an explicit specialization for a class template, function "
5223  "template, variable template, or a member function, static data member, "
5224  "%select{or member class|member class, or member enumeration}0 of a "
5225  "class template">;
5226def note_specialized_entity : Note<
5227  "explicitly specialized declaration is here">;
5228def err_template_spec_decl_function_scope : Error<
5229  "explicit specialization of %0 in function scope">;
5230def err_template_spec_decl_friend : Error<
5231  "cannot declare an explicit specialization in a friend">;
5232def err_template_spec_redecl_out_of_scope : Error<
5233  "%select{class template|class template partial|variable template|"
5234  "variable template partial|function template|member "
5235  "function|static data member|member class|member enumeration}0 "
5236  "specialization of %1 not in %select{a namespace enclosing %2|"
5237  "class %2 or an enclosing namespace}3">;
5238def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
5239  "%select{class template|class template partial|variable template|"
5240  "variable template partial|function template|member "
5241  "function|static data member|member class|member enumeration}0 "
5242  "specialization of %1 not in %select{a namespace enclosing %2|"
5243  "class %2 or an enclosing namespace}3 "
5244  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
5245def err_template_spec_redecl_global_scope : Error<
5246  "%select{class template|class template partial|variable template|"
5247  "variable template partial|function template|member "
5248  "function|static data member|member class|member enumeration}0 "
5249  "specialization of %1 must occur at global scope">;
5250def err_spec_member_not_instantiated : Error<
5251  "specialization of member %q0 does not specialize an instantiated member">;
5252def note_specialized_decl : Note<"attempt to specialize declaration here">;
5253def err_specialization_after_instantiation : Error<
5254  "explicit specialization of %0 after instantiation">;
5255def note_instantiation_required_here : Note<
5256  "%select{implicit|explicit}0 instantiation first required here">;
5257def err_template_spec_friend : Error<
5258  "template specialization declaration cannot be a friend">;
5259def err_template_spec_default_arg : Error<
5260  "default argument not permitted on an explicit "
5261  "%select{instantiation|specialization}0 of function %1">;
5262def err_not_class_template_specialization : Error<
5263  "cannot specialize a %select{dependent template|template template "
5264  "parameter}0">;
5265def ext_explicit_specialization_storage_class : ExtWarn<
5266  "explicit specialization cannot have a storage class">;
5267def err_explicit_specialization_inconsistent_storage_class : Error<
5268  "explicit specialization has extraneous, inconsistent storage class "
5269  "'%select{none|extern|static|__private_extern__|auto|register}0'">;
5270def err_dependent_function_template_spec_no_match : Error<
5271  "no candidate function template was found for dependent"
5272  " %select{member|friend}0 function template specialization">;
5273def note_dependent_function_template_spec_discard_reason : Note<
5274  "candidate ignored: %select{not a function template|"
5275  "not a member of the enclosing %select{class template|"
5276  "namespace; did you mean to explicitly qualify the specialization?}1}0">;
5277
5278// C++ class template specializations and out-of-line definitions
5279def err_template_spec_needs_header : Error<
5280  "template specialization requires 'template<>'">;
5281def err_template_spec_needs_template_parameters : Error<
5282  "template specialization or definition requires a template parameter list "
5283  "corresponding to the nested type %0">;
5284def err_template_param_list_matches_nontemplate : Error<
5285  "template parameter list matching the non-templated nested type %0 should "
5286  "be empty ('template<>')">;
5287def err_alias_template_extra_headers : Error<
5288  "extraneous template parameter list in alias template declaration">;
5289def err_template_spec_extra_headers : Error<
5290  "extraneous template parameter list in template specialization or "
5291  "out-of-line template definition">;
5292def warn_template_spec_extra_headers : Warning<
5293  "extraneous template parameter list in template specialization">;
5294def note_explicit_template_spec_does_not_need_header : Note<
5295  "'template<>' header not required for explicitly-specialized class %0 "
5296  "declared here">;
5297def err_template_qualified_declarator_no_match : Error<
5298  "nested name specifier '%0' for declaration does not refer into a class, "
5299  "class template or class template partial specialization">;
5300def err_specialize_member_of_template : Error<
5301  "cannot specialize %select{|(with 'template<>') }0a member of an "
5302  "unspecialized template">;
5303
5304// C++ Class Template Partial Specialization
5305def err_default_arg_in_partial_spec : Error<
5306    "default template argument in a class template partial specialization">;
5307def err_dependent_non_type_arg_in_partial_spec : Error<
5308    "type of specialized non-type template argument depends on a template "
5309    "parameter of the partial specialization">;
5310def note_dependent_non_type_default_arg_in_partial_spec : Note<
5311    "template parameter is used in default argument declared here">;
5312def err_dependent_typed_non_type_arg_in_partial_spec : Error<
5313    "non-type template argument specializes a template parameter with "
5314    "dependent type %0">;
5315def err_partial_spec_args_match_primary_template : Error<
5316    "%select{class|variable}0 template partial specialization does not "
5317    "specialize any template argument; to %select{declare|define}1 the "
5318    "primary template, remove the template argument list">;
5319def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
5320    "%select{class|variable}0 template partial specialization is not "
5321    "more specialized than the primary template">, DefaultError,
5322    InGroup<DiagGroup<"invalid-partial-specialization">>;
5323def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
5324def ext_partial_specs_not_deducible : ExtWarn<
5325    "%select{class|variable}0 template partial specialization contains "
5326    "%select{a template parameter|template parameters}1 that cannot be "
5327    "deduced; this partial specialization will never be used">,
5328    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
5329def note_non_deducible_parameter : Note<
5330    "non-deducible template parameter %0">;
5331def err_partial_spec_ordering_ambiguous : Error<
5332    "ambiguous partial specializations of %0">;
5333def note_partial_spec_match : Note<"partial specialization matches %0">;
5334def err_partial_spec_redeclared : Error<
5335  "class template partial specialization %0 cannot be redeclared">;
5336def note_prev_partial_spec_here : Note<
5337  "previous declaration of class template partial specialization %0 is here">;
5338def err_partial_spec_fully_specialized : Error<
5339  "partial specialization of %0 does not use any of its template parameters">;
5340
5341// C++ Variable Template Partial Specialization
5342def err_var_partial_spec_redeclared : Error<
5343  "variable template partial specialization %0 cannot be redefined">;
5344def note_var_prev_partial_spec_here : Note<
5345  "previous declaration of variable template partial specialization is here">;
5346def err_var_spec_no_template : Error<
5347  "no variable template matches%select{| partial}0 specialization">;
5348def err_var_spec_no_template_but_method : Error<
5349  "no variable template matches specialization; "
5350  "did you mean to use %0 as function template instead?">;
5351
5352// C++ Function template specializations
5353def err_function_template_spec_no_match : Error<
5354    "no function template matches function template specialization %0">;
5355def err_function_template_spec_ambiguous : Error<
5356    "function template specialization %0 ambiguously refers to more than one "
5357    "function template; explicitly specify%select{| additional}1 template "
5358    "arguments to identify a particular function template">;
5359def note_function_template_spec_matched : Note<
5360    "function template %q0 matches specialization %1">;
5361def err_function_template_partial_spec : Error<
5362    "function template partial specialization is not allowed">;
5363
5364// C++ Template Instantiation
5365def err_template_recursion_depth_exceeded : Error<
5366  "recursive template instantiation exceeded maximum depth of %0">,
5367  DefaultFatal, NoSFINAE;
5368def err_constraint_depends_on_self : Error<
5369  "satisfaction of constraint '%0' depends on itself">, NoSFINAE;
5370def note_template_recursion_depth : Note<
5371  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
5372
5373def err_template_instantiate_within_definition : Error<
5374  "%select{implicit|explicit}0 instantiation of template %1 within its"
5375  " own definition">;
5376def err_template_instantiate_undefined : Error<
5377  "%select{implicit|explicit}0 instantiation of undefined template %1">;
5378def err_implicit_instantiate_member_undefined : Error<
5379  "implicit instantiation of undefined member %0">;
5380def note_template_class_instantiation_was_here : Note<
5381  "class template %0 was instantiated here">;
5382def note_template_class_explicit_specialization_was_here : Note<
5383  "class template %0 was explicitly specialized here">;
5384def note_template_class_instantiation_here : Note<
5385  "in instantiation of template class %q0 requested here">;
5386def note_template_member_class_here : Note<
5387  "in instantiation of member class %q0 requested here">;
5388def note_template_member_function_here : Note<
5389  "in instantiation of member function %q0 requested here">;
5390def note_function_template_spec_here : Note<
5391  "in instantiation of function template specialization %q0 requested here">;
5392def note_template_static_data_member_def_here : Note<
5393  "in instantiation of static data member %q0 requested here">;
5394def note_template_variable_def_here : Note<
5395  "in instantiation of variable template specialization %q0 requested here">;
5396def note_template_enum_def_here : Note<
5397  "in instantiation of enumeration %q0 requested here">;
5398def note_template_nsdmi_here : Note<
5399  "in instantiation of default member initializer %q0 requested here">;
5400def note_template_type_alias_instantiation_here : Note<
5401  "in instantiation of template type alias %0 requested here">;
5402def note_template_exception_spec_instantiation_here : Note<
5403  "in instantiation of exception specification for %0 requested here">;
5404def note_template_requirement_instantiation_here : Note<
5405  "in instantiation of requirement here">;
5406def note_template_requirement_params_instantiation_here : Note<
5407  "in instantiation of requirement parameters here">;
5408def warn_var_template_missing : Warning<"instantiation of variable %q0 "
5409  "required here, but no definition is available">,
5410  InGroup<UndefinedVarTemplate>;
5411def warn_func_template_missing : Warning<"instantiation of function %q0 "
5412  "required here, but no definition is available">,
5413  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
5414def note_forward_template_decl : Note<
5415  "forward declaration of template entity is here">;
5416def note_inst_declaration_hint : Note<"add an explicit instantiation "
5417  "declaration to suppress this warning if %q0 is explicitly instantiated in "
5418  "another translation unit">;
5419def note_evaluating_exception_spec_here : Note<
5420  "in evaluation of exception specification for %q0 needed here">;
5421
5422def note_default_arg_instantiation_here : Note<
5423  "in instantiation of default argument for '%0' required here">;
5424def note_default_function_arg_instantiation_here : Note<
5425  "in instantiation of default function argument expression "
5426  "for '%0' required here">;
5427def note_explicit_template_arg_substitution_here : Note<
5428  "while substituting explicitly-specified template arguments into function "
5429  "template %0 %1">;
5430def note_function_template_deduction_instantiation_here : Note<
5431  "while substituting deduced template arguments into function template %0 "
5432  "%1">;
5433def note_deduced_template_arg_substitution_here : Note<
5434  "during template argument deduction for %select{class|variable}0 template "
5435  "%select{partial specialization |}1%2 %3">;
5436def note_prior_template_arg_substitution : Note<
5437  "while substituting prior template arguments into %select{non-type|template}0"
5438  " template parameter%1 %2">;
5439def note_template_default_arg_checking : Note<
5440  "while checking a default template argument used here">;
5441def note_concept_specialization_here : Note<
5442  "while checking the satisfaction of concept '%0' requested here">;
5443def note_nested_requirement_here : Note<
5444  "while checking the satisfaction of nested requirement requested here">;
5445def note_checking_constraints_for_template_id_here : Note<
5446  "while checking constraint satisfaction for template '%0' required here">;
5447def note_checking_constraints_for_var_spec_id_here : Note<
5448  "while checking constraint satisfaction for variable template "
5449  "partial specialization '%0' required here">;
5450def note_checking_constraints_for_class_spec_id_here : Note<
5451  "while checking constraint satisfaction for class template partial "
5452  "specialization '%0' required here">;
5453def note_checking_constraints_for_function_here : Note<
5454  "while checking constraint satisfaction for function '%0' required here">;
5455def note_constraint_substitution_here : Note<
5456  "while substituting template arguments into constraint expression here">;
5457def note_constraint_normalization_here : Note<
5458  "while calculating associated constraint of template '%0' here">;
5459def note_parameter_mapping_substitution_here : Note<
5460  "while substituting into concept arguments here; substitution failures not "
5461  "allowed in concept arguments">;
5462def note_building_deduction_guide_here : Note<
5463  "while building implicit deduction guide first needed here">;
5464def note_lambda_substitution_here : Note<
5465  "while substituting into a lambda expression here">;
5466def note_instantiation_contexts_suppressed : Note<
5467  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
5468  "see all)">;
5469
5470def err_field_instantiates_to_function : Error<
5471  "data member instantiated with function type %0">;
5472def err_variable_instantiates_to_function : Error<
5473  "%select{variable|static data member}0 instantiated with function type %1">;
5474def err_nested_name_spec_non_tag : Error<
5475  "type %0 cannot be used prior to '::' because it has no members">;
5476
5477def err_using_pack_expansion_empty : Error<
5478  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
5479
5480// C++ Explicit Instantiation
5481def err_explicit_instantiation_duplicate : Error<
5482    "duplicate explicit instantiation of %0">;
5483def ext_explicit_instantiation_duplicate : ExtWarn<
5484    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
5485    InGroup<MicrosoftTemplate>;
5486def note_previous_explicit_instantiation : Note<
5487    "previous explicit instantiation is here">;
5488def warn_explicit_instantiation_after_specialization : Warning<
5489  "explicit instantiation of %0 that occurs after an explicit "
5490  "specialization has no effect">,
5491  InGroup<DiagGroup<"instantiation-after-specialization">>;
5492def note_previous_template_specialization : Note<
5493    "previous template specialization is here">;
5494def err_explicit_instantiation_nontemplate_type : Error<
5495    "explicit instantiation of non-templated type %0">;
5496def note_nontemplate_decl_here : Note<
5497    "non-templated declaration is here">;
5498def err_explicit_instantiation_in_class : Error<
5499  "explicit instantiation of %0 in class scope">;
5500def err_explicit_instantiation_out_of_scope : Error<
5501  "explicit instantiation of %0 not in a namespace enclosing %1">;
5502def err_explicit_instantiation_must_be_global : Error<
5503  "explicit instantiation of %0 must occur at global scope">;
5504def warn_explicit_instantiation_out_of_scope_0x : Warning<
5505  "explicit instantiation of %0 not in a namespace enclosing %1">,
5506  InGroup<CXX11Compat>, DefaultIgnore;
5507def warn_explicit_instantiation_must_be_global_0x : Warning<
5508  "explicit instantiation of %0 must occur at global scope">,
5509  InGroup<CXX11Compat>, DefaultIgnore;
5510
5511def err_explicit_instantiation_requires_name : Error<
5512  "explicit instantiation declaration requires a name">;
5513def err_explicit_instantiation_of_typedef : Error<
5514  "explicit instantiation of typedef %0">;
5515def err_explicit_instantiation_storage_class : Error<
5516  "explicit instantiation cannot have a storage class">;
5517def err_explicit_instantiation_internal_linkage : Error<
5518  "explicit instantiation declaration of %0 with internal linkage">;
5519def err_explicit_instantiation_not_known : Error<
5520  "explicit instantiation of %0 does not refer to a function template, "
5521  "variable template, member function, member class, or static data member">;
5522def note_explicit_instantiation_here : Note<
5523  "explicit instantiation refers here">;
5524def err_explicit_instantiation_data_member_not_instantiated : Error<
5525  "explicit instantiation refers to static data member %q0 that is not an "
5526  "instantiation">;
5527def err_explicit_instantiation_member_function_not_instantiated : Error<
5528  "explicit instantiation refers to member function %q0 that is not an "
5529  "instantiation">;
5530def err_explicit_instantiation_ambiguous : Error<
5531  "partial ordering for explicit instantiation of %0 is ambiguous">;
5532def note_explicit_instantiation_candidate : Note<
5533  "explicit instantiation candidate function %q0 template here %1">;
5534def err_explicit_instantiation_inline : Error<
5535  "explicit instantiation cannot be 'inline'">;
5536def warn_explicit_instantiation_inline_0x : Warning<
5537  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5538  DefaultIgnore;
5539def err_explicit_instantiation_constexpr : Error<
5540  "explicit instantiation cannot be 'constexpr'">;
5541def ext_explicit_instantiation_without_qualified_id : Extension<
5542  "qualifier in explicit instantiation of %q0 requires a template-id "
5543  "(a typedef is not permitted)">;
5544def err_explicit_instantiation_without_template_id : Error<
5545  "explicit instantiation of %q0 must specify a template argument list">;
5546def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5547  "explicit instantiation of %q0 must occur in namespace %1">;
5548def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5549  "explicit instantiation of %q0 must occur in namespace %1">,
5550  InGroup<CXX11Compat>, DefaultIgnore;
5551def err_explicit_instantiation_undefined_member : Error<
5552  "explicit instantiation of undefined %select{member class|member function|"
5553  "static data member}0 %1 of class template %2">;
5554def err_explicit_instantiation_undefined_func_template : Error<
5555  "explicit instantiation of undefined function template %0">;
5556def err_explicit_instantiation_undefined_var_template : Error<
5557  "explicit instantiation of undefined variable template %q0">;
5558def err_explicit_instantiation_declaration_after_definition : Error<
5559  "explicit instantiation declaration (with 'extern') follows explicit "
5560  "instantiation definition (without 'extern')">;
5561def note_explicit_instantiation_definition_here : Note<
5562  "explicit instantiation definition is here">;
5563def err_invalid_var_template_spec_type : Error<"type %2 "
5564  "of %select{explicit instantiation|explicit specialization|"
5565  "partial specialization|redeclaration}0 of %1 does not match"
5566  " expected type %3">;
5567def err_mismatched_exception_spec_explicit_instantiation : Error<
5568  "exception specification in explicit instantiation does not match "
5569  "instantiated one">;
5570def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5571  err_mismatched_exception_spec_explicit_instantiation.Summary>,
5572  InGroup<MicrosoftExceptionSpec>;
5573def err_explicit_instantiation_dependent : Error<
5574  "explicit instantiation has dependent template arguments">;
5575
5576// C++ typename-specifiers
5577def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5578def err_typename_nested_not_found_enable_if : Error<
5579  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5580  "this declaration">;
5581def err_typename_nested_not_found_requirement : Error<
5582  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5583  "declaration">;
5584def err_typename_nested_not_type : Error<
5585    "typename specifier refers to non-type member %0 in %1">;
5586def err_typename_not_type : Error<
5587    "typename specifier refers to non-type %0">;
5588def note_typename_member_refers_here : Note<
5589    "referenced member %0 is declared here">;
5590def note_typename_refers_here : Note<
5591    "referenced %0 is declared here">;
5592def err_typename_missing : Error<
5593  "missing 'typename' prior to dependent type name '%0%1'">;
5594def err_typename_missing_template : Error<
5595  "missing 'typename' prior to dependent type template name '%0%1'">;
5596def ext_typename_missing : ExtWarn<
5597  "missing 'typename' prior to dependent type name '%0%1'">,
5598  InGroup<DiagGroup<"typename-missing">>;
5599def ext_typename_outside_of_template : ExtWarn<
5600  "'typename' occurs outside of a template">, InGroup<CXX11>;
5601def warn_cxx98_compat_typename_outside_of_template : Warning<
5602  "use of 'typename' outside of a template is incompatible with C++98">,
5603  InGroup<CXX98Compat>, DefaultIgnore;
5604def err_typename_refers_to_using_value_decl : Error<
5605  "typename specifier refers to a dependent using declaration for a value "
5606  "%0 in %1">;
5607def note_using_value_decl_missing_typename : Note<
5608  "add 'typename' to treat this using declaration as a type">;
5609def warn_cxx17_compat_implicit_typename : Warning<"use of implicit 'typename' is "
5610  "incompatible with C++ standards before C++20">, InGroup<CXX20Compat>,
5611  DefaultIgnore;
5612def ext_implicit_typename : ExtWarn<"missing 'typename' prior to dependent "
5613  "type name %0%1; implicit 'typename' is a C++20 extension">,
5614  InGroup<CXX20>;
5615
5616def err_template_kw_refers_to_non_template : Error<
5617  "%0%select{| following the 'template' keyword}1 "
5618  "does not refer to a template">;
5619def note_template_kw_refers_to_non_template : Note<
5620  "declared as a non-template here">;
5621def err_template_kw_refers_to_dependent_non_template : Error<
5622  "%0%select{| following the 'template' keyword}1 "
5623  "cannot refer to a dependent template">;
5624def err_template_kw_refers_to_type_template : Error<
5625  "'%0%1' is expected to be a non-type template, but instantiated to a %select{class|type alias}2 template">;
5626def note_referenced_type_template : Note<
5627  "%select{class|type alias}0 template declared here">;
5628def err_template_kw_missing : Error<
5629  "missing 'template' keyword prior to dependent template name '%0%1'">;
5630def ext_template_outside_of_template : ExtWarn<
5631  "'template' keyword outside of a template">, InGroup<CXX11>;
5632def warn_cxx98_compat_template_outside_of_template : Warning<
5633  "use of 'template' keyword outside of a template is incompatible with C++98">,
5634  InGroup<CXX98Compat>, DefaultIgnore;
5635
5636def err_non_type_template_in_nested_name_specifier : Error<
5637  "qualified name refers into a specialization of %select{function|variable}0 "
5638  "template %1">;
5639def err_template_id_not_a_type : Error<
5640  "template name refers to non-type template %0">;
5641def note_template_declared_here : Note<
5642  "%select{function template|class template|variable template"
5643  "|type alias template|template template parameter}0 "
5644  "%1 declared here">;
5645def err_template_expansion_into_fixed_list : Error<
5646  "pack expansion used as argument for non-pack parameter of %select{alias "
5647  "template|concept}0">;
5648def note_parameter_type : Note<
5649  "parameter of type %0 is declared here">;
5650
5651// C++11 Variadic Templates
5652def err_template_param_pack_default_arg : Error<
5653  "template parameter pack cannot have a default argument">;
5654def err_template_param_pack_must_be_last_template_parameter : Error<
5655  "template parameter pack must be the last template parameter">;
5656
5657def err_template_parameter_pack_non_pack : Error<
5658  "%select{template type|non-type template|template template}0 parameter"
5659  "%select{| pack}1 conflicts with previous %select{template type|"
5660  "non-type template|template template}0 parameter%select{ pack|}1">;
5661def note_template_parameter_pack_non_pack : Note<
5662  "%select{template type|non-type template|template template}0 parameter"
5663  "%select{| pack}1 does not match %select{template type|non-type template"
5664  "|template template}0 parameter%select{ pack|}1 in template argument">;
5665def note_template_parameter_pack_here : Note<
5666  "previous %select{template type|non-type template|template template}0 "
5667  "parameter%select{| pack}1 declared here">;
5668
5669def err_unexpanded_parameter_pack : Error<
5670  "%select{expression|base type|declaration type|data member type|bit-field "
5671  "size|static assertion|fixed underlying type|enumerator value|"
5672  "using declaration|friend declaration|qualifier|initializer|default argument|"
5673  "non-type template parameter type|exception type|explicit specialization|"
5674  "partial specialization|__if_exists name|__if_not_exists name|lambda|block|"
5675  "type constraint|requirement|requires clause}0 "
5676  "contains%plural{0: an|:}1 unexpanded parameter pack"
5677  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5678
5679def err_pack_expansion_without_parameter_packs : Error<
5680  "pack expansion does not contain any unexpanded parameter packs">;
5681def err_pack_expansion_length_conflict : Error<
5682  "pack expansion contains parameter packs %0 and %1 that have different "
5683  "lengths (%2 vs. %3)">;
5684def err_pack_expansion_length_conflict_multilevel : Error<
5685  "pack expansion contains parameter pack %0 that has a different "
5686  "length (%1 vs. %2) from outer parameter packs">;
5687def err_pack_expansion_length_conflict_partial : Error<
5688  "pack expansion contains parameter pack %0 that has a different "
5689  "length (at least %1 vs. %2) from outer parameter packs">;
5690def err_pack_expansion_member_init : Error<
5691  "pack expansion for initialization of member %0">;
5692
5693def err_function_parameter_pack_without_parameter_packs : Error<
5694  "type %0 of function parameter pack does not contain any unexpanded "
5695  "parameter packs">;
5696def err_ellipsis_in_declarator_not_parameter : Error<
5697  "only function and template parameters can be parameter packs">;
5698
5699def err_sizeof_pack_no_pack_name : Error<
5700  "%0 does not refer to the name of a parameter pack">;
5701
5702def err_fold_expression_packs_both_sides : Error<
5703  "binary fold expression has unexpanded parameter packs in both operands">;
5704def err_fold_expression_empty : Error<
5705  "unary fold expression has empty expansion for operator '%0' "
5706  "with no fallback value">;
5707def err_fold_expression_bad_operand : Error<
5708  "expression not permitted as operand of fold expression">;
5709def err_fold_expression_limit_exceeded: Error<
5710  "instantiating fold expression with %0 arguments exceeded expression nesting "
5711  "limit of %1">, DefaultFatal, NoSFINAE;
5712
5713def err_unexpected_typedef : Error<
5714  "unexpected type name %0: expected expression">;
5715def err_unexpected_namespace : Error<
5716  "unexpected namespace name %0: expected expression">;
5717def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5718def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5719  "use of undeclared identifier %0; "
5720  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5721  InGroup<MicrosoftTemplate>;
5722def err_found_in_dependent_base : Error<
5723  "explicit qualification required to use member %0 from dependent base class">;
5724def ext_found_in_dependent_base : ExtWarn<"use of member %0 "
5725  "found via unqualified lookup into dependent bases of class templates is a "
5726  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5727def err_found_later_in_class : Error<"member %0 used before its declaration">;
5728def ext_found_later_in_class : ExtWarn<
5729  "use of member %0 before its declaration is a Microsoft extension">,
5730  InGroup<MicrosoftTemplate>;
5731def ext_unqualified_base_class : ExtWarn<
5732  "unqualified base initializer of class templates is a Microsoft extension">,
5733  InGroup<MicrosoftTemplate>;
5734def note_dependent_member_use : Note<
5735  "must qualify identifier to find this declaration in dependent base class">;
5736def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5737    "visible in the template definition nor found by argument-dependent lookup">;
5738def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5739    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5740def err_undeclared_use : Error<"use of undeclared %0">;
5741def warn_deprecated : Warning<"%0 is deprecated">,
5742    InGroup<DeprecatedDeclarations>;
5743def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5744def warn_property_method_deprecated :
5745    Warning<"property access is using %0 method which is deprecated">,
5746    InGroup<DeprecatedDeclarations>;
5747def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5748    InGroup<DeprecatedDeclarations>;
5749def warn_deprecated_anonymous_namespace : Warning<
5750  "'deprecated' attribute on anonymous namespace ignored">,
5751  InGroup<IgnoredAttributes>;
5752def warn_deprecated_fwdclass_message : Warning<
5753    "%0 may be deprecated because the receiver type is unknown">,
5754    InGroup<DeprecatedDeclarations>;
5755def warn_deprecated_def : Warning<
5756  "implementing deprecated %select{method|class|category}0">,
5757  InGroup<DeprecatedImplementations>, DefaultIgnore;
5758def warn_unavailable_def : Warning<
5759  "implementing unavailable method">,
5760  InGroup<DeprecatedImplementations>, DefaultIgnore;
5761def warn_deprecated_builtin : Warning<
5762  "builtin %0 is deprecated; use %1 instead">,
5763  InGroup<DeprecatedBuiltins>;
5764def err_unavailable : Error<"%0 is unavailable">;
5765def err_property_method_unavailable :
5766    Error<"property access is using %0 method which is unavailable">;
5767def err_unavailable_message : Error<"%0 is unavailable: %1">;
5768def warn_unavailable_fwdclass_message : Warning<
5769    "%0 may be unavailable because the receiver type is unknown">,
5770    InGroup<UnavailableDeclarations>;
5771def note_availability_specified_here : Note<
5772  "%0 has been explicitly marked "
5773  "%select{unavailable|deleted|deprecated}1 here">;
5774def note_partial_availability_specified_here : Note<
5775  "%0 has been marked as being introduced in %1 %2 here, "
5776  "but the deployment target is %1 %3">;
5777def note_implicitly_deleted : Note<
5778  "explicitly defaulted function was implicitly deleted here">;
5779def warn_not_enough_argument : Warning<
5780  "not enough variable arguments in %0 declaration to fit a sentinel">,
5781  InGroup<Sentinel>;
5782def warn_missing_sentinel : Warning <
5783  "missing sentinel in %select{function call|method dispatch|block call}0">,
5784  InGroup<Sentinel>;
5785def note_sentinel_here : Note<
5786  "%select{function|method|block}0 has been explicitly marked sentinel here">;
5787def warn_strict_uses_without_prototype : Warning<
5788  "passing arguments to %select{a function|%1}0 without a prototype is "
5789  "deprecated in all versions of C and is not supported in C23">,
5790  InGroup<DeprecatedNonPrototype>;
5791def warn_missing_prototype : Warning<
5792  "no previous prototype for function %0">,
5793  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5794def note_declaration_not_a_prototype : Note<
5795  "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5796  "to make it %select{a prototype for a zero-parameter function|one}0">;
5797// This is not actually an extension, but we only want it to be enabled in
5798// -pedantic mode and this is the most direct way of accomplishing that.
5799def warn_strict_prototypes : Extension<
5800  "a %select{function|block}0 declaration without a prototype is deprecated "
5801  "%select{in all versions of C|}0">, InGroup<StrictPrototypes>;
5802def warn_non_prototype_changes_behavior : Warning<
5803  "a function %select{declaration|definition}0 without a prototype is "
5804  "deprecated in all versions of C %select{and is not supported in C23|and is "
5805  "treated as a zero-parameter prototype in C23, conflicting with a "
5806  "%select{previous|subsequent}2 %select{declaration|definition}3}1">,
5807  InGroup<DeprecatedNonPrototype>;
5808def note_conflicting_prototype : Note<"conflicting prototype is here">;
5809def warn_missing_variable_declarations : Warning<
5810  "no previous extern declaration for non-static variable %0">,
5811  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5812def note_static_for_internal_linkage : Note<
5813  "declare 'static' if the %select{variable|function}0 is not intended to be "
5814  "used outside of this translation unit">;
5815def err_static_data_member_reinitialization :
5816  Error<"static data member %0 already has an initializer">;
5817def err_redefinition : Error<"redefinition of %0">;
5818def err_alias_after_tentative :
5819  Error<"alias definition of %0 after tentative definition">;
5820def err_alias_is_definition :
5821  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5822def err_definition_of_implicitly_declared_member : Error<
5823  "definition of implicitly declared %select{default constructor|copy "
5824  "constructor|move constructor|copy assignment operator|move assignment "
5825  "operator|destructor|function}1">;
5826def err_definition_of_explicitly_defaulted_member : Error<
5827  "definition of explicitly defaulted %select{default constructor|copy "
5828  "constructor|move constructor|copy assignment operator|move assignment "
5829  "operator|destructor|function}0">;
5830def err_redefinition_extern_inline : Error<
5831  "redefinition of a 'extern inline' function %0 is not supported in "
5832  "%select{C99 mode|C++}1">;
5833def warn_attr_abi_tag_namespace : Warning<
5834  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5835  InGroup<IgnoredAttributes>;
5836def err_abi_tag_on_redeclaration : Error<
5837  "cannot add 'abi_tag' attribute in a redeclaration">;
5838def err_new_abi_tag_on_redeclaration : Error<
5839  "'abi_tag' %0 missing in original declaration">;
5840def note_use_ifdef_guards : Note<
5841  "unguarded header; consider using #ifdef guards or #pragma once">;
5842
5843def warn_var_decl_not_read_only : Warning<
5844  "object of type %0 cannot be placed in read-only memory">,
5845  InGroup<ReadOnlyPlacementChecks>;
5846def note_enforce_read_only_placement : Note<"type was declared read-only here">;
5847
5848
5849def note_deleted_dtor_no_operator_delete : Note<
5850  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5851def note_deleted_special_member_class_subobject : Note<
5852  "%select{default constructor of|copy constructor of|move constructor of|"
5853  "copy assignment operator of|move assignment operator of|destructor of|"
5854  "constructor inherited by}0 "
5855  "%1 is implicitly deleted because "
5856  "%select{base class %3|%select{||||variant }4field %3}2 "
5857  "%select{has "
5858  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5859  "%select{%select{default constructor|copy constructor|move constructor|copy "
5860  "assignment operator|move assignment operator|destructor|"
5861  "%select{default|corresponding|default|default|default}4 constructor}0|"
5862  "destructor}5"
5863  "%select{||s||}4"
5864  "|is an ObjC pointer}6">;
5865def note_deleted_default_ctor_uninit_field : Note<
5866  "%select{default constructor of|constructor inherited by}0 "
5867  "%1 is implicitly deleted because field %2 of "
5868  "%select{reference|const-qualified}4 type %3 would not be initialized">;
5869def note_deleted_default_ctor_all_const : Note<
5870  "%select{default constructor of|constructor inherited by}0 "
5871  "%1 is implicitly deleted because all "
5872  "%select{data members|data members of an anonymous union member}2"
5873  " are const-qualified">;
5874def note_deleted_copy_ctor_rvalue_reference : Note<
5875  "copy constructor of %0 is implicitly deleted because field %1 is of "
5876  "rvalue reference type %2">;
5877def note_deleted_copy_user_declared_move : Note<
5878  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5879  " %1 has a user-declared move %select{constructor|assignment operator}2">;
5880def note_deleted_assign_field : Note<
5881  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5882  "because field %2 is of %select{reference|const-qualified}4 type %3">;
5883
5884// These should be errors.
5885def warn_undefined_internal : Warning<
5886  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5887  InGroup<DiagGroup<"undefined-internal">>;
5888def err_undefined_internal_type : Error<
5889  "%select{function|variable}0 %q1 is used but not defined in this "
5890  "translation unit, and cannot be defined in any other translation unit "
5891  "because its type does not have linkage">;
5892def ext_undefined_internal_type : Extension<
5893  "ISO C++ requires a definition in this translation unit for "
5894  "%select{function|variable}0 %q1 because its type does not have linkage">,
5895  InGroup<DiagGroup<"undefined-internal-type">>;
5896def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5897  InGroup<DiagGroup<"undefined-inline">>;
5898def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5899def note_used_here : Note<"used here">;
5900
5901def err_attribute_missing_on_first_decl : Error<
5902  "%0 attribute does not appear on the first declaration">;
5903def warn_internal_linkage_local_storage : Warning<
5904  "'internal_linkage' attribute on a non-static local variable is ignored">,
5905  InGroup<IgnoredAttributes>;
5906
5907def ext_internal_in_extern_inline : ExtWarn<
5908  "static %select{function|variable}0 %1 is used in an inline function with "
5909  "external linkage">, InGroup<StaticInInline>;
5910def ext_internal_in_extern_inline_quiet : Extension<
5911  "static %select{function|variable}0 %1 is used in an inline function with "
5912  "external linkage">, InGroup<StaticInInline>;
5913def warn_static_local_in_extern_inline : Warning<
5914  "non-constant static local variable in inline function may be different "
5915  "in different files">, InGroup<StaticLocalInInline>;
5916def note_convert_inline_to_static : Note<
5917  "use 'static' to give inline function %0 internal linkage">;
5918
5919def ext_redefinition_of_typedef : ExtWarn<
5920  "redefinition of typedef %0 is a C11 feature">,
5921  InGroup<DiagGroup<"typedef-redefinition"> >;
5922def err_redefinition_variably_modified_typedef : Error<
5923  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5924
5925def err_inline_decl_follows_def : Error<
5926  "inline declaration of %0 follows non-inline definition">;
5927def err_inline_declaration_block_scope : Error<
5928  "inline declaration of %0 not allowed in block scope">;
5929def err_static_non_static : Error<
5930  "static declaration of %0 follows non-static declaration">;
5931def err_different_language_linkage : Error<
5932  "declaration of %0 has a different language linkage">;
5933def ext_retained_language_linkage : Extension<
5934  "friend function %0 retaining previous language linkage is an extension">,
5935  InGroup<DiagGroup<"retained-language-linkage">>;
5936def err_extern_c_global_conflict : Error<
5937  "declaration of %1 %select{with C language linkage|in global scope}0 "
5938  "conflicts with declaration %select{in global scope|with C language linkage}0">;
5939def note_extern_c_global_conflict : Note<
5940  "declared %select{in global scope|with C language linkage}0 here">;
5941def note_extern_c_begins_here : Note<
5942  "extern \"C\" language linkage specification begins here">;
5943def warn_weak_import : Warning <
5944  "an already-declared variable is made a weak_import declaration %0">;
5945def ext_static_non_static : Extension<
5946  "redeclaring non-static %0 as static is a Microsoft extension">,
5947  InGroup<MicrosoftRedeclareStatic>;
5948def err_non_static_static : Error<
5949  "non-static declaration of %0 follows static declaration">;
5950def err_extern_non_extern : Error<
5951  "extern declaration of %0 follows non-extern declaration">;
5952def err_non_extern_extern : Error<
5953  "non-extern declaration of %0 follows extern declaration">;
5954def err_non_thread_thread : Error<
5955  "non-thread-local declaration of %0 follows thread-local declaration">;
5956def err_thread_non_thread : Error<
5957  "thread-local declaration of %0 follows non-thread-local declaration">;
5958def err_thread_thread_different_kind : Error<
5959  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5960  "follows declaration with %select{dynamic|static}1 initialization">;
5961def err_mismatched_owning_module : Error<
5962  "declaration of %0 in %select{the global module|module %2}1 follows "
5963  "declaration in %select{the global module|module %4}3">;
5964def err_redefinition_different_type : Error<
5965  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5966def err_redefinition_different_kind : Error<
5967  "redefinition of %0 as different kind of symbol">;
5968def err_redefinition_different_namespace_alias : Error<
5969  "redefinition of %0 as an alias for a different namespace">;
5970def note_previous_namespace_alias : Note<
5971  "previously defined as an alias for %0">;
5972def warn_forward_class_redefinition : Warning<
5973  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5974  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5975def err_redefinition_different_typedef : Error<
5976  "%select{typedef|type alias|type alias template}0 "
5977  "redefinition with different types%diff{ ($ vs $)|}1,2">;
5978def err_redefinition_different_concept : Error<
5979  "redefinition of concept %0 with different template parameters or requirements">;
5980def err_tag_reference_non_tag : Error<
5981  "%select{non-struct type|non-class type|non-union type|non-enum "
5982  "type|typedef|type alias|template|type alias template|template "
5983  "template argument}1 %0 cannot be referenced with a "
5984  "%select{struct|interface|union|class|enum}2 specifier">;
5985def err_tag_reference_conflict : Error<
5986  "implicit declaration introduced by elaborated type conflicts with a "
5987  "%select{non-struct type|non-class type|non-union type|non-enum "
5988  "type|typedef|type alias|template|type alias template|template "
5989  "template argument}0 of the same name">;
5990def err_dependent_tag_decl : Error<
5991  "%select{declaration|definition}0 of "
5992  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5993def err_tag_definition_of_typedef : Error<
5994  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
5995def err_conflicting_types : Error<"conflicting types for %0">;
5996def err_different_pass_object_size_params : Error<
5997  "conflicting pass_object_size attributes on parameters">;
5998def err_late_asm_label_name : Error<
5999  "cannot apply asm label to %select{variable|function}0 after its first use">;
6000def err_different_asm_label : Error<"conflicting asm label">;
6001def err_nested_redefinition : Error<"nested redefinition of %0">;
6002def err_use_with_wrong_tag : Error<
6003  "use of %0 with tag type that does not match previous declaration">;
6004def warn_struct_class_tag_mismatch : Warning<
6005  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
6006  "declared as a %select{struct|interface|class}3%select{| template}1; "
6007  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
6008  InGroup<MismatchedTags>, DefaultIgnore;
6009def warn_struct_class_previous_tag_mismatch : Warning<
6010  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
6011  "here but previously declared as "
6012  "%select{a struct|an interface|a class}3%select{| template}1; "
6013  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
6014  InGroup<MismatchedTags>, DefaultIgnore;
6015def note_struct_class_suggestion : Note<
6016  "did you mean %select{struct|interface|class}0 here?">;
6017def ext_forward_ref_enum : Extension<
6018  "ISO C forbids forward references to 'enum' types">;
6019def err_forward_ref_enum : Error<
6020  "ISO C++ forbids forward references to 'enum' types">;
6021def ext_ms_forward_ref_enum : ExtWarn<
6022  "forward references to 'enum' types are a Microsoft extension">,
6023  InGroup<MicrosoftEnumForwardReference>;
6024def ext_forward_ref_enum_def : Extension<
6025  "redeclaration of already-defined enum %0 is a GNU extension">,
6026  InGroup<GNURedeclaredEnum>;
6027
6028def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
6029def err_duplicate_member : Error<"duplicate member %0">;
6030def err_misplaced_ivar : Error<
6031  "instance variables may not be placed in %select{categories|class extension}0">;
6032def warn_ivars_in_interface : Warning<
6033  "declaration of instance variables in the interface is deprecated">,
6034  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
6035def ext_enum_value_not_int : Extension<
6036  "ISO C restricts enumerator values to range of 'int' (%0 is too "
6037  "%select{small|large}1)">;
6038def ext_enum_too_large : ExtWarn<
6039  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
6040def ext_enumerator_increment_too_large : ExtWarn<
6041  "incremented enumerator value %0 is not representable in the "
6042  "largest integer type">, InGroup<EnumTooLarge>;
6043def warn_flag_enum_constant_out_of_range : Warning<
6044  "enumeration value %0 is out of range of flags in enumeration type %1">,
6045  InGroup<FlagEnum>;
6046
6047def err_vm_decl_in_file_scope : Error<
6048  "variably modified type declaration not allowed at file scope">;
6049def err_vm_decl_has_extern_linkage : Error<
6050  "variably modified type declaration cannot have 'extern' linkage">;
6051def err_typecheck_field_variable_size : Error<
6052  "fields must have a constant size: 'variable length array in structure' "
6053  "extension will never be supported">;
6054def err_vm_func_decl : Error<
6055  "function declaration cannot have variably modified type">;
6056def err_array_too_large : Error<
6057  "array is too large (%0 elements)">;
6058
6059def err_typecheck_negative_array_size : Error<"array size is negative">;
6060def warn_typecheck_function_qualifiers_ignored : Warning<
6061  "'%0' qualifier on function type %1 has no effect">,
6062  InGroup<IgnoredQualifiers>;
6063def warn_typecheck_function_qualifiers_unspecified : Warning<
6064  "'%0' qualifier on function type %1 has unspecified behavior">;
6065def warn_typecheck_reference_qualifiers : Warning<
6066  "'%0' qualifier on reference type %1 has no effect">,
6067  InGroup<IgnoredReferenceQualifiers>;
6068def err_typecheck_invalid_restrict_not_pointer : Error<
6069  "restrict requires a pointer or reference (%0 is invalid)">;
6070def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
6071  "restrict requires a pointer or reference">;
6072def err_typecheck_invalid_restrict_invalid_pointee : Error<
6073  "pointer to function type %0 may not be 'restrict' qualified">;
6074def ext_typecheck_zero_array_size : Extension<
6075  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
6076def err_typecheck_zero_array_size : Error<
6077  "zero-length arrays are not permitted in %select{C++|SYCL device code}0">;
6078def err_array_size_non_int : Error<"size of array has non-integer type %0">;
6079def err_init_element_not_constant : Error<
6080  "initializer element is not a compile-time constant">;
6081def ext_aggregate_init_not_constant : Extension<
6082  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
6083def err_local_cant_init : Error<
6084  "'__local' variable cannot have an initializer">;
6085def err_loader_uninitialized_cant_init
6086    : Error<"variable with 'loader_uninitialized' attribute cannot have an "
6087            "initializer">;
6088def err_loader_uninitialized_trivial_ctor
6089    : Error<"variable with 'loader_uninitialized' attribute must have a "
6090            "trivial default constructor">;
6091def err_loader_uninitialized_redeclaration
6092    : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
6093def err_loader_uninitialized_extern_decl
6094    : Error<"variable %0 cannot be declared both 'extern' and with the "
6095            "'loader_uninitialized' attribute">;
6096def err_block_extern_cant_init : Error<
6097  "declaration of block scope identifier with linkage cannot have an initializer">;
6098def warn_extern_init : Warning<"'extern' variable has an initializer">,
6099  InGroup<DiagGroup<"extern-initializer">>;
6100def err_variable_object_no_init : Error<
6101  "variable-sized object may not be initialized">;
6102def err_excess_initializers : Error<
6103  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
6104def ext_excess_initializers : ExtWarn<
6105  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
6106  InGroup<ExcessInitializers>;
6107def err_excess_initializers_for_sizeless_type : Error<
6108  "excess elements in initializer for indivisible sizeless type %0">;
6109def ext_excess_initializers_for_sizeless_type : ExtWarn<
6110  "excess elements in initializer for indivisible sizeless type %0">,
6111  InGroup<ExcessInitializers>;
6112def err_excess_initializers_in_char_array_initializer : Error<
6113  "excess elements in char array initializer">;
6114def ext_excess_initializers_in_char_array_initializer : ExtWarn<
6115  "excess elements in char array initializer">,
6116  InGroup<ExcessInitializers>;
6117def err_initializer_string_for_char_array_too_long : Error<
6118  "initializer-string for char array is too long, array size is %0 but initializer has size %1 (including the null terminating character)">;
6119def ext_initializer_string_for_char_array_too_long : ExtWarn<
6120  "initializer-string for char array is too long">,
6121  InGroup<ExcessInitializers>;
6122def warn_missing_field_initializers : Warning<
6123  "missing field %0 initializer">,
6124  InGroup<MissingFieldInitializers>, DefaultIgnore;
6125def warn_braces_around_init : Warning<
6126  "braces around %select{scalar |}0initializer">,
6127  InGroup<DiagGroup<"braced-scalar-init">>;
6128def ext_many_braces_around_init : ExtWarn<
6129  "too many braces around %select{scalar |}0initializer">,
6130  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
6131def ext_complex_component_init : Extension<
6132  "complex initialization specifying real and imaginary components "
6133  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
6134def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
6135def err_empty_sizeless_initializer : Error<
6136  "initializer for sizeless type %0 cannot be empty">;
6137def warn_cxx98_compat_empty_scalar_initializer : Warning<
6138  "scalar initialized from empty initializer list is incompatible with C++98">,
6139  InGroup<CXX98Compat>, DefaultIgnore;
6140def warn_cxx98_compat_empty_sizeless_initializer : Warning<
6141  "initializing %0 from an empty initializer list is incompatible with C++98">,
6142  InGroup<CXX98Compat>, DefaultIgnore;
6143def warn_cxx98_compat_reference_list_init : Warning<
6144  "reference initialized from initializer list is incompatible with C++98">,
6145  InGroup<CXX98Compat>, DefaultIgnore;
6146def warn_cxx98_compat_initializer_list_init : Warning<
6147  "initialization of initializer_list object is incompatible with C++98">,
6148  InGroup<CXX98Compat>, DefaultIgnore;
6149def warn_cxx98_compat_ctor_list_init : Warning<
6150  "constructor call from initializer list is incompatible with C++98">,
6151  InGroup<CXX98Compat>, DefaultIgnore;
6152def err_illegal_initializer : Error<
6153  "illegal initializer (only variables can be initialized)">;
6154def err_illegal_initializer_type : Error<"illegal initializer type %0">;
6155def ext_init_list_type_narrowing : ExtWarn<
6156  "type %0 cannot be narrowed to %1 in initializer list">,
6157  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6158def ext_init_list_variable_narrowing : ExtWarn<
6159  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6160  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6161def ext_init_list_constant_narrowing : ExtWarn<
6162  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
6163  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6164def warn_init_list_type_narrowing : Warning<
6165  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
6166  InGroup<CXX11Narrowing>, DefaultIgnore;
6167def warn_init_list_variable_narrowing : Warning<
6168  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6169  "initializer list in C++11">,
6170  InGroup<CXX11Narrowing>, DefaultIgnore;
6171def warn_init_list_constant_narrowing : Warning<
6172  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
6173  "C++11">,
6174  InGroup<CXX11Narrowing>, DefaultIgnore;
6175def note_init_list_narrowing_silence : Note<
6176  "insert an explicit cast to silence this issue">;
6177def err_init_objc_class : Error<
6178  "cannot initialize Objective-C class type %0">;
6179def err_implicit_empty_initializer : Error<
6180  "initializer for aggregate with no elements requires explicit braces">;
6181def err_bitfield_has_negative_width : Error<
6182  "bit-field %0 has negative width (%1)">;
6183def err_anon_bitfield_has_negative_width : Error<
6184  "anonymous bit-field has negative width (%0)">;
6185def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
6186def err_bitfield_width_exceeds_type_width : Error<
6187  "width of%select{ anonymous|}0 bit-field%select{| %1}0 (%2 bits) exceeds the "
6188  "%select{width|size}3 of its type (%4 bit%s4)">;
6189def err_incorrect_number_of_vector_initializers : Error<
6190  "number of elements must be either one or match the size of the vector">;
6191
6192// Used by C++ which allows bit-fields that are wider than the type.
6193def warn_bitfield_width_exceeds_type_width: Warning<
6194  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
6195  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
6196def err_bitfield_too_wide : Error<
6197  "%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
6198def warn_bitfield_too_small_for_enum : Warning<
6199  "bit-field %0 is not wide enough to store all enumerators of %1">,
6200  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6201def note_widen_bitfield : Note<
6202  "widen this field to %0 bits to store all values of %1">;
6203def warn_unsigned_bitfield_assigned_signed_enum : Warning<
6204  "assigning value of signed enum type %1 to unsigned bit-field %0; "
6205  "negative enumerators of enum %1 will be converted to positive values">,
6206  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6207def warn_signed_bitfield_enum_conversion : Warning<
6208  "signed bit-field %0 needs an extra bit to represent the largest positive "
6209  "enumerators of %1">,
6210  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6211def note_change_bitfield_sign : Note<
6212  "consider making the bitfield type %select{unsigned|signed}0">;
6213
6214def warn_missing_braces : Warning<
6215  "suggest braces around initialization of subobject">,
6216  InGroup<MissingBraces>, DefaultIgnore;
6217
6218def err_redefinition_of_label : Error<"redefinition of label %0">;
6219def err_undeclared_label_use : Error<"use of undeclared label %0">;
6220def err_goto_ms_asm_label : Error<
6221  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
6222def note_goto_ms_asm_label : Note<
6223  "inline assembly label %0 declared here">;
6224def warn_unused_label : Warning<"unused label %0">,
6225  InGroup<UnusedLabel>, DefaultIgnore;
6226
6227def err_continue_from_cond_var_init : Error<
6228  "cannot jump from this continue statement to the loop increment; "
6229  "jump bypasses initialization of loop condition variable">;
6230def err_goto_into_protected_scope : Error<
6231  "cannot jump from this goto statement to its label">;
6232def ext_goto_into_protected_scope : ExtWarn<
6233  "jump from this goto statement to its label is a Microsoft extension">,
6234  InGroup<MicrosoftGoto>;
6235def warn_cxx98_compat_goto_into_protected_scope : Warning<
6236  "jump from this goto statement to its label is incompatible with C++98">,
6237  InGroup<CXX98Compat>, DefaultIgnore;
6238def err_switch_into_protected_scope : Error<
6239  "cannot jump from switch statement to this case label">;
6240def warn_cxx98_compat_switch_into_protected_scope : Warning<
6241  "jump from switch statement to this case label is incompatible with C++98">,
6242  InGroup<CXX98Compat>, DefaultIgnore;
6243def err_indirect_goto_without_addrlabel : Error<
6244  "indirect goto in function with no address-of-label expressions">;
6245def err_indirect_goto_in_protected_scope : Error<
6246  "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
6247def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
6248  "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
6249  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6250def note_indirect_goto_target : Note<
6251  "possible target of %select{indirect|asm}0 goto statement">;
6252def note_protected_by_variable_init : Note<
6253  "jump bypasses variable initialization">;
6254def note_protected_by_variable_nontriv_destructor : Note<
6255  "jump bypasses variable with a non-trivial destructor">;
6256def note_protected_by_variable_non_pod : Note<
6257  "jump bypasses initialization of non-POD variable">;
6258def note_protected_by_cleanup : Note<
6259  "jump bypasses initialization of variable with __attribute__((cleanup))">;
6260def note_protected_by_vla_typedef : Note<
6261  "jump bypasses initialization of VLA typedef">;
6262def note_protected_by_vla_type_alias : Note<
6263  "jump bypasses initialization of VLA type alias">;
6264def note_protected_by_constexpr_if : Note<
6265  "jump enters controlled statement of constexpr if">;
6266def note_protected_by_consteval_if : Note<
6267  "jump enters controlled statement of consteval if">;
6268def note_protected_by_if_available : Note<
6269  "jump enters controlled statement of if available">;
6270def note_protected_by_vla : Note<
6271  "jump bypasses initialization of variable length array">;
6272def note_protected_by_objc_fast_enumeration : Note<
6273  "jump enters Objective-C fast enumeration loop">;
6274def note_protected_by_objc_try : Note<
6275  "jump bypasses initialization of @try block">;
6276def note_protected_by_objc_catch : Note<
6277  "jump bypasses initialization of @catch block">;
6278def note_protected_by_objc_finally : Note<
6279  "jump bypasses initialization of @finally block">;
6280def note_protected_by_objc_synchronized : Note<
6281  "jump bypasses initialization of @synchronized block">;
6282def note_protected_by_objc_autoreleasepool : Note<
6283  "jump bypasses auto release push of @autoreleasepool block">;
6284def note_protected_by_cxx_try : Note<
6285  "jump bypasses initialization of try block">;
6286def note_protected_by_cxx_catch : Note<
6287  "jump bypasses initialization of catch block">;
6288def note_protected_by_seh_try : Note<
6289  "jump bypasses initialization of __try block">;
6290def note_protected_by_seh_except : Note<
6291  "jump bypasses initialization of __except block">;
6292def note_protected_by_seh_finally : Note<
6293  "jump bypasses initialization of __finally block">;
6294def note_protected_by___block : Note<
6295  "jump bypasses setup of __block variable">;
6296def note_protected_by_objc_strong_init : Note<
6297  "jump bypasses initialization of __strong variable">;
6298def note_protected_by_objc_weak_init : Note<
6299  "jump bypasses initialization of __weak variable">;
6300def note_protected_by_non_trivial_c_struct_init : Note<
6301  "jump bypasses initialization of variable of non-trivial C struct type">;
6302def note_enters_block_captures_cxx_obj : Note<
6303  "jump enters lifetime of block which captures a destructible C++ object">;
6304def note_enters_block_captures_strong : Note<
6305  "jump enters lifetime of block which strongly captures a variable">;
6306def note_enters_block_captures_weak : Note<
6307  "jump enters lifetime of block which weakly captures a variable">;
6308def note_enters_block_captures_non_trivial_c_struct : Note<
6309  "jump enters lifetime of block which captures a C struct that is non-trivial "
6310  "to destroy">;
6311def note_enters_compound_literal_scope : Note<
6312  "jump enters lifetime of a compound literal that is non-trivial to destruct">;
6313def note_enters_statement_expression : Note<
6314  "jump enters a statement expression">;
6315
6316def note_exits_cleanup : Note<
6317  "jump exits scope of variable with __attribute__((cleanup))">;
6318def note_exits_dtor : Note<
6319  "jump exits scope of variable with non-trivial destructor">;
6320def note_exits_temporary_dtor : Note<
6321  "jump exits scope of lifetime-extended temporary with non-trivial "
6322  "destructor">;
6323def note_exits___block : Note<
6324  "jump exits scope of __block variable">;
6325def note_exits_objc_try : Note<
6326  "jump exits @try block">;
6327def note_exits_objc_catch : Note<
6328  "jump exits @catch block">;
6329def note_exits_objc_finally : Note<
6330  "jump exits @finally block">;
6331def note_exits_objc_synchronized : Note<
6332  "jump exits @synchronized block">;
6333def note_exits_cxx_try : Note<
6334  "jump exits try block">;
6335def note_exits_cxx_catch : Note<
6336  "jump exits catch block">;
6337def note_exits_seh_try : Note<
6338  "jump exits __try block">;
6339def note_exits_seh_except : Note<
6340  "jump exits __except block">;
6341def note_exits_seh_finally : Note<
6342  "jump exits __finally block">;
6343def note_exits_objc_autoreleasepool : Note<
6344  "jump exits autoreleasepool block">;
6345def note_exits_objc_strong : Note<
6346  "jump exits scope of __strong variable">;
6347def note_exits_objc_weak : Note<
6348  "jump exits scope of __weak variable">;
6349def note_exits_block_captures_cxx_obj : Note<
6350  "jump exits lifetime of block which captures a destructible C++ object">;
6351def note_exits_block_captures_strong : Note<
6352  "jump exits lifetime of block which strongly captures a variable">;
6353def note_exits_block_captures_weak : Note<
6354  "jump exits lifetime of block which weakly captures a variable">;
6355def note_exits_block_captures_non_trivial_c_struct : Note<
6356  "jump exits lifetime of block which captures a C struct that is non-trivial "
6357  "to destroy">;
6358def note_exits_compound_literal_scope : Note<
6359  "jump exits lifetime of a compound literal that is non-trivial to destruct">;
6360
6361def err_func_returning_qualified_void : ExtWarn<
6362  "function cannot return qualified void type %0">,
6363  InGroup<DiagGroup<"qualified-void-return-type">>;
6364def err_func_returning_array_function : Error<
6365  "function cannot return %select{array|function}0 type %1">;
6366def err_field_declared_as_function : Error<"field %0 declared as a function">;
6367def err_field_incomplete_or_sizeless : Error<
6368  "field has %select{incomplete|sizeless}0 type %1">;
6369def ext_variable_sized_type_in_struct : ExtWarn<
6370  "field %0 with variable sized type %1 not at the end of a struct or class is"
6371  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
6372
6373def ext_c99_flexible_array_member : Extension<
6374  "flexible array members are a C99 feature">, InGroup<C99>;
6375def err_flexible_array_virtual_base : Error<
6376  "flexible array member %0 not allowed in "
6377  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
6378def err_flexible_array_empty_aggregate : Error<
6379  "flexible array member %0 not allowed in otherwise empty "
6380  "%select{struct|interface|union|class|enum}1">;
6381def err_flexible_array_has_nontrivial_dtor : Error<
6382  "flexible array member %0 of type %1 with non-trivial destruction">;
6383def ext_flexible_array_in_struct : Extension<
6384  "%0 may not be nested in a struct due to flexible array member">,
6385  InGroup<FlexibleArrayExtensions>;
6386def ext_flexible_array_in_array : Extension<
6387  "%0 may not be used as an array element due to flexible array member">,
6388  InGroup<FlexibleArrayExtensions>;
6389def err_flexible_array_init : Error<
6390  "initialization of flexible array member is not allowed">;
6391def ext_flexible_array_empty_aggregate_ms : Extension<
6392  "flexible array member %0 in otherwise empty "
6393  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
6394  InGroup<MicrosoftFlexibleArray>;
6395def err_flexible_array_union : Error<
6396  "flexible array member %0 in a union is not allowed">;
6397def ext_flexible_array_union_ms : Extension<
6398  "flexible array member %0 in a union is a Microsoft extension">,
6399  InGroup<MicrosoftFlexibleArray>;
6400def ext_flexible_array_empty_aggregate_gnu : Extension<
6401  "flexible array member %0 in otherwise empty "
6402  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
6403  InGroup<GNUEmptyStruct>;
6404def ext_flexible_array_union_gnu : Extension<
6405  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
6406
6407def err_flexible_array_not_at_end : Error<
6408  "flexible array member %0 with type %1 is not at the end of"
6409  " %select{struct|interface|union|class|enum}2">;
6410def err_objc_variable_sized_type_not_at_end : Error<
6411  "field %0 with variable sized type %1 is not at the end of class">;
6412def note_next_field_declaration : Note<
6413  "next field declaration is here">;
6414def note_next_ivar_declaration : Note<
6415  "next %select{instance variable declaration|synthesized instance variable}0"
6416  " is here">;
6417def err_synthesize_variable_sized_ivar : Error<
6418  "synthesized property with variable size type %0"
6419  " requires an existing instance variable">;
6420def err_flexible_array_arc_retainable : Error<
6421  "ARC forbids flexible array members with retainable object type">;
6422def warn_variable_sized_ivar_visibility : Warning<
6423  "field %0 with variable sized type %1 is not visible to subclasses and"
6424  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
6425def warn_superclass_variable_sized_type_not_at_end : Warning<
6426  "field %0 can overwrite instance variable %1 with variable sized type %2"
6427  " in superclass %3">, InGroup<ObjCFlexibleArray>;
6428
6429def err_counted_by_attr_not_on_flexible_array_member : Error<
6430  "'counted_by' only applies to C99 flexible array members">;
6431def err_counted_by_attr_refers_to_flexible_array : Error<
6432  "'counted_by' cannot refer to the flexible array %0">;
6433def err_counted_by_must_be_in_structure : Error<
6434  "field %0 in 'counted_by' not inside structure">;
6435def err_flexible_array_counted_by_attr_field_not_integer : Error<
6436  "field %0 in 'counted_by' must be a non-boolean integer type">;
6437def note_flexible_array_counted_by_attr_field : Note<
6438  "field %0 declared here">;
6439
6440let CategoryName = "ARC Semantic Issue" in {
6441
6442// ARC-mode diagnostics.
6443
6444let CategoryName = "ARC Weak References" in {
6445
6446def err_arc_weak_no_runtime : Error<
6447  "cannot create __weak reference because the current deployment target "
6448  "does not support weak references">;
6449def err_arc_weak_disabled : Error<
6450  "cannot create __weak reference in file using manual reference counting">;
6451def err_synthesizing_arc_weak_property_disabled : Error<
6452  "cannot synthesize weak property in file using manual reference counting">;
6453def err_synthesizing_arc_weak_property_no_runtime : Error<
6454  "cannot synthesize weak property because the current deployment target "
6455  "does not support weak references">;
6456def err_arc_unsupported_weak_class : Error<
6457  "class is incompatible with __weak references">;
6458def err_arc_weak_unavailable_assign : Error<
6459  "assignment of a weak-unavailable object to a __weak object">;
6460def err_arc_weak_unavailable_property : Error<
6461  "synthesizing __weak instance variable of type %0, which does not "
6462  "support weak references">;
6463def note_implemented_by_class : Note<
6464  "when implemented by class %0">;
6465def err_arc_convesion_of_weak_unavailable : Error<
6466  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
6467  " a __weak object of type %2">;
6468
6469} // end "ARC Weak References" category
6470
6471let CategoryName = "ARC Restrictions" in {
6472
6473def err_unavailable_in_arc : Error<
6474  "%0 is unavailable in ARC">;
6475def note_arc_forbidden_type : Note<
6476  "declaration uses type that is ill-formed in ARC">;
6477def note_performs_forbidden_arc_conversion : Note<
6478  "inline function performs a conversion which is forbidden in ARC">;
6479def note_arc_init_returns_unrelated : Note<
6480  "init method must return a type related to its receiver type">;
6481def note_arc_weak_disabled : Note<
6482  "declaration uses __weak, but ARC is disabled">;
6483def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
6484  "the current deployment target does not support">;
6485def note_arc_field_with_ownership : Note<
6486  "field has non-trivial ownership qualification">;
6487
6488def err_arc_illegal_explicit_message : Error<
6489  "ARC forbids explicit message send of %0">;
6490def err_arc_unused_init_message : Error<
6491  "the result of a delegate init call must be immediately returned "
6492  "or assigned to 'self'">;
6493def err_arc_mismatched_cast : Error<
6494  "%select{implicit conversion|cast}0 of "
6495  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
6496  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
6497  " to %3 is disallowed with ARC">;
6498def err_arc_nolifetime_behavior : Error<
6499  "explicit ownership qualifier on cast result has no effect">;
6500def err_arc_objc_property_default_assign_on_object : Error<
6501  "ARC forbids synthesizing a property of an Objective-C object "
6502  "with unspecified ownership or storage attribute">;
6503def err_arc_illegal_selector : Error<
6504  "ARC forbids use of %0 in a @selector">;
6505def err_arc_illegal_method_def : Error<
6506  "ARC forbids %select{implementation|synthesis}0 of %1">;
6507def warn_arc_strong_pointer_objc_pointer : Warning<
6508  "method parameter of type %0 with no explicit ownership">,
6509  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
6510
6511} // end "ARC Restrictions" category
6512
6513def err_arc_lost_method_convention : Error<
6514  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
6515  "method, but its implementation doesn't match because %select{"
6516  "its result type is not an object pointer|"
6517  "its result type is unrelated to its receiver type}1">;
6518def note_arc_lost_method_convention : Note<"declaration in interface">;
6519def err_arc_gained_method_convention : Error<
6520  "method implementation does not match its declaration">;
6521def note_arc_gained_method_convention : Note<
6522  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
6523  "family because %select{its result type is not an object pointer|"
6524  "its result type is unrelated to its receiver type}1">;
6525def err_typecheck_arc_assign_self : Error<
6526  "cannot assign to 'self' outside of a method in the init family">;
6527def err_typecheck_arc_assign_self_class_method : Error<
6528  "cannot assign to 'self' in a class method">;
6529def err_typecheck_arr_assign_enumeration : Error<
6530  "fast enumeration variables cannot be modified in ARC by default; "
6531  "declare the variable __strong to allow this">;
6532def err_typecheck_arc_assign_externally_retained : Error<
6533  "variable declared with 'objc_externally_retained' "
6534  "cannot be modified in ARC">;
6535def warn_arc_retained_assign : Warning<
6536  "assigning retained object to %select{weak|unsafe_unretained}0 "
6537  "%select{property|variable}1"
6538  "; object will be released after assignment">,
6539  InGroup<ARCUnsafeRetainedAssign>;
6540def warn_arc_retained_property_assign : Warning<
6541  "assigning retained object to unsafe property"
6542  "; object will be released after assignment">,
6543  InGroup<ARCUnsafeRetainedAssign>;
6544def warn_arc_literal_assign : Warning<
6545  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
6546  " to a weak %select{property|variable}1"
6547  "; object will be released after assignment">,
6548  InGroup<ARCUnsafeRetainedAssign>;
6549def err_arc_new_array_without_ownership : Error<
6550  "'new' cannot allocate an array of %0 with no explicit ownership">;
6551def err_arc_autoreleasing_var : Error<
6552  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
6553  "__autoreleasing ownership">;
6554def err_arc_autoreleasing_capture : Error<
6555  "cannot capture __autoreleasing variable in a "
6556  "%select{block|lambda by copy}0">;
6557def err_arc_thread_ownership : Error<
6558  "thread-local variable has non-trivial ownership: type is %0">;
6559def err_arc_indirect_no_ownership : Error<
6560  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6561def err_arc_array_param_no_ownership : Error<
6562  "must explicitly describe intended ownership of an object array parameter">;
6563def err_arc_pseudo_dtor_inconstant_quals : Error<
6564  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6565  "type %1">;
6566def err_arc_init_method_unrelated_result_type : Error<
6567  "init methods must return a type related to the receiver type">;
6568def err_arc_nonlocal_writeback : Error<
6569  "passing address of %select{non-local|non-scalar}0 object to "
6570  "__autoreleasing parameter for write-back">;
6571def err_arc_method_not_found : Error<
6572  "no known %select{instance|class}1 method for selector %0">;
6573def err_arc_receiver_forward_class : Error<
6574  "receiver %0 for class message is a forward declaration">;
6575def err_arc_may_not_respond : Error<
6576  "no visible @interface for %0 declares the selector %1">;
6577def err_arc_receiver_forward_instance : Error<
6578  "receiver type %0 for instance message is a forward declaration">;
6579def warn_receiver_forward_instance : Warning<
6580  "receiver type %0 for instance message is a forward declaration">,
6581  InGroup<ForwardClassReceiver>, DefaultIgnore;
6582def err_arc_collection_forward : Error<
6583  "collection expression type %0 is a forward declaration">;
6584def err_arc_multiple_method_decl : Error<
6585  "multiple methods named %0 found with mismatched result, "
6586  "parameter type or attributes">;
6587def warn_arc_lifetime_result_type : Warning<
6588  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6589  "lifetime qualifier on return type is ignored">,
6590  InGroup<IgnoredQualifiers>;
6591
6592let CategoryName = "ARC Retain Cycle" in {
6593
6594def warn_arc_retain_cycle : Warning<
6595  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6596  InGroup<ARCRetainCycles>;
6597def note_arc_retain_cycle_owner : Note<
6598  "block will be retained by %select{the captured object|an object strongly "
6599  "retained by the captured object}0">;
6600
6601} // end "ARC Retain Cycle" category
6602
6603def warn_arc_object_memaccess : Warning<
6604  "%select{destination for|source of}0 this %1 call is a pointer to "
6605  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6606
6607let CategoryName = "ARC and @properties" in {
6608
6609def err_arc_strong_property_ownership : Error<
6610  "existing instance variable %1 for strong property %0 may not be "
6611  "%select{|__unsafe_unretained||__weak}2">;
6612def err_arc_assign_property_ownership : Error<
6613  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6614  "attribute must be __unsafe_unretained">;
6615def err_arc_inconsistent_property_ownership : Error<
6616  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6617  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6618
6619} // end "ARC and @properties" category
6620
6621def warn_block_capture_autoreleasing : Warning<
6622  "block captures an autoreleasing out-parameter, which may result in "
6623  "use-after-free bugs">,
6624  InGroup<BlockCaptureAutoReleasing>;
6625def note_declare_parameter_strong : Note<
6626  "declare the parameter __strong or capture a __block __strong variable to "
6627  "keep values alive across autorelease pools">;
6628
6629def err_arc_atomic_ownership : Error<
6630  "cannot perform atomic operation on a pointer to type %0: type has "
6631  "non-trivial ownership">;
6632
6633let CategoryName = "ARC Casting Rules" in {
6634
6635def err_arc_bridge_cast_incompatible : Error<
6636  "incompatible types casting %0 to %1 with a %select{__bridge|"
6637  "__bridge_transfer|__bridge_retained}2 cast">;
6638def err_arc_bridge_cast_wrong_kind : Error<
6639  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6640  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6641  "__bridge_transfer|__bridge_retained}4">;
6642def err_arc_cast_requires_bridge : Error<
6643  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6644  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6645  "requires a bridged cast">;
6646def note_arc_bridge : Note<
6647  "use __bridge to convert directly (no change in ownership)">;
6648def note_arc_cstyle_bridge : Note<
6649  "use __bridge with C-style cast to convert directly (no change in ownership)">;
6650def note_arc_bridge_transfer : Note<
6651  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6652  "ownership of a +1 %0 into ARC">;
6653def note_arc_cstyle_bridge_transfer : Note<
6654  "use __bridge_transfer with C-style cast to transfer "
6655  "ownership of a +1 %0 into ARC">;
6656def note_arc_bridge_retained : Note<
6657  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6658  "ARC object available as a +1 %0">;
6659def note_arc_cstyle_bridge_retained : Note<
6660  "use __bridge_retained with C-style cast to make an "
6661  "ARC object available as a +1 %0">;
6662
6663} // ARC Casting category
6664
6665} // ARC category name
6666
6667def err_flexible_array_init_needs_braces : Error<
6668  "flexible array requires brace-enclosed initializer">;
6669def err_illegal_decl_array_of_functions : Error<
6670  "'%0' declared as array of functions of type %1">;
6671def err_array_incomplete_or_sizeless_type : Error<
6672  "array has %select{incomplete|sizeless}0 element type %1">;
6673def err_illegal_message_expr_incomplete_type : Error<
6674  "Objective-C message has incomplete result type %0">;
6675def err_illegal_decl_array_of_references : Error<
6676  "'%0' declared as array of references of type %1">;
6677def err_decl_negative_array_size : Error<
6678  "'%0' declared as an array with a negative size">;
6679def err_array_static_outside_prototype : Error<
6680  "%0 used in array declarator outside of function prototype">;
6681def err_array_static_not_outermost : Error<
6682  "%0 used in non-outermost array type derivation">;
6683def err_array_star_outside_prototype : Error<
6684  "star modifier used outside of function prototype">;
6685def err_illegal_decl_pointer_to_reference : Error<
6686  "'%0' declared as a pointer to a reference of type %1">;
6687def err_illegal_decl_mempointer_to_reference : Error<
6688  "'%0' declared as a member pointer to a reference of type %1">;
6689def err_illegal_decl_mempointer_to_void : Error<
6690  "'%0' declared as a member pointer to void">;
6691def err_illegal_decl_mempointer_in_nonclass : Error<
6692  "'%0' does not point into a class">;
6693def err_mempointer_in_nonclass_type : Error<
6694  "member pointer refers into non-class type %0">;
6695def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6696def err_nonfunction_block_type : Error<
6697  "block pointer to non-function type is invalid">;
6698def err_return_block_has_expr : Error<"void block should not return a value">;
6699def err_block_return_missing_expr : Error<
6700  "non-void block should return a value">;
6701def err_func_def_incomplete_result : Error<
6702  "incomplete result type %0 in function definition">;
6703def err_atomic_specifier_bad_type
6704    : Error<"_Atomic cannot be applied to "
6705            "%select{incomplete |array |function |reference |atomic |qualified "
6706            "|sizeless ||integer |}0type "
6707            "%1 %select{|||||||which is not trivially copyable||in C23}0">;
6708def warn_atomic_member_access : Warning<
6709  "accessing a member of an atomic structure or union is undefined behavior">,
6710  InGroup<DiagGroup<"atomic-access">>, DefaultError;
6711
6712// Expressions.
6713def err_using_placeholder_variable : Error<
6714  "ambiguous reference to placeholder '_', which is defined multiple times">;
6715def note_reference_placeholder : Note<
6716  "placeholder declared here">;
6717def ext_placeholder_var_definition : ExtWarn<
6718  "placeholder variables are a C++2c extension">, InGroup<CXX26>;
6719def warn_cxx23_placeholder_var_definition : Warning<
6720  "placeholder variables are incompatible with C++ standards before C++2c">,
6721  DefaultIgnore, InGroup<CXXPre26Compat>;
6722
6723def ext_sizeof_alignof_function_type : Extension<
6724  "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6725def ext_sizeof_alignof_void_type : Extension<
6726  "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6727def err_opencl_sizeof_alignof_type : Error<
6728  "invalid application of '%0' to a void type">;
6729def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6730  "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6731def err_sizeof_alignof_function_type : Error<
6732  "invalid application of '%0' to a function type">;
6733def err_openmp_default_simd_align_expr : Error<
6734  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6735def err_sizeof_alignof_typeof_bitfield : Error<
6736  "invalid application of '%select{sizeof|alignof|typeof|typeof_unqual}0' to "
6737  "bit-field">;
6738def err_alignof_member_of_incomplete_type : Error<
6739  "invalid application of 'alignof' to a field of a class still being defined">;
6740def err_vecstep_non_scalar_vector_type : Error<
6741  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6742def err_offsetof_incomplete_type : Error<
6743  "offsetof of incomplete type %0">;
6744def err_offsetof_record_type : Error<
6745  "offsetof requires struct, union, or class type, %0 invalid">;
6746def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6747def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6748  InGroup<InvalidOffsetof>;
6749def ext_offsetof_non_standardlayout_type : ExtWarn<
6750  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6751def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6752def err_offsetof_field_of_virtual_base : Error<
6753  "invalid application of 'offsetof' to a field of a virtual base">;
6754def warn_sub_ptr_zero_size_types : Warning<
6755  "subtraction of pointers to type %0 of zero size has undefined behavior">,
6756  InGroup<PointerArith>;
6757def warn_pointer_arith_null_ptr : Warning<
6758  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6759  InGroup<NullPointerArithmetic>, DefaultIgnore;
6760def warn_gnu_null_ptr_arith : Extension<
6761  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6762  InGroup<GNUNullPointerArithmetic>;
6763def warn_pointer_sub_null_ptr : Warning<
6764  "performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior">,
6765  InGroup<NullPointerSubtraction>, DefaultIgnore;
6766
6767def warn_floatingpoint_eq : Warning<
6768  "comparing floating point with == or != is unsafe">,
6769  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6770
6771def err_setting_eval_method_used_in_unsafe_context : Error <
6772  "%select{'#pragma clang fp eval_method'|option 'ffp-eval-method'}0 cannot be used with "
6773  "%select{option 'fapprox-func'|option 'mreassociate'|option 'freciprocal'|option 'ffp-eval-method'|'#pragma clang fp reassociate'|'#pragma clang fp reciprocal'}1">;
6774
6775def warn_remainder_division_by_zero : Warning<
6776  "%select{remainder|division}0 by zero is undefined">,
6777  InGroup<DivZero>;
6778def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6779  InGroup<DiagGroup<"shift-negative-value">>;
6780def warn_shift_negative : Warning<"shift count is negative">,
6781  InGroup<DiagGroup<"shift-count-negative">>;
6782def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6783  InGroup<DiagGroup<"shift-count-overflow">>;
6784def warn_shift_result_gt_typewidth : Warning<
6785  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6786  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6787def warn_shift_result_sets_sign_bit : Warning<
6788  "signed shift result (%0) sets the sign bit of the shift expression's "
6789  "type (%1) and becomes negative">,
6790  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6791
6792def warn_precedence_bitwise_rel : Warning<
6793  "%0 has lower precedence than %1; %1 will be evaluated first">,
6794  InGroup<Parentheses>;
6795def note_precedence_bitwise_first : Note<
6796  "place parentheses around the %0 expression to evaluate it first">;
6797def note_precedence_silence : Note<
6798  "place parentheses around the '%0' expression to silence this warning">;
6799
6800def warn_precedence_conditional : Warning<
6801  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6802  InGroup<Parentheses>;
6803def warn_precedence_bitwise_conditional : Warning<
6804  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6805  InGroup<BitwiseConditionalParentheses>;
6806def note_precedence_conditional_first : Note<
6807  "place parentheses around the '?:' expression to evaluate it first">;
6808
6809def warn_enum_constant_in_bool_context : Warning<
6810  "converting the enum constant to a boolean">,
6811  InGroup<IntInBoolContext>, DefaultIgnore;
6812def warn_left_shift_in_bool_context : Warning<
6813  "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6814  InGroup<IntInBoolContext>, DefaultIgnore;
6815def warn_logical_instead_of_bitwise : Warning<
6816  "use of logical '%0' with constant operand">,
6817  InGroup<DiagGroup<"constant-logical-operand">>;
6818def note_logical_instead_of_bitwise_change_operator : Note<
6819  "use '%0' for a bitwise operation">;
6820def note_logical_instead_of_bitwise_remove_constant : Note<
6821  "remove constant to silence this warning">;
6822
6823def warn_bitwise_op_in_bitwise_op : Warning<
6824  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6825
6826def warn_logical_and_in_logical_or : Warning<
6827  "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6828
6829def warn_overloaded_shift_in_comparison :Warning<
6830  "overloaded operator %select{>>|<<}0 has higher precedence than "
6831  "comparison operator">,
6832  InGroup<OverloadedShiftOpParentheses>;
6833def note_evaluate_comparison_first :Note<
6834  "place parentheses around comparison expression to evaluate it first">;
6835
6836def note_concatenated_string_literal_silence :Note<
6837  "place parentheses around the string literal to silence warning">;
6838
6839def warn_addition_in_bitshift : Warning<
6840  "operator '%0' has lower precedence than '%1'; "
6841  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6842
6843def warn_self_assignment_builtin : Warning<
6844  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6845  "you mean to assign to member %2?}1">,
6846  InGroup<SelfAssignment>, DefaultIgnore;
6847def warn_self_assignment_overloaded : Warning<
6848  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6849  "you mean to assign to member %2?}1">,
6850  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6851def warn_self_move : Warning<
6852  "explicitly moving variable of type %0 to itself%select{|; did you mean to "
6853  "move to member %2?}1">,
6854  InGroup<SelfMove>, DefaultIgnore;
6855
6856def err_builtin_move_forward_unsupported : Error<
6857  "unsupported signature for %q0">;
6858def err_use_of_unaddressable_function : Error<
6859  "taking address of non-addressable standard library function">;
6860// FIXME: This should also be in -Wc++23-compat once we have it.
6861def warn_cxx20_compat_use_of_unaddressable_function : Warning<
6862  "taking address of non-addressable standard library function "
6863  "is incompatible with C++20">, InGroup<CXX20Compat>;
6864
6865def warn_redundant_move_on_return : Warning<
6866  "redundant move in return statement">,
6867  InGroup<RedundantMove>, DefaultIgnore;
6868def warn_pessimizing_move_on_return : Warning<
6869  "moving a local object in a return statement prevents copy elision">,
6870  InGroup<PessimizingMove>, DefaultIgnore;
6871def warn_pessimizing_move_on_initialization : Warning<
6872  "moving a temporary object prevents copy elision">,
6873  InGroup<PessimizingMove>, DefaultIgnore;
6874def note_remove_move : Note<"remove std::move call here">;
6875
6876def warn_string_plus_int : Warning<
6877  "adding %0 to a string does not append to the string">,
6878  InGroup<StringPlusInt>;
6879def warn_string_plus_char : Warning<
6880  "adding %0 to a string pointer does not append to the string">,
6881  InGroup<StringPlusChar>;
6882def note_string_plus_scalar_silence : Note<
6883  "use array indexing to silence this warning">;
6884
6885def warn_sizeof_array_param : Warning<
6886  "sizeof on array function parameter will return size of %0 instead of %1">,
6887  InGroup<SizeofArrayArgument>;
6888
6889def warn_sizeof_array_decay : Warning<
6890  "sizeof on pointer operation will return size of %0 instead of %1">,
6891  InGroup<SizeofArrayDecay>;
6892
6893def err_sizeof_nonfragile_interface : Error<
6894  "application of '%select{alignof|sizeof}1' to interface %0 is "
6895  "not supported on this architecture and platform">;
6896def err_atdef_nonfragile_interface : Error<
6897  "use of @defs is not supported on this architecture and platform">;
6898def err_subscript_nonfragile_interface : Error<
6899  "subscript requires size of interface %0, which is not constant for "
6900  "this architecture and platform">;
6901
6902def err_arithmetic_nonfragile_interface : Error<
6903  "arithmetic on pointer to interface %0, which is not a constant size for "
6904  "this architecture and platform">;
6905
6906def warn_deprecated_comma_subscript : Warning<
6907  "top-level comma expression in array subscript is deprecated "
6908  "in C++20 and unsupported in C++23">,
6909  InGroup<DeprecatedCommaSubscript>;
6910
6911def ext_subscript_non_lvalue : Extension<
6912  "ISO C90 does not allow subscripting non-lvalue array">;
6913def err_typecheck_subscript_value : Error<
6914  "subscripted value is not an array, pointer, or vector">;
6915def err_typecheck_subscript_not_integer : Error<
6916  "array subscript is not an integer">;
6917def err_subscript_function_type : Error<
6918  "subscript of pointer to function type %0">;
6919def err_subscript_incomplete_or_sizeless_type : Error<
6920  "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6921def err_subscript_svbool_t : Error<
6922  "subscript of svbool_t is not allowed">;
6923def err_dereference_incomplete_type : Error<
6924  "dereference of pointer to incomplete type %0">;
6925def ext_gnu_subscript_void_type : Extension<
6926  "subscript of a pointer to void is a GNU extension">,
6927  InGroup<GNUPointerArith>;
6928def err_typecheck_member_reference_struct_union : Error<
6929  "member reference base type %0 is not a structure or union">;
6930def err_typecheck_member_reference_ivar : Error<
6931  "%0 does not have a member named %1">;
6932def err_arc_weak_ivar_access : Error<
6933  "dereferencing a __weak pointer is not allowed due to possible "
6934  "null value caused by race condition, assign it to strong variable first">;
6935def err_typecheck_member_reference_arrow : Error<
6936  "member reference type %0 is not a pointer">;
6937def err_typecheck_member_reference_suggestion : Error<
6938  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6939def note_typecheck_member_reference_suggestion : Note<
6940  "did you mean to use '.' instead?">;
6941def note_member_reference_arrow_from_operator_arrow : Note<
6942  "'->' applied to return value of the operator->() declared here">;
6943def err_typecheck_member_reference_type : Error<
6944  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6945def err_typecheck_member_reference_unknown : Error<
6946  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6947def err_member_reference_needs_call : Error<
6948  "base of member reference is a function; perhaps you meant to call "
6949  "it%select{| with no arguments}0?">;
6950def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6951  InGroup<CharSubscript>, DefaultIgnore;
6952
6953def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6954def err_no_member : Error<"no member named %0 in %1">;
6955def err_no_member_overloaded_arrow : Error<
6956  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6957
6958def err_member_not_yet_instantiated : Error<
6959  "no member %0 in %1; it has not yet been instantiated">;
6960def note_non_instantiated_member_here : Note<
6961  "not-yet-instantiated member is declared here">;
6962
6963def err_enumerator_does_not_exist : Error<
6964  "enumerator %0 does not exist in instantiation of %1">;
6965def note_enum_specialized_here : Note<
6966  "enum %0 was explicitly specialized here">;
6967
6968def err_specialization_not_primary_template : Error<
6969  "cannot reference member of primary template because deduced class "
6970  "template specialization %0 is %select{instantiated from a partial|"
6971  "an explicit}1 specialization">;
6972
6973def err_member_redeclared : Error<"class member cannot be redeclared">;
6974def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6975  InGroup<RedeclaredClassMember>;
6976def err_member_redeclared_in_instantiation : Error<
6977  "multiple overloads of %0 instantiate to the same signature %1">;
6978def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6979def err_member_def_undefined_record : Error<
6980  "out-of-line definition of %0 from class %1 without definition">;
6981def err_member_decl_does_not_match : Error<
6982  "out-of-line %select{declaration|definition}2 of %0 "
6983  "does not match any declaration in %1">;
6984def err_friend_decl_with_def_arg_must_be_def : Error<
6985  "friend declaration specifying a default argument must be a definition">;
6986def err_friend_decl_with_def_arg_redeclared : Error<
6987  "friend declaration specifying a default argument must be the only declaration">;
6988def err_friend_decl_does_not_match : Error<
6989  "friend declaration of %0 does not match any declaration in %1">;
6990def err_member_decl_does_not_match_suggest : Error<
6991  "out-of-line %select{declaration|definition}2 of %0 "
6992  "does not match any declaration in %1; did you mean %3?">;
6993def err_member_def_does_not_match_ret_type : Error<
6994  "return type of out-of-line definition of %q0 differs from "
6995  "that in the declaration">;
6996def err_nonstatic_member_out_of_line : Error<
6997  "non-static data member defined out-of-line">;
6998def err_qualified_typedef_declarator : Error<
6999  "typedef declarator cannot be qualified">;
7000def err_qualified_param_declarator : Error<
7001  "parameter declarator cannot be qualified">;
7002def ext_out_of_line_declaration : ExtWarn<
7003  "out-of-line declaration of a member must be a definition">,
7004  InGroup<OutOfLineDeclaration>, DefaultError;
7005def err_member_extra_qualification : Error<
7006  "extra qualification on member %0">;
7007def warn_member_extra_qualification : Warning<
7008  err_member_extra_qualification.Summary>, InGroup<MicrosoftExtraQualification>;
7009def warn_namespace_member_extra_qualification : Warning<
7010  "extra qualification on member %0">,
7011  InGroup<DiagGroup<"extra-qualification">>;
7012def err_member_qualification : Error<
7013  "non-friend class member %0 cannot have a qualified name">;
7014def note_member_def_close_match : Note<"member declaration nearly matches">;
7015def note_member_def_close_const_match : Note<
7016  "member declaration does not match because "
7017  "it %select{is|is not}0 const qualified">;
7018def note_member_def_close_param_match : Note<
7019  "type of %ordinal0 parameter of member declaration does not match definition"
7020  "%diff{ ($ vs $)|}1,2">;
7021def note_local_decl_close_match : Note<"local declaration nearly matches">;
7022def note_local_decl_close_param_match : Note<
7023  "type of %ordinal0 parameter of local declaration does not match definition"
7024  "%diff{ ($ vs $)|}1,2">;
7025def err_typecheck_ivar_variable_size : Error<
7026  "instance variables must have a constant size">;
7027def err_ivar_reference_type : Error<
7028  "instance variables cannot be of reference type">;
7029def err_typecheck_illegal_increment_decrement : Error<
7030  "cannot %select{decrement|increment}1 value of type %0">;
7031def err_typecheck_expect_int : Error<
7032  "used type %0 where integer is required">;
7033def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
7034  "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
7035def err_typecheck_pointer_arith_function_type : Error<
7036  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
7037  "function type%select{|s}2 %1%select{| and %3}2">;
7038def err_typecheck_pointer_arith_void_type : Error<
7039  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
7040def err_typecheck_decl_incomplete_type : Error<
7041  "variable has incomplete type %0">;
7042def ext_typecheck_decl_incomplete_type : ExtWarn<
7043  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
7044  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
7045def err_tentative_def_incomplete_type : Error<
7046  "tentative definition has type %0 that is never completed">;
7047def warn_tentative_incomplete_array : Warning<
7048  "tentative array definition assumed to have one element">;
7049def err_typecheck_incomplete_array_needs_initializer : Error<
7050  "definition of variable with array type needs an explicit size "
7051  "or an initializer">;
7052def err_array_init_not_init_list : Error<
7053  "array initializer must be an initializer "
7054  "list%select{| or string literal| or wide string literal}0">;
7055def err_array_init_narrow_string_into_wchar : Error<
7056  "initializing wide char array with non-wide string literal">;
7057def err_array_init_wide_string_into_char : Error<
7058  "initializing char array with wide string literal">;
7059def err_array_init_incompat_wide_string_into_wchar : Error<
7060  "initializing wide char array with incompatible wide string literal">;
7061def err_array_init_plain_string_into_char8_t : Error<
7062  "initializing 'char8_t' array with plain string literal">;
7063def note_array_init_plain_string_into_char8_t : Note<
7064  "add 'u8' prefix to form a 'char8_t' string literal">;
7065def err_array_init_utf8_string_into_char : Error<
7066  "initialization of %select{|signed }0char array with "
7067  "UTF-8 string literal is not permitted by %select{'-fchar8_t'|C++20}1">;
7068def warn_cxx20_compat_utf8_string : Warning<
7069  "type of UTF-8 string literal will change from array of const char to "
7070  "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
7071def note_cxx20_compat_utf8_string_remove_u8 : Note<
7072  "remove 'u8' prefix to avoid a change of behavior; "
7073  "Clang encodes unprefixed narrow string literals as UTF-8">;
7074def err_array_init_different_type : Error<
7075  "cannot initialize array %diff{of type $ with array of type $|"
7076  "with different type of array}0,1">;
7077def err_array_init_non_constant_array : Error<
7078  "cannot initialize array %diff{of type $ with non-constant array of type $|"
7079  "with different type of array}0,1">;
7080def ext_array_init_copy : Extension<
7081  "initialization of an array "
7082  "%diff{of type $ from a compound literal of type $|"
7083  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
7084// This is intentionally not disabled by -Wno-gnu.
7085def ext_array_init_parens : ExtWarn<
7086  "parenthesized initialization of a member array is a GNU extension">,
7087  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
7088def warn_deprecated_string_literal_conversion : Warning<
7089  "conversion from string literal to %0 is deprecated">,
7090  InGroup<CXX11CompatDeprecatedWritableStr>;
7091def ext_deprecated_string_literal_conversion : ExtWarn<
7092  "ISO C++11 does not allow conversion from string literal to %0">,
7093  InGroup<WritableStrings>, SFINAEFailure;
7094def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
7095def err_typecheck_sclass_fscope : Error<
7096  "illegal storage class on file-scoped variable">;
7097def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
7098  InGroup<MissingDeclarations>;
7099def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
7100  "of a type">, InGroup<MissingDeclarations>;
7101def err_standalone_class_nested_name_specifier : Error<
7102  "forward declaration of %select{class|struct|interface|union|enum|enum class|enum struct}0 cannot "
7103  "have a nested name specifier">;
7104def err_typecheck_sclass_func : Error<"illegal storage class on function">;
7105def err_static_block_func : Error<
7106  "function declared in block scope cannot have 'static' storage class">;
7107def err_typecheck_address_of : Error<"address of %select{bit-field"
7108  "|vector element|property expression|register variable|matrix element}0 requested">;
7109def ext_typecheck_addrof_void : Extension<
7110  "ISO C forbids taking the address of an expression of type 'void'">;
7111def err_unqualified_pointer_member_function : Error<
7112  "must explicitly qualify name of member function when taking its address">;
7113def err_invalid_form_pointer_member_function : Error<
7114  "cannot create a non-constant pointer to member function">;
7115def err_address_of_function_with_pass_object_size_params: Error<
7116  "cannot take address of function %0 because parameter %1 has "
7117  "pass_object_size attribute">;
7118def err_parens_pointer_member_function : Error<
7119  "cannot parenthesize the name of a method when forming a member pointer">;
7120def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
7121  "extra '&' taking address of overloaded function">;
7122def err_typecheck_invalid_lvalue_addrof : Error<
7123  "cannot take the address of an rvalue of type %0">;
7124def ext_typecheck_addrof_temporary : ExtWarn<
7125  "taking the address of a temporary object of type %0">,
7126  InGroup<AddressOfTemporary>, DefaultError;
7127def err_typecheck_addrof_temporary : Error<
7128  "taking the address of a temporary object of type %0">;
7129def err_typecheck_addrof_dtor : Error<
7130  "taking the address of a destructor">;
7131def err_typecheck_unary_expr : Error<
7132  "invalid argument type %0 to unary expression">;
7133def err_typecheck_indirection_requires_pointer : Error<
7134  "indirection requires pointer operand (%0 invalid)">;
7135def ext_typecheck_indirection_through_void_pointer : ExtWarn<
7136  "ISO C does not allow indirection on operand of type %0">,
7137  InGroup<VoidPointerDeref>;
7138def err_typecheck_indirection_through_void_pointer_cpp
7139    : Error<"indirection not permitted on operand of type %0">;
7140def warn_indirection_through_null : Warning<
7141  "indirection of non-volatile null pointer will be deleted, not trap">,
7142  InGroup<NullDereference>;
7143def warn_binding_null_to_reference : Warning<
7144  "binding dereferenced null pointer to reference has undefined behavior">,
7145  InGroup<NullDereference>;
7146def note_indirection_through_null : Note<
7147  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
7148def warn_pointer_indirection_from_incompatible_type : Warning<
7149  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
7150  "behavior">,
7151  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7152def warn_taking_address_of_packed_member : Warning<
7153  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
7154  InGroup<DiagGroup<"address-of-packed-member">>;
7155def warn_param_mismatched_alignment : Warning<
7156  "passing %0-byte aligned argument to %1-byte aligned parameter %2%select{| of %4}3 may result in an unaligned pointer access">,
7157  InGroup<DiagGroup<"align-mismatch">>;
7158
7159def err_objc_object_assignment : Error<
7160  "cannot assign to class object (%0 invalid)">;
7161def err_typecheck_invalid_operands : Error<
7162  "invalid operands to binary expression (%0 and %1)">, Deferrable;
7163def note_typecheck_invalid_operands_converted : Note<
7164  "%select{first|second}0 operand was implicitly converted to type %1">;
7165def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
7166  "logical expression with vector %select{type %1 and non-vector type %2|types"
7167  " %1 and %2}0 is only supported in C++">;
7168def err_typecheck_sub_ptr_compatible : Error<
7169  "%diff{$ and $ are not pointers to compatible types|"
7170  "pointers to incompatible types}0,1">;
7171def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
7172  "ordered comparison between pointer and integer (%0 and %1)">;
7173def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
7174  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
7175def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
7176  "ordered comparison between pointer and zero (%0 and %1)">;
7177def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
7178  "three-way comparison between pointer and zero">;
7179def ext_typecheck_compare_complete_incomplete_pointers : Extension<
7180  "pointer comparisons before C11 "
7181  "need to be between two complete or two incomplete types; "
7182  "%0 is %select{|in}2complete and "
7183  "%1 is %select{|in}3complete">,
7184  InGroup<C11>;
7185def warn_typecheck_ordered_comparison_of_function_pointers : Warning<
7186  "ordered comparison of function pointers (%0 and %1)">,
7187  InGroup<OrderedCompareFunctionPointers>;
7188def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
7189  "ordered comparison of function pointers (%0 and %1)">,
7190  InGroup<OrderedCompareFunctionPointers>;
7191def err_typecheck_ordered_comparison_of_function_pointers : Error<
7192  "ordered comparison of function pointers (%0 and %1)">;
7193def ext_typecheck_comparison_of_fptr_to_void : Extension<
7194  "equality comparison between function pointer and void pointer (%0 and %1)">;
7195def err_typecheck_comparison_of_fptr_to_void : Error<
7196  "equality comparison between function pointer and void pointer (%0 and %1)">;
7197def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
7198  "comparison between pointer and integer (%0 and %1)">,
7199  InGroup<DiagGroup<"pointer-integer-compare">>;
7200def err_typecheck_comparison_of_pointer_integer : Error<
7201  "comparison between pointer and integer (%0 and %1)">;
7202def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
7203  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
7204  InGroup<CompareDistinctPointerType>;
7205def ext_typecheck_cond_incompatible_operands : ExtWarn<
7206  "incompatible operand types (%0 and %1)">;
7207def err_cond_voidptr_arc : Error <
7208  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
7209  "in ARC mode">;
7210def err_typecheck_comparison_of_distinct_pointers : Error<
7211  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
7212def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
7213  "%select{comparison between %diff{ ($ and $)|}0,1"
7214  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
7215  "|conditional operator with the second and third operands of type "
7216  "%diff{ ($ and $)|}0,1}2"
7217  " which are pointers to non-overlapping address spaces">;
7218
7219def select_arith_conv_kind : TextSubstitution<
7220  "%select{arithmetic between|bitwise operation between|comparison of|"
7221  "conditional expression between|compound assignment of}0">;
7222def warn_arith_conv_enum_float : Warning<
7223  "%sub{select_arith_conv_kind}0 "
7224  "%select{floating-point|enumeration}1 type %2 "
7225  "%plural{2:with|4:from|:and}0 "
7226  "%select{enumeration|floating-point}1 type %3">,
7227  InGroup<EnumFloatConversion>, DefaultIgnore;
7228def warn_arith_conv_enum_float_cxx20 : Warning<
7229  "%sub{select_arith_conv_kind}0 "
7230  "%select{floating-point|enumeration}1 type %2 "
7231  "%plural{2:with|4:from|:and}0 "
7232  "%select{enumeration|floating-point}1 type %3 is deprecated">,
7233  InGroup<DeprecatedEnumFloatConversion>;
7234def err_arith_conv_enum_float_cxx26 : Error<
7235  "invalid %sub{select_arith_conv_kind}0 "
7236  "%select{floating-point|enumeration}1 type %2 "
7237  "%plural{2:with|4:from|:and}0 "
7238  "%select{enumeration|floating-point}1 type %3">;
7239def warn_arith_conv_mixed_enum_types : Warning<
7240  "%sub{select_arith_conv_kind}0 "
7241  "different enumeration types%diff{ ($ and $)|}1,2">,
7242  InGroup<EnumEnumConversion>, DefaultIgnore;
7243def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
7244  "%sub{select_arith_conv_kind}0 "
7245  "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
7246  InGroup<DeprecatedEnumEnumConversion>;
7247def err_conv_mixed_enum_types_cxx26 : Error<
7248  "invalid %sub{select_arith_conv_kind}0 "
7249  "different enumeration types%diff{ ($ and $)|}1,2">;
7250
7251def warn_arith_conv_mixed_anon_enum_types : Warning<
7252  warn_arith_conv_mixed_enum_types.Summary>,
7253  InGroup<AnonEnumEnumConversion>, DefaultIgnore;
7254def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
7255  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7256  InGroup<DeprecatedAnonEnumEnumConversion>;
7257def warn_conditional_mixed_enum_types : Warning<
7258  warn_arith_conv_mixed_enum_types.Summary>,
7259  InGroup<EnumCompareConditional>, DefaultIgnore;
7260def warn_conditional_mixed_enum_types_cxx20 : Warning<
7261  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7262  InGroup<DeprecatedEnumCompareConditional>;
7263def warn_comparison_mixed_enum_types : Warning<
7264  warn_arith_conv_mixed_enum_types.Summary>,
7265  InGroup<EnumCompare>;
7266def warn_comparison_mixed_enum_types_cxx20 : Warning<
7267  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7268  InGroup<DeprecatedEnumCompare>;
7269def warn_comparison_of_mixed_enum_types_switch : Warning<
7270  "comparison of different enumeration types in switch statement"
7271  "%diff{ ($ and $)|}0,1">,
7272  InGroup<EnumCompareSwitch>;
7273
7274def err_typecheck_assign_const : Error<
7275  "%select{"
7276  "cannot assign to return value because function %1 returns a const value|"
7277  "cannot assign to variable %1 with const-qualified type %2|"
7278  "cannot assign to %select{non-|}1static data member %2 "
7279  "with const-qualified type %3|"
7280  "cannot assign to non-static data member within const member function %1|"
7281  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
7282  "with %select{|nested }3const-qualified data member %4|"
7283  "read-only variable is not assignable}0">;
7284
7285def note_typecheck_assign_const : Note<
7286  "%select{"
7287  "function %1 which returns const-qualified type %2 declared here|"
7288  "variable %1 declared const here|"
7289  "%select{non-|}1static data member %2 declared const here|"
7290  "member function %q1 is declared const here|"
7291  "%select{|nested }1data member %2 declared const here}0">;
7292
7293def warn_unsigned_always_true_comparison : Warning<
7294  "result of comparison of %select{%3|unsigned expression}0 %2 "
7295  "%select{unsigned expression|%3}0 is always %4">,
7296  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
7297def warn_unsigned_char_always_true_comparison : Warning<
7298  "result of comparison of %select{%3|char expression}0 %2 "
7299  "%select{char expression|%3}0 is always %4, since char is interpreted as "
7300  "unsigned">, InGroup<TautologicalUnsignedCharZeroCompare>, DefaultIgnore;
7301def warn_unsigned_enum_always_true_comparison : Warning<
7302  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
7303  "%select{unsigned enum expression|%3}0 is always %4">,
7304  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
7305def warn_tautological_constant_compare : Warning<
7306  "result of comparison %select{%3|%1}0 %2 "
7307  "%select{%1|%3}0 is always %4">,
7308  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
7309def warn_tautological_compare_objc_bool : Warning<
7310  "result of comparison of constant %0 with expression of type 'BOOL'"
7311  " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
7312  InGroup<TautologicalObjCBoolCompare>;
7313def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
7314def warn_tautological_compare_value_range : Warning<
7315  "result of comparison of "
7316  "%select{%4|%sub{subst_int_range}1,2}0 %3 "
7317  "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
7318  InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
7319
7320def warn_mixed_sign_comparison : Warning<
7321  "comparison of integers of different signs: %0 and %1">,
7322  InGroup<SignCompare>, DefaultIgnore;
7323def warn_out_of_range_compare : Warning<
7324  "result of comparison of %select{constant %0|true|false}1 with "
7325  "%select{expression of type %2|boolean expression}3 is always %4">,
7326  InGroup<TautologicalOutOfRangeCompare>;
7327def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Summary>,
7328  InGroup<TautologicalConstantCompare>;
7329def warn_integer_constants_in_conditional_always_true : Warning<
7330  "converting the result of '?:' with integer constants to a boolean always "
7331  "evaluates to 'true'">,
7332  InGroup<TautologicalConstantCompare>;
7333def warn_left_shift_always : Warning<
7334  "converting the result of '<<' to a boolean always evaluates "
7335  "to %select{false|true}0">,
7336  InGroup<TautologicalConstantCompare>;
7337def warn_null_in_arithmetic_operation : Warning<
7338  "use of NULL in arithmetic operation">,
7339  InGroup<NullArithmetic>;
7340def warn_null_in_comparison_operation : Warning<
7341  "comparison between NULL and non-pointer "
7342  "%select{(%1 and NULL)|(NULL and %1)}0">,
7343  InGroup<NullArithmetic>;
7344def err_shift_rhs_only_vector : Error<
7345  "requested shift is a vector of type %0 but the first operand is not a "
7346  "vector (%1)">;
7347
7348def warn_logical_not_on_lhs_of_check : Warning<
7349  "logical not is only applied to the left hand side of this "
7350  "%select{comparison|bitwise operator}0">,
7351  InGroup<LogicalNotParentheses>;
7352def note_logical_not_fix : Note<
7353  "add parentheses after the '!' to evaluate the "
7354  "%select{comparison|bitwise operator}0 first">;
7355def note_logical_not_silence_with_parens : Note<
7356  "add parentheses around left hand side expression to silence this warning">;
7357
7358def err_invalid_this_use : Error<
7359  "invalid use of 'this' %select{outside of a non-static member function"
7360  "|in a function with an explicit object parameter}0">;
7361def err_this_static_member_func : Error<
7362  "'this' cannot be%select{| implicitly}0 used in a static member function "
7363  "declaration">;
7364def err_invalid_member_use_in_method : Error<
7365  "invalid use of member %0 in %select{static|explicit object}1 member function">;
7366
7367def err_invalid_qualified_function_type : Error<
7368  "%select{non-member function|static member function|explicit object member function|deduction guide}0 "
7369  "%select{of type %2 |}1cannot have '%3' qualifier">;
7370def err_compound_qualified_function_type : Error<
7371  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
7372  "cannot have '%3' qualifier">;
7373def err_qualified_function_typeid : Error<
7374  "type operand %0 of 'typeid' cannot have '%1' qualifier">;
7375
7376def err_cxx20_deducing_this  : Error<
7377  "explicit object parameters are incompatible with C++ standards before C++2b">;
7378def err_explicit_object_default_arg: Error<
7379  "the explicit object parameter cannot have a default argument">;
7380def err_explicit_object_parameter_pack: Error<
7381  "the explicit object parameter cannot be a function parameter pack">;
7382def err_explicit_object_parameter_must_be_first: Error<
7383  "an explicit object parameter can only appear as the first parameter "
7384  "of the %select{function|lambda}0">;
7385def err_explicit_object_parameter_nonmember: Error<
7386  "an explicit object parameter cannot appear in a "
7387  "%select{static|virtual|non-member}0 %select{function|lambda}1">;
7388def err_explicit_object_parameter_constructor: Error<
7389  "an explicit object parameter cannot appear in a %select{constructor|destructor}0">;
7390def err_explicit_object_parameter_mutable: Error<
7391  "a lambda with an explicit object parameter cannot be mutable">;
7392def err_invalid_explicit_object_type_in_lambda: Error<
7393  "invalid explicit object parameter type %0 in lambda with capture; "
7394  "the type must be the same as, or derived from, the lambda">;
7395
7396def err_ref_qualifier_overload : Error<
7397  "cannot overload a member function %select{without a ref-qualifier|with "
7398  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
7399  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
7400
7401def err_invalid_non_static_member_use : Error<
7402  "invalid use of non-static data member %0">;
7403def err_nested_non_static_member_use : Error<
7404  "%select{call to non-static member function|use of non-static data member}0 "
7405  "%2 of %1 from nested type %3">;
7406def warn_cxx98_compat_non_static_member_use : Warning<
7407  "use of non-static data member %0 in an unevaluated context is "
7408  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
7409def err_invalid_incomplete_type_use : Error<
7410  "invalid use of incomplete type %0">;
7411def err_builtin_func_cast_more_than_one_arg : Error<
7412  "function-style cast to a builtin type can only take one argument">;
7413def err_value_init_for_array_type : Error<
7414  "array types cannot be value-initialized">;
7415def err_init_for_function_type : Error<
7416  "cannot create object of function type %0">;
7417def warn_format_nonliteral_noargs : Warning<
7418  "format string is not a string literal (potentially insecure)">,
7419  InGroup<FormatSecurity>;
7420def warn_format_nonliteral : Warning<
7421  "format string is not a string literal">,
7422  InGroup<FormatNonLiteral>, DefaultIgnore;
7423
7424def err_unexpected_interface : Error<
7425  "unexpected interface name %0: expected expression">;
7426def err_ref_non_value : Error<"%0 does not refer to a value">;
7427def err_ref_vm_type : Error<
7428  "cannot refer to declaration with a variably modified type inside block">;
7429def err_ref_flexarray_type : Error<
7430  "cannot refer to declaration of structure variable with flexible array member "
7431  "inside block">;
7432def err_ref_array_type : Error<
7433  "cannot refer to declaration with an array type inside block">;
7434def err_property_not_found : Error<
7435  "property %0 not found on object of type %1">;
7436def err_invalid_property_name : Error<
7437  "%0 is not a valid property name (accessing an object of type %1)">;
7438def err_getter_not_found : Error<
7439  "no getter method for read from property">;
7440def err_objc_subscript_method_not_found : Error<
7441  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
7442  "found on object of type %0">;
7443def err_objc_subscript_index_type : Error<
7444  "method index parameter type %0 is not integral type">;
7445def err_objc_subscript_key_type : Error<
7446  "method key parameter type %0 is not object type">;
7447def err_objc_subscript_dic_object_type : Error<
7448  "method object parameter type %0 is not object type">;
7449def err_objc_subscript_object_type : Error<
7450  "cannot assign to this %select{dictionary|array}1 because assigning method's "
7451  "2nd parameter of type %0 is not an Objective-C pointer type">;
7452def err_objc_subscript_base_type : Error<
7453  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
7454def err_objc_multiple_subscript_type_conversion : Error<
7455  "indexing expression is invalid because subscript type %0 has "
7456  "multiple type conversion functions">;
7457def err_objc_subscript_type_conversion : Error<
7458  "indexing expression is invalid because subscript type %0 is not an integral"
7459  " or Objective-C pointer type">;
7460def err_objc_subscript_pointer : Error<
7461  "indexing expression is invalid because subscript type %0 is not an"
7462  " Objective-C pointer">;
7463def err_objc_indexing_method_result_type : Error<
7464  "method for accessing %select{dictionary|array}1 element must have Objective-C"
7465  " object return type instead of %0">;
7466def err_objc_index_incomplete_class_type : Error<
7467  "Objective-C index expression has incomplete class type %0">;
7468def err_illegal_container_subscripting_op : Error<
7469  "illegal operation on Objective-C container subscripting">;
7470def err_property_not_found_forward_class : Error<
7471  "property %0 cannot be found in forward class object %1">;
7472def err_property_not_as_forward_class : Error<
7473  "property %0 refers to an incomplete Objective-C class %1 "
7474  "(with no @interface available)">;
7475def note_forward_class : Note<
7476  "forward declaration of class here">;
7477def err_duplicate_property : Error<
7478  "property has a previous declaration">;
7479def ext_gnu_void_ptr : Extension<
7480  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
7481  InGroup<GNUPointerArith>;
7482def ext_gnu_ptr_func_arith : Extension<
7483  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
7484  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
7485  InGroup<GNUPointerArith>;
7486def err_readonly_message_assignment : Error<
7487  "assigning to 'readonly' return result of an Objective-C message not allowed">;
7488def ext_integer_increment_complex : Extension<
7489  "ISO C does not support '++'/'--' on complex integer type %0">;
7490def ext_integer_complement_complex : Extension<
7491  "ISO C does not support '~' for complex conjugation of %0">;
7492def err_nosetter_property_assignment : Error<
7493  "%select{assignment to readonly property|"
7494  "no setter method %1 for assignment to property}0">;
7495def err_nosetter_property_incdec : Error<
7496  "%select{%select{increment|decrement}1 of readonly property|"
7497  "no setter method %2 for %select{increment|decrement}1 of property}0">;
7498def err_nogetter_property_compound_assignment : Error<
7499  "a getter method is needed to perform a compound assignment on a property">;
7500def err_nogetter_property_incdec : Error<
7501  "no getter method %1 for %select{increment|decrement}0 of property">;
7502def err_no_subobject_property_setting : Error<
7503  "expression is not assignable">;
7504def err_qualified_objc_access : Error<
7505  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
7506
7507def ext_freestanding_complex : Extension<
7508  "complex numbers are an extension in a freestanding C99 implementation">;
7509
7510// FIXME: Remove when we support imaginary.
7511def err_imaginary_not_supported : Error<"imaginary types are not supported">;
7512
7513// Obj-c expressions
7514def warn_root_inst_method_not_found : Warning<
7515  "instance method %0 is being used on 'Class' which is not in the root class">,
7516  InGroup<MethodAccess>;
7517def warn_class_method_not_found : Warning<
7518  "class method %objcclass0 not found (return type defaults to 'id')">,
7519  InGroup<MethodAccess>;
7520def warn_instance_method_on_class_found : Warning<
7521  "instance method %0 found instead of class method %1">,
7522  InGroup<MethodAccess>;
7523def warn_inst_method_not_found : Warning<
7524  "instance method %objcinstance0 not found (return type defaults to 'id')">,
7525  InGroup<MethodAccess>;
7526def warn_instance_method_not_found_with_typo : Warning<
7527  "instance method %objcinstance0 not found (return type defaults to 'id')"
7528  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
7529def warn_class_method_not_found_with_typo : Warning<
7530  "class method %objcclass0 not found (return type defaults to 'id')"
7531  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
7532def err_method_not_found_with_typo : Error<
7533  "%select{instance|class}1 method %0 not found "
7534  "; did you mean %2?">;
7535def err_no_super_class_message : Error<
7536  "no @interface declaration found in class messaging of %0">;
7537def err_root_class_cannot_use_super : Error<
7538  "%0 cannot use 'super' because it is a root class">;
7539def err_invalid_receiver_to_message_super : Error<
7540  "'super' is only valid in a method body">;
7541def err_invalid_receiver_class_message : Error<
7542  "receiver type %0 is not an Objective-C class">;
7543def err_missing_open_square_message_send : Error<
7544  "missing '[' at start of message send expression">;
7545def warn_bad_receiver_type : Warning<
7546  "receiver type %0 is not 'id' or interface pointer, consider "
7547  "casting it to 'id'">,InGroup<ObjCReceiver>;
7548def err_bad_receiver_type : Error<"bad receiver type %0">;
7549def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
7550def err_unknown_receiver_suggest : Error<
7551  "unknown receiver %0; did you mean %1?">;
7552def err_objc_throw_expects_object : Error<
7553  "@throw requires an Objective-C object type (%0 invalid)">;
7554def err_objc_synchronized_expects_object : Error<
7555  "@synchronized requires an Objective-C object type (%0 invalid)">;
7556def err_rethrow_used_outside_catch : Error<
7557  "@throw (rethrow) used outside of a @catch block">;
7558def err_attribute_multiple_objc_gc : Error<
7559  "multiple garbage collection attributes specified for type">;
7560def err_catch_param_not_objc_type : Error<
7561  "@catch parameter is not a pointer to an interface type">;
7562def err_illegal_qualifiers_on_catch_parm : Error<
7563  "illegal qualifiers on @catch parameter">;
7564def err_storage_spec_on_catch_parm : Error<
7565  "@catch parameter cannot have storage specifier '%0'">;
7566def warn_register_objc_catch_parm : Warning<
7567  "'register' storage specifier on @catch parameter will be ignored">;
7568def err_qualified_objc_catch_parm : Error<
7569  "@catch parameter declarator cannot be qualified">;
7570def warn_objc_pointer_cxx_catch_fragile : Warning<
7571  "cannot catch an exception thrown with @throw in C++ in the non-unified "
7572  "exception model">, InGroup<ObjCNonUnifiedException>;
7573def err_objc_object_catch : Error<
7574  "cannot catch an Objective-C object by value">;
7575def err_incomplete_type_objc_at_encode : Error<
7576  "'@encode' of incomplete type %0">;
7577def warn_objc_circular_container : Warning<
7578  "adding %0 to %1 might cause circular dependency in container">,
7579  InGroup<DiagGroup<"objc-circular-container">>;
7580def note_objc_circular_container_declared_here : Note<"%0 declared here">;
7581def warn_objc_unsafe_perform_selector : Warning<
7582  "%0 is incompatible with selectors that return a "
7583  "%select{struct|union|vector}1 type">,
7584  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
7585def note_objc_unsafe_perform_selector_method_declared_here :  Note<
7586  "method %0 that returns %1 declared here">;
7587def err_attribute_arm_builtin_alias : Error<
7588  "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
7589def err_attribute_arm_mve_polymorphism : Error<
7590  "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
7591def err_attribute_webassembly_funcref : Error<
7592  "'__funcref' attribute can only be applied to a function pointer type">;
7593
7594def warn_setter_getter_impl_required : Warning<
7595  "property %0 requires method %1 to be defined - "
7596  "use @synthesize, @dynamic or provide a method implementation "
7597  "in this class implementation">,
7598  InGroup<ObjCPropertyImpl>;
7599def warn_setter_getter_impl_required_in_category : Warning<
7600  "property %0 requires method %1 to be defined - "
7601  "use @dynamic or provide a method implementation in this category">,
7602  InGroup<ObjCPropertyImpl>;
7603def note_parameter_named_here : Note<
7604  "passing argument to parameter %0 here">;
7605def note_parameter_here : Note<
7606  "passing argument to parameter here">;
7607def note_method_return_type_change : Note<
7608  "compiler has implicitly changed method %0 return type">;
7609
7610def warn_impl_required_for_class_property : Warning<
7611  "class property %0 requires method %1 to be defined - "
7612  "use @dynamic or provide a method implementation "
7613  "in this class implementation">,
7614  InGroup<ObjCPropertyImpl>;
7615def warn_impl_required_in_category_for_class_property : Warning<
7616  "class property %0 requires method %1 to be defined - "
7617  "use @dynamic or provide a method implementation in this category">,
7618  InGroup<ObjCPropertyImpl>;
7619
7620// C++ casts
7621// These messages adhere to the TryCast pattern: %0 is an int specifying the
7622// cast type, %1 is the source type, %2 is the destination type.
7623def err_bad_reinterpret_cast_overload : Error<
7624  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
7625
7626def warn_reinterpret_different_from_static : Warning<
7627  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
7628  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
7629  "'static_cast'">, InGroup<ReinterpretBaseClass>;
7630def note_reinterpret_updowncast_use_static: Note<
7631  "use 'static_cast' to adjust the pointer correctly while "
7632  "%select{upcasting|downcasting}0">;
7633
7634def err_bad_static_cast_overload : Error<
7635  "address of overloaded function %0 cannot be static_cast to type %1">;
7636
7637def err_bad_cstyle_cast_overload : Error<
7638  "address of overloaded function %0 cannot be cast to type %1">;
7639
7640
7641def err_bad_cxx_cast_generic : Error<
7642  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7643  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7644def err_bad_cxx_cast_unrelated_class : Error<
7645  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7646  "functional-style cast|}0 from %1 to %2, which are not related by "
7647  "inheritance, is not allowed">;
7648def note_type_incomplete : Note<"%0 is incomplete">;
7649def err_bad_cxx_cast_rvalue : Error<
7650  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7651  "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7652def err_bad_cxx_cast_bitfield : Error<
7653  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7654  "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7655def err_bad_cxx_cast_qualifiers_away : Error<
7656  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7657  "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7658def err_bad_cxx_cast_addr_space_mismatch : Error<
7659  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7660  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7661  " spaces">;
7662def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7663  "ISO C++ does not allow "
7664  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7665  "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
7666  "even though the source and destination types are unrelated">,
7667  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
7668def err_bad_const_cast_dest : Error<
7669  "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
7670  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
7671def ext_cast_fn_obj : Extension<
7672  "cast between pointer-to-function and pointer-to-object is an extension">;
7673def ext_ms_cast_fn_obj : ExtWarn<
7674  "static_cast between pointer-to-function and pointer-to-object is a "
7675  "Microsoft extension">, InGroup<MicrosoftCast>;
7676def warn_cxx98_compat_cast_fn_obj : Warning<
7677  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
7678  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7679def err_bad_reinterpret_cast_small_int : Error<
7680  "cast from pointer to smaller type %2 loses information">;
7681def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
7682  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7683  "to scalar %2 of different size">;
7684def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
7685  "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
7686  "to vector %2 of different size">;
7687def err_bad_cxx_cast_vector_to_vector_different_size : Error<
7688  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7689  "to vector %2 of different size">;
7690def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
7691  "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
7692  "changes address space of nested pointers">,
7693  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7694def err_bad_lvalue_to_rvalue_cast : Error<
7695  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
7696  "not compatible">;
7697def err_bad_rvalue_to_rvalue_cast : Error<
7698  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
7699  "not compatible">;
7700def err_bad_static_cast_pointer_nonpointer : Error<
7701  "cannot cast from type %1 to pointer type %2">;
7702def err_bad_static_cast_member_pointer_nonmp : Error<
7703  "cannot cast from type %1 to member pointer type %2">;
7704def err_bad_cxx_cast_member_pointer_size : Error<
7705  "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
7706  "type %1 to member pointer type %2 of different size">;
7707def err_bad_reinterpret_cast_reference : Error<
7708  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
7709def warn_undefined_reinterpret_cast : Warning<
7710  "reinterpret_cast from %0 to %1 has undefined behavior">,
7711  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7712
7713// These messages don't adhere to the pattern.
7714// FIXME: Display the path somehow better.
7715def err_ambiguous_base_to_derived_cast : Error<
7716  "ambiguous cast from base %0 to derived %1:%2">;
7717def err_static_downcast_via_virtual : Error<
7718  "cannot cast %0 to %1 via virtual base %2">;
7719def err_downcast_from_inaccessible_base : Error<
7720  "cannot cast %select{private|protected}2 base class %1 to %0">;
7721def err_upcast_to_inaccessible_base : Error<
7722  "cannot cast %0 to its %select{private|protected}2 base class %1">;
7723def err_bad_dynamic_cast_not_ref_or_ptr : Error<
7724  "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
7725def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
7726def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
7727def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
7728def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
7729
7730// Other C++ expressions
7731def err_need_header_before_typeid : Error<
7732  "you need to include <typeinfo> before using the 'typeid' operator">;
7733def err_need_header_before_placement_new : Error<
7734  "no matching %0 function for non-allocating placement new expression; "
7735  "include <new>">;
7736def err_ms___leave_not_in___try : Error<
7737  "'__leave' statement not in __try block">;
7738def err_uuidof_without_guid : Error<
7739  "cannot call operator __uuidof on a type with no GUID">;
7740def err_uuidof_with_multiple_guids : Error<
7741  "cannot call operator __uuidof on a type with multiple GUIDs">;
7742def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
7743def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
7744def err_static_illegal_in_new : Error<
7745  "the 'static' modifier for the array size is not legal in new expressions">;
7746def err_array_new_needs_size : Error<
7747  "array size must be specified in new expression with no initializer">;
7748def err_bad_new_type : Error<
7749  "cannot allocate %select{function|reference}1 type %0 with new">;
7750def err_new_incomplete_or_sizeless_type : Error<
7751  "allocation of %select{incomplete|sizeless}0 type %1">;
7752def err_new_array_nonconst : Error<
7753  "only the first dimension of an allocated array may have dynamic size">;
7754def err_new_array_size_unknown_from_init : Error<
7755  "cannot determine allocated array size from initializer">;
7756def err_new_array_init_args : Error<
7757  "array 'new' cannot have initialization arguments">;
7758def ext_new_paren_array_nonconst : ExtWarn<
7759  "when type is in parentheses, array cannot have dynamic size">;
7760def err_placement_new_non_placement_delete : Error<
7761  "'new' expression with placement arguments refers to non-placement "
7762  "'operator delete'">;
7763def err_array_size_not_integral : Error<
7764  "array size expression must have integral or %select{|unscoped }0"
7765  "enumeration type, not %1">;
7766def err_array_size_incomplete_type : Error<
7767  "array size expression has incomplete class type %0">;
7768def err_array_size_explicit_conversion : Error<
7769  "array size expression of type %0 requires explicit conversion to type %1">;
7770def note_array_size_conversion : Note<
7771  "conversion to %select{integral|enumeration}0 type %1 declared here">;
7772def err_array_size_ambiguous_conversion : Error<
7773  "ambiguous conversion of array size expression of type %0 to an integral or "
7774  "enumeration type">;
7775def ext_array_size_conversion : Extension<
7776  "implicit conversion from array size expression of type %0 to "
7777  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7778  InGroup<CXX11>;
7779def warn_cxx98_compat_array_size_conversion : Warning<
7780  "implicit conversion from array size expression of type %0 to "
7781  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7782  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7783def err_address_space_qualified_new : Error<
7784  "'new' cannot allocate objects of type %0 in address space '%1'">;
7785def err_address_space_qualified_delete : Error<
7786  "'delete' cannot delete objects of type %0 in address space '%1'">;
7787
7788def err_default_init_const : Error<
7789  "default initialization of an object of const type %0"
7790  "%select{| without a user-provided default constructor}1">;
7791def ext_default_init_const : ExtWarn<
7792  "default initialization of an object of const type %0"
7793  "%select{| without a user-provided default constructor}1 "
7794  "is a Microsoft extension">,
7795  InGroup<MicrosoftConstInit>;
7796def err_delete_operand : Error<"cannot delete expression of type %0">;
7797def ext_delete_void_ptr_operand : ExtWarn<
7798  "cannot delete expression with pointer-to-'void' type %0">,
7799  InGroup<DeleteIncomplete>;
7800def err_ambiguous_delete_operand : Error<
7801  "ambiguous conversion of delete expression of type %0 to a pointer">;
7802def warn_delete_incomplete : Warning<
7803  "deleting pointer to incomplete type %0 may cause undefined behavior">,
7804  InGroup<DeleteIncomplete>;
7805def err_delete_incomplete_class_type : Error<
7806  "deleting incomplete class type %0; no conversions to pointer type">;
7807def err_delete_explicit_conversion : Error<
7808  "converting delete expression from type %0 to type %1 invokes an explicit "
7809  "conversion function">;
7810def note_delete_conversion : Note<"conversion to pointer type %0">;
7811def warn_delete_array_type : Warning<
7812  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7813def warn_mismatched_delete_new : Warning<
7814  "'delete%select{|[]}0' applied to a pointer that was allocated with "
7815  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7816  InGroup<DiagGroup<"mismatched-new-delete">>;
7817def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7818def err_no_suitable_delete_member_function_found : Error<
7819  "no suitable member %0 in %1">;
7820def err_ambiguous_suitable_delete_member_function_found : Error<
7821  "multiple suitable %0 functions in %1">;
7822def warn_ambiguous_suitable_delete_function_found : Warning<
7823  "multiple suitable %0 functions for %1; no 'operator delete' function "
7824  "will be invoked if initialization throws an exception">,
7825  InGroup<DiagGroup<"ambiguous-delete">>;
7826def note_member_declared_here : Note<
7827  "member %0 declared here">;
7828def note_member_first_declared_here : Note<
7829  "member %0 first declared here">;
7830def warn_bitwise_instead_of_logical : Warning<
7831  "use of bitwise '%0' with boolean operands">,
7832  InGroup<BitwiseInsteadOfLogical>, DefaultIgnore;
7833def warn_bitwise_negation_bool : Warning<
7834  "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7835  "did you mean logical negation?">,
7836  InGroup<BoolOperation>, DefaultIgnore;
7837def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7838def warn_increment_bool : Warning<
7839  "incrementing expression of type bool is deprecated and "
7840  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7841def ext_increment_bool : ExtWarn<
7842  "ISO C++17 does not allow incrementing expression of type bool">,
7843  DefaultError, SFINAEFailure, InGroup<IncrementBool>;
7844def err_increment_decrement_enum : Error<
7845  "cannot %select{decrement|increment}0 expression of enum type %1">;
7846
7847def warn_deprecated_increment_decrement_volatile : Warning<
7848  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7849  "is deprecated">, InGroup<DeprecatedVolatile>;
7850def warn_deprecated_simple_assign_volatile : Warning<
7851  "use of result of assignment to object of volatile-qualified type %0 "
7852  "is deprecated">, InGroup<DeprecatedVolatile>;
7853def warn_deprecated_volatile_return : Warning<
7854  "volatile-qualified return type %0 is deprecated">,
7855  InGroup<DeprecatedVolatile>;
7856def warn_deprecated_volatile_param : Warning<
7857  "volatile-qualified parameter type %0 is deprecated">,
7858  InGroup<DeprecatedVolatile>;
7859def warn_deprecated_volatile_structured_binding : Warning<
7860  "volatile qualifier in structured binding declaration is deprecated">,
7861  InGroup<DeprecatedVolatile>;
7862
7863def warn_deprecated_altivec_src_compat : Warning<
7864  "Current handling of vector bool and vector pixel types in this context are "
7865  "deprecated. The default behaviour will soon change to that implied by the "
7866  "'-altivec-compat=xl' option">,
7867  InGroup<DiagGroup<"deprecated-altivec-src-compat">>;
7868
7869def warn_deprecated_lax_vec_conv_all : Warning<
7870  "Implicit conversion between vector types ('%0' and '%1') is deprecated. "
7871  "In the future, the behavior implied by '-fno-lax-vector-conversions' "
7872  "will be the default.">,
7873  InGroup<DiagGroup<"deprecate-lax-vec-conv-all">>;
7874
7875def err_catch_incomplete_ptr : Error<
7876  "cannot catch pointer to incomplete type %0">;
7877def err_catch_incomplete_ref : Error<
7878  "cannot catch reference to incomplete type %0">;
7879def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7880def err_catch_sizeless : Error<
7881  "cannot catch %select{|reference to }0sizeless type %1">;
7882def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7883def err_catch_variably_modified : Error<
7884  "cannot catch variably modified type %0">;
7885def err_qualified_catch_declarator : Error<
7886  "exception declarator cannot be qualified">;
7887def err_early_catch_all : Error<"catch-all handler must come last">;
7888def err_bad_memptr_rhs : Error<
7889  "right hand operand to %0 has non-pointer-to-member type %1">;
7890def err_bad_memptr_lhs : Error<
7891  "left hand operand to %0 must be a %select{|pointer to }1class "
7892  "compatible with the right hand operand, but is %2">;
7893def err_memptr_incomplete : Error<
7894  "member pointer has incomplete base type %0">;
7895def warn_exception_caught_by_earlier_handler : Warning<
7896  "exception of type %0 will be caught by earlier handler">,
7897  InGroup<Exceptions>;
7898def note_previous_exception_handler : Note<"for type %0">;
7899def err_exceptions_disabled : Error<
7900  "cannot use '%0' with exceptions disabled">;
7901def err_objc_exceptions_disabled : Error<
7902  "cannot use '%0' with Objective-C exceptions disabled">;
7903def warn_throw_in_noexcept_func : Warning<
7904  "%0 has a non-throwing exception specification but can still throw">,
7905  InGroup<Exceptions>;
7906def note_throw_in_dtor : Note<
7907  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7908  "non-throwing}1 exception specification">;
7909def note_throw_in_function : Note<"function declared non-throwing here">;
7910def err_seh_try_outside_functions : Error<
7911  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7912def err_mixing_cxx_try_seh_try : Error<
7913  "cannot use %select{C++ 'try'|Objective-C '@try'}0 "
7914  "in the same function as SEH '__try'">;
7915def err_seh_try_unsupported : Error<
7916  "SEH '__try' is not supported on this target">;
7917def note_conflicting_try_here : Note<
7918  "conflicting %0 here">;
7919def warn_jump_out_of_seh_finally : Warning<
7920  "jump out of __finally block has undefined behavior">,
7921  InGroup<DiagGroup<"jump-seh-finally">>;
7922def warn_non_virtual_dtor : Warning<
7923  "%0 has virtual functions but non-virtual destructor">,
7924  InGroup<NonVirtualDtor>, DefaultIgnore;
7925def warn_delete_non_virtual_dtor : Warning<
7926  "%select{delete|destructor}0 called on non-final %1 that has "
7927  "virtual functions but non-virtual destructor">,
7928  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7929def note_delete_non_virtual : Note<
7930  "qualify call to silence this warning">;
7931def warn_delete_abstract_non_virtual_dtor : Warning<
7932  "%select{delete|destructor}0 called on %1 that is abstract but has "
7933  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7934def warn_overloaded_virtual : Warning<
7935  "%q0 hides overloaded virtual %select{function|functions}1">,
7936  InGroup<OverloadedVirtual>, DefaultIgnore;
7937def note_hidden_overloaded_virtual_declared_here : Note<
7938  "hidden overloaded virtual function %q0 declared here"
7939  "%select{|: different classes%diff{ ($ vs $)|}2,3"
7940  "|: different number of parameters (%2 vs %3)"
7941  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7942  "|: different return type%diff{ ($ vs $)|}2,3"
7943  "|: different qualifiers (%2 vs %3)"
7944  "|: different exception specifications}1">;
7945def warn_using_directive_in_header : Warning<
7946  "using namespace directive in global context in header">,
7947  InGroup<HeaderHygiene>, DefaultIgnore;
7948def warn_overaligned_type : Warning<
7949  "type %0 requires %1 bytes of alignment and the default allocator only "
7950  "guarantees %2 bytes">,
7951  InGroup<OveralignedType>, DefaultIgnore;
7952def err_array_element_alignment : Error<
7953  "size of array element of type %0 (%1 bytes) isn't a multiple of its alignment (%2 bytes)">;
7954def err_aligned_allocation_unavailable : Error<
7955  "aligned %select{allocation|deallocation}0 function of type '%1' is "
7956  "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
7957def note_silence_aligned_allocation_unavailable : Note<
7958  "if you supply your own aligned allocation functions, use "
7959  "-faligned-allocation to silence this diagnostic">;
7960
7961def err_conditional_void_nonvoid : Error<
7962  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7963  "is of type %0">;
7964def err_conditional_ambiguous : Error<
7965  "conditional expression is ambiguous; "
7966  "%diff{$ can be converted to $ and vice versa|"
7967  "types can be convert to each other}0,1">;
7968def err_conditional_ambiguous_ovl : Error<
7969  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7970  "can be converted to several common types">;
7971def err_conditional_vector_size : Error<
7972  "vector condition type %0 and result type %1 do not have the same number "
7973  "of elements">;
7974def err_conditional_vector_element_size : Error<
7975  "vector condition type %0 and result type %1 do not have elements of the "
7976  "same size">;
7977def err_conditional_vector_has_void : Error<
7978  "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7979def err_conditional_vector_operand_type
7980    : Error<"enumeration type %0 is not allowed in a vector conditional">;
7981def err_conditional_vector_cond_result_mismatch
7982    : Error<"cannot mix vectors and extended vectors in a vector conditional">;
7983def err_conditional_vector_mismatched
7984    : Error<"vector operands to the vector conditional must be the same type "
7985            "%diff{($ and $)|}0,1}">;
7986
7987def err_throw_incomplete : Error<
7988  "cannot throw object of incomplete type %0">;
7989def err_throw_incomplete_ptr : Error<
7990  "cannot throw pointer to object of incomplete type %0">;
7991def err_throw_sizeless : Error<
7992  "cannot throw object of sizeless type %0">;
7993def warn_throw_underaligned_obj : Warning<
7994  "underaligned exception object thrown">,
7995  InGroup<UnderalignedExceptionObject>;
7996def note_throw_underaligned_obj : Note<
7997  "required alignment of type %0 (%1 bytes) is larger than the supported "
7998  "alignment of C++ exception objects on this target (%2 bytes)">;
7999def err_return_in_constructor_handler : Error<
8000  "return in the catch of a function try block of a constructor is illegal">;
8001def warn_cdtor_function_try_handler_mem_expr : Warning<
8002  "cannot refer to a non-static member from the handler of a "
8003  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
8004def err_throw_object_throwing_dtor : Error<
8005  "cannot throw object of type %0 with a potentially-throwing destructor">;
8006
8007let CategoryName = "Lambda Issue" in {
8008  def err_capture_more_than_once : Error<
8009    "%0 can appear only once in a capture list">;
8010  def err_reference_capture_with_reference_default : Error<
8011    "'&' cannot precede a capture when the capture default is '&'">;
8012  def err_copy_capture_with_copy_default : Error<
8013    "'&' must precede a capture when the capture default is '='">;
8014  def err_capture_does_not_name_variable : Error<
8015    "%0 in capture list does not name a variable">;
8016  def err_capture_non_automatic_variable : Error<
8017    "%0 cannot be captured because it does not have automatic storage "
8018    "duration">;
8019  def err_this_capture : Error<
8020    "'this' cannot be %select{implicitly |}0captured in this context">;
8021  def note_lambda_this_capture_fixit : Note<
8022    "explicitly capture 'this'">;
8023  def err_lambda_capture_anonymous_var : Error<
8024    "unnamed variable cannot be implicitly captured in a lambda expression">;
8025  def err_lambda_capture_flexarray_type : Error<
8026    "variable %0 with flexible array member cannot be captured in "
8027    "a lambda expression">;
8028  def err_lambda_impcap : Error<
8029    "variable %0 cannot be implicitly captured in a lambda with no "
8030    "capture-default specified">;
8031  def note_lambda_variable_capture_fixit : Note<
8032    "capture %0 by %select{value|reference}1">;
8033  def note_lambda_default_capture_fixit : Note<
8034    "default capture by %select{value|reference}0">;
8035  def note_lambda_decl : Note<"lambda expression begins here">;
8036  def err_lambda_unevaluated_operand : Error<
8037    "lambda expression in an unevaluated operand">;
8038  def err_lambda_in_constant_expression : Error<
8039    "a lambda expression may not appear inside of a constant expression">;
8040  def err_lambda_in_invalid_context : Error<
8041    "a lambda expression cannot appear in this context">;
8042  def err_lambda_return_init_list : Error<
8043    "cannot deduce lambda return type from initializer list">;
8044  def err_lambda_capture_default_arg : Error<
8045    "lambda expression in default argument cannot capture any entity">;
8046  def err_lambda_incomplete_result : Error<
8047    "incomplete result type %0 in lambda expression">;
8048  def err_noreturn_lambda_has_return_expr : Error<
8049    "lambda declared 'noreturn' should not return">;
8050  def warn_maybe_falloff_nonvoid_lambda : Warning<
8051    "non-void lambda does not return a value in all control paths">,
8052    InGroup<ReturnType>;
8053  def warn_falloff_nonvoid_lambda : Warning<
8054    "non-void lambda does not return a value">,
8055    InGroup<ReturnType>;
8056  def err_access_lambda_capture : Error<
8057    // The ERRORs represent other special members that aren't constructors, in
8058    // hopes that someone will bother noticing and reporting if they appear
8059    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
8060    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
8061    AccessControl;
8062  def note_lambda_to_block_conv : Note<
8063    "implicit capture of lambda object due to conversion to block pointer "
8064    "here">;
8065  def note_var_explicitly_captured_here : Note<"variable %0 is"
8066    "%select{| explicitly}1 captured here">;
8067
8068  // C++14 lambda init-captures.
8069  def warn_cxx11_compat_init_capture : Warning<
8070    "initialized lambda captures are incompatible with C++ standards "
8071    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
8072  def ext_init_capture : ExtWarn<
8073    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
8074  def err_init_capture_no_expression : Error<
8075    "initializer missing for lambda capture %0">;
8076  def err_init_capture_multiple_expressions : Error<
8077    "initializer for lambda capture %0 contains multiple expressions">;
8078  def err_init_capture_paren_braces : Error<
8079    "cannot deduce type for lambda capture %1 from "
8080    "%select{parenthesized|nested}0 initializer list">;
8081  def err_init_capture_deduction_failure : Error<
8082    "cannot deduce type for lambda capture %0 from initializer of type %2">;
8083  def err_init_capture_deduction_failure_from_init_list : Error<
8084    "cannot deduce type for lambda capture %0 from initializer list">;
8085  def warn_cxx17_compat_init_capture_pack : Warning<
8086    "initialized lambda capture packs are incompatible with C++ standards "
8087    "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8088  def ext_init_capture_pack : ExtWarn<
8089    "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
8090
8091  // C++14 generic lambdas.
8092  def warn_cxx11_compat_generic_lambda : Warning<
8093    "generic lambdas are incompatible with C++11">,
8094    InGroup<CXXPre14Compat>, DefaultIgnore;
8095
8096  // C++17 '*this' captures.
8097  def warn_cxx14_compat_star_this_lambda_capture : Warning<
8098    "by value capture of '*this' is incompatible with C++ standards before C++17">,
8099     InGroup<CXXPre17Compat>, DefaultIgnore;
8100  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
8101    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
8102
8103  // C++17 parameter shadows capture
8104  def err_parameter_shadow_capture : Error<
8105    "a lambda parameter cannot shadow an explicitly captured entity">;
8106
8107  // C++20 [=, this] captures.
8108  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
8109    "explicit capture of 'this' with a capture default of '=' is incompatible "
8110    "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8111  def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
8112    "explicit capture of 'this' with a capture default of '=' "
8113    "is a C++20 extension">, InGroup<CXX20>;
8114  def warn_deprecated_this_capture : Warning<
8115    "implicit capture of 'this' with a capture default of '=' is deprecated">,
8116    InGroup<DeprecatedThisCapture>;
8117  def note_deprecated_this_capture : Note<
8118    "add an explicit capture of 'this' to capture '*this' by reference">;
8119
8120  // C++20 default constructible / assignable lambdas.
8121  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
8122    "%select{default construction|assignment}0 of lambda is incompatible with "
8123    "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8124}
8125
8126def err_return_in_captured_stmt : Error<
8127  "cannot return from %0">;
8128def err_capture_block_variable : Error<
8129  "__block variable %0 cannot be captured in a "
8130  "%select{lambda expression|captured statement}1">;
8131
8132def err_operator_arrow_circular : Error<
8133  "circular pointer delegation detected">;
8134def err_operator_arrow_depth_exceeded : Error<
8135  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
8136  "'operator->' calls">;
8137def note_operator_arrow_here : Note<
8138  "'operator->' declared here produces an object of type %0">;
8139def note_operator_arrows_suppressed : Note<
8140  "(skipping %0 'operator->'%s0 in backtrace)">;
8141def note_operator_arrow_depth : Note<
8142  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
8143
8144def err_pseudo_dtor_base_not_scalar : Error<
8145  "object expression of non-scalar type %0 cannot be used in a "
8146  "pseudo-destructor expression">;
8147def ext_pseudo_dtor_on_void : ExtWarn<
8148  "pseudo-destructors on type void are a Microsoft extension">,
8149  InGroup<MicrosoftVoidPseudoDtor>;
8150def err_pseudo_dtor_type_mismatch : Error<
8151  "the type of object expression "
8152  "%diff{($) does not match the type being destroyed ($)|"
8153  "does not match the type being destroyed}0,1 "
8154  "in pseudo-destructor expression">;
8155def err_pseudo_dtor_call_with_args : Error<
8156  "call to pseudo-destructor cannot have any arguments">;
8157def err_dtor_expr_without_call : Error<
8158  "reference to %select{destructor|pseudo-destructor}0 must be called"
8159  "%select{|; did you mean to call it with no arguments?}1">;
8160def err_pseudo_dtor_destructor_non_type : Error<
8161  "%0 does not refer to a type name in pseudo-destructor expression; expected "
8162  "the name of type %1">;
8163def err_invalid_use_of_function_type : Error<
8164  "a function type is not allowed here">;
8165def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
8166def err_typecheck_bool_condition : Error<
8167  "value of type %0 is not contextually convertible to 'bool'">;
8168def err_typecheck_ambiguous_condition : Error<
8169  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
8170def err_typecheck_nonviable_condition : Error<
8171  "no viable conversion%select{%diff{ from $ to $|}1,2|"
8172  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
8173def err_typecheck_nonviable_condition_incomplete : Error<
8174  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
8175def err_typecheck_deleted_function : Error<
8176  "conversion function %diff{from $ to $|between types}0,1 "
8177  "invokes a deleted function">;
8178
8179def err_expected_class_or_namespace : Error<"%0 is not a class"
8180  "%select{ or namespace|, namespace, or enumeration}1">;
8181def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
8182  "because namespace %1 does not enclose namespace %2">;
8183def err_export_non_namespace_scope_name : Error<
8184  "cannot export %0 as it is not at namespace scope">;
8185def err_redeclaration_non_exported : Error <
8186  "cannot export redeclaration %0 here since the previous declaration "
8187  "%select{is not exported|has internal linkage|has module linkage}1">;
8188def err_invalid_declarator_global_scope : Error<
8189  "definition or redeclaration of %0 cannot name the global scope">;
8190def err_invalid_declarator_in_function : Error<
8191  "definition or redeclaration of %0 not allowed inside a function">;
8192def err_invalid_declarator_in_block : Error<
8193  "definition or redeclaration of %0 not allowed inside a block">;
8194def err_not_tag_in_scope : Error<
8195  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
8196
8197def err_no_typeid_with_fno_rtti : Error<
8198  "use of typeid requires -frtti">;
8199def err_no_dynamic_cast_with_fno_rtti : Error<
8200  "use of dynamic_cast requires -frtti">;
8201def warn_no_dynamic_cast_with_rtti_disabled: Warning<
8202  "dynamic_cast will not work since RTTI data is disabled by "
8203  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8204def warn_no_typeid_with_rtti_disabled: Warning<
8205  "typeid will not work since RTTI data is disabled by "
8206  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8207
8208def err_cannot_form_pointer_to_member_of_reference_type : Error<
8209  "cannot form a pointer-to-member to member %0 of reference type %1">;
8210def err_incomplete_object_call : Error<
8211  "incomplete type in call to object of type %0">;
8212
8213def warn_condition_is_assignment : Warning<"using the result of an "
8214  "assignment as a condition without parentheses">,
8215  InGroup<Parentheses>;
8216def warn_free_nonheap_object
8217  : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
8218    InGroup<FreeNonHeapObject>;
8219
8220// Completely identical except off by default.
8221def warn_condition_is_idiomatic_assignment : Warning<"using the result "
8222  "of an assignment as a condition without parentheses">,
8223  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
8224def note_condition_assign_to_comparison : Note<
8225  "use '==' to turn this assignment into an equality comparison">;
8226def note_condition_or_assign_to_comparison : Note<
8227  "use '!=' to turn this compound assignment into an inequality comparison">;
8228def note_condition_assign_silence : Note<
8229  "place parentheses around the assignment to silence this warning">;
8230
8231def warn_equality_with_extra_parens : Warning<"equality comparison with "
8232  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
8233def note_equality_comparison_to_assign : Note<
8234  "use '=' to turn this equality comparison into an assignment">;
8235def note_equality_comparison_silence : Note<
8236  "remove extraneous parentheses around the comparison to silence this warning">;
8237
8238// assignment related diagnostics (also for argument passing, returning, etc).
8239// In most of these diagnostics the %2 is a value from the
8240// Sema::AssignmentAction enumeration
8241def err_typecheck_convert_incompatible : Error<
8242  "%select{%diff{assigning to $ from incompatible type $|"
8243  "assigning to type from incompatible type}0,1"
8244  "|%diff{passing $ to parameter of incompatible type $|"
8245  "passing type to parameter of incompatible type}0,1"
8246  "|%diff{returning $ from a function with incompatible result type $|"
8247  "returning type from a function with incompatible result type}0,1"
8248  "|%diff{converting $ to incompatible type $|"
8249  "converting type to incompatible type}0,1"
8250  "|%diff{initializing $ with an expression of incompatible type $|"
8251  "initializing type with an expression of incompatible type}0,1"
8252  "|%diff{sending $ to parameter of incompatible type $|"
8253  "sending type to parameter of incompatible type}0,1"
8254  "|%diff{casting $ to incompatible type $|"
8255  "casting type to incompatible type}0,1}2"
8256  "%select{|; dereference with *|"
8257  "; take the address with &|"
8258  "; remove *|"
8259  "; remove &}3"
8260  "%select{|: different classes%diff{ ($ vs $)|}5,6"
8261  "|: different number of parameters (%5 vs %6)"
8262  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
8263  "|: different return type%diff{ ($ vs $)|}5,6"
8264  "|: different qualifiers (%5 vs %6)"
8265  "|: different exception specifications}4">;
8266def err_typecheck_missing_return_type_incompatible : Error<
8267  "%diff{return type $ must match previous return type $|"
8268  "return type must match previous return type}0,1 when %select{block "
8269  "literal|lambda expression}2 has unspecified explicit return type">;
8270
8271def note_incomplete_class_and_qualified_id : Note<
8272  "conformance of forward class %0 to protocol %1 can not be confirmed">;
8273def warn_incompatible_qualified_id : Warning<
8274  "%select{%diff{assigning to $ from incompatible type $|"
8275  "assigning to type from incompatible type}0,1"
8276  "|%diff{passing $ to parameter of incompatible type $|"
8277  "passing type to parameter of incompatible type}0,1"
8278  "|%diff{returning $ from a function with incompatible result type $|"
8279  "returning type from a function with incompatible result type}0,1"
8280  "|%diff{converting $ to incompatible type $|"
8281  "converting type to incompatible type}0,1"
8282  "|%diff{initializing $ with an expression of incompatible type $|"
8283  "initializing type with an expression of incompatible type}0,1"
8284  "|%diff{sending $ to parameter of incompatible type $|"
8285  "sending type to parameter of incompatible type}0,1"
8286  "|%diff{casting $ to incompatible type $|"
8287  "casting type to incompatible type}0,1}2">;
8288def err_incompatible_qualified_id : Error<
8289  "%select{%diff{assigning to $ from incompatible type $|"
8290  "assigning to type from incompatible type}0,1"
8291  "|%diff{passing $ to parameter of incompatible type $|"
8292  "passing type to parameter of incompatible type}0,1"
8293  "|%diff{returning $ from a function with incompatible result type $|"
8294  "returning type from a function with incompatible result type}0,1"
8295  "|%diff{converting $ to incompatible type $|"
8296  "converting type to incompatible type}0,1"
8297  "|%diff{initializing $ with an expression of incompatible type $|"
8298  "initializing type with an expression of incompatible type}0,1"
8299  "|%diff{sending $ to parameter of incompatible type $|"
8300  "sending type to parameter of incompatible type}0,1"
8301  "|%diff{casting $ to incompatible type $|"
8302  "casting type to incompatible type}0,1}2">;
8303def err_typecheck_convert_pointer_int : Error<
8304  "incompatible pointer to integer conversion "
8305  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8306  "|%diff{passing $ to parameter of type $|"
8307  "passing to parameter of different type}0,1"
8308  "|%diff{returning $ from a function with result type $|"
8309  "returning from function with different return type}0,1"
8310  "|%diff{converting $ to type $|converting between types}0,1"
8311  "|%diff{initializing $ with an expression of type $|"
8312  "initializing with expression of different type}0,1"
8313  "|%diff{sending $ to parameter of type $|"
8314  "sending to parameter of different type}0,1"
8315  "|%diff{casting $ to type $|casting between types}0,1}2"
8316  "%select{|; dereference with *|"
8317  "; take the address with &|"
8318  "; remove *|"
8319  "; remove &}3">;
8320def ext_typecheck_convert_pointer_int : ExtWarn<
8321  err_typecheck_convert_pointer_int.Summary>,
8322  InGroup<IntConversion>, DefaultError;
8323def err_typecheck_convert_int_pointer : Error<
8324  "incompatible integer to pointer conversion "
8325  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8326  "|%diff{passing $ to parameter of type $|"
8327  "passing to parameter of different type}0,1"
8328  "|%diff{returning $ from a function with result type $|"
8329  "returning from function with different return type}0,1"
8330  "|%diff{converting $ to type $|converting between types}0,1"
8331  "|%diff{initializing $ with an expression of type $|"
8332  "initializing with expression of different type}0,1"
8333  "|%diff{sending $ to parameter of type $|"
8334  "sending to parameter of different type}0,1"
8335  "|%diff{casting $ to type $|casting between types}0,1}2"
8336  "%select{|; dereference with *|"
8337  "; take the address with &|"
8338  "; remove *|"
8339  "; remove &}3">;
8340def ext_typecheck_convert_int_pointer : ExtWarn<
8341  err_typecheck_convert_int_pointer.Summary>,
8342  InGroup<IntConversion>, DefaultError;
8343def ext_typecheck_convert_pointer_void_func : Extension<
8344  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8345  "|%diff{passing $ to parameter of type $|"
8346  "passing to parameter of different type}0,1"
8347  "|%diff{returning $ from a function with result type $|"
8348  "returning from function with different return type}0,1"
8349  "|%diff{converting $ to type $|converting between types}0,1"
8350  "|%diff{initializing $ with an expression of type $|"
8351  "initializing with expression of different type}0,1"
8352  "|%diff{sending $ to parameter of type $|"
8353  "sending to parameter of different type}0,1"
8354  "|%diff{casting $ to type $|casting between types}0,1}2"
8355  " converts between void pointer and function pointer">;
8356def err_typecheck_convert_pointer_void_func : Error<
8357  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8358  "|%diff{passing $ to parameter of type $|"
8359  "passing to parameter of different type}0,1"
8360  "|%diff{returning $ from a function with result type $|"
8361  "returning from function with different return type}0,1"
8362  "|%diff{converting $ to type $|converting between types}0,1"
8363  "|%diff{initializing $ with an expression of type $|"
8364  "initializing with expression of different type}0,1"
8365  "|%diff{sending $ to parameter of type $|"
8366  "sending to parameter of different type}0,1"
8367  "|%diff{casting $ to type $|casting between types}0,1}2"
8368  " converts between void pointer and function pointer">;
8369def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
8370  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8371  "|%diff{passing $ to parameter of type $|"
8372  "passing to parameter of different type}0,1"
8373  "|%diff{returning $ from a function with result type $|"
8374  "returning from function with different return type}0,1"
8375  "|%diff{converting $ to type $|converting between types}0,1"
8376  "|%diff{initializing $ with an expression of type $|"
8377  "initializing with expression of different type}0,1"
8378  "|%diff{sending $ to parameter of type $|"
8379  "sending to parameter of different type}0,1"
8380  "|%diff{casting $ to type $|casting between types}0,1}2"
8381  " converts between pointers to integer types %select{with different sign|"
8382  "where one is of the unique plain 'char' type and the other is not}3">,
8383  InGroup<DiagGroup<"pointer-sign">>;
8384def err_typecheck_convert_incompatible_pointer_sign :
8385  Error<ext_typecheck_convert_incompatible_pointer_sign.Summary>;
8386def ext_typecheck_convert_incompatible_pointer : ExtWarn<
8387  "incompatible pointer types "
8388  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8389  "|%diff{passing $ to parameter of type $|"
8390  "passing to parameter of different type}0,1"
8391  "|%diff{returning $ from a function with result type $|"
8392  "returning from function with different return type}0,1"
8393  "|%diff{converting $ to type $|converting between types}0,1"
8394  "|%diff{initializing $ with an expression of type $|"
8395  "initializing with expression of different type}0,1"
8396  "|%diff{sending $ to parameter of type $|"
8397  "sending to parameter of different type}0,1"
8398  "|%diff{casting $ to type $|casting between types}0,1}2"
8399  "%select{|; dereference with *|"
8400  "; take the address with &|"
8401  "; remove *|"
8402  "; remove &}3">,
8403  InGroup<IncompatiblePointerTypes>;
8404def err_typecheck_convert_incompatible_pointer : Error<
8405  "incompatible pointer types "
8406  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8407  "|%diff{passing $ to parameter of type $|"
8408  "passing to parameter of different type}0,1"
8409  "|%diff{returning $ from a function with result type $|"
8410  "returning from function with different return type}0,1"
8411  "|%diff{converting $ to type $|converting between types}0,1"
8412  "|%diff{initializing $ with an expression of type $|"
8413  "initializing with expression of different type}0,1"
8414  "|%diff{sending $ to parameter of type $|"
8415  "sending to parameter of different type}0,1"
8416  "|%diff{casting $ to type $|casting between types}0,1}2"
8417  "%select{|; dereference with *|"
8418  "; take the address with &|"
8419  "; remove *|"
8420  "; remove &}3">;
8421def err_typecheck_convert_incompatible_function_pointer : Error<
8422  "incompatible function pointer types "
8423  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8424  "|%diff{passing $ to parameter of type $|"
8425  "passing to parameter of different type}0,1"
8426  "|%diff{returning $ from a function with result type $|"
8427  "returning from function with different return type}0,1"
8428  "|%diff{converting $ to type $|converting between types}0,1"
8429  "|%diff{initializing $ with an expression of type $|"
8430  "initializing with expression of different type}0,1"
8431  "|%diff{sending $ to parameter of type $|"
8432  "sending to parameter of different type}0,1"
8433  "|%diff{casting $ to type $|casting between types}0,1}2"
8434  "%select{|; dereference with *|"
8435  "; take the address with &|"
8436  "; remove *|"
8437  "; remove &}3">;
8438def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
8439  err_typecheck_convert_incompatible_function_pointer.Summary>,
8440  InGroup<IncompatibleFunctionPointerTypes>, DefaultError;
8441def warn_typecheck_convert_incompatible_function_pointer_strict : Warning<
8442  err_typecheck_convert_incompatible_function_pointer.Summary>,
8443  InGroup<DiagGroup<"incompatible-function-pointer-types-strict">>, DefaultIgnore;
8444def ext_typecheck_convert_discards_qualifiers : ExtWarn<
8445  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8446  "|%diff{passing $ to parameter of type $|"
8447  "passing to parameter of different type}0,1"
8448  "|%diff{returning $ from a function with result type $|"
8449  "returning from function with different return type}0,1"
8450  "|%diff{converting $ to type $|converting between types}0,1"
8451  "|%diff{initializing $ with an expression of type $|"
8452  "initializing with expression of different type}0,1"
8453  "|%diff{sending $ to parameter of type $|"
8454  "sending to parameter of different type}0,1"
8455  "|%diff{casting $ to type $|casting between types}0,1}2"
8456  " discards qualifiers">,
8457  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8458def err_typecheck_convert_discards_qualifiers : Error<
8459  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8460  "|%diff{passing $ to parameter of type $|"
8461  "passing to parameter of different type}0,1"
8462  "|%diff{returning $ from a function with result type $|"
8463  "returning from function with different return type}0,1"
8464  "|%diff{converting $ to type $|converting between types}0,1"
8465  "|%diff{initializing $ with an expression of type $|"
8466  "initializing with expression of different type}0,1"
8467  "|%diff{sending $ to parameter of type $|"
8468  "sending to parameter of different type}0,1"
8469  "|%diff{casting $ to type $|casting between types}0,1}2"
8470  " discards qualifiers">;
8471def ext_nested_pointer_qualifier_mismatch : ExtWarn<
8472  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8473  "|%diff{passing $ to parameter of type $|"
8474  "passing to parameter of different type}0,1"
8475  "|%diff{returning $ from a function with result type $|"
8476  "returning from function with different return type}0,1"
8477  "|%diff{converting $ to type $|converting between types}0,1"
8478  "|%diff{initializing $ with an expression of type $|"
8479  "initializing with expression of different type}0,1"
8480  "|%diff{sending $ to parameter of type $|"
8481  "sending to parameter of different type}0,1"
8482  "|%diff{casting $ to type $|casting between types}0,1}2"
8483  " discards qualifiers in nested pointer types">,
8484  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8485def err_nested_pointer_qualifier_mismatch : Error<
8486  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8487  "|%diff{passing $ to parameter of type $|"
8488  "passing to parameter of different type}0,1"
8489  "|%diff{returning $ from a function with result type $|"
8490  "returning from function with different return type}0,1"
8491  "|%diff{converting $ to type $|converting between types}0,1"
8492  "|%diff{initializing $ with an expression of type $|"
8493  "initializing with expression of different type}0,1"
8494  "|%diff{sending $ to parameter of type $|"
8495  "sending to parameter of different type}0,1"
8496  "|%diff{casting $ to type $|casting between types}0,1}2"
8497  " discards qualifiers in nested pointer types">;
8498def warn_incompatible_vectors : Warning<
8499  "incompatible vector types "
8500  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8501  "|%diff{passing $ to parameter of type $|"
8502  "passing to parameter of different type}0,1"
8503  "|%diff{returning $ from a function with result type $|"
8504  "returning from function with different return type}0,1"
8505  "|%diff{converting $ to type $|converting between types}0,1"
8506  "|%diff{initializing $ with an expression of type $|"
8507  "initializing with expression of different type}0,1"
8508  "|%diff{sending $ to parameter of type $|"
8509  "sending to parameter of different type}0,1"
8510  "|%diff{casting $ to type $|casting between types}0,1}2">,
8511  InGroup<VectorConversion>, DefaultIgnore;
8512def err_incompatible_vectors : Error<
8513  "incompatible vector types "
8514  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8515  "|%diff{passing $ to parameter of type $|"
8516  "passing to parameter of different type}0,1"
8517  "|%diff{returning $ from a function with result type $|"
8518  "returning from function with different return type}0,1"
8519  "|%diff{converting $ to type $|converting between types}0,1"
8520  "|%diff{initializing $ with an expression of type $|"
8521  "initializing with expression of different type}0,1"
8522  "|%diff{sending $ to parameter of type $|"
8523  "sending to parameter of different type}0,1"
8524  "|%diff{casting $ to type $|casting between types}0,1}2">;
8525def err_int_to_block_pointer : Error<
8526  "invalid block pointer conversion "
8527  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8528  "|%diff{passing $ to parameter of type $|"
8529  "passing to parameter of different type}0,1"
8530  "|%diff{returning $ from a function with result type $|"
8531  "returning from function with different return type}0,1"
8532  "|%diff{converting $ to type $|converting between types}0,1"
8533  "|%diff{initializing $ with an expression of type $|"
8534  "initializing with expression of different type}0,1"
8535  "|%diff{sending $ to parameter of type $|"
8536  "sending to parameter of different type}0,1"
8537  "|%diff{casting $ to type $|casting between types}0,1}2">;
8538def err_typecheck_convert_incompatible_block_pointer : Error<
8539  "incompatible block pointer types "
8540  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8541  "|%diff{passing $ to parameter of type $|"
8542  "passing to parameter of different type}0,1"
8543  "|%diff{returning $ from a function with result type $|"
8544  "returning from function with different return type}0,1"
8545  "|%diff{converting $ to type $|converting between types}0,1"
8546  "|%diff{initializing $ with an expression of type $|"
8547  "initializing with expression of different type}0,1"
8548  "|%diff{sending $ to parameter of type $|"
8549  "sending to parameter of different type}0,1"
8550  "|%diff{casting $ to type $|casting between types}0,1}2">;
8551def err_typecheck_incompatible_address_space : Error<
8552  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8553  "|%diff{passing $ to parameter of type $|"
8554  "passing to parameter of different type}0,1"
8555  "|%diff{returning $ from a function with result type $|"
8556  "returning from function with different return type}0,1"
8557  "|%diff{converting $ to type $|converting between types}0,1"
8558  "|%diff{initializing $ with an expression of type $|"
8559  "initializing with expression of different type}0,1"
8560  "|%diff{sending $ to parameter of type $|"
8561  "sending to parameter of different type}0,1"
8562  "|%diff{casting $ to type $|casting between types}0,1}2"
8563  " changes address space of pointer">;
8564def err_typecheck_incompatible_nested_address_space : Error<
8565  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8566  "|%diff{passing $ to parameter of type $|"
8567  "passing to parameter of different type}0,1"
8568  "|%diff{returning $ from a function with result type $|"
8569  "returning from function with different return type}0,1"
8570  "|%diff{converting $ to type $|converting between types}0,1"
8571  "|%diff{initializing $ with an expression of type $|"
8572  "initializing with expression of different type}0,1"
8573  "|%diff{sending $ to parameter of type $|"
8574  "sending to parameter of different type}0,1"
8575  "|%diff{casting $ to type $|casting between types}0,1}2"
8576  " changes address space of nested pointer">;
8577def err_typecheck_incompatible_ownership : Error<
8578  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8579  "|%diff{passing $ to parameter of type $|"
8580  "passing to parameter of different type}0,1"
8581  "|%diff{returning $ from a function with result type $|"
8582  "returning from function with different return type}0,1"
8583  "|%diff{converting $ to type $|converting between types}0,1"
8584  "|%diff{initializing $ with an expression of type $|"
8585  "initializing with expression of different type}0,1"
8586  "|%diff{sending $ to parameter of type $|"
8587  "sending to parameter of different type}0,1"
8588  "|%diff{casting $ to type $|casting between types}0,1}2"
8589  " changes retain/release properties of pointer">;
8590def err_typecheck_comparison_of_distinct_blocks : Error<
8591  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
8592
8593def err_typecheck_array_not_modifiable_lvalue : Error<
8594  "array type %0 is not assignable">;
8595def err_typecheck_non_object_not_modifiable_lvalue : Error<
8596  "non-object type %0 is not assignable">;
8597def err_typecheck_expression_not_modifiable_lvalue : Error<
8598  "expression is not assignable">;
8599def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
8600  "incomplete type %0 is not assignable">;
8601def err_typecheck_lvalue_casts_not_supported : Error<
8602  "assignment to cast is illegal, lvalue casts are not supported">;
8603
8604def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
8605  "vector is not assignable (contains duplicate components)">;
8606def err_block_decl_ref_not_modifiable_lvalue : Error<
8607  "variable is not assignable (missing __block type specifier)">;
8608def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8609  "cannot assign to a variable captured by copy in a non-mutable lambda">;
8610def err_typecheck_call_not_function : Error<
8611  "called object type %0 is not a function or function pointer">;
8612def err_call_incomplete_return : Error<
8613  "calling function with incomplete return type %0">;
8614def err_call_function_incomplete_return : Error<
8615  "calling %0 with incomplete return type %1">;
8616def err_call_incomplete_argument : Error<
8617  "argument type %0 is incomplete">;
8618def err_typecheck_call_too_few_args : Error<
8619  "too few %select{|||execution configuration }0"
8620  "%select{|non-object }3arguments to "
8621  "%select{function|block|method|kernel function}0 call, "
8622  "expected %1, have %2">;
8623def err_typecheck_call_too_few_args_one : Error<
8624  "too few %select{|||execution configuration }0"
8625  "%select{|non-object }2arguments to "
8626  "%select{function|block|method|kernel function}0 call, "
8627  "single argument %1 was not specified">;
8628def err_typecheck_call_too_few_args_at_least : Error<
8629  "too few %select{|||execution configuration }0"
8630  "%select{|non-object }3arguments to "
8631  "%select{function|block|method|kernel function}0 call, "
8632  "expected at least %1, have %2">;
8633def err_typecheck_call_too_few_args_at_least_one : Error<
8634  "too few %select{|||execution configuration }0"
8635  "%select{|non-object }2arguments to "
8636  "%select{function|block|method|kernel function}0 call, "
8637  "at least argument %1 must be specified">;
8638def err_typecheck_call_too_few_args_suggest : Error<
8639  "too few %select{|||execution configuration }0"
8640  "%select{|non-object }3arguments to "
8641  "%select{function|block|method|kernel function}0 call, "
8642  "expected %1, have %2; did you mean %4?">;
8643def err_typecheck_call_too_few_args_at_least_suggest : Error<
8644  "too few %select{|||execution configuration }0"
8645  "%select{|non-object }3arguments to "
8646  "%select{function|block|method|kernel function}0 call, "
8647  "expected at least %1, have %2; did you mean %4?">;
8648def err_typecheck_call_too_many_args : Error<
8649  "too many %select{|||execution configuration }0"
8650  "%select{|non-object }3arguments to "
8651  "%select{function|block|method|kernel function}0 call, "
8652  "expected %1, have %2">;
8653def err_typecheck_call_too_many_args_one : Error<
8654  "too many %select{|||execution configuration }0"
8655  "%select{|non-object }3arguments to "
8656  "%select{function|block|method|kernel function}0 call, "
8657  "expected single argument %1, have %2 arguments">;
8658def err_typecheck_call_too_many_args_at_most : Error<
8659  "too many %select{|||execution configuration }0"
8660  "%select{|non-object }3arguments to "
8661  "%select{function|block|method|kernel function}0 call, "
8662  "expected at most %1, have %2">;
8663def err_typecheck_call_too_many_args_at_most_one : Error<
8664  "too many %select{|||execution configuration }0arguments to "
8665  "%select{function|block|method|kernel function}0 call, "
8666  "expected at most single %select{|non-object }3argument %1, "
8667  "have %2%select{|non-object}3 arguments">;
8668def err_typecheck_call_too_many_args_suggest : Error<
8669  "too many %select{|||execution configuration }0"
8670  "%select{|non-object }3arguments to "
8671  "%select{function|block|method|kernel function}0 call, "
8672  "expected %1, have %2; did you mean %4?">;
8673def err_typecheck_call_too_many_args_at_most_suggest : Error<
8674  "too many %select{|||execution configuration }0"
8675  "%select{|non-object }3arguments to "
8676  "%select{function|block|method|kernel function}0 call, "
8677  "expected at most %1, have %2; did you mean %4?">;
8678
8679def err_arc_typecheck_convert_incompatible_pointer : Error<
8680  "incompatible pointer types passing retainable parameter of type %0"
8681  "to a CF function expecting %1 type">;
8682
8683def err_builtin_fn_use : Error<"builtin functions must be directly called">;
8684
8685def warn_call_wrong_number_of_arguments : Warning<
8686  "too %select{few|many}0 arguments in call to %1">;
8687def err_atomic_builtin_must_be_pointer : Error<
8688  "address argument to atomic builtin must be a pointer (%0 invalid)">;
8689def err_atomic_builtin_must_be_pointer_intptr : Error<
8690  "address argument to atomic builtin must be a pointer to integer or pointer"
8691  " (%0 invalid)">;
8692def err_atomic_builtin_cannot_be_const : Error<
8693  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
8694def err_atomic_builtin_must_be_pointer_intfltptr : Error<
8695  "address argument to atomic builtin must be a pointer to integer,"
8696  " floating-point or pointer (%0 invalid)">;
8697def err_atomic_builtin_pointer_size : Error<
8698  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
8699  "type (%0 invalid)">;
8700def err_atomic_exclusive_builtin_pointer_size : Error<
8701  "address argument to load or store exclusive builtin must be a pointer to"
8702  " 1,2,4 or 8 byte type (%0 invalid)">;
8703def err_atomic_builtin_ext_int_size : Error<
8704  "Atomic memory operand must have a power-of-two size">;
8705def err_atomic_builtin_bit_int_prohibit : Error<
8706  "argument to atomic builtin of type '_BitInt' is not supported">;
8707def err_atomic_op_needs_atomic : Error<
8708  "address argument to atomic operation must be a pointer to _Atomic "
8709  "type (%0 invalid)">;
8710def err_atomic_op_needs_non_const_atomic : Error<
8711  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
8712  "type (%1 invalid)">;
8713def err_atomic_op_needs_non_const_pointer : Error<
8714  "address argument to atomic operation must be a pointer to non-const "
8715  "type (%0 invalid)">;
8716def err_atomic_op_needs_trivial_copy : Error<
8717  "address argument to atomic operation must be a pointer to a "
8718  "trivially-copyable type (%0 invalid)">;
8719def err_atomic_op_needs_atomic_int_ptr_or_fp : Error<
8720  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8721  "integer, pointer or supported floating point type (%1 invalid)">;
8722def err_atomic_op_needs_atomic_int_or_ptr : Error<
8723  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8724  "integer or pointer (%1 invalid)">;
8725def err_atomic_op_needs_atomic_int_or_fp : Error<
8726  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8727  "integer or supported floating point type (%1 invalid)">;
8728def err_atomic_op_needs_atomic_int : Error<
8729  "address argument to atomic operation must be a pointer to "
8730  "%select{|atomic }0integer (%1 invalid)">;
8731def warn_atomic_op_has_invalid_memory_order : Warning<
8732  "%select{|success |failure }0memory order argument to atomic operation is invalid">,
8733  InGroup<DiagGroup<"atomic-memory-ordering">>;
8734def err_atomic_op_has_invalid_synch_scope : Error<
8735  "synchronization scope argument to atomic operation is invalid">;
8736def warn_atomic_implicit_seq_cst : Warning<
8737  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
8738  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
8739
8740def err_overflow_builtin_must_be_int : Error<
8741  "operand argument to %select{overflow builtin|checked integer operation}0 "
8742  "must be an integer type %select{|other than plain 'char', 'bool', bit-precise, "
8743  "or an enumeration }0(%1 invalid)">;
8744def err_overflow_builtin_must_be_ptr_int : Error<
8745  "result argument to %select{overflow builtin|checked integer operation}0 "
8746  "must be a pointer to a non-const integer type %select{|other than plain 'char', "
8747  "'bool', bit-precise, or an enumeration }0(%1 invalid)">;
8748def err_overflow_builtin_bit_int_max_size : Error<
8749  "__builtin_mul_overflow does not support 'signed _BitInt' operands of more "
8750  "than %0 bits">;
8751def err_expected_struct_pointer_argument : Error<
8752  "expected pointer to struct as %ordinal0 argument to %1, found %2">;
8753def err_expected_callable_argument : Error<
8754  "expected a callable expression as %ordinal0 argument to %1, found %2">;
8755def note_building_builtin_dump_struct_call : Note<
8756  "in call to printing function with arguments '(%0)' while dumping struct">;
8757
8758def err_atomic_load_store_uses_lib : Error<
8759  "atomic %select{load|store}0 requires runtime support that is not "
8760  "available for this target">;
8761
8762def err_nontemporal_builtin_must_be_pointer : Error<
8763  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
8764def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
8765  "address argument to nontemporal builtin must be a pointer to integer, float, "
8766  "pointer, or a vector of such types (%0 invalid)">;
8767
8768def err_deleted_function_use : Error<"attempt to use a deleted function">;
8769def err_deleted_inherited_ctor_use : Error<
8770  "constructor inherited by %0 from base class %1 is implicitly deleted">;
8771
8772def note_called_by : Note<"called by %0">;
8773def err_kern_type_not_void_return : Error<
8774  "kernel function type %0 must have void return type">;
8775def err_kern_is_nonstatic_method : Error<
8776  "kernel function %0 must be a free function or static member function">;
8777def err_config_scalar_return : Error<
8778  "CUDA special function '%0' must have scalar return type">;
8779def err_kern_call_not_global_function : Error<
8780  "kernel call to non-global function %0">;
8781def err_global_call_not_config : Error<
8782  "call to global function %0 not configured">;
8783def err_ref_bad_target : Error<
8784  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8785  "%select{function|variable}1 %2 in %select{__device__|__global__|__host__|__host__ __device__}3 function">;
8786def note_cuda_const_var_unpromoted : Note<
8787  "const variable cannot be emitted on device side due to dynamic initialization">;
8788def note_cuda_host_var : Note<
8789  "host variable declared here">;
8790def err_ref_bad_target_global_initializer : Error<
8791  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8792  "function %1 in global initializer">;
8793def err_capture_bad_target : Error<
8794  "capture host variable %0 by reference in device or host device lambda function">;
8795def warn_maybe_capture_bad_target_this_ptr : Warning<
8796  "capture host side class data member by this pointer in device or host device lambda function "
8797  "may result in invalid memory access if this pointer is not accessible on device side">,
8798  InGroup<DiagGroup<"gpu-maybe-wrong-side">>;
8799def warn_kern_is_method : Extension<
8800  "kernel function %0 is a member function; this may not be accepted by nvcc">,
8801  InGroup<CudaCompat>;
8802def warn_kern_is_inline : Warning<
8803  "ignored 'inline' attribute on kernel function %0">,
8804  InGroup<CudaCompat>;
8805def err_variadic_device_fn : Error<
8806  "CUDA device code does not support variadic functions">;
8807def err_va_arg_in_device : Error<
8808"CUDA device code does not support va_arg">;
8809def err_alias_not_supported_on_nvptx : Error<"CUDA older than 10.0 does not support .alias">;
8810def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8811  "constexpr function %0 without __host__ or __device__ attributes cannot "
8812  "overload __device__ function with same signature.  Add a __host__ "
8813  "attribute, or build with -fno-cuda-host-device-constexpr.">;
8814def note_cuda_conflicting_device_function_declared_here : Note<
8815  "conflicting __device__ function declared here">;
8816def err_cuda_device_exceptions : Error<
8817  "cannot use '%0' in "
8818  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8819def err_dynamic_var_init : Error<
8820    "dynamic initialization is not supported for "
8821    "__device__, __constant__, __shared__, and __managed__ variables.">;
8822def err_shared_var_init : Error<
8823    "initialization is not supported for __shared__ variables.">;
8824def err_cuda_vla : Error<
8825    "cannot use variable-length arrays in "
8826    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8827def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8828def err_cuda_host_shared : Error<
8829    "__shared__ local variables not allowed in "
8830    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8831def err_cuda_nonstatic_constdev: Error<"__constant__, __device__, and "
8832    "__managed__ are not allowed on non-static local variables">;
8833def err_cuda_ovl_target : Error<
8834  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8835  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8836def note_cuda_ovl_candidate_target_mismatch : Note<
8837    "candidate template ignored: target attributes do not match">;
8838
8839def err_cuda_device_builtin_surftex_cls_template : Error<
8840    "illegal device builtin %select{surface|texture}0 reference "
8841    "class template %1 declared here">;
8842def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8843    "%0 needs to have exactly %1 template parameters">;
8844def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8845    "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8846    "%select{a type|an integer or enum value}2">;
8847
8848def err_cuda_device_builtin_surftex_ref_decl : Error<
8849    "illegal device builtin %select{surface|texture}0 reference "
8850    "type %1 declared here">;
8851def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8852    "%0 needs to be instantiated from a class template with proper "
8853    "template arguments">;
8854
8855def err_hip_invalid_args_builtin_mangled_name : Error<
8856    "invalid argument: symbol must be a device-side function or global variable">;
8857
8858def warn_hip_omp_target_directives : Warning<
8859  "HIP does not support OpenMP target directives; directive has been ignored">,
8860  InGroup<HIPOpenMPOffloading>, DefaultError;
8861
8862def warn_non_pod_vararg_with_format_string : Warning<
8863  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8864  "%select{function|block|method|constructor}2; expected type from format "
8865  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8866// The arguments to this diagnostic should match the warning above.
8867def err_cannot_pass_objc_interface_to_vararg_format : Error<
8868  "cannot pass object with interface type %1 by value to variadic "
8869  "%select{function|block|method|constructor}2; expected type from format "
8870  "string was %3">;
8871def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8872  "cannot pass non-trivial C object of type %0 by value to variadic "
8873  "%select{function|block|method|constructor}1">;
8874
8875
8876def err_cannot_pass_objc_interface_to_vararg : Error<
8877  "cannot pass object with interface type %0 by value through variadic "
8878  "%select{function|block|method|constructor}1">;
8879def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8880  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8881  " %select{function|block|method|constructor}2; call will abort at runtime">,
8882  InGroup<NonPODVarargs>, DefaultError;
8883def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8884  "passing object of trivial but non-POD type %0 through variadic"
8885  " %select{function|block|method|constructor}1 is incompatible with C++98">,
8886  InGroup<CXX98Compat>, DefaultIgnore;
8887def warn_pass_class_arg_to_vararg : Warning<
8888  "passing object of class type %0 through variadic "
8889  "%select{function|block|method|constructor}1"
8890  "%select{|; did you mean to call '%3'?}2">,
8891  InGroup<ClassVarargs>, DefaultIgnore;
8892def err_cannot_pass_to_vararg : Error<
8893  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8894  "%select{function|block|method|constructor}2">;
8895def err_cannot_pass_to_vararg_format : Error<
8896  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8897  "%select{function|block|method|constructor}2; expected type from format "
8898  "string was %3">;
8899
8900def err_typecheck_call_invalid_ordered_compare : Error<
8901  "ordered compare requires two args of floating point type"
8902  "%diff{ ($ and $)|}0,1">;
8903def err_typecheck_call_invalid_unary_fp : Error<
8904  "floating point classification requires argument of floating point type "
8905  "(passed in %0)">;
8906def err_typecheck_cond_expect_int_float : Error<
8907  "used type %0 where integer or floating point type is required">;
8908def err_typecheck_cond_expect_scalar : Error<
8909  "used type %0 where arithmetic or pointer type is required">;
8910def err_typecheck_cond_expect_nonfloat : Error<
8911  "used type %0 where floating point type is not allowed">;
8912def ext_typecheck_cond_one_void : Extension<
8913  "C99 forbids conditional expressions with only one void side">;
8914def err_typecheck_cast_to_incomplete : Error<
8915  "cast to incomplete type %0">;
8916def ext_typecheck_cast_nonscalar : Extension<
8917  "C99 forbids casting nonscalar type %0 to the same type">;
8918def ext_typecheck_cast_to_union : Extension<
8919  "cast to union type is a GNU extension">,
8920  InGroup<GNUUnionCast>;
8921def err_typecheck_cast_to_union_no_type : Error<
8922  "cast to union type from type %0 not present in union">;
8923def err_cast_pointer_from_non_pointer_int : Error<
8924  "operand of type %0 cannot be cast to a pointer type">;
8925def warn_cast_pointer_from_sel : Warning<
8926  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8927  InGroup<SelTypeCast>;
8928def warn_function_def_in_objc_container : Warning<
8929  "function definition inside an Objective-C container is deprecated">,
8930  InGroup<FunctionDefInObjCContainer>;
8931def err_typecheck_call_requires_real_fp : Error<
8932  "argument type %0 is not a real floating point type">;
8933def err_typecheck_call_different_arg_types : Error<
8934  "arguments are of different types%diff{ ($ vs $)|}0,1">;
8935
8936def warn_cast_calling_conv : Warning<
8937  "cast between incompatible calling conventions '%0' and '%1'; "
8938  "calls through this pointer may abort at runtime">,
8939  InGroup<DiagGroup<"cast-calling-convention">>;
8940def note_change_calling_conv_fixit : Note<
8941  "consider defining %0 with the '%1' calling convention">;
8942def warn_bad_function_cast : Warning<
8943  "cast from function call of type %0 to non-matching type %1">,
8944  InGroup<BadFunctionCast>, DefaultIgnore;
8945def warn_cast_function_type : Warning<
8946  "cast %diff{from $ to $ |}0,1converts to incompatible function type">,
8947  InGroup<CastFunctionType>, DefaultIgnore;
8948def warn_cast_function_type_strict : Warning<warn_cast_function_type.Summary>,
8949  InGroup<CastFunctionTypeStrict>, DefaultIgnore;
8950def err_cast_pointer_to_non_pointer_int : Error<
8951  "pointer cannot be cast to type %0">;
8952def err_nullptr_cast : Error<
8953  "cannot cast an object of type %select{'nullptr_t' to %1|%1 to 'nullptr_t'}0"
8954>;
8955def err_typecheck_expect_scalar_operand : Error<
8956  "operand of type %0 where arithmetic or pointer type is required">;
8957def err_typecheck_cond_incompatible_operands : Error<
8958  "incompatible operand types%diff{ ($ and $)|}0,1">;
8959def err_typecheck_expect_flt_or_vector : Error<
8960  "invalid operand of type %0 where floating, complex or "
8961  "a vector of such types is required">;
8962def err_cast_selector_expr : Error<
8963  "cannot type cast @selector expression">;
8964def err_make_signed_integral_only : Error<
8965  "'%select{make_unsigned|make_signed}0' is only compatible with "
8966  "non-%select{bool|_BitInt(1)}1 integers and enum types, but was given "
8967  "%2%select{| whose underlying type is %4}3">;
8968def ext_typecheck_cond_incompatible_pointers : ExtWarn<
8969  "pointer type mismatch%diff{ ($ and $)|}0,1">,
8970  InGroup<DiagGroup<"pointer-type-mismatch">>;
8971def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
8972  "pointer/integer type mismatch in conditional expression"
8973  "%diff{ ($ and $)|}0,1">,
8974  InGroup<DiagGroup<"conditional-type-mismatch">>;
8975def err_typecheck_choose_expr_requires_constant : Error<
8976  "'__builtin_choose_expr' requires a constant expression">;
8977def warn_unused_expr : Warning<"expression result unused">,
8978  InGroup<UnusedValue>;
8979def warn_unused_comma_left_operand : Warning<
8980  "left operand of comma operator has no effect">,
8981  InGroup<UnusedValue>;
8982def warn_unused_voidptr : Warning<
8983  "expression result unused; should this cast be to 'void'?">,
8984  InGroup<UnusedValue>;
8985def warn_unused_property_expr : Warning<
8986 "property access result unused - getters should not be used for side effects">,
8987  InGroup<UnusedGetterReturnValue>;
8988def warn_unused_container_subscript_expr : Warning<
8989 "container access result unused - container access should not be used for side effects">,
8990  InGroup<UnusedValue>;
8991def warn_unused_call : Warning<
8992  "ignoring return value of function declared with %0 attribute">,
8993  InGroup<UnusedValue>;
8994def warn_unused_constructor : Warning<
8995  "ignoring temporary created by a constructor declared with %0 attribute">,
8996  InGroup<UnusedValue>;
8997def warn_unused_constructor_msg : Warning<
8998  "ignoring temporary created by a constructor declared with %0 attribute: %1">,
8999  InGroup<UnusedValue>;
9000def warn_side_effects_unevaluated_context : Warning<
9001  "expression with side effects has no effect in an unevaluated context">,
9002  InGroup<UnevaluatedExpression>;
9003def warn_side_effects_typeid : Warning<
9004  "expression with side effects will be evaluated despite being used as an "
9005  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
9006def warn_unused_result : Warning<
9007  "ignoring return value of function declared with %0 attribute">,
9008  InGroup<UnusedResult>;
9009def warn_unused_result_msg : Warning<
9010  "ignoring return value of function declared with %0 attribute: %1">,
9011  InGroup<UnusedResult>;
9012def warn_unused_result_typedef_unsupported_spelling : Warning<
9013  "'[[%select{nodiscard|gnu::warn_unused_result}0]]' attribute ignored when "
9014  "applied to a typedef; consider using '__attribute__((warn_unused_result))' "
9015  "or '[[clang::warn_unused_result]]' instead">, InGroup<IgnoredAttributes>;
9016def warn_unused_volatile : Warning<
9017  "expression result unused; assign into a variable to force a volatile load">,
9018  InGroup<DiagGroup<"unused-volatile-lvalue">>;
9019
9020def ext_cxx14_attr : Extension<
9021  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14Attrs>;
9022def ext_cxx17_attr : Extension<
9023  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17Attrs>;
9024def ext_cxx20_attr : Extension<
9025  "use of the %0 attribute is a C++20 extension">, InGroup<CXX20Attrs>;
9026
9027def warn_unused_comparison : Warning<
9028  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
9029  InGroup<UnusedComparison>;
9030def note_inequality_comparison_to_or_assign : Note<
9031  "use '|=' to turn this inequality comparison into an or-assignment">;
9032
9033def err_incomplete_type_used_in_type_trait_expr : Error<
9034  "incomplete type %0 used in type trait expression">;
9035
9036// C++20 constinit and require_constant_initialization attribute
9037def warn_cxx20_compat_constinit : Warning<
9038  "'constinit' specifier is incompatible with C++ standards before C++20">,
9039  InGroup<CXX20Compat>, DefaultIgnore;
9040def err_constinit_local_variable : Error<
9041  "local variable cannot be declared 'constinit'">;
9042def err_require_constant_init_failed : Error<
9043  "variable does not have a constant initializer">;
9044def note_declared_required_constant_init_here : Note<
9045  "required by %select{'require_constant_initialization' attribute|"
9046  "'constinit' specifier}0 here">;
9047def ext_constinit_missing : ExtWarn<
9048  "'constinit' specifier missing on initializing declaration of %0">,
9049  InGroup<DiagGroup<"missing-constinit">>;
9050def note_constinit_specified_here : Note<"variable declared constinit here">;
9051def err_constinit_added_too_late : Error<
9052  "'constinit' specifier added after initialization of variable">;
9053def warn_require_const_init_added_too_late : Warning<
9054  "'require_constant_initialization' attribute added after initialization "
9055  "of variable">, InGroup<IgnoredAttributes>;
9056def note_constinit_missing_here : Note<
9057  "add the "
9058  "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
9059  "to the initializing declaration here">;
9060
9061def err_dimension_expr_not_constant_integer : Error<
9062  "dimension expression does not evaluate to a constant unsigned int">;
9063
9064def err_typecheck_cond_incompatible_operands_null : Error<
9065  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
9066def ext_empty_struct_union : Extension<
9067  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
9068def ext_no_named_members_in_struct_union : Extension<
9069  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
9070def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
9071  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
9072  InGroup<CXXCompat>, DefaultIgnore;
9073def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
9074  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
9075  InGroup<ExternCCompat>;
9076def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
9077  "volatile qualifiers|const qualifier|volatile qualifier}2">,
9078  InGroup<CastQual>, DefaultIgnore;
9079def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
9080  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
9081def warn_redefine_extname_not_applied : Warning<
9082  "#pragma redefine_extname is applicable to external C declarations only; "
9083  "not applied to %select{function|variable}0 %1">,
9084  InGroup<Pragmas>;
9085} // End of general sema category.
9086
9087// inline asm.
9088let CategoryName = "Inline Assembly Issue" in {
9089  def err_asm_pmf_through_constraint_not_permitted
9090    : Error<"cannot pass a pointer-to-member through register-constrained "
9091            "inline assembly parameter">;
9092  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
9093  def err_asm_invalid_output_constraint : Error<
9094    "invalid output constraint '%0' in asm">;
9095  def err_asm_invalid_lvalue_in_input : Error<
9096    "invalid lvalue in asm input for constraint '%0'">;
9097  def err_asm_invalid_input_constraint : Error<
9098    "invalid input constraint '%0' in asm">;
9099  def err_asm_tying_incompatible_types : Error<
9100    "unsupported inline asm: input with type "
9101    "%diff{$ matching output with type $|}0,1">;
9102  def err_asm_unexpected_constraint_alternatives : Error<
9103    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
9104  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
9105  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
9106  def err_asm_unwind_and_goto : Error<"unwind clobber can't be used with asm goto">;
9107  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
9108    "global register variables on this target">;
9109  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
9110    "match variable size">;
9111  def err_asm_bad_register_type : Error<"bad type for named register variable">;
9112  def err_asm_invalid_input_size : Error<
9113    "invalid input size for constraint '%0'">;
9114  def err_asm_invalid_output_size : Error<
9115    "invalid output size for constraint '%0'">;
9116  def err_invalid_asm_cast_lvalue : Error<
9117    "invalid use of a cast in a inline asm context requiring an lvalue: "
9118    "remove the cast or build with -fheinous-gnu-extensions">;
9119  def err_invalid_asm_value_for_constraint
9120      : Error <"value '%0' out of range for constraint '%1'">;
9121  def err_asm_non_addr_value_in_memory_constraint : Error <
9122    "reference to a %select{bit-field|vector element|global register variable}0"
9123    " in asm %select{input|output}1 with a memory constraint '%2'">;
9124  def err_asm_input_duplicate_match : Error<
9125    "more than one input constraint matches the same output '%0'">;
9126  def err_store_value_to_reg : Error<
9127    "impossible constraint in asm: can't store value into a register">;
9128
9129  def warn_asm_label_on_auto_decl : Warning<
9130    "ignored asm label '%0' on automatic variable">;
9131  def warn_invalid_asm_cast_lvalue : Warning<
9132    "invalid use of a cast in an inline asm context requiring an lvalue: "
9133    "accepted due to -fheinous-gnu-extensions, but clang may remove support "
9134    "for this in the future">;
9135  def warn_asm_mismatched_size_modifier : Warning<
9136    "value size does not match register size specified by the constraint "
9137    "and modifier">,
9138    InGroup<ASMOperandWidths>;
9139
9140  def note_asm_missing_constraint_modifier : Note<
9141    "use constraint modifier \"%0\"">;
9142  def note_asm_input_duplicate_first : Note<
9143    "constraint '%0' is already present here">;
9144 def error_duplicate_asm_operand_name : Error<
9145    "duplicate use of asm operand name \"%0\"">;
9146 def note_duplicate_asm_operand_name : Note<
9147    "asm operand name \"%0\" first referenced here">;
9148}
9149
9150  def error_inoutput_conflict_with_clobber : Error<
9151    "asm-specifier for input or output variable conflicts with asm"
9152    " clobber list">;
9153
9154let CategoryName = "Semantic Issue" in {
9155
9156def err_invalid_conversion_between_matrixes : Error<
9157  "conversion between matrix types%diff{ $ and $|}0,1 of different size is not allowed">;
9158
9159def err_invalid_conversion_between_matrix_and_type : Error<
9160  "conversion between matrix type %0 and incompatible type %1 is not allowed">;
9161
9162def err_invalid_conversion_between_vectors : Error<
9163  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
9164  "size">;
9165def err_invalid_conversion_between_vector_and_integer : Error<
9166  "invalid conversion between vector type %0 and integer type %1 "
9167  "of different size">;
9168
9169def err_opencl_function_pointer : Error<
9170  "%select{pointers|references}0 to functions are not allowed">;
9171
9172def err_opencl_taking_address_capture : Error<
9173  "taking address of a capture is not allowed">;
9174
9175def err_invalid_conversion_between_vector_and_scalar : Error<
9176  "invalid conversion between vector type %0 and scalar type %1">;
9177
9178// C++ member initializers.
9179def err_only_constructors_take_base_inits : Error<
9180  "only constructors take base initializers">;
9181
9182def err_multiple_mem_initialization : Error <
9183  "multiple initializations given for non-static member %0">;
9184def err_multiple_mem_union_initialization : Error <
9185  "initializing multiple members of union">;
9186def err_multiple_base_initialization : Error <
9187  "multiple initializations given for base %0">;
9188
9189def err_mem_init_not_member_or_class : Error<
9190  "member initializer %0 does not name a non-static data member or base "
9191  "class">;
9192
9193def warn_initializer_out_of_order : Warning<
9194  "%select{field|base class}0 %1 will be initialized after "
9195  "%select{field|base}2 %3">,
9196  InGroup<ReorderCtor>, DefaultIgnore;
9197
9198def warn_some_initializers_out_of_order : Warning<
9199  "initializer order does not match the declaration order">,
9200  InGroup<ReorderCtor>, DefaultIgnore;
9201
9202def note_initializer_out_of_order : Note<
9203  "%select{field|base class}0 %1 will be initialized after "
9204  "%select{field|base}2 %3">;
9205
9206def warn_abstract_vbase_init_ignored : Warning<
9207  "initializer for virtual base class %0 of abstract class %1 "
9208  "will never be used">,
9209  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
9210
9211def err_base_init_does_not_name_class : Error<
9212  "constructor initializer %0 does not name a class">;
9213def err_base_init_direct_and_virtual : Error<
9214  "base class initializer %0 names both a direct base class and an "
9215  "inherited virtual base class">;
9216def err_not_direct_base_or_virtual : Error<
9217  "type %0 is not a direct or virtual base of %1">;
9218
9219def err_in_class_initializer_non_const : Error<
9220  "non-const static data member must be initialized out of line">;
9221def err_in_class_initializer_volatile : Error<
9222  "static const volatile data member must be initialized out of line">;
9223def err_in_class_initializer_bad_type : Error<
9224  "static data member of type %0 must be initialized out of line">;
9225def ext_in_class_initializer_float_type : ExtWarn<
9226  "in-class initializer for static data member of type %0 is a GNU extension">,
9227  InGroup<GNUStaticFloatInit>;
9228def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
9229  "in-class initializer for static data member of type %0 requires "
9230  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
9231def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
9232def err_in_class_initializer_literal_type : Error<
9233  "in-class initializer for static data member of type %0 requires "
9234  "'constexpr' specifier">;
9235def err_in_class_initializer_non_constant : Error<
9236  "in-class initializer for static data member is not a constant expression">;
9237def err_default_member_initializer_not_yet_parsed : Error<
9238  "default member initializer for %1 needed within definition of enclosing "
9239  "class %0 outside of member functions">;
9240def note_default_member_initializer_not_yet_parsed : Note<
9241  "default member initializer declared here">;
9242def err_default_member_initializer_cycle
9243    : Error<"default member initializer for %0 uses itself">;
9244
9245def ext_in_class_initializer_non_constant : Extension<
9246  "in-class initializer for static data member is not a constant expression; "
9247  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
9248
9249def err_thread_dynamic_init : Error<
9250  "initializer for thread-local variable must be a constant expression">;
9251def err_thread_nontrivial_dtor : Error<
9252  "type of thread-local variable has non-trivial destruction">;
9253def note_use_thread_local : Note<
9254  "use 'thread_local' to allow this">;
9255
9256// C++ anonymous unions and GNU anonymous structs/unions
9257def ext_anonymous_union : Extension<
9258  "anonymous unions are a C11 extension">, InGroup<C11>;
9259def ext_gnu_anonymous_struct : Extension<
9260  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
9261def ext_c11_anonymous_struct : Extension<
9262  "anonymous structs are a C11 extension">, InGroup<C11>;
9263def err_anonymous_union_not_static : Error<
9264  "anonymous unions at namespace or global scope must be declared 'static'">;
9265def err_anonymous_union_with_storage_spec : Error<
9266  "anonymous union at class scope must not have a storage specifier">;
9267def err_anonymous_struct_not_member : Error<
9268  "anonymous %select{structs|structs and classes}0 must be "
9269  "%select{struct or union|class}0 members">;
9270def err_anonymous_record_member_redecl : Error<
9271  "member of anonymous %select{struct|union}0 redeclares %1">;
9272def err_anonymous_record_with_type : Error<
9273  "types cannot be declared in an anonymous %select{struct|union}0">;
9274def ext_anonymous_record_with_type : Extension<
9275  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
9276  "extension">, InGroup<MicrosoftAnonTag>;
9277def ext_anonymous_record_with_anonymous_type : Extension<
9278  "anonymous types declared in an anonymous %select{struct|union}0 "
9279  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
9280def err_anonymous_record_with_function : Error<
9281  "functions cannot be declared in an anonymous %select{struct|union}0">;
9282def err_anonymous_record_with_static : Error<
9283  "static members cannot be declared in an anonymous %select{struct|union}0">;
9284def err_anonymous_record_bad_member : Error<
9285  "anonymous %select{struct|union}0 can only contain non-static data members">;
9286def err_anonymous_record_nonpublic_member : Error<
9287  "anonymous %select{struct|union}0 cannot contain a "
9288  "%select{private|protected}1 data member">;
9289def ext_ms_anonymous_record : ExtWarn<
9290  "anonymous %select{structs|unions}0 are a Microsoft extension">,
9291  InGroup<MicrosoftAnonTag>;
9292
9293// C++ local classes
9294def err_reference_to_local_in_enclosing_context : Error<
9295  "reference to local %select{variable|binding}1 %0 declared in enclosing "
9296  "%select{%3|block literal|lambda expression|context}2">;
9297def err_capture_binding_openmp : Error<
9298  "capturing a structured binding is not yet supported in OpenMP">;
9299def ext_capture_binding : ExtWarn<
9300  "captured structured bindings are a C++20 extension">, InGroup<CXX20>;
9301def warn_cxx17_compat_capture_binding : Warning<
9302  "captured structured bindings are incompatible with "
9303  "C++ standards before C++20">,
9304  InGroup<CXXPre20Compat>, DefaultIgnore;
9305
9306def err_static_data_member_not_allowed_in_local_class : Error<
9307  "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
9308
9309// C++ derived classes
9310def err_base_clause_on_union : Error<"unions cannot have base classes">;
9311def err_base_must_be_class : Error<"base specifier must name a class">;
9312def err_union_as_base_class : Error<"unions cannot be base classes">;
9313def err_circular_inheritance : Error<
9314  "circular inheritance between %0 and %1">;
9315def err_base_class_has_flexible_array_member : Error<
9316  "base class %0 has a flexible array member">;
9317def err_incomplete_base_class : Error<"base class has incomplete type">;
9318def err_duplicate_base_class : Error<
9319  "base class %0 specified more than once as a direct base class">;
9320def warn_inaccessible_base_class : Warning<
9321  "direct base %0 is inaccessible due to ambiguity:%1">,
9322  InGroup<DiagGroup<"inaccessible-base">>;
9323// FIXME: better way to display derivation?  Pass entire thing into diagclient?
9324def err_ambiguous_derived_to_base_conv : Error<
9325  "ambiguous conversion from derived class %0 to base class %1:%2">;
9326def err_ambiguous_memptr_conv : Error<
9327  "ambiguous conversion from pointer to member of %select{base|derived}0 "
9328  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
9329def ext_ms_ambiguous_direct_base : ExtWarn<
9330  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
9331  InGroup<MicrosoftInaccessibleBase>;
9332
9333def err_memptr_conv_via_virtual : Error<
9334  "conversion from pointer to member of class %0 to pointer to member "
9335  "of class %1 via virtual base %2 is not allowed">;
9336
9337// C++ member name lookup
9338def err_ambiguous_member_multiple_subobjects : Error<
9339  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
9340def err_ambiguous_member_multiple_subobject_types : Error<
9341  "member %0 found in multiple base classes of different types">;
9342def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
9343def note_ambiguous_member_type_found : Note<
9344  "member type %0 found by ambiguous name lookup">;
9345def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
9346def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
9347def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
9348  "declaration in a different namespace">;
9349def note_hidden_tag : Note<"type declaration hidden">;
9350def note_hiding_object : Note<"declaration hides type">;
9351
9352// C++ operator overloading
9353def err_operator_overload_needs_class_or_enum : Error<
9354  "overloaded %0 must have at least one parameter of class "
9355  "or enumeration type">;
9356
9357def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
9358def warn_cxx20_compat_operator_overload_static : Warning<
9359  "declaring overloaded %0 as 'static' is incompatible with C++ standards "
9360  "before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
9361def ext_operator_overload_static : ExtWarn<
9362  "declaring overloaded %0 as 'static' is a C++23 extension">, InGroup<CXX23>;
9363def err_operator_overload_static : Error<
9364  "overloaded %0 cannot be a static member function">;
9365def err_operator_overload_default_arg : Error<
9366  "parameter of overloaded %0 cannot have a default argument">;
9367
9368def ext_subscript_overload : Warning<
9369  "overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a "
9370  "C++23 extension">, InGroup<CXXPre23Compat>, DefaultIgnore;
9371def error_subscript_overload : Error<
9372  "overloaded %0 cannot have %select{no|a defaulted|more than one}1 parameter before C++23">;
9373
9374def err_operator_overload_must_be : Error<
9375  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
9376  "(has %1 parameter%s1)">;
9377
9378def err_operator_overload_must_be_member : Error<
9379  "overloaded %0 must be a non-static member function">;
9380def err_operator_overload_post_incdec_must_be_int : Error<
9381  "parameter of overloaded post-%select{increment|decrement}1 operator must "
9382  "have type 'int' (not %0)">;
9383
9384// C++ allocation and deallocation functions.
9385def err_operator_new_delete_declared_in_namespace : Error<
9386  "%0 cannot be declared inside a namespace">;
9387def err_operator_new_delete_declared_static : Error<
9388  "%0 cannot be declared static in global scope">;
9389def ext_operator_new_delete_declared_inline : ExtWarn<
9390  "replacement function %0 cannot be declared 'inline'">,
9391  InGroup<DiagGroup<"inline-new-delete">>;
9392def err_operator_new_delete_invalid_result_type : Error<
9393  "%0 must return type %1">;
9394def err_operator_new_delete_dependent_result_type : Error<
9395  "%0 cannot have a dependent return type; use %1 instead">;
9396def err_operator_new_delete_too_few_parameters : Error<
9397  "%0 must have at least one parameter">;
9398def err_operator_new_delete_template_too_few_parameters : Error<
9399  "%0 template must have at least two parameters">;
9400def warn_operator_new_returns_null : Warning<
9401  "%0 should not return a null pointer unless it is declared 'throw()'"
9402  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
9403
9404def err_operator_new_dependent_param_type : Error<
9405  "%0 cannot take a dependent type as first parameter; "
9406  "use size_t (%1) instead">;
9407def err_operator_new_param_type : Error<
9408  "%0 takes type size_t (%1) as first parameter">;
9409def err_operator_new_default_arg: Error<
9410  "parameter of %0 cannot have a default argument">;
9411def err_operator_delete_dependent_param_type : Error<
9412  "%0 cannot take a dependent type as first parameter; use %1 instead">;
9413def err_operator_delete_param_type : Error<
9414  "first parameter of %0 must have type %1">;
9415def err_destroying_operator_delete_not_usual : Error<
9416  "destroying operator delete can have only an optional size and optional "
9417  "alignment parameter">;
9418def note_implicit_delete_this_in_destructor_here : Note<
9419  "while checking implicit 'delete this' for virtual destructor">;
9420def err_builtin_operator_new_delete_not_usual : Error<
9421  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
9422  "selects non-usual %select{allocation|deallocation}0 function">;
9423def note_non_usual_function_declared_here : Note<
9424  "non-usual %0 declared here">;
9425
9426// C++ literal operators
9427def err_literal_operator_outside_namespace : Error<
9428  "literal operator %0 must be in a namespace or global scope">;
9429def err_literal_operator_id_outside_namespace : Error<
9430  "non-namespace scope '%0' cannot have a literal operator member">;
9431def err_literal_operator_default_argument : Error<
9432  "literal operator cannot have a default argument">;
9433def err_literal_operator_bad_param_count : Error<
9434  "non-template literal operator must have one or two parameters">;
9435def err_literal_operator_invalid_param : Error<
9436  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
9437def err_literal_operator_param : Error<
9438  "invalid literal operator parameter type %0, did you mean %1?">;
9439def err_literal_operator_template_with_params : Error<
9440  "literal operator template cannot have any parameters">;
9441def err_literal_operator_template : Error<
9442  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
9443def err_literal_operator_extern_c : Error<
9444  "literal operator must have C++ linkage">;
9445def ext_string_literal_operator_template : ExtWarn<
9446  "string literal operator templates are a GNU extension">,
9447  InGroup<GNUStringLiteralOperatorTemplate>;
9448def warn_user_literal_reserved : Warning<
9449  "user-defined literal suffixes %select{<ERROR>|not starting with '_'|containing '__'}0 are reserved"
9450  "%select{; no literal will invoke this operator|}1">,
9451  InGroup<UserDefinedLiterals>;
9452
9453// C++ conversion functions
9454def err_conv_function_not_member : Error<
9455  "conversion function must be a non-static member function">;
9456def err_conv_function_return_type : Error<
9457  "conversion function cannot have a return type">;
9458def err_conv_function_with_params : Error<
9459  "conversion function cannot have any parameters">;
9460def err_conv_function_variadic : Error<
9461  "conversion function cannot be variadic">;
9462def err_conv_function_to_array : Error<
9463  "conversion function cannot convert to an array type">;
9464def err_conv_function_to_function : Error<
9465  "conversion function cannot convert to a function type">;
9466def err_conv_function_with_complex_decl : Error<
9467  "cannot specify any part of a return type in the "
9468  "declaration of a conversion function"
9469  "%select{"
9470  "; put the complete type after 'operator'|"
9471  "; use a typedef to declare a conversion to %1|"
9472  "; use an alias template to declare a conversion to %1|"
9473  "}0">;
9474def err_conv_function_redeclared : Error<
9475  "conversion function cannot be redeclared">;
9476def warn_conv_to_self_not_used : Warning<
9477  "conversion function converting %0 to itself will never be used">,
9478  InGroup<ClassConversion>;
9479def warn_conv_to_base_not_used : Warning<
9480  "conversion function converting %0 to its base class %1 will never be used">,
9481  InGroup<ClassConversion>;
9482def warn_conv_to_void_not_used : Warning<
9483  "conversion function converting %0 to %1 will never be used">,
9484  InGroup<ClassConversion>;
9485
9486def warn_not_compound_assign : Warning<
9487  "use of unary operator that may be intended as compound assignment (%0=)">;
9488
9489// C++11 explicit conversion operators
9490def ext_explicit_conversion_functions : ExtWarn<
9491  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
9492def warn_cxx98_compat_explicit_conversion_functions : Warning<
9493  "explicit conversion functions are incompatible with C++98">,
9494  InGroup<CXX98Compat>, DefaultIgnore;
9495
9496// C++11 defaulted functions
9497def err_defaulted_special_member_params : Error<
9498  "an explicitly-defaulted %sub{select_special_member_kind}0 cannot "
9499  "have default arguments">;
9500def err_defaulted_special_member_variadic : Error<
9501  "an explicitly-defaulted %sub{select_special_member_kind}0 cannot "
9502  "be variadic">;
9503def err_defaulted_special_member_return_type : Error<
9504  "explicitly-defaulted %select{copy|move}0 assignment operator must "
9505  "return %1">;
9506def err_defaulted_special_member_quals : Error<
9507  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
9508  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
9509def err_defaulted_special_member_explicit_object_mismatch : Error<
9510  "the type of the explicit object parameter of an explicitly-defaulted "
9511  "%select{copy|move}0 assignment operator should match the type of the class %1">;
9512def err_defaulted_special_member_volatile_param : Error<
9513  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
9514  "may not be volatile">;
9515def err_defaulted_special_member_move_const_param : Error<
9516  "the parameter for an explicitly-defaulted move "
9517  "%select{constructor|assignment operator}0 may not be const">;
9518def err_defaulted_special_member_copy_const_param : Error<
9519  "the parameter for this explicitly-defaulted copy "
9520  "%select{constructor|assignment operator}0 is const, but a member or base "
9521  "requires it to be non-const">;
9522def err_defaulted_copy_assign_not_ref : Error<
9523  "the parameter for an explicitly-defaulted copy assignment operator must be an "
9524  "lvalue reference type">;
9525def err_incorrect_defaulted_constexpr : Error<
9526  "defaulted definition of %sub{select_special_member_kind}0 "
9527  "is not constexpr">;
9528def err_incorrect_defaulted_constexpr_with_vb: Error<
9529  "%sub{select_special_member_kind}0 cannot be 'constexpr' in a class with virtual base class">;
9530def err_incorrect_defaulted_consteval : Error<
9531  "defaulted declaration of %sub{select_special_member_kind}0 "
9532  "cannot be consteval because implicit definition is not constexpr">;
9533def warn_defaulted_method_deleted : Warning<
9534  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
9535  "deleted">, InGroup<DefaultedFunctionDeleted>;
9536def note_replace_equals_default_to_delete : Note<
9537  "replace 'default' with 'delete'">;
9538def err_out_of_line_default_deletes : Error<
9539  "defaulting this %sub{select_special_member_kind}0 "
9540  "would delete it after its first declaration">;
9541def note_deleted_type_mismatch : Note<
9542  "function is implicitly deleted because its declared type does not match "
9543  "the type of an implicit %sub{select_special_member_kind}0">;
9544def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
9545  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
9546  "different from the implicit type is incompatible with C++ standards before "
9547  "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9548def warn_vbase_moved_multiple_times : Warning<
9549  "defaulted move assignment operator of %0 will move assign virtual base "
9550  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
9551def note_vbase_moved_here : Note<
9552  "%select{%1 is a virtual base class of base class %2 declared here|"
9553  "virtual base class %1 declared here}0">;
9554
9555// C++20 defaulted comparisons
9556// This corresponds to values of Sema::DefaultedComparisonKind.
9557def select_defaulted_comparison_kind : TextSubstitution<
9558  "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
9559  "operator">;
9560def ext_defaulted_comparison : ExtWarn<
9561  "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
9562def warn_cxx17_compat_defaulted_comparison : Warning<
9563  "defaulted comparison operators are incompatible with C++ standards "
9564  "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9565def err_defaulted_comparison_template : Error<
9566  "comparison operator template cannot be defaulted">;
9567def err_defaulted_comparison_num_args : Error<
9568  "%select{non-member|member}0 %sub{select_defaulted_comparison_kind}1"
9569  " must have %select{2|1}0 parameters">;
9570def err_defaulted_comparison_param : Error<
9571  "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
9572  "; found %1, expected %2%select{| or %4}3">;
9573def err_defaulted_comparison_param_unknown : Error<
9574  "invalid parameter type for non-member defaulted"
9575  " %sub{select_defaulted_comparison_kind}0"
9576  "; found %1, expected class or reference to a constant class">;
9577def err_defaulted_comparison_param_mismatch : Error<
9578  "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
9579  "must have the same type%diff{ (found $ vs $)|}1,2">;
9580def err_defaulted_comparison_not_friend : Error<
9581  "%sub{select_defaulted_comparison_kind}0 is not a friend of"
9582  " %select{|incomplete class }1%2">;
9583def err_defaulted_comparison_non_const : Error<
9584  "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
9585  "const-qualified">;
9586def err_defaulted_comparison_return_type_not_bool : Error<
9587  "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9588  "must be 'bool', not %1">;
9589def err_defaulted_comparison_deduced_return_type_not_auto : Error<
9590  "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9591  "must be 'auto', not %1">;
9592def warn_defaulted_comparison_deleted : Warning<
9593  "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
9594  "deleted">, InGroup<DefaultedFunctionDeleted>;
9595def err_non_first_default_compare_deletes : Error<
9596  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
9597  "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
9598  "would delete it after its first declaration">;
9599def err_non_first_default_compare_in_class : Error<
9600  "defaulting this %sub{select_defaulted_comparison_kind}0 "
9601  "is not allowed because it was already declared outside the class">;
9602def note_defaulted_comparison_union : Note<
9603  "defaulted %0 is implicitly deleted because "
9604  "%2 is a %select{union-like class|union}1 with variant members">;
9605def note_defaulted_comparison_reference_member : Note<
9606  "defaulted %0 is implicitly deleted because "
9607  "class %1 has a reference member">;
9608def note_defaulted_comparison_ambiguous : Note<
9609  "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
9610  "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
9611def note_defaulted_comparison_inaccessible : Note<
9612  "defaulted %0 is implicitly deleted because it would invoke a "
9613  "%select{private|protected}3 %4%select{ member of %6|"
9614  " member of %6 to compare member %2| to compare base class %2}1">;
9615def note_defaulted_comparison_calls_deleted : Note<
9616  "defaulted %0 is implicitly deleted because it would invoke a deleted "
9617  "comparison function%select{| for member %2| for base class %2}1">;
9618def note_defaulted_comparison_no_viable_function : Note<
9619  "defaulted %0 is implicitly deleted because there is no viable "
9620  "%select{three-way comparison function|'operator=='}1 for "
9621  "%select{|member |base class }2%3">;
9622def note_defaulted_comparison_no_viable_function_synthesized : Note<
9623  "three-way comparison cannot be synthesized because there is no viable "
9624  "function for %select{'=='|'<'}0 comparison">;
9625def note_defaulted_comparison_not_rewritten_callee : Note<
9626  "defaulted %0 is implicitly deleted because this non-rewritten comparison "
9627  "function would be the best match for the comparison">;
9628def note_defaulted_comparison_not_rewritten_conversion : Note<
9629  "defaulted %0 is implicitly deleted because a builtin comparison function "
9630  "using this conversion would be the best match for the comparison">;
9631def note_defaulted_comparison_cannot_deduce : Note<
9632  "return type of defaulted 'operator<=>' cannot be deduced because "
9633  "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
9634  "is not a standard comparison category type">;
9635def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
9636  "return type of defaulted 'operator<=>' cannot be deduced because "
9637  "three-way comparison for %select{|member|base class}0 %1 "
9638  "has a deduced return type and is not yet defined">;
9639def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
9640  "%select{|member|base class}0 %1 declared here">;
9641def note_defaulted_comparison_cannot_deduce_callee : Note<
9642  "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
9643def ext_defaulted_comparison_constexpr_mismatch : Extension<
9644  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9645  "three-way comparison operator}0 that is "
9646  "declared %select{constexpr|consteval}2 but"
9647  "%select{|for which the corresponding implicit 'operator==' }0 "
9648  "invokes a non-constexpr comparison function is a C++23 extension">,
9649  InGroup<DiagGroup<"c++23-default-comp-relaxed-constexpr">>;
9650def warn_cxx23_compat_defaulted_comparison_constexpr_mismatch : Warning<
9651  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9652  "three-way comparison operator}0 that is "
9653  "declared %select{constexpr|consteval}2 but"
9654  "%select{|for which the corresponding implicit 'operator==' }0 "
9655  "invokes a non-constexpr comparison function is incompatible with C++ "
9656  "standards before C++23">,
9657  InGroup<CXXPre23Compat>, DefaultIgnore;
9658def note_defaulted_comparison_not_constexpr : Note<
9659  "non-constexpr comparison function would be used to compare "
9660  "%select{|member %1|base class %1}0">;
9661def note_defaulted_comparison_not_constexpr_here : Note<
9662  "non-constexpr comparison function declared here">;
9663def note_in_declaration_of_implicit_equality_comparison : Note<
9664  "while declaring the corresponding implicit 'operator==' "
9665  "for this defaulted 'operator<=>'">;
9666def err_volatile_comparison_operator : Error<
9667  "defaulted comparison function must not be volatile">;
9668def err_ref_qualifier_comparison_operator : Error<
9669  "ref-qualifier '&&' is not allowed on a defaulted comparison operator">;
9670
9671def ext_implicit_exception_spec_mismatch : ExtWarn<
9672  "function previously declared with an %select{explicit|implicit}0 exception "
9673  "specification redeclared with an %select{implicit|explicit}0 exception "
9674  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
9675
9676def warn_ptr_arith_precedes_bounds : Warning<
9677  "the pointer decremented by %0 refers before the beginning of the array">,
9678  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9679def warn_ptr_arith_exceeds_bounds : Warning<
9680  "the pointer incremented by %0 refers past the end of the array (that has type %1)">,
9681  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9682def warn_array_index_precedes_bounds : Warning<
9683  "array index %0 is before the beginning of the array">,
9684  InGroup<ArrayBounds>;
9685def warn_array_index_exceeds_bounds : Warning<
9686  "array index %0 is past the end of the array (that has type %1%select{|, cast to %3}2)">,
9687  InGroup<ArrayBounds>;
9688def warn_ptr_arith_exceeds_max_addressable_bounds : Warning<
9689  "the pointer incremented by %0 refers past the last possible element for an array in %1-bit "
9690  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9691  InGroup<ArrayBounds>;
9692def warn_array_index_exceeds_max_addressable_bounds : Warning<
9693  "array index %0 refers past the last possible element for an array in %1-bit "
9694  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9695  InGroup<ArrayBounds>;
9696def note_array_declared_here : Note<
9697  "array %0 declared here">;
9698
9699def warn_inconsistent_array_form : Warning<
9700  "argument %0 of type %1 with mismatched bound">,
9701  InGroup<ArrayParameter>, DefaultIgnore;
9702def note_previous_declaration_as : Note<
9703  "previously declared as %0 here">;
9704
9705def warn_printf_insufficient_data_args : Warning<
9706  "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
9707def warn_printf_data_arg_not_used : Warning<
9708  "data argument not used by format string">, InGroup<FormatExtraArgs>;
9709def warn_format_invalid_conversion : Warning<
9710  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
9711def warn_printf_incomplete_specifier : Warning<
9712  "incomplete format specifier">, InGroup<Format>;
9713def warn_missing_format_string : Warning<
9714  "format string missing">, InGroup<Format>;
9715def warn_scanf_nonzero_width : Warning<
9716  "zero field width in scanf format string is unused">,
9717  InGroup<Format>;
9718def warn_format_conversion_argument_type_mismatch : Warning<
9719  "format specifies type %0 but the argument has "
9720  "%select{type|underlying type}2 %1">,
9721  InGroup<Format>;
9722def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
9723  warn_format_conversion_argument_type_mismatch.Summary>,
9724  InGroup<FormatPedantic>;
9725def warn_format_conversion_argument_type_mismatch_confusion : Warning<
9726  warn_format_conversion_argument_type_mismatch.Summary>,
9727  InGroup<FormatTypeConfusion>, DefaultIgnore;
9728def warn_format_argument_needs_cast : Warning<
9729  "%select{values of type|enum values with underlying type}2 '%0' should not "
9730  "be used as format arguments; add an explicit cast to %1 instead">,
9731  InGroup<Format>;
9732def warn_format_argument_needs_cast_pedantic : Warning<
9733  warn_format_argument_needs_cast.Summary>,
9734  InGroup<FormatPedantic>, DefaultIgnore;
9735def warn_printf_positional_arg_exceeds_data_args : Warning <
9736  "data argument position '%0' exceeds the number of data arguments (%1)">,
9737  InGroup<Format>;
9738def warn_format_zero_positional_specifier : Warning<
9739  "position arguments in format strings start counting at 1 (not 0)">,
9740  InGroup<Format>;
9741def warn_format_invalid_positional_specifier : Warning<
9742  "invalid position specified for %select{field width|field precision}0">,
9743  InGroup<Format>;
9744def warn_format_mix_positional_nonpositional_args : Warning<
9745  "cannot mix positional and non-positional arguments in format string">,
9746  InGroup<Format>;
9747def warn_static_array_too_small : Warning<
9748  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
9749  " callee requires at least %1">,
9750  InGroup<ArrayBounds>;
9751def note_callee_static_array : Note<
9752  "callee declares array parameter as static here">;
9753def warn_empty_format_string : Warning<
9754  "format string is empty">, InGroup<FormatZeroLength>;
9755def warn_format_string_is_wide_literal : Warning<
9756  "format string should not be a wide string">, InGroup<Format>;
9757def warn_printf_format_string_contains_null_char : Warning<
9758  "format string contains '\\0' within the string body">, InGroup<Format>;
9759def warn_printf_format_string_not_null_terminated : Warning<
9760  "format string is not null-terminated">, InGroup<Format>;
9761def warn_printf_asterisk_missing_arg : Warning<
9762  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
9763  InGroup<Format>;
9764def warn_printf_asterisk_wrong_type : Warning<
9765  "field %select{width|precision}0 should have type %1, but argument has type %2">,
9766  InGroup<Format>;
9767def warn_printf_nonsensical_optional_amount: Warning<
9768  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
9769  InGroup<Format>;
9770def warn_printf_nonsensical_flag: Warning<
9771  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
9772  InGroup<Format>;
9773def warn_format_nonsensical_length: Warning<
9774  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
9775  InGroup<Format>;
9776def warn_format_non_standard_positional_arg: Warning<
9777  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
9778def warn_format_non_standard: Warning<
9779  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
9780  InGroup<FormatNonStandard>, DefaultIgnore;
9781def warn_format_non_standard_conversion_spec: Warning<
9782  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
9783  InGroup<FormatNonStandard>, DefaultIgnore;
9784def err_invalid_mask_type_size : Error<
9785  "mask type size must be between 1-byte and 8-bytes">;
9786def warn_format_invalid_annotation : Warning<
9787  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
9788  InGroup<Format>;
9789def warn_format_P_no_precision : Warning<
9790  "using '%%P' format specifier without precision">,
9791  InGroup<Format>;
9792def warn_printf_ignored_flag: Warning<
9793  "flag '%0' is ignored when flag '%1' is present">,
9794  InGroup<Format>;
9795def warn_printf_empty_objc_flag: Warning<
9796  "missing object format flag">,
9797  InGroup<Format>;
9798def warn_printf_ObjCflags_without_ObjCConversion: Warning<
9799  "object format flags cannot be used with '%0' conversion specifier">,
9800  InGroup<Format>;
9801def warn_printf_invalid_objc_flag: Warning<
9802    "'%0' is not a valid object format flag">,
9803    InGroup<Format>;
9804def warn_printf_narg_not_supported : Warning<
9805    "'%%n' specifier not supported on this platform">,
9806    InGroup<Format>;
9807def warn_scanf_scanlist_incomplete : Warning<
9808  "no closing ']' for '%%[' in scanf format string">,
9809  InGroup<Format>;
9810def warn_format_bool_as_character : Warning<
9811  "using '%0' format specifier, but argument has boolean value">,
9812  InGroup<Format>;
9813def note_format_string_defined : Note<"format string is defined here">;
9814def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
9815def note_printf_c_str: Note<"did you mean to call the %0 method?">;
9816def note_format_security_fixit: Note<
9817  "treat the string as an argument to avoid this">;
9818
9819def warn_null_arg : Warning<
9820  "null passed to a callee that requires a non-null argument">,
9821  InGroup<NonNull>;
9822def warn_null_ret : Warning<
9823  "null returned from %select{function|method}0 that requires a non-null return value">,
9824  InGroup<NonNull>;
9825
9826def err_lifetimebound_no_object_param : Error<
9827  "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
9828  "function has no implicit object parameter">;
9829def err_lifetimebound_ctor_dtor : Error<
9830  "'lifetimebound' attribute cannot be applied to a "
9831  "%select{constructor|destructor}0">;
9832
9833// CHECK: returning address/reference of stack memory
9834def warn_ret_stack_addr_ref : Warning<
9835  "%select{address of|reference to}0 stack memory associated with "
9836  "%select{local variable|parameter}2 %1 returned">,
9837  InGroup<ReturnStackAddress>;
9838def warn_ret_local_temp_addr_ref : Warning<
9839  "returning %select{address of|reference to}0 local temporary object">,
9840  InGroup<ReturnStackAddress>;
9841def warn_ret_addr_label : Warning<
9842  "returning address of label, which is local">,
9843  InGroup<ReturnStackAddress>;
9844def err_ret_local_block : Error<
9845  "returning block that lives on the local stack">;
9846def note_local_var_initializer : Note<
9847  "%select{via initialization of|binding reference}0 variable "
9848  "%select{%2 |}1here">;
9849def note_lambda_capture_initializer : Note<
9850  "%select{implicitly |}2captured%select{| by reference}3"
9851  "%select{%select{ due to use|}2 here|"
9852  " via initialization of lambda capture %0}1">;
9853def note_init_with_default_member_initializer : Note<
9854  "initializing field %0 with default member initializer">;
9855
9856// Check for initializing a member variable with the address or a reference to
9857// a constructor parameter.
9858def warn_bind_ref_member_to_parameter : Warning<
9859  "binding reference member %0 to stack allocated "
9860  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9861def warn_init_ptr_member_to_parameter_addr : Warning<
9862  "initializing pointer member %0 with the stack address of "
9863  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9864def note_ref_or_ptr_member_declared_here : Note<
9865  "%select{reference|pointer}0 member declared here">;
9866
9867def err_dangling_member : Error<
9868  "%select{reference|backing array for 'std::initializer_list'}2 "
9869  "%select{|subobject of }1member %0 "
9870  "%select{binds to|is}2 a temporary object "
9871  "whose lifetime would be shorter than the lifetime of "
9872  "the constructed object">;
9873def warn_dangling_member : Warning<
9874  "%select{reference|backing array for 'std::initializer_list'}2 "
9875  "%select{|subobject of }1member %0 "
9876  "%select{binds to|is}2 a temporary object "
9877  "whose lifetime is shorter than the lifetime of the constructed object">,
9878  InGroup<DanglingField>;
9879def warn_dangling_lifetime_pointer_member : Warning<
9880  "initializing pointer member %0 to point to a temporary object "
9881  "whose lifetime is shorter than the lifetime of the constructed object">,
9882  InGroup<DanglingGsl>;
9883def note_lifetime_extending_member_declared_here : Note<
9884  "%select{%select{reference|'std::initializer_list'}0 member|"
9885  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
9886  "declared here">;
9887def warn_dangling_variable : Warning<
9888  "%select{temporary %select{whose address is used as value of|"
9889  "%select{|implicitly }2bound to}4 "
9890  "%select{%select{|reference }4member of local variable|"
9891  "local %select{variable|reference}4}1|"
9892  "array backing "
9893  "%select{initializer list subobject of local variable|"
9894  "local initializer list}1}0 "
9895  "%select{%3 |}2will be destroyed at the end of the full-expression">,
9896  InGroup<Dangling>;
9897def warn_new_dangling_reference : Warning<
9898  "temporary bound to reference member of allocated object "
9899  "will be destroyed at the end of the full-expression">,
9900  InGroup<DanglingField>;
9901def warn_dangling_lifetime_pointer : Warning<
9902  "object backing the pointer "
9903  "will be destroyed at the end of the full-expression">,
9904  InGroup<DanglingGsl>;
9905def warn_new_dangling_initializer_list : Warning<
9906  "array backing "
9907  "%select{initializer list subobject of the allocated object|"
9908  "the allocated initializer list}0 "
9909  "will be destroyed at the end of the full-expression">,
9910  InGroup<DanglingInitializerList>;
9911def warn_unsupported_lifetime_extension : Warning<
9912  "sorry, lifetime extension of "
9913  "%select{temporary|backing array of initializer list}0 created "
9914  "by aggregate initialization using default member initializer "
9915  "is not supported; lifetime of %select{temporary|backing array}0 "
9916  "will end at the end of the full-expression">, InGroup<Dangling>;
9917
9918// For non-floating point, expressions of the form x == x or x != x
9919// should result in a warning, since these always evaluate to a constant.
9920// Array comparisons have similar warnings
9921def warn_comparison_always : Warning<
9922  "%select{self-|array }0comparison always evaluates to "
9923  "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9924  InGroup<TautologicalCompare>;
9925def warn_comparison_bitwise_always : Warning<
9926  "bitwise comparison always evaluates to %select{false|true}0">,
9927  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9928def warn_comparison_bitwise_or : Warning<
9929  "bitwise or with non-zero value always evaluates to true">,
9930  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9931def warn_tautological_negation_and_compare: Warning<
9932  "'&&' of a value and its negation always evaluates to false">,
9933  InGroup<TautologicalNegationCompare>, DefaultIgnore;
9934def warn_tautological_negation_or_compare: Warning<
9935  "'||' of a value and its negation always evaluates to true">,
9936  InGroup<TautologicalNegationCompare>, DefaultIgnore;
9937def warn_tautological_overlap_comparison : Warning<
9938  "overlapping comparisons always evaluate to %select{false|true}0">,
9939  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9940def warn_depr_array_comparison : Warning<
9941  "comparison between two arrays is deprecated; "
9942  "to compare array addresses, use unary '+' to decay operands to pointers">,
9943  InGroup<DeprecatedArrayCompare>;
9944
9945def warn_stringcompare : Warning<
9946  "result of comparison against %select{a string literal|@encode}0 is "
9947  "unspecified (use an explicit string comparison function instead)">,
9948  InGroup<StringCompare>;
9949
9950def warn_identity_field_assign : Warning<
9951  "assigning %select{field|instance variable}0 to itself">,
9952  InGroup<SelfAssignmentField>;
9953
9954// Type safety attributes
9955def err_type_tag_for_datatype_not_ice : Error<
9956  "'type_tag_for_datatype' attribute requires the initializer to be "
9957  "an %select{integer|integral}0 constant expression">;
9958def err_type_tag_for_datatype_too_large : Error<
9959  "'type_tag_for_datatype' attribute requires the initializer to be "
9960  "an %select{integer|integral}0 constant expression "
9961  "that can be represented by a 64 bit integer">;
9962def err_tag_index_out_of_range : Error<
9963  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
9964def warn_type_tag_for_datatype_wrong_kind : Warning<
9965  "this type tag was not designed to be used with this function">,
9966  InGroup<TypeSafety>;
9967def warn_type_safety_type_mismatch : Warning<
9968  "argument type %0 doesn't match specified %1 type tag "
9969  "%select{that requires %3|}2">, InGroup<TypeSafety>;
9970def warn_type_safety_null_pointer_required : Warning<
9971  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
9972
9973// Generic selections.
9974def err_assoc_type_incomplete : Error<
9975  "type %0 in generic association incomplete">;
9976def err_assoc_type_nonobject : Error<
9977  "type %0 in generic association not an object type">;
9978def err_assoc_type_variably_modified : Error<
9979  "type %0 in generic association is a variably modified type">;
9980def err_assoc_compatible_types : Error<
9981  "type %0 in generic association compatible with previously specified type %1">;
9982def note_compat_assoc : Note<
9983  "compatible type %0 specified here">;
9984def err_generic_sel_no_match : Error<
9985  "controlling expression type %0 not compatible with any generic association type">;
9986def err_generic_sel_multi_match : Error<
9987  "controlling expression type %0 compatible with %1 generic association types">;
9988
9989
9990// Blocks
9991def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
9992  " or %select{pick a deployment target that supports them|for OpenCL C 2.0"
9993  " or OpenCL C 3.0 with __opencl_c_device_enqueue feature}0">;
9994def err_block_returning_array_function : Error<
9995  "block cannot return %select{array|function}0 type %1">;
9996
9997// Builtin annotation
9998def err_builtin_annotation_first_arg : Error<
9999  "first argument to __builtin_annotation must be an integer">;
10000def err_builtin_annotation_second_arg : Error<
10001  "second argument to __builtin_annotation must be a non-wide string constant">;
10002def err_msvc_annotation_wide_str : Error<
10003  "arguments to __annotation must be wide string constants">;
10004
10005// CFString checking
10006def err_cfstring_literal_not_string_constant : Error<
10007  "CFString literal is not a string constant">;
10008def warn_cfstring_truncated : Warning<
10009  "input conversion stopped due to an input byte that does not "
10010  "belong to the input codeset UTF-8">,
10011  InGroup<DiagGroup<"CFString-literal">>;
10012
10013// os_log checking
10014// TODO: separate diagnostic for os_trace()
10015def err_os_log_format_not_string_constant : Error<
10016  "os_log() format argument is not a string constant">;
10017def err_os_log_argument_too_big : Error<
10018  "os_log() argument %0 is too big (%1 bytes, max %2)">;
10019def warn_os_log_format_narg : Error<
10020 "os_log() '%%n' format specifier is not allowed">, DefaultError;
10021
10022// Statements.
10023def err_continue_not_in_loop : Error<
10024  "'continue' statement not in loop statement">;
10025def err_break_not_in_loop_or_switch : Error<
10026  "'break' statement not in loop or switch statement">;
10027def warn_loop_ctrl_binds_to_inner : Warning<
10028  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
10029  InGroup<GccCompat>;
10030def err_omp_bind_required_on_loop : Error<
10031  "expected 'bind' clause for 'loop' construct without an enclosing OpenMP "
10032  "construct">;
10033def err_omp_loop_reduction_clause : Error<
10034  "'reduction' clause not allowed with '#pragma omp loop bind(teams)'">;
10035def warn_break_binds_to_switch : Warning<
10036  "'break' is bound to loop, GCC binds it to switch">,
10037  InGroup<GccCompat>;
10038def err_default_not_in_switch : Error<
10039  "'default' statement not in switch statement">;
10040def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
10041def warn_bool_switch_condition : Warning<
10042  "switch condition has boolean value">, InGroup<SwitchBool>;
10043def warn_case_value_overflow : Warning<
10044  "overflow converting case value to switch condition type (%0 to %1)">,
10045  InGroup<Switch>;
10046def err_duplicate_case : Error<"duplicate case value '%0'">;
10047def err_duplicate_case_differing_expr : Error<
10048  "duplicate case value: '%0' and '%1' both equal '%2'">;
10049def warn_case_empty_range : Warning<"empty case range specified">;
10050def warn_missing_case_for_condition :
10051  Warning<"no case matching constant switch condition '%0'">;
10052def err_loop_attr_conflict : Error<
10053  "conflicting loop attribute %0">;
10054def err_attribute_power_of_two_in_range : Error<
10055  "%0 attribute requires an integer argument which is a constant power of two "
10056  "between %1 and %2 inclusive; provided argument was %3">;
10057
10058def warn_def_missing_case : Warning<"%plural{"
10059  "1:enumeration value %1 not explicitly handled in switch|"
10060  "2:enumeration values %1 and %2 not explicitly handled in switch|"
10061  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
10062  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
10063  InGroup<SwitchEnum>, DefaultIgnore;
10064
10065def warn_missing_case : Warning<"%plural{"
10066  "1:enumeration value %1 not handled in switch|"
10067  "2:enumeration values %1 and %2 not handled in switch|"
10068  "3:enumeration values %1, %2, and %3 not handled in switch|"
10069  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
10070  InGroup<Switch>;
10071def warn_switch_default : Warning<"'switch' missing 'default' label">,
10072  InGroup<SwitchDefault>, DefaultIgnore;
10073
10074def warn_unannotated_fallthrough : Warning<
10075  "unannotated fall-through between switch labels">,
10076  InGroup<ImplicitFallthrough>, DefaultIgnore;
10077def warn_unannotated_fallthrough_per_function : Warning<
10078  "unannotated fall-through between switch labels in partly-annotated "
10079  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
10080def note_insert_fallthrough_fixit : Note<
10081  "insert '%0;' to silence this warning">;
10082def note_insert_break_fixit : Note<
10083  "insert 'break;' to avoid fall-through">;
10084def err_fallthrough_attr_wrong_target : Error<
10085  "%0 attribute is only allowed on empty statements">;
10086def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
10087def err_fallthrough_attr_outside_switch : Error<
10088  "fallthrough annotation is outside switch statement">;
10089def err_fallthrough_attr_invalid_placement : Error<
10090  "fallthrough annotation does not directly precede switch label">;
10091
10092def warn_unreachable_default : Warning<
10093  "default label in switch which covers all enumeration values">,
10094  InGroup<CoveredSwitchDefault>, DefaultIgnore;
10095def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
10096  InGroup<Switch>;
10097def warn_not_in_enum_assignment : Warning<"integer constant not in range "
10098  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
10099def err_typecheck_statement_requires_scalar : Error<
10100  "statement requires expression of scalar type (%0 invalid)">;
10101def err_typecheck_statement_requires_integer : Error<
10102  "statement requires expression of integer type (%0 invalid)">;
10103def err_multiple_default_labels_defined : Error<
10104  "multiple default labels in one switch">;
10105def err_switch_multiple_conversions : Error<
10106  "multiple conversions from switch condition type %0 to an integral or "
10107  "enumeration type">;
10108def note_switch_conversion : Note<
10109  "conversion to %select{integral|enumeration}0 type %1">;
10110def err_switch_explicit_conversion : Error<
10111  "switch condition type %0 requires explicit conversion to %1">;
10112def err_switch_incomplete_class_type : Error<
10113  "switch condition has incomplete class type %0">;
10114
10115def warn_empty_if_body : Warning<
10116  "if statement has empty body">, InGroup<EmptyBody>;
10117def warn_empty_for_body : Warning<
10118  "for loop has empty body">, InGroup<EmptyBody>;
10119def warn_empty_range_based_for_body : Warning<
10120  "range-based for loop has empty body">, InGroup<EmptyBody>;
10121def warn_empty_while_body : Warning<
10122  "while loop has empty body">, InGroup<EmptyBody>;
10123def warn_empty_switch_body : Warning<
10124  "switch statement has empty body">, InGroup<EmptyBody>;
10125def note_empty_body_on_separate_line : Note<
10126  "put the semicolon on a separate line to silence this warning">;
10127
10128def err_va_start_captured_stmt : Error<
10129  "'va_start' cannot be used in a captured statement">;
10130def err_va_start_outside_function : Error<
10131  "'va_start' cannot be used outside a function">;
10132def err_va_start_fixed_function : Error<
10133  "'va_start' used in function with fixed args">;
10134def err_va_start_used_in_wrong_abi_function : Error<
10135  "'va_start' used in %select{System V|Win64}0 ABI function">;
10136def err_ms_va_start_used_in_sysv_function : Error<
10137  "'__builtin_ms_va_start' used in System V ABI function">;
10138def warn_second_arg_of_va_start_not_last_named_param : Warning<
10139  "second argument to 'va_start' is not the last named parameter">,
10140  InGroup<Varargs>;
10141def warn_c17_compat_ellipsis_only_parameter : Warning<
10142  "'...' as the only parameter of a function is incompatible with C standards "
10143  "before C23">, DefaultIgnore, InGroup<CPre23Compat>;
10144def warn_va_start_type_is_undefined : Warning<
10145  "passing %select{an object that undergoes default argument promotion|"
10146  "an object of reference type|a parameter declared with the 'register' "
10147  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
10148def err_first_argument_to_va_arg_not_of_type_va_list : Error<
10149  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
10150def err_second_parameter_to_va_arg_incomplete: Error<
10151  "second argument to 'va_arg' is of incomplete type %0">;
10152def err_second_parameter_to_va_arg_abstract: Error<
10153  "second argument to 'va_arg' is of abstract type %0">;
10154def warn_second_parameter_to_va_arg_not_pod : Warning<
10155  "second argument to 'va_arg' is of non-POD type %0">,
10156  InGroup<NonPODVarargs>, DefaultError;
10157def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
10158  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
10159  InGroup<NonPODVarargs>, DefaultError;
10160def warn_second_parameter_to_va_arg_never_compatible : Warning<
10161  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
10162  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
10163
10164def warn_return_missing_expr : Warning<
10165  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
10166  InGroup<ReturnType>;
10167def ext_return_missing_expr : ExtWarn<
10168  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
10169  InGroup<ReturnType>;
10170def ext_return_has_expr : ExtWarn<
10171  "%select{void function|void method|constructor|destructor}1 %0 "
10172  "should not return a value">,
10173  DefaultError, InGroup<ReturnType>;
10174def ext_return_has_void_expr : Extension<
10175  "void %select{function|method|block}1 %0 should not return void expression">;
10176def err_return_init_list : Error<
10177  "%select{void function|void method|constructor|destructor}1 %0 "
10178  "must not return a value">;
10179def err_ctor_dtor_returns_void : Error<
10180  "%select{constructor|destructor}1 %0 must not return void expression">;
10181def warn_noreturn_function_has_return_expr : Warning<
10182  "function %0 declared 'noreturn' should not return">,
10183  InGroup<InvalidNoreturn>;
10184def warn_falloff_noreturn_function : Warning<
10185  "function declared 'noreturn' should not return">,
10186  InGroup<InvalidNoreturn>;
10187def err_noreturn_block_has_return_expr : Error<
10188  "block declared 'noreturn' should not return">;
10189def err_carries_dependency_missing_on_first_decl : Error<
10190  "%select{function|parameter}0 declared '[[carries_dependency]]' "
10191  "after its first declaration">;
10192def note_carries_dependency_missing_first_decl : Note<
10193  "declaration missing '[[carries_dependency]]' attribute is here">;
10194def err_carries_dependency_param_not_function_decl : Error<
10195  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
10196  "declaration or lambda">;
10197def err_block_on_nonlocal : Error<
10198  "__block attribute not allowed, only allowed on local variables">;
10199def err_block_on_vm : Error<
10200  "__block attribute not allowed on declaration with a variably modified type">;
10201def err_sizeless_nonlocal : Error<
10202  "non-local variable with sizeless type %0">;
10203
10204def err_vec_builtin_non_vector : Error<
10205 "first two arguments to %0 must be vectors">;
10206def err_vec_builtin_incompatible_vector : Error<
10207  "first two arguments to %0 must have the same type">;
10208def err_vsx_builtin_nonconstant_argument : Error<
10209  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
10210
10211def err_shufflevector_nonconstant_argument : Error<
10212  "index for __builtin_shufflevector must be a constant integer">;
10213def err_shufflevector_argument_too_large : Error<
10214  "index for __builtin_shufflevector must be less than the total number "
10215  "of vector elements">;
10216
10217def err_convertvector_non_vector : Error<
10218  "first argument to __builtin_convertvector must be a vector">;
10219def err_builtin_non_vector_type : Error<
10220  "%0 argument to %1 must be of vector type">;
10221def err_convertvector_incompatible_vector : Error<
10222  "first two arguments to __builtin_convertvector must have the same number of elements">;
10223
10224def err_first_argument_to_cwsc_not_call : Error<
10225  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
10226def err_first_argument_to_cwsc_block_call : Error<
10227  "first argument to __builtin_call_with_static_chain must not be a block call">;
10228def err_first_argument_to_cwsc_builtin_call : Error<
10229  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
10230def err_first_argument_to_cwsc_pdtor_call : Error<
10231  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
10232def err_second_argument_to_cwsc_not_pointer : Error<
10233  "second argument to __builtin_call_with_static_chain must be of pointer type">;
10234
10235def err_vector_incorrect_num_initializers : Error<
10236  "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
10237def err_altivec_empty_initializer : Error<"expected initializer">;
10238
10239def err_invalid_neon_type_code : Error<
10240  "incompatible constant for this __builtin_neon function">;
10241def err_argument_invalid_range : Error<
10242  "argument value %0 is outside the valid range [%1, %2]">;
10243def warn_argument_invalid_range : Warning<
10244  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
10245  InGroup<DiagGroup<"argument-outside-range">>;
10246def warn_argument_undefined_behaviour : Warning<
10247  "argument value %0 will result in undefined behaviour">,
10248  InGroup<DiagGroup<"argument-undefined-behaviour">>;
10249def err_argument_not_multiple : Error<
10250  "argument should be a multiple of %0">;
10251def err_argument_not_power_of_2 : Error<
10252  "argument should be a power of 2">;
10253def err_argument_not_shifted_byte : Error<
10254  "argument should be an 8-bit value shifted by a multiple of 8 bits">;
10255def err_argument_not_shifted_byte_or_xxff : Error<
10256  "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
10257def err_argument_not_contiguous_bit_field : Error<
10258  "argument %0 value should represent a contiguous bit field">;
10259def err_rotation_argument_to_cadd : Error<
10260  "argument should be the value 90 or 270">;
10261def err_rotation_argument_to_cmla : Error<
10262  "argument should be the value 0, 90, 180 or 270">;
10263def warn_neon_vector_initializer_non_portable : Warning<
10264  "vector initializers are not compatible with NEON intrinsics in big endian "
10265  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
10266def note_neon_vector_initializer_non_portable : Note<
10267  "consider using vld1_%0%1() to initialize a vector from memory, or "
10268  "vcreate_%0%1() to initialize from an integer constant">;
10269def note_neon_vector_initializer_non_portable_q : Note<
10270  "consider using vld1q_%0%1() to initialize a vector from memory, or "
10271  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
10272  "constants">;
10273def err_systemz_invalid_tabort_code : Error<
10274  "invalid transaction abort code">;
10275def err_64_bit_builtin_32_bit_tgt : Error<
10276  "this builtin is only available on 64-bit targets">;
10277def err_32_bit_builtin_64_bit_tgt : Error<
10278  "this builtin is only available on 32-bit targets">;
10279def err_builtin_x64_aarch64_only : Error<
10280  "this builtin is only available on x86-64 and aarch64 targets">;
10281def err_mips_builtin_requires_dsp : Error<
10282  "this builtin requires 'dsp' ASE, please use -mdsp">;
10283def err_mips_builtin_requires_dspr2 : Error<
10284  "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
10285def err_mips_builtin_requires_msa : Error<
10286  "this builtin requires 'msa' ASE, please use -mmsa">;
10287def err_ppc_builtin_requires_abi : Error<
10288  "this builtin requires ABI -mabi=%0">;
10289def err_ppc_invalid_use_mma_type : Error<
10290  "invalid use of PPC MMA type">;
10291def err_ppc_invalid_test_data_class_type : Error<
10292  "expected a 'float', 'double' or '__float128' for the first argument">;
10293def err_x86_builtin_invalid_rounding : Error<
10294  "invalid rounding argument">;
10295def err_x86_builtin_invalid_scale : Error<
10296  "scale argument must be 1, 2, 4, or 8">;
10297def err_x86_builtin_tile_arg_duplicate : Error<
10298  "tile arguments must refer to different tiles">;
10299
10300def err_builtin_target_unsupported : Error<
10301  "builtin is not supported on this target">;
10302def err_builtin_longjmp_unsupported : Error<
10303  "__builtin_longjmp is not supported for the current target">;
10304def err_builtin_setjmp_unsupported : Error<
10305  "__builtin_setjmp is not supported for the current target">;
10306
10307def err_builtin_longjmp_invalid_val : Error<
10308  "argument to __builtin_longjmp must be a constant 1">;
10309def err_builtin_requires_language : Error<"'%0' is only available in %1">;
10310
10311def err_constant_integer_arg_type : Error<
10312  "argument to %0 must be a constant integer">;
10313
10314def ext_mixed_decls_code : Extension<
10315  "mixing declarations and code is a C99 extension">,
10316  InGroup<DeclarationAfterStatement>;
10317def warn_mixed_decls_code : Warning<
10318  "mixing declarations and code is incompatible with standards before C99">,
10319  InGroup<DeclarationAfterStatement>, DefaultIgnore;
10320
10321def err_non_local_variable_decl_in_for : Error<
10322  "declaration of non-local variable in 'for' loop">;
10323def err_non_variable_decl_in_for : Error<
10324  "non-variable declaration in 'for' loop">;
10325def err_toomany_element_decls : Error<
10326  "only one element declaration is allowed">;
10327def err_selector_element_not_lvalue : Error<
10328  "selector element is not a valid lvalue">;
10329def err_selector_element_type : Error<
10330  "selector element type %0 is not a valid object">;
10331def err_selector_element_const_type : Error<
10332  "selector element of type %0 cannot be a constant lvalue expression">;
10333def err_collection_expr_type : Error<
10334  "the type %0 is not a pointer to a fast-enumerable object">;
10335def warn_collection_expr_type : Warning<
10336  "collection expression type %0 may not respond to %1">;
10337
10338def err_invalid_conversion_between_ext_vectors : Error<
10339  "invalid conversion between ext-vector type %0 and %1">;
10340
10341def warn_duplicate_attribute_exact : Warning<
10342  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
10343
10344def warn_duplicate_attribute : Warning<
10345  "attribute %0 is already applied with different arguments">,
10346  InGroup<IgnoredAttributes>;
10347def err_disallowed_duplicate_attribute : Error<
10348  "attribute %0 cannot appear more than once on a declaration">;
10349
10350def warn_sync_fetch_and_nand_semantics_change : Warning<
10351  "the semantics of this intrinsic changed with GCC "
10352  "version 4.4 - the newer semantics are provided here">,
10353  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
10354
10355// Type
10356def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
10357  InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
10358def warn_receiver_forward_class : Warning<
10359  "receiver %0 is a forward class and corresponding @interface may not exist">,
10360  InGroup<ForwardClassReceiver>;
10361def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
10362def ext_missing_type_specifier : ExtWarn<
10363  "type specifier missing, defaults to 'int'; ISO C99 and later do not support "
10364  "implicit int">, InGroup<ImplicitInt>;
10365def err_missing_type_specifier : Error<
10366  "a type specifier is required for all declarations">;
10367def err_decimal_unsupported : Error<
10368  "GNU decimal type extension not supported">;
10369def err_objc_array_of_interfaces : Error<
10370  "array of interface %0 is invalid (probably should be an array of pointers)">;
10371def ext_c99_array_usage : Extension<
10372  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10373  "feature">, InGroup<C99>;
10374def err_c99_array_usage_cxx : Error<
10375  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10376  "feature, not permitted in C++">;
10377def err_type_unsupported : Error<
10378  "%0 is not supported on this target">;
10379def err_nsconsumed_attribute_mismatch : Error<
10380  "overriding method has mismatched ns_consumed attribute on its"
10381  " parameter">;
10382def err_nsreturns_retained_attribute_mismatch : Error<
10383  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
10384  " attributes">;
10385def err_nserrordomain_invalid_decl : Error<
10386  "domain argument %select{|%1 }0does not refer to global constant">;
10387def err_nserrordomain_wrong_type : Error<
10388  "domain argument %0 does not point to an NSString or CFString constant">;
10389
10390def warn_nsconsumed_attribute_mismatch : Warning<
10391  err_nsconsumed_attribute_mismatch.Summary>, InGroup<NSConsumedMismatch>;
10392def warn_nsreturns_retained_attribute_mismatch : Warning<
10393  err_nsreturns_retained_attribute_mismatch.Summary>, InGroup<NSReturnsMismatch>;
10394
10395def note_getter_unavailable : Note<
10396  "or because setter is declared here, but no getter method %0 is found">;
10397def err_invalid_protocol_qualifiers : Error<
10398  "invalid protocol qualifiers on non-ObjC type">;
10399def warn_ivar_use_hidden : Warning<
10400  "local declaration of %0 hides instance variable">,
10401   InGroup<ShadowIvar>;
10402def warn_direct_initialize_call : Warning<
10403  "explicit call to +initialize results in duplicate call to +initialize">,
10404   InGroup<ExplicitInitializeCall>;
10405def warn_direct_super_initialize_call : Warning<
10406  "explicit call to [super initialize] should only be in implementation "
10407  "of +initialize">,
10408   InGroup<ExplicitInitializeCall>;
10409def err_ivar_use_in_class_method : Error<
10410  "instance variable %0 accessed in class method">;
10411def err_private_ivar_access : Error<"instance variable %0 is private">,
10412  AccessControl;
10413def err_protected_ivar_access : Error<"instance variable %0 is protected">,
10414  AccessControl;
10415def warn_maynot_respond : Warning<"%0 may not respond to %1">;
10416def ext_typecheck_base_super : Warning<
10417  "method parameter type "
10418  "%diff{$ does not match super class method parameter type $|"
10419  "does not match super class method parameter type}0,1">,
10420   InGroup<SuperSubClassMismatch>, DefaultIgnore;
10421def warn_missing_method_return_type : Warning<
10422  "method has no return type specified; defaults to 'id'">,
10423  InGroup<MissingMethodReturnType>, DefaultIgnore;
10424def warn_direct_ivar_access : Warning<"instance variable %0 is being "
10425  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
10426
10427// Spell-checking diagnostics
10428def err_unknown_typename : Error<
10429  "unknown type name %0">;
10430def err_unknown_type_or_class_name_suggest : Error<
10431  "unknown %select{type|class}1 name %0; did you mean %2?">;
10432def err_unknown_typename_suggest : Error<
10433  "unknown type name %0; did you mean %1?">;
10434def err_unknown_nested_typename_suggest : Error<
10435  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
10436def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
10437def err_undeclared_use_suggest : Error<
10438  "use of undeclared %0; did you mean %1?">;
10439def err_undeclared_var_use_suggest : Error<
10440  "use of undeclared identifier %0; did you mean %1?">;
10441def err_no_template : Error<"no template named %0">;
10442def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
10443def err_no_member_template : Error<"no template named %0 in %1">;
10444def err_no_member_template_suggest : Error<
10445  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
10446def err_non_template_in_template_id : Error<
10447  "%0 does not name a template but is followed by template arguments">;
10448def err_non_template_in_template_id_suggest : Error<
10449  "%0 does not name a template but is followed by template arguments; "
10450  "did you mean %1?">;
10451def err_non_template_in_member_template_id_suggest : Error<
10452  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
10453def note_non_template_in_template_id_found : Note<
10454  "non-template declaration found by name lookup">;
10455def err_mem_init_not_member_or_class_suggest : Error<
10456  "initializer %0 does not name a non-static data member or base "
10457  "class; did you mean the %select{base class|member}1 %2?">;
10458def err_field_designator_unknown_suggest : Error<
10459  "field designator %0 does not refer to any field in type %1; did you mean "
10460  "%2?">;
10461def err_typecheck_member_reference_ivar_suggest : Error<
10462  "%0 does not have a member named %1; did you mean %2?">;
10463def err_property_not_found_suggest : Error<
10464  "property %0 not found on object of type %1; did you mean %2?">;
10465def err_class_property_found : Error<
10466  "property %0 is a class property; did you mean to access it with class '%1'?">;
10467def err_ivar_access_using_property_syntax_suggest : Error<
10468  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
10469def warn_property_access_suggest : Warning<
10470"property %0 not found on object of type %1; did you mean to access property %2?">,
10471InGroup<PropertyAccessDotSyntax>;
10472def err_property_found_suggest : Error<
10473  "property %0 found on object of type %1; did you mean to access "
10474  "it with the \".\" operator?">;
10475def err_undef_interface_suggest : Error<
10476  "cannot find interface declaration for %0; did you mean %1?">;
10477def warn_undef_interface_suggest : Warning<
10478  "cannot find interface declaration for %0; did you mean %1?">;
10479def err_undef_superclass_suggest : Error<
10480  "cannot find interface declaration for %0, superclass of %1; did you mean "
10481  "%2?">;
10482def err_undeclared_protocol_suggest : Error<
10483  "cannot find protocol declaration for %0; did you mean %1?">;
10484def note_base_class_specified_here : Note<
10485  "base class %0 specified here">;
10486def err_using_directive_suggest : Error<
10487  "no namespace named %0; did you mean %1?">;
10488def err_using_directive_member_suggest : Error<
10489  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
10490def note_namespace_defined_here : Note<"namespace %0 defined here">;
10491def err_sizeof_pack_no_pack_name_suggest : Error<
10492  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
10493def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
10494
10495def err_uncasted_use_of_unknown_any : Error<
10496  "%0 has unknown type; cast it to its declared type to use it">;
10497def err_uncasted_call_of_unknown_any : Error<
10498  "%0 has unknown return type; cast the call to its declared return type">;
10499def err_uncasted_send_to_unknown_any_method : Error<
10500  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
10501  "message send to the method's return type">;
10502def err_unsupported_unknown_any_decl : Error<
10503  "%0 has unknown type, which is not supported for this kind of declaration">;
10504def err_unsupported_unknown_any_expr : Error<
10505  "unsupported expression with unknown type">;
10506def err_unsupported_unknown_any_call : Error<
10507  "call to unsupported expression with unknown type">;
10508def err_unknown_any_addrof : Error<
10509  "the address of a declaration with unknown type "
10510  "can only be cast to a pointer type">;
10511def err_unknown_any_addrof_call : Error<
10512  "address-of operator cannot be applied to a call to a function with "
10513  "unknown return type">;
10514def err_unknown_any_var_function_type : Error<
10515  "variable %0 with unknown type cannot be given a function type">;
10516def err_unknown_any_function : Error<
10517  "function %0 with unknown type must be given a function type">;
10518
10519def err_filter_expression_integral : Error<
10520  "filter expression has non-integral type %0">;
10521
10522def err_non_asm_stmt_in_naked_function : Error<
10523  "non-ASM statement in naked function is not supported">;
10524def err_asm_naked_this_ref : Error<
10525  "'this' pointer references not allowed in naked functions">;
10526def err_asm_naked_parm_ref : Error<
10527  "parameter references not allowed in naked functions">;
10528
10529// OpenCL warnings and errors.
10530def err_invalid_astype_of_different_size : Error<
10531  "invalid reinterpretation: sizes of %0 and %1 must match">;
10532def err_static_kernel : Error<
10533  "kernel functions cannot be declared static">;
10534def err_method_kernel : Error<
10535  "kernel functions cannot be class members">;
10536def err_template_kernel : Error<
10537  "kernel functions cannot be used in a template declaration, instantiation or specialization">;
10538def err_opencl_ptrptr_kernel_param : Error<
10539  "kernel parameter cannot be declared as a pointer to a pointer">;
10540def err_kernel_arg_address_space : Error<
10541  "pointer arguments to kernel functions must reside in '__global', "
10542  "'__constant' or '__local' address space">;
10543def err_opencl_ext_vector_component_invalid_length : Error<
10544  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
10545def err_opencl_function_variable : Error<
10546  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
10547def err_opencl_addrspace_scope : Error<
10548  "variables in the %0 address space can only be declared in the outermost "
10549  "scope of a kernel function">;
10550def err_static_function_scope : Error<
10551  "variables in function scope cannot be declared static">;
10552def err_opencl_bitfields : Error<
10553  "bit-fields are not supported in OpenCL">;
10554def err_opencl_vla : Error<
10555  "variable length arrays are not supported in OpenCL">;
10556def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
10557    "scalar operand type has greater rank than the type of the vector "
10558    "element. (%0 and %1)">;
10559def err_bad_kernel_param_type : Error<
10560  "%0 cannot be used as the type of a kernel parameter">;
10561def err_record_with_pointers_kernel_param : Error<
10562  "%select{struct|union}0 kernel parameters may not contain pointers">;
10563def note_within_field_of_type : Note<
10564  "within field of type %0 declared here">;
10565def note_illegal_field_declared_here : Note<
10566  "field of illegal %select{type|pointer type}0 %1 declared here">;
10567def err_opencl_type_struct_or_union_field : Error<
10568  "the %0 type cannot be used to declare a structure or union field">;
10569def err_event_t_addr_space_qual : Error<
10570  "the event_t type can only be used with __private address space qualifier">;
10571def err_expected_kernel_void_return_type : Error<
10572  "kernel must have void return type">;
10573def err_sampler_initializer_not_integer : Error<
10574  "sampler_t initialization requires 32-bit integer, not %0">;
10575def warn_sampler_initializer_invalid_bits : Warning<
10576  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
10577def err_sampler_argument_required : Error<
10578  "sampler_t variable required - got %0">;
10579def err_wrong_sampler_addressspace: Error<
10580  "sampler type cannot be used with the __local and __global address space qualifiers">;
10581def err_opencl_nonconst_global_sampler : Error<
10582  "global sampler requires a const or constant address space qualifier">;
10583def err_opencl_cast_non_zero_to_event_t : Error<
10584  "cannot cast non-zero value '%0' to 'event_t'">;
10585def err_opencl_global_invalid_addr_space : Error<
10586  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
10587def err_missing_actual_pipe_type : Error<
10588  "missing actual type specifier for pipe">;
10589def err_reference_pipe_type : Error <
10590  "pipes packet types cannot be of reference type">;
10591def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
10592def err_opencl_kernel_attr :
10593  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
10594def err_return_value_with_address_space : Error<
10595  "return type cannot be qualified with address space">;
10596def err_opencl_constant_no_init : Error<
10597  "variable in constant address space must be initialized">;
10598def err_opencl_atomic_init: Error<
10599  "atomic variable can be %select{assigned|initialized}0 to a variable only "
10600  "in global address space">;
10601def err_opencl_implicit_vector_conversion : Error<
10602  "implicit conversions between vector types (%0 and %1) are not permitted">;
10603def err_opencl_invalid_type_array : Error<
10604  "array of %0 type is invalid in OpenCL">;
10605def err_opencl_ternary_with_block : Error<
10606  "block type cannot be used as expression in ternary expression in OpenCL">;
10607def err_opencl_pointer_to_type : Error<
10608  "pointer to type %0 is invalid in OpenCL">;
10609def err_opencl_type_can_only_be_used_as_function_parameter : Error <
10610  "type %0 can only be used as a function parameter in OpenCL">;
10611def err_opencl_type_not_found : Error<
10612  "%0 type %1 not found; include the base header with -finclude-default-header">;
10613def warn_opencl_attr_deprecated_ignored : Warning <
10614  "%0 attribute is deprecated and ignored in %1">, InGroup<IgnoredAttributes>;
10615def err_opencl_variadic_function : Error<
10616  "invalid prototype, variadic arguments are not allowed in OpenCL">;
10617def err_opencl_requires_extension : Error<
10618  "use of %select{type|declaration}0 %1 requires %2 support">;
10619def ext_opencl_double_without_pragma : Extension<
10620  "Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is"
10621  " supported">;
10622def warn_opencl_generic_address_space_arg : Warning<
10623  "passing non-generic address space pointer to %0"
10624  " may cause dynamic conversion affecting performance">,
10625  InGroup<Conversion>, DefaultIgnore;
10626
10627// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
10628def err_opencl_builtin_pipe_first_arg : Error<
10629  "first argument to %0 must be a pipe type">;
10630def err_opencl_builtin_pipe_arg_num : Error<
10631  "invalid number of arguments to function: %0">;
10632def err_opencl_builtin_pipe_invalid_arg : Error<
10633  "invalid argument type to function %0 (expecting %1 having %2)">;
10634def err_opencl_builtin_pipe_invalid_access_modifier : Error<
10635  "invalid pipe access modifier (expecting %0)">;
10636
10637// OpenCL access qualifier
10638def err_opencl_invalid_access_qualifier : Error<
10639  "access qualifier can only be used for pipe and image type">;
10640def err_opencl_invalid_read_write : Error<
10641  "access qualifier %0 can not be used for %1 %select{|prior to OpenCL C version 2.0 or in version 3.0 "
10642  "and without __opencl_c_read_write_images feature}2">;
10643def err_opencl_multiple_access_qualifiers : Error<
10644  "multiple access qualifiers">;
10645def note_opencl_typedef_access_qualifier : Note<
10646  "previously declared '%0' here">;
10647
10648// OpenCL v2.0 s6.12.5 Blocks restrictions
10649def err_opencl_block_storage_type : Error<
10650  "the __block storage type is not permitted">;
10651def err_opencl_invalid_block_declaration : Error<
10652  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
10653def err_opencl_extern_block_declaration : Error<
10654  "invalid block variable declaration - using 'extern' storage class is disallowed">;
10655def err_opencl_block_ref_block : Error<
10656  "cannot refer to a block inside block">;
10657
10658// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
10659def err_opencl_builtin_to_addr_invalid_arg : Error<
10660  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
10661
10662// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
10663def err_opencl_enqueue_kernel_incorrect_args : Error<
10664  "illegal call to enqueue_kernel, incorrect argument types">;
10665def err_opencl_enqueue_kernel_local_size_args : Error<
10666  "mismatch in number of block parameters and local size arguments passed">;
10667def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
10668  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
10669def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
10670  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
10671def err_opencl_enqueue_kernel_blocks_no_args : Error<
10672  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
10673
10674def err_opencl_builtin_expected_type : Error<
10675  "illegal call to %0, expected %1 argument type">;
10676
10677// OpenCL v3.0 s6.3.7 - Vector Components
10678def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
10679  "vector component name '%0' is a feature from OpenCL version 3.0 onwards">,
10680  InGroup<OpenCLUnsupportedRGBA>;
10681
10682def err_openclcxx_placement_new : Error<
10683  "use of placement new requires explicit declaration">;
10684
10685// MIG routine annotations.
10686def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
10687  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
10688  InGroup<IgnoredAttributes>;
10689
10690def warn_imp_cast_drops_unaligned : Warning<
10691  "implicit cast from type %0 to type %1 drops __unaligned qualifier">,
10692  InGroup<DiagGroup<"unaligned-qualifier-implicit-cast">>;
10693
10694} // end of sema category
10695
10696let CategoryName = "OpenMP Issue" in {
10697// OpenMP support.
10698def err_omp_expected_var_arg : Error<
10699  "%0 is not a global variable, static local variable or static data member">;
10700def err_omp_expected_var_arg_suggest : Error<
10701  "%0 is not a global variable, static local variable or static data member; "
10702  "did you mean %1">;
10703def err_omp_global_var_arg : Error<
10704  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
10705def err_omp_ref_type_arg : Error<
10706  "arguments of '#pragma omp %0' cannot be of reference type %1">;
10707def err_omp_region_not_file_context : Error<
10708  "directive must be at file or namespace scope">;
10709def err_omp_var_scope : Error<
10710  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
10711def err_omp_var_used : Error<
10712  "'#pragma omp %0' must precede all references to variable %q1">;
10713def err_omp_var_thread_local : Error<
10714  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
10715def err_omp_private_incomplete_type : Error<
10716  "a private variable with incomplete type %0">;
10717def err_omp_firstprivate_incomplete_type : Error<
10718  "a firstprivate variable with incomplete type %0">;
10719def err_omp_lastprivate_incomplete_type : Error<
10720  "a lastprivate variable with incomplete type %0">;
10721def err_omp_reduction_incomplete_type : Error<
10722  "a reduction list item with incomplete type %0">;
10723def warn_omp_minus_in_reduction_deprecated : Warning<
10724  "minus(-) operator for reductions is deprecated; use + or user defined reduction instead">,
10725  InGroup<Deprecated>;
10726def err_omp_unexpected_clause_value : Error<
10727  "expected %0 in OpenMP clause '%1'">;
10728def err_omp_unexpected_call_to_omp_runtime_api
10729    : Error<"calls to OpenMP runtime API are not allowed within a region that "
10730            "corresponds to a construct with an order clause that specifies "
10731            "concurrent">;
10732def err_omp_expected_var_name_member_expr : Error<
10733  "expected variable name%select{| or data member of current class}0">;
10734def err_omp_expected_var_name_member_expr_with_type : Error<
10735  "expected variable%select{| or static data member|, static data member, "
10736  "or non-static data member of current class}0 of type '%1'">;
10737def err_omp_expected_var_name_member_expr_or_array_item : Error<
10738  "expected variable name%select{|, data member of current class}0, array element or array section">;
10739def err_omp_expected_addressable_lvalue_or_array_item : Error<
10740  "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">;
10741def err_omp_expected_named_var_member_or_array_expression: Error<
10742  "expected expression containing only member accesses and/or array sections based on named variables">;
10743def err_omp_bit_fields_forbidden_in_clause : Error<
10744  "bit fields cannot be used to specify storage in a '%0' clause">;
10745def err_array_section_does_not_specify_contiguous_storage : Error<
10746  "array section does not specify contiguous storage">;
10747def err_array_section_does_not_specify_length : Error<
10748  "array section does not specify length for outermost dimension">;
10749def err_omp_union_type_not_allowed : Error<
10750  "mapping of union members is not allowed">;
10751def err_omp_expected_access_to_data_field : Error<
10752  "expected access to data field">;
10753def err_omp_multiple_array_items_in_map_clause : Error<
10754  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
10755def err_omp_duplicate_map_type_modifier : Error<
10756  "same map type modifier has been specified more than once">;
10757def err_omp_duplicate_motion_modifier : Error<
10758  "same motion modifier has been specified more than once">;
10759def err_omp_pointer_mapped_along_with_derived_section : Error<
10760  "pointer cannot be mapped along with a section derived from itself">;
10761def err_omp_original_storage_is_shared_and_does_not_contain : Error<
10762  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
10763def err_omp_same_pointer_dereferenced : Error<
10764  "same pointer dereferenced in multiple different ways in map clause expressions">;
10765def note_omp_task_predetermined_firstprivate_here : Note<
10766  "predetermined as a firstprivate in a task construct here">;
10767def err_omp_threadprivate_incomplete_type : Error<
10768  "threadprivate variable with incomplete type %0">;
10769def err_omp_no_dsa_for_variable : Error<
10770  "variable %0 must have explicitly specified data sharing attributes">;
10771def err_omp_defaultmap_no_attr_for_variable : Error<
10772  "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
10773def note_omp_default_dsa_none : Note<
10774  "explicit data sharing attribute requested here">;
10775def note_omp_defaultmap_attr_none : Note<
10776  "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
10777def err_omp_wrong_dsa : Error<
10778  "%0 variable cannot be %1">;
10779def err_omp_variably_modified_type_not_supported : Error<
10780  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
10781def note_omp_explicit_dsa : Note<
10782  "defined as %0">;
10783def note_omp_predetermined_dsa : Note<
10784  "%select{static data member is predetermined as shared|"
10785  "variable with static storage duration is predetermined as shared|"
10786  "loop iteration variable is predetermined as private|"
10787  "loop iteration variable is predetermined as linear|"
10788  "loop iteration variable is predetermined as lastprivate|"
10789  "constant variable is predetermined as shared|"
10790  "global variable is predetermined as shared|"
10791  "non-shared variable in a task construct is predetermined as firstprivate|"
10792  "variable with automatic storage duration is predetermined as private}0"
10793  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
10794def note_omp_implicit_dsa : Note<
10795  "implicitly determined as %0">;
10796def err_omp_loop_var_dsa : Error<
10797  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
10798def err_omp_not_for : Error<
10799  "%select{statement after '#pragma omp %1' must be a for loop|"
10800  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
10801def note_omp_collapse_ordered_expr : Note<
10802  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
10803def err_omp_negative_expression_in_clause : Error<
10804  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
10805def err_omp_not_integral : Error<
10806  "expression must have integral or unscoped enumeration "
10807  "type, not %0">;
10808def err_omp_threadprivate_in_target : Error<
10809  "threadprivate variables cannot be used in target constructs">;
10810def err_omp_incomplete_type : Error<
10811  "expression has incomplete class type %0">;
10812def err_omp_explicit_conversion : Error<
10813  "expression requires explicit conversion from %0 to %1">;
10814def note_omp_conversion_here : Note<
10815  "conversion to %select{integral|enumeration}0 type %1 declared here">;
10816def err_omp_ambiguous_conversion : Error<
10817  "ambiguous conversion from type %0 to an integral or unscoped "
10818  "enumeration type">;
10819def err_omp_iterator_not_integral_or_pointer : Error<
10820  "expected integral or pointer type as the iterator-type, not %0">;
10821def err_omp_iterator_step_not_integral : Error<
10822  "iterator step expression %0 is not the integral expression">;
10823def err_omp_iterator_step_constant_zero : Error<
10824  "iterator step expression %0 evaluates to 0">;
10825def err_omp_required_access : Error<
10826  "%0 variable must be %1">;
10827def err_omp_const_variable : Error<
10828  "const-qualified variable cannot be %0">;
10829def err_omp_const_not_mutable_variable : Error<
10830  "const-qualified variable without mutable fields cannot be %0">;
10831def err_omp_const_list_item : Error<
10832  "const-qualified list item cannot be %0">;
10833def err_omp_linear_incomplete_type : Error<
10834  "a linear variable with incomplete type %0">;
10835def err_omp_linear_expected_int_or_ptr : Error<
10836  "argument of a linear clause should be of integral or pointer "
10837  "type, not %0">;
10838def warn_omp_linear_step_zero : Warning<
10839  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
10840  InGroup<OpenMPClauses>;
10841def warn_omp_alignment_not_power_of_two : Warning<
10842  "aligned clause will be ignored because the requested alignment is not a power of 2">,
10843  InGroup<OpenMPClauses>;
10844def err_omp_invalid_target_decl : Error<
10845  "%0 used in declare target directive is not a variable or a function name">;
10846def err_omp_declare_target_to_and_link : Error<
10847  "%0 must not appear in both clauses 'to' and 'link'">;
10848def warn_omp_not_in_target_context : Warning<
10849  "declaration is not declared in any declare target region">,
10850  InGroup<OpenMPTarget>;
10851def err_omp_function_in_link_clause : Error<
10852  "function name is not allowed in 'link' clause">;
10853def err_omp_aligned_expected_array_or_ptr : Error<
10854  "argument of aligned clause should be array"
10855  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
10856  ", not %0">;
10857def err_omp_used_in_clause_twice : Error<
10858  "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
10859def err_omp_local_var_in_threadprivate_init : Error<
10860  "variable with local storage in initial value of threadprivate variable">;
10861def err_omp_loop_not_canonical_init : Error<
10862  "initialization clause of OpenMP for loop is not in canonical form "
10863  "('var = init' or 'T var = init')">;
10864def ext_omp_loop_not_canonical_init : ExtWarn<
10865  "initialization clause of OpenMP for loop is not in canonical form "
10866  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
10867def err_omp_loop_not_canonical_cond : Error<
10868  "condition of OpenMP for loop must be a relational comparison "
10869  "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
10870def err_omp_loop_not_canonical_incr : Error<
10871  "increment clause of OpenMP for loop must perform simple addition "
10872  "or subtraction on loop variable %0">;
10873def err_omp_loop_variable_type : Error<
10874  "variable must be of integer or %select{pointer|random access iterator}0 type">;
10875def err_omp_loop_incr_not_compatible : Error<
10876  "increment expression must cause %0 to %select{decrease|increase}1 "
10877  "on each iteration of OpenMP for loop">;
10878def note_omp_loop_cond_requres_compatible_incr : Note<
10879  "loop step is expected to be %select{negative|positive}0 due to this condition">;
10880def err_omp_loop_diff_cxx : Error<
10881  "could not calculate number of iterations calling 'operator-' with "
10882  "upper and lower loop bounds">;
10883def err_omp_loop_cannot_use_stmt : Error<
10884  "'%0' statement cannot be used in OpenMP for loop">;
10885def err_omp_simd_region_cannot_use_stmt : Error<
10886  "'%0' statement cannot be used in OpenMP simd region">;
10887def warn_omp_loop_64_bit_var : Warning<
10888  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
10889  InGroup<OpenMPLoopForm>;
10890def err_omp_unknown_reduction_identifier_prior_omp_6_0 : Error<
10891  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
10892  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10893def err_omp_unknown_reduction_identifier_since_omp_6_0 : Error<
10894  "incorrect reduction identifier, expected one of '+', '*', '&', '|', '^', "
10895  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10896def err_omp_not_resolved_reduction_identifier : Error<
10897  "unable to resolve declare reduction construct for type %0">;
10898def err_omp_reduction_ref_type_arg : Error<
10899  "argument of OpenMP clause '%0' must reference the same object in all threads">;
10900def err_omp_clause_not_arithmetic_type_arg : Error<
10901  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
10902def err_omp_clause_floating_type_arg : Error<
10903  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
10904def err_omp_once_referenced : Error<
10905  "variable can appear only once in OpenMP '%0' clause">;
10906def err_omp_once_referenced_in_target_update : Error<
10907  "variable can appear only once in OpenMP 'target update' construct">;
10908def note_omp_referenced : Note<
10909  "previously referenced here">;
10910def err_omp_reduction_in_task : Error<
10911  "reduction variables may not be accessed in an explicit task">;
10912def err_omp_reduction_id_not_compatible : Error<
10913  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
10914def err_omp_reduction_identifier_mismatch : Error<
10915  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
10916def note_omp_previous_reduction_identifier : Note<
10917  "previously marked as task_reduction with different reduction operation">;
10918def err_omp_prohibited_region : Error<
10919  "region cannot be%select{| closely}0 nested inside '%1' region"
10920  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
10921  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
10922  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
10923  "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
10924  "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
10925def err_omp_prohibited_region_simd : Error<
10926  "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
10927def err_omp_prohibited_region_atomic : Error<
10928  "OpenMP constructs may not be nested inside an atomic region">;
10929def err_omp_prohibited_region_order
10930    : Error<"construct '%0' not allowed in a region associated with a "
10931            "directive with 'order' clause">;
10932def err_omp_prohibited_region_critical_same_name : Error<
10933  "cannot nest 'critical' regions having the same name %0">;
10934def note_omp_previous_critical_region : Note<
10935  "previous 'critical' region starts here">;
10936def err_omp_several_directives_in_region : Error<
10937  "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
10938def note_omp_previous_directive : Note<
10939  "previous '%0' directive used here">;
10940def err_omp_sections_not_compound_stmt : Error<
10941  "the statement for '#pragma omp sections' must be a compound statement">;
10942def err_omp_parallel_sections_not_compound_stmt : Error<
10943  "the statement for '#pragma omp parallel sections' must be a compound statement">;
10944def err_omp_orphaned_section_directive : Error<
10945  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
10946  " must be closely nested to a sections region%select{|, not a %1 region}0">;
10947def err_omp_sections_substmt_not_section : Error<
10948  "statement in 'omp sections' directive must be enclosed into a section region">;
10949def err_omp_parallel_sections_substmt_not_section : Error<
10950  "statement in 'omp parallel sections' directive must be enclosed into a section region">;
10951def err_omp_parallel_reduction_in_task_firstprivate : Error<
10952  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
10953def err_omp_atomic_read_not_expression_statement : Error<
10954  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
10955  " where v and x are both lvalue expressions with scalar type">;
10956def note_omp_atomic_read_write: Note<
10957  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
10958def err_omp_atomic_write_not_expression_statement : Error<
10959  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
10960  " where x is a lvalue expression with scalar type">;
10961def err_omp_atomic_update_not_expression_statement : Error<
10962  "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',"
10963  " where x is an lvalue expression with scalar type">;
10964def err_omp_atomic_not_expression_statement : Error<
10965  "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',"
10966  " where x is an lvalue expression with scalar type">;
10967def note_omp_atomic_update: Note<
10968  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
10969  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
10970  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
10971def err_omp_atomic_capture_not_expression_statement : Error<
10972  "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',"
10973  " where x and v are both lvalue expressions with scalar type">;
10974def err_omp_atomic_capture_not_compound_statement : Error<
10975  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
10976  " '{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;}',"
10977  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
10978  " where x is an lvalue expression with scalar type">;
10979def note_omp_atomic_capture: Note<
10980  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
10981def err_omp_atomic_compare : Error<
10982  "the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}',"
10983  " '{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;}',"
10984  " 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type,"
10985  " and 'ordop' is one of '<' or '>'.">;
10986def err_omp_atomic_compare_capture : Error<
10987  "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;}}',"
10988  " '{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;}',"
10989  " '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,"
10990  " and 'ordop' is one of '<' or '>'.">;
10991def note_omp_atomic_compare: Note<
10992  "%select{expected compound statement|expected exactly one expression statement|expected assignment statement|expected conditional operator|expect result value to be at false expression|"
10993  "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'|"
10994  "expect lvalue for result value|expect scalar value|expect integer value|unexpected 'else' statement|expect '==' operator|expect an assignment statement 'v = x'|"
10995  "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">;
10996def err_omp_atomic_fail_wrong_or_no_clauses : Error<"expected a memory order clause">;
10997def err_omp_atomic_fail_no_compare : Error<"expected 'compare' clause with the 'fail' modifier">;
10998def err_omp_atomic_several_clauses : Error<
10999  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
11000def err_omp_several_mem_order_clauses : Error<
11001  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
11002def err_omp_atomic_incompatible_mem_order_clause : Error<
11003  "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
11004def note_omp_previous_mem_order_clause : Note<
11005  "'%0' clause used here">;
11006def err_omp_target_contains_not_only_teams : Error<
11007  "target construct with nested teams region contains statements outside of the teams construct">;
11008def note_omp_nested_teams_construct_here : Note<
11009  "nested teams construct here">;
11010def note_omp_nested_statement_here : Note<
11011  "%select{statement|directive}0 outside teams construct here">;
11012def err_omp_single_copyprivate_with_nowait : Error<
11013  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
11014def err_omp_nowait_clause_without_depend: Error<
11015  "directive '#pragma omp taskwait' cannot use 'nowait' clause without 'depend' clause">;
11016def note_omp_nowait_clause_here : Note<
11017  "'nowait' clause is here">;
11018def err_omp_single_decl_in_declare_simd_variant : Error<
11019  "single declaration is expected after 'declare %select{simd|variant}0' directive">;
11020def err_omp_function_expected : Error<
11021  "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
11022def err_omp_wrong_cancel_region : Error<
11023  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
11024def err_omp_parent_cancel_region_nowait : Error<
11025  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
11026def err_omp_parent_cancel_region_ordered : Error<
11027  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
11028def 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">;
11029def 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">;
11030def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
11031def err_omp_mapper_wrong_type : Error<
11032  "mapper type must be of struct, union or class type">;
11033def err_omp_declare_mapper_wrong_var : Error<
11034  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
11035def err_omp_declare_mapper_redefinition : Error<
11036  "redefinition of user-defined mapper for type %0 with name %1">;
11037def err_omp_invalid_mapper: Error<
11038  "cannot find a valid user-defined mapper for type %0 with name %1">;
11039def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
11040def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
11041def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
11042def err_omp_typecheck_section_value : Error<
11043  "subscripted value is not an array or pointer">;
11044def err_omp_typecheck_section_not_integer : Error<
11045  "array section %select{lower bound|length}0 is not an integer">;
11046def err_omp_typecheck_shaping_not_integer : Error<
11047  "array shaping operation dimension is not an integer">;
11048def err_omp_shaping_dimension_not_positive : Error<
11049  "array shaping dimension is evaluated to a non-positive value %0">;
11050def err_omp_section_function_type : Error<
11051  "section of pointer to function type %0">;
11052def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
11053  InGroup<CharSubscript>, DefaultIgnore;
11054def err_omp_section_incomplete_type : Error<
11055  "section of pointer to incomplete type %0">;
11056def err_omp_section_not_subset_of_array : Error<
11057  "array section must be a subset of the original array">;
11058def err_omp_section_length_negative : Error<
11059  "section length is evaluated to a negative value %0">;
11060def err_omp_section_stride_non_positive : Error<
11061  "section stride is evaluated to a non-positive value %0">;
11062def err_omp_section_length_undefined : Error<
11063  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
11064def err_omp_wrong_linear_modifier : Error<
11065  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
11066def err_omp_wrong_linear_modifier_non_reference : Error<
11067  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
11068def err_omp_step_simple_modifier_exclusive : Error<
11069  "step simple modifier is exclusive and can't be use with 'val', 'uval' or 'ref' modifier">;
11070def err_omp_wrong_simdlen_safelen_values : Error<
11071  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
11072def err_omp_wrong_if_directive_name_modifier : Error<
11073  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
11074def err_omp_no_more_if_clause : Error<
11075  "no more 'if' clause is allowed">;
11076def err_omp_unnamed_if_clause : Error<
11077  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
11078def note_omp_previous_named_if_clause : Note<
11079  "previous clause with directive name modifier specified here">;
11080def err_omp_ordered_directive_with_param : Error<
11081  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
11082def err_omp_ordered_directive_without_param : Error<
11083  "'ordered' directive with '%0' clause cannot be closely nested inside ordered region without specified parameter">;
11084def note_omp_ordered_param : Note<
11085  "'ordered' clause%select{| with specified parameter}0">;
11086def err_omp_expected_base_var_name : Error<
11087  "expected variable name as a base of the array %select{subscript|section}0">;
11088def err_omp_map_shared_storage : Error<
11089  "variable already marked as mapped in current construct">;
11090def err_omp_invalid_map_type_for_directive : Error<
11091  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
11092def err_omp_invalid_map_type_modifier_for_directive : Error<
11093  "map type modifier '%0' is not allowed for '#pragma omp %1'">;
11094def err_omp_no_clause_for_directive : Error<
11095  "expected at least one %0 clause for '#pragma omp %1'">;
11096def err_omp_threadprivate_in_clause : Error<
11097  "threadprivate variables are not allowed in '%0' clause">;
11098def err_omp_wrong_ordered_loop_count : Error<
11099  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
11100def note_collapse_loop_count : Note<
11101  "parameter of the 'collapse' clause">;
11102def err_omp_clauses_mutually_exclusive : Error<
11103  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
11104def note_omp_previous_clause : Note<
11105  "'%0' clause is specified here">;
11106def err_omp_hint_clause_no_name : Error<
11107  "the name of the construct must be specified in presence of 'hint' clause">;
11108def err_omp_critical_with_hint : Error<
11109  "constructs with the same name must have a 'hint' clause with the same value">;
11110def note_omp_critical_hint_here : Note<
11111  "%select{|previous }0'hint' clause with value '%1'">;
11112def note_omp_critical_no_hint : Note<
11113  "%select{|previous }0directive with no 'hint' clause specified">;
11114def err_omp_depend_clause_thread_simd : Error<
11115  "'%0' clauses cannot be mixed with '%1' clause">;
11116def err_omp_depend_sink_expected_loop_iteration : Error<
11117  "expected%select{| %1}0 loop iteration variable">;
11118def err_omp_depend_sink_unexpected_expr : Error<
11119  "unexpected expression: number of expressions is larger than the number of associated loops">;
11120def err_omp_depend_sink_expected_plus_minus : Error<
11121  "expected '+' or '-' operation">;
11122def err_omp_taskwait_depend_mutexinoutset_not_allowed : Error<
11123  "'mutexinoutset' modifier not allowed in 'depend' clause on 'taskwait' directive">;
11124def err_omp_sink_and_source_not_allowed : Error<
11125  "'%0(%select{source|sink:vec}1)' clause%select{|s}1 cannot be mixed with '%0(%select{sink:vec|source}1)' clause%select{s|}1">;
11126def err_omp_depend_zero_length_array_section_not_allowed : Error<
11127  "zero-length array section is not allowed in 'depend' clause">;
11128def err_omp_depend_sink_source_with_modifier : Error<
11129  "depend modifier cannot be used with 'sink' or 'source' depend type">;
11130def err_omp_depend_modifier_not_iterator : Error<
11131  "expected iterator specification as depend modifier">;
11132def err_omp_map_modifier_not_iterator : Error<
11133  "expected iterator specification as map modifier">;
11134def err_omp_linear_ordered : Error<
11135  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
11136def err_omp_unexpected_schedule_modifier : Error<
11137  "modifier '%0' cannot be used along with modifier '%1'">;
11138def err_omp_schedule_nonmonotonic_static : Error<
11139  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
11140def err_omp_simple_clause_incompatible_with_ordered : Error<
11141  "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
11142def err_omp_ordered_simd : Error<
11143  "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
11144def err_omp_variable_in_given_clause_and_dsa : Error<
11145  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
11146def err_omp_param_or_this_in_clause : Error<
11147  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
11148def err_omp_expected_uniform_param : Error<
11149  "expected a reference to a parameter specified in a 'uniform' clause">;
11150def err_omp_expected_int_param : Error<
11151  "expected a reference to an integer-typed parameter">;
11152def err_omp_at_least_one_motion_clause_required : Error<
11153  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
11154def err_omp_cannot_update_with_internal_linkage : Error<
11155  "the host cannot update a declare target variable that is not externally visible.">;
11156def err_omp_usedeviceptr_not_a_pointer : Error<
11157  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
11158def err_omp_argument_type_isdeviceptr : Error <
11159  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
11160def warn_omp_nesting_simd : Warning<
11161  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
11162  InGroup<SourceUsesOpenMP>;
11163def err_omp_orphaned_device_directive : Error<
11164  "orphaned 'omp %0' directives are prohibited"
11165  "; perhaps you forget to enclose the directive into a "
11166  "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
11167def err_omp_reduction_non_addressable_expression : Error<
11168  "expected addressable reduction item for the task-based directives">;
11169def err_omp_reduction_with_nogroup : Error<
11170  "'reduction' clause cannot be used with 'nogroup' clause">;
11171def err_omp_reduction_vla_unsupported : Error<
11172  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
11173def err_omp_linear_distribute_var_non_loop_iteration : Error<
11174  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
11175def warn_omp_non_trivial_type_mapped : Warning<
11176  "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
11177  InGroup<OpenMPMapping>;
11178def err_omp_requires_clause_redeclaration : Error <
11179  "Only one %0 clause can appear on a requires directive in a single translation unit">;
11180def note_omp_requires_previous_clause : Note <
11181  "%0 clause previously used here">;
11182def err_omp_directive_before_requires : Error <
11183  "'%0' region encountered before requires directive with '%1' clause">;
11184def note_omp_requires_encountered_directive : Note <
11185  "'%0' previously encountered here">;
11186def err_omp_device_ancestor_without_requires_reverse_offload : Error <
11187  "Device clause with ancestor device-modifier used without specifying 'requires reverse_offload'">;
11188def err_omp_invalid_scope : Error <
11189  "'#pragma omp %0' directive must appear only in file scope">;
11190def note_omp_invalid_length_on_this_ptr_mapping : Note <
11191  "expected length on mapping of 'this' array section expression to be '1'">;
11192def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
11193  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
11194def note_omp_invalid_subscript_on_this_ptr_map : Note <
11195  "expected 'this' subscript expression on map clause to be 'this[0]'">;
11196def err_omp_invalid_map_this_expr : Error <
11197  "invalid 'this' expression on 'map' clause">;
11198def err_omp_implied_type_not_found : Error<
11199  "'%0' type not found; include <omp.h>">;
11200def err_omp_expected_omp_depend_t_lvalue : Error<
11201  "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
11202def err_omp_depobj_expected : Error<
11203  "expected depobj expression">;
11204def err_omp_depobj_single_clause_expected : Error<
11205  "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
11206def err_omp_scan_single_clause_expected : Error<
11207  "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
11208def err_omp_inclusive_exclusive_not_reduction : Error<
11209  "the list item must appear in 'reduction' clause with the 'inscan' modifier "
11210  "of the parent directive">;
11211def err_omp_reduction_not_inclusive_exclusive : Error<
11212  "the inscan reduction list item must appear as a list item in an 'inclusive' or"
11213  " 'exclusive' clause on an inner 'omp scan' directive">;
11214def err_omp_wrong_inscan_reduction : Error<
11215  "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
11216  " 'omp parallel for', or 'omp parallel for simd' directive">;
11217def err_omp_inscan_reduction_expected : Error<
11218  "expected 'reduction' clause with the 'inscan' modifier">;
11219def note_omp_previous_inscan_reduction : Note<
11220  "'reduction' clause with 'inscan' modifier is used here">;
11221def err_omp_expected_predefined_allocator : Error<
11222  "expected one of the predefined allocators for the variables with the static "
11223  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
11224  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
11225  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
11226def warn_omp_used_different_allocator : Warning<
11227  "allocate directive specifies %select{default|'%1'}0 allocator while "
11228  "previously used %select{default|'%3'}2">,
11229  InGroup<OpenMPClauses>;
11230def note_omp_previous_allocator : Note<
11231  "previous allocator is specified here">;
11232def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
11233  "inside of the target region; provide an 'allocator' clause or use 'requires'"
11234  " directive with the 'dynamic_allocators' clause">;
11235def err_expected_allocator_expression : Error<"expected an allocator expression "
11236  "inside of the target region; provide an allocator expression or use 'requires'"
11237  " directive with the 'dynamic_allocators' clause">;
11238def warn_omp_allocate_thread_on_task_target_directive : Warning<
11239  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
11240  InGroup<OpenMPClauses>;
11241def err_omp_expected_private_copy_for_allocate : Error<
11242  "the referenced item is not found in any private clause on the same directive">;
11243def err_omp_stmt_depends_on_loop_counter : Error<
11244  "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
11245def err_omp_invariant_dependency : Error<
11246  "expected loop invariant expression">;
11247def err_omp_invariant_or_linear_dependency : Error<
11248  "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
11249def err_omp_wrong_dependency_iterator_type : Error<
11250  "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
11251def err_target_unsupported_type
11252    : Error<"%0 requires %select{|%2 bit size}1 %3 %select{|return }4type support,"
11253            " but target '%5' does not support it">;
11254def err_omp_lambda_capture_in_declare_target_not_to : Error<
11255  "variable captured in declare target region must appear in a to clause">;
11256def err_omp_device_type_mismatch : Error<
11257  "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
11258def err_omp_wrong_device_function_call : Error<
11259  "function with 'device_type(%0)' is not available on %select{device|host}1">;
11260def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
11261def warn_omp_declare_target_after_first_use : Warning<
11262  "declaration marked as declare target after first use, it may lead to incorrect results">,
11263  InGroup<OpenMPTarget>;
11264def err_omp_declare_variant_incompat_attributes : Error<
11265  "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
11266def warn_omp_declare_variant_score_not_constant
11267    : Warning<"score expressions in the OpenMP context selector need to be "
11268              "constant; %0 is not and will be ignored">,
11269      InGroup<SourceUsesOpenMP>;
11270def err_omp_declare_variant_user_condition_not_constant
11271    : Error<"the user condition in the OpenMP context selector needs to be "
11272            "constant; %0 is not">;
11273def warn_omp_declare_variant_after_used : Warning<
11274  "'#pragma omp declare variant' cannot be applied for function after first "
11275  "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
11276def warn_omp_declare_variant_after_emitted : Warning<
11277  "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
11278  " the original function might be used">, InGroup<SourceUsesOpenMP>;
11279def err_omp_declare_variant_doesnt_support : Error<
11280  "'#pragma omp declare variant' does not "
11281  "support %select{function templates|virtual functions|"
11282  "deduced return types|constructors|destructors|deleted functions|"
11283  "defaulted functions|constexpr functions|consteval function}0">;
11284def err_omp_declare_variant_diff : Error<
11285  "function with '#pragma omp declare variant' has a different %select{calling convention"
11286  "|return type|constexpr specification|inline specification|storage class|"
11287  "linkage}0">;
11288def err_omp_declare_variant_prototype_required : Error<
11289  "function with '#pragma omp declare variant' must have a prototype when "
11290  "'append_args' is used">;
11291def err_omp_interop_type_not_found : Error<
11292  "'omp_interop_t' must be defined when 'append_args' clause is used; include <omp.h>">;
11293def err_omp_declare_variant_incompat_types : Error<
11294  "variant in '#pragma omp declare variant' with type %0 is incompatible with"
11295  " type %1%select{| with appended arguments}2">;
11296def err_omp_declare_variant_same_base_function : Error<
11297  "variant in '#pragma omp declare variant' is the same as the base function">;
11298def warn_omp_declare_variant_marked_as_declare_variant : Warning<
11299  "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
11300  >, InGroup<SourceUsesOpenMP>;
11301def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
11302def err_omp_one_defaultmap_each_category: Error<
11303  "at most one defaultmap clause for each variable-category can appear on the directive">;
11304def err_omp_lastprivate_conditional_non_scalar : Error<
11305  "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
11306  >;
11307def err_omp_flush_order_clause_and_list : Error<
11308  "'flush' directive with memory order clause '%0' cannot have the list">;
11309def note_omp_flush_order_clause_here : Note<
11310  "memory order clause '%0' is specified here">;
11311def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
11312  "expected addressable lvalue in '%0' clause">;
11313def err_omp_var_expected : Error<
11314  "expected variable of the '%0' type%select{|, not %2}1">;
11315def err_omp_non_pointer_type_array_shaping_base : Error<
11316  "expected expression with a pointer to a complete type as a base of an array "
11317  "shaping operation">;
11318def err_omp_reduction_task_not_parallel_or_worksharing : Error<
11319  "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
11320  " worksharing constructs">;
11321def err_omp_expected_array_alloctraits : Error<
11322  "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
11323def err_omp_predefined_allocator_with_traits : Error<
11324  "predefined allocator cannot have traits specified">;
11325def note_omp_predefined_allocator : Note<
11326  "predefined trait '%0' used here">;
11327def err_omp_nonpredefined_allocator_without_traits : Error<
11328  "non-predefined allocator must have traits specified">;
11329def err_omp_allocator_used_in_clauses : Error<
11330  "allocators used in 'uses_allocators' clause cannot appear in other "
11331  "data-sharing or data-mapping attribute clauses">;
11332def err_omp_allocator_not_in_uses_allocators : Error<
11333  "allocator must be specified in the 'uses_allocators' clause">;
11334def note_omp_protected_structured_block
11335    : Note<"jump bypasses OpenMP structured block">;
11336def note_omp_exits_structured_block
11337    : Note<"jump exits scope of OpenMP structured block">;
11338def err_omp_lastprivate_loop_var_non_loop_iteration : Error<
11339  "only loop iteration variables are allowed in 'lastprivate' clause in "
11340  "'omp %0' directives">;
11341def err_omp_interop_variable_expected : Error<
11342  "expected%select{| non-const}0 variable of type 'omp_interop_t'">;
11343def err_omp_interop_variable_wrong_type : Error<
11344  "interop variable must be of type 'omp_interop_t'">;
11345def err_omp_interop_prefer_type : Error<
11346  "prefer_list item must be a string literal or constant integral "
11347  "expression">;
11348def err_omp_interop_bad_depend_clause : Error<
11349  "'depend' clause requires the 'targetsync' interop type">;
11350def err_omp_interop_var_multiple_actions : Error<
11351  "interop variable %0 used in multiple action clauses">;
11352def err_omp_dispatch_statement_call
11353    : Error<"statement after '#pragma omp dispatch' must be a direct call"
11354            " to a target function or an assignment to one">;
11355def err_omp_unroll_full_variable_trip_count : Error<
11356  "loop to be fully unrolled must have a constant trip count">;
11357def note_omp_directive_here : Note<"'%0' directive found here">;
11358def err_omp_instantiation_not_supported
11359    : Error<"instantiation of '%0' not supported yet">;
11360def err_omp_adjust_arg_multiple_clauses : Error<
11361  "'adjust_arg' argument %0 used in multiple clauses">;
11362def err_omp_clause_requires_dispatch_construct : Error<
11363  "'%0' clause requires 'dispatch' context selector">;
11364def err_omp_append_args_with_varargs : Error<
11365  "'append_args' is not allowed with varargs functions">;
11366def err_openmp_vla_in_task_untied : Error<
11367  "variable length arrays are not supported in OpenMP tasking regions with 'untied' clause">;
11368def warn_omp_unterminated_declare_target : Warning<
11369  "expected '#pragma omp end declare target' at end of file to match '#pragma omp %0'">,
11370  InGroup<SourceUsesOpenMP>;
11371} // end of OpenMP category
11372
11373let CategoryName = "Related Result Type Issue" in {
11374// Objective-C related result type compatibility
11375def warn_related_result_type_compatibility_class : Warning<
11376  "method is expected to return an instance of its class type "
11377  "%diff{$, but is declared to return $|"
11378  ", but is declared to return different type}0,1">;
11379def warn_related_result_type_compatibility_protocol : Warning<
11380  "protocol method is expected to return an instance of the implementing "
11381  "class, but is declared to return %0">;
11382def note_related_result_type_family : Note<
11383  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
11384  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
11385  "self}1' method family%select{| and is expected to return an instance of its "
11386  "class type}0">;
11387def note_related_result_type_overridden : Note<
11388  "overridden method returns an instance of its class type">;
11389def note_related_result_type_inferred : Note<
11390  "%select{class|instance}0 method %1 is assumed to return an instance of "
11391  "its receiver type (%2)">;
11392def note_related_result_type_explicit : Note<
11393  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
11394  "%select{| and is expected to return an instance of its class type}0">;
11395def err_invalid_type_for_program_scope_var : Error<
11396  "the %0 type cannot be used to declare a program scope variable">;
11397
11398}
11399
11400let CategoryName = "Modules Issue" in {
11401def err_module_decl_in_module_map_module : Error<
11402  "'module' declaration found while building module from module map">;
11403def err_module_decl_in_header_unit : Error<
11404  "'module' declaration found while building header unit">;
11405def err_module_interface_implementation_mismatch : Error<
11406  "missing 'export' specifier in module declaration while "
11407  "building module interface">;
11408def err_current_module_name_mismatch : Error<
11409  "module name '%0' specified on command line does not match name of module">;
11410def err_module_redefinition : Error<
11411  "redefinition of module '%0'">;
11412def note_prev_module_definition : Note<"previously defined here">;
11413def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
11414def err_module_not_defined : Error<
11415  "definition of module '%0' is not available; use -fmodule-file= to specify "
11416  "path to precompiled module interface">;
11417def err_module_redeclaration : Error<
11418  "translation unit contains multiple module declarations">;
11419def note_prev_module_declaration : Note<"previous module declaration is here">;
11420def err_module_declaration_missing : Error<
11421  "missing 'export module' declaration in module interface unit">;
11422def err_module_declaration_missing_after_global_module_introducer : Error<
11423  "missing 'module' declaration at end of global module fragment "
11424  "introduced here">;
11425def err_module_private_specialization : Error<
11426  "%select{template|partial|member}0 specialization cannot be "
11427  "declared __module_private__">;
11428def err_module_private_local : Error<
11429  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
11430  "__module_private__">;
11431def err_module_private_local_class : Error<
11432  "local %select{struct|interface|union|class|enum}0 cannot be declared "
11433  "__module_private__">;
11434def err_module_unimported_use : Error<
11435  "%select{declaration|definition|default argument|"
11436  "explicit specialization|partial specialization}0 of %1 must be imported "
11437  "from module '%2' before it is required">;
11438def err_module_unimported_use_header : Error<
11439  "%select{missing '#include'|missing '#include %3'}2; "
11440  "%select{||default argument of |explicit specialization of |"
11441  "partial specialization of }0%1 must be "
11442  "%select{declared|defined|defined|declared|declared}0 "
11443  "before it is used">;
11444def err_module_unimported_use_multiple : Error<
11445  "%select{declaration|definition|default argument|"
11446  "explicit specialization|partial specialization}0 of %1 must be imported "
11447  "from one of the following modules before it is required:%2">;
11448def note_unreachable_entity : Note<
11449  "%select{declaration|definition|default argument declared|"
11450  "explicit specialization declared|partial specialization declared}0 here "
11451  "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
11452def ext_module_import_in_extern_c : ExtWarn<
11453  "import of C++ module '%0' appears within extern \"C\" language linkage "
11454  "specification">, DefaultError,
11455  InGroup<DiagGroup<"module-import-in-extern-c">>;
11456def err_module_import_not_at_top_level_fatal : Error<
11457  "import of module '%0' appears within %1">, DefaultFatal;
11458def ext_module_import_not_at_top_level_noop : ExtWarn<
11459  "redundant #include of module '%0' appears within %1">, DefaultError,
11460  InGroup<DiagGroup<"modules-import-nested-redundant">>;
11461def note_module_import_not_at_top_level : Note<"%0 begins here">;
11462def err_module_self_import : Error<
11463  "import of module '%0' appears within same top-level module '%1'">;
11464def err_module_self_import_cxx20 : Error<
11465  "import of module '%0' appears within its own %select{interface|implementation}1">;
11466def err_module_import_in_implementation : Error<
11467  "@import of module '%0' in implementation of '%1'; use #import">;
11468
11469// C++ Modules
11470def err_module_import_non_interface_nor_parition : Error<
11471  "import of module '%0' imported non C++20 importable modules">;
11472def err_module_decl_not_at_start : Error<
11473  "module declaration must occur at the start of the translation unit">;
11474def note_global_module_introducer_missing : Note<
11475  "add 'module;' to the start of the file to introduce a "
11476  "global module fragment">;
11477def err_export_within_anonymous_namespace : Error<
11478  "export declaration appears within anonymous namespace">;
11479def note_anonymous_namespace : Note<"anonymous namespace begins here">;
11480def note_export : Note<"export block begins here">;
11481def err_export_within_export : Error<
11482  "export declaration appears within another export declaration">;
11483def err_export_anon_ns_internal : Error<
11484  "anonymous namespaces cannot be exported">;
11485def err_export_internal : Error<
11486  "declaration of %0 with internal linkage cannot be exported">;
11487def err_export_using_internal : Error<
11488  "using declaration referring to %1 with %select{internal|module|unknown}0 "
11489  "linkage cannot be exported">;
11490def err_export_not_in_module_interface : Error<
11491  "export declaration can only be used within a module purview">;
11492def err_export_inline_not_defined : Error<
11493  "inline function not defined%select{| before the private module fragment}0">;
11494def err_export_partition_impl : Error<
11495  "module partition implementations cannot be exported">;
11496def err_export_in_private_module_fragment : Error<
11497  "export declaration cannot be used in a private module fragment">;
11498def note_private_module_fragment : Note<
11499  "private module fragment begins here">;
11500def err_private_module_fragment_not_module : Error<
11501  "private module fragment declaration with no preceding module declaration">;
11502def err_private_module_fragment_redefined : Error<
11503  "private module fragment redefined">;
11504def err_private_module_fragment_not_module_interface : Error<
11505  "private module fragment in module implementation unit">;
11506def note_not_module_interface_add_export : Note<
11507  "add 'export' here if this is intended to be a module interface unit">;
11508def err_invalid_module_name : Error<"%0 is an invalid name for a module">;
11509def err_extern_def_in_header_unit : Error<
11510  "non-inline external definitions are not permitted in C++ header units">;
11511
11512def warn_experimental_header_unit : Warning<
11513  "the implementation of header units is in an experimental phase">,
11514  InGroup<DiagGroup<"experimental-header-units">>;
11515
11516def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
11517  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
11518  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
11519def note_equivalent_internal_linkage_decl : Note<
11520  "declared here%select{ in module '%1'|}0">;
11521
11522def note_redefinition_modules_same_file : Note<
11523  "'%0' included multiple times, additional include site in header from module '%1'">;
11524def note_redefinition_include_same_file : Note<
11525  "'%0' included multiple times, additional include site here">;
11526}
11527
11528let CategoryName = "Coroutines Issue" in {
11529def err_return_in_coroutine : Error<
11530  "return statement not allowed in coroutine; did you mean 'co_return'?">;
11531def note_declared_coroutine_here : Note<
11532  "function is a coroutine due to use of '%0' here">;
11533def err_coroutine_objc_method : Error<
11534  "Objective-C methods as coroutines are not yet supported">;
11535def err_coroutine_unevaluated_context : Error<
11536  "'%0' cannot be used in an unevaluated context">;
11537def err_coroutine_within_handler : Error<
11538  "'%0' cannot be used in the handler of a try block">;
11539def err_coroutine_outside_function : Error<
11540  "'%0' cannot be used outside a function">;
11541def err_coroutine_invalid_func_context : Error<
11542  "'%1' cannot be used in %select{a constructor|a destructor"
11543  "|the 'main' function|a constexpr function"
11544  "|a function with a deduced return type|a varargs function"
11545  "|a consteval function}0">;
11546def err_implied_coroutine_type_not_found : Error<
11547  "%0 type was not found; include <coroutine> before defining "
11548  "a coroutine">;
11549def err_implicit_coroutine_std_nothrow_type_not_found : Error<
11550  "std::nothrow was not found; include <new> before defining a coroutine which "
11551  "uses get_return_object_on_allocation_failure()">;
11552def err_malformed_std_nothrow : Error<
11553  "std::nothrow must be a valid variable declaration">;
11554def err_malformed_std_coroutine_handle : Error<
11555  "std::coroutine_handle isn't a class template">;
11556def err_coroutine_handle_missing_member : Error<
11557  "std::coroutine_handle must have a member named '%0'">;
11558def err_malformed_std_coroutine_traits : Error<
11559  "std::coroutine_traits isn't a class template">;
11560def err_implied_std_coroutine_traits_promise_type_not_found : Error<
11561  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
11562def err_implied_std_coroutine_traits_promise_type_not_class : Error<
11563  "this function cannot be a coroutine: %0 is not a class">;
11564def err_coroutine_promise_type_incomplete : Error<
11565  "this function cannot be a coroutine: %0 is an incomplete type">;
11566def err_coroutine_type_missing_specialization : Error<
11567  "this function cannot be a coroutine: missing definition of "
11568  "specialization %0">;
11569def err_coroutine_promise_incompatible_return_functions : Error<
11570  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
11571def note_coroutine_promise_implicit_await_transform_required_here : Note<
11572  "call to 'await_transform' implicitly required by 'co_await' here">;
11573def note_coroutine_promise_suspend_implicitly_required : Note<
11574  "call to '%select{initial_suspend|final_suspend}0' implicitly "
11575  "required by the %select{initial suspend point|final suspend point}0">;
11576def err_coroutine_promise_unhandled_exception_required : Error<
11577  "%0 is required to declare the member 'unhandled_exception()'">;
11578def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
11579  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
11580  InGroup<CoroutineMissingUnhandledException>;
11581def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
11582  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
11583def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
11584  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
11585def err_coroutine_promise_new_requires_nothrow : Error<
11586  "%0 is required to have a non-throwing noexcept specification when the promise "
11587   "type declares 'get_return_object_on_allocation_failure()'">;
11588def note_coroutine_promise_call_implicitly_required : Note<
11589  "call to %0 implicitly required by coroutine function here">;
11590def err_await_suspend_invalid_return_type : Error<
11591  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
11592>;
11593def note_await_ready_no_bool_conversion : Note<
11594  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
11595>;
11596def warn_coroutine_handle_address_invalid_return_type : Warning <
11597  "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">,
11598  InGroup<Coroutine>;
11599def err_coroutine_promise_final_suspend_requires_nothrow : Error<
11600  "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
11601>;
11602def note_coroutine_function_declare_noexcept : Note<
11603  "must be declared with 'noexcept'"
11604>;
11605def warn_always_inline_coroutine : Warning<
11606  "this coroutine may be split into pieces; not every piece is guaranteed to be inlined"
11607  >,
11608  InGroup<AlwaysInlineCoroutine>;
11609def err_coroutine_unusable_new : Error<
11610  "'operator new' provided by %0 is not usable with the function signature of %1"
11611>;
11612def err_coroutine_unfound_nothrow_new : Error <
11613  "unable to find %select{'::operator new(size_t, nothrow_t)'|"
11614  "'::operator new(size_t, align_val_t, nothrow_t)'}1 for %0"
11615>;
11616def warn_non_aligned_allocation_function : Warning <
11617  "under -fcoro-aligned-allocation, the non-aligned allocation function "
11618  "for the promise type %0 has higher precedence than the global aligned "
11619  "allocation function">,
11620  InGroup<CoroNonAlignedAllocationFunction>;
11621def err_conflicting_aligned_options : Error <
11622  "conflicting option '-fcoro-aligned-allocation' and '-fno-aligned-allocation'"
11623>;
11624def err_coro_invalid_addr_of_label : Error<
11625  "the GNU address of label extension is not allowed in coroutines."
11626>;
11627def err_coroutine_return_type : Error<
11628  "function returns a type %0 marked with [[clang::coro_return_type]] but is neither a coroutine nor a coroutine wrapper; "
11629  "non-coroutines should be marked with [[clang::coro_wrapper]] to allow returning coroutine return type"
11630>;
11631} // end of coroutines issue category
11632
11633let CategoryName = "Documentation Issue" in {
11634def warn_not_a_doxygen_trailing_member_comment : Warning<
11635  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
11636def warn_splice_in_doxygen_comment : Warning<
11637  "line splicing in Doxygen comments are not supported">, InGroup<Documentation>, DefaultIgnore;
11638} // end of documentation issue category
11639
11640let CategoryName = "Nullability Issue" in {
11641
11642def warn_mismatched_nullability_attr : Warning<
11643  "nullability specifier %0 conflicts with existing specifier %1">,
11644  InGroup<Nullability>;
11645
11646def warn_nullability_declspec : Warning<
11647  "nullability specifier %0 cannot be applied "
11648  "to non-pointer type %1; did you mean to apply the specifier to the "
11649  "%select{pointer|block pointer|member pointer|function pointer|"
11650  "member function pointer}2?">,
11651  InGroup<NullabilityDeclSpec>,
11652  DefaultError;
11653
11654def note_nullability_here : Note<"%0 specified here">;
11655
11656def err_nullability_nonpointer : Error<
11657  "nullability specifier %0 cannot be applied to non-pointer type %1">;
11658
11659def warn_nullability_lost : Warning<
11660  "implicit conversion from nullable pointer %0 to non-nullable pointer "
11661  "type %1">,
11662  InGroup<NullableToNonNullConversion>, DefaultIgnore;
11663def warn_zero_as_null_pointer_constant : Warning<
11664  "zero as null pointer constant">,
11665  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
11666
11667def err_nullability_cs_multilevel : Error<
11668  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
11669def note_nullability_type_specifier : Note<
11670  "use nullability type specifier %0 to affect the innermost "
11671  "pointer type of %1">;
11672
11673def warn_null_resettable_setter : Warning<
11674  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
11675  InGroup<Nullability>;
11676
11677def warn_nullability_missing : Warning<
11678  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
11679  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
11680  InGroup<NullabilityCompleteness>;
11681def warn_nullability_missing_array : Warning<
11682  "array parameter is missing a nullability type specifier (_Nonnull, "
11683  "_Nullable, or _Null_unspecified)">,
11684  InGroup<NullabilityCompletenessOnArrays>;
11685def note_nullability_fix_it : Note<
11686  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
11687  "%select{pointer|block pointer|member pointer|array parameter}1 "
11688  "%select{should never be null|may be null|should not declare nullability}0">;
11689
11690def warn_nullability_inferred_on_nested_type : Warning<
11691  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
11692  "deprecated">,
11693  InGroup<NullabilityInferredOnNestedType>;
11694
11695def err_objc_type_arg_explicit_nullability : Error<
11696  "type argument %0 cannot explicitly specify nullability">;
11697
11698def err_objc_type_param_bound_explicit_nullability : Error<
11699  "type parameter %0 bound %1 cannot explicitly specify nullability">;
11700
11701}
11702
11703let CategoryName = "Generics Issue" in {
11704
11705def err_objc_type_param_bound_nonobject : Error<
11706  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
11707
11708def err_objc_type_param_bound_missing_pointer : Error<
11709  "missing '*' in type bound %0 for type parameter %1">;
11710def err_objc_type_param_bound_qualified : Error<
11711  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
11712
11713def err_objc_type_param_redecl : Error<
11714  "redeclaration of type parameter %0">;
11715
11716def err_objc_type_param_arity_mismatch : Error<
11717  "%select{forward class declaration|class definition|category|extension}0 has "
11718  "too %select{few|many}1 type parameters (expected %2, have %3)">;
11719
11720def err_objc_type_param_bound_conflict : Error<
11721  "type bound %0 for type parameter %1 conflicts with "
11722  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
11723
11724def err_objc_type_param_variance_conflict : Error<
11725  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
11726  "%select{in|co|contra}2variant type parameter %3">;
11727
11728def note_objc_type_param_here : Note<"type parameter %0 declared here">;
11729
11730def err_objc_type_param_bound_missing : Error<
11731  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
11732
11733def err_objc_parameterized_category_nonclass : Error<
11734  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
11735  "parameters">;
11736
11737def err_objc_parameterized_forward_class : Error<
11738  "forward declaration of non-parameterized class %0 cannot have type "
11739  "parameters">;
11740
11741def err_objc_parameterized_forward_class_first : Error<
11742  "class %0 previously declared with type parameters">;
11743
11744def err_objc_type_arg_missing_star : Error<
11745  "type argument %0 must be a pointer (requires a '*')">;
11746def err_objc_type_arg_qualified : Error<
11747  "type argument %0 cannot be qualified with '%1'">;
11748
11749def err_objc_type_arg_missing : Error<
11750  "no type or protocol named %0">;
11751
11752def err_objc_type_args_and_protocols : Error<
11753  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
11754  "%select{protocol|type}0 (%2)">;
11755
11756def err_objc_type_args_non_class : Error<
11757  "type arguments cannot be applied to non-class type %0">;
11758
11759def err_objc_type_args_non_parameterized_class : Error<
11760  "type arguments cannot be applied to non-parameterized class %0">;
11761
11762def err_objc_type_args_specialized_class : Error<
11763  "type arguments cannot be applied to already-specialized class type %0">;
11764
11765def err_objc_type_args_wrong_arity : Error<
11766  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
11767}
11768
11769def err_type_available_only_in_default_eval_method : Error<
11770  "cannot use type '%0' within '#pragma clang fp eval_method'; type is set "
11771  "according to the default eval method for the translation unit">;
11772
11773def err_objc_type_arg_not_id_compatible : Error<
11774  "type argument %0 is neither an Objective-C object nor a block type">;
11775
11776def err_objc_type_arg_does_not_match_bound : Error<
11777  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
11778
11779def warn_objc_redundant_qualified_class_type : Warning<
11780  "parameterized class %0 already conforms to the protocols listed; did you "
11781  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
11782
11783def warn_block_literal_attributes_on_omitted_return_type : Warning<
11784  "attribute %0 ignored, because it cannot be applied to omitted return type">,
11785  InGroup<IgnoredAttributes>;
11786
11787def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
11788  "'%0' qualifier on omitted return type %1 has no effect">,
11789  InGroup<IgnoredQualifiers>;
11790
11791def warn_shadow_field : Warning<
11792  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
11793  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
11794def note_shadow_field : Note<"declared here">;
11795
11796def err_multiversion_required_in_redecl : Error<
11797  "function declaration is missing %select{'target'|'cpu_specific' or "
11798  "'cpu_dispatch'|'target_version'}0 attribute in a multiversioned function">;
11799def note_multiversioning_caused_here : Note<
11800  "function multiversioning caused by this declaration">;
11801def err_multiversion_after_used : Error<
11802  "function declaration cannot become a multiversioned function after first "
11803  "usage">;
11804def err_bad_multiversion_option : Error<
11805  "function multiversioning doesn't support %select{feature|architecture}0 "
11806  "'%1'">;
11807def err_multiversion_duplicate : Error<
11808  "multiversioned function redeclarations require identical target attributes">;
11809def err_multiversion_noproto : Error<
11810  "multiversioned function must have a prototype">;
11811def err_multiversion_disallowed_other_attr
11812    : Error<"attribute "
11813            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
11814            "multiversioning cannot be combined"
11815            " with attribute %1">;
11816def err_multiversion_diff : Error<
11817  "multiversioned function declaration has a different %select{calling convention"
11818  "|return type|constexpr specification|inline specification|linkage|"
11819  "language linkage}0">;
11820def err_multiversion_doesnt_support
11821    : Error<"attribute "
11822            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
11823            "multiversioned functions do not "
11824            "yet support %select{function templates|virtual functions|"
11825            "deduced return types|constructors|destructors|deleted functions|"
11826            "defaulted functions|constexpr functions|consteval "
11827            "function|lambdas}1">;
11828def err_multiversion_not_allowed_on_main : Error<
11829  "'main' cannot be a multiversioned function">;
11830def err_multiversion_not_supported : Error<
11831 "function multiversioning is not supported on the current target">;
11832def err_multiversion_types_mixed : Error<
11833  "multiversioning attributes cannot be combined">;
11834def err_cpu_dispatch_mismatch : Error<
11835 "'cpu_dispatch' function redeclared with different CPUs">;
11836def err_cpu_specific_multiple_defs : Error<
11837 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
11838def warn_multiversion_duplicate_entries : Warning<
11839 "CPU list contains duplicate entries; attribute ignored">,
11840  InGroup<FunctionMultiVersioning>;
11841def warn_dispatch_body_ignored : Warning<
11842  "body of cpu_dispatch function will be ignored">,
11843  InGroup<FunctionMultiVersioning>;
11844def err_target_clone_must_have_default
11845    : Error<"'target_clones' multiversioning requires a default target">;
11846def err_target_clone_doesnt_match
11847    : Error<"'target_clones' attribute does not match previous declaration">;
11848def warn_target_clone_mixed_values
11849    : ExtWarn<
11850          "mixing 'target_clones' specifier mechanisms is permitted for GCC "
11851          "compatibility; use a comma separated sequence of string literals, "
11852          "or a string literal containing a comma-separated list of versions">,
11853      InGroup<TargetClonesMixedSpecifiers>;
11854def warn_target_clone_duplicate_options
11855    : Warning<"version list contains duplicate entries">,
11856      InGroup<FunctionMultiVersioning>;
11857def warn_target_clone_no_impact_options
11858    : Warning<"version list contains entries that don't impact code generation">,
11859      InGroup<FunctionMultiVersioning>;
11860
11861// three-way comparison operator diagnostics
11862def err_implied_comparison_category_type_not_found : Error<
11863  "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
11864  "because type '%0' was not found; include <compare>">;
11865def err_spaceship_argument_narrowing : Error<
11866  "argument to 'operator<=>' "
11867  "%select{cannot be narrowed from type %1 to %2|"
11868  "evaluates to %1, which cannot be narrowed to type %2}0">;
11869def err_std_compare_type_not_supported : Error<
11870  "standard library implementation of %0 is not supported; "
11871   "%select{member '%2' does not have expected form|"
11872   "member '%2' is missing|"
11873   "the type is not trivially copyable|"
11874   "the type does not have the expected form}1">;
11875def note_rewriting_operator_as_spaceship : Note<
11876  "while rewriting comparison as call to 'operator<=>' declared here">;
11877def err_three_way_vector_comparison : Error<
11878  "three-way comparison between vectors is not supported">;
11879
11880// Memory Tagging Extensions (MTE) diagnostics
11881def err_memtag_arg_null_or_pointer : Error<
11882  "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
11883def err_memtag_any2arg_pointer : Error<
11884  "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
11885def err_memtag_arg_must_be_pointer : Error<
11886  "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
11887def err_memtag_arg_must_be_integer : Error<
11888  "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
11889
11890def warn_dereference_of_noderef_type : Warning<
11891  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
11892def warn_dereference_of_noderef_type_no_decl : Warning<
11893  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
11894def warn_noderef_on_non_pointer_or_array : Warning<
11895  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
11896def warn_noderef_to_dereferenceable_pointer : Warning<
11897  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
11898
11899def err_builtin_launder_invalid_arg : Error<
11900  "%select{non-pointer|function pointer|void pointer}0 argument to "
11901  "'__builtin_launder' is not allowed">;
11902
11903def err_builtin_invalid_arg_type: Error <
11904  "%ordinal0 argument must be a "
11905  "%select{vector, integer or floating point type|matrix|"
11906  "pointer to a valid matrix element type|"
11907  "signed integer or floating point type|vector type|"
11908  "floating point type|"
11909  "vector of integers}1 (was %2)">;
11910
11911def err_builtin_matrix_disabled: Error<
11912  "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
11913def err_matrix_index_not_integer: Error<
11914  "matrix %select{row|column}0 index is not an integer">;
11915def err_matrix_index_outside_range: Error<
11916  "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
11917def err_matrix_incomplete_index: Error<
11918  "single subscript expressions are not allowed for matrix values">;
11919def err_matrix_separate_incomplete_index: Error<
11920  "matrix row and column subscripts cannot be separated by any expression">;
11921def err_matrix_subscript_comma: Error<
11922  "comma expressions are not allowed as indices in matrix subscript expressions">;
11923def err_builtin_matrix_scalar_unsigned_arg: Error<
11924  "%0 argument must be a constant unsigned integer expression">;
11925def err_builtin_matrix_pointer_arg_mismatch: Error<
11926  "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
11927def err_builtin_matrix_store_to_const: Error<
11928  "cannot store matrix to read-only pointer">;
11929def err_builtin_matrix_stride_too_small: Error<
11930  "stride must be greater or equal to the number of rows">;
11931def err_builtin_matrix_invalid_dimension: Error<
11932  "%0 dimension is outside the allowed range [1, %1]">;
11933
11934def warn_mismatched_import : Warning<
11935  "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
11936  "previous declaration">,
11937  InGroup<IgnoredAttributes>;
11938def warn_import_on_definition : Warning<
11939  "import %select{module|name}0 cannot be applied to a function with a definition">,
11940  InGroup<IgnoredAttributes>;
11941
11942def err_preserve_field_info_not_field : Error<
11943  "__builtin_preserve_field_info argument %0 not a field access">;
11944def err_preserve_field_info_not_const: Error<
11945  "__builtin_preserve_field_info argument %0 not a constant">;
11946def err_btf_type_id_not_const: Error<
11947  "__builtin_btf_type_id argument %0 not a constant">;
11948def err_preserve_type_info_invalid : Error<
11949  "__builtin_preserve_type_info argument %0 invalid">;
11950def err_preserve_type_info_not_const: Error<
11951  "__builtin_preserve_type_info argument %0 not a constant">;
11952def err_preserve_enum_value_invalid : Error<
11953  "__builtin_preserve_enum_value argument %0 invalid">;
11954def err_preserve_enum_value_not_const: Error<
11955  "__builtin_preserve_enum_value argument %0 not a constant">;
11956
11957def err_bit_cast_non_trivially_copyable : Error<
11958  "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
11959def err_bit_cast_type_size_mismatch : Error<
11960  "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
11961
11962// SYCL-specific diagnostics
11963def warn_sycl_kernel_num_of_template_params : Warning<
11964  "'sycl_kernel' attribute only applies to a function template with at least"
11965  " two template parameters">, InGroup<IgnoredAttributes>;
11966def warn_sycl_kernel_invalid_template_param_type : Warning<
11967  "template parameter of a function template with the 'sycl_kernel' attribute"
11968  " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
11969def warn_sycl_kernel_num_of_function_params : Warning<
11970  "function template with 'sycl_kernel' attribute must have a single parameter">,
11971  InGroup<IgnoredAttributes>;
11972def warn_sycl_kernel_return_type : Warning<
11973  "function template with 'sycl_kernel' attribute must have a 'void' return type">,
11974  InGroup<IgnoredAttributes>;
11975def err_sycl_special_type_num_init_method : Error<
11976  "types with 'sycl_special_class' attribute must have one and only one '__init' "
11977  "method defined">;
11978
11979def warn_cuda_maxclusterrank_sm_90 : Warning<
11980  "maxclusterrank requires sm_90 or higher, CUDA arch provided: %0, ignoring "
11981  "%1 attribute">, InGroup<IgnoredAttributes>;
11982
11983def err_bit_int_bad_size : Error<"%select{signed|unsigned}0 _BitInt must "
11984                                 "have a bit size of at least %select{2|1}0">;
11985def err_bit_int_max_size : Error<"%select{signed|unsigned}0 _BitInt of bit "
11986                                 "sizes greater than %1 not supported">;
11987
11988// errors of expect.with.probability
11989def err_probability_not_constant_float : Error<
11990   "probability argument to __builtin_expect_with_probability must be constant "
11991   "floating-point expression">;
11992def err_probability_out_of_range : Error<
11993   "probability argument to __builtin_expect_with_probability is outside the "
11994   "range [0.0, 1.0]">;
11995
11996// TCB warnings
11997def err_tcb_conflicting_attributes : Error<
11998  "attributes '%0(\"%2\")' and '%1(\"%2\")' are mutually exclusive">;
11999def warn_tcb_enforcement_violation : Warning<
12000  "calling %0 is a violation of trusted computing base '%1'">,
12001  InGroup<DiagGroup<"tcb-enforcement">>;
12002
12003// RISC-V builtin required extension warning
12004def err_riscv_builtin_requires_extension : Error<
12005  "builtin requires%select{| at least one of the following extensions}0: %1">;
12006def err_riscv_builtin_invalid_lmul : Error<
12007  "LMUL argument must be in the range [0,3] or [5,7]">;
12008def err_riscv_type_requires_extension : Error<
12009  "RISC-V type %0 requires the '%1' extension"
12010>;
12011
12012def err_std_source_location_impl_not_found : Error<
12013  "'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called">;
12014def err_std_source_location_impl_malformed : Error<
12015  "'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'">;
12016
12017// HLSL Diagnostics
12018def err_hlsl_attr_unsupported_in_stage : Error<"attribute %0 is unsupported in '%1' shaders, requires %select{|one of the following: }2%3">;
12019def err_hlsl_attr_invalid_type : Error<
12020   "attribute %0 only applies to a field or parameter of type '%1'">;
12021def err_hlsl_attr_invalid_ast_node : Error<
12022   "attribute %0 only applies to %1">;
12023def err_hlsl_entry_shader_attr_mismatch : Error<
12024   "%0 attribute on entry function does not match the target profile">;
12025def err_hlsl_numthreads_argument_oor : Error<"argument '%select{X|Y|Z}0' to numthreads attribute cannot exceed %1">;
12026def err_hlsl_numthreads_invalid : Error<"total number of threads cannot exceed %0">;
12027def err_hlsl_missing_numthreads : Error<"missing numthreads attribute for %0 shader entry">;
12028def err_hlsl_attribute_param_mismatch : Error<"%0 attribute parameters do not match the previous declaration">;
12029def err_hlsl_duplicate_parameter_modifier : Error<"duplicate parameter modifier %0">;
12030def err_hlsl_missing_semantic_annotation : Error<
12031  "semantic annotations must be present for all parameters of an entry "
12032  "function or patch constant function">;
12033def err_hlsl_init_priority_unsupported : Error<
12034  "initializer priorities are not supported in HLSL">;
12035
12036def err_hlsl_unsupported_register_type : Error<"invalid resource class specifier '%0' used; expected 'b', 's', 't', or 'u'">;
12037def err_hlsl_unsupported_register_number : Error<"register number should be an integer">;
12038def err_hlsl_expected_space : Error<"invalid space specifier '%0' used; expected 'space' followed by an integer, like space1">;
12039def err_hlsl_pointers_unsupported : Error<
12040  "%select{pointers|references}0 are unsupported in HLSL">;
12041
12042def err_hlsl_operator_unsupported : Error<
12043  "the '%select{&|*|->}0' operator is unsupported in HLSL">;
12044
12045def err_hlsl_param_qualifier_mismatch :
12046  Error<"conflicting parameter qualifier %0 on parameter %1">;
12047
12048// Layout randomization diagnostics.
12049def err_non_designated_init_used : Error<
12050  "a randomized struct can only be initialized with a designated initializer">;
12051def err_cast_from_randomized_struct : Error<
12052  "casting from randomized structure pointer type %0 to %1">;
12053
12054// Unsafe buffer usage diagnostics.
12055def warn_unsafe_buffer_variable : Warning<
12056  "%0 is an %select{unsafe pointer used for buffer access|unsafe buffer that "
12057  "does not perform bounds checks}1">,
12058  InGroup<UnsafeBufferUsage>, DefaultIgnore;
12059def warn_unsafe_buffer_operation : Warning<
12060  "%select{unsafe pointer operation|unsafe pointer arithmetic|"
12061  "unsafe buffer access|function introduces unsafe buffer manipulation}0">,
12062  InGroup<UnsafeBufferUsage>, DefaultIgnore;
12063def note_unsafe_buffer_operation : Note<
12064  "used%select{| in pointer arithmetic| in buffer access}0 here">;
12065def note_unsafe_buffer_variable_fixit_group : Note<
12066  "change type of %0 to '%select{std::span|std::array|std::span::iterator}1' to preserve bounds information%select{|, and change %2 to '%select{std::span|std::array|std::span::iterator}1' to propagate bounds information between them}3">;
12067def note_unsafe_buffer_variable_fixit_together : Note<
12068  "change type of %0 to '%select{std::span|std::array|std::span::iterator}1' to preserve bounds information"
12069  "%select{|, and change %2 to safe types to make function %4 bounds-safe}3">;
12070def note_safe_buffer_usage_suggestions_disabled : Note<
12071  "pass -fsafe-buffer-usage-suggestions to receive code hardening suggestions">;
12072#ifndef NDEBUG
12073// Not a user-facing diagnostic. Useful for debugging false negatives in
12074// -fsafe-buffer-usage-suggestions (i.e. lack of -Wunsafe-buffer-usage fixits).
12075def note_safe_buffer_debug_mode : Note<"safe buffers debug: %0">;
12076#endif
12077
12078def err_builtin_pass_in_regs_non_class : Error<
12079  "argument %0 is not an unqualified class type">;
12080
12081
12082// WebAssembly reference type and table diagnostics.
12083def err_wasm_reference_pr : Error<
12084  "%select{pointer|reference}0 to WebAssembly reference type is not allowed">;
12085def err_wasm_ca_reference : Error<
12086  "cannot %select{capture|take address of}0 WebAssembly reference">;
12087def err_wasm_funcref_not_wasm : Error<
12088  "invalid use of '__funcref' keyword outside the WebAssembly triple">;
12089def err_wasm_table_pr : Error<
12090  "cannot form a %select{pointer|reference}0 to a WebAssembly table">;
12091def err_typecheck_wasm_table_must_have_zero_length : Error<
12092  "only zero-length WebAssembly tables are currently supported">;
12093def err_wasm_table_in_function : Error<
12094  "WebAssembly table cannot be declared within a function">;
12095def err_wasm_table_as_function_parameter : Error<
12096  "cannot use WebAssembly table as a function parameter">;
12097def err_wasm_table_invalid_uett_operand : Error<
12098  "invalid application of '%0' to WebAssembly table">;
12099def err_wasm_cast_table : Error<
12100  "cannot cast %select{to|from}0 a WebAssembly table">;
12101def err_wasm_table_conditional_expression : Error<
12102  "cannot use a WebAssembly table within a branch of a conditional expression">;
12103def err_wasm_table_art : Error<
12104  "cannot %select{assign|return|throw|subscript}0 a WebAssembly table">;
12105def err_wasm_reftype_tc : Error<
12106  "cannot %select{throw|catch}0 a WebAssembly reference type">;
12107def err_wasm_reftype_exception_spec : Error<
12108  "WebAssembly reference type not allowed in exception specification">;
12109def err_wasm_table_must_be_static : Error<
12110  "WebAssembly table must be static">;
12111def err_wasm_reftype_multidimensional_array : Error<
12112  "multi-dimensional arrays of WebAssembly references are not allowed">;
12113def err_wasm_builtin_arg_must_be_table_type : Error <
12114  "%ordinal0 argument must be a WebAssembly table">;
12115def err_wasm_builtin_arg_must_match_table_element_type : Error <
12116  "%ordinal0 argument must match the element type of the WebAssembly table in the %ordinal1 argument">;
12117def err_wasm_builtin_arg_must_be_integer_type : Error <
12118  "%ordinal0 argument must be an integer">;
12119} // end of sema component.
12120