xref: /freebsd/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td (revision 1db9f3b21e39176dd5b67cf8ac378633b172463e)
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 warn_attribute_arm_za_builtin_no_za_state : Warning<
3159  "builtin call is not valid when calling from a function without active ZA state">,
3160  InGroup<DiagGroup<"undefined-arm-za">>;
3161def err_sve_vector_in_non_sve_target : Error<
3162  "SVE vector type %0 cannot be used in a target without sve">;
3163def err_attribute_riscv_rvv_bits_unsupported : Error<
3164  "%0 is only supported when '-mrvv-vector-bits=<bits>' is specified with a "
3165  "value of \"zvl\" or a power 2 in the range [64,65536]">;
3166def err_attribute_bad_rvv_vector_size : Error<
3167  "invalid RVV vector size '%0', expected size is '%1' based on LMUL of type "
3168  "and '-mrvv-vector-bits'">;
3169def err_attribute_invalid_rvv_type : Error<
3170  "%0 attribute applied to non-RVV type %1">;
3171def err_attribute_requires_positive_integer : Error<
3172  "%0 attribute requires a %select{positive|non-negative}1 "
3173  "integral compile time constant expression">;
3174def err_attribute_requires_opencl_version : Error<
3175  "attribute %0 is supported in the OpenCL version %1%select{| onwards}2">;
3176def err_invalid_branch_protection_spec : Error<
3177  "invalid or misplaced branch protection specification '%0'">;
3178def warn_unsupported_branch_protection_spec : Warning<
3179  "unsupported branch protection specification '%0'">, InGroup<BranchProtection>;
3180
3181def warn_unsupported_target_attribute
3182    : Warning<"%select{unsupported|duplicate|unknown}0%select{| CPU|"
3183              " tune CPU}1 '%2' in the '%select{target|target_clones|target_version}3' "
3184              "attribute string; '%select{target|target_clones|target_version}3' "
3185              "attribute ignored">,
3186      InGroup<IgnoredAttributes>;
3187def err_attribute_unsupported
3188    : Error<"%0 attribute is not supported on targets missing %1;"
3189            " specify an appropriate -march= or -mcpu=">;
3190def err_duplicate_target_attribute
3191    : Error<"%select{unsupported|duplicate|unknown}0%select{| CPU|"
3192              " tune CPU}1 '%2' in the '%select{target|target_clones|target_version}3' "
3193              "attribute string; ">;
3194// The err_*_attribute_argument_not_int are separate because they're used by
3195// VerifyIntegerConstantExpression.
3196def err_aligned_attribute_argument_not_int : Error<
3197  "'aligned' attribute requires integer constant">;
3198def err_align_value_attribute_argument_not_int : Error<
3199  "'align_value' attribute requires integer constant">;
3200def err_alignas_attribute_wrong_decl_type : Error<
3201  "%0 attribute cannot be applied to %select{a function parameter|"
3202  "a variable with 'register' storage class|a 'catch' variable|a bit-field|"
3203  "an enumeration}1">;
3204def err_alignas_missing_on_definition : Error<
3205  "%0 must be specified on definition if it is specified on any declaration">;
3206def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
3207def err_alignas_mismatch : Error<
3208  "redeclaration has different alignment requirement (%1 vs %0)">;
3209def err_alignas_underaligned : Error<
3210  "requested alignment is less than minimum alignment of %1 for type %0">;
3211def warn_aligned_attr_underaligned : Warning<err_alignas_underaligned.Summary>,
3212  InGroup<IgnoredAttributes>;
3213def err_attribute_sizeless_type : Error<
3214  "%0 attribute cannot be applied to sizeless type %1">;
3215def err_attribute_argument_n_type : Error<
3216  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
3217  "constant|a string|an identifier|a constant expression|a builtin function}2">;
3218def err_attribute_argument_type : Error<
3219  "%0 attribute requires %select{int or bool|an integer "
3220  "constant|a string|an identifier}1">;
3221def err_attribute_argument_out_of_range : Error<
3222  "%0 attribute requires integer constant between %1 and %2 inclusive">;
3223def err_init_priority_object_attr : Error<
3224  "can only use 'init_priority' attribute on file-scope definitions "
3225  "of objects of class type">;
3226def err_attribute_argument_out_of_bounds : Error<
3227  "%0 attribute parameter %1 is out of bounds">;
3228def err_attribute_only_once_per_parameter : Error<
3229  "%0 attribute can only be applied once per parameter">;
3230def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
3231def note_previous_uuid : Note<"previous uuid specified here">;
3232def warn_attribute_pointers_only : Warning<
3233  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
3234  InGroup<IgnoredAttributes>;
3235def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Summary>;
3236def err_attribute_integers_only : Error<
3237  "%0 attribute argument may only refer to a function parameter of integer "
3238  "type">;
3239def warn_attribute_return_pointers_only : Warning<
3240  "%0 attribute only applies to return values that are pointers">,
3241  InGroup<IgnoredAttributes>;
3242def warn_attribute_return_pointers_refs_only : Warning<
3243  "%0 attribute only applies to return values that are pointers or references">,
3244  InGroup<IgnoredAttributes>;
3245def warn_attribute_pointer_or_reference_only : Warning<
3246  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
3247  InGroup<IgnoredAttributes>;
3248def err_attribute_no_member_pointers : Error<
3249  "%0 attribute cannot be used with pointers to members">;
3250def err_attribute_invalid_implicit_this_argument : Error<
3251  "%0 attribute is invalid for the implicit this argument">;
3252def err_ownership_type : Error<
3253  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
3254def err_ownership_returns_index_mismatch : Error<
3255  "'ownership_returns' attribute index does not match; here it is %0">;
3256def note_ownership_returns_index_mismatch : Note<
3257  "declared with index %0 here">;
3258def err_format_strftime_third_parameter : Error<
3259  "strftime format attribute requires 3rd parameter to be 0">;
3260def err_format_attribute_not : Error<"format argument not a string type">;
3261def err_format_attribute_result_not : Error<"function does not return %0">;
3262def err_format_attribute_implicit_this_format_string : Error<
3263  "format attribute cannot specify the implicit this argument as the format "
3264  "string">;
3265def err_callback_attribute_no_callee : Error<
3266  "'callback' attribute specifies no callback callee">;
3267def err_callback_attribute_invalid_callee : Error<
3268  "'callback' attribute specifies invalid callback callee">;
3269def err_callback_attribute_multiple : Error<
3270  "multiple 'callback' attributes specified">;
3271def err_callback_attribute_argument_unknown : Error<
3272  "'callback' attribute argument %0 is not a known function parameter">;
3273def err_callback_callee_no_function_type : Error<
3274  "'callback' attribute callee does not have function type">;
3275def err_callback_callee_is_variadic : Error<
3276  "'callback' attribute callee may not be variadic">;
3277def err_callback_implicit_this_not_available : Error<
3278  "'callback' argument at position %0 references unavailable implicit 'this'">;
3279def err_init_method_bad_return_type : Error<
3280  "init methods must return an object pointer type, not %0">;
3281def err_attribute_invalid_size : Error<
3282  "vector size not an integral multiple of component size">;
3283def err_attribute_zero_size : Error<"zero %0 size">;
3284def err_attribute_size_too_large : Error<"%0 size too large">;
3285def err_typecheck_sve_rvv_ambiguous : Error<
3286  "cannot combine fixed-length and sizeless %select{SVE|RVV}0 vectors "
3287  "in expression, result is ambiguous (%1 and %2)">;
3288def err_typecheck_sve_rvv_gnu_ambiguous : Error<
3289  "cannot combine GNU and %select{SVE|RVV}0 vectors in expression, result is ambiguous (%1 and %2)">;
3290def err_typecheck_vector_not_convertable_implict_truncation : Error<
3291   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
3292   " %2 as implicit conversion would cause truncation">;
3293def err_typecheck_vector_not_convertable : Error<
3294  "cannot convert between vector values of different size (%0 and %1)">;
3295def err_typecheck_vector_not_convertable_non_scalar : Error<
3296  "cannot convert between vector and non-scalar values (%0 and %1)">;
3297def err_typecheck_vector_lengths_not_equal : Error<
3298  "vector operands do not have the same number of elements (%0 and %1)">;
3299def warn_typecheck_vector_element_sizes_not_equal : Warning<
3300  "vector operands do not have the same elements sizes (%0 and %1)">,
3301  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
3302def err_ext_vector_component_exceeds_length : Error<
3303  "vector component access exceeds type %0">;
3304def err_ext_vector_component_name_illegal : Error<
3305  "illegal vector component name '%0'">;
3306def err_attribute_address_space_negative : Error<
3307  "address space is negative">;
3308def err_attribute_address_space_too_high : Error<
3309  "address space is larger than the maximum supported (%0)">;
3310def err_attribute_address_multiple_qualifiers : Error<
3311  "multiple address spaces specified for type">;
3312def warn_attribute_address_multiple_identical_qualifiers : Warning<
3313  "multiple identical address spaces specified for type">,
3314  InGroup<DuplicateDeclSpecifier>;
3315def err_attribute_not_clinkage : Error<
3316  "function type with %0 attribute must have C linkage">;
3317def err_function_decl_cmse_ns_call : Error<
3318  "functions may not be declared with 'cmse_nonsecure_call' attribute">;
3319def err_attribute_address_function_type : Error<
3320  "function type may not be qualified with an address space">;
3321def err_as_qualified_auto_decl : Error<
3322  "automatic variable qualified with an%select{| invalid}0 address space">;
3323def err_arg_with_address_space : Error<
3324  "parameter may not be qualified with an address space">;
3325def err_field_with_address_space : Error<
3326  "field may not be qualified with an address space">;
3327def err_compound_literal_with_address_space : Error<
3328  "compound literal in function scope may not be qualified with an address space">;
3329def err_address_space_mismatch_templ_inst : Error<
3330  "conflicting address space qualifiers are provided between types %0 and %1">;
3331def err_attr_objc_ownership_redundant : Error<
3332  "the type %0 is already explicitly ownership-qualified">;
3333def err_invalid_nsnumber_type : Error<
3334  "%0 is not a valid literal type for NSNumber">;
3335def err_objc_illegal_boxed_expression_type : Error<
3336  "illegal type %0 used in a boxed expression">;
3337def err_objc_non_trivially_copyable_boxed_expression_type : Error<
3338  "non-trivially copyable type %0 cannot be used in a boxed expression">;
3339def err_objc_incomplete_boxed_expression_type : Error<
3340  "incomplete type %0 used in a boxed expression">;
3341def err_undeclared_objc_literal_class : Error<
3342  "definition of class %0 must be available to use Objective-C "
3343  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
3344  "string literals}1">;
3345def err_undeclared_boxing_method : Error<
3346  "declaration of %0 is missing in %1 class">;
3347def err_objc_literal_method_sig : Error<
3348  "literal construction method %0 has incompatible signature">;
3349def note_objc_literal_method_param : Note<
3350  "%select{first|second|third}0 parameter has unexpected type %1 "
3351  "(should be %2)">;
3352def note_objc_literal_method_return : Note<
3353  "method returns unexpected type %0 (should be an object type)">;
3354def err_invalid_collection_element : Error<
3355  "collection element of type %0 is not an Objective-C object">;
3356def err_box_literal_collection : Error<
3357  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3358  "in a collection">;
3359def warn_objc_literal_comparison : Warning<
3360  "direct comparison of %select{an array literal|a dictionary literal|"
3361  "a numeric literal|a boxed expression|}0 has undefined behavior">,
3362  InGroup<ObjCLiteralComparison>;
3363def err_missing_atsign_prefix : Error<
3364  "%select{string|numeric}0 literal must be prefixed by '@'">;
3365def warn_objc_string_literal_comparison : Warning<
3366  "direct comparison of a string literal has undefined behavior">,
3367  InGroup<ObjCStringComparison>;
3368def warn_concatenated_literal_array_init : Warning<
3369  "suspicious concatenation of string literals in an array initialization; "
3370  "did you mean to separate the elements with a comma?">,
3371  InGroup<StringConcatation>, DefaultIgnore;
3372def warn_concatenated_nsarray_literal : Warning<
3373  "concatenated NSString literal for an NSArray expression - "
3374  "possibly missing a comma">,
3375  InGroup<ObjCStringConcatenation>;
3376def note_objc_literal_comparison_isequal : Note<
3377  "use 'isEqual:' instead">;
3378def warn_objc_collection_literal_element : Warning<
3379  "object of type %0 is not compatible with "
3380  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3381  InGroup<ObjCLiteralConversion>;
3382def warn_nsdictionary_duplicate_key : Warning<
3383  "duplicate key in dictionary literal">,
3384  InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3385def note_nsdictionary_duplicate_key_here : Note<
3386  "previous equal key is here">;
3387def err_swift_param_attr_not_swiftcall : Error<
3388  "'%0' parameter can only be used with swiftcall%select{ or swiftasynccall|}1 "
3389  "calling convention%select{|s}1">;
3390def err_swift_indirect_result_not_first : Error<
3391  "'swift_indirect_result' parameters must be first parameters of function">;
3392def err_swift_error_result_not_after_swift_context : Error<
3393  "'swift_error_result' parameter must follow 'swift_context' parameter">;
3394def err_swift_abi_parameter_wrong_type : Error<
3395  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3396  "type here is %2">;
3397
3398def err_attribute_argument_invalid : Error<
3399  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3400  "min must not be greater than max}1">;
3401def err_attribute_argument_is_zero : Error<
3402  "%0 attribute must be greater than 0">;
3403def warn_attribute_argument_n_negative : Warning<
3404  "%0 attribute parameter %1 is negative and will be ignored">,
3405  InGroup<CudaCompat>;
3406def err_property_function_in_objc_container : Error<
3407  "use of Objective-C property in function nested in Objective-C "
3408  "container not supported, move function outside its container">;
3409
3410let CategoryName = "Cocoa API Issue" in {
3411def warn_objc_redundant_literal_use : Warning<
3412  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3413}
3414
3415def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3416  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3417
3418def err_attr_codemodel_arg : Error<"code model '%0' is not supported on this target">;
3419
3420def err_aix_attr_unsupported_tls_model : Error<"TLS model '%0' is not yet supported on AIX">;
3421
3422def err_tls_var_aligned_over_maximum : Error<
3423  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3424  "alignment (%2) for a thread-local variable on this target">;
3425
3426def err_only_annotate_after_access_spec : Error<
3427  "access specifier can only have annotation attributes">;
3428
3429def err_attribute_section_invalid_for_target : Error<
3430  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3431def err_pragma_section_invalid_for_target : Error<
3432  "argument to #pragma section is not valid for this target: %0">;
3433def warn_attribute_section_drectve : Warning<
3434  "#pragma %0(\".drectve\") has undefined behavior, "
3435  "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3436def warn_mismatched_section : Warning<
3437  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3438def warn_attribute_section_on_redeclaration : Warning<
3439  "section attribute is specified on redeclared variable">, InGroup<Section>;
3440def err_mismatched_code_seg_base : Error<
3441  "derived class must specify the same code segment as its base classes">;
3442def err_mismatched_code_seg_override : Error<
3443  "overriding virtual function must specify the same code segment as its overridden function">;
3444def err_conflicting_codeseg_attribute : Error<
3445  "conflicting code segment specifiers">;
3446def warn_duplicate_codeseg_attribute : Warning<
3447  "duplicate code segment specifiers">, InGroup<Section>;
3448
3449def err_anonymous_property: Error<
3450  "anonymous property is not supported">;
3451def err_property_is_variably_modified : Error<
3452  "property %0 has a variably modified type">;
3453def err_no_accessor_for_property : Error<
3454  "no %select{getter|setter}0 defined for property %1">;
3455def err_cannot_find_suitable_accessor : Error<
3456  "cannot find suitable %select{getter|setter}0 for property %1">;
3457
3458def warn_alloca : Warning<
3459  "use of function %0 is discouraged; there is no way to check for failure but "
3460  "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3461  InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3462
3463def warn_alloca_align_alignof : Warning<
3464  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3465  InGroup<DiagGroup<"alloca-with-align-alignof">>;
3466
3467def err_alignment_too_small : Error<
3468  "requested alignment must be %0 or greater">;
3469def err_alignment_too_big : Error<
3470  "requested alignment must be %0 or smaller">;
3471def err_alignment_not_power_of_two : Error<
3472  "requested alignment is not a power of 2">;
3473def warn_alignment_not_power_of_two : Warning<
3474  err_alignment_not_power_of_two.Summary>,
3475  InGroup<DiagGroup<"non-power-of-two-alignment">>;
3476def err_alignment_dependent_typedef_name : Error<
3477  "requested alignment is dependent but declaration is not dependent">;
3478
3479def warn_alignment_builtin_useless : Warning<
3480  "%select{aligning a value|the result of checking whether a value is aligned}0"
3481  " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3482def err_attribute_aligned_too_great : Error<
3483  "requested alignment must be %0 bytes or smaller">;
3484def warn_assume_aligned_too_great
3485    : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3486              "alignment assumed">,
3487      InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3488def warn_not_xl_compatible
3489    : Warning<"alignment of 16 bytes for a struct member is not binary "
3490              "compatible with IBM XL C/C++ for AIX 16.1.0 or older">,
3491      InGroup<AIXCompat>;
3492def note_misaligned_member_used_here : Note<
3493    "passing byval argument %0 with potentially incompatible alignment here">;
3494def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3495  "%q0 redeclared without %1 attribute: previous %1 ignored">,
3496  InGroup<MicrosoftInconsistentDllImport>;
3497def warn_redeclaration_without_import_attribute : Warning<
3498  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3499  InGroup<MicrosoftInconsistentDllImport>;
3500def warn_dllimport_dropped_from_inline_function : Warning<
3501  "%q0 redeclared inline; %1 attribute ignored">,
3502  InGroup<IgnoredAttributes>;
3503def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3504  " exception specification; attribute ignored">,
3505  InGroup<IgnoredAttributes>;
3506def warn_attribute_ignored_on_non_definition :
3507  Warning<"%0 attribute ignored on a non-definition declaration">,
3508  InGroup<IgnoredAttributes>;
3509def warn_attribute_ignored_on_inline :
3510  Warning<"%0 attribute ignored on inline function">,
3511  InGroup<IgnoredAttributes>;
3512def warn_nocf_check_attribute_ignored :
3513  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3514  InGroup<IgnoredAttributes>;
3515def warn_attribute_after_definition_ignored : Warning<
3516  "attribute %0 after definition is ignored">,
3517   InGroup<IgnoredAttributes>;
3518def warn_attributes_likelihood_ifstmt_conflict
3519    : Warning<"conflicting attributes %0 are ignored">,
3520      InGroup<IgnoredAttributes>;
3521def warn_cxx11_gnu_attribute_on_type : Warning<
3522  "attribute %0 ignored, because it cannot be applied to a type">,
3523  InGroup<IgnoredAttributes>;
3524def warn_unhandled_ms_attribute_ignored : Warning<
3525  "__declspec attribute %0 is not supported">,
3526  InGroup<IgnoredAttributes>;
3527def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3528  "attribute %0 has no effect when annotating an infinite loop">,
3529   InGroup<IgnoredAttributes>;
3530def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3531  "annotating the infinite loop here">;
3532def warn_attribute_has_no_effect_on_compile_time_if : Warning<
3533  "attribute %0 has no effect when annotating an 'if %select{constexpr|consteval}1' statement">,
3534   InGroup<IgnoredAttributes>;
3535def note_attribute_has_no_effect_on_compile_time_if_here : Note<
3536  "annotating the 'if %select{constexpr|consteval}0' statement here">;
3537def err_decl_attribute_invalid_on_stmt : Error<
3538  "%0%select{ attribute|}1 cannot be applied to a statement">;
3539def err_attribute_invalid_on_decl : Error<
3540  "%0%select{ attribute|}1 cannot be applied to a declaration">;
3541def warn_type_attribute_deprecated_on_decl : Warning<
3542  "applying attribute %0 to a declaration is deprecated; apply it to the type instead">,
3543  InGroup<DeprecatedAttributes>;
3544def warn_declspec_attribute_ignored : Warning<
3545  "attribute %0 is ignored, place it after "
3546  "\"%select{class|struct|interface|union|enum|enum class|enum struct}1\" to apply attribute to "
3547  "type declaration">, InGroup<IgnoredAttributes>;
3548def err_declspec_keyword_has_no_effect : Error<
3549  "%0 cannot appear here, place it after "
3550  "\"%select{class|struct|interface|union|enum}1\" to apply it to the "
3551  "type declaration">;
3552def warn_attribute_precede_definition : Warning<
3553  "attribute declaration must precede definition">,
3554  InGroup<IgnoredAttributes>;
3555def warn_attribute_void_function_method : Warning<
3556  "attribute %0 cannot be applied to "
3557  "%select{functions|Objective-C method}1 without return value">,
3558  InGroup<IgnoredAttributes>;
3559def warn_attribute_weak_on_field : Warning<
3560  "__weak attribute cannot be specified on a field declaration">,
3561  InGroup<IgnoredAttributes>;
3562def warn_gc_attribute_weak_on_local : Warning<
3563  "Objective-C GC does not allow weak variables on the stack">,
3564  InGroup<IgnoredAttributes>;
3565def warn_nsobject_attribute : Warning<
3566  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3567  InGroup<NSobjectAttribute>;
3568def warn_independentclass_attribute : Warning<
3569  "'objc_independent_class' attribute may be put on a typedef only; "
3570  "attribute is ignored">,
3571  InGroup<IndependentClassAttribute>;
3572def warn_ptr_independentclass_attribute : Warning<
3573  "'objc_independent_class' attribute may be put on Objective-C object "
3574  "pointer type only; attribute is ignored">,
3575  InGroup<IndependentClassAttribute>;
3576def warn_attribute_weak_on_local : Warning<
3577  "__weak attribute cannot be specified on an automatic variable when ARC "
3578  "is not enabled">,
3579  InGroup<IgnoredAttributes>;
3580def warn_weak_identifier_undeclared : Warning<
3581  "weak identifier %0 never declared">;
3582def warn_attribute_cmse_entry_static : Warning<
3583  "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3584  InGroup<IgnoredAttributes>;
3585def warn_cmse_nonsecure_union : Warning<
3586  "passing union across security boundary via %select{parameter %1|return value}0 "
3587  "may leak information">,
3588  InGroup<DiagGroup<"cmse-union-leak">>;
3589def err_attribute_weak_static : Error<
3590  "weak declaration cannot have internal linkage">;
3591def err_attribute_selectany_non_extern_data : Error<
3592  "'selectany' can only be applied to data items with external linkage">;
3593def err_declspec_thread_on_thread_variable : Error<
3594  "'__declspec(thread)' applied to variable that already has a "
3595  "thread-local storage specifier">;
3596def err_attribute_dll_not_extern : Error<
3597  "%q0 must have external linkage when declared %q1">;
3598def err_attribute_dll_thread_local : Error<
3599  "%q0 cannot be thread local when declared %q1">;
3600def err_attribute_dll_lambda : Error<
3601  "lambda cannot be declared %0">;
3602def warn_attribute_invalid_on_definition : Warning<
3603  "'%0' attribute cannot be specified on a definition">,
3604  InGroup<IgnoredAttributes>;
3605def err_attribute_dll_redeclaration : Error<
3606  "redeclaration of %q0 cannot add %q1 attribute">;
3607def warn_attribute_dll_redeclaration : Warning<
3608  "redeclaration of %q0 should not add %q1 attribute">,
3609  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3610def err_attribute_dllimport_function_definition : Error<
3611  "dllimport cannot be applied to non-inline function definition">;
3612def err_attribute_dllimport_function_specialization_definition : Error<
3613  "cannot define non-inline dllimport template specialization">;
3614def err_attribute_dll_deleted : Error<
3615  "attribute %q0 cannot be applied to a deleted function">;
3616def err_attribute_dllimport_data_definition : Error<
3617  "definition of dllimport data">;
3618def err_attribute_dllimport_static_field_definition : Error<
3619  "definition of dllimport static field not allowed">;
3620def warn_attribute_dllimport_static_field_definition : Warning<
3621  "definition of dllimport static field">,
3622  InGroup<DiagGroup<"dllimport-static-field-def">>;
3623def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3624  "explicit instantiation declaration should not be 'dllexport'">,
3625  InGroup<DllexportExplicitInstantiationDecl>;
3626def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3627  "'dllexport' attribute ignored on explicit instantiation definition">,
3628  InGroup<IgnoredAttributes>;
3629def warn_invalid_initializer_from_system_header : Warning<
3630  "invalid constructor from class in system header, should not be explicit">,
3631  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3632def note_used_in_initialization_here : Note<"used in initialization here">;
3633def err_attribute_dll_member_of_dll_class : Error<
3634  "attribute %q0 cannot be applied to member of %q1 class">;
3635def warn_attribute_dll_instantiated_base_class : Warning<
3636  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3637  "base class template without dll attribute is not supported">,
3638  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3639def err_attribute_dll_ambiguous_default_ctor : Error<
3640  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3641def err_attribute_weakref_not_static : Error<
3642  "weakref declaration must have internal linkage">;
3643def err_attribute_weakref_not_global_context : Error<
3644  "weakref declaration of %0 must be in a global context">;
3645def err_attribute_weakref_without_alias : Error<
3646  "weakref declaration of %0 must also have an alias attribute">;
3647def err_alias_not_supported_on_darwin : Error <
3648  "aliases are not supported on darwin">;
3649def warn_attribute_wrong_decl_type_str : Warning<
3650  "%0%select{ attribute|}1 only applies to %2">, InGroup<IgnoredAttributes>;
3651def err_attribute_wrong_decl_type_str : Error<
3652  warn_attribute_wrong_decl_type_str.Summary>;
3653def warn_attribute_wrong_decl_type : Warning<
3654  "%0%select{ attribute|}1 only applies to %select{"
3655  "functions"
3656  "|unions"
3657  "|variables and functions"
3658  "|functions and methods"
3659  "|functions, methods and blocks"
3660  "|functions, methods, and parameters"
3661  "|variables"
3662  "|variables and fields"
3663  "|variables, data members and tag types"
3664  "|types and namespaces"
3665  "|variables, functions and classes"
3666  "|kernel functions"
3667  "|non-K&R-style functions}2">,
3668  InGroup<IgnoredAttributes>;
3669def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Summary>;
3670def warn_type_attribute_wrong_type : Warning<
3671  "'%0' only applies to %select{function|pointer|"
3672  "Objective-C object or block pointer}1 types; type here is %2">,
3673  InGroup<IgnoredAttributes>;
3674def err_type_attribute_wrong_type : Error<
3675  warn_type_attribute_wrong_type.Summary>;
3676def warn_incomplete_encoded_type : Warning<
3677  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3678  InGroup<DiagGroup<"encode-type">>;
3679def warn_gnu_inline_attribute_requires_inline : Warning<
3680  "'gnu_inline' attribute requires function to be marked 'inline',"
3681  " attribute ignored">,
3682  InGroup<IgnoredAttributes>;
3683def warn_gnu_inline_cplusplus_without_extern : Warning<
3684  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3685  " available, this changed in Clang 10">,
3686  InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3687def err_attribute_vecreturn_only_vector_member : Error<
3688  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3689def err_attribute_vecreturn_only_pod_record : Error<
3690  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3691def err_sme_attr_mismatch : Error<
3692  "function declared %0 was previously declared %1, which has different SME function attributes">;
3693def err_sme_call_in_non_sme_target : Error<
3694  "call to a streaming function requires 'sme'">;
3695def err_sme_za_call_no_za_state : Error<
3696  "call to a shared ZA function requires the caller to have ZA state">;
3697def err_sme_definition_using_sm_in_non_sme_target : Error<
3698  "function executed in streaming-SVE mode requires 'sme'">;
3699def err_sme_definition_using_za_in_non_sme_target : Error<
3700  "function using ZA state requires 'sme'">;
3701def err_cconv_change : Error<
3702  "function declared '%0' here was previously declared "
3703  "%select{'%2'|without calling convention}1">;
3704def warn_cconv_unsupported : Warning<
3705  "%0 calling convention is not supported %select{"
3706  // Use CallingConventionIgnoredReason Enum to specify these.
3707  "for this target"
3708  "|on variadic function"
3709  "|on constructor/destructor"
3710  "|on builtin function"
3711  "}1">,
3712  InGroup<IgnoredAttributes>;
3713def error_cconv_unsupported : Error<warn_cconv_unsupported.Summary>;
3714def err_cconv_knr : Error<
3715  "function with no prototype cannot use the %0 calling convention">;
3716def warn_cconv_knr : Warning<
3717  err_cconv_knr.Summary>,
3718  InGroup<DiagGroup<"missing-prototype-for-cc">>;
3719def err_cconv_varargs : Error<
3720  "variadic function cannot use %0 calling convention">;
3721def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3722  "attribute was previously declared "
3723  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3724def err_function_attribute_mismatch : Error<
3725  "function declared with %0 attribute "
3726  "was previously declared without the %0 attribute">;
3727def err_objc_precise_lifetime_bad_type : Error<
3728  "objc_precise_lifetime only applies to retainable types; type here is %0">;
3729def warn_objc_precise_lifetime_meaningless : Error<
3730  "objc_precise_lifetime is not meaningful for "
3731  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3732def err_invalid_pcs : Error<"invalid PCS type">;
3733def warn_attribute_not_on_decl : Warning<
3734  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3735def err_base_specifier_attribute : Error<
3736  "%0%select{ attribute|}1 cannot be applied to a base specifier">;
3737def warn_declspec_allocator_nonpointer : Warning<
3738  "ignoring __declspec(allocator) because the function return type %0 is not "
3739  "a pointer or reference type">, InGroup<IgnoredAttributes>;
3740def err_cconv_incomplete_param_type : Error<
3741  "parameter %0 must have a complete type to use function %1 with the %2 "
3742  "calling convention">;
3743def err_attribute_output_parameter : Error<
3744  "attribute only applies to output parameters">;
3745
3746def ext_cannot_use_trivial_abi : ExtWarn<
3747  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3748def note_cannot_use_trivial_abi_reason : Note<
3749  "'trivial_abi' is disallowed on %0 because %select{"
3750  "its copy constructors and move constructors are all deleted|"
3751  "it is polymorphic|"
3752  "it has a base of a non-trivial class type|it has a virtual base|"
3753  "it has a __weak field|it has a field of a non-trivial class type}1">;
3754
3755// Availability attribute
3756def warn_availability_unknown_platform : Warning<
3757  "unknown platform %0 in availability macro">, InGroup<Availability>;
3758def warn_availability_version_ordering : Warning<
3759  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3760  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3761  "attribute ignored">, InGroup<Availability>;
3762def warn_mismatched_availability: Warning<
3763  "availability does not match previous declaration">, InGroup<Availability>;
3764def warn_mismatched_availability_override : Warning<
3765  "%select{|overriding }4method %select{introduced after|"
3766  "deprecated before|obsoleted before}0 "
3767  "%select{the protocol method it implements|overridden method}4 "
3768  "on %1 (%2 vs. %3)">, InGroup<Availability>;
3769def warn_mismatched_availability_override_unavail : Warning<
3770  "%select{|overriding }1method cannot be unavailable on %0 when "
3771  "%select{the protocol method it implements|its overridden method}1 is "
3772  "available">,
3773  InGroup<Availability>;
3774def warn_availability_on_static_initializer : Warning<
3775  "ignoring availability attribute %select{on '+load' method|"
3776  "with constructor attribute|with destructor attribute}0">,
3777  InGroup<Availability>;
3778def note_overridden_method : Note<
3779  "overridden method is here">;
3780def warn_availability_swift_unavailable_deprecated_only : Warning<
3781  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3782  InGroup<Availability>;
3783def note_protocol_method : Note<
3784  "protocol method is here">;
3785def warn_availability_fuchsia_unavailable_minor : Warning<
3786  "Fuchsia API Level prohibits specifying a minor or sub-minor version">,
3787  InGroup<Availability>;
3788
3789def warn_unguarded_availability :
3790  Warning<"%0 is only available on %1 %2 or newer">,
3791  InGroup<UnguardedAvailability>, DefaultIgnore;
3792def warn_unguarded_availability_new :
3793  Warning<warn_unguarded_availability.Summary>,
3794  InGroup<UnguardedAvailabilityNew>;
3795def note_decl_unguarded_availability_silence : Note<
3796  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3797def note_unguarded_available_silence : Note<
3798  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3799  " this warning">;
3800def warn_at_available_unchecked_use : Warning<
3801  "%select{@available|__builtin_available}0 does not guard availability here; "
3802  "use if (%select{@available|__builtin_available}0) instead">,
3803  InGroup<DiagGroup<"unsupported-availability-guard">>;
3804
3805def warn_missing_sdksettings_for_availability_checking : Warning<
3806  "%0 availability is ignored without a valid 'SDKSettings.json' in the SDK">,
3807  InGroup<DiagGroup<"ignored-availability-without-sdk-settings">>;
3808
3809// Thread Safety Attributes
3810def warn_thread_attribute_ignored : Warning<
3811  "ignoring %0 attribute because its argument is invalid">,
3812  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3813def warn_thread_attribute_not_on_non_static_member : Warning<
3814  "%0 attribute without capability arguments can only be applied to non-static "
3815  "methods of a class">,
3816  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3817def warn_thread_attribute_not_on_capability_member : Warning<
3818  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3819  "annotated with 'capability' or 'scoped_lockable' attribute">,
3820  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3821def warn_thread_attribute_argument_not_lockable : Warning<
3822  "%0 attribute requires arguments whose type is annotated "
3823  "with 'capability' attribute; type here is %1">,
3824  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3825def warn_thread_attribute_decl_not_lockable : Warning<
3826  "%0 attribute can only be applied in a context annotated "
3827  "with 'capability' attribute">,
3828  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3829def warn_thread_attribute_decl_not_pointer : Warning<
3830  "%0 only applies to pointer types; type here is %1">,
3831  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3832def err_attribute_argument_out_of_bounds_extra_info : Error<
3833  "%0 attribute parameter %1 is out of bounds: "
3834  "%plural{0:no parameters to index into|"
3835  "1:can only be 1, since there is one parameter|"
3836  ":must be between 1 and %2}2">;
3837
3838// Thread Safety Analysis
3839def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3840  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3841def warn_unlock_kind_mismatch : Warning<
3842  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3843  "%select{shared|exclusive}3 access">,
3844  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3845def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3846  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3847def warn_no_unlock : Warning<
3848  "%0 '%1' is still held at the end of function">,
3849  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3850def warn_expecting_locked : Warning<
3851  "expecting %0 '%1' to be held at the end of function">,
3852  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3853// FIXME: improve the error message about locks not in scope
3854def warn_lock_some_predecessors : Warning<
3855  "%0 '%1' is not held on every path through here">,
3856  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3857def warn_expecting_lock_held_on_loop : Warning<
3858  "expecting %0 '%1' to be held at start of each loop">,
3859  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3860def note_locked_here : Note<"%0 acquired here">;
3861def note_unlocked_here : Note<"%0 released here">;
3862def warn_lock_exclusive_and_shared : Warning<
3863  "%0 '%1' is acquired exclusively and shared in the same scope">,
3864  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3865def note_lock_exclusive_and_shared : Note<
3866  "the other acquisition of %0 '%1' is here">;
3867def warn_variable_requires_any_lock : Warning<
3868  "%select{reading|writing}1 variable %0 requires holding "
3869  "%select{any mutex|any mutex exclusively}1">,
3870  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3871def warn_var_deref_requires_any_lock : Warning<
3872  "%select{reading|writing}1 the value pointed to by %0 requires holding "
3873  "%select{any mutex|any mutex exclusively}1">,
3874  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3875def warn_fun_excludes_mutex : Warning<
3876  "cannot call function '%1' while %0 '%2' is held">,
3877  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3878def warn_cannot_resolve_lock : Warning<
3879  "cannot resolve lock expression">,
3880  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3881def warn_acquired_before : Warning<
3882  "%0 '%1' must be acquired before '%2'">,
3883  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3884def warn_acquired_before_after_cycle : Warning<
3885  "Cycle in acquired_before/after dependencies, starting with '%0'">,
3886  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3887
3888
3889// Thread safety warnings negative capabilities
3890def warn_acquire_requires_negative_cap : Warning<
3891  "acquiring %0 '%1' requires negative capability '%2'">,
3892  InGroup<ThreadSafetyNegative>, DefaultIgnore;
3893def warn_fun_requires_negative_cap : Warning<
3894  "calling function %0 requires negative capability '%1'">,
3895  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3896
3897// Thread safety warnings on pass/return by reference
3898def warn_guarded_pass_by_reference : Warning<
3899  "passing variable %1 by reference requires holding %0 "
3900  "%select{'%2'|'%2' exclusively}3">,
3901  InGroup<ThreadSafetyReference>, DefaultIgnore;
3902def warn_pt_guarded_pass_by_reference : Warning<
3903  "passing the value that %1 points to by reference requires holding %0 "
3904  "%select{'%2'|'%2' exclusively}3">,
3905  InGroup<ThreadSafetyReference>, DefaultIgnore;
3906def warn_guarded_return_by_reference : Warning<
3907  "returning variable %1 by reference requires holding %0 "
3908  "%select{'%2'|'%2' exclusively}3">,
3909  InGroup<ThreadSafetyReferenceReturn>, DefaultIgnore;
3910def warn_pt_guarded_return_by_reference : Warning<
3911  "returning the value that %1 points to by reference requires holding %0 "
3912  "%select{'%2'|'%2' exclusively}3">,
3913  InGroup<ThreadSafetyReferenceReturn>, DefaultIgnore;
3914
3915// Imprecise thread safety warnings
3916def warn_variable_requires_lock : Warning<
3917  "%select{reading|writing}3 variable %1 requires holding %0 "
3918  "%select{'%2'|'%2' exclusively}3">,
3919  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3920def warn_var_deref_requires_lock : Warning<
3921  "%select{reading|writing}3 the value pointed to by %1 requires "
3922  "holding %0 %select{'%2'|'%2' exclusively}3">,
3923  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3924def warn_fun_requires_lock : Warning<
3925  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3926  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3927
3928// Precise thread safety warnings
3929def warn_variable_requires_lock_precise :
3930  Warning<warn_variable_requires_lock.Summary>,
3931  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3932def warn_var_deref_requires_lock_precise :
3933  Warning<warn_var_deref_requires_lock.Summary>,
3934  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3935def warn_fun_requires_lock_precise :
3936  Warning<warn_fun_requires_lock.Summary>,
3937  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3938def note_found_mutex_near_match : Note<"found near match '%0'">;
3939
3940// Verbose thread safety warnings
3941def warn_thread_safety_verbose : Warning<"thread safety verbose warning">,
3942  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3943def note_thread_warning_in_fun : Note<"thread warning in function %0">;
3944def note_guarded_by_declared_here : Note<"guarded_by declared here">;
3945
3946// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3947def warn_thread_safety_beta : Warning<"thread safety beta warning">,
3948  InGroup<ThreadSafetyBeta>, DefaultIgnore;
3949
3950// Consumed warnings
3951def warn_use_in_invalid_state : Warning<
3952  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3953  "state">, InGroup<Consumed>, DefaultIgnore;
3954def warn_use_of_temp_in_invalid_state : Warning<
3955  "invalid invocation of method '%0' on a temporary object while it is in the "
3956  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3957def warn_attr_on_unconsumable_class : Warning<
3958  "consumed analysis attribute is attached to member of class %0 which isn't "
3959  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3960def warn_return_typestate_for_unconsumable_type : Warning<
3961  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3962  DefaultIgnore;
3963def warn_return_typestate_mismatch : Warning<
3964  "return value not in expected state; expected '%0', observed '%1'">,
3965  InGroup<Consumed>, DefaultIgnore;
3966def warn_loop_state_mismatch : Warning<
3967  "state of variable '%0' must match at the entry and exit of loop">,
3968  InGroup<Consumed>, DefaultIgnore;
3969def warn_param_return_typestate_mismatch : Warning<
3970  "parameter '%0' not in expected state when the function returns: expected "
3971  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3972def warn_param_typestate_mismatch : Warning<
3973  "argument not in expected state; expected '%0', observed '%1'">,
3974  InGroup<Consumed>, DefaultIgnore;
3975
3976// no_sanitize attribute
3977def warn_unknown_sanitizer_ignored : Warning<
3978  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3979
3980def warn_impcast_vector_scalar : Warning<
3981  "implicit conversion turns vector to scalar: %0 to %1">,
3982  InGroup<Conversion>, DefaultIgnore;
3983def warn_impcast_complex_scalar : Warning<
3984  "implicit conversion discards imaginary component: %0 to %1">,
3985  InGroup<Conversion>, DefaultIgnore;
3986def err_impcast_complex_scalar : Error<
3987  "implicit conversion from %0 to %1 is not permitted in C++">;
3988def warn_impcast_float_precision : Warning<
3989  "implicit conversion loses floating-point precision: %0 to %1">,
3990  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3991def warn_impcast_float_result_precision : Warning<
3992  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3993  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3994def warn_impcast_double_promotion : Warning<
3995  "implicit conversion increases floating-point precision: %0 to %1">,
3996  InGroup<DoublePromotion>, DefaultIgnore;
3997def warn_impcast_integer_sign : Warning<
3998  "implicit conversion changes signedness: %0 to %1">,
3999  InGroup<SignConversion>, DefaultIgnore;
4000def warn_impcast_integer_sign_conditional : Warning<
4001  "operand of ? changes signedness: %0 to %1">,
4002  InGroup<SignConversion>, DefaultIgnore;
4003def warn_impcast_integer_precision : Warning<
4004  "implicit conversion loses integer precision: %0 to %1">,
4005  InGroup<ImplicitIntConversion>, DefaultIgnore;
4006def warn_impcast_high_order_zero_bits : Warning<
4007  "higher order bits are zeroes after implicit conversion">,
4008  InGroup<ImplicitIntConversion>, DefaultIgnore;
4009def warn_impcast_nonnegative_result : Warning<
4010  "the resulting value is always non-negative after implicit conversion">,
4011  InGroup<SignConversion>, DefaultIgnore;
4012def warn_impcast_integer_64_32 : Warning<
4013  "implicit conversion loses integer precision: %0 to %1">,
4014  InGroup<Shorten64To32>, DefaultIgnore;
4015def warn_impcast_integer_precision_constant : Warning<
4016  "implicit conversion from %2 to %3 changes value from %0 to %1">,
4017  InGroup<ConstantConversion>;
4018def warn_impcast_single_bit_bitield_precision_constant : Warning<
4019  "implicit truncation from %2 to a one-bit wide bit-field changes value from "
4020  "%0 to %1">, InGroup<SingleBitBitFieldConstantConversion>;
4021def warn_impcast_bitfield_precision_constant : Warning<
4022  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
4023  InGroup<BitFieldConstantConversion>;
4024def warn_impcast_constant_value_to_objc_bool : Warning<
4025  "implicit conversion from constant value %0 to 'BOOL'; "
4026  "the only well defined values for 'BOOL' are YES and NO">,
4027  InGroup<ObjCBoolConstantConversion>;
4028
4029def warn_impcast_fixed_point_range : Warning<
4030  "implicit conversion from %0 cannot fit within the range of values for %1">,
4031  InGroup<ImplicitFixedPointConversion>;
4032
4033def warn_impcast_literal_float_to_integer : Warning<
4034  "implicit conversion from %0 to %1 changes value from %2 to %3">,
4035  InGroup<LiteralConversion>;
4036def warn_impcast_literal_float_to_integer_out_of_range : Warning<
4037  "implicit conversion of out of range value from %0 to %1 is undefined">,
4038  InGroup<LiteralConversion>;
4039def warn_impcast_float_integer : Warning<
4040  "implicit conversion turns floating-point number into integer: %0 to %1">,
4041  InGroup<FloatConversion>, DefaultIgnore;
4042def warn_impcast_float_to_objc_signed_char_bool : Warning<
4043  "implicit conversion from floating-point type %0 to 'BOOL'">,
4044  InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
4045def warn_impcast_int_to_objc_signed_char_bool : Warning<
4046  "implicit conversion from integral type %0 to 'BOOL'">,
4047  InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
4048
4049// Implicit int -> float conversion precision loss warnings.
4050def warn_impcast_integer_float_precision : Warning<
4051  "implicit conversion from %0 to %1 may lose precision">,
4052  InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
4053def warn_impcast_integer_float_precision_constant : Warning<
4054  "implicit conversion from %2 to %3 changes value from %0 to %1">,
4055  InGroup<ImplicitConstIntFloatConversion>;
4056
4057def warn_impcast_float_to_integer : Warning<
4058  "implicit conversion from %0 to %1 changes value from %2 to %3">,
4059  InGroup<FloatOverflowConversion>, DefaultIgnore;
4060def warn_impcast_float_to_integer_out_of_range : Warning<
4061  "implicit conversion of out of range value from %0 to %1 is undefined">,
4062  InGroup<FloatOverflowConversion>, DefaultIgnore;
4063def warn_impcast_float_to_integer_zero : Warning<
4064  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
4065  InGroup<FloatZeroConversion>, DefaultIgnore;
4066
4067def warn_impcast_string_literal_to_bool : Warning<
4068  "implicit conversion turns string literal into bool: %0 to %1">,
4069  InGroup<StringConversion>, DefaultIgnore;
4070def warn_impcast_different_enum_types : Warning<
4071  "implicit conversion from enumeration type %0 to different enumeration type "
4072  "%1">, InGroup<EnumConversion>;
4073def warn_impcast_bool_to_null_pointer : Warning<
4074    "initialization of pointer of type %0 to null from a constant boolean "
4075    "expression">, InGroup<BoolConversion>;
4076def warn_non_literal_null_pointer : Warning<
4077    "expression which evaluates to zero treated as a null pointer constant of "
4078    "type %0">, InGroup<NonLiteralNullConversion>;
4079def warn_pointer_compare : Warning<
4080    "comparing a pointer to a null character constant; did you mean "
4081    "to compare to %select{NULL|(void *)0}0?">,
4082    InGroup<DiagGroup<"pointer-compare">>;
4083def warn_impcast_null_pointer_to_integer : Warning<
4084    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
4085    InGroup<NullConversion>;
4086def warn_impcast_floating_point_to_bool : Warning<
4087    "implicit conversion turns floating-point number into bool: %0 to %1">,
4088    InGroup<ImplicitConversionFloatingPointToBool>;
4089def ext_ms_impcast_fn_obj : ExtWarn<
4090  "implicit conversion between pointer-to-function and pointer-to-object is a "
4091  "Microsoft extension">, InGroup<MicrosoftCast>;
4092
4093def warn_impcast_pointer_to_bool : Warning<
4094    "address of%select{| function| array}0 '%1' will always evaluate to "
4095    "'true'">,
4096    InGroup<PointerBoolConversion>;
4097def warn_cast_nonnull_to_bool : Warning<
4098    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
4099    "'true' on first encounter">,
4100    InGroup<PointerBoolConversion>;
4101def warn_this_bool_conversion : Warning<
4102  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
4103  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
4104def warn_address_of_reference_bool_conversion : Warning<
4105  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4106  "code; pointer may be assumed to always convert to true">,
4107  InGroup<UndefinedBoolConversion>;
4108
4109def warn_xor_used_as_pow : Warning<
4110  "result of '%0' is %1; did you mean exponentiation?">,
4111  InGroup<XorUsedAsPow>;
4112def warn_xor_used_as_pow_base_extra : Warning<
4113  "result of '%0' is %1; did you mean '%2' (%3)?">,
4114  InGroup<XorUsedAsPow>;
4115def warn_xor_used_as_pow_base : Warning<
4116  "result of '%0' is %1; did you mean '%2'?">,
4117  InGroup<XorUsedAsPow>;
4118def note_xor_used_as_pow_silence : Note<
4119  "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
4120
4121def warn_null_pointer_compare : Warning<
4122    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
4123    "equal to a null pointer is always %select{true|false}2">,
4124    InGroup<TautologicalPointerCompare>;
4125def warn_nonnull_expr_compare : Warning<
4126    "comparison of nonnull %select{function call|parameter}0 '%1' "
4127    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
4128    "encounter">,
4129    InGroup<TautologicalPointerCompare>;
4130def warn_this_null_compare : Warning<
4131  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
4132  "assumed to always evaluate to %select{true|false}0">,
4133  InGroup<TautologicalUndefinedCompare>;
4134def warn_address_of_reference_null_compare : Warning<
4135  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4136  "code; comparison may be assumed to always evaluate to "
4137  "%select{true|false}0">,
4138  InGroup<TautologicalUndefinedCompare>;
4139def note_reference_is_return_value : Note<"%0 returns a reference">;
4140
4141def note_pointer_declared_here : Note<
4142  "pointer %0 declared here">;
4143def warn_division_sizeof_ptr : Warning<
4144  "'%0' will return the size of the pointer, not the array itself">,
4145  InGroup<DiagGroup<"sizeof-pointer-div">>;
4146def warn_division_sizeof_array : Warning<
4147  "expression does not compute the number of elements in this array; element "
4148  "type is %0, not %1">,
4149  InGroup<DiagGroup<"sizeof-array-div">>;
4150
4151def note_function_warning_silence : Note<
4152    "prefix with the address-of operator to silence this warning">;
4153def note_function_to_function_call : Note<
4154    "suffix with parentheses to turn this into a function call">;
4155def warn_impcast_objective_c_literal_to_bool : Warning<
4156    "implicit boolean conversion of Objective-C object literal always "
4157    "evaluates to true">,
4158    InGroup<ObjCLiteralConversion>;
4159
4160def warn_cast_align : Warning<
4161  "cast from %0 to %1 increases required alignment from %2 to %3">,
4162  InGroup<CastAlign>, DefaultIgnore;
4163def warn_old_style_cast : Warning<
4164  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore,
4165  SuppressInSystemMacro;
4166
4167// Separate between casts to void* and non-void* pointers.
4168// Some APIs use (abuse) void* for something like a user context,
4169// and often that value is an integer even if it isn't a pointer itself.
4170// Having a separate warning flag allows users to control the warning
4171// for their workflow.
4172def warn_int_to_pointer_cast : Warning<
4173  "cast to %1 from smaller integer type %0">,
4174  InGroup<IntToPointerCast>;
4175def warn_int_to_void_pointer_cast : Warning<
4176  "cast to %1 from smaller integer type %0">,
4177  InGroup<IntToVoidPointerCast>;
4178def warn_pointer_to_int_cast : Warning<
4179  "cast to smaller integer type %1 from %0">,
4180  InGroup<PointerToIntCast>;
4181def warn_pointer_to_enum_cast : Warning<
4182  warn_pointer_to_int_cast.Summary>,
4183  InGroup<PointerToEnumCast>;
4184def warn_void_pointer_to_int_cast : Warning<
4185  "cast to smaller integer type %1 from %0">,
4186  InGroup<VoidPointerToIntCast>;
4187def warn_void_pointer_to_enum_cast : Warning<
4188  warn_void_pointer_to_int_cast.Summary>,
4189  InGroup<VoidPointerToEnumCast>;
4190
4191def warn_attribute_ignored_for_field_of_type : Warning<
4192  "%0 attribute ignored for field of type %1">,
4193  InGroup<IgnoredAttributes>;
4194def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
4195  "enums in the Microsoft ABI are signed integers by default; consider giving "
4196  "the enum %0 an unsigned underlying type to make this code portable">,
4197  InGroup<SignedEnumBitfield>, DefaultIgnore;
4198def warn_attribute_packed_for_bitfield : Warning<
4199  "'packed' attribute was ignored on bit-fields with single-byte alignment "
4200  "in older versions of GCC and Clang">,
4201  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
4202def warn_transparent_union_attribute_field_size_align : Warning<
4203  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
4204  "%select{alignment|size}0 of the first field in transparent union; "
4205  "transparent_union attribute ignored">,
4206  InGroup<IgnoredAttributes>;
4207def note_transparent_union_first_field_size_align : Note<
4208  "%select{alignment|size}0 of first field is %1 bits">;
4209def warn_transparent_union_attribute_not_definition : Warning<
4210  "transparent_union attribute can only be applied to a union definition; "
4211  "attribute ignored">,
4212  InGroup<IgnoredAttributes>;
4213def warn_transparent_union_attribute_floating : Warning<
4214  "first field of a transparent union cannot have %select{floating point|"
4215  "vector}0 type %1; transparent_union attribute ignored">,
4216  InGroup<IgnoredAttributes>;
4217def warn_transparent_union_attribute_zero_fields : Warning<
4218  "transparent union definition must contain at least one field; "
4219  "transparent_union attribute ignored">,
4220  InGroup<IgnoredAttributes>;
4221def warn_attribute_type_not_supported : Warning<
4222  "%0 attribute argument not supported: %1">,
4223  InGroup<IgnoredAttributes>;
4224def warn_attribute_type_not_supported_global : Warning<
4225  "%0 attribute argument '%1' not supported on a global variable">,
4226  InGroup<IgnoredAttributes>;
4227def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
4228  InGroup<IgnoredAttributes>;
4229def warn_attribute_protected_visibility :
4230  Warning<"target does not support 'protected' visibility; using 'default'">,
4231  InGroup<DiagGroup<"unsupported-visibility">>;
4232def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
4233def note_previous_attribute : Note<"previous attribute is here">;
4234def note_conflicting_attribute : Note<"conflicting attribute is here">;
4235def note_attribute : Note<"attribute is here">;
4236def err_mismatched_ms_inheritance : Error<
4237  "inheritance model does not match %select{definition|previous declaration}0">;
4238def warn_ignored_ms_inheritance : Warning<
4239  "inheritance model ignored on %select{primary template|partial specialization}0">,
4240  InGroup<IgnoredAttributes>;
4241def note_previous_ms_inheritance : Note<
4242  "previous inheritance model specified here">;
4243def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
4244def err_mode_not_primitive : Error<
4245  "mode attribute only supported for integer and floating-point types">;
4246def err_mode_wrong_type : Error<
4247  "type of machine mode does not match type of base type">;
4248def warn_vector_mode_deprecated : Warning<
4249  "specifying vector types with the 'mode' attribute is deprecated; "
4250  "use the 'vector_size' attribute instead">,
4251  InGroup<DeprecatedAttributes>;
4252def warn_deprecated_noreturn_spelling : Warning<
4253  "the '[[_Noreturn]]' attribute spelling is deprecated in C23; use "
4254  "'[[noreturn]]' instead">, InGroup<DeprecatedAttributes>;
4255def err_complex_mode_vector_type : Error<
4256  "type of machine mode does not support base vector types">;
4257def err_enum_mode_vector_type : Error<
4258  "mode %0 is not supported for enumeration types">;
4259def warn_attribute_nonnull_no_pointers : Warning<
4260  "'nonnull' attribute applied to function with no pointer arguments">,
4261  InGroup<IgnoredAttributes>;
4262def warn_attribute_nonnull_parm_no_args : Warning<
4263  "'nonnull' attribute when used on parameters takes no arguments">,
4264  InGroup<IgnoredAttributes>;
4265def warn_function_stmt_attribute_precedence : Warning<
4266  "statement attribute %0 has higher precedence than function attribute "
4267  "'%select{always_inline|flatten|noinline}1'">,
4268  InGroup<IgnoredAttributes>;
4269def note_declared_nonnull : Note<
4270  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
4271def warn_attribute_sentinel_named_arguments : Warning<
4272  "'sentinel' attribute requires named arguments">,
4273  InGroup<IgnoredAttributes>;
4274def warn_attribute_sentinel_not_variadic : Warning<
4275  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
4276  InGroup<IgnoredAttributes>;
4277def warn_deprecated_ignored_on_using : Warning<
4278  "%0 currently has no effect on a using declaration">,
4279  InGroup<IgnoredAttributes>;
4280def err_attribute_sentinel_less_than_zero : Error<
4281  "'sentinel' parameter 1 less than zero">;
4282def err_attribute_sentinel_not_zero_or_one : Error<
4283  "'sentinel' parameter 2 not 0 or 1">;
4284def warn_cleanup_ext : Warning<
4285  "GCC does not allow the 'cleanup' attribute argument to be anything other "
4286  "than a simple identifier">,
4287  InGroup<GccCompat>;
4288def err_attribute_cleanup_arg_not_function : Error<
4289  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
4290def err_attribute_cleanup_func_must_take_one_arg : Error<
4291  "'cleanup' function %0 must take 1 parameter">;
4292def err_attribute_cleanup_func_arg_incompatible_type : Error<
4293  "'cleanup' function %0 parameter has "
4294  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
4295def err_attribute_regparm_wrong_platform : Error<
4296  "'regparm' is not valid on this platform">;
4297def err_attribute_regparm_invalid_number : Error<
4298  "'regparm' parameter must be between 0 and %0 inclusive">;
4299def err_attribute_not_supported_in_lang : Error<
4300  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
4301def err_attribute_not_supported_on_arch
4302    : Error<"%0 attribute is not supported on '%1'">;
4303def warn_gcc_ignores_type_attr : Warning<
4304  "GCC does not allow the %0 attribute to be written on a type">,
4305  InGroup<GccCompat>;
4306def warn_gcc_requires_variadic_function : Warning<
4307  "GCC requires a function with the %0 attribute to be variadic">,
4308  InGroup<GccCompat>;
4309
4310// Clang-Specific Attributes
4311def warn_attribute_iboutlet : Warning<
4312  "%0 attribute can only be applied to instance variables or properties">,
4313  InGroup<IgnoredAttributes>;
4314def err_iboutletcollection_type : Error<
4315  "invalid type %0 as argument of iboutletcollection attribute">;
4316def err_iboutletcollection_builtintype : Error<
4317  "type argument of iboutletcollection attribute cannot be a builtin type">;
4318def warn_iboutlet_object_type : Warning<
4319  "%select{instance variable|property}2 with %0 attribute must "
4320  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
4321def warn_iboutletcollection_property_assign : Warning<
4322  "IBOutletCollection properties should be copy/strong and not assign">,
4323  InGroup<ObjCInvalidIBOutletProperty>;
4324
4325def err_attribute_overloadable_mismatch : Error<
4326  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
4327def note_attribute_overloadable_prev_overload : Note<
4328  "previous %select{unmarked |}0overload of function is here">;
4329def err_attribute_overloadable_no_prototype : Error<
4330  "'overloadable' function %0 must have a prototype">;
4331def err_attribute_overloadable_multiple_unmarked_overloads : Error<
4332  "at most one overload for a given name may lack the 'overloadable' "
4333  "attribute">;
4334def warn_attribute_no_builtin_invalid_builtin_name : Warning<
4335  "'%0' is not a valid builtin name for %1">,
4336  InGroup<DiagGroup<"invalid-no-builtin-names">>;
4337def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
4338  "empty %0 cannot be composed with named ones">;
4339def err_attribute_no_builtin_on_non_definition : Error<
4340  "%0 attribute is permitted on definitions only">;
4341def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
4342  "%0 attribute has no effect on defaulted or deleted functions">;
4343def warn_ns_attribute_wrong_return_type : Warning<
4344  "%0 attribute only applies to %select{functions|methods|properties}1 that "
4345  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
4346  InGroup<IgnoredAttributes>;
4347def err_ns_attribute_wrong_parameter_type : Error<
4348  "%0 attribute only applies to "
4349  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
4350def warn_ns_attribute_wrong_parameter_type : Warning<
4351  "%0 attribute only applies to "
4352  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
4353  InGroup<IgnoredAttributes>;
4354def warn_objc_requires_super_protocol : Warning<
4355  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
4356  InGroup<DiagGroup<"requires-super-attribute">>;
4357def note_protocol_decl : Note<
4358  "protocol is declared here">;
4359def note_protocol_decl_undefined : Note<
4360  "protocol %0 has no definition">;
4361def err_attribute_preferred_name_arg_invalid : Error<
4362  "argument %0 to 'preferred_name' attribute is not a typedef for "
4363  "a specialization of %1">;
4364def err_attribute_builtin_alias : Error<
4365  "%0 attribute can only be applied to a ARM, HLSL or RISC-V builtin">;
4366
4367// called-once attribute diagnostics.
4368def err_called_once_attribute_wrong_type : Error<
4369  "'called_once' attribute only applies to function-like parameters">;
4370
4371def warn_completion_handler_never_called : Warning<
4372  "%select{|captured }1completion handler is never called">,
4373  InGroup<CompletionHandler>, DefaultIgnore;
4374def warn_called_once_never_called : Warning<
4375  "%select{|captured }1%0 parameter marked 'called_once' is never called">,
4376  InGroup<CalledOnceParameter>;
4377
4378def warn_completion_handler_never_called_when : Warning<
4379  "completion handler is never %select{used|called}1 when "
4380  "%select{taking true branch|taking false branch|"
4381  "handling this case|none of the cases applies|"
4382  "entering the loop|skipping the loop|taking one of the branches}2">,
4383  InGroup<CompletionHandler>, DefaultIgnore;
4384def warn_called_once_never_called_when : Warning<
4385  "%0 parameter marked 'called_once' is never %select{used|called}1 when "
4386  "%select{taking true branch|taking false branch|"
4387  "handling this case|none of the cases applies|"
4388  "entering the loop|skipping the loop|taking one of the branches}2">,
4389  InGroup<CalledOnceParameter>;
4390
4391def warn_completion_handler_called_twice : Warning<
4392  "completion handler is called twice">,
4393  InGroup<CompletionHandler>, DefaultIgnore;
4394def warn_called_once_gets_called_twice : Warning<
4395  "%0 parameter marked 'called_once' is called twice">,
4396  InGroup<CalledOnceParameter>;
4397def note_called_once_gets_called_twice : Note<
4398  "previous call is here%select{; set to nil to indicate "
4399  "it cannot be called afterwards|}0">;
4400
4401// objc_designated_initializer attribute diagnostics.
4402def warn_objc_designated_init_missing_super_call : Warning<
4403  "designated initializer missing a 'super' call to a designated initializer of the super class">,
4404  InGroup<ObjCDesignatedInit>;
4405def note_objc_designated_init_marked_here : Note<
4406  "method marked as designated initializer of the class here">;
4407def warn_objc_designated_init_non_super_designated_init_call : Warning<
4408  "designated initializer should only invoke a designated initializer on 'super'">,
4409  InGroup<ObjCDesignatedInit>;
4410def warn_objc_designated_init_non_designated_init_call : Warning<
4411  "designated initializer invoked a non-designated initializer">,
4412  InGroup<ObjCDesignatedInit>;
4413def warn_objc_secondary_init_super_init_call : Warning<
4414  "convenience initializer should not invoke an initializer on 'super'">,
4415  InGroup<ObjCDesignatedInit>;
4416def warn_objc_secondary_init_missing_init_call : Warning<
4417  "convenience initializer missing a 'self' call to another initializer">,
4418  InGroup<ObjCDesignatedInit>;
4419def warn_objc_implementation_missing_designated_init_override : Warning<
4420  "method override for the designated initializer of the superclass %objcinstance0 not found">,
4421  InGroup<ObjCDesignatedInit>;
4422def err_designated_init_attr_non_init : Error<
4423  "'objc_designated_initializer' attribute only applies to init methods "
4424  "of interface or class extension declarations">;
4425
4426// objc_bridge attribute diagnostics.
4427def err_objc_attr_not_id : Error<
4428  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
4429def err_objc_attr_typedef_not_id : Error<
4430  "parameter of %0 attribute must be 'id' when used on a typedef">;
4431def err_objc_attr_typedef_not_void_pointer : Error<
4432  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
4433def err_objc_cf_bridged_not_interface : Error<
4434  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
4435def err_objc_ns_bridged_invalid_cfobject : Error<
4436  "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
4437def warn_objc_invalid_bridge : Warning<
4438  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
4439def warn_objc_invalid_bridge_to_cf : Warning<
4440  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
4441
4442// objc_bridge_related attribute diagnostics.
4443def err_objc_bridged_related_invalid_class : Error<
4444  "could not find Objective-C class %0 to convert %1 to %2">;
4445def err_objc_bridged_related_invalid_class_name : Error<
4446  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
4447def err_objc_bridged_related_known_method : Error<
4448 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
4449 "method for this conversion">;
4450
4451def err_objc_attr_protocol_requires_definition : Error<
4452  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
4453
4454// Swift attributes.
4455def warn_attr_swift_name_function
4456  : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
4457    InGroup<SwiftNameAttribute>;
4458def warn_attr_swift_name_invalid_identifier
4459  : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4460    InGroup<SwiftNameAttribute>;
4461def warn_attr_swift_name_decl_kind
4462  : Warning<"%0 attribute cannot be applied to this declaration">,
4463    InGroup<SwiftNameAttribute>;
4464def warn_attr_swift_name_subscript_invalid_parameter
4465  : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4466        "have at least one parameter|"
4467        "have a 'self:' parameter}1">,
4468    InGroup<SwiftNameAttribute>;
4469def warn_attr_swift_name_missing_parameters
4470  : Warning<"%0 attribute is missing parameter label clause">,
4471    InGroup<SwiftNameAttribute>;
4472def warn_attr_swift_name_setter_parameters
4473  : Warning<"%0 attribute for setter must have one parameter for new value">,
4474    InGroup<SwiftNameAttribute>;
4475def warn_attr_swift_name_multiple_selfs
4476  : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4477    InGroup<SwiftNameAttribute>;
4478def warn_attr_swift_name_getter_parameters
4479  : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4480    InGroup<SwiftNameAttribute>;
4481def warn_attr_swift_name_subscript_setter_no_newValue
4482  : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4483    InGroup<SwiftNameAttribute>;
4484def warn_attr_swift_name_subscript_setter_multiple_newValues
4485  : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4486    InGroup<SwiftNameAttribute>;
4487def warn_attr_swift_name_subscript_getter_newValue
4488  : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4489    InGroup<SwiftNameAttribute>;
4490def warn_attr_swift_name_num_params
4491  : Warning<"too %select{few|many}0 parameters in the signature specified by "
4492            "the %1 attribute (expected %2; got %3)">,
4493    InGroup<SwiftNameAttribute>;
4494def warn_attr_swift_name_decl_missing_params
4495  : Warning<"%0 attribute cannot be applied to a %select{function|method}1 "
4496            "with no parameters">,
4497    InGroup<SwiftNameAttribute>;
4498
4499def err_attr_swift_error_no_error_parameter : Error<
4500  "%0 attribute can only be applied to a %select{function|method}1 with an "
4501  "error parameter">;
4502def err_attr_swift_error_return_type : Error<
4503  "%0 attribute with '%1' convention can only be applied to a "
4504  "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4505
4506def err_swift_async_no_access : Error<
4507  "first argument to 'swift_async' must be either 'none', 'swift_private', or "
4508  "'not_swift_private'">;
4509def err_swift_async_bad_block_type : Error<
4510  "'swift_async' completion handler parameter must have block type returning"
4511  " 'void', type here is %0">;
4512
4513def err_swift_async_error_without_swift_async : Error<
4514  "%0 attribute must be applied to a %select{function|method}1 annotated "
4515  "with non-'none' attribute 'swift_async'">;
4516def err_swift_async_error_no_error_parameter : Error<
4517  "%0 attribute with 'nonnull_error' convention can only be applied to a "
4518  "%select{function|method}1 with a completion handler with an error "
4519  "parameter">;
4520def err_swift_async_error_non_integral : Error<
4521  "%0 attribute with '%1' convention must have an integral-typed parameter "
4522  "in completion handler at index %2, type here is %3">;
4523
4524def warn_ignored_objc_externally_retained : Warning<
4525  "'objc_externally_retained' can only be applied to local variables "
4526  "%select{of retainable type|with strong ownership}0">,
4527  InGroup<IgnoredAttributes>;
4528
4529// Function Parameter Semantic Analysis.
4530def err_param_with_void_type : Error<"argument may not have 'void' type">;
4531def err_void_only_param : Error<
4532  "'void' must be the first and only parameter if specified">;
4533def err_void_param_qualified : Error<
4534  "'void' as parameter must not have type qualifiers">;
4535def err_ident_list_in_fn_declaration : Error<
4536  "a parameter list without types is only allowed in a function definition">;
4537def ext_param_not_declared : ExtWarn<
4538  "parameter %0 was not declared, defaults to 'int'; ISO C99 and later do not "
4539  "support implicit int">, InGroup<ImplicitInt>;
4540def err_param_default_argument : Error<
4541  "C does not support default arguments">;
4542def err_param_default_argument_redefinition : Error<
4543  "redefinition of default argument">;
4544def ext_param_default_argument_redefinition : ExtWarn<
4545  err_param_default_argument_redefinition.Summary>,
4546  InGroup<MicrosoftDefaultArgRedefinition>;
4547def err_param_default_argument_missing : Error<
4548  "missing default argument on parameter">;
4549def err_param_default_argument_missing_name : Error<
4550  "missing default argument on parameter %0">;
4551def err_param_default_argument_references_param : Error<
4552  "default argument references parameter %0">;
4553def err_param_default_argument_references_local : Error<
4554  "default argument references local variable %0 of enclosing function">;
4555def err_param_default_argument_references_this : Error<
4556  "default argument references 'this'">;
4557def err_param_default_argument_nonfunc : Error<
4558  "default arguments can only be specified for parameters in a function "
4559  "declaration">;
4560def err_param_default_argument_template_redecl : Error<
4561  "default arguments cannot be added to a function template that has already "
4562  "been declared">;
4563def err_param_default_argument_member_template_redecl : Error<
4564  "default arguments cannot be added to an out-of-line definition of a member "
4565  "of a %select{class template|class template partial specialization|nested "
4566  "class in a template}0">;
4567def err_param_default_argument_on_parameter_pack : Error<
4568  "parameter pack cannot have a default argument">;
4569def err_uninitialized_member_for_assign : Error<
4570  "cannot define the implicit copy assignment operator for %0, because "
4571  "non-static %select{reference|const}1 member %2 cannot use copy "
4572  "assignment operator">;
4573def err_uninitialized_member_in_ctor : Error<
4574  "%select{constructor for %1|"
4575  "implicit default constructor for %1|"
4576  "cannot use constructor inherited from %1:}0 must explicitly "
4577  "initialize the %select{reference|const}2 member %3">;
4578def err_default_arg_makes_ctor_special : Error<
4579  "addition of default argument on redeclaration makes this constructor a "
4580  "%select{default|copy|move}0 constructor">;
4581def err_stmt_expr_in_default_arg : Error<
4582  "default %select{argument|non-type template argument}0 may not use a GNU "
4583  "statement expression">;
4584
4585def err_use_of_default_argument_to_function_declared_later : Error<
4586  "use of default argument to function %0 that is declared later in class %1">;
4587def note_default_argument_declared_here : Note<
4588  "default argument declared here">;
4589def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4590def note_recursive_default_argument_used_here : Note<
4591  "default argument used here">;
4592
4593def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4594  "%diff{promoted type $ of K&R function parameter is not compatible with the "
4595  "parameter type $|promoted type of K&R function parameter is not compatible "
4596  "with parameter type}0,1 declared in a previous prototype">,
4597  InGroup<KNRPromotedParameter>;
4598
4599
4600// C++ Overloading Semantic Analysis.
4601def err_ovl_diff_return_type : Error<
4602  "functions that differ only in their return type cannot be overloaded">;
4603def err_ovl_static_nonstatic_member : Error<
4604  "static and non-static member functions with the same parameter types "
4605  "cannot be overloaded">;
4606
4607let Deferrable = 1 in {
4608
4609def err_ovl_no_viable_function_in_call : Error<
4610  "no matching function for call to %0">;
4611def err_ovl_no_viable_member_function_in_call : Error<
4612  "no matching member function for call to %0">;
4613def err_ovl_ambiguous_call : Error<
4614  "call to %0 is ambiguous">;
4615def err_ovl_deleted_call : Error<"call to deleted function %0">;
4616def err_ovl_ambiguous_member_call : Error<
4617  "call to member function %0 is ambiguous">;
4618def err_ovl_deleted_member_call : Error<
4619  "call to deleted member function %0">;
4620def note_ovl_too_many_candidates : Note<
4621    "remaining %0 candidate%s0 omitted; "
4622    "pass -fshow-overloads=all to show them">;
4623
4624def select_ovl_candidate_kind : TextSubstitution<
4625  "%select{function|function|function (with reversed parameter order)|"
4626    "constructor|"
4627    "constructor (the implicit default constructor)|"
4628    "constructor (the implicit copy constructor)|"
4629    "constructor (the implicit move constructor)|"
4630    "function (the implicit copy assignment operator)|"
4631    "function (the implicit move assignment operator)|"
4632    "function (the implicit 'operator==' for this 'operator<=>)'|"
4633    "inherited constructor}0%select{| template| %2}1">;
4634
4635def note_ovl_candidate : Note<
4636    "candidate %sub{select_ovl_candidate_kind}0,1,3"
4637    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4638    "| has different number of parameters (expected %5 but has %6)"
4639    "| has type mismatch at %ordinal5 parameter"
4640    "%diff{ (expected $ but has $)|}6,7"
4641    "| has different return type%diff{ ($ expected but has $)|}5,6"
4642    "| has different qualifiers (expected %5 but found %6)"
4643    "| has different exception specification}4">;
4644
4645def note_ovl_candidate_explicit : Note<
4646    "explicit %select{constructor|conversion function|deduction guide}0 "
4647    "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4648def note_ovl_candidate_inherited_constructor : Note<
4649    "constructor from base class %0 inherited here">;
4650def note_ovl_candidate_inherited_constructor_slice : Note<
4651    "candidate %select{constructor|template}0 ignored: "
4652    "inherited constructor cannot be used to %select{copy|move}1 object">;
4653def note_ovl_candidate_illegal_constructor : Note<
4654    "candidate %select{constructor|template}0 ignored: "
4655    "instantiation %select{takes|would take}0 its own class type by value">;
4656def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4657    "candidate constructor ignored: cannot be used to construct an object "
4658    "in address space %0">;
4659def note_ovl_candidate_bad_deduction : Note<
4660    "candidate template ignored: failed template argument deduction">;
4661def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4662    "couldn't infer template argument %0">;
4663def note_ovl_candidate_incomplete_deduction_pack : Note<
4664    "candidate template ignored: "
4665    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4666    "expanded parameter in deduced argument pack %2">;
4667def note_ovl_candidate_inconsistent_deduction : Note<
4668    "candidate template ignored: deduced %select{conflicting types|"
4669    "conflicting values|conflicting templates|packs of different lengths}0 "
4670    "for parameter %1%diff{ ($ vs. $)|}2,3">;
4671def note_ovl_candidate_inconsistent_deduction_types : Note<
4672    "candidate template ignored: deduced values %diff{"
4673    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4674    "%1 and %3 of conflicting types for parameter %0}2,4">;
4675def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4676    "candidate template ignored: invalid explicitly-specified argument "
4677    "for template parameter %0">;
4678def note_ovl_candidate_unsatisfied_constraints : Note<
4679    "candidate template ignored: constraints not satisfied%0">;
4680def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4681    "candidate template ignored: invalid explicitly-specified argument "
4682    "for %ordinal0 template parameter">;
4683def note_ovl_candidate_instantiation_depth : Note<
4684    "candidate template ignored: substitution exceeded maximum template "
4685    "instantiation depth">;
4686def note_ovl_candidate_underqualified : Note<
4687    "candidate template ignored: cannot deduce a type for %0 that would "
4688    "make %2 equal %1">;
4689def note_ovl_candidate_substitution_failure : Note<
4690    "candidate template ignored: substitution failure%0%1">;
4691def note_ovl_candidate_disabled_by_enable_if : Note<
4692    "candidate template ignored: disabled by %0%1">;
4693def note_ovl_candidate_disabled_by_requirement : Note<
4694    "candidate template ignored: requirement '%0' was not satisfied%1">;
4695def note_ovl_candidate_has_pass_object_size_params: Note<
4696    "candidate address cannot be taken because parameter %0 has "
4697    "pass_object_size attribute">;
4698def err_diagnose_if_succeeded : Error<"%0">;
4699def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4700    ShowInSystemHeader;
4701def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4702    "candidate disabled: %0">;
4703def err_addrof_function_disabled_by_enable_if_attr : Error<
4704    "cannot take address of function %0 because it has one or more "
4705    "non-tautological enable_if conditions">;
4706def err_addrof_function_constraints_not_satisfied : Error<
4707    "cannot take address of function %0 because its constraints are not "
4708    "satisfied">;
4709def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4710    "candidate function made ineligible by enable_if">;
4711def note_ovl_candidate_deduced_mismatch : Note<
4712    "candidate template ignored: deduced type "
4713    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4714    "adjusted type $ of %select{|element of }4argument"
4715    "|of %select{|element of }4%ordinal0 parameter does not match "
4716    "adjusted type of %select{|element of }4argument}1,2%3">;
4717def note_ovl_candidate_non_deduced_mismatch : Note<
4718    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4719// This note is needed because the above note would sometimes print two
4720// different types with the same name.  Remove this note when the above note
4721// can handle that case properly.
4722def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4723    "candidate template ignored: could not match %q0 against %q1">;
4724
4725// Note that we don't treat templates differently for this diagnostic.
4726def note_ovl_candidate_arity : Note<"candidate "
4727    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4728    "requires%select{ at least| at most|}3 %4 "
4729    "%select{|non-object }6argument%s4, but %5 "
4730    "%plural{1:was|:were}5 provided">;
4731
4732def note_ovl_candidate_arity_one : Note<"candidate "
4733    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4734    "%select{requires at least|allows at most single|requires single}3 "
4735    "%select{|non-object }6"
4736    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4737
4738def note_ovl_candidate_deleted : Note<
4739    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4740    "%select{explicitly made unavailable|explicitly deleted|"
4741    "implicitly deleted}3">;
4742
4743// Giving the index of the bad argument really clutters this message, and
4744// it's relatively unimportant because 1) it's generally obvious which
4745// argument(s) are of the given object type and 2) the fix is usually
4746// to complete the type, which doesn't involve changes to the call line
4747// anyway.  If people complain, we can change it.
4748def note_ovl_candidate_bad_conv_incomplete : Note<
4749    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4750    "cannot convert argument of incomplete type "
4751    "%diff{$ to $|to parameter type}3,4 for "
4752    "%select{%ordinal6 argument|object argument}5"
4753    "%select{|; dereference the argument with *|"
4754    "; take the address of the argument with &|"
4755    "; remove *|"
4756    "; remove &}7">;
4757def note_ovl_candidate_bad_list_argument : Note<
4758    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4759    "%select{cannot convert initializer list|too few initializers in list"
4760    "|too many initializers in list}7 argument to %4">;
4761def note_ovl_candidate_bad_overload : Note<
4762    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4763    "no overload of %4 matching %3 for %ordinal5 argument">;
4764def note_ovl_candidate_bad_conv : Note<
4765    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4766    "no known conversion "
4767    "%diff{from $ to $|from argument type to parameter type}3,4 for "
4768    "%select{%ordinal6 argument|object argument}5"
4769    "%select{|; dereference the argument with *|"
4770    "; take the address of the argument with &|"
4771    "; remove *|"
4772    "; remove &}7">;
4773def note_ovl_candidate_bad_arc_conv : Note<
4774    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4775    "cannot implicitly convert argument "
4776    "%diff{of type $ to $|type to parameter type}3,4 for "
4777    "%select{%ordinal6 argument|object argument}5 under ARC">;
4778def note_ovl_candidate_bad_value_category : Note<
4779    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4780    "expects an %select{lvalue|rvalue}5 for "
4781    "%select{%ordinal4 argument|object argument}3">;
4782def note_ovl_candidate_bad_addrspace : Note<
4783    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4784    "cannot %select{pass pointer to|bind reference in}5 %3 "
4785    "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4786    "argument">;
4787def note_ovl_candidate_bad_addrspace_this : Note<
4788    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4789    "'this' object is in %3, but method expects object in %4">;
4790def note_ovl_candidate_bad_gc : Note<
4791    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4792    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4793    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4794def note_ovl_candidate_bad_ownership : Note<
4795    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4796    "%select{%ordinal7|'this'}6 argument (%3) has "
4797    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4798    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4799    "__autoreleasing}5 ownership">;
4800def note_ovl_candidate_bad_cvr_this : Note<
4801    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4802    "'this' argument has type %3, but method is not marked "
4803    "%select{const|restrict|const or restrict|volatile|const or volatile|"
4804    "volatile or restrict|const, volatile, or restrict}4">;
4805def note_ovl_candidate_bad_cvr : Note<
4806    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4807    "%ordinal5 argument (%3) would lose "
4808    "%select{const|restrict|const and restrict|volatile|const and volatile|"
4809    "volatile and restrict|const, volatile, and restrict}4 qualifier"
4810    "%select{||s||s|s|s}4">;
4811def note_ovl_candidate_bad_base_to_derived_conv : Note<
4812    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4813    "cannot %select{convert from|convert from|bind}3 "
4814    "%select{base class pointer|superclass|base class object of type}3 %4 to "
4815    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4816    "%ordinal6 argument">;
4817def note_ovl_candidate_bad_target : Note<
4818    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4819    "call to "
4820    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4821    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4822def note_ovl_candidate_constraints_not_satisfied : Note<
4823    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4824    "not satisfied">;
4825def note_ovl_surrogate_constraints_not_satisfied : Note<
4826    "conversion candidate %0 not viable: constraints not satisfied">;
4827def note_implicit_member_target_infer_collision : Note<
4828    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4829    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4830    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4831
4832def note_ambiguous_type_conversion: Note<
4833    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4834def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4835def err_ovl_no_viable_function_in_init : Error<
4836  "no matching constructor for initialization of %0">;
4837def err_ovl_no_conversion_in_cast : Error<
4838  "cannot convert %1 to %2 without a conversion operator">;
4839def err_ovl_no_viable_conversion_in_cast : Error<
4840  "no matching conversion for %select{|static_cast|reinterpret_cast|"
4841  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4842def err_ovl_ambiguous_conversion_in_cast : Error<
4843  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4844  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4845def err_ovl_deleted_conversion_in_cast : Error<
4846  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4847  "functional-style cast|}0 from %1 to %2 uses deleted function">;
4848def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4849def err_ref_init_ambiguous : Error<
4850  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4851def err_ovl_deleted_init : Error<
4852  "call to deleted constructor of %0">;
4853def err_ovl_deleted_special_init : Error<
4854  "call to implicitly-deleted %select{default constructor|copy constructor|"
4855  "move constructor|copy assignment operator|move assignment operator|"
4856  "destructor|function}0 of %1">;
4857def err_ovl_ambiguous_oper_unary : Error<
4858  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4859def err_ovl_ambiguous_oper_binary : Error<
4860  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4861def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4862  "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4863  "and %2) to be ambiguous despite there being a unique best viable function"
4864  "%select{ with non-reversed arguments|}3">,
4865  InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4866def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4867  "ambiguity is between a regular call to this operator and a call with the "
4868  "argument order reversed">;
4869def note_ovl_ambiguous_eqeq_reversed_self_non_const : Note<
4870  "mark 'operator==' as const or add a matching 'operator!=' to resolve the ambiguity">;
4871def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4872  "candidate function with non-reversed arguments">;
4873def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4874  "ambiguous candidate function with reversed arguments">;
4875def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4876def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4877def err_ovl_deleted_oper : Error<
4878  "overload resolution selected deleted operator '%0'">;
4879def err_ovl_deleted_special_oper : Error<
4880  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4881  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4882  "implicitly deleted">;
4883def err_ovl_deleted_comparison : Error<
4884  "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4885def err_ovl_rewrite_equalequal_not_bool : Error<
4886  "return type %0 of selected 'operator==' function for rewritten "
4887  "'%1' comparison is not 'bool'">;
4888def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4889  "ISO C++20 requires return type of selected 'operator==' function for "
4890  "rewritten '%1' comparison to be 'bool', not %0">,
4891  InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4892def err_ovl_no_viable_subscript :
4893    Error<"no viable overloaded operator[] for type %0">;
4894def err_ovl_no_oper :
4895    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4896def err_ovl_unresolvable : Error<
4897  "reference to %select{overloaded|multiversioned}1 function could not be "
4898  "resolved; did you mean to call it%select{| with no arguments}0?">;
4899def err_bound_member_function : Error<
4900  "reference to non-static member function must be called"
4901  "%select{|; did you mean to call it with no arguments?}0">;
4902def note_possible_target_of_call : Note<"possible target for call">;
4903def err_no_viable_destructor : Error<
4904  "no viable destructor found for class %0">;
4905def err_ambiguous_destructor : Error<
4906  "destructor of class %0 is ambiguous">;
4907
4908def err_ovl_no_viable_object_call : Error<
4909  "no matching function for call to object of type %0">;
4910def err_ovl_ambiguous_object_call : Error<
4911  "call to object of type %0 is ambiguous">;
4912def err_ovl_ambiguous_subscript_call : Error<
4913  "call to subscript operator of type %0 is ambiguous">;
4914def err_ovl_deleted_object_call : Error<
4915  "call to deleted function call operator in type %0">;
4916def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4917def err_member_call_without_object : Error<
4918  "call to %select{non-static|explicit}0 member function without an object argument">;
4919
4920// C++ Address of Overloaded Function
4921def err_addr_ovl_no_viable : Error<
4922  "address of overloaded function %0 does not match required type %1">;
4923def err_addr_ovl_ambiguous : Error<
4924  "address of overloaded function %0 is ambiguous">;
4925def err_addr_ovl_not_func_ptrref : Error<
4926  "address of overloaded function %0 cannot be converted to type %1">;
4927def err_addr_ovl_no_qualifier : Error<
4928  "cannot form member pointer of type %0 without '&' and class name">;
4929
4930} // let Deferrable
4931
4932// C++11 Literal Operators
4933def err_ovl_no_viable_literal_operator : Error<
4934  "no matching literal operator for call to %0"
4935  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4936  "%select{| or 'const char *'}4"
4937  "%select{|, and no matching literal operator template}5">;
4938
4939// C++ Template Declarations
4940def err_template_param_shadow : Error<
4941  "declaration of %0 shadows template parameter">;
4942def ext_template_param_shadow : ExtWarn<
4943  err_template_param_shadow.Summary>, InGroup<MicrosoftTemplateShadow>;
4944def note_template_param_here : Note<"template parameter is declared here">;
4945def note_template_param_external : Note<
4946  "template parameter from hidden source: %0">;
4947def warn_template_export_unsupported : Warning<
4948  "exported templates are unsupported">;
4949def err_template_outside_namespace_or_class_scope : Error<
4950  "templates can only be declared in namespace or class scope">;
4951def err_template_inside_local_class : Error<
4952  "templates cannot be declared inside of a local class">;
4953def err_template_linkage : Error<"templates must have C++ linkage">;
4954def err_template_typedef : Error<"a typedef cannot be a template">;
4955def err_template_unnamed_class : Error<
4956  "cannot declare a class template with no name">;
4957def err_template_param_list_different_arity : Error<
4958  "%select{too few|too many}0 template parameters in template "
4959  "%select{|template parameter }1redeclaration">;
4960def note_template_param_list_different_arity : Note<
4961  "%select{too few|too many}0 template parameters in template template "
4962  "argument">;
4963def note_template_prev_declaration : Note<
4964  "previous template %select{declaration|template parameter}0 is here">;
4965def err_template_param_different_kind : Error<
4966  "template parameter has a different kind in template "
4967  "%select{|template parameter }0redeclaration">;
4968def note_template_param_different_kind : Note<
4969  "template parameter has a different kind in template argument">;
4970
4971def err_invalid_decl_specifier_in_nontype_parm : Error<
4972  "invalid declaration specifier in template non-type parameter">;
4973
4974def err_template_nontype_parm_different_type : Error<
4975  "template non-type parameter has a different type %0 in template "
4976  "%select{|template parameter }1redeclaration">;
4977
4978def note_template_nontype_parm_different_type : Note<
4979  "template non-type parameter has a different type %0 in template argument">;
4980def note_template_nontype_parm_prev_declaration : Note<
4981  "previous non-type template parameter with type %0 is here">;
4982def err_template_nontype_parm_bad_type : Error<
4983  "a non-type template parameter cannot have type %0">;
4984def err_template_nontype_parm_bad_structural_type : Error<
4985  "a non-type template parameter cannot have type %0 before C++20">;
4986def err_template_nontype_parm_incomplete : Error<
4987  "non-type template parameter has incomplete type %0">;
4988def err_template_nontype_parm_not_literal : Error<
4989  "non-type template parameter has non-literal type %0">;
4990def err_template_nontype_parm_rvalue_ref : Error<
4991  "non-type template parameter has rvalue reference type %0">;
4992def err_template_nontype_parm_not_structural : Error<
4993  "type %0 of non-type template parameter is not a structural type">;
4994def note_not_structural_non_public : Note<
4995  "%0 is not a structural type because it has a "
4996  "%select{non-static data member|base class}1 that is not public">;
4997def note_not_structural_mutable_field : Note<
4998  "%0 is not a structural type because it has a mutable "
4999  "non-static data member">;
5000def note_not_structural_rvalue_ref_field : Note<
5001  "%0 is not a structural type because it has a non-static data member "
5002  "of rvalue reference type">;
5003def note_not_structural_subobject : Note<
5004  "%0 is not a structural type because it has a "
5005  "%select{non-static data member|base class}1 of non-structural type %2">;
5006def warn_cxx17_compat_template_nontype_parm_type : Warning<
5007  "non-type template parameter of type %0 is incompatible with "
5008  "C++ standards before C++20">,
5009  DefaultIgnore, InGroup<CXXPre20Compat>;
5010def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
5011  "non-type template parameters declared with %0 are incompatible with C++ "
5012  "standards before C++17">,
5013  DefaultIgnore, InGroup<CXXPre17Compat>;
5014def err_template_param_default_arg_redefinition : Error<
5015  "template parameter redefines default argument">;
5016def err_template_param_default_arg_inconsistent_redefinition : Error<
5017  "template parameter default argument is inconsistent with previous definition">;
5018def note_template_param_prev_default_arg : Note<
5019  "previous default template argument defined here">;
5020def note_template_param_prev_default_arg_in_other_module : Note<
5021  "previous default template argument defined in module %0">;
5022def err_template_param_default_arg_missing : Error<
5023  "template parameter missing a default argument">;
5024def ext_template_parameter_default_in_function_template : ExtWarn<
5025  "default template arguments for a function template are a C++11 extension">,
5026  InGroup<CXX11>;
5027def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
5028  "default template arguments for a function template are incompatible with C++98">,
5029  InGroup<CXX98Compat>, DefaultIgnore;
5030def err_template_parameter_default_template_member : Error<
5031  "cannot add a default template argument to the definition of a member of a "
5032  "class template">;
5033def err_template_parameter_default_friend_template : Error<
5034  "default template argument not permitted on a friend template">;
5035def err_template_template_parm_no_parms : Error<
5036  "template template parameter must have its own template parameters">;
5037
5038def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
5039  InGroup<CXX14>;
5040def warn_cxx11_compat_variable_template : Warning<
5041  "variable templates are incompatible with C++ standards before C++14">,
5042  InGroup<CXXPre14Compat>, DefaultIgnore;
5043def err_template_variable_noparams : Error<
5044  "extraneous 'template<>' in declaration of variable %0">;
5045def err_template_member : Error<"member %0 declared as a template">;
5046def err_member_with_template_arguments : Error<"member %0 cannot have template arguments">;
5047def err_template_member_noparams : Error<
5048  "extraneous 'template<>' in declaration of member %0">;
5049def err_template_tag_noparams : Error<
5050  "extraneous 'template<>' in declaration of %0 %1">;
5051
5052def warn_cxx17_compat_adl_only_template_id : Warning<
5053  "use of function template name with no prior function template "
5054  "declaration in function call with explicit template arguments "
5055  "is incompatible with C++ standards before C++20">,
5056  InGroup<CXXPre20Compat>, DefaultIgnore;
5057def ext_adl_only_template_id : ExtWarn<
5058  "use of function template name with no prior declaration in function call "
5059  "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
5060
5061def warn_unqualified_call_to_std_cast_function : Warning<
5062  "unqualified call to '%0'">, InGroup<DiagGroup<"unqualified-std-cast-call">>;
5063
5064// C++ Template Argument Lists
5065def err_template_missing_args : Error<
5066  "use of "
5067  "%select{class template|function template|variable template|alias template|"
5068  "template template parameter|concept|template}0 %1 requires template "
5069  "arguments">;
5070def err_template_arg_list_different_arity : Error<
5071  "%select{too few|too many}0 template arguments for "
5072  "%select{class template|function template|variable template|alias template|"
5073  "template template parameter|concept|template}1 %2">;
5074def note_template_decl_here : Note<"template is declared here">;
5075def note_template_decl_external : Note<
5076  "template declaration from hidden source: %0">;
5077def err_template_arg_must_be_type : Error<
5078  "template argument for template type parameter must be a type">;
5079def err_template_arg_must_be_type_suggest : Error<
5080  "template argument for template type parameter must be a type; "
5081  "did you forget 'typename'?">;
5082def ext_ms_template_type_arg_missing_typename : ExtWarn<
5083  "template argument for template type parameter must be a type; "
5084  "omitted 'typename' is a Microsoft extension">,
5085  InGroup<MicrosoftTemplate>;
5086def err_template_arg_must_be_expr : Error<
5087  "template argument for non-type template parameter must be an expression">;
5088def err_template_arg_nontype_ambig : Error<
5089  "template argument for non-type template parameter is treated as function type %0">;
5090def err_template_arg_must_be_template : Error<
5091  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
5092def ext_template_arg_local_type : ExtWarn<
5093  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
5094def ext_template_arg_unnamed_type : ExtWarn<
5095  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
5096def warn_cxx98_compat_template_arg_local_type : Warning<
5097  "local type %0 as template argument is incompatible with C++98">,
5098  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
5099def warn_cxx98_compat_template_arg_unnamed_type : Warning<
5100  "unnamed type as template argument is incompatible with C++98">,
5101  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
5102def note_template_unnamed_type_here : Note<
5103  "unnamed type used in template argument was declared here">;
5104def err_template_arg_overload_type : Error<
5105  "template argument is the type of an unresolved overloaded function">;
5106def err_template_arg_not_valid_template : Error<
5107  "template argument does not refer to a class or alias template, or template "
5108  "template parameter">;
5109def note_template_arg_refers_here_func : Note<
5110  "template argument refers to function template %0, here">;
5111def err_template_arg_template_params_mismatch : Error<
5112  "template template argument has different template parameters than its "
5113  "corresponding template template parameter">;
5114def err_template_arg_not_integral_or_enumeral : Error<
5115  "non-type template argument of type %0 must have an integral or enumeration"
5116  " type">;
5117def err_template_arg_not_ice : Error<
5118  "non-type template argument of type %0 is not an integral constant "
5119  "expression">;
5120def err_template_arg_not_address_constant : Error<
5121  "non-type template argument of type %0 is not a constant expression">;
5122def warn_cxx98_compat_template_arg_null : Warning<
5123  "use of null pointer as non-type template argument is incompatible with "
5124  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5125def err_template_arg_untyped_null_constant : Error<
5126  "null non-type template argument must be cast to template parameter type %0">;
5127def err_template_arg_wrongtype_null_constant : Error<
5128  "null non-type template argument of type %0 does not match template parameter "
5129  "of type %1">;
5130def err_non_type_template_parm_type_deduction_failure : Error<
5131  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
5132def err_deduced_non_type_template_arg_type_mismatch : Error<
5133  "deduced non-type template argument does not have the same type as the "
5134  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
5135def err_non_type_template_arg_subobject : Error<
5136  "non-type template argument refers to subobject '%0'">;
5137def err_non_type_template_arg_addr_label_diff : Error<
5138  "template argument / label address difference / what did you expect?">;
5139def err_non_type_template_arg_unsupported : Error<
5140  "sorry, non-type template argument of type %0 is not yet supported">;
5141def err_template_arg_not_convertible : Error<
5142  "non-type template argument of type %0 cannot be converted to a value "
5143  "of type %1">;
5144def warn_template_arg_negative : Warning<
5145  "non-type template argument with value '%0' converted to '%1' for unsigned "
5146  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5147def warn_template_arg_too_large : Warning<
5148  "non-type template argument value '%0' truncated to '%1' for "
5149  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5150def err_template_arg_no_ref_bind : Error<
5151  "non-type template parameter of reference type "
5152  "%diff{$ cannot bind to template argument of type $"
5153  "|cannot bind to template of incompatible argument type}0,1">;
5154def err_template_arg_ref_bind_ignores_quals : Error<
5155  "reference binding of non-type template parameter "
5156  "%diff{of type $ to template argument of type $|to template argument}0,1 "
5157  "ignores qualifiers">;
5158def err_template_arg_not_decl_ref : Error<
5159  "non-type template argument does not refer to any declaration">;
5160def err_template_arg_not_address_of : Error<
5161  "non-type template argument for template parameter of pointer type %0 must "
5162  "have its address taken">;
5163def err_template_arg_address_of_non_pointer : Error<
5164  "address taken in non-type template argument for template parameter of "
5165  "reference type %0">;
5166def err_template_arg_reference_var : Error<
5167  "non-type template argument of reference type %0 is not an object">;
5168def err_template_arg_field : Error<
5169  "non-type template argument refers to non-static data member %0">;
5170def err_template_arg_method : Error<
5171  "non-type template argument refers to non-static member function %0">;
5172def err_template_arg_object_no_linkage : Error<
5173  "non-type template argument refers to %select{function|object}0 %1 that "
5174  "does not have linkage">;
5175def warn_cxx98_compat_template_arg_object_internal : Warning<
5176  "non-type template argument referring to %select{function|object}0 %1 with "
5177  "internal linkage is incompatible with C++98">,
5178  InGroup<CXX98Compat>, DefaultIgnore;
5179def ext_template_arg_object_internal : ExtWarn<
5180  "non-type template argument referring to %select{function|object}0 %1 with "
5181  "internal linkage is a C++11 extension">, InGroup<CXX11>;
5182def err_template_arg_thread_local : Error<
5183  "non-type template argument refers to thread-local object">;
5184def note_template_arg_internal_object : Note<
5185  "non-type template argument refers to %select{function|object}0 here">;
5186def note_template_arg_refers_here : Note<
5187  "non-type template argument refers here">;
5188def err_template_arg_not_object_or_func : Error<
5189  "non-type template argument does not refer to an object or function">;
5190def err_template_arg_not_pointer_to_member_form : Error<
5191  "non-type template argument is not a pointer to member constant">;
5192def err_template_arg_member_ptr_base_derived_not_supported : Error<
5193  "sorry, non-type template argument of pointer-to-member type %1 that refers "
5194  "to member %q0 of a different class is not supported yet">;
5195def err_template_arg_invalid : Error<
5196  "non-type template argument '%0' is invalid">;
5197def ext_template_arg_extra_parens : ExtWarn<
5198  "address non-type template argument cannot be surrounded by parentheses">;
5199def warn_cxx98_compat_template_arg_extra_parens : Warning<
5200  "redundant parentheses surrounding address non-type template argument are "
5201  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5202def err_pointer_to_member_type : Error<
5203  "invalid use of pointer to member type after %select{.*|->*}0">;
5204def err_pointer_to_member_call_drops_quals : Error<
5205  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
5206def err_pointer_to_member_oper_value_classify: Error<
5207  "pointer-to-member function type %0 can only be called on an "
5208  "%select{rvalue|lvalue}1">;
5209def ext_pointer_to_const_ref_member_on_rvalue : Extension<
5210  "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
5211  InGroup<CXX20>, SFINAEFailure;
5212def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
5213  "invoking a pointer to a 'const &' member function on an rvalue is "
5214  "incompatible with C++ standards before C++20">,
5215  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
5216def ext_ms_deref_template_argument: ExtWarn<
5217  "non-type template argument containing a dereference operation is a "
5218  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5219def ext_ms_delayed_template_argument: ExtWarn<
5220  "using the undeclared type %0 as a default template argument is a "
5221  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5222def err_template_arg_deduced_incomplete_pack : Error<
5223  "deduced incomplete pack %0 for template parameter %1">;
5224
5225// C++ template specialization
5226def err_template_spec_unknown_kind : Error<
5227  "can only provide an explicit specialization for a class template, function "
5228  "template, variable template, or a member function, static data member, "
5229  "%select{or member class|member class, or member enumeration}0 of a "
5230  "class template">;
5231def note_specialized_entity : Note<
5232  "explicitly specialized declaration is here">;
5233def err_template_spec_decl_function_scope : Error<
5234  "explicit specialization of %0 in function scope">;
5235def err_template_spec_decl_friend : Error<
5236  "cannot declare an explicit specialization in a friend">;
5237def err_template_spec_redecl_out_of_scope : Error<
5238  "%select{class template|class template partial|variable template|"
5239  "variable template partial|function template|member "
5240  "function|static data member|member class|member enumeration}0 "
5241  "specialization of %1 not in %select{a namespace enclosing %2|"
5242  "class %2 or an enclosing namespace}3">;
5243def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
5244  "%select{class template|class template partial|variable template|"
5245  "variable template partial|function template|member "
5246  "function|static data member|member class|member enumeration}0 "
5247  "specialization of %1 not in %select{a namespace enclosing %2|"
5248  "class %2 or an enclosing namespace}3 "
5249  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
5250def err_template_spec_redecl_global_scope : Error<
5251  "%select{class template|class template partial|variable template|"
5252  "variable template partial|function template|member "
5253  "function|static data member|member class|member enumeration}0 "
5254  "specialization of %1 must occur at global scope">;
5255def err_spec_member_not_instantiated : Error<
5256  "specialization of member %q0 does not specialize an instantiated member">;
5257def note_specialized_decl : Note<"attempt to specialize declaration here">;
5258def err_specialization_after_instantiation : Error<
5259  "explicit specialization of %0 after instantiation">;
5260def note_instantiation_required_here : Note<
5261  "%select{implicit|explicit}0 instantiation first required here">;
5262def err_template_spec_friend : Error<
5263  "template specialization declaration cannot be a friend">;
5264def err_template_spec_default_arg : Error<
5265  "default argument not permitted on an explicit "
5266  "%select{instantiation|specialization}0 of function %1">;
5267def err_not_class_template_specialization : Error<
5268  "cannot specialize a %select{dependent template|template template "
5269  "parameter}0">;
5270def ext_explicit_specialization_storage_class : ExtWarn<
5271  "explicit specialization cannot have a storage class">;
5272def err_explicit_specialization_inconsistent_storage_class : Error<
5273  "explicit specialization has extraneous, inconsistent storage class "
5274  "'%select{none|extern|static|__private_extern__|auto|register}0'">;
5275def err_dependent_function_template_spec_no_match : Error<
5276  "no candidate function template was found for dependent"
5277  " %select{member|friend}0 function template specialization">;
5278def note_dependent_function_template_spec_discard_reason : Note<
5279  "candidate ignored: %select{not a function template|"
5280  "not a member of the enclosing %select{class template|"
5281  "namespace; did you mean to explicitly qualify the specialization?}1}0">;
5282
5283// C++ class template specializations and out-of-line definitions
5284def err_template_spec_needs_header : Error<
5285  "template specialization requires 'template<>'">;
5286def err_template_spec_needs_template_parameters : Error<
5287  "template specialization or definition requires a template parameter list "
5288  "corresponding to the nested type %0">;
5289def err_template_param_list_matches_nontemplate : Error<
5290  "template parameter list matching the non-templated nested type %0 should "
5291  "be empty ('template<>')">;
5292def err_alias_template_extra_headers : Error<
5293  "extraneous template parameter list in alias template declaration">;
5294def err_template_spec_extra_headers : Error<
5295  "extraneous template parameter list in template specialization or "
5296  "out-of-line template definition">;
5297def warn_template_spec_extra_headers : Warning<
5298  "extraneous template parameter list in template specialization">;
5299def note_explicit_template_spec_does_not_need_header : Note<
5300  "'template<>' header not required for explicitly-specialized class %0 "
5301  "declared here">;
5302def err_template_qualified_declarator_no_match : Error<
5303  "nested name specifier '%0' for declaration does not refer into a class, "
5304  "class template or class template partial specialization">;
5305def err_specialize_member_of_template : Error<
5306  "cannot specialize %select{|(with 'template<>') }0a member of an "
5307  "unspecialized template">;
5308
5309// C++ Class Template Partial Specialization
5310def err_default_arg_in_partial_spec : Error<
5311    "default template argument in a class template partial specialization">;
5312def err_dependent_non_type_arg_in_partial_spec : Error<
5313    "type of specialized non-type template argument depends on a template "
5314    "parameter of the partial specialization">;
5315def note_dependent_non_type_default_arg_in_partial_spec : Note<
5316    "template parameter is used in default argument declared here">;
5317def err_dependent_typed_non_type_arg_in_partial_spec : Error<
5318    "non-type template argument specializes a template parameter with "
5319    "dependent type %0">;
5320def err_partial_spec_args_match_primary_template : Error<
5321    "%select{class|variable}0 template partial specialization does not "
5322    "specialize any template argument; to %select{declare|define}1 the "
5323    "primary template, remove the template argument list">;
5324def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
5325    "%select{class|variable}0 template partial specialization is not "
5326    "more specialized than the primary template">, DefaultError,
5327    InGroup<DiagGroup<"invalid-partial-specialization">>;
5328def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
5329def ext_partial_specs_not_deducible : ExtWarn<
5330    "%select{class|variable}0 template partial specialization contains "
5331    "%select{a template parameter|template parameters}1 that cannot be "
5332    "deduced; this partial specialization will never be used">,
5333    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
5334def note_non_deducible_parameter : Note<
5335    "non-deducible template parameter %0">;
5336def err_partial_spec_ordering_ambiguous : Error<
5337    "ambiguous partial specializations of %0">;
5338def note_partial_spec_match : Note<"partial specialization matches %0">;
5339def err_partial_spec_redeclared : Error<
5340  "class template partial specialization %0 cannot be redeclared">;
5341def note_prev_partial_spec_here : Note<
5342  "previous declaration of class template partial specialization %0 is here">;
5343def err_partial_spec_fully_specialized : Error<
5344  "partial specialization of %0 does not use any of its template parameters">;
5345
5346// C++ Variable Template Partial Specialization
5347def err_var_partial_spec_redeclared : Error<
5348  "variable template partial specialization %0 cannot be redefined">;
5349def note_var_prev_partial_spec_here : Note<
5350  "previous declaration of variable template partial specialization is here">;
5351def err_var_spec_no_template : Error<
5352  "no variable template matches%select{| partial}0 specialization">;
5353def err_var_spec_no_template_but_method : Error<
5354  "no variable template matches specialization; "
5355  "did you mean to use %0 as function template instead?">;
5356
5357// C++ Function template specializations
5358def err_function_template_spec_no_match : Error<
5359    "no function template matches function template specialization %0">;
5360def err_function_template_spec_ambiguous : Error<
5361    "function template specialization %0 ambiguously refers to more than one "
5362    "function template; explicitly specify%select{| additional}1 template "
5363    "arguments to identify a particular function template">;
5364def note_function_template_spec_matched : Note<
5365    "function template %q0 matches specialization %1">;
5366def err_function_template_partial_spec : Error<
5367    "function template partial specialization is not allowed">;
5368
5369// C++ Template Instantiation
5370def err_template_recursion_depth_exceeded : Error<
5371  "recursive template instantiation exceeded maximum depth of %0">,
5372  DefaultFatal, NoSFINAE;
5373def err_constraint_depends_on_self : Error<
5374  "satisfaction of constraint '%0' depends on itself">, NoSFINAE;
5375def note_template_recursion_depth : Note<
5376  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
5377
5378def err_template_instantiate_within_definition : Error<
5379  "%select{implicit|explicit}0 instantiation of template %1 within its"
5380  " own definition">;
5381def err_template_instantiate_undefined : Error<
5382  "%select{implicit|explicit}0 instantiation of undefined template %1">;
5383def err_implicit_instantiate_member_undefined : Error<
5384  "implicit instantiation of undefined member %0">;
5385def note_template_class_instantiation_was_here : Note<
5386  "class template %0 was instantiated here">;
5387def note_template_class_explicit_specialization_was_here : Note<
5388  "class template %0 was explicitly specialized here">;
5389def note_template_class_instantiation_here : Note<
5390  "in instantiation of template class %q0 requested here">;
5391def note_template_member_class_here : Note<
5392  "in instantiation of member class %q0 requested here">;
5393def note_template_member_function_here : Note<
5394  "in instantiation of member function %q0 requested here">;
5395def note_function_template_spec_here : Note<
5396  "in instantiation of function template specialization %q0 requested here">;
5397def note_template_static_data_member_def_here : Note<
5398  "in instantiation of static data member %q0 requested here">;
5399def note_template_variable_def_here : Note<
5400  "in instantiation of variable template specialization %q0 requested here">;
5401def note_template_enum_def_here : Note<
5402  "in instantiation of enumeration %q0 requested here">;
5403def note_template_nsdmi_here : Note<
5404  "in instantiation of default member initializer %q0 requested here">;
5405def note_template_type_alias_instantiation_here : Note<
5406  "in instantiation of template type alias %0 requested here">;
5407def note_template_exception_spec_instantiation_here : Note<
5408  "in instantiation of exception specification for %0 requested here">;
5409def note_template_requirement_instantiation_here : Note<
5410  "in instantiation of requirement here">;
5411def note_template_requirement_params_instantiation_here : Note<
5412  "in instantiation of requirement parameters here">;
5413def warn_var_template_missing : Warning<"instantiation of variable %q0 "
5414  "required here, but no definition is available">,
5415  InGroup<UndefinedVarTemplate>;
5416def warn_func_template_missing : Warning<"instantiation of function %q0 "
5417  "required here, but no definition is available">,
5418  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
5419def note_forward_template_decl : Note<
5420  "forward declaration of template entity is here">;
5421def note_inst_declaration_hint : Note<"add an explicit instantiation "
5422  "declaration to suppress this warning if %q0 is explicitly instantiated in "
5423  "another translation unit">;
5424def note_evaluating_exception_spec_here : Note<
5425  "in evaluation of exception specification for %q0 needed here">;
5426
5427def note_default_arg_instantiation_here : Note<
5428  "in instantiation of default argument for '%0' required here">;
5429def note_default_function_arg_instantiation_here : Note<
5430  "in instantiation of default function argument expression "
5431  "for '%0' required here">;
5432def note_explicit_template_arg_substitution_here : Note<
5433  "while substituting explicitly-specified template arguments into function "
5434  "template %0 %1">;
5435def note_function_template_deduction_instantiation_here : Note<
5436  "while substituting deduced template arguments into function template %0 "
5437  "%1">;
5438def note_deduced_template_arg_substitution_here : Note<
5439  "during template argument deduction for %select{class|variable}0 template "
5440  "%select{partial specialization |}1%2 %3">;
5441def note_prior_template_arg_substitution : Note<
5442  "while substituting prior template arguments into %select{non-type|template}0"
5443  " template parameter%1 %2">;
5444def note_template_default_arg_checking : Note<
5445  "while checking a default template argument used here">;
5446def note_concept_specialization_here : Note<
5447  "while checking the satisfaction of concept '%0' requested here">;
5448def note_nested_requirement_here : Note<
5449  "while checking the satisfaction of nested requirement requested here">;
5450def note_checking_constraints_for_template_id_here : Note<
5451  "while checking constraint satisfaction for template '%0' required here">;
5452def note_checking_constraints_for_var_spec_id_here : Note<
5453  "while checking constraint satisfaction for variable template "
5454  "partial specialization '%0' required here">;
5455def note_checking_constraints_for_class_spec_id_here : Note<
5456  "while checking constraint satisfaction for class template partial "
5457  "specialization '%0' required here">;
5458def note_checking_constraints_for_function_here : Note<
5459  "while checking constraint satisfaction for function '%0' required here">;
5460def note_constraint_substitution_here : Note<
5461  "while substituting template arguments into constraint expression here">;
5462def note_constraint_normalization_here : Note<
5463  "while calculating associated constraint of template '%0' here">;
5464def note_parameter_mapping_substitution_here : Note<
5465  "while substituting into concept arguments here; substitution failures not "
5466  "allowed in concept arguments">;
5467def note_building_deduction_guide_here : Note<
5468  "while building implicit deduction guide first needed here">;
5469def note_lambda_substitution_here : Note<
5470  "while substituting into a lambda expression here">;
5471def note_instantiation_contexts_suppressed : Note<
5472  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
5473  "see all)">;
5474
5475def err_field_instantiates_to_function : Error<
5476  "data member instantiated with function type %0">;
5477def err_variable_instantiates_to_function : Error<
5478  "%select{variable|static data member}0 instantiated with function type %1">;
5479def err_nested_name_spec_non_tag : Error<
5480  "type %0 cannot be used prior to '::' because it has no members">;
5481
5482def err_using_pack_expansion_empty : Error<
5483  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
5484
5485// C++ Explicit Instantiation
5486def err_explicit_instantiation_duplicate : Error<
5487    "duplicate explicit instantiation of %0">;
5488def ext_explicit_instantiation_duplicate : ExtWarn<
5489    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
5490    InGroup<MicrosoftTemplate>;
5491def note_previous_explicit_instantiation : Note<
5492    "previous explicit instantiation is here">;
5493def warn_explicit_instantiation_after_specialization : Warning<
5494  "explicit instantiation of %0 that occurs after an explicit "
5495  "specialization has no effect">,
5496  InGroup<DiagGroup<"instantiation-after-specialization">>;
5497def note_previous_template_specialization : Note<
5498    "previous template specialization is here">;
5499def err_explicit_instantiation_nontemplate_type : Error<
5500    "explicit instantiation of non-templated type %0">;
5501def note_nontemplate_decl_here : Note<
5502    "non-templated declaration is here">;
5503def err_explicit_instantiation_in_class : Error<
5504  "explicit instantiation of %0 in class scope">;
5505def err_explicit_instantiation_out_of_scope : Error<
5506  "explicit instantiation of %0 not in a namespace enclosing %1">;
5507def err_explicit_instantiation_must_be_global : Error<
5508  "explicit instantiation of %0 must occur at global scope">;
5509def warn_explicit_instantiation_out_of_scope_0x : Warning<
5510  "explicit instantiation of %0 not in a namespace enclosing %1">,
5511  InGroup<CXX11Compat>, DefaultIgnore;
5512def warn_explicit_instantiation_must_be_global_0x : Warning<
5513  "explicit instantiation of %0 must occur at global scope">,
5514  InGroup<CXX11Compat>, DefaultIgnore;
5515
5516def err_explicit_instantiation_requires_name : Error<
5517  "explicit instantiation declaration requires a name">;
5518def err_explicit_instantiation_of_typedef : Error<
5519  "explicit instantiation of typedef %0">;
5520def err_explicit_instantiation_storage_class : Error<
5521  "explicit instantiation cannot have a storage class">;
5522def err_explicit_instantiation_internal_linkage : Error<
5523  "explicit instantiation declaration of %0 with internal linkage">;
5524def err_explicit_instantiation_not_known : Error<
5525  "explicit instantiation of %0 does not refer to a function template, "
5526  "variable template, member function, member class, or static data member">;
5527def note_explicit_instantiation_here : Note<
5528  "explicit instantiation refers here">;
5529def err_explicit_instantiation_data_member_not_instantiated : Error<
5530  "explicit instantiation refers to static data member %q0 that is not an "
5531  "instantiation">;
5532def err_explicit_instantiation_member_function_not_instantiated : Error<
5533  "explicit instantiation refers to member function %q0 that is not an "
5534  "instantiation">;
5535def err_explicit_instantiation_ambiguous : Error<
5536  "partial ordering for explicit instantiation of %0 is ambiguous">;
5537def note_explicit_instantiation_candidate : Note<
5538  "explicit instantiation candidate function %q0 template here %1">;
5539def err_explicit_instantiation_inline : Error<
5540  "explicit instantiation cannot be 'inline'">;
5541def warn_explicit_instantiation_inline_0x : Warning<
5542  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5543  DefaultIgnore;
5544def err_explicit_instantiation_constexpr : Error<
5545  "explicit instantiation cannot be 'constexpr'">;
5546def ext_explicit_instantiation_without_qualified_id : Extension<
5547  "qualifier in explicit instantiation of %q0 requires a template-id "
5548  "(a typedef is not permitted)">;
5549def err_explicit_instantiation_without_template_id : Error<
5550  "explicit instantiation of %q0 must specify a template argument list">;
5551def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5552  "explicit instantiation of %q0 must occur in namespace %1">;
5553def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5554  "explicit instantiation of %q0 must occur in namespace %1">,
5555  InGroup<CXX11Compat>, DefaultIgnore;
5556def err_explicit_instantiation_undefined_member : Error<
5557  "explicit instantiation of undefined %select{member class|member function|"
5558  "static data member}0 %1 of class template %2">;
5559def err_explicit_instantiation_undefined_func_template : Error<
5560  "explicit instantiation of undefined function template %0">;
5561def err_explicit_instantiation_undefined_var_template : Error<
5562  "explicit instantiation of undefined variable template %q0">;
5563def err_explicit_instantiation_declaration_after_definition : Error<
5564  "explicit instantiation declaration (with 'extern') follows explicit "
5565  "instantiation definition (without 'extern')">;
5566def note_explicit_instantiation_definition_here : Note<
5567  "explicit instantiation definition is here">;
5568def err_invalid_var_template_spec_type : Error<"type %2 "
5569  "of %select{explicit instantiation|explicit specialization|"
5570  "partial specialization|redeclaration}0 of %1 does not match"
5571  " expected type %3">;
5572def err_mismatched_exception_spec_explicit_instantiation : Error<
5573  "exception specification in explicit instantiation does not match "
5574  "instantiated one">;
5575def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5576  err_mismatched_exception_spec_explicit_instantiation.Summary>,
5577  InGroup<MicrosoftExceptionSpec>;
5578def err_explicit_instantiation_dependent : Error<
5579  "explicit instantiation has dependent template arguments">;
5580
5581// C++ typename-specifiers
5582def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5583def err_typename_nested_not_found_enable_if : Error<
5584  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5585  "this declaration">;
5586def err_typename_nested_not_found_requirement : Error<
5587  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5588  "declaration">;
5589def err_typename_nested_not_type : Error<
5590    "typename specifier refers to non-type member %0 in %1">;
5591def err_typename_not_type : Error<
5592    "typename specifier refers to non-type %0">;
5593def note_typename_member_refers_here : Note<
5594    "referenced member %0 is declared here">;
5595def note_typename_refers_here : Note<
5596    "referenced %0 is declared here">;
5597def err_typename_missing : Error<
5598  "missing 'typename' prior to dependent type name '%0%1'">;
5599def err_typename_missing_template : Error<
5600  "missing 'typename' prior to dependent type template name '%0%1'">;
5601def ext_typename_missing : ExtWarn<
5602  "missing 'typename' prior to dependent type name '%0%1'">,
5603  InGroup<DiagGroup<"typename-missing">>;
5604def ext_typename_outside_of_template : ExtWarn<
5605  "'typename' occurs outside of a template">, InGroup<CXX11>;
5606def warn_cxx98_compat_typename_outside_of_template : Warning<
5607  "use of 'typename' outside of a template is incompatible with C++98">,
5608  InGroup<CXX98Compat>, DefaultIgnore;
5609def err_typename_refers_to_using_value_decl : Error<
5610  "typename specifier refers to a dependent using declaration for a value "
5611  "%0 in %1">;
5612def note_using_value_decl_missing_typename : Note<
5613  "add 'typename' to treat this using declaration as a type">;
5614def warn_cxx17_compat_implicit_typename : Warning<"use of implicit 'typename' is "
5615  "incompatible with C++ standards before C++20">, InGroup<CXX20Compat>,
5616  DefaultIgnore;
5617def ext_implicit_typename : ExtWarn<"missing 'typename' prior to dependent "
5618  "type name %0%1; implicit 'typename' is a C++20 extension">,
5619  InGroup<CXX20>;
5620
5621def err_template_kw_refers_to_non_template : Error<
5622  "%0%select{| following the 'template' keyword}1 "
5623  "does not refer to a template">;
5624def note_template_kw_refers_to_non_template : Note<
5625  "declared as a non-template here">;
5626def err_template_kw_refers_to_dependent_non_template : Error<
5627  "%0%select{| following the 'template' keyword}1 "
5628  "cannot refer to a dependent template">;
5629def err_template_kw_refers_to_type_template : Error<
5630  "'%0%1' is expected to be a non-type template, but instantiated to a %select{class|type alias}2 template">;
5631def note_referenced_type_template : Note<
5632  "%select{class|type alias}0 template declared here">;
5633def err_template_kw_missing : Error<
5634  "missing 'template' keyword prior to dependent template name '%0%1'">;
5635def ext_template_outside_of_template : ExtWarn<
5636  "'template' keyword outside of a template">, InGroup<CXX11>;
5637def warn_cxx98_compat_template_outside_of_template : Warning<
5638  "use of 'template' keyword outside of a template is incompatible with C++98">,
5639  InGroup<CXX98Compat>, DefaultIgnore;
5640
5641def err_non_type_template_in_nested_name_specifier : Error<
5642  "qualified name refers into a specialization of %select{function|variable}0 "
5643  "template %1">;
5644def err_template_id_not_a_type : Error<
5645  "template name refers to non-type template %0">;
5646def note_template_declared_here : Note<
5647  "%select{function template|class template|variable template"
5648  "|type alias template|template template parameter}0 "
5649  "%1 declared here">;
5650def err_template_expansion_into_fixed_list : Error<
5651  "pack expansion used as argument for non-pack parameter of %select{alias "
5652  "template|concept}0">;
5653def note_parameter_type : Note<
5654  "parameter of type %0 is declared here">;
5655
5656// C++11 Variadic Templates
5657def err_template_param_pack_default_arg : Error<
5658  "template parameter pack cannot have a default argument">;
5659def err_template_param_pack_must_be_last_template_parameter : Error<
5660  "template parameter pack must be the last template parameter">;
5661
5662def err_template_parameter_pack_non_pack : Error<
5663  "%select{template type|non-type template|template template}0 parameter"
5664  "%select{| pack}1 conflicts with previous %select{template type|"
5665  "non-type template|template template}0 parameter%select{ pack|}1">;
5666def note_template_parameter_pack_non_pack : Note<
5667  "%select{template type|non-type template|template template}0 parameter"
5668  "%select{| pack}1 does not match %select{template type|non-type template"
5669  "|template template}0 parameter%select{ pack|}1 in template argument">;
5670def note_template_parameter_pack_here : Note<
5671  "previous %select{template type|non-type template|template template}0 "
5672  "parameter%select{| pack}1 declared here">;
5673
5674def err_unexpanded_parameter_pack : Error<
5675  "%select{expression|base type|declaration type|data member type|bit-field "
5676  "size|static assertion|fixed underlying type|enumerator value|"
5677  "using declaration|friend declaration|qualifier|initializer|default argument|"
5678  "non-type template parameter type|exception type|explicit specialization|"
5679  "partial specialization|__if_exists name|__if_not_exists name|lambda|block|"
5680  "type constraint|requirement|requires clause}0 "
5681  "contains%plural{0: an|:}1 unexpanded parameter pack"
5682  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5683
5684def err_pack_expansion_without_parameter_packs : Error<
5685  "pack expansion does not contain any unexpanded parameter packs">;
5686def err_pack_expansion_length_conflict : Error<
5687  "pack expansion contains parameter packs %0 and %1 that have different "
5688  "lengths (%2 vs. %3)">;
5689def err_pack_expansion_length_conflict_multilevel : Error<
5690  "pack expansion contains parameter pack %0 that has a different "
5691  "length (%1 vs. %2) from outer parameter packs">;
5692def err_pack_expansion_length_conflict_partial : Error<
5693  "pack expansion contains parameter pack %0 that has a different "
5694  "length (at least %1 vs. %2) from outer parameter packs">;
5695def err_pack_expansion_member_init : Error<
5696  "pack expansion for initialization of member %0">;
5697
5698def err_function_parameter_pack_without_parameter_packs : Error<
5699  "type %0 of function parameter pack does not contain any unexpanded "
5700  "parameter packs">;
5701def err_ellipsis_in_declarator_not_parameter : Error<
5702  "only function and template parameters can be parameter packs">;
5703
5704def err_sizeof_pack_no_pack_name : Error<
5705  "%0 does not refer to the name of a parameter pack">;
5706
5707def err_fold_expression_packs_both_sides : Error<
5708  "binary fold expression has unexpanded parameter packs in both operands">;
5709def err_fold_expression_empty : Error<
5710  "unary fold expression has empty expansion for operator '%0' "
5711  "with no fallback value">;
5712def err_fold_expression_bad_operand : Error<
5713  "expression not permitted as operand of fold expression">;
5714def err_fold_expression_limit_exceeded: Error<
5715  "instantiating fold expression with %0 arguments exceeded expression nesting "
5716  "limit of %1">, DefaultFatal, NoSFINAE;
5717
5718def err_unexpected_typedef : Error<
5719  "unexpected type name %0: expected expression">;
5720def err_unexpected_namespace : Error<
5721  "unexpected namespace name %0: expected expression">;
5722def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5723def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5724  "use of undeclared identifier %0; "
5725  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5726  InGroup<MicrosoftTemplate>;
5727def err_found_in_dependent_base : Error<
5728  "explicit qualification required to use member %0 from dependent base class">;
5729def ext_found_in_dependent_base : ExtWarn<"use of member %0 "
5730  "found via unqualified lookup into dependent bases of class templates is a "
5731  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5732def err_found_later_in_class : Error<"member %0 used before its declaration">;
5733def ext_found_later_in_class : ExtWarn<
5734  "use of member %0 before its declaration is a Microsoft extension">,
5735  InGroup<MicrosoftTemplate>;
5736def ext_unqualified_base_class : ExtWarn<
5737  "unqualified base initializer of class templates is a Microsoft extension">,
5738  InGroup<MicrosoftTemplate>;
5739def note_dependent_member_use : Note<
5740  "must qualify identifier to find this declaration in dependent base class">;
5741def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5742    "visible in the template definition nor found by argument-dependent lookup">;
5743def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5744    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5745def err_undeclared_use : Error<"use of undeclared %0">;
5746def warn_deprecated : Warning<"%0 is deprecated">,
5747    InGroup<DeprecatedDeclarations>;
5748def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5749def warn_property_method_deprecated :
5750    Warning<"property access is using %0 method which is deprecated">,
5751    InGroup<DeprecatedDeclarations>;
5752def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5753    InGroup<DeprecatedDeclarations>;
5754def warn_deprecated_anonymous_namespace : Warning<
5755  "'deprecated' attribute on anonymous namespace ignored">,
5756  InGroup<IgnoredAttributes>;
5757def warn_deprecated_fwdclass_message : Warning<
5758    "%0 may be deprecated because the receiver type is unknown">,
5759    InGroup<DeprecatedDeclarations>;
5760def warn_deprecated_def : Warning<
5761  "implementing deprecated %select{method|class|category}0">,
5762  InGroup<DeprecatedImplementations>, DefaultIgnore;
5763def warn_unavailable_def : Warning<
5764  "implementing unavailable method">,
5765  InGroup<DeprecatedImplementations>, DefaultIgnore;
5766def warn_deprecated_builtin : Warning<
5767  "builtin %0 is deprecated; use %1 instead">,
5768  InGroup<DeprecatedBuiltins>;
5769def err_unavailable : Error<"%0 is unavailable">;
5770def err_property_method_unavailable :
5771    Error<"property access is using %0 method which is unavailable">;
5772def err_unavailable_message : Error<"%0 is unavailable: %1">;
5773def warn_unavailable_fwdclass_message : Warning<
5774    "%0 may be unavailable because the receiver type is unknown">,
5775    InGroup<UnavailableDeclarations>;
5776def note_availability_specified_here : Note<
5777  "%0 has been explicitly marked "
5778  "%select{unavailable|deleted|deprecated}1 here">;
5779def note_partial_availability_specified_here : Note<
5780  "%0 has been marked as being introduced in %1 %2 here, "
5781  "but the deployment target is %1 %3">;
5782def note_implicitly_deleted : Note<
5783  "explicitly defaulted function was implicitly deleted here">;
5784def warn_not_enough_argument : Warning<
5785  "not enough variable arguments in %0 declaration to fit a sentinel">,
5786  InGroup<Sentinel>;
5787def warn_missing_sentinel : Warning <
5788  "missing sentinel in %select{function call|method dispatch|block call}0">,
5789  InGroup<Sentinel>;
5790def note_sentinel_here : Note<
5791  "%select{function|method|block}0 has been explicitly marked sentinel here">;
5792def warn_strict_uses_without_prototype : Warning<
5793  "passing arguments to %select{a function|%1}0 without a prototype is "
5794  "deprecated in all versions of C and is not supported in C23">,
5795  InGroup<DeprecatedNonPrototype>;
5796def warn_missing_prototype : Warning<
5797  "no previous prototype for function %0">,
5798  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5799def note_declaration_not_a_prototype : Note<
5800  "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5801  "to make it %select{a prototype for a zero-parameter function|one}0">;
5802// This is not actually an extension, but we only want it to be enabled in
5803// -pedantic mode and this is the most direct way of accomplishing that.
5804def warn_strict_prototypes : Extension<
5805  "a %select{function|block}0 declaration without a prototype is deprecated "
5806  "%select{in all versions of C|}0">, InGroup<StrictPrototypes>;
5807def warn_non_prototype_changes_behavior : Warning<
5808  "a function %select{declaration|definition}0 without a prototype is "
5809  "deprecated in all versions of C %select{and is not supported in C23|and is "
5810  "treated as a zero-parameter prototype in C23, conflicting with a "
5811  "%select{previous|subsequent}2 %select{declaration|definition}3}1">,
5812  InGroup<DeprecatedNonPrototype>;
5813def note_conflicting_prototype : Note<"conflicting prototype is here">;
5814def warn_missing_variable_declarations : Warning<
5815  "no previous extern declaration for non-static variable %0">,
5816  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5817def note_static_for_internal_linkage : Note<
5818  "declare 'static' if the %select{variable|function}0 is not intended to be "
5819  "used outside of this translation unit">;
5820def err_static_data_member_reinitialization :
5821  Error<"static data member %0 already has an initializer">;
5822def err_redefinition : Error<"redefinition of %0">;
5823def err_alias_after_tentative :
5824  Error<"alias definition of %0 after tentative definition">;
5825def err_alias_is_definition :
5826  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5827def err_definition_of_implicitly_declared_member : Error<
5828  "definition of implicitly declared %select{default constructor|copy "
5829  "constructor|move constructor|copy assignment operator|move assignment "
5830  "operator|destructor|function}1">;
5831def err_definition_of_explicitly_defaulted_member : Error<
5832  "definition of explicitly defaulted %select{default constructor|copy "
5833  "constructor|move constructor|copy assignment operator|move assignment "
5834  "operator|destructor|function}0">;
5835def err_redefinition_extern_inline : Error<
5836  "redefinition of a 'extern inline' function %0 is not supported in "
5837  "%select{C99 mode|C++}1">;
5838def warn_attr_abi_tag_namespace : Warning<
5839  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5840  InGroup<IgnoredAttributes>;
5841def err_abi_tag_on_redeclaration : Error<
5842  "cannot add 'abi_tag' attribute in a redeclaration">;
5843def err_new_abi_tag_on_redeclaration : Error<
5844  "'abi_tag' %0 missing in original declaration">;
5845def note_use_ifdef_guards : Note<
5846  "unguarded header; consider using #ifdef guards or #pragma once">;
5847
5848def warn_var_decl_not_read_only : Warning<
5849  "object of type %0 cannot be placed in read-only memory">,
5850  InGroup<ReadOnlyPlacementChecks>;
5851def note_enforce_read_only_placement : Note<"type was declared read-only here">;
5852
5853
5854def note_deleted_dtor_no_operator_delete : Note<
5855  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5856def note_deleted_special_member_class_subobject : Note<
5857  "%select{default constructor of|copy constructor of|move constructor of|"
5858  "copy assignment operator of|move assignment operator of|destructor of|"
5859  "constructor inherited by}0 "
5860  "%1 is implicitly deleted because "
5861  "%select{base class %3|%select{||||variant }4field %3}2 "
5862  "%select{has "
5863  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5864  "%select{%select{default constructor|copy constructor|move constructor|copy "
5865  "assignment operator|move assignment operator|destructor|"
5866  "%select{default|corresponding|default|default|default}4 constructor}0|"
5867  "destructor}5"
5868  "%select{||s||}4"
5869  "|is an ObjC pointer}6">;
5870def note_deleted_default_ctor_uninit_field : Note<
5871  "%select{default constructor of|constructor inherited by}0 "
5872  "%1 is implicitly deleted because field %2 of "
5873  "%select{reference|const-qualified}4 type %3 would not be initialized">;
5874def note_deleted_default_ctor_all_const : Note<
5875  "%select{default constructor of|constructor inherited by}0 "
5876  "%1 is implicitly deleted because all "
5877  "%select{data members|data members of an anonymous union member}2"
5878  " are const-qualified">;
5879def note_deleted_copy_ctor_rvalue_reference : Note<
5880  "copy constructor of %0 is implicitly deleted because field %1 is of "
5881  "rvalue reference type %2">;
5882def note_deleted_copy_user_declared_move : Note<
5883  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5884  " %1 has a user-declared move %select{constructor|assignment operator}2">;
5885def note_deleted_assign_field : Note<
5886  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5887  "because field %2 is of %select{reference|const-qualified}4 type %3">;
5888
5889// These should be errors.
5890def warn_undefined_internal : Warning<
5891  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5892  InGroup<DiagGroup<"undefined-internal">>;
5893def err_undefined_internal_type : Error<
5894  "%select{function|variable}0 %q1 is used but not defined in this "
5895  "translation unit, and cannot be defined in any other translation unit "
5896  "because its type does not have linkage">;
5897def ext_undefined_internal_type : Extension<
5898  "ISO C++ requires a definition in this translation unit for "
5899  "%select{function|variable}0 %q1 because its type does not have linkage">,
5900  InGroup<DiagGroup<"undefined-internal-type">>;
5901def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5902  InGroup<DiagGroup<"undefined-inline">>;
5903def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5904def note_used_here : Note<"used here">;
5905
5906def err_attribute_missing_on_first_decl : Error<
5907  "%0 attribute does not appear on the first declaration">;
5908def warn_internal_linkage_local_storage : Warning<
5909  "'internal_linkage' attribute on a non-static local variable is ignored">,
5910  InGroup<IgnoredAttributes>;
5911
5912def ext_internal_in_extern_inline : ExtWarn<
5913  "static %select{function|variable}0 %1 is used in an inline function with "
5914  "external linkage">, InGroup<StaticInInline>;
5915def ext_internal_in_extern_inline_quiet : Extension<
5916  "static %select{function|variable}0 %1 is used in an inline function with "
5917  "external linkage">, InGroup<StaticInInline>;
5918def warn_static_local_in_extern_inline : Warning<
5919  "non-constant static local variable in inline function may be different "
5920  "in different files">, InGroup<StaticLocalInInline>;
5921def note_convert_inline_to_static : Note<
5922  "use 'static' to give inline function %0 internal linkage">;
5923
5924def ext_redefinition_of_typedef : ExtWarn<
5925  "redefinition of typedef %0 is a C11 feature">,
5926  InGroup<DiagGroup<"typedef-redefinition"> >;
5927def err_redefinition_variably_modified_typedef : Error<
5928  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5929
5930def err_inline_decl_follows_def : Error<
5931  "inline declaration of %0 follows non-inline definition">;
5932def err_inline_declaration_block_scope : Error<
5933  "inline declaration of %0 not allowed in block scope">;
5934def err_static_non_static : Error<
5935  "static declaration of %0 follows non-static declaration">;
5936def err_different_language_linkage : Error<
5937  "declaration of %0 has a different language linkage">;
5938def ext_retained_language_linkage : Extension<
5939  "friend function %0 retaining previous language linkage is an extension">,
5940  InGroup<DiagGroup<"retained-language-linkage">>;
5941def err_extern_c_global_conflict : Error<
5942  "declaration of %1 %select{with C language linkage|in global scope}0 "
5943  "conflicts with declaration %select{in global scope|with C language linkage}0">;
5944def note_extern_c_global_conflict : Note<
5945  "declared %select{in global scope|with C language linkage}0 here">;
5946def note_extern_c_begins_here : Note<
5947  "extern \"C\" language linkage specification begins here">;
5948def warn_weak_import : Warning <
5949  "an already-declared variable is made a weak_import declaration %0">;
5950def ext_static_non_static : Extension<
5951  "redeclaring non-static %0 as static is a Microsoft extension">,
5952  InGroup<MicrosoftRedeclareStatic>;
5953def err_non_static_static : Error<
5954  "non-static declaration of %0 follows static declaration">;
5955def err_extern_non_extern : Error<
5956  "extern declaration of %0 follows non-extern declaration">;
5957def err_non_extern_extern : Error<
5958  "non-extern declaration of %0 follows extern declaration">;
5959def err_non_thread_thread : Error<
5960  "non-thread-local declaration of %0 follows thread-local declaration">;
5961def err_thread_non_thread : Error<
5962  "thread-local declaration of %0 follows non-thread-local declaration">;
5963def err_thread_thread_different_kind : Error<
5964  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5965  "follows declaration with %select{dynamic|static}1 initialization">;
5966def err_mismatched_owning_module : Error<
5967  "declaration of %0 in %select{the global module|module %2}1 follows "
5968  "declaration in %select{the global module|module %4}3">;
5969def err_redefinition_different_type : Error<
5970  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5971def err_redefinition_different_kind : Error<
5972  "redefinition of %0 as different kind of symbol">;
5973def err_redefinition_different_namespace_alias : Error<
5974  "redefinition of %0 as an alias for a different namespace">;
5975def note_previous_namespace_alias : Note<
5976  "previously defined as an alias for %0">;
5977def warn_forward_class_redefinition : Warning<
5978  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5979  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5980def err_redefinition_different_typedef : Error<
5981  "%select{typedef|type alias|type alias template}0 "
5982  "redefinition with different types%diff{ ($ vs $)|}1,2">;
5983def err_redefinition_different_concept : Error<
5984  "redefinition of concept %0 with different template parameters or requirements">;
5985def err_tag_reference_non_tag : Error<
5986  "%select{non-struct type|non-class type|non-union type|non-enum "
5987  "type|typedef|type alias|template|type alias template|template "
5988  "template argument}1 %0 cannot be referenced with a "
5989  "%select{struct|interface|union|class|enum}2 specifier">;
5990def err_tag_reference_conflict : Error<
5991  "implicit declaration introduced by elaborated type conflicts with a "
5992  "%select{non-struct type|non-class type|non-union type|non-enum "
5993  "type|typedef|type alias|template|type alias template|template "
5994  "template argument}0 of the same name">;
5995def err_dependent_tag_decl : Error<
5996  "%select{declaration|definition}0 of "
5997  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5998def err_tag_definition_of_typedef : Error<
5999  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
6000def err_conflicting_types : Error<"conflicting types for %0">;
6001def err_different_pass_object_size_params : Error<
6002  "conflicting pass_object_size attributes on parameters">;
6003def err_late_asm_label_name : Error<
6004  "cannot apply asm label to %select{variable|function}0 after its first use">;
6005def err_different_asm_label : Error<"conflicting asm label">;
6006def err_nested_redefinition : Error<"nested redefinition of %0">;
6007def err_use_with_wrong_tag : Error<
6008  "use of %0 with tag type that does not match previous declaration">;
6009def warn_struct_class_tag_mismatch : Warning<
6010  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
6011  "declared as a %select{struct|interface|class}3%select{| template}1; "
6012  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
6013  InGroup<MismatchedTags>, DefaultIgnore;
6014def warn_struct_class_previous_tag_mismatch : Warning<
6015  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
6016  "here but previously declared as "
6017  "%select{a struct|an interface|a class}3%select{| template}1; "
6018  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
6019  InGroup<MismatchedTags>, DefaultIgnore;
6020def note_struct_class_suggestion : Note<
6021  "did you mean %select{struct|interface|class}0 here?">;
6022def ext_forward_ref_enum : Extension<
6023  "ISO C forbids forward references to 'enum' types">;
6024def err_forward_ref_enum : Error<
6025  "ISO C++ forbids forward references to 'enum' types">;
6026def ext_ms_forward_ref_enum : ExtWarn<
6027  "forward references to 'enum' types are a Microsoft extension">,
6028  InGroup<MicrosoftEnumForwardReference>;
6029def ext_forward_ref_enum_def : Extension<
6030  "redeclaration of already-defined enum %0 is a GNU extension">,
6031  InGroup<GNURedeclaredEnum>;
6032
6033def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
6034def err_duplicate_member : Error<"duplicate member %0">;
6035def err_misplaced_ivar : Error<
6036  "instance variables may not be placed in %select{categories|class extension}0">;
6037def warn_ivars_in_interface : Warning<
6038  "declaration of instance variables in the interface is deprecated">,
6039  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
6040def ext_enum_value_not_int : Extension<
6041  "ISO C restricts enumerator values to range of 'int' (%0 is too "
6042  "%select{small|large}1)">;
6043def ext_enum_too_large : ExtWarn<
6044  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
6045def ext_enumerator_increment_too_large : ExtWarn<
6046  "incremented enumerator value %0 is not representable in the "
6047  "largest integer type">, InGroup<EnumTooLarge>;
6048def warn_flag_enum_constant_out_of_range : Warning<
6049  "enumeration value %0 is out of range of flags in enumeration type %1">,
6050  InGroup<FlagEnum>;
6051
6052def err_vm_decl_in_file_scope : Error<
6053  "variably modified type declaration not allowed at file scope">;
6054def err_vm_decl_has_extern_linkage : Error<
6055  "variably modified type declaration cannot have 'extern' linkage">;
6056def err_typecheck_field_variable_size : Error<
6057  "fields must have a constant size: 'variable length array in structure' "
6058  "extension will never be supported">;
6059def err_vm_func_decl : Error<
6060  "function declaration cannot have variably modified type">;
6061def err_array_too_large : Error<
6062  "array is too large (%0 elements)">;
6063
6064def err_typecheck_negative_array_size : Error<"array size is negative">;
6065def warn_typecheck_function_qualifiers_ignored : Warning<
6066  "'%0' qualifier on function type %1 has no effect">,
6067  InGroup<IgnoredQualifiers>;
6068def warn_typecheck_function_qualifiers_unspecified : Warning<
6069  "'%0' qualifier on function type %1 has unspecified behavior">;
6070def warn_typecheck_reference_qualifiers : Warning<
6071  "'%0' qualifier on reference type %1 has no effect">,
6072  InGroup<IgnoredReferenceQualifiers>;
6073def err_typecheck_invalid_restrict_not_pointer : Error<
6074  "restrict requires a pointer or reference (%0 is invalid)">;
6075def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
6076  "restrict requires a pointer or reference">;
6077def err_typecheck_invalid_restrict_invalid_pointee : Error<
6078  "pointer to function type %0 may not be 'restrict' qualified">;
6079def ext_typecheck_zero_array_size : Extension<
6080  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
6081def err_typecheck_zero_array_size : Error<
6082  "zero-length arrays are not permitted in %select{C++|SYCL device code}0">;
6083def err_array_size_non_int : Error<"size of array has non-integer type %0">;
6084def err_init_element_not_constant : Error<
6085  "initializer element is not a compile-time constant">;
6086def ext_aggregate_init_not_constant : Extension<
6087  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
6088def err_local_cant_init : Error<
6089  "'__local' variable cannot have an initializer">;
6090def err_loader_uninitialized_cant_init
6091    : Error<"variable with 'loader_uninitialized' attribute cannot have an "
6092            "initializer">;
6093def err_loader_uninitialized_trivial_ctor
6094    : Error<"variable with 'loader_uninitialized' attribute must have a "
6095            "trivial default constructor">;
6096def err_loader_uninitialized_redeclaration
6097    : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
6098def err_loader_uninitialized_extern_decl
6099    : Error<"variable %0 cannot be declared both 'extern' and with the "
6100            "'loader_uninitialized' attribute">;
6101def err_block_extern_cant_init : Error<
6102  "declaration of block scope identifier with linkage cannot have an initializer">;
6103def warn_extern_init : Warning<"'extern' variable has an initializer">,
6104  InGroup<DiagGroup<"extern-initializer">>;
6105def err_variable_object_no_init : Error<
6106  "variable-sized object may not be initialized">;
6107def err_excess_initializers : Error<
6108  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
6109def ext_excess_initializers : ExtWarn<
6110  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
6111  InGroup<ExcessInitializers>;
6112def err_excess_initializers_for_sizeless_type : Error<
6113  "excess elements in initializer for indivisible sizeless type %0">;
6114def ext_excess_initializers_for_sizeless_type : ExtWarn<
6115  "excess elements in initializer for indivisible sizeless type %0">,
6116  InGroup<ExcessInitializers>;
6117def err_excess_initializers_in_char_array_initializer : Error<
6118  "excess elements in char array initializer">;
6119def ext_excess_initializers_in_char_array_initializer : ExtWarn<
6120  "excess elements in char array initializer">,
6121  InGroup<ExcessInitializers>;
6122def err_initializer_string_for_char_array_too_long : Error<
6123  "initializer-string for char array is too long, array size is %0 but initializer has size %1 (including the null terminating character)">;
6124def ext_initializer_string_for_char_array_too_long : ExtWarn<
6125  "initializer-string for char array is too long">,
6126  InGroup<ExcessInitializers>;
6127def warn_missing_field_initializers : Warning<
6128  "missing field %0 initializer">,
6129  InGroup<MissingFieldInitializers>, DefaultIgnore;
6130def warn_braces_around_init : Warning<
6131  "braces around %select{scalar |}0initializer">,
6132  InGroup<DiagGroup<"braced-scalar-init">>;
6133def ext_many_braces_around_init : ExtWarn<
6134  "too many braces around %select{scalar |}0initializer">,
6135  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
6136def ext_complex_component_init : Extension<
6137  "complex initialization specifying real and imaginary components "
6138  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
6139def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
6140def err_empty_sizeless_initializer : Error<
6141  "initializer for sizeless type %0 cannot be empty">;
6142def warn_cxx98_compat_empty_scalar_initializer : Warning<
6143  "scalar initialized from empty initializer list is incompatible with C++98">,
6144  InGroup<CXX98Compat>, DefaultIgnore;
6145def warn_cxx98_compat_empty_sizeless_initializer : Warning<
6146  "initializing %0 from an empty initializer list is incompatible with C++98">,
6147  InGroup<CXX98Compat>, DefaultIgnore;
6148def warn_cxx98_compat_reference_list_init : Warning<
6149  "reference initialized from initializer list is incompatible with C++98">,
6150  InGroup<CXX98Compat>, DefaultIgnore;
6151def warn_cxx98_compat_initializer_list_init : Warning<
6152  "initialization of initializer_list object is incompatible with C++98">,
6153  InGroup<CXX98Compat>, DefaultIgnore;
6154def warn_cxx98_compat_ctor_list_init : Warning<
6155  "constructor call from initializer list is incompatible with C++98">,
6156  InGroup<CXX98Compat>, DefaultIgnore;
6157def err_illegal_initializer : Error<
6158  "illegal initializer (only variables can be initialized)">;
6159def err_illegal_initializer_type : Error<"illegal initializer type %0">;
6160def ext_init_list_type_narrowing : ExtWarn<
6161  "type %0 cannot be narrowed to %1 in initializer list">,
6162  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6163def ext_init_list_type_narrowing_const_reference : ExtWarn<
6164  ext_init_list_type_narrowing.Summary>,
6165  InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6166def ext_init_list_variable_narrowing : ExtWarn<
6167  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6168  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6169def ext_init_list_variable_narrowing_const_reference : ExtWarn<
6170  ext_init_list_variable_narrowing.Summary>, InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6171def ext_init_list_constant_narrowing : ExtWarn<
6172  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
6173  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6174def ext_init_list_constant_narrowing_const_reference : ExtWarn<
6175  ext_init_list_constant_narrowing.Summary>,
6176  InGroup<CXX11NarrowingConstReference>, DefaultError, SFINAEFailure;
6177def warn_init_list_type_narrowing : Warning<
6178  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
6179  InGroup<CXX11Narrowing>, DefaultIgnore;
6180def warn_init_list_variable_narrowing : Warning<
6181  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6182  "initializer list in C++11">,
6183  InGroup<CXX11Narrowing>, DefaultIgnore;
6184def warn_init_list_constant_narrowing : Warning<
6185  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
6186  "C++11">,
6187  InGroup<CXX11Narrowing>, DefaultIgnore;
6188def note_init_list_narrowing_silence : Note<
6189  "insert an explicit cast to silence this issue">;
6190def err_init_objc_class : Error<
6191  "cannot initialize Objective-C class type %0">;
6192def err_implicit_empty_initializer : Error<
6193  "initializer for aggregate with no elements requires explicit braces">;
6194def err_bitfield_has_negative_width : Error<
6195  "bit-field %0 has negative width (%1)">;
6196def err_anon_bitfield_has_negative_width : Error<
6197  "anonymous bit-field has negative width (%0)">;
6198def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
6199def err_bitfield_width_exceeds_type_width : Error<
6200  "width of%select{ anonymous|}0 bit-field%select{| %1}0 (%2 bits) exceeds the "
6201  "%select{width|size}3 of its type (%4 bit%s4)">;
6202def err_incorrect_number_of_vector_initializers : Error<
6203  "number of elements must be either one or match the size of the vector">;
6204
6205// Used by C++ which allows bit-fields that are wider than the type.
6206def warn_bitfield_width_exceeds_type_width: Warning<
6207  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
6208  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
6209def err_bitfield_too_wide : Error<
6210  "%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
6211def warn_bitfield_too_small_for_enum : Warning<
6212  "bit-field %0 is not wide enough to store all enumerators of %1">,
6213  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6214def note_widen_bitfield : Note<
6215  "widen this field to %0 bits to store all values of %1">;
6216def warn_unsigned_bitfield_assigned_signed_enum : Warning<
6217  "assigning value of signed enum type %1 to unsigned bit-field %0; "
6218  "negative enumerators of enum %1 will be converted to positive values">,
6219  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6220def warn_signed_bitfield_enum_conversion : Warning<
6221  "signed bit-field %0 needs an extra bit to represent the largest positive "
6222  "enumerators of %1">,
6223  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6224def note_change_bitfield_sign : Note<
6225  "consider making the bitfield type %select{unsigned|signed}0">;
6226
6227def warn_missing_braces : Warning<
6228  "suggest braces around initialization of subobject">,
6229  InGroup<MissingBraces>, DefaultIgnore;
6230
6231def err_redefinition_of_label : Error<"redefinition of label %0">;
6232def err_undeclared_label_use : Error<"use of undeclared label %0">;
6233def err_goto_ms_asm_label : Error<
6234  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
6235def note_goto_ms_asm_label : Note<
6236  "inline assembly label %0 declared here">;
6237def warn_unused_label : Warning<"unused label %0">,
6238  InGroup<UnusedLabel>, DefaultIgnore;
6239
6240def err_continue_from_cond_var_init : Error<
6241  "cannot jump from this continue statement to the loop increment; "
6242  "jump bypasses initialization of loop condition variable">;
6243def err_goto_into_protected_scope : Error<
6244  "cannot jump from this goto statement to its label">;
6245def ext_goto_into_protected_scope : ExtWarn<
6246  "jump from this goto statement to its label is a Microsoft extension">,
6247  InGroup<MicrosoftGoto>;
6248def warn_cxx98_compat_goto_into_protected_scope : Warning<
6249  "jump from this goto statement to its label is incompatible with C++98">,
6250  InGroup<CXX98Compat>, DefaultIgnore;
6251def err_switch_into_protected_scope : Error<
6252  "cannot jump from switch statement to this case label">;
6253def warn_cxx98_compat_switch_into_protected_scope : Warning<
6254  "jump from switch statement to this case label is incompatible with C++98">,
6255  InGroup<CXX98Compat>, DefaultIgnore;
6256def err_indirect_goto_without_addrlabel : Error<
6257  "indirect goto in function with no address-of-label expressions">;
6258def err_indirect_goto_in_protected_scope : Error<
6259  "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
6260def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
6261  "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
6262  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6263def note_indirect_goto_target : Note<
6264  "possible target of %select{indirect|asm}0 goto statement">;
6265def note_protected_by_variable_init : Note<
6266  "jump bypasses variable initialization">;
6267def note_protected_by_variable_nontriv_destructor : Note<
6268  "jump bypasses variable with a non-trivial destructor">;
6269def note_protected_by_variable_non_pod : Note<
6270  "jump bypasses initialization of non-POD variable">;
6271def note_protected_by_cleanup : Note<
6272  "jump bypasses initialization of variable with __attribute__((cleanup))">;
6273def note_protected_by_vla_typedef : Note<
6274  "jump bypasses initialization of VLA typedef">;
6275def note_protected_by_vla_type_alias : Note<
6276  "jump bypasses initialization of VLA type alias">;
6277def note_protected_by_constexpr_if : Note<
6278  "jump enters controlled statement of constexpr if">;
6279def note_protected_by_consteval_if : Note<
6280  "jump enters controlled statement of consteval if">;
6281def note_protected_by_if_available : Note<
6282  "jump enters controlled statement of if available">;
6283def note_protected_by_vla : Note<
6284  "jump bypasses initialization of variable length array">;
6285def note_protected_by_objc_fast_enumeration : Note<
6286  "jump enters Objective-C fast enumeration loop">;
6287def note_protected_by_objc_try : Note<
6288  "jump bypasses initialization of @try block">;
6289def note_protected_by_objc_catch : Note<
6290  "jump bypasses initialization of @catch block">;
6291def note_protected_by_objc_finally : Note<
6292  "jump bypasses initialization of @finally block">;
6293def note_protected_by_objc_synchronized : Note<
6294  "jump bypasses initialization of @synchronized block">;
6295def note_protected_by_objc_autoreleasepool : Note<
6296  "jump bypasses auto release push of @autoreleasepool block">;
6297def note_protected_by_cxx_try : Note<
6298  "jump bypasses initialization of try block">;
6299def note_protected_by_cxx_catch : Note<
6300  "jump bypasses initialization of catch block">;
6301def note_protected_by_seh_try : Note<
6302  "jump bypasses initialization of __try block">;
6303def note_protected_by_seh_except : Note<
6304  "jump bypasses initialization of __except block">;
6305def note_protected_by_seh_finally : Note<
6306  "jump bypasses initialization of __finally block">;
6307def note_protected_by___block : Note<
6308  "jump bypasses setup of __block variable">;
6309def note_protected_by_objc_strong_init : Note<
6310  "jump bypasses initialization of __strong variable">;
6311def note_protected_by_objc_weak_init : Note<
6312  "jump bypasses initialization of __weak variable">;
6313def note_protected_by_non_trivial_c_struct_init : Note<
6314  "jump bypasses initialization of variable of non-trivial C struct type">;
6315def note_enters_block_captures_cxx_obj : Note<
6316  "jump enters lifetime of block which captures a destructible C++ object">;
6317def note_enters_block_captures_strong : Note<
6318  "jump enters lifetime of block which strongly captures a variable">;
6319def note_enters_block_captures_weak : Note<
6320  "jump enters lifetime of block which weakly captures a variable">;
6321def note_enters_block_captures_non_trivial_c_struct : Note<
6322  "jump enters lifetime of block which captures a C struct that is non-trivial "
6323  "to destroy">;
6324def note_enters_compound_literal_scope : Note<
6325  "jump enters lifetime of a compound literal that is non-trivial to destruct">;
6326def note_enters_statement_expression : Note<
6327  "jump enters a statement expression">;
6328
6329def note_exits_cleanup : Note<
6330  "jump exits scope of variable with __attribute__((cleanup))">;
6331def note_exits_dtor : Note<
6332  "jump exits scope of variable with non-trivial destructor">;
6333def note_exits_temporary_dtor : Note<
6334  "jump exits scope of lifetime-extended temporary with non-trivial "
6335  "destructor">;
6336def note_exits___block : Note<
6337  "jump exits scope of __block variable">;
6338def note_exits_objc_try : Note<
6339  "jump exits @try block">;
6340def note_exits_objc_catch : Note<
6341  "jump exits @catch block">;
6342def note_exits_objc_finally : Note<
6343  "jump exits @finally block">;
6344def note_exits_objc_synchronized : Note<
6345  "jump exits @synchronized block">;
6346def note_exits_cxx_try : Note<
6347  "jump exits try block">;
6348def note_exits_cxx_catch : Note<
6349  "jump exits catch block">;
6350def note_exits_seh_try : Note<
6351  "jump exits __try block">;
6352def note_exits_seh_except : Note<
6353  "jump exits __except block">;
6354def note_exits_seh_finally : Note<
6355  "jump exits __finally block">;
6356def note_exits_objc_autoreleasepool : Note<
6357  "jump exits autoreleasepool block">;
6358def note_exits_objc_strong : Note<
6359  "jump exits scope of __strong variable">;
6360def note_exits_objc_weak : Note<
6361  "jump exits scope of __weak variable">;
6362def note_exits_block_captures_cxx_obj : Note<
6363  "jump exits lifetime of block which captures a destructible C++ object">;
6364def note_exits_block_captures_strong : Note<
6365  "jump exits lifetime of block which strongly captures a variable">;
6366def note_exits_block_captures_weak : Note<
6367  "jump exits lifetime of block which weakly captures a variable">;
6368def note_exits_block_captures_non_trivial_c_struct : Note<
6369  "jump exits lifetime of block which captures a C struct that is non-trivial "
6370  "to destroy">;
6371def note_exits_compound_literal_scope : Note<
6372  "jump exits lifetime of a compound literal that is non-trivial to destruct">;
6373
6374def err_func_returning_qualified_void : ExtWarn<
6375  "function cannot return qualified void type %0">,
6376  InGroup<DiagGroup<"qualified-void-return-type">>;
6377def err_func_returning_array_function : Error<
6378  "function cannot return %select{array|function}0 type %1">;
6379def err_field_declared_as_function : Error<"field %0 declared as a function">;
6380def err_field_incomplete_or_sizeless : Error<
6381  "field has %select{incomplete|sizeless}0 type %1">;
6382def ext_variable_sized_type_in_struct : ExtWarn<
6383  "field %0 with variable sized type %1 not at the end of a struct or class is"
6384  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
6385
6386def ext_c99_flexible_array_member : Extension<
6387  "flexible array members are a C99 feature">, InGroup<C99>;
6388def err_flexible_array_virtual_base : Error<
6389  "flexible array member %0 not allowed in "
6390  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
6391def err_flexible_array_empty_aggregate : Error<
6392  "flexible array member %0 not allowed in otherwise empty "
6393  "%select{struct|interface|union|class|enum}1">;
6394def err_flexible_array_has_nontrivial_dtor : Error<
6395  "flexible array member %0 of type %1 with non-trivial destruction">;
6396def ext_flexible_array_in_struct : Extension<
6397  "%0 may not be nested in a struct due to flexible array member">,
6398  InGroup<FlexibleArrayExtensions>;
6399def ext_flexible_array_in_array : Extension<
6400  "%0 may not be used as an array element due to flexible array member">,
6401  InGroup<FlexibleArrayExtensions>;
6402def err_flexible_array_init : Error<
6403  "initialization of flexible array member is not allowed">;
6404def ext_flexible_array_empty_aggregate_ms : Extension<
6405  "flexible array member %0 in otherwise empty "
6406  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
6407  InGroup<MicrosoftFlexibleArray>;
6408def err_flexible_array_union : Error<
6409  "flexible array member %0 in a union is not allowed">;
6410def ext_flexible_array_union_ms : Extension<
6411  "flexible array member %0 in a union is a Microsoft extension">,
6412  InGroup<MicrosoftFlexibleArray>;
6413def ext_flexible_array_empty_aggregate_gnu : Extension<
6414  "flexible array member %0 in otherwise empty "
6415  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
6416  InGroup<GNUEmptyStruct>;
6417def ext_flexible_array_union_gnu : Extension<
6418  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
6419
6420def err_flexible_array_not_at_end : Error<
6421  "flexible array member %0 with type %1 is not at the end of"
6422  " %select{struct|interface|union|class|enum}2">;
6423def err_objc_variable_sized_type_not_at_end : Error<
6424  "field %0 with variable sized type %1 is not at the end of class">;
6425def note_next_field_declaration : Note<
6426  "next field declaration is here">;
6427def note_next_ivar_declaration : Note<
6428  "next %select{instance variable declaration|synthesized instance variable}0"
6429  " is here">;
6430def err_synthesize_variable_sized_ivar : Error<
6431  "synthesized property with variable size type %0"
6432  " requires an existing instance variable">;
6433def err_flexible_array_arc_retainable : Error<
6434  "ARC forbids flexible array members with retainable object type">;
6435def warn_variable_sized_ivar_visibility : Warning<
6436  "field %0 with variable sized type %1 is not visible to subclasses and"
6437  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
6438def warn_superclass_variable_sized_type_not_at_end : Warning<
6439  "field %0 can overwrite instance variable %1 with variable sized type %2"
6440  " in superclass %3">, InGroup<ObjCFlexibleArray>;
6441
6442let CategoryName = "ARC Semantic Issue" in {
6443
6444// ARC-mode diagnostics.
6445
6446let CategoryName = "ARC Weak References" in {
6447
6448def err_arc_weak_no_runtime : Error<
6449  "cannot create __weak reference because the current deployment target "
6450  "does not support weak references">;
6451def err_arc_weak_disabled : Error<
6452  "cannot create __weak reference in file using manual reference counting">;
6453def err_synthesizing_arc_weak_property_disabled : Error<
6454  "cannot synthesize weak property in file using manual reference counting">;
6455def err_synthesizing_arc_weak_property_no_runtime : Error<
6456  "cannot synthesize weak property because the current deployment target "
6457  "does not support weak references">;
6458def err_arc_unsupported_weak_class : Error<
6459  "class is incompatible with __weak references">;
6460def err_arc_weak_unavailable_assign : Error<
6461  "assignment of a weak-unavailable object to a __weak object">;
6462def err_arc_weak_unavailable_property : Error<
6463  "synthesizing __weak instance variable of type %0, which does not "
6464  "support weak references">;
6465def note_implemented_by_class : Note<
6466  "when implemented by class %0">;
6467def err_arc_convesion_of_weak_unavailable : Error<
6468  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
6469  " a __weak object of type %2">;
6470
6471} // end "ARC Weak References" category
6472
6473let CategoryName = "ARC Restrictions" in {
6474
6475def err_unavailable_in_arc : Error<
6476  "%0 is unavailable in ARC">;
6477def note_arc_forbidden_type : Note<
6478  "declaration uses type that is ill-formed in ARC">;
6479def note_performs_forbidden_arc_conversion : Note<
6480  "inline function performs a conversion which is forbidden in ARC">;
6481def note_arc_init_returns_unrelated : Note<
6482  "init method must return a type related to its receiver type">;
6483def note_arc_weak_disabled : Note<
6484  "declaration uses __weak, but ARC is disabled">;
6485def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
6486  "the current deployment target does not support">;
6487def note_arc_field_with_ownership : Note<
6488  "field has non-trivial ownership qualification">;
6489
6490def err_arc_illegal_explicit_message : Error<
6491  "ARC forbids explicit message send of %0">;
6492def err_arc_unused_init_message : Error<
6493  "the result of a delegate init call must be immediately returned "
6494  "or assigned to 'self'">;
6495def err_arc_mismatched_cast : Error<
6496  "%select{implicit conversion|cast}0 of "
6497  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
6498  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
6499  " to %3 is disallowed with ARC">;
6500def err_arc_nolifetime_behavior : Error<
6501  "explicit ownership qualifier on cast result has no effect">;
6502def err_arc_objc_property_default_assign_on_object : Error<
6503  "ARC forbids synthesizing a property of an Objective-C object "
6504  "with unspecified ownership or storage attribute">;
6505def err_arc_illegal_selector : Error<
6506  "ARC forbids use of %0 in a @selector">;
6507def err_arc_illegal_method_def : Error<
6508  "ARC forbids %select{implementation|synthesis}0 of %1">;
6509def warn_arc_strong_pointer_objc_pointer : Warning<
6510  "method parameter of type %0 with no explicit ownership">,
6511  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
6512
6513} // end "ARC Restrictions" category
6514
6515def err_arc_lost_method_convention : Error<
6516  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
6517  "method, but its implementation doesn't match because %select{"
6518  "its result type is not an object pointer|"
6519  "its result type is unrelated to its receiver type}1">;
6520def note_arc_lost_method_convention : Note<"declaration in interface">;
6521def err_arc_gained_method_convention : Error<
6522  "method implementation does not match its declaration">;
6523def note_arc_gained_method_convention : Note<
6524  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
6525  "family because %select{its result type is not an object pointer|"
6526  "its result type is unrelated to its receiver type}1">;
6527def err_typecheck_arc_assign_self : Error<
6528  "cannot assign to 'self' outside of a method in the init family">;
6529def err_typecheck_arc_assign_self_class_method : Error<
6530  "cannot assign to 'self' in a class method">;
6531def err_typecheck_arr_assign_enumeration : Error<
6532  "fast enumeration variables cannot be modified in ARC by default; "
6533  "declare the variable __strong to allow this">;
6534def err_typecheck_arc_assign_externally_retained : Error<
6535  "variable declared with 'objc_externally_retained' "
6536  "cannot be modified in ARC">;
6537def warn_arc_retained_assign : Warning<
6538  "assigning retained object to %select{weak|unsafe_unretained}0 "
6539  "%select{property|variable}1"
6540  "; object will be released after assignment">,
6541  InGroup<ARCUnsafeRetainedAssign>;
6542def warn_arc_retained_property_assign : Warning<
6543  "assigning retained object to unsafe property"
6544  "; object will be released after assignment">,
6545  InGroup<ARCUnsafeRetainedAssign>;
6546def warn_arc_literal_assign : Warning<
6547  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
6548  " to a weak %select{property|variable}1"
6549  "; object will be released after assignment">,
6550  InGroup<ARCUnsafeRetainedAssign>;
6551def err_arc_new_array_without_ownership : Error<
6552  "'new' cannot allocate an array of %0 with no explicit ownership">;
6553def err_arc_autoreleasing_var : Error<
6554  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
6555  "__autoreleasing ownership">;
6556def err_arc_autoreleasing_capture : Error<
6557  "cannot capture __autoreleasing variable in a "
6558  "%select{block|lambda by copy}0">;
6559def err_arc_thread_ownership : Error<
6560  "thread-local variable has non-trivial ownership: type is %0">;
6561def err_arc_indirect_no_ownership : Error<
6562  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6563def err_arc_array_param_no_ownership : Error<
6564  "must explicitly describe intended ownership of an object array parameter">;
6565def err_arc_pseudo_dtor_inconstant_quals : Error<
6566  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6567  "type %1">;
6568def err_arc_init_method_unrelated_result_type : Error<
6569  "init methods must return a type related to the receiver type">;
6570def err_arc_nonlocal_writeback : Error<
6571  "passing address of %select{non-local|non-scalar}0 object to "
6572  "__autoreleasing parameter for write-back">;
6573def err_arc_method_not_found : Error<
6574  "no known %select{instance|class}1 method for selector %0">;
6575def err_arc_receiver_forward_class : Error<
6576  "receiver %0 for class message is a forward declaration">;
6577def err_arc_may_not_respond : Error<
6578  "no visible @interface for %0 declares the selector %1">;
6579def err_arc_receiver_forward_instance : Error<
6580  "receiver type %0 for instance message is a forward declaration">;
6581def warn_receiver_forward_instance : Warning<
6582  "receiver type %0 for instance message is a forward declaration">,
6583  InGroup<ForwardClassReceiver>, DefaultIgnore;
6584def err_arc_collection_forward : Error<
6585  "collection expression type %0 is a forward declaration">;
6586def err_arc_multiple_method_decl : Error<
6587  "multiple methods named %0 found with mismatched result, "
6588  "parameter type or attributes">;
6589def warn_arc_lifetime_result_type : Warning<
6590  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6591  "lifetime qualifier on return type is ignored">,
6592  InGroup<IgnoredQualifiers>;
6593
6594let CategoryName = "ARC Retain Cycle" in {
6595
6596def warn_arc_retain_cycle : Warning<
6597  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6598  InGroup<ARCRetainCycles>;
6599def note_arc_retain_cycle_owner : Note<
6600  "block will be retained by %select{the captured object|an object strongly "
6601  "retained by the captured object}0">;
6602
6603} // end "ARC Retain Cycle" category
6604
6605def warn_arc_object_memaccess : Warning<
6606  "%select{destination for|source of}0 this %1 call is a pointer to "
6607  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6608
6609let CategoryName = "ARC and @properties" in {
6610
6611def err_arc_strong_property_ownership : Error<
6612  "existing instance variable %1 for strong property %0 may not be "
6613  "%select{|__unsafe_unretained||__weak}2">;
6614def err_arc_assign_property_ownership : Error<
6615  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6616  "attribute must be __unsafe_unretained">;
6617def err_arc_inconsistent_property_ownership : Error<
6618  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6619  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6620
6621} // end "ARC and @properties" category
6622
6623def warn_block_capture_autoreleasing : Warning<
6624  "block captures an autoreleasing out-parameter, which may result in "
6625  "use-after-free bugs">,
6626  InGroup<BlockCaptureAutoReleasing>;
6627def note_declare_parameter_strong : Note<
6628  "declare the parameter __strong or capture a __block __strong variable to "
6629  "keep values alive across autorelease pools">;
6630
6631def err_arc_atomic_ownership : Error<
6632  "cannot perform atomic operation on a pointer to type %0: type has "
6633  "non-trivial ownership">;
6634
6635let CategoryName = "ARC Casting Rules" in {
6636
6637def err_arc_bridge_cast_incompatible : Error<
6638  "incompatible types casting %0 to %1 with a %select{__bridge|"
6639  "__bridge_transfer|__bridge_retained}2 cast">;
6640def err_arc_bridge_cast_wrong_kind : Error<
6641  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6642  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6643  "__bridge_transfer|__bridge_retained}4">;
6644def err_arc_cast_requires_bridge : Error<
6645  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6646  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6647  "requires a bridged cast">;
6648def note_arc_bridge : Note<
6649  "use __bridge to convert directly (no change in ownership)">;
6650def note_arc_cstyle_bridge : Note<
6651  "use __bridge with C-style cast to convert directly (no change in ownership)">;
6652def note_arc_bridge_transfer : Note<
6653  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6654  "ownership of a +1 %0 into ARC">;
6655def note_arc_cstyle_bridge_transfer : Note<
6656  "use __bridge_transfer with C-style cast to transfer "
6657  "ownership of a +1 %0 into ARC">;
6658def note_arc_bridge_retained : Note<
6659  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6660  "ARC object available as a +1 %0">;
6661def note_arc_cstyle_bridge_retained : Note<
6662  "use __bridge_retained with C-style cast to make an "
6663  "ARC object available as a +1 %0">;
6664
6665} // ARC Casting category
6666
6667} // ARC category name
6668
6669def err_flexible_array_init_needs_braces : Error<
6670  "flexible array requires brace-enclosed initializer">;
6671def err_illegal_decl_array_of_functions : Error<
6672  "'%0' declared as array of functions of type %1">;
6673def err_array_incomplete_or_sizeless_type : Error<
6674  "array has %select{incomplete|sizeless}0 element type %1">;
6675def err_illegal_message_expr_incomplete_type : Error<
6676  "Objective-C message has incomplete result type %0">;
6677def err_illegal_decl_array_of_references : Error<
6678  "'%0' declared as array of references of type %1">;
6679def err_decl_negative_array_size : Error<
6680  "'%0' declared as an array with a negative size">;
6681def err_array_static_outside_prototype : Error<
6682  "%0 used in array declarator outside of function prototype">;
6683def err_array_static_not_outermost : Error<
6684  "%0 used in non-outermost array type derivation">;
6685def err_array_star_outside_prototype : Error<
6686  "star modifier used outside of function prototype">;
6687def err_illegal_decl_pointer_to_reference : Error<
6688  "'%0' declared as a pointer to a reference of type %1">;
6689def err_illegal_decl_mempointer_to_reference : Error<
6690  "'%0' declared as a member pointer to a reference of type %1">;
6691def err_illegal_decl_mempointer_to_void : Error<
6692  "'%0' declared as a member pointer to void">;
6693def err_illegal_decl_mempointer_in_nonclass : Error<
6694  "'%0' does not point into a class">;
6695def err_mempointer_in_nonclass_type : Error<
6696  "member pointer refers into non-class type %0">;
6697def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6698def err_nonfunction_block_type : Error<
6699  "block pointer to non-function type is invalid">;
6700def err_return_block_has_expr : Error<"void block should not return a value">;
6701def err_block_return_missing_expr : Error<
6702  "non-void block should return a value">;
6703def err_func_def_incomplete_result : Error<
6704  "incomplete result type %0 in function definition">;
6705def err_atomic_specifier_bad_type
6706    : Error<"_Atomic cannot be applied to "
6707            "%select{incomplete |array |function |reference |atomic |qualified "
6708            "|sizeless ||integer |}0type "
6709            "%1 %select{|||||||which is not trivially copyable||in C23}0">;
6710def warn_atomic_member_access : Warning<
6711  "accessing a member of an atomic structure or union is undefined behavior">,
6712  InGroup<DiagGroup<"atomic-access">>, DefaultError;
6713
6714// Expressions.
6715def err_using_placeholder_variable : Error<
6716  "ambiguous reference to placeholder '_', which is defined multiple times">;
6717def note_reference_placeholder : Note<
6718  "placeholder declared here">;
6719def ext_placeholder_var_definition : ExtWarn<
6720  "placeholder variables are a C++2c extension">, InGroup<CXX26>;
6721def warn_cxx23_placeholder_var_definition : Warning<
6722  "placeholder variables are incompatible with C++ standards before C++2c">,
6723  DefaultIgnore, InGroup<CXXPre26Compat>;
6724
6725def ext_sizeof_alignof_function_type : Extension<
6726  "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6727def ext_sizeof_alignof_void_type : Extension<
6728  "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6729def err_opencl_sizeof_alignof_type : Error<
6730  "invalid application of '%0' to a void type">;
6731def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6732  "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6733def err_sizeof_alignof_function_type : Error<
6734  "invalid application of '%0' to a function type">;
6735def err_openmp_default_simd_align_expr : Error<
6736  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6737def err_sizeof_alignof_typeof_bitfield : Error<
6738  "invalid application of '%select{sizeof|alignof|typeof|typeof_unqual}0' to "
6739  "bit-field">;
6740def err_alignof_member_of_incomplete_type : Error<
6741  "invalid application of 'alignof' to a field of a class still being defined">;
6742def err_vecstep_non_scalar_vector_type : Error<
6743  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6744def err_offsetof_incomplete_type : Error<
6745  "offsetof of incomplete type %0">;
6746def err_offsetof_record_type : Error<
6747  "offsetof requires struct, union, or class type, %0 invalid">;
6748def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6749def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6750  InGroup<InvalidOffsetof>;
6751def ext_offsetof_non_standardlayout_type : ExtWarn<
6752  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6753def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6754def err_offsetof_field_of_virtual_base : Error<
6755  "invalid application of 'offsetof' to a field of a virtual base">;
6756def warn_sub_ptr_zero_size_types : Warning<
6757  "subtraction of pointers to type %0 of zero size has undefined behavior">,
6758  InGroup<PointerArith>;
6759def warn_pointer_arith_null_ptr : Warning<
6760  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6761  InGroup<NullPointerArithmetic>, DefaultIgnore;
6762def warn_gnu_null_ptr_arith : Extension<
6763  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6764  InGroup<GNUNullPointerArithmetic>;
6765def warn_pointer_sub_null_ptr : Warning<
6766  "performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior">,
6767  InGroup<NullPointerSubtraction>, DefaultIgnore;
6768
6769def warn_floatingpoint_eq : Warning<
6770  "comparing floating point with == or != is unsafe">,
6771  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6772
6773def err_setting_eval_method_used_in_unsafe_context : Error <
6774  "%select{'#pragma clang fp eval_method'|option 'ffp-eval-method'}0 cannot be used with "
6775  "%select{option 'fapprox-func'|option 'mreassociate'|option 'freciprocal'|option 'ffp-eval-method'|'#pragma clang fp reassociate'|'#pragma clang fp reciprocal'}1">;
6776
6777def warn_remainder_division_by_zero : Warning<
6778  "%select{remainder|division}0 by zero is undefined">,
6779  InGroup<DivZero>;
6780def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6781  InGroup<DiagGroup<"shift-negative-value">>;
6782def warn_shift_negative : Warning<"shift count is negative">,
6783  InGroup<DiagGroup<"shift-count-negative">>;
6784def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6785  InGroup<DiagGroup<"shift-count-overflow">>;
6786def warn_shift_result_gt_typewidth : Warning<
6787  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6788  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6789def warn_shift_result_sets_sign_bit : Warning<
6790  "signed shift result (%0) sets the sign bit of the shift expression's "
6791  "type (%1) and becomes negative">,
6792  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6793
6794def warn_precedence_bitwise_rel : Warning<
6795  "%0 has lower precedence than %1; %1 will be evaluated first">,
6796  InGroup<Parentheses>;
6797def note_precedence_bitwise_first : Note<
6798  "place parentheses around the %0 expression to evaluate it first">;
6799def note_precedence_silence : Note<
6800  "place parentheses around the '%0' expression to silence this warning">;
6801
6802def warn_precedence_conditional : Warning<
6803  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6804  InGroup<Parentheses>;
6805def warn_precedence_bitwise_conditional : Warning<
6806  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6807  InGroup<BitwiseConditionalParentheses>;
6808def note_precedence_conditional_first : Note<
6809  "place parentheses around the '?:' expression to evaluate it first">;
6810
6811def warn_enum_constant_in_bool_context : Warning<
6812  "converting the enum constant to a boolean">,
6813  InGroup<IntInBoolContext>, DefaultIgnore;
6814def warn_left_shift_in_bool_context : Warning<
6815  "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6816  InGroup<IntInBoolContext>, DefaultIgnore;
6817def warn_logical_instead_of_bitwise : Warning<
6818  "use of logical '%0' with constant operand">,
6819  InGroup<DiagGroup<"constant-logical-operand">>;
6820def note_logical_instead_of_bitwise_change_operator : Note<
6821  "use '%0' for a bitwise operation">;
6822def note_logical_instead_of_bitwise_remove_constant : Note<
6823  "remove constant to silence this warning">;
6824
6825def warn_bitwise_op_in_bitwise_op : Warning<
6826  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6827
6828def warn_logical_and_in_logical_or : Warning<
6829  "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6830
6831def warn_overloaded_shift_in_comparison :Warning<
6832  "overloaded operator %select{>>|<<}0 has higher precedence than "
6833  "comparison operator">,
6834  InGroup<OverloadedShiftOpParentheses>;
6835def note_evaluate_comparison_first :Note<
6836  "place parentheses around comparison expression to evaluate it first">;
6837
6838def note_concatenated_string_literal_silence :Note<
6839  "place parentheses around the string literal to silence warning">;
6840
6841def warn_addition_in_bitshift : Warning<
6842  "operator '%0' has lower precedence than '%1'; "
6843  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6844
6845def warn_self_assignment_builtin : Warning<
6846  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6847  "you mean to assign to member %2?}1">,
6848  InGroup<SelfAssignment>, DefaultIgnore;
6849def warn_self_assignment_overloaded : Warning<
6850  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6851  "you mean to assign to member %2?}1">,
6852  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6853def warn_self_move : Warning<
6854  "explicitly moving variable of type %0 to itself%select{|; did you mean to "
6855  "move to member %2?}1">,
6856  InGroup<SelfMove>, DefaultIgnore;
6857
6858def err_builtin_move_forward_unsupported : Error<
6859  "unsupported signature for %q0">;
6860def err_use_of_unaddressable_function : Error<
6861  "taking address of non-addressable standard library function">;
6862// FIXME: This should also be in -Wc++23-compat once we have it.
6863def warn_cxx20_compat_use_of_unaddressable_function : Warning<
6864  "taking address of non-addressable standard library function "
6865  "is incompatible with C++20">, InGroup<CXX20Compat>;
6866
6867def warn_redundant_move_on_return : Warning<
6868  "redundant move in return statement">,
6869  InGroup<RedundantMove>, DefaultIgnore;
6870def warn_pessimizing_move_on_return : Warning<
6871  "moving a local object in a return statement prevents copy elision">,
6872  InGroup<PessimizingMove>, DefaultIgnore;
6873def warn_pessimizing_move_on_initialization : Warning<
6874  "moving a temporary object prevents copy elision">,
6875  InGroup<PessimizingMove>, DefaultIgnore;
6876def note_remove_move : Note<"remove std::move call here">;
6877
6878def warn_string_plus_int : Warning<
6879  "adding %0 to a string does not append to the string">,
6880  InGroup<StringPlusInt>;
6881def warn_string_plus_char : Warning<
6882  "adding %0 to a string pointer does not append to the string">,
6883  InGroup<StringPlusChar>;
6884def note_string_plus_scalar_silence : Note<
6885  "use array indexing to silence this warning">;
6886
6887def warn_sizeof_array_param : Warning<
6888  "sizeof on array function parameter will return size of %0 instead of %1">,
6889  InGroup<SizeofArrayArgument>;
6890
6891def warn_sizeof_array_decay : Warning<
6892  "sizeof on pointer operation will return size of %0 instead of %1">,
6893  InGroup<SizeofArrayDecay>;
6894
6895def err_sizeof_nonfragile_interface : Error<
6896  "application of '%select{alignof|sizeof}1' to interface %0 is "
6897  "not supported on this architecture and platform">;
6898def err_atdef_nonfragile_interface : Error<
6899  "use of @defs is not supported on this architecture and platform">;
6900def err_subscript_nonfragile_interface : Error<
6901  "subscript requires size of interface %0, which is not constant for "
6902  "this architecture and platform">;
6903
6904def err_arithmetic_nonfragile_interface : Error<
6905  "arithmetic on pointer to interface %0, which is not a constant size for "
6906  "this architecture and platform">;
6907
6908def warn_deprecated_comma_subscript : Warning<
6909  "top-level comma expression in array subscript is deprecated "
6910  "in C++20 and unsupported in C++23">,
6911  InGroup<DeprecatedCommaSubscript>;
6912
6913def ext_subscript_non_lvalue : Extension<
6914  "ISO C90 does not allow subscripting non-lvalue array">;
6915def err_typecheck_subscript_value : Error<
6916  "subscripted value is not an array, pointer, or vector">;
6917def err_typecheck_subscript_not_integer : Error<
6918  "array subscript is not an integer">;
6919def err_subscript_function_type : Error<
6920  "subscript of pointer to function type %0">;
6921def err_subscript_incomplete_or_sizeless_type : Error<
6922  "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6923def err_subscript_svbool_t : Error<
6924  "subscript of svbool_t is not allowed">;
6925def err_dereference_incomplete_type : Error<
6926  "dereference of pointer to incomplete type %0">;
6927def ext_gnu_subscript_void_type : Extension<
6928  "subscript of a pointer to void is a GNU extension">,
6929  InGroup<GNUPointerArith>;
6930def err_typecheck_member_reference_struct_union : Error<
6931  "member reference base type %0 is not a structure or union">;
6932def err_typecheck_member_reference_ivar : Error<
6933  "%0 does not have a member named %1">;
6934def err_arc_weak_ivar_access : Error<
6935  "dereferencing a __weak pointer is not allowed due to possible "
6936  "null value caused by race condition, assign it to strong variable first">;
6937def err_typecheck_member_reference_arrow : Error<
6938  "member reference type %0 is not a pointer">;
6939def err_typecheck_member_reference_suggestion : Error<
6940  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6941def note_typecheck_member_reference_suggestion : Note<
6942  "did you mean to use '.' instead?">;
6943def note_member_reference_arrow_from_operator_arrow : Note<
6944  "'->' applied to return value of the operator->() declared here">;
6945def err_typecheck_member_reference_type : Error<
6946  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6947def err_typecheck_member_reference_unknown : Error<
6948  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6949def err_member_reference_needs_call : Error<
6950  "base of member reference is a function; perhaps you meant to call "
6951  "it%select{| with no arguments}0?">;
6952def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6953  InGroup<CharSubscript>, DefaultIgnore;
6954
6955def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6956def err_no_member : Error<"no member named %0 in %1">;
6957def err_no_member_overloaded_arrow : Error<
6958  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6959
6960def err_member_not_yet_instantiated : Error<
6961  "no member %0 in %1; it has not yet been instantiated">;
6962def note_non_instantiated_member_here : Note<
6963  "not-yet-instantiated member is declared here">;
6964
6965def err_enumerator_does_not_exist : Error<
6966  "enumerator %0 does not exist in instantiation of %1">;
6967def note_enum_specialized_here : Note<
6968  "enum %0 was explicitly specialized here">;
6969
6970def err_specialization_not_primary_template : Error<
6971  "cannot reference member of primary template because deduced class "
6972  "template specialization %0 is %select{instantiated from a partial|"
6973  "an explicit}1 specialization">;
6974
6975def err_member_redeclared : Error<"class member cannot be redeclared">;
6976def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6977  InGroup<RedeclaredClassMember>;
6978def err_member_redeclared_in_instantiation : Error<
6979  "multiple overloads of %0 instantiate to the same signature %1">;
6980def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6981def err_member_def_undefined_record : Error<
6982  "out-of-line definition of %0 from class %1 without definition">;
6983def err_member_decl_does_not_match : Error<
6984  "out-of-line %select{declaration|definition}2 of %0 "
6985  "does not match any declaration in %1">;
6986def err_friend_decl_with_def_arg_must_be_def : Error<
6987  "friend declaration specifying a default argument must be a definition">;
6988def err_friend_decl_with_def_arg_redeclared : Error<
6989  "friend declaration specifying a default argument must be the only declaration">;
6990def err_friend_decl_does_not_match : Error<
6991  "friend declaration of %0 does not match any declaration in %1">;
6992def err_member_decl_does_not_match_suggest : Error<
6993  "out-of-line %select{declaration|definition}2 of %0 "
6994  "does not match any declaration in %1; did you mean %3?">;
6995def err_member_def_does_not_match_ret_type : Error<
6996  "return type of out-of-line definition of %q0 differs from "
6997  "that in the declaration">;
6998def err_nonstatic_member_out_of_line : Error<
6999  "non-static data member defined out-of-line">;
7000def err_qualified_typedef_declarator : Error<
7001  "typedef declarator cannot be qualified">;
7002def err_qualified_param_declarator : Error<
7003  "parameter declarator cannot be qualified">;
7004def ext_out_of_line_declaration : ExtWarn<
7005  "out-of-line declaration of a member must be a definition">,
7006  InGroup<OutOfLineDeclaration>, DefaultError;
7007def err_member_extra_qualification : Error<
7008  "extra qualification on member %0">;
7009def warn_member_extra_qualification : Warning<
7010  err_member_extra_qualification.Summary>, InGroup<MicrosoftExtraQualification>;
7011def warn_namespace_member_extra_qualification : Warning<
7012  "extra qualification on member %0">,
7013  InGroup<DiagGroup<"extra-qualification">>;
7014def err_member_qualification : Error<
7015  "non-friend class member %0 cannot have a qualified name">;
7016def note_member_def_close_match : Note<"member declaration nearly matches">;
7017def note_member_def_close_const_match : Note<
7018  "member declaration does not match because "
7019  "it %select{is|is not}0 const qualified">;
7020def note_member_def_close_param_match : Note<
7021  "type of %ordinal0 parameter of member declaration does not match definition"
7022  "%diff{ ($ vs $)|}1,2">;
7023def note_local_decl_close_match : Note<"local declaration nearly matches">;
7024def note_local_decl_close_param_match : Note<
7025  "type of %ordinal0 parameter of local declaration does not match definition"
7026  "%diff{ ($ vs $)|}1,2">;
7027def err_typecheck_ivar_variable_size : Error<
7028  "instance variables must have a constant size">;
7029def err_ivar_reference_type : Error<
7030  "instance variables cannot be of reference type">;
7031def err_typecheck_illegal_increment_decrement : Error<
7032  "cannot %select{decrement|increment}1 value of type %0">;
7033def err_typecheck_expect_int : Error<
7034  "used type %0 where integer is required">;
7035def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
7036  "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
7037def err_typecheck_pointer_arith_function_type : Error<
7038  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
7039  "function type%select{|s}2 %1%select{| and %3}2">;
7040def err_typecheck_pointer_arith_void_type : Error<
7041  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
7042def err_typecheck_decl_incomplete_type : Error<
7043  "variable has incomplete type %0">;
7044def ext_typecheck_decl_incomplete_type : ExtWarn<
7045  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
7046  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
7047def err_tentative_def_incomplete_type : Error<
7048  "tentative definition has type %0 that is never completed">;
7049def warn_tentative_incomplete_array : Warning<
7050  "tentative array definition assumed to have one element">;
7051def err_typecheck_incomplete_array_needs_initializer : Error<
7052  "definition of variable with array type needs an explicit size "
7053  "or an initializer">;
7054def err_array_init_not_init_list : Error<
7055  "array initializer must be an initializer "
7056  "list%select{| or string literal| or wide string literal}0">;
7057def err_array_init_narrow_string_into_wchar : Error<
7058  "initializing wide char array with non-wide string literal">;
7059def err_array_init_wide_string_into_char : Error<
7060  "initializing char array with wide string literal">;
7061def err_array_init_incompat_wide_string_into_wchar : Error<
7062  "initializing wide char array with incompatible wide string literal">;
7063def err_array_init_plain_string_into_char8_t : Error<
7064  "initializing 'char8_t' array with plain string literal">;
7065def note_array_init_plain_string_into_char8_t : Note<
7066  "add 'u8' prefix to form a 'char8_t' string literal">;
7067def err_array_init_utf8_string_into_char : Error<
7068  "initialization of %select{|signed }0char array with "
7069  "UTF-8 string literal is not permitted by %select{'-fchar8_t'|C++20}1">;
7070def warn_cxx20_compat_utf8_string : Warning<
7071  "type of UTF-8 string literal will change from array of const char to "
7072  "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
7073def note_cxx20_compat_utf8_string_remove_u8 : Note<
7074  "remove 'u8' prefix to avoid a change of behavior; "
7075  "Clang encodes unprefixed narrow string literals as UTF-8">;
7076def err_array_init_different_type : Error<
7077  "cannot initialize array %diff{of type $ with array of type $|"
7078  "with different type of array}0,1">;
7079def err_array_init_non_constant_array : Error<
7080  "cannot initialize array %diff{of type $ with non-constant array of type $|"
7081  "with different type of array}0,1">;
7082def ext_array_init_copy : Extension<
7083  "initialization of an array "
7084  "%diff{of type $ from a compound literal of type $|"
7085  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
7086// This is intentionally not disabled by -Wno-gnu.
7087def ext_array_init_parens : ExtWarn<
7088  "parenthesized initialization of a member array is a GNU extension">,
7089  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
7090def warn_deprecated_string_literal_conversion : Warning<
7091  "conversion from string literal to %0 is deprecated">,
7092  InGroup<CXX11CompatDeprecatedWritableStr>;
7093def ext_deprecated_string_literal_conversion : ExtWarn<
7094  "ISO C++11 does not allow conversion from string literal to %0">,
7095  InGroup<WritableStrings>, SFINAEFailure;
7096def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
7097def err_typecheck_sclass_fscope : Error<
7098  "illegal storage class on file-scoped variable">;
7099def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
7100  InGroup<MissingDeclarations>;
7101def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
7102  "of a type">, InGroup<MissingDeclarations>;
7103def err_standalone_class_nested_name_specifier : Error<
7104  "forward declaration of %select{class|struct|interface|union|enum|enum class|enum struct}0 cannot "
7105  "have a nested name specifier">;
7106def err_typecheck_sclass_func : Error<"illegal storage class on function">;
7107def err_static_block_func : Error<
7108  "function declared in block scope cannot have 'static' storage class">;
7109def err_typecheck_address_of : Error<"address of %select{bit-field"
7110  "|vector element|property expression|register variable|matrix element}0 requested">;
7111def ext_typecheck_addrof_void : Extension<
7112  "ISO C forbids taking the address of an expression of type 'void'">;
7113def err_unqualified_pointer_member_function : Error<
7114  "must explicitly qualify name of member function when taking its address">;
7115def err_invalid_form_pointer_member_function : Error<
7116  "cannot create a non-constant pointer to member function">;
7117def err_address_of_function_with_pass_object_size_params: Error<
7118  "cannot take address of function %0 because parameter %1 has "
7119  "pass_object_size attribute">;
7120def err_parens_pointer_member_function : Error<
7121  "cannot parenthesize the name of a method when forming a member pointer">;
7122def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
7123  "extra '&' taking address of overloaded function">;
7124def err_typecheck_invalid_lvalue_addrof : Error<
7125  "cannot take the address of an rvalue of type %0">;
7126def ext_typecheck_addrof_temporary : ExtWarn<
7127  "taking the address of a temporary object of type %0">,
7128  InGroup<AddressOfTemporary>, DefaultError;
7129def err_typecheck_addrof_temporary : Error<
7130  "taking the address of a temporary object of type %0">;
7131def err_typecheck_addrof_dtor : Error<
7132  "taking the address of a destructor">;
7133def err_typecheck_unary_expr : Error<
7134  "invalid argument type %0 to unary expression">;
7135def err_typecheck_indirection_requires_pointer : Error<
7136  "indirection requires pointer operand (%0 invalid)">;
7137def ext_typecheck_indirection_through_void_pointer : ExtWarn<
7138  "ISO C does not allow indirection on operand of type %0">,
7139  InGroup<VoidPointerDeref>;
7140def err_typecheck_indirection_through_void_pointer_cpp
7141    : Error<"indirection not permitted on operand of type %0">;
7142def warn_indirection_through_null : Warning<
7143  "indirection of non-volatile null pointer will be deleted, not trap">,
7144  InGroup<NullDereference>;
7145def warn_binding_null_to_reference : Warning<
7146  "binding dereferenced null pointer to reference has undefined behavior">,
7147  InGroup<NullDereference>;
7148def note_indirection_through_null : Note<
7149  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
7150def warn_pointer_indirection_from_incompatible_type : Warning<
7151  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
7152  "behavior">,
7153  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7154def warn_taking_address_of_packed_member : Warning<
7155  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
7156  InGroup<DiagGroup<"address-of-packed-member">>;
7157def warn_param_mismatched_alignment : Warning<
7158  "passing %0-byte aligned argument to %1-byte aligned parameter %2%select{| of %4}3 may result in an unaligned pointer access">,
7159  InGroup<DiagGroup<"align-mismatch">>;
7160
7161def err_objc_object_assignment : Error<
7162  "cannot assign to class object (%0 invalid)">;
7163def err_typecheck_invalid_operands : Error<
7164  "invalid operands to binary expression (%0 and %1)">, Deferrable;
7165def note_typecheck_invalid_operands_converted : Note<
7166  "%select{first|second}0 operand was implicitly converted to type %1">;
7167def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
7168  "logical expression with vector %select{type %1 and non-vector type %2|types"
7169  " %1 and %2}0 is only supported in C++">;
7170def err_typecheck_sub_ptr_compatible : Error<
7171  "%diff{$ and $ are not pointers to compatible types|"
7172  "pointers to incompatible types}0,1">;
7173def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
7174  "ordered comparison between pointer and integer (%0 and %1)">;
7175def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
7176  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
7177def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
7178  "ordered comparison between pointer and zero (%0 and %1)">;
7179def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
7180  "three-way comparison between pointer and zero">;
7181def ext_typecheck_compare_complete_incomplete_pointers : Extension<
7182  "pointer comparisons before C11 "
7183  "need to be between two complete or two incomplete types; "
7184  "%0 is %select{|in}2complete and "
7185  "%1 is %select{|in}3complete">,
7186  InGroup<C11>;
7187def warn_typecheck_ordered_comparison_of_function_pointers : Warning<
7188  "ordered comparison of function pointers (%0 and %1)">,
7189  InGroup<OrderedCompareFunctionPointers>;
7190def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
7191  "ordered comparison of function pointers (%0 and %1)">,
7192  InGroup<OrderedCompareFunctionPointers>;
7193def err_typecheck_ordered_comparison_of_function_pointers : Error<
7194  "ordered comparison of function pointers (%0 and %1)">;
7195def ext_typecheck_comparison_of_fptr_to_void : Extension<
7196  "equality comparison between function pointer and void pointer (%0 and %1)">;
7197def err_typecheck_comparison_of_fptr_to_void : Error<
7198  "equality comparison between function pointer and void pointer (%0 and %1)">;
7199def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
7200  "comparison between pointer and integer (%0 and %1)">,
7201  InGroup<DiagGroup<"pointer-integer-compare">>;
7202def err_typecheck_comparison_of_pointer_integer : Error<
7203  "comparison between pointer and integer (%0 and %1)">;
7204def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
7205  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
7206  InGroup<CompareDistinctPointerType>;
7207def ext_typecheck_cond_incompatible_operands : ExtWarn<
7208  "incompatible operand types (%0 and %1)">;
7209def err_cond_voidptr_arc : Error <
7210  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
7211  "in ARC mode">;
7212def err_typecheck_comparison_of_distinct_pointers : Error<
7213  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
7214def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
7215  "%select{comparison between %diff{ ($ and $)|}0,1"
7216  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
7217  "|conditional operator with the second and third operands of type "
7218  "%diff{ ($ and $)|}0,1}2"
7219  " which are pointers to non-overlapping address spaces">;
7220
7221def select_arith_conv_kind : TextSubstitution<
7222  "%select{arithmetic between|bitwise operation between|comparison of|"
7223  "conditional expression between|compound assignment of}0">;
7224def warn_arith_conv_enum_float : Warning<
7225  "%sub{select_arith_conv_kind}0 "
7226  "%select{floating-point|enumeration}1 type %2 "
7227  "%plural{2:with|4:from|:and}0 "
7228  "%select{enumeration|floating-point}1 type %3">,
7229  InGroup<EnumFloatConversion>, DefaultIgnore;
7230def warn_arith_conv_enum_float_cxx20 : Warning<
7231  "%sub{select_arith_conv_kind}0 "
7232  "%select{floating-point|enumeration}1 type %2 "
7233  "%plural{2:with|4:from|:and}0 "
7234  "%select{enumeration|floating-point}1 type %3 is deprecated">,
7235  InGroup<DeprecatedEnumFloatConversion>;
7236def err_arith_conv_enum_float_cxx26 : Error<
7237  "invalid %sub{select_arith_conv_kind}0 "
7238  "%select{floating-point|enumeration}1 type %2 "
7239  "%plural{2:with|4:from|:and}0 "
7240  "%select{enumeration|floating-point}1 type %3">;
7241def warn_arith_conv_mixed_enum_types : Warning<
7242  "%sub{select_arith_conv_kind}0 "
7243  "different enumeration types%diff{ ($ and $)|}1,2">,
7244  InGroup<EnumEnumConversion>, DefaultIgnore;
7245def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
7246  "%sub{select_arith_conv_kind}0 "
7247  "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
7248  InGroup<DeprecatedEnumEnumConversion>;
7249def err_conv_mixed_enum_types_cxx26 : Error<
7250  "invalid %sub{select_arith_conv_kind}0 "
7251  "different enumeration types%diff{ ($ and $)|}1,2">;
7252
7253def warn_arith_conv_mixed_anon_enum_types : Warning<
7254  warn_arith_conv_mixed_enum_types.Summary>,
7255  InGroup<AnonEnumEnumConversion>, DefaultIgnore;
7256def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
7257  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7258  InGroup<DeprecatedAnonEnumEnumConversion>;
7259def warn_conditional_mixed_enum_types : Warning<
7260  warn_arith_conv_mixed_enum_types.Summary>,
7261  InGroup<EnumCompareConditional>, DefaultIgnore;
7262def warn_conditional_mixed_enum_types_cxx20 : Warning<
7263  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7264  InGroup<DeprecatedEnumCompareConditional>;
7265def warn_comparison_mixed_enum_types : Warning<
7266  warn_arith_conv_mixed_enum_types.Summary>,
7267  InGroup<EnumCompare>;
7268def warn_comparison_mixed_enum_types_cxx20 : Warning<
7269  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7270  InGroup<DeprecatedEnumCompare>;
7271def warn_comparison_of_mixed_enum_types_switch : Warning<
7272  "comparison of different enumeration types in switch statement"
7273  "%diff{ ($ and $)|}0,1">,
7274  InGroup<EnumCompareSwitch>;
7275
7276def err_typecheck_assign_const : Error<
7277  "%select{"
7278  "cannot assign to return value because function %1 returns a const value|"
7279  "cannot assign to variable %1 with const-qualified type %2|"
7280  "cannot assign to %select{non-|}1static data member %2 "
7281  "with const-qualified type %3|"
7282  "cannot assign to non-static data member within const member function %1|"
7283  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
7284  "with %select{|nested }3const-qualified data member %4|"
7285  "read-only variable is not assignable}0">;
7286
7287def note_typecheck_assign_const : Note<
7288  "%select{"
7289  "function %1 which returns const-qualified type %2 declared here|"
7290  "variable %1 declared const here|"
7291  "%select{non-|}1static data member %2 declared const here|"
7292  "member function %q1 is declared const here|"
7293  "%select{|nested }1data member %2 declared const here}0">;
7294
7295def warn_unsigned_always_true_comparison : Warning<
7296  "result of comparison of %select{%3|unsigned expression}0 %2 "
7297  "%select{unsigned expression|%3}0 is always %4">,
7298  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
7299def warn_unsigned_char_always_true_comparison : Warning<
7300  "result of comparison of %select{%3|char expression}0 %2 "
7301  "%select{char expression|%3}0 is always %4, since char is interpreted as "
7302  "unsigned">, InGroup<TautologicalUnsignedCharZeroCompare>, DefaultIgnore;
7303def warn_unsigned_enum_always_true_comparison : Warning<
7304  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
7305  "%select{unsigned enum expression|%3}0 is always %4">,
7306  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
7307def warn_tautological_constant_compare : Warning<
7308  "result of comparison %select{%3|%1}0 %2 "
7309  "%select{%1|%3}0 is always %4">,
7310  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
7311def warn_tautological_compare_objc_bool : Warning<
7312  "result of comparison of constant %0 with expression of type 'BOOL'"
7313  " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
7314  InGroup<TautologicalObjCBoolCompare>;
7315def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
7316def warn_tautological_compare_value_range : Warning<
7317  "result of comparison of "
7318  "%select{%4|%sub{subst_int_range}1,2}0 %3 "
7319  "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
7320  InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
7321
7322def warn_mixed_sign_comparison : Warning<
7323  "comparison of integers of different signs: %0 and %1">,
7324  InGroup<SignCompare>, DefaultIgnore;
7325def warn_out_of_range_compare : Warning<
7326  "result of comparison of %select{constant %0|true|false}1 with "
7327  "%select{expression of type %2|boolean expression}3 is always %4">,
7328  InGroup<TautologicalOutOfRangeCompare>;
7329def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Summary>,
7330  InGroup<TautologicalConstantCompare>;
7331def warn_integer_constants_in_conditional_always_true : Warning<
7332  "converting the result of '?:' with integer constants to a boolean always "
7333  "evaluates to 'true'">,
7334  InGroup<TautologicalConstantCompare>;
7335def warn_left_shift_always : Warning<
7336  "converting the result of '<<' to a boolean always evaluates "
7337  "to %select{false|true}0">,
7338  InGroup<TautologicalConstantCompare>;
7339def warn_null_in_arithmetic_operation : Warning<
7340  "use of NULL in arithmetic operation">,
7341  InGroup<NullArithmetic>;
7342def warn_null_in_comparison_operation : Warning<
7343  "comparison between NULL and non-pointer "
7344  "%select{(%1 and NULL)|(NULL and %1)}0">,
7345  InGroup<NullArithmetic>;
7346def err_shift_rhs_only_vector : Error<
7347  "requested shift is a vector of type %0 but the first operand is not a "
7348  "vector (%1)">;
7349
7350def warn_logical_not_on_lhs_of_check : Warning<
7351  "logical not is only applied to the left hand side of this "
7352  "%select{comparison|bitwise operator}0">,
7353  InGroup<LogicalNotParentheses>;
7354def note_logical_not_fix : Note<
7355  "add parentheses after the '!' to evaluate the "
7356  "%select{comparison|bitwise operator}0 first">;
7357def note_logical_not_silence_with_parens : Note<
7358  "add parentheses around left hand side expression to silence this warning">;
7359
7360def err_invalid_this_use : Error<
7361  "invalid use of 'this' %select{outside of a non-static member function"
7362  "|in a function with an explicit object parameter}0">;
7363def err_this_static_member_func : Error<
7364  "'this' cannot be%select{| implicitly}0 used in a static member function "
7365  "declaration">;
7366def err_invalid_member_use_in_method : Error<
7367  "invalid use of member %0 in %select{static|explicit object}1 member function">;
7368
7369def err_invalid_qualified_function_type : Error<
7370  "%select{non-member function|static member function|explicit object member function|deduction guide}0 "
7371  "%select{of type %2 |}1cannot have '%3' qualifier">;
7372def err_compound_qualified_function_type : Error<
7373  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
7374  "cannot have '%3' qualifier">;
7375def err_qualified_function_typeid : Error<
7376  "type operand %0 of 'typeid' cannot have '%1' qualifier">;
7377
7378def err_cxx20_deducing_this  : Error<
7379  "explicit object parameters are incompatible with C++ standards before C++2b">;
7380def err_explicit_object_default_arg: Error<
7381  "the explicit object parameter cannot have a default argument">;
7382def err_explicit_object_parameter_pack: Error<
7383  "the explicit object parameter cannot be a function parameter pack">;
7384def err_explicit_object_parameter_must_be_first: Error<
7385  "an explicit object parameter can only appear as the first parameter "
7386  "of the %select{function|lambda}0">;
7387def err_explicit_object_parameter_nonmember: Error<
7388  "an explicit object parameter cannot appear in a "
7389  "%select{static|virtual|non-member}0 %select{function|lambda}1">;
7390def err_explicit_object_parameter_constructor: Error<
7391  "an explicit object parameter cannot appear in a %select{constructor|destructor}0">;
7392def err_explicit_object_parameter_mutable: Error<
7393  "a lambda with an explicit object parameter cannot be mutable">;
7394def err_invalid_explicit_object_type_in_lambda: Error<
7395  "invalid explicit object parameter type %0 in lambda with capture; "
7396  "the type must be the same as, or derived from, the lambda">;
7397
7398def err_ref_qualifier_overload : Error<
7399  "cannot overload a member function %select{without a ref-qualifier|with "
7400  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
7401  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
7402
7403def err_invalid_non_static_member_use : Error<
7404  "invalid use of non-static data member %0">;
7405def err_nested_non_static_member_use : Error<
7406  "%select{call to non-static member function|use of non-static data member}0 "
7407  "%2 of %1 from nested type %3">;
7408def warn_cxx98_compat_non_static_member_use : Warning<
7409  "use of non-static data member %0 in an unevaluated context is "
7410  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
7411def err_invalid_incomplete_type_use : Error<
7412  "invalid use of incomplete type %0">;
7413def err_builtin_func_cast_more_than_one_arg : Error<
7414  "function-style cast to a builtin type can only take one argument">;
7415def err_value_init_for_array_type : Error<
7416  "array types cannot be value-initialized">;
7417def err_init_for_function_type : Error<
7418  "cannot create object of function type %0">;
7419def warn_format_nonliteral_noargs : Warning<
7420  "format string is not a string literal (potentially insecure)">,
7421  InGroup<FormatSecurity>;
7422def warn_format_nonliteral : Warning<
7423  "format string is not a string literal">,
7424  InGroup<FormatNonLiteral>, DefaultIgnore;
7425
7426def err_unexpected_interface : Error<
7427  "unexpected interface name %0: expected expression">;
7428def err_ref_non_value : Error<"%0 does not refer to a value">;
7429def err_ref_vm_type : Error<
7430  "cannot refer to declaration with a variably modified type inside block">;
7431def err_ref_flexarray_type : Error<
7432  "cannot refer to declaration of structure variable with flexible array member "
7433  "inside block">;
7434def err_ref_array_type : Error<
7435  "cannot refer to declaration with an array type inside block">;
7436def err_property_not_found : Error<
7437  "property %0 not found on object of type %1">;
7438def err_invalid_property_name : Error<
7439  "%0 is not a valid property name (accessing an object of type %1)">;
7440def err_getter_not_found : Error<
7441  "no getter method for read from property">;
7442def err_objc_subscript_method_not_found : Error<
7443  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
7444  "found on object of type %0">;
7445def err_objc_subscript_index_type : Error<
7446  "method index parameter type %0 is not integral type">;
7447def err_objc_subscript_key_type : Error<
7448  "method key parameter type %0 is not object type">;
7449def err_objc_subscript_dic_object_type : Error<
7450  "method object parameter type %0 is not object type">;
7451def err_objc_subscript_object_type : Error<
7452  "cannot assign to this %select{dictionary|array}1 because assigning method's "
7453  "2nd parameter of type %0 is not an Objective-C pointer type">;
7454def err_objc_subscript_base_type : Error<
7455  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
7456def err_objc_multiple_subscript_type_conversion : Error<
7457  "indexing expression is invalid because subscript type %0 has "
7458  "multiple type conversion functions">;
7459def err_objc_subscript_type_conversion : Error<
7460  "indexing expression is invalid because subscript type %0 is not an integral"
7461  " or Objective-C pointer type">;
7462def err_objc_subscript_pointer : Error<
7463  "indexing expression is invalid because subscript type %0 is not an"
7464  " Objective-C pointer">;
7465def err_objc_indexing_method_result_type : Error<
7466  "method for accessing %select{dictionary|array}1 element must have Objective-C"
7467  " object return type instead of %0">;
7468def err_objc_index_incomplete_class_type : Error<
7469  "Objective-C index expression has incomplete class type %0">;
7470def err_illegal_container_subscripting_op : Error<
7471  "illegal operation on Objective-C container subscripting">;
7472def err_property_not_found_forward_class : Error<
7473  "property %0 cannot be found in forward class object %1">;
7474def err_property_not_as_forward_class : Error<
7475  "property %0 refers to an incomplete Objective-C class %1 "
7476  "(with no @interface available)">;
7477def note_forward_class : Note<
7478  "forward declaration of class here">;
7479def err_duplicate_property : Error<
7480  "property has a previous declaration">;
7481def ext_gnu_void_ptr : Extension<
7482  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
7483  InGroup<GNUPointerArith>;
7484def ext_gnu_ptr_func_arith : Extension<
7485  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
7486  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
7487  InGroup<GNUPointerArith>;
7488def err_readonly_message_assignment : Error<
7489  "assigning to 'readonly' return result of an Objective-C message not allowed">;
7490def ext_integer_increment_complex : Extension<
7491  "ISO C does not support '++'/'--' on complex integer type %0">;
7492def ext_integer_complement_complex : Extension<
7493  "ISO C does not support '~' for complex conjugation of %0">;
7494def err_nosetter_property_assignment : Error<
7495  "%select{assignment to readonly property|"
7496  "no setter method %1 for assignment to property}0">;
7497def err_nosetter_property_incdec : Error<
7498  "%select{%select{increment|decrement}1 of readonly property|"
7499  "no setter method %2 for %select{increment|decrement}1 of property}0">;
7500def err_nogetter_property_compound_assignment : Error<
7501  "a getter method is needed to perform a compound assignment on a property">;
7502def err_nogetter_property_incdec : Error<
7503  "no getter method %1 for %select{increment|decrement}0 of property">;
7504def err_no_subobject_property_setting : Error<
7505  "expression is not assignable">;
7506def err_qualified_objc_access : Error<
7507  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
7508
7509def ext_freestanding_complex : Extension<
7510  "complex numbers are an extension in a freestanding C99 implementation">;
7511
7512// FIXME: Remove when we support imaginary.
7513def err_imaginary_not_supported : Error<"imaginary types are not supported">;
7514
7515// Obj-c expressions
7516def warn_root_inst_method_not_found : Warning<
7517  "instance method %0 is being used on 'Class' which is not in the root class">,
7518  InGroup<MethodAccess>;
7519def warn_class_method_not_found : Warning<
7520  "class method %objcclass0 not found (return type defaults to 'id')">,
7521  InGroup<MethodAccess>;
7522def warn_instance_method_on_class_found : Warning<
7523  "instance method %0 found instead of class method %1">,
7524  InGroup<MethodAccess>;
7525def warn_inst_method_not_found : Warning<
7526  "instance method %objcinstance0 not found (return type defaults to 'id')">,
7527  InGroup<MethodAccess>;
7528def warn_instance_method_not_found_with_typo : Warning<
7529  "instance method %objcinstance0 not found (return type defaults to 'id')"
7530  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
7531def warn_class_method_not_found_with_typo : Warning<
7532  "class method %objcclass0 not found (return type defaults to 'id')"
7533  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
7534def err_method_not_found_with_typo : Error<
7535  "%select{instance|class}1 method %0 not found "
7536  "; did you mean %2?">;
7537def err_no_super_class_message : Error<
7538  "no @interface declaration found in class messaging of %0">;
7539def err_root_class_cannot_use_super : Error<
7540  "%0 cannot use 'super' because it is a root class">;
7541def err_invalid_receiver_to_message_super : Error<
7542  "'super' is only valid in a method body">;
7543def err_invalid_receiver_class_message : Error<
7544  "receiver type %0 is not an Objective-C class">;
7545def err_missing_open_square_message_send : Error<
7546  "missing '[' at start of message send expression">;
7547def warn_bad_receiver_type : Warning<
7548  "receiver type %0 is not 'id' or interface pointer, consider "
7549  "casting it to 'id'">,InGroup<ObjCReceiver>;
7550def err_bad_receiver_type : Error<"bad receiver type %0">;
7551def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
7552def err_unknown_receiver_suggest : Error<
7553  "unknown receiver %0; did you mean %1?">;
7554def err_objc_throw_expects_object : Error<
7555  "@throw requires an Objective-C object type (%0 invalid)">;
7556def err_objc_synchronized_expects_object : Error<
7557  "@synchronized requires an Objective-C object type (%0 invalid)">;
7558def err_rethrow_used_outside_catch : Error<
7559  "@throw (rethrow) used outside of a @catch block">;
7560def err_attribute_multiple_objc_gc : Error<
7561  "multiple garbage collection attributes specified for type">;
7562def err_catch_param_not_objc_type : Error<
7563  "@catch parameter is not a pointer to an interface type">;
7564def err_illegal_qualifiers_on_catch_parm : Error<
7565  "illegal qualifiers on @catch parameter">;
7566def err_storage_spec_on_catch_parm : Error<
7567  "@catch parameter cannot have storage specifier '%0'">;
7568def warn_register_objc_catch_parm : Warning<
7569  "'register' storage specifier on @catch parameter will be ignored">;
7570def err_qualified_objc_catch_parm : Error<
7571  "@catch parameter declarator cannot be qualified">;
7572def warn_objc_pointer_cxx_catch_fragile : Warning<
7573  "cannot catch an exception thrown with @throw in C++ in the non-unified "
7574  "exception model">, InGroup<ObjCNonUnifiedException>;
7575def err_objc_object_catch : Error<
7576  "cannot catch an Objective-C object by value">;
7577def err_incomplete_type_objc_at_encode : Error<
7578  "'@encode' of incomplete type %0">;
7579def warn_objc_circular_container : Warning<
7580  "adding %0 to %1 might cause circular dependency in container">,
7581  InGroup<DiagGroup<"objc-circular-container">>;
7582def note_objc_circular_container_declared_here : Note<"%0 declared here">;
7583def warn_objc_unsafe_perform_selector : Warning<
7584  "%0 is incompatible with selectors that return a "
7585  "%select{struct|union|vector}1 type">,
7586  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
7587def note_objc_unsafe_perform_selector_method_declared_here :  Note<
7588  "method %0 that returns %1 declared here">;
7589def err_attribute_arm_builtin_alias : Error<
7590  "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
7591def err_attribute_arm_mve_polymorphism : Error<
7592  "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
7593def err_attribute_webassembly_funcref : Error<
7594  "'__funcref' attribute can only be applied to a function pointer type">;
7595
7596def warn_setter_getter_impl_required : Warning<
7597  "property %0 requires method %1 to be defined - "
7598  "use @synthesize, @dynamic or provide a method implementation "
7599  "in this class implementation">,
7600  InGroup<ObjCPropertyImpl>;
7601def warn_setter_getter_impl_required_in_category : Warning<
7602  "property %0 requires method %1 to be defined - "
7603  "use @dynamic or provide a method implementation in this category">,
7604  InGroup<ObjCPropertyImpl>;
7605def note_parameter_named_here : Note<
7606  "passing argument to parameter %0 here">;
7607def note_parameter_here : Note<
7608  "passing argument to parameter here">;
7609def note_method_return_type_change : Note<
7610  "compiler has implicitly changed method %0 return type">;
7611
7612def warn_impl_required_for_class_property : Warning<
7613  "class property %0 requires method %1 to be defined - "
7614  "use @dynamic or provide a method implementation "
7615  "in this class implementation">,
7616  InGroup<ObjCPropertyImpl>;
7617def warn_impl_required_in_category_for_class_property : Warning<
7618  "class property %0 requires method %1 to be defined - "
7619  "use @dynamic or provide a method implementation in this category">,
7620  InGroup<ObjCPropertyImpl>;
7621
7622// C++ casts
7623// These messages adhere to the TryCast pattern: %0 is an int specifying the
7624// cast type, %1 is the source type, %2 is the destination type.
7625def err_bad_reinterpret_cast_overload : Error<
7626  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
7627
7628def warn_reinterpret_different_from_static : Warning<
7629  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
7630  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
7631  "'static_cast'">, InGroup<ReinterpretBaseClass>;
7632def note_reinterpret_updowncast_use_static: Note<
7633  "use 'static_cast' to adjust the pointer correctly while "
7634  "%select{upcasting|downcasting}0">;
7635
7636def err_bad_static_cast_overload : Error<
7637  "address of overloaded function %0 cannot be static_cast to type %1">;
7638
7639def err_bad_cstyle_cast_overload : Error<
7640  "address of overloaded function %0 cannot be cast to type %1">;
7641
7642
7643def err_bad_cxx_cast_generic : Error<
7644  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7645  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7646def err_bad_cxx_cast_unrelated_class : Error<
7647  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7648  "functional-style cast|}0 from %1 to %2, which are not related by "
7649  "inheritance, is not allowed">;
7650def note_type_incomplete : Note<"%0 is incomplete">;
7651def err_bad_cxx_cast_rvalue : Error<
7652  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7653  "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7654def err_bad_cxx_cast_bitfield : Error<
7655  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7656  "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7657def err_bad_cxx_cast_qualifiers_away : Error<
7658  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7659  "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7660def err_bad_cxx_cast_addr_space_mismatch : Error<
7661  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7662  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7663  " spaces">;
7664def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7665  "ISO C++ does not allow "
7666  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7667  "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
7668  "even though the source and destination types are unrelated">,
7669  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
7670def err_bad_const_cast_dest : Error<
7671  "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
7672  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
7673def ext_cast_fn_obj : Extension<
7674  "cast between pointer-to-function and pointer-to-object is an extension">;
7675def ext_ms_cast_fn_obj : ExtWarn<
7676  "static_cast between pointer-to-function and pointer-to-object is a "
7677  "Microsoft extension">, InGroup<MicrosoftCast>;
7678def warn_cxx98_compat_cast_fn_obj : Warning<
7679  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
7680  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7681def err_bad_reinterpret_cast_small_int : Error<
7682  "cast from pointer to smaller type %2 loses information">;
7683def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
7684  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7685  "to scalar %2 of different size">;
7686def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
7687  "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
7688  "to vector %2 of different size">;
7689def err_bad_cxx_cast_vector_to_vector_different_size : Error<
7690  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7691  "to vector %2 of different size">;
7692def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
7693  "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
7694  "changes address space of nested pointers">,
7695  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7696def err_bad_lvalue_to_rvalue_cast : Error<
7697  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
7698  "not compatible">;
7699def err_bad_rvalue_to_rvalue_cast : Error<
7700  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
7701  "not compatible">;
7702def err_bad_static_cast_pointer_nonpointer : Error<
7703  "cannot cast from type %1 to pointer type %2">;
7704def err_bad_static_cast_member_pointer_nonmp : Error<
7705  "cannot cast from type %1 to member pointer type %2">;
7706def err_bad_cxx_cast_member_pointer_size : Error<
7707  "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
7708  "type %1 to member pointer type %2 of different size">;
7709def err_bad_reinterpret_cast_reference : Error<
7710  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
7711def warn_undefined_reinterpret_cast : Warning<
7712  "reinterpret_cast from %0 to %1 has undefined behavior">,
7713  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7714
7715// These messages don't adhere to the pattern.
7716// FIXME: Display the path somehow better.
7717def err_ambiguous_base_to_derived_cast : Error<
7718  "ambiguous cast from base %0 to derived %1:%2">;
7719def err_static_downcast_via_virtual : Error<
7720  "cannot cast %0 to %1 via virtual base %2">;
7721def err_downcast_from_inaccessible_base : Error<
7722  "cannot cast %select{private|protected}2 base class %1 to %0">;
7723def err_upcast_to_inaccessible_base : Error<
7724  "cannot cast %0 to its %select{private|protected}2 base class %1">;
7725def err_bad_dynamic_cast_not_ref_or_ptr : Error<
7726  "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
7727def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
7728def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
7729def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
7730def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
7731
7732// Other C++ expressions
7733def err_need_header_before_typeid : Error<
7734  "you need to include <typeinfo> before using the 'typeid' operator">;
7735def err_need_header_before_placement_new : Error<
7736  "no matching %0 function for non-allocating placement new expression; "
7737  "include <new>">;
7738def err_ms___leave_not_in___try : Error<
7739  "'__leave' statement not in __try block">;
7740def err_uuidof_without_guid : Error<
7741  "cannot call operator __uuidof on a type with no GUID">;
7742def err_uuidof_with_multiple_guids : Error<
7743  "cannot call operator __uuidof on a type with multiple GUIDs">;
7744def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
7745def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
7746def err_static_illegal_in_new : Error<
7747  "the 'static' modifier for the array size is not legal in new expressions">;
7748def err_array_new_needs_size : Error<
7749  "array size must be specified in new expression with no initializer">;
7750def err_bad_new_type : Error<
7751  "cannot allocate %select{function|reference}1 type %0 with new">;
7752def err_new_incomplete_or_sizeless_type : Error<
7753  "allocation of %select{incomplete|sizeless}0 type %1">;
7754def err_new_array_nonconst : Error<
7755  "only the first dimension of an allocated array may have dynamic size">;
7756def err_new_array_size_unknown_from_init : Error<
7757  "cannot determine allocated array size from initializer">;
7758def err_new_array_init_args : Error<
7759  "array 'new' cannot have initialization arguments">;
7760def ext_new_paren_array_nonconst : ExtWarn<
7761  "when type is in parentheses, array cannot have dynamic size">;
7762def err_placement_new_non_placement_delete : Error<
7763  "'new' expression with placement arguments refers to non-placement "
7764  "'operator delete'">;
7765def err_array_size_not_integral : Error<
7766  "array size expression must have integral or %select{|unscoped }0"
7767  "enumeration type, not %1">;
7768def err_array_size_incomplete_type : Error<
7769  "array size expression has incomplete class type %0">;
7770def err_array_size_explicit_conversion : Error<
7771  "array size expression of type %0 requires explicit conversion to type %1">;
7772def note_array_size_conversion : Note<
7773  "conversion to %select{integral|enumeration}0 type %1 declared here">;
7774def err_array_size_ambiguous_conversion : Error<
7775  "ambiguous conversion of array size expression of type %0 to an integral or "
7776  "enumeration type">;
7777def ext_array_size_conversion : Extension<
7778  "implicit conversion from array size expression of type %0 to "
7779  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7780  InGroup<CXX11>;
7781def warn_cxx98_compat_array_size_conversion : Warning<
7782  "implicit conversion from array size expression of type %0 to "
7783  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7784  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7785def err_address_space_qualified_new : Error<
7786  "'new' cannot allocate objects of type %0 in address space '%1'">;
7787def err_address_space_qualified_delete : Error<
7788  "'delete' cannot delete objects of type %0 in address space '%1'">;
7789
7790def err_default_init_const : Error<
7791  "default initialization of an object of const type %0"
7792  "%select{| without a user-provided default constructor}1">;
7793def ext_default_init_const : ExtWarn<
7794  "default initialization of an object of const type %0"
7795  "%select{| without a user-provided default constructor}1 "
7796  "is a Microsoft extension">,
7797  InGroup<MicrosoftConstInit>;
7798def err_delete_operand : Error<"cannot delete expression of type %0">;
7799def ext_delete_void_ptr_operand : ExtWarn<
7800  "cannot delete expression with pointer-to-'void' type %0">,
7801  InGroup<DeleteIncomplete>;
7802def err_ambiguous_delete_operand : Error<
7803  "ambiguous conversion of delete expression of type %0 to a pointer">;
7804def warn_delete_incomplete : Warning<
7805  "deleting pointer to incomplete type %0 may cause undefined behavior">,
7806  InGroup<DeleteIncomplete>;
7807def err_delete_incomplete_class_type : Error<
7808  "deleting incomplete class type %0; no conversions to pointer type">;
7809def err_delete_explicit_conversion : Error<
7810  "converting delete expression from type %0 to type %1 invokes an explicit "
7811  "conversion function">;
7812def note_delete_conversion : Note<"conversion to pointer type %0">;
7813def warn_delete_array_type : Warning<
7814  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7815def warn_mismatched_delete_new : Warning<
7816  "'delete%select{|[]}0' applied to a pointer that was allocated with "
7817  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7818  InGroup<DiagGroup<"mismatched-new-delete">>;
7819def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7820def err_no_suitable_delete_member_function_found : Error<
7821  "no suitable member %0 in %1">;
7822def err_ambiguous_suitable_delete_member_function_found : Error<
7823  "multiple suitable %0 functions in %1">;
7824def warn_ambiguous_suitable_delete_function_found : Warning<
7825  "multiple suitable %0 functions for %1; no 'operator delete' function "
7826  "will be invoked if initialization throws an exception">,
7827  InGroup<DiagGroup<"ambiguous-delete">>;
7828def note_member_declared_here : Note<
7829  "member %0 declared here">;
7830def note_member_first_declared_here : Note<
7831  "member %0 first declared here">;
7832def warn_bitwise_instead_of_logical : Warning<
7833  "use of bitwise '%0' with boolean operands">,
7834  InGroup<BitwiseInsteadOfLogical>, DefaultIgnore;
7835def warn_bitwise_negation_bool : Warning<
7836  "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7837  "did you mean logical negation?">,
7838  InGroup<BoolOperation>, DefaultIgnore;
7839def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7840def warn_increment_bool : Warning<
7841  "incrementing expression of type bool is deprecated and "
7842  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7843def ext_increment_bool : ExtWarn<
7844  "ISO C++17 does not allow incrementing expression of type bool">,
7845  DefaultError, SFINAEFailure, InGroup<IncrementBool>;
7846def err_increment_decrement_enum : Error<
7847  "cannot %select{decrement|increment}0 expression of enum type %1">;
7848
7849def warn_deprecated_increment_decrement_volatile : Warning<
7850  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7851  "is deprecated">, InGroup<DeprecatedVolatile>;
7852def warn_deprecated_simple_assign_volatile : Warning<
7853  "use of result of assignment to object of volatile-qualified type %0 "
7854  "is deprecated">, InGroup<DeprecatedVolatile>;
7855def warn_deprecated_volatile_return : Warning<
7856  "volatile-qualified return type %0 is deprecated">,
7857  InGroup<DeprecatedVolatile>;
7858def warn_deprecated_volatile_param : Warning<
7859  "volatile-qualified parameter type %0 is deprecated">,
7860  InGroup<DeprecatedVolatile>;
7861def warn_deprecated_volatile_structured_binding : Warning<
7862  "volatile qualifier in structured binding declaration is deprecated">,
7863  InGroup<DeprecatedVolatile>;
7864
7865def warn_deprecated_altivec_src_compat : Warning<
7866  "Current handling of vector bool and vector pixel types in this context are "
7867  "deprecated. The default behaviour will soon change to that implied by the "
7868  "'-altivec-compat=xl' option">,
7869  InGroup<DiagGroup<"deprecated-altivec-src-compat">>;
7870
7871def warn_deprecated_lax_vec_conv_all : Warning<
7872  "Implicit conversion between vector types ('%0' and '%1') is deprecated. "
7873  "In the future, the behavior implied by '-fno-lax-vector-conversions' "
7874  "will be the default.">,
7875  InGroup<DiagGroup<"deprecate-lax-vec-conv-all">>;
7876
7877def err_catch_incomplete_ptr : Error<
7878  "cannot catch pointer to incomplete type %0">;
7879def err_catch_incomplete_ref : Error<
7880  "cannot catch reference to incomplete type %0">;
7881def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7882def err_catch_sizeless : Error<
7883  "cannot catch %select{|reference to }0sizeless type %1">;
7884def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7885def err_catch_variably_modified : Error<
7886  "cannot catch variably modified type %0">;
7887def err_qualified_catch_declarator : Error<
7888  "exception declarator cannot be qualified">;
7889def err_early_catch_all : Error<"catch-all handler must come last">;
7890def err_bad_memptr_rhs : Error<
7891  "right hand operand to %0 has non-pointer-to-member type %1">;
7892def err_bad_memptr_lhs : Error<
7893  "left hand operand to %0 must be a %select{|pointer to }1class "
7894  "compatible with the right hand operand, but is %2">;
7895def err_memptr_incomplete : Error<
7896  "member pointer has incomplete base type %0">;
7897def warn_exception_caught_by_earlier_handler : Warning<
7898  "exception of type %0 will be caught by earlier handler">,
7899  InGroup<Exceptions>;
7900def note_previous_exception_handler : Note<"for type %0">;
7901def err_exceptions_disabled : Error<
7902  "cannot use '%0' with exceptions disabled">;
7903def err_objc_exceptions_disabled : Error<
7904  "cannot use '%0' with Objective-C exceptions disabled">;
7905def warn_throw_in_noexcept_func : Warning<
7906  "%0 has a non-throwing exception specification but can still throw">,
7907  InGroup<Exceptions>;
7908def note_throw_in_dtor : Note<
7909  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7910  "non-throwing}1 exception specification">;
7911def note_throw_in_function : Note<"function declared non-throwing here">;
7912def err_seh_try_outside_functions : Error<
7913  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7914def err_mixing_cxx_try_seh_try : Error<
7915  "cannot use %select{C++ 'try'|Objective-C '@try'}0 "
7916  "in the same function as SEH '__try'">;
7917def err_seh_try_unsupported : Error<
7918  "SEH '__try' is not supported on this target">;
7919def note_conflicting_try_here : Note<
7920  "conflicting %0 here">;
7921def warn_jump_out_of_seh_finally : Warning<
7922  "jump out of __finally block has undefined behavior">,
7923  InGroup<DiagGroup<"jump-seh-finally">>;
7924def warn_non_virtual_dtor : Warning<
7925  "%0 has virtual functions but non-virtual destructor">,
7926  InGroup<NonVirtualDtor>, DefaultIgnore;
7927def warn_delete_non_virtual_dtor : Warning<
7928  "%select{delete|destructor}0 called on non-final %1 that has "
7929  "virtual functions but non-virtual destructor">,
7930  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7931def note_delete_non_virtual : Note<
7932  "qualify call to silence this warning">;
7933def warn_delete_abstract_non_virtual_dtor : Warning<
7934  "%select{delete|destructor}0 called on %1 that is abstract but has "
7935  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7936def warn_overloaded_virtual : Warning<
7937  "%q0 hides overloaded virtual %select{function|functions}1">,
7938  InGroup<OverloadedVirtual>, DefaultIgnore;
7939def note_hidden_overloaded_virtual_declared_here : Note<
7940  "hidden overloaded virtual function %q0 declared here"
7941  "%select{|: different classes%diff{ ($ vs $)|}2,3"
7942  "|: different number of parameters (%2 vs %3)"
7943  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7944  "|: different return type%diff{ ($ vs $)|}2,3"
7945  "|: different qualifiers (%2 vs %3)"
7946  "|: different exception specifications}1">;
7947def warn_using_directive_in_header : Warning<
7948  "using namespace directive in global context in header">,
7949  InGroup<HeaderHygiene>, DefaultIgnore;
7950def warn_overaligned_type : Warning<
7951  "type %0 requires %1 bytes of alignment and the default allocator only "
7952  "guarantees %2 bytes">,
7953  InGroup<OveralignedType>, DefaultIgnore;
7954def err_array_element_alignment : Error<
7955  "size of array element of type %0 (%1 bytes) isn't a multiple of its alignment (%2 bytes)">;
7956def err_aligned_allocation_unavailable : Error<
7957  "aligned %select{allocation|deallocation}0 function of type '%1' is "
7958  "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
7959def note_silence_aligned_allocation_unavailable : Note<
7960  "if you supply your own aligned allocation functions, use "
7961  "-faligned-allocation to silence this diagnostic">;
7962
7963def err_conditional_void_nonvoid : Error<
7964  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7965  "is of type %0">;
7966def err_conditional_ambiguous : Error<
7967  "conditional expression is ambiguous; "
7968  "%diff{$ can be converted to $ and vice versa|"
7969  "types can be convert to each other}0,1">;
7970def err_conditional_ambiguous_ovl : Error<
7971  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7972  "can be converted to several common types">;
7973def err_conditional_vector_size : Error<
7974  "vector condition type %0 and result type %1 do not have the same number "
7975  "of elements">;
7976def err_conditional_vector_element_size : Error<
7977  "vector condition type %0 and result type %1 do not have elements of the "
7978  "same size">;
7979def err_conditional_vector_has_void : Error<
7980  "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7981def err_conditional_vector_operand_type
7982    : Error<"enumeration type %0 is not allowed in a vector conditional">;
7983def err_conditional_vector_cond_result_mismatch
7984    : Error<"cannot mix vectors and extended vectors in a vector conditional">;
7985def err_conditional_vector_mismatched
7986    : Error<"vector operands to the vector conditional must be the same type "
7987            "%diff{($ and $)|}0,1}">;
7988
7989def err_throw_incomplete : Error<
7990  "cannot throw object of incomplete type %0">;
7991def err_throw_incomplete_ptr : Error<
7992  "cannot throw pointer to object of incomplete type %0">;
7993def err_throw_sizeless : Error<
7994  "cannot throw object of sizeless type %0">;
7995def warn_throw_underaligned_obj : Warning<
7996  "underaligned exception object thrown">,
7997  InGroup<UnderalignedExceptionObject>;
7998def note_throw_underaligned_obj : Note<
7999  "required alignment of type %0 (%1 bytes) is larger than the supported "
8000  "alignment of C++ exception objects on this target (%2 bytes)">;
8001def err_return_in_constructor_handler : Error<
8002  "return in the catch of a function try block of a constructor is illegal">;
8003def warn_cdtor_function_try_handler_mem_expr : Warning<
8004  "cannot refer to a non-static member from the handler of a "
8005  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
8006def err_throw_object_throwing_dtor : Error<
8007  "cannot throw object of type %0 with a potentially-throwing destructor">;
8008
8009let CategoryName = "Lambda Issue" in {
8010  def err_capture_more_than_once : Error<
8011    "%0 can appear only once in a capture list">;
8012  def err_reference_capture_with_reference_default : Error<
8013    "'&' cannot precede a capture when the capture default is '&'">;
8014  def err_copy_capture_with_copy_default : Error<
8015    "'&' must precede a capture when the capture default is '='">;
8016  def err_capture_does_not_name_variable : Error<
8017    "%0 in capture list does not name a variable">;
8018  def err_capture_non_automatic_variable : Error<
8019    "%0 cannot be captured because it does not have automatic storage "
8020    "duration">;
8021  def err_this_capture : Error<
8022    "'this' cannot be %select{implicitly |}0captured in this context">;
8023  def note_lambda_this_capture_fixit : Note<
8024    "explicitly capture 'this'">;
8025  def err_lambda_capture_anonymous_var : Error<
8026    "unnamed variable cannot be implicitly captured in a lambda expression">;
8027  def err_lambda_capture_flexarray_type : Error<
8028    "variable %0 with flexible array member cannot be captured in "
8029    "a lambda expression">;
8030  def err_lambda_impcap : Error<
8031    "variable %0 cannot be implicitly captured in a lambda with no "
8032    "capture-default specified">;
8033  def note_lambda_variable_capture_fixit : Note<
8034    "capture %0 by %select{value|reference}1">;
8035  def note_lambda_default_capture_fixit : Note<
8036    "default capture by %select{value|reference}0">;
8037  def note_lambda_decl : Note<"lambda expression begins here">;
8038  def err_lambda_unevaluated_operand : Error<
8039    "lambda expression in an unevaluated operand">;
8040  def err_lambda_in_constant_expression : Error<
8041    "a lambda expression may not appear inside of a constant expression">;
8042  def err_lambda_in_invalid_context : Error<
8043    "a lambda expression cannot appear in this context">;
8044  def err_lambda_return_init_list : Error<
8045    "cannot deduce lambda return type from initializer list">;
8046  def err_lambda_capture_default_arg : Error<
8047    "lambda expression in default argument cannot capture any entity">;
8048  def err_lambda_incomplete_result : Error<
8049    "incomplete result type %0 in lambda expression">;
8050  def err_noreturn_lambda_has_return_expr : Error<
8051    "lambda declared 'noreturn' should not return">;
8052  def warn_maybe_falloff_nonvoid_lambda : Warning<
8053    "non-void lambda does not return a value in all control paths">,
8054    InGroup<ReturnType>;
8055  def warn_falloff_nonvoid_lambda : Warning<
8056    "non-void lambda does not return a value">,
8057    InGroup<ReturnType>;
8058  def err_access_lambda_capture : Error<
8059    // The ERRORs represent other special members that aren't constructors, in
8060    // hopes that someone will bother noticing and reporting if they appear
8061    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
8062    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
8063    AccessControl;
8064  def note_lambda_to_block_conv : Note<
8065    "implicit capture of lambda object due to conversion to block pointer "
8066    "here">;
8067  def note_var_explicitly_captured_here : Note<"variable %0 is"
8068    "%select{| explicitly}1 captured here">;
8069
8070  // C++14 lambda init-captures.
8071  def warn_cxx11_compat_init_capture : Warning<
8072    "initialized lambda captures are incompatible with C++ standards "
8073    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
8074  def ext_init_capture : ExtWarn<
8075    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
8076  def err_init_capture_no_expression : Error<
8077    "initializer missing for lambda capture %0">;
8078  def err_init_capture_multiple_expressions : Error<
8079    "initializer for lambda capture %0 contains multiple expressions">;
8080  def err_init_capture_paren_braces : Error<
8081    "cannot deduce type for lambda capture %1 from "
8082    "%select{parenthesized|nested}0 initializer list">;
8083  def err_init_capture_deduction_failure : Error<
8084    "cannot deduce type for lambda capture %0 from initializer of type %2">;
8085  def err_init_capture_deduction_failure_from_init_list : Error<
8086    "cannot deduce type for lambda capture %0 from initializer list">;
8087  def warn_cxx17_compat_init_capture_pack : Warning<
8088    "initialized lambda capture packs are incompatible with C++ standards "
8089    "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8090  def ext_init_capture_pack : ExtWarn<
8091    "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
8092
8093  // C++14 generic lambdas.
8094  def warn_cxx11_compat_generic_lambda : Warning<
8095    "generic lambdas are incompatible with C++11">,
8096    InGroup<CXXPre14Compat>, DefaultIgnore;
8097
8098  // C++17 '*this' captures.
8099  def warn_cxx14_compat_star_this_lambda_capture : Warning<
8100    "by value capture of '*this' is incompatible with C++ standards before C++17">,
8101     InGroup<CXXPre17Compat>, DefaultIgnore;
8102  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
8103    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
8104
8105  // C++17 parameter shadows capture
8106  def err_parameter_shadow_capture : Error<
8107    "a lambda parameter cannot shadow an explicitly captured entity">;
8108
8109  // C++20 [=, this] captures.
8110  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
8111    "explicit capture of 'this' with a capture default of '=' is incompatible "
8112    "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8113  def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
8114    "explicit capture of 'this' with a capture default of '=' "
8115    "is a C++20 extension">, InGroup<CXX20>;
8116  def warn_deprecated_this_capture : Warning<
8117    "implicit capture of 'this' with a capture default of '=' is deprecated">,
8118    InGroup<DeprecatedThisCapture>;
8119  def note_deprecated_this_capture : Note<
8120    "add an explicit capture of 'this' to capture '*this' by reference">;
8121
8122  // C++20 default constructible / assignable lambdas.
8123  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
8124    "%select{default construction|assignment}0 of lambda is incompatible with "
8125    "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8126}
8127
8128def err_return_in_captured_stmt : Error<
8129  "cannot return from %0">;
8130def err_capture_block_variable : Error<
8131  "__block variable %0 cannot be captured in a "
8132  "%select{lambda expression|captured statement}1">;
8133
8134def err_operator_arrow_circular : Error<
8135  "circular pointer delegation detected">;
8136def err_operator_arrow_depth_exceeded : Error<
8137  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
8138  "'operator->' calls">;
8139def note_operator_arrow_here : Note<
8140  "'operator->' declared here produces an object of type %0">;
8141def note_operator_arrows_suppressed : Note<
8142  "(skipping %0 'operator->'%s0 in backtrace)">;
8143def note_operator_arrow_depth : Note<
8144  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
8145
8146def err_pseudo_dtor_base_not_scalar : Error<
8147  "object expression of non-scalar type %0 cannot be used in a "
8148  "pseudo-destructor expression">;
8149def ext_pseudo_dtor_on_void : ExtWarn<
8150  "pseudo-destructors on type void are a Microsoft extension">,
8151  InGroup<MicrosoftVoidPseudoDtor>;
8152def err_pseudo_dtor_type_mismatch : Error<
8153  "the type of object expression "
8154  "%diff{($) does not match the type being destroyed ($)|"
8155  "does not match the type being destroyed}0,1 "
8156  "in pseudo-destructor expression">;
8157def err_pseudo_dtor_call_with_args : Error<
8158  "call to pseudo-destructor cannot have any arguments">;
8159def err_dtor_expr_without_call : Error<
8160  "reference to %select{destructor|pseudo-destructor}0 must be called"
8161  "%select{|; did you mean to call it with no arguments?}1">;
8162def err_pseudo_dtor_destructor_non_type : Error<
8163  "%0 does not refer to a type name in pseudo-destructor expression; expected "
8164  "the name of type %1">;
8165def err_invalid_use_of_function_type : Error<
8166  "a function type is not allowed here">;
8167def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
8168def err_typecheck_bool_condition : Error<
8169  "value of type %0 is not contextually convertible to 'bool'">;
8170def err_typecheck_ambiguous_condition : Error<
8171  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
8172def err_typecheck_nonviable_condition : Error<
8173  "no viable conversion%select{%diff{ from $ to $|}1,2|"
8174  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
8175def err_typecheck_nonviable_condition_incomplete : Error<
8176  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
8177def err_typecheck_deleted_function : Error<
8178  "conversion function %diff{from $ to $|between types}0,1 "
8179  "invokes a deleted function">;
8180
8181def err_expected_class_or_namespace : Error<"%0 is not a class"
8182  "%select{ or namespace|, namespace, or enumeration}1">;
8183def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
8184  "because namespace %1 does not enclose namespace %2">;
8185def err_export_non_namespace_scope_name : Error<
8186  "cannot export %0 as it is not at namespace scope">;
8187def err_redeclaration_non_exported : Error <
8188  "cannot export redeclaration %0 here since the previous declaration "
8189  "%select{is not exported|has internal linkage|has module linkage}1">;
8190def err_invalid_declarator_global_scope : Error<
8191  "definition or redeclaration of %0 cannot name the global scope">;
8192def err_invalid_declarator_in_function : Error<
8193  "definition or redeclaration of %0 not allowed inside a function">;
8194def err_invalid_declarator_in_block : Error<
8195  "definition or redeclaration of %0 not allowed inside a block">;
8196def err_not_tag_in_scope : Error<
8197  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
8198
8199def err_no_typeid_with_fno_rtti : Error<
8200  "use of typeid requires -frtti">;
8201def err_no_dynamic_cast_with_fno_rtti : Error<
8202  "use of dynamic_cast requires -frtti">;
8203def warn_no_dynamic_cast_with_rtti_disabled: Warning<
8204  "dynamic_cast will not work since RTTI data is disabled by "
8205  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8206def warn_no_typeid_with_rtti_disabled: Warning<
8207  "typeid will not work since RTTI data is disabled by "
8208  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8209
8210def err_cannot_form_pointer_to_member_of_reference_type : Error<
8211  "cannot form a pointer-to-member to member %0 of reference type %1">;
8212def err_incomplete_object_call : Error<
8213  "incomplete type in call to object of type %0">;
8214
8215def warn_condition_is_assignment : Warning<"using the result of an "
8216  "assignment as a condition without parentheses">,
8217  InGroup<Parentheses>;
8218def warn_free_nonheap_object
8219  : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
8220    InGroup<FreeNonHeapObject>;
8221
8222// Completely identical except off by default.
8223def warn_condition_is_idiomatic_assignment : Warning<"using the result "
8224  "of an assignment as a condition without parentheses">,
8225  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
8226def note_condition_assign_to_comparison : Note<
8227  "use '==' to turn this assignment into an equality comparison">;
8228def note_condition_or_assign_to_comparison : Note<
8229  "use '!=' to turn this compound assignment into an inequality comparison">;
8230def note_condition_assign_silence : Note<
8231  "place parentheses around the assignment to silence this warning">;
8232
8233def warn_equality_with_extra_parens : Warning<"equality comparison with "
8234  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
8235def note_equality_comparison_to_assign : Note<
8236  "use '=' to turn this equality comparison into an assignment">;
8237def note_equality_comparison_silence : Note<
8238  "remove extraneous parentheses around the comparison to silence this warning">;
8239
8240// assignment related diagnostics (also for argument passing, returning, etc).
8241// In most of these diagnostics the %2 is a value from the
8242// Sema::AssignmentAction enumeration
8243def err_typecheck_convert_incompatible : Error<
8244  "%select{%diff{assigning to $ from incompatible type $|"
8245  "assigning to type from incompatible type}0,1"
8246  "|%diff{passing $ to parameter of incompatible type $|"
8247  "passing type to parameter of incompatible type}0,1"
8248  "|%diff{returning $ from a function with incompatible result type $|"
8249  "returning type from a function with incompatible result type}0,1"
8250  "|%diff{converting $ to incompatible type $|"
8251  "converting type to incompatible type}0,1"
8252  "|%diff{initializing $ with an expression of incompatible type $|"
8253  "initializing type with an expression of incompatible type}0,1"
8254  "|%diff{sending $ to parameter of incompatible type $|"
8255  "sending type to parameter of incompatible type}0,1"
8256  "|%diff{casting $ to incompatible type $|"
8257  "casting type to incompatible type}0,1}2"
8258  "%select{|; dereference with *|"
8259  "; take the address with &|"
8260  "; remove *|"
8261  "; remove &}3"
8262  "%select{|: different classes%diff{ ($ vs $)|}5,6"
8263  "|: different number of parameters (%5 vs %6)"
8264  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
8265  "|: different return type%diff{ ($ vs $)|}5,6"
8266  "|: different qualifiers (%5 vs %6)"
8267  "|: different exception specifications}4">;
8268def err_typecheck_missing_return_type_incompatible : Error<
8269  "%diff{return type $ must match previous return type $|"
8270  "return type must match previous return type}0,1 when %select{block "
8271  "literal|lambda expression}2 has unspecified explicit return type">;
8272
8273def note_incomplete_class_and_qualified_id : Note<
8274  "conformance of forward class %0 to protocol %1 can not be confirmed">;
8275def warn_incompatible_qualified_id : Warning<
8276  "%select{%diff{assigning to $ from incompatible type $|"
8277  "assigning to type from incompatible type}0,1"
8278  "|%diff{passing $ to parameter of incompatible type $|"
8279  "passing type to parameter of incompatible type}0,1"
8280  "|%diff{returning $ from a function with incompatible result type $|"
8281  "returning type from a function with incompatible result type}0,1"
8282  "|%diff{converting $ to incompatible type $|"
8283  "converting type to incompatible type}0,1"
8284  "|%diff{initializing $ with an expression of incompatible type $|"
8285  "initializing type with an expression of incompatible type}0,1"
8286  "|%diff{sending $ to parameter of incompatible type $|"
8287  "sending type to parameter of incompatible type}0,1"
8288  "|%diff{casting $ to incompatible type $|"
8289  "casting type to incompatible type}0,1}2">;
8290def err_incompatible_qualified_id : Error<
8291  "%select{%diff{assigning to $ from incompatible type $|"
8292  "assigning to type from incompatible type}0,1"
8293  "|%diff{passing $ to parameter of incompatible type $|"
8294  "passing type to parameter of incompatible type}0,1"
8295  "|%diff{returning $ from a function with incompatible result type $|"
8296  "returning type from a function with incompatible result type}0,1"
8297  "|%diff{converting $ to incompatible type $|"
8298  "converting type to incompatible type}0,1"
8299  "|%diff{initializing $ with an expression of incompatible type $|"
8300  "initializing type with an expression of incompatible type}0,1"
8301  "|%diff{sending $ to parameter of incompatible type $|"
8302  "sending type to parameter of incompatible type}0,1"
8303  "|%diff{casting $ to incompatible type $|"
8304  "casting type to incompatible type}0,1}2">;
8305def err_typecheck_convert_pointer_int : Error<
8306  "incompatible pointer to integer conversion "
8307  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8308  "|%diff{passing $ to parameter of type $|"
8309  "passing to parameter of different type}0,1"
8310  "|%diff{returning $ from a function with result type $|"
8311  "returning from function with different return type}0,1"
8312  "|%diff{converting $ to type $|converting between types}0,1"
8313  "|%diff{initializing $ with an expression of type $|"
8314  "initializing with expression of different type}0,1"
8315  "|%diff{sending $ to parameter of type $|"
8316  "sending to parameter of different type}0,1"
8317  "|%diff{casting $ to type $|casting between types}0,1}2"
8318  "%select{|; dereference with *|"
8319  "; take the address with &|"
8320  "; remove *|"
8321  "; remove &}3">;
8322def ext_typecheck_convert_pointer_int : ExtWarn<
8323  err_typecheck_convert_pointer_int.Summary>,
8324  InGroup<IntConversion>, DefaultError;
8325def err_typecheck_convert_int_pointer : Error<
8326  "incompatible integer to pointer conversion "
8327  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8328  "|%diff{passing $ to parameter of type $|"
8329  "passing to parameter of different type}0,1"
8330  "|%diff{returning $ from a function with result type $|"
8331  "returning from function with different return type}0,1"
8332  "|%diff{converting $ to type $|converting between types}0,1"
8333  "|%diff{initializing $ with an expression of type $|"
8334  "initializing with expression of different type}0,1"
8335  "|%diff{sending $ to parameter of type $|"
8336  "sending to parameter of different type}0,1"
8337  "|%diff{casting $ to type $|casting between types}0,1}2"
8338  "%select{|; dereference with *|"
8339  "; take the address with &|"
8340  "; remove *|"
8341  "; remove &}3">;
8342def ext_typecheck_convert_int_pointer : ExtWarn<
8343  err_typecheck_convert_int_pointer.Summary>,
8344  InGroup<IntConversion>, DefaultError;
8345def ext_typecheck_convert_pointer_void_func : Extension<
8346  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8347  "|%diff{passing $ to parameter of type $|"
8348  "passing to parameter of different type}0,1"
8349  "|%diff{returning $ from a function with result type $|"
8350  "returning from function with different return type}0,1"
8351  "|%diff{converting $ to type $|converting between types}0,1"
8352  "|%diff{initializing $ with an expression of type $|"
8353  "initializing with expression of different type}0,1"
8354  "|%diff{sending $ to parameter of type $|"
8355  "sending to parameter of different type}0,1"
8356  "|%diff{casting $ to type $|casting between types}0,1}2"
8357  " converts between void pointer and function pointer">;
8358def err_typecheck_convert_pointer_void_func : Error<
8359  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8360  "|%diff{passing $ to parameter of type $|"
8361  "passing to parameter of different type}0,1"
8362  "|%diff{returning $ from a function with result type $|"
8363  "returning from function with different return type}0,1"
8364  "|%diff{converting $ to type $|converting between types}0,1"
8365  "|%diff{initializing $ with an expression of type $|"
8366  "initializing with expression of different type}0,1"
8367  "|%diff{sending $ to parameter of type $|"
8368  "sending to parameter of different type}0,1"
8369  "|%diff{casting $ to type $|casting between types}0,1}2"
8370  " converts between void pointer and function pointer">;
8371def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
8372  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8373  "|%diff{passing $ to parameter of type $|"
8374  "passing to parameter of different type}0,1"
8375  "|%diff{returning $ from a function with result type $|"
8376  "returning from function with different return type}0,1"
8377  "|%diff{converting $ to type $|converting between types}0,1"
8378  "|%diff{initializing $ with an expression of type $|"
8379  "initializing with expression of different type}0,1"
8380  "|%diff{sending $ to parameter of type $|"
8381  "sending to parameter of different type}0,1"
8382  "|%diff{casting $ to type $|casting between types}0,1}2"
8383  " converts between pointers to integer types %select{with different sign|"
8384  "where one is of the unique plain 'char' type and the other is not}3">,
8385  InGroup<DiagGroup<"pointer-sign">>;
8386def err_typecheck_convert_incompatible_pointer_sign :
8387  Error<ext_typecheck_convert_incompatible_pointer_sign.Summary>;
8388def ext_typecheck_convert_incompatible_pointer : ExtWarn<
8389  "incompatible pointer types "
8390  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8391  "|%diff{passing $ to parameter of type $|"
8392  "passing to parameter of different type}0,1"
8393  "|%diff{returning $ from a function with result type $|"
8394  "returning from function with different return type}0,1"
8395  "|%diff{converting $ to type $|converting between types}0,1"
8396  "|%diff{initializing $ with an expression of type $|"
8397  "initializing with expression of different type}0,1"
8398  "|%diff{sending $ to parameter of type $|"
8399  "sending to parameter of different type}0,1"
8400  "|%diff{casting $ to type $|casting between types}0,1}2"
8401  "%select{|; dereference with *|"
8402  "; take the address with &|"
8403  "; remove *|"
8404  "; remove &}3">,
8405  InGroup<IncompatiblePointerTypes>;
8406def err_typecheck_convert_incompatible_pointer : Error<
8407  "incompatible pointer types "
8408  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8409  "|%diff{passing $ to parameter of type $|"
8410  "passing to parameter of different type}0,1"
8411  "|%diff{returning $ from a function with result type $|"
8412  "returning from function with different return type}0,1"
8413  "|%diff{converting $ to type $|converting between types}0,1"
8414  "|%diff{initializing $ with an expression of type $|"
8415  "initializing with expression of different type}0,1"
8416  "|%diff{sending $ to parameter of type $|"
8417  "sending to parameter of different type}0,1"
8418  "|%diff{casting $ to type $|casting between types}0,1}2"
8419  "%select{|; dereference with *|"
8420  "; take the address with &|"
8421  "; remove *|"
8422  "; remove &}3">;
8423def err_typecheck_convert_incompatible_function_pointer : Error<
8424  "incompatible function pointer types "
8425  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8426  "|%diff{passing $ to parameter of type $|"
8427  "passing to parameter of different type}0,1"
8428  "|%diff{returning $ from a function with result type $|"
8429  "returning from function with different return type}0,1"
8430  "|%diff{converting $ to type $|converting between types}0,1"
8431  "|%diff{initializing $ with an expression of type $|"
8432  "initializing with expression of different type}0,1"
8433  "|%diff{sending $ to parameter of type $|"
8434  "sending to parameter of different type}0,1"
8435  "|%diff{casting $ to type $|casting between types}0,1}2"
8436  "%select{|; dereference with *|"
8437  "; take the address with &|"
8438  "; remove *|"
8439  "; remove &}3">;
8440def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
8441  err_typecheck_convert_incompatible_function_pointer.Summary>,
8442  InGroup<IncompatibleFunctionPointerTypes>, DefaultError;
8443def warn_typecheck_convert_incompatible_function_pointer_strict : Warning<
8444  err_typecheck_convert_incompatible_function_pointer.Summary>,
8445  InGroup<DiagGroup<"incompatible-function-pointer-types-strict">>, DefaultIgnore;
8446def ext_typecheck_convert_discards_qualifiers : ExtWarn<
8447  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8448  "|%diff{passing $ to parameter of type $|"
8449  "passing to parameter of different type}0,1"
8450  "|%diff{returning $ from a function with result type $|"
8451  "returning from function with different return type}0,1"
8452  "|%diff{converting $ to type $|converting between types}0,1"
8453  "|%diff{initializing $ with an expression of type $|"
8454  "initializing with expression of different type}0,1"
8455  "|%diff{sending $ to parameter of type $|"
8456  "sending to parameter of different type}0,1"
8457  "|%diff{casting $ to type $|casting between types}0,1}2"
8458  " discards qualifiers">,
8459  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8460def err_typecheck_convert_discards_qualifiers : Error<
8461  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8462  "|%diff{passing $ to parameter of type $|"
8463  "passing to parameter of different type}0,1"
8464  "|%diff{returning $ from a function with result type $|"
8465  "returning from function with different return type}0,1"
8466  "|%diff{converting $ to type $|converting between types}0,1"
8467  "|%diff{initializing $ with an expression of type $|"
8468  "initializing with expression of different type}0,1"
8469  "|%diff{sending $ to parameter of type $|"
8470  "sending to parameter of different type}0,1"
8471  "|%diff{casting $ to type $|casting between types}0,1}2"
8472  " discards qualifiers">;
8473def ext_nested_pointer_qualifier_mismatch : ExtWarn<
8474  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8475  "|%diff{passing $ to parameter of type $|"
8476  "passing to parameter of different type}0,1"
8477  "|%diff{returning $ from a function with result type $|"
8478  "returning from function with different return type}0,1"
8479  "|%diff{converting $ to type $|converting between types}0,1"
8480  "|%diff{initializing $ with an expression of type $|"
8481  "initializing with expression of different type}0,1"
8482  "|%diff{sending $ to parameter of type $|"
8483  "sending to parameter of different type}0,1"
8484  "|%diff{casting $ to type $|casting between types}0,1}2"
8485  " discards qualifiers in nested pointer types">,
8486  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8487def err_nested_pointer_qualifier_mismatch : Error<
8488  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8489  "|%diff{passing $ to parameter of type $|"
8490  "passing to parameter of different type}0,1"
8491  "|%diff{returning $ from a function with result type $|"
8492  "returning from function with different return type}0,1"
8493  "|%diff{converting $ to type $|converting between types}0,1"
8494  "|%diff{initializing $ with an expression of type $|"
8495  "initializing with expression of different type}0,1"
8496  "|%diff{sending $ to parameter of type $|"
8497  "sending to parameter of different type}0,1"
8498  "|%diff{casting $ to type $|casting between types}0,1}2"
8499  " discards qualifiers in nested pointer types">;
8500def warn_incompatible_vectors : Warning<
8501  "incompatible vector types "
8502  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8503  "|%diff{passing $ to parameter of type $|"
8504  "passing to parameter of different type}0,1"
8505  "|%diff{returning $ from a function with result type $|"
8506  "returning from function with different return type}0,1"
8507  "|%diff{converting $ to type $|converting between types}0,1"
8508  "|%diff{initializing $ with an expression of type $|"
8509  "initializing with expression of different type}0,1"
8510  "|%diff{sending $ to parameter of type $|"
8511  "sending to parameter of different type}0,1"
8512  "|%diff{casting $ to type $|casting between types}0,1}2">,
8513  InGroup<VectorConversion>, DefaultIgnore;
8514def err_incompatible_vectors : Error<
8515  "incompatible vector types "
8516  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8517  "|%diff{passing $ to parameter of type $|"
8518  "passing to parameter of different type}0,1"
8519  "|%diff{returning $ from a function with result type $|"
8520  "returning from function with different return type}0,1"
8521  "|%diff{converting $ to type $|converting between types}0,1"
8522  "|%diff{initializing $ with an expression of type $|"
8523  "initializing with expression of different type}0,1"
8524  "|%diff{sending $ to parameter of type $|"
8525  "sending to parameter of different type}0,1"
8526  "|%diff{casting $ to type $|casting between types}0,1}2">;
8527def err_int_to_block_pointer : Error<
8528  "invalid block pointer conversion "
8529  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8530  "|%diff{passing $ to parameter of type $|"
8531  "passing to parameter of different type}0,1"
8532  "|%diff{returning $ from a function with result type $|"
8533  "returning from function with different return type}0,1"
8534  "|%diff{converting $ to type $|converting between types}0,1"
8535  "|%diff{initializing $ with an expression of type $|"
8536  "initializing with expression of different type}0,1"
8537  "|%diff{sending $ to parameter of type $|"
8538  "sending to parameter of different type}0,1"
8539  "|%diff{casting $ to type $|casting between types}0,1}2">;
8540def err_typecheck_convert_incompatible_block_pointer : Error<
8541  "incompatible block pointer types "
8542  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8543  "|%diff{passing $ to parameter of type $|"
8544  "passing to parameter of different type}0,1"
8545  "|%diff{returning $ from a function with result type $|"
8546  "returning from function with different return type}0,1"
8547  "|%diff{converting $ to type $|converting between types}0,1"
8548  "|%diff{initializing $ with an expression of type $|"
8549  "initializing with expression of different type}0,1"
8550  "|%diff{sending $ to parameter of type $|"
8551  "sending to parameter of different type}0,1"
8552  "|%diff{casting $ to type $|casting between types}0,1}2">;
8553def err_typecheck_incompatible_address_space : Error<
8554  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8555  "|%diff{passing $ to parameter of type $|"
8556  "passing to parameter of different type}0,1"
8557  "|%diff{returning $ from a function with result type $|"
8558  "returning from function with different return type}0,1"
8559  "|%diff{converting $ to type $|converting between types}0,1"
8560  "|%diff{initializing $ with an expression of type $|"
8561  "initializing with expression of different type}0,1"
8562  "|%diff{sending $ to parameter of type $|"
8563  "sending to parameter of different type}0,1"
8564  "|%diff{casting $ to type $|casting between types}0,1}2"
8565  " changes address space of pointer">;
8566def err_typecheck_incompatible_nested_address_space : Error<
8567  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8568  "|%diff{passing $ to parameter of type $|"
8569  "passing to parameter of different type}0,1"
8570  "|%diff{returning $ from a function with result type $|"
8571  "returning from function with different return type}0,1"
8572  "|%diff{converting $ to type $|converting between types}0,1"
8573  "|%diff{initializing $ with an expression of type $|"
8574  "initializing with expression of different type}0,1"
8575  "|%diff{sending $ to parameter of type $|"
8576  "sending to parameter of different type}0,1"
8577  "|%diff{casting $ to type $|casting between types}0,1}2"
8578  " changes address space of nested pointer">;
8579def err_typecheck_incompatible_ownership : Error<
8580  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8581  "|%diff{passing $ to parameter of type $|"
8582  "passing to parameter of different type}0,1"
8583  "|%diff{returning $ from a function with result type $|"
8584  "returning from function with different return type}0,1"
8585  "|%diff{converting $ to type $|converting between types}0,1"
8586  "|%diff{initializing $ with an expression of type $|"
8587  "initializing with expression of different type}0,1"
8588  "|%diff{sending $ to parameter of type $|"
8589  "sending to parameter of different type}0,1"
8590  "|%diff{casting $ to type $|casting between types}0,1}2"
8591  " changes retain/release properties of pointer">;
8592def err_typecheck_comparison_of_distinct_blocks : Error<
8593  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
8594
8595def err_typecheck_array_not_modifiable_lvalue : Error<
8596  "array type %0 is not assignable">;
8597def err_typecheck_non_object_not_modifiable_lvalue : Error<
8598  "non-object type %0 is not assignable">;
8599def err_typecheck_expression_not_modifiable_lvalue : Error<
8600  "expression is not assignable">;
8601def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
8602  "incomplete type %0 is not assignable">;
8603def err_typecheck_lvalue_casts_not_supported : Error<
8604  "assignment to cast is illegal, lvalue casts are not supported">;
8605
8606def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
8607  "vector is not assignable (contains duplicate components)">;
8608def err_block_decl_ref_not_modifiable_lvalue : Error<
8609  "variable is not assignable (missing __block type specifier)">;
8610def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8611  "cannot assign to a variable captured by copy in a non-mutable lambda">;
8612def err_typecheck_call_not_function : Error<
8613  "called object type %0 is not a function or function pointer">;
8614def err_call_incomplete_return : Error<
8615  "calling function with incomplete return type %0">;
8616def err_call_function_incomplete_return : Error<
8617  "calling %0 with incomplete return type %1">;
8618def err_call_incomplete_argument : Error<
8619  "argument type %0 is incomplete">;
8620def err_typecheck_call_too_few_args : Error<
8621  "too few %select{|||execution configuration }0"
8622  "%select{|non-object }3arguments to "
8623  "%select{function|block|method|kernel function}0 call, "
8624  "expected %1, have %2">;
8625def err_typecheck_call_too_few_args_one : Error<
8626  "too few %select{|||execution configuration }0"
8627  "%select{|non-object }2arguments to "
8628  "%select{function|block|method|kernel function}0 call, "
8629  "single argument %1 was not specified">;
8630def err_typecheck_call_too_few_args_at_least : Error<
8631  "too few %select{|||execution configuration }0"
8632  "%select{|non-object }3arguments to "
8633  "%select{function|block|method|kernel function}0 call, "
8634  "expected at least %1, have %2">;
8635def err_typecheck_call_too_few_args_at_least_one : Error<
8636  "too few %select{|||execution configuration }0"
8637  "%select{|non-object }2arguments to "
8638  "%select{function|block|method|kernel function}0 call, "
8639  "at least argument %1 must be specified">;
8640def err_typecheck_call_too_few_args_suggest : Error<
8641  "too few %select{|||execution configuration }0"
8642  "%select{|non-object }3arguments to "
8643  "%select{function|block|method|kernel function}0 call, "
8644  "expected %1, have %2; did you mean %4?">;
8645def err_typecheck_call_too_few_args_at_least_suggest : Error<
8646  "too few %select{|||execution configuration }0"
8647  "%select{|non-object }3arguments to "
8648  "%select{function|block|method|kernel function}0 call, "
8649  "expected at least %1, have %2; did you mean %4?">;
8650def err_typecheck_call_too_many_args : Error<
8651  "too many %select{|||execution configuration }0"
8652  "%select{|non-object }3arguments to "
8653  "%select{function|block|method|kernel function}0 call, "
8654  "expected %1, have %2">;
8655def err_typecheck_call_too_many_args_one : Error<
8656  "too many %select{|||execution configuration }0"
8657  "%select{|non-object }3arguments to "
8658  "%select{function|block|method|kernel function}0 call, "
8659  "expected single argument %1, have %2 arguments">;
8660def err_typecheck_call_too_many_args_at_most : Error<
8661  "too many %select{|||execution configuration }0"
8662  "%select{|non-object }3arguments to "
8663  "%select{function|block|method|kernel function}0 call, "
8664  "expected at most %1, have %2">;
8665def err_typecheck_call_too_many_args_at_most_one : Error<
8666  "too many %select{|||execution configuration }0arguments to "
8667  "%select{function|block|method|kernel function}0 call, "
8668  "expected at most single %select{|non-object }3argument %1, "
8669  "have %2%select{|non-object}3 arguments">;
8670def err_typecheck_call_too_many_args_suggest : Error<
8671  "too many %select{|||execution configuration }0"
8672  "%select{|non-object }3arguments to "
8673  "%select{function|block|method|kernel function}0 call, "
8674  "expected %1, have %2; did you mean %4?">;
8675def err_typecheck_call_too_many_args_at_most_suggest : Error<
8676  "too many %select{|||execution configuration }0"
8677  "%select{|non-object }3arguments to "
8678  "%select{function|block|method|kernel function}0 call, "
8679  "expected at most %1, have %2; did you mean %4?">;
8680
8681def err_arc_typecheck_convert_incompatible_pointer : Error<
8682  "incompatible pointer types passing retainable parameter of type %0"
8683  "to a CF function expecting %1 type">;
8684
8685def err_builtin_fn_use : Error<"builtin functions must be directly called">;
8686
8687def warn_call_wrong_number_of_arguments : Warning<
8688  "too %select{few|many}0 arguments in call to %1">;
8689def err_atomic_builtin_must_be_pointer : Error<
8690  "address argument to atomic builtin must be a pointer (%0 invalid)">;
8691def err_atomic_builtin_must_be_pointer_intptr : Error<
8692  "address argument to atomic builtin must be a pointer to integer or pointer"
8693  " (%0 invalid)">;
8694def err_atomic_builtin_cannot_be_const : Error<
8695  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
8696def err_atomic_builtin_must_be_pointer_intfltptr : Error<
8697  "address argument to atomic builtin must be a pointer to integer,"
8698  " floating-point or pointer (%0 invalid)">;
8699def err_atomic_builtin_pointer_size : Error<
8700  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
8701  "type (%0 invalid)">;
8702def err_atomic_exclusive_builtin_pointer_size : Error<
8703  "address argument to load or store exclusive builtin must be a pointer to"
8704  " 1,2,4 or 8 byte type (%0 invalid)">;
8705def err_atomic_builtin_ext_int_size : Error<
8706  "Atomic memory operand must have a power-of-two size">;
8707def err_atomic_builtin_bit_int_prohibit : Error<
8708  "argument to atomic builtin of type '_BitInt' is not supported">;
8709def err_atomic_op_needs_atomic : Error<
8710  "address argument to atomic operation must be a pointer to _Atomic "
8711  "type (%0 invalid)">;
8712def err_atomic_op_needs_non_const_atomic : Error<
8713  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
8714  "type (%1 invalid)">;
8715def err_atomic_op_needs_non_const_pointer : Error<
8716  "address argument to atomic operation must be a pointer to non-const "
8717  "type (%0 invalid)">;
8718def err_atomic_op_needs_trivial_copy : Error<
8719  "address argument to atomic operation must be a pointer to a "
8720  "trivially-copyable type (%0 invalid)">;
8721def err_atomic_op_needs_atomic_int_ptr_or_fp : Error<
8722  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8723  "integer, pointer or supported floating point type (%1 invalid)">;
8724def err_atomic_op_needs_atomic_int_or_ptr : Error<
8725  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8726  "integer or pointer (%1 invalid)">;
8727def err_atomic_op_needs_atomic_int_or_fp : Error<
8728  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8729  "integer or supported floating point type (%1 invalid)">;
8730def err_atomic_op_needs_atomic_int : Error<
8731  "address argument to atomic operation must be a pointer to "
8732  "%select{|atomic }0integer (%1 invalid)">;
8733def warn_atomic_op_has_invalid_memory_order : Warning<
8734  "%select{|success |failure }0memory order argument to atomic operation is invalid">,
8735  InGroup<DiagGroup<"atomic-memory-ordering">>;
8736def err_atomic_op_has_invalid_synch_scope : Error<
8737  "synchronization scope argument to atomic operation is invalid">;
8738def warn_atomic_implicit_seq_cst : Warning<
8739  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
8740  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
8741
8742def err_overflow_builtin_must_be_int : Error<
8743  "operand argument to %select{overflow builtin|checked integer operation}0 "
8744  "must be an integer type %select{|other than plain 'char', 'bool', bit-precise, "
8745  "or an enumeration }0(%1 invalid)">;
8746def err_overflow_builtin_must_be_ptr_int : Error<
8747  "result argument to %select{overflow builtin|checked integer operation}0 "
8748  "must be a pointer to a non-const integer type %select{|other than plain 'char', "
8749  "'bool', bit-precise, or an enumeration }0(%1 invalid)">;
8750def err_overflow_builtin_bit_int_max_size : Error<
8751  "__builtin_mul_overflow does not support 'signed _BitInt' operands of more "
8752  "than %0 bits">;
8753def err_expected_struct_pointer_argument : Error<
8754  "expected pointer to struct as %ordinal0 argument to %1, found %2">;
8755def err_expected_callable_argument : Error<
8756  "expected a callable expression as %ordinal0 argument to %1, found %2">;
8757def note_building_builtin_dump_struct_call : Note<
8758  "in call to printing function with arguments '(%0)' while dumping struct">;
8759
8760def err_atomic_load_store_uses_lib : Error<
8761  "atomic %select{load|store}0 requires runtime support that is not "
8762  "available for this target">;
8763
8764def err_nontemporal_builtin_must_be_pointer : Error<
8765  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
8766def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
8767  "address argument to nontemporal builtin must be a pointer to integer, float, "
8768  "pointer, or a vector of such types (%0 invalid)">;
8769
8770def err_deleted_function_use : Error<"attempt to use a deleted function">;
8771def err_deleted_inherited_ctor_use : Error<
8772  "constructor inherited by %0 from base class %1 is implicitly deleted">;
8773
8774def note_called_by : Note<"called by %0">;
8775def err_kern_type_not_void_return : Error<
8776  "kernel function type %0 must have void return type">;
8777def err_kern_is_nonstatic_method : Error<
8778  "kernel function %0 must be a free function or static member function">;
8779def err_config_scalar_return : Error<
8780  "CUDA special function '%0' must have scalar return type">;
8781def err_kern_call_not_global_function : Error<
8782  "kernel call to non-global function %0">;
8783def err_global_call_not_config : Error<
8784  "call to global function %0 not configured">;
8785def err_ref_bad_target : Error<
8786  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8787  "%select{function|variable}1 %2 in %select{__device__|__global__|__host__|__host__ __device__}3 function">;
8788def note_cuda_const_var_unpromoted : Note<
8789  "const variable cannot be emitted on device side due to dynamic initialization">;
8790def note_cuda_host_var : Note<
8791  "host variable declared here">;
8792def err_ref_bad_target_global_initializer : Error<
8793  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8794  "function %1 in global initializer">;
8795def err_capture_bad_target : Error<
8796  "capture host variable %0 by reference in device or host device lambda function">;
8797def warn_maybe_capture_bad_target_this_ptr : Warning<
8798  "capture host side class data member by this pointer in device or host device lambda function "
8799  "may result in invalid memory access if this pointer is not accessible on device side">,
8800  InGroup<DiagGroup<"gpu-maybe-wrong-side">>;
8801def warn_kern_is_method : Extension<
8802  "kernel function %0 is a member function; this may not be accepted by nvcc">,
8803  InGroup<CudaCompat>;
8804def warn_kern_is_inline : Warning<
8805  "ignored 'inline' attribute on kernel function %0">,
8806  InGroup<CudaCompat>;
8807def err_variadic_device_fn : Error<
8808  "CUDA device code does not support variadic functions">;
8809def err_va_arg_in_device : Error<
8810"CUDA device code does not support va_arg">;
8811def err_alias_not_supported_on_nvptx : Error<"CUDA older than 10.0 does not support .alias">;
8812def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8813  "constexpr function %0 without __host__ or __device__ attributes cannot "
8814  "overload __device__ function with same signature.  Add a __host__ "
8815  "attribute, or build with -fno-cuda-host-device-constexpr.">;
8816def note_cuda_conflicting_device_function_declared_here : Note<
8817  "conflicting __device__ function declared here">;
8818def err_cuda_device_exceptions : Error<
8819  "cannot use '%0' in "
8820  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8821def err_dynamic_var_init : Error<
8822    "dynamic initialization is not supported for "
8823    "__device__, __constant__, __shared__, and __managed__ variables.">;
8824def err_shared_var_init : Error<
8825    "initialization is not supported for __shared__ variables.">;
8826def err_cuda_vla : Error<
8827    "cannot use variable-length arrays in "
8828    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8829def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8830def err_cuda_host_shared : Error<
8831    "__shared__ local variables not allowed in "
8832    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8833def err_cuda_nonstatic_constdev: Error<"__constant__, __device__, and "
8834    "__managed__ are not allowed on non-static local variables">;
8835def err_cuda_ovl_target : Error<
8836  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8837  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8838def note_cuda_ovl_candidate_target_mismatch : Note<
8839    "candidate template ignored: target attributes do not match">;
8840
8841def err_cuda_device_builtin_surftex_cls_template : Error<
8842    "illegal device builtin %select{surface|texture}0 reference "
8843    "class template %1 declared here">;
8844def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8845    "%0 needs to have exactly %1 template parameters">;
8846def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8847    "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8848    "%select{a type|an integer or enum value}2">;
8849
8850def err_cuda_device_builtin_surftex_ref_decl : Error<
8851    "illegal device builtin %select{surface|texture}0 reference "
8852    "type %1 declared here">;
8853def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8854    "%0 needs to be instantiated from a class template with proper "
8855    "template arguments">;
8856
8857def err_hip_invalid_args_builtin_mangled_name : Error<
8858    "invalid argument: symbol must be a device-side function or global variable">;
8859
8860def warn_hip_omp_target_directives : Warning<
8861  "HIP does not support OpenMP target directives; directive has been ignored">,
8862  InGroup<HIPOpenMPOffloading>, DefaultError;
8863
8864def warn_non_pod_vararg_with_format_string : Warning<
8865  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8866  "%select{function|block|method|constructor}2; expected type from format "
8867  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8868// The arguments to this diagnostic should match the warning above.
8869def err_cannot_pass_objc_interface_to_vararg_format : Error<
8870  "cannot pass object with interface type %1 by value to variadic "
8871  "%select{function|block|method|constructor}2; expected type from format "
8872  "string was %3">;
8873def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8874  "cannot pass non-trivial C object of type %0 by value to variadic "
8875  "%select{function|block|method|constructor}1">;
8876
8877
8878def err_cannot_pass_objc_interface_to_vararg : Error<
8879  "cannot pass object with interface type %0 by value through variadic "
8880  "%select{function|block|method|constructor}1">;
8881def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8882  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8883  " %select{function|block|method|constructor}2; call will abort at runtime">,
8884  InGroup<NonPODVarargs>, DefaultError;
8885def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8886  "passing object of trivial but non-POD type %0 through variadic"
8887  " %select{function|block|method|constructor}1 is incompatible with C++98">,
8888  InGroup<CXX98Compat>, DefaultIgnore;
8889def warn_pass_class_arg_to_vararg : Warning<
8890  "passing object of class type %0 through variadic "
8891  "%select{function|block|method|constructor}1"
8892  "%select{|; did you mean to call '%3'?}2">,
8893  InGroup<ClassVarargs>, DefaultIgnore;
8894def err_cannot_pass_to_vararg : Error<
8895  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8896  "%select{function|block|method|constructor}2">;
8897def err_cannot_pass_to_vararg_format : Error<
8898  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8899  "%select{function|block|method|constructor}2; expected type from format "
8900  "string was %3">;
8901
8902def err_typecheck_call_invalid_ordered_compare : Error<
8903  "ordered compare requires two args of floating point type"
8904  "%diff{ ($ and $)|}0,1">;
8905def err_typecheck_call_invalid_unary_fp : Error<
8906  "floating point classification requires argument of floating point type "
8907  "(passed in %0)">;
8908def err_typecheck_cond_expect_int_float : Error<
8909  "used type %0 where integer or floating point type is required">;
8910def err_typecheck_cond_expect_scalar : Error<
8911  "used type %0 where arithmetic or pointer type is required">;
8912def err_typecheck_cond_expect_nonfloat : Error<
8913  "used type %0 where floating point type is not allowed">;
8914def ext_typecheck_cond_one_void : Extension<
8915  "C99 forbids conditional expressions with only one void side">;
8916def err_typecheck_cast_to_incomplete : Error<
8917  "cast to incomplete type %0">;
8918def ext_typecheck_cast_nonscalar : Extension<
8919  "C99 forbids casting nonscalar type %0 to the same type">;
8920def ext_typecheck_cast_to_union : Extension<
8921  "cast to union type is a GNU extension">,
8922  InGroup<GNUUnionCast>;
8923def err_typecheck_cast_to_union_no_type : Error<
8924  "cast to union type from type %0 not present in union">;
8925def err_cast_pointer_from_non_pointer_int : Error<
8926  "operand of type %0 cannot be cast to a pointer type">;
8927def warn_cast_pointer_from_sel : Warning<
8928  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8929  InGroup<SelTypeCast>;
8930def warn_function_def_in_objc_container : Warning<
8931  "function definition inside an Objective-C container is deprecated">,
8932  InGroup<FunctionDefInObjCContainer>;
8933def err_typecheck_call_requires_real_fp : Error<
8934  "argument type %0 is not a real floating point type">;
8935def err_typecheck_call_different_arg_types : Error<
8936  "arguments are of different types%diff{ ($ vs $)|}0,1">;
8937
8938def warn_cast_calling_conv : Warning<
8939  "cast between incompatible calling conventions '%0' and '%1'; "
8940  "calls through this pointer may abort at runtime">,
8941  InGroup<DiagGroup<"cast-calling-convention">>;
8942def note_change_calling_conv_fixit : Note<
8943  "consider defining %0 with the '%1' calling convention">;
8944def warn_bad_function_cast : Warning<
8945  "cast from function call of type %0 to non-matching type %1">,
8946  InGroup<BadFunctionCast>, DefaultIgnore;
8947def warn_cast_function_type : Warning<
8948  "cast %diff{from $ to $ |}0,1converts to incompatible function type">,
8949  InGroup<CastFunctionType>, DefaultIgnore;
8950def warn_cast_function_type_strict : Warning<warn_cast_function_type.Summary>,
8951  InGroup<CastFunctionTypeStrict>, DefaultIgnore;
8952def err_cast_pointer_to_non_pointer_int : Error<
8953  "pointer cannot be cast to type %0">;
8954def err_nullptr_cast : Error<
8955  "cannot cast an object of type %select{'nullptr_t' to %1|%1 to 'nullptr_t'}0"
8956>;
8957def err_typecheck_expect_scalar_operand : Error<
8958  "operand of type %0 where arithmetic or pointer type is required">;
8959def err_typecheck_cond_incompatible_operands : Error<
8960  "incompatible operand types%diff{ ($ and $)|}0,1">;
8961def err_typecheck_expect_flt_or_vector : Error<
8962  "invalid operand of type %0 where floating, complex or "
8963  "a vector of such types is required">;
8964def err_cast_selector_expr : Error<
8965  "cannot type cast @selector expression">;
8966def err_make_signed_integral_only : Error<
8967  "'%select{make_unsigned|make_signed}0' is only compatible with "
8968  "non-%select{bool|_BitInt(1)}1 integers and enum types, but was given "
8969  "%2%select{| whose underlying type is %4}3">;
8970def ext_typecheck_cond_incompatible_pointers : ExtWarn<
8971  "pointer type mismatch%diff{ ($ and $)|}0,1">,
8972  InGroup<DiagGroup<"pointer-type-mismatch">>;
8973def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
8974  "pointer/integer type mismatch in conditional expression"
8975  "%diff{ ($ and $)|}0,1">,
8976  InGroup<DiagGroup<"conditional-type-mismatch">>;
8977def err_typecheck_choose_expr_requires_constant : Error<
8978  "'__builtin_choose_expr' requires a constant expression">;
8979def warn_unused_expr : Warning<"expression result unused">,
8980  InGroup<UnusedValue>;
8981def warn_unused_comma_left_operand : Warning<
8982  "left operand of comma operator has no effect">,
8983  InGroup<UnusedValue>;
8984def warn_unused_voidptr : Warning<
8985  "expression result unused; should this cast be to 'void'?">,
8986  InGroup<UnusedValue>;
8987def warn_unused_property_expr : Warning<
8988 "property access result unused - getters should not be used for side effects">,
8989  InGroup<UnusedGetterReturnValue>;
8990def warn_unused_container_subscript_expr : Warning<
8991 "container access result unused - container access should not be used for side effects">,
8992  InGroup<UnusedValue>;
8993def warn_unused_call : Warning<
8994  "ignoring return value of function declared with %0 attribute">,
8995  InGroup<UnusedValue>;
8996def warn_unused_constructor : Warning<
8997  "ignoring temporary created by a constructor declared with %0 attribute">,
8998  InGroup<UnusedValue>;
8999def warn_unused_constructor_msg : Warning<
9000  "ignoring temporary created by a constructor declared with %0 attribute: %1">,
9001  InGroup<UnusedValue>;
9002def warn_side_effects_unevaluated_context : Warning<
9003  "expression with side effects has no effect in an unevaluated context">,
9004  InGroup<UnevaluatedExpression>;
9005def warn_side_effects_typeid : Warning<
9006  "expression with side effects will be evaluated despite being used as an "
9007  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
9008def warn_unused_result : Warning<
9009  "ignoring return value of function declared with %0 attribute">,
9010  InGroup<UnusedResult>;
9011def warn_unused_result_msg : Warning<
9012  "ignoring return value of function declared with %0 attribute: %1">,
9013  InGroup<UnusedResult>;
9014def warn_unused_result_typedef_unsupported_spelling : Warning<
9015  "'[[%select{nodiscard|gnu::warn_unused_result}0]]' attribute ignored when "
9016  "applied to a typedef; consider using '__attribute__((warn_unused_result))' "
9017  "or '[[clang::warn_unused_result]]' instead">, InGroup<IgnoredAttributes>;
9018def warn_unused_volatile : Warning<
9019  "expression result unused; assign into a variable to force a volatile load">,
9020  InGroup<DiagGroup<"unused-volatile-lvalue">>;
9021
9022def ext_cxx14_attr : Extension<
9023  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14Attrs>;
9024def ext_cxx17_attr : Extension<
9025  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17Attrs>;
9026def ext_cxx20_attr : Extension<
9027  "use of the %0 attribute is a C++20 extension">, InGroup<CXX20Attrs>;
9028
9029def warn_unused_comparison : Warning<
9030  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
9031  InGroup<UnusedComparison>;
9032def note_inequality_comparison_to_or_assign : Note<
9033  "use '|=' to turn this inequality comparison into an or-assignment">;
9034
9035def err_incomplete_type_used_in_type_trait_expr : Error<
9036  "incomplete type %0 used in type trait expression">;
9037
9038// C++20 constinit and require_constant_initialization attribute
9039def warn_cxx20_compat_constinit : Warning<
9040  "'constinit' specifier is incompatible with C++ standards before C++20">,
9041  InGroup<CXX20Compat>, DefaultIgnore;
9042def err_constinit_local_variable : Error<
9043  "local variable cannot be declared 'constinit'">;
9044def err_require_constant_init_failed : Error<
9045  "variable does not have a constant initializer">;
9046def note_declared_required_constant_init_here : Note<
9047  "required by %select{'require_constant_initialization' attribute|"
9048  "'constinit' specifier}0 here">;
9049def ext_constinit_missing : ExtWarn<
9050  "'constinit' specifier missing on initializing declaration of %0">,
9051  InGroup<DiagGroup<"missing-constinit">>;
9052def note_constinit_specified_here : Note<"variable declared constinit here">;
9053def err_constinit_added_too_late : Error<
9054  "'constinit' specifier added after initialization of variable">;
9055def warn_require_const_init_added_too_late : Warning<
9056  "'require_constant_initialization' attribute added after initialization "
9057  "of variable">, InGroup<IgnoredAttributes>;
9058def note_constinit_missing_here : Note<
9059  "add the "
9060  "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
9061  "to the initializing declaration here">;
9062
9063def err_dimension_expr_not_constant_integer : Error<
9064  "dimension expression does not evaluate to a constant unsigned int">;
9065
9066def err_typecheck_cond_incompatible_operands_null : Error<
9067  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
9068def ext_empty_struct_union : Extension<
9069  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
9070def ext_no_named_members_in_struct_union : Extension<
9071  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
9072def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
9073  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
9074  InGroup<CXXCompat>, DefaultIgnore;
9075def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
9076  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
9077  InGroup<ExternCCompat>;
9078def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
9079  "volatile qualifiers|const qualifier|volatile qualifier}2">,
9080  InGroup<CastQual>, DefaultIgnore;
9081def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
9082  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
9083def warn_redefine_extname_not_applied : Warning<
9084  "#pragma redefine_extname is applicable to external C declarations only; "
9085  "not applied to %select{function|variable}0 %1">,
9086  InGroup<Pragmas>;
9087} // End of general sema category.
9088
9089// inline asm.
9090let CategoryName = "Inline Assembly Issue" in {
9091  def err_asm_pmf_through_constraint_not_permitted
9092    : Error<"cannot pass a pointer-to-member through register-constrained "
9093            "inline assembly parameter">;
9094  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
9095  def err_asm_invalid_output_constraint : Error<
9096    "invalid output constraint '%0' in asm">;
9097  def err_asm_invalid_lvalue_in_input : Error<
9098    "invalid lvalue in asm input for constraint '%0'">;
9099  def err_asm_invalid_input_constraint : Error<
9100    "invalid input constraint '%0' in asm">;
9101  def err_asm_tying_incompatible_types : Error<
9102    "unsupported inline asm: input with type "
9103    "%diff{$ matching output with type $|}0,1">;
9104  def err_asm_unexpected_constraint_alternatives : Error<
9105    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
9106  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
9107  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
9108  def err_asm_unwind_and_goto : Error<"unwind clobber can't be used with asm goto">;
9109  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
9110    "global register variables on this target">;
9111  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
9112    "match variable size">;
9113  def err_asm_bad_register_type : Error<"bad type for named register variable">;
9114  def err_asm_invalid_input_size : Error<
9115    "invalid input size for constraint '%0'">;
9116  def err_asm_invalid_output_size : Error<
9117    "invalid output size for constraint '%0'">;
9118  def err_invalid_asm_cast_lvalue : Error<
9119    "invalid use of a cast in a inline asm context requiring an lvalue: "
9120    "remove the cast or build with -fheinous-gnu-extensions">;
9121  def err_invalid_asm_value_for_constraint
9122      : Error <"value '%0' out of range for constraint '%1'">;
9123  def err_asm_non_addr_value_in_memory_constraint : Error <
9124    "reference to a %select{bit-field|vector element|global register variable}0"
9125    " in asm %select{input|output}1 with a memory constraint '%2'">;
9126  def err_asm_input_duplicate_match : Error<
9127    "more than one input constraint matches the same output '%0'">;
9128  def err_store_value_to_reg : Error<
9129    "impossible constraint in asm: can't store value into a register">;
9130
9131  def warn_asm_label_on_auto_decl : Warning<
9132    "ignored asm label '%0' on automatic variable">;
9133  def warn_invalid_asm_cast_lvalue : Warning<
9134    "invalid use of a cast in an inline asm context requiring an lvalue: "
9135    "accepted due to -fheinous-gnu-extensions, but clang may remove support "
9136    "for this in the future">;
9137  def warn_asm_mismatched_size_modifier : Warning<
9138    "value size does not match register size specified by the constraint "
9139    "and modifier">,
9140    InGroup<ASMOperandWidths>;
9141
9142  def note_asm_missing_constraint_modifier : Note<
9143    "use constraint modifier \"%0\"">;
9144  def note_asm_input_duplicate_first : Note<
9145    "constraint '%0' is already present here">;
9146 def error_duplicate_asm_operand_name : Error<
9147    "duplicate use of asm operand name \"%0\"">;
9148 def note_duplicate_asm_operand_name : Note<
9149    "asm operand name \"%0\" first referenced here">;
9150}
9151
9152  def error_inoutput_conflict_with_clobber : Error<
9153    "asm-specifier for input or output variable conflicts with asm"
9154    " clobber list">;
9155
9156let CategoryName = "Semantic Issue" in {
9157
9158def err_invalid_conversion_between_matrixes : Error<
9159  "conversion between matrix types%diff{ $ and $|}0,1 of different size is not allowed">;
9160
9161def err_invalid_conversion_between_matrix_and_type : Error<
9162  "conversion between matrix type %0 and incompatible type %1 is not allowed">;
9163
9164def err_invalid_conversion_between_vectors : Error<
9165  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
9166  "size">;
9167def err_invalid_conversion_between_vector_and_integer : Error<
9168  "invalid conversion between vector type %0 and integer type %1 "
9169  "of different size">;
9170
9171def err_opencl_function_pointer : Error<
9172  "%select{pointers|references}0 to functions are not allowed">;
9173
9174def err_opencl_taking_address_capture : Error<
9175  "taking address of a capture is not allowed">;
9176
9177def err_invalid_conversion_between_vector_and_scalar : Error<
9178  "invalid conversion between vector type %0 and scalar type %1">;
9179
9180// C++ member initializers.
9181def err_only_constructors_take_base_inits : Error<
9182  "only constructors take base initializers">;
9183
9184def err_multiple_mem_initialization : Error <
9185  "multiple initializations given for non-static member %0">;
9186def err_multiple_mem_union_initialization : Error <
9187  "initializing multiple members of union">;
9188def err_multiple_base_initialization : Error <
9189  "multiple initializations given for base %0">;
9190
9191def err_mem_init_not_member_or_class : Error<
9192  "member initializer %0 does not name a non-static data member or base "
9193  "class">;
9194
9195def warn_initializer_out_of_order : Warning<
9196  "%select{field|base class}0 %1 will be initialized after "
9197  "%select{field|base}2 %3">,
9198  InGroup<ReorderCtor>, DefaultIgnore;
9199
9200def warn_some_initializers_out_of_order : Warning<
9201  "initializer order does not match the declaration order">,
9202  InGroup<ReorderCtor>, DefaultIgnore;
9203
9204def note_initializer_out_of_order : Note<
9205  "%select{field|base class}0 %1 will be initialized after "
9206  "%select{field|base}2 %3">;
9207
9208def warn_abstract_vbase_init_ignored : Warning<
9209  "initializer for virtual base class %0 of abstract class %1 "
9210  "will never be used">,
9211  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
9212
9213def err_base_init_does_not_name_class : Error<
9214  "constructor initializer %0 does not name a class">;
9215def err_base_init_direct_and_virtual : Error<
9216  "base class initializer %0 names both a direct base class and an "
9217  "inherited virtual base class">;
9218def err_not_direct_base_or_virtual : Error<
9219  "type %0 is not a direct or virtual base of %1">;
9220
9221def err_in_class_initializer_non_const : Error<
9222  "non-const static data member must be initialized out of line">;
9223def err_in_class_initializer_volatile : Error<
9224  "static const volatile data member must be initialized out of line">;
9225def err_in_class_initializer_bad_type : Error<
9226  "static data member of type %0 must be initialized out of line">;
9227def ext_in_class_initializer_float_type : ExtWarn<
9228  "in-class initializer for static data member of type %0 is a GNU extension">,
9229  InGroup<GNUStaticFloatInit>;
9230def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
9231  "in-class initializer for static data member of type %0 requires "
9232  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
9233def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
9234def err_in_class_initializer_literal_type : Error<
9235  "in-class initializer for static data member of type %0 requires "
9236  "'constexpr' specifier">;
9237def err_in_class_initializer_non_constant : Error<
9238  "in-class initializer for static data member is not a constant expression">;
9239def err_default_member_initializer_not_yet_parsed : Error<
9240  "default member initializer for %1 needed within definition of enclosing "
9241  "class %0 outside of member functions">;
9242def note_default_member_initializer_not_yet_parsed : Note<
9243  "default member initializer declared here">;
9244def err_default_member_initializer_cycle
9245    : Error<"default member initializer for %0 uses itself">;
9246
9247def ext_in_class_initializer_non_constant : Extension<
9248  "in-class initializer for static data member is not a constant expression; "
9249  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
9250
9251def err_thread_dynamic_init : Error<
9252  "initializer for thread-local variable must be a constant expression">;
9253def err_thread_nontrivial_dtor : Error<
9254  "type of thread-local variable has non-trivial destruction">;
9255def note_use_thread_local : Note<
9256  "use 'thread_local' to allow this">;
9257
9258// C++ anonymous unions and GNU anonymous structs/unions
9259def ext_anonymous_union : Extension<
9260  "anonymous unions are a C11 extension">, InGroup<C11>;
9261def ext_gnu_anonymous_struct : Extension<
9262  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
9263def ext_c11_anonymous_struct : Extension<
9264  "anonymous structs are a C11 extension">, InGroup<C11>;
9265def err_anonymous_union_not_static : Error<
9266  "anonymous unions at namespace or global scope must be declared 'static'">;
9267def err_anonymous_union_with_storage_spec : Error<
9268  "anonymous union at class scope must not have a storage specifier">;
9269def err_anonymous_struct_not_member : Error<
9270  "anonymous %select{structs|structs and classes}0 must be "
9271  "%select{struct or union|class}0 members">;
9272def err_anonymous_record_member_redecl : Error<
9273  "member of anonymous %select{struct|union}0 redeclares %1">;
9274def err_anonymous_record_with_type : Error<
9275  "types cannot be declared in an anonymous %select{struct|union}0">;
9276def ext_anonymous_record_with_type : Extension<
9277  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
9278  "extension">, InGroup<MicrosoftAnonTag>;
9279def ext_anonymous_record_with_anonymous_type : Extension<
9280  "anonymous types declared in an anonymous %select{struct|union}0 "
9281  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
9282def err_anonymous_record_with_function : Error<
9283  "functions cannot be declared in an anonymous %select{struct|union}0">;
9284def err_anonymous_record_with_static : Error<
9285  "static members cannot be declared in an anonymous %select{struct|union}0">;
9286def err_anonymous_record_bad_member : Error<
9287  "anonymous %select{struct|union}0 can only contain non-static data members">;
9288def err_anonymous_record_nonpublic_member : Error<
9289  "anonymous %select{struct|union}0 cannot contain a "
9290  "%select{private|protected}1 data member">;
9291def ext_ms_anonymous_record : ExtWarn<
9292  "anonymous %select{structs|unions}0 are a Microsoft extension">,
9293  InGroup<MicrosoftAnonTag>;
9294
9295// C++ local classes
9296def err_reference_to_local_in_enclosing_context : Error<
9297  "reference to local %select{variable|binding}1 %0 declared in enclosing "
9298  "%select{%3|block literal|lambda expression|context}2">;
9299def err_capture_binding_openmp : Error<
9300  "capturing a structured binding is not yet supported in OpenMP">;
9301def ext_capture_binding : ExtWarn<
9302  "captured structured bindings are a C++20 extension">, InGroup<CXX20>;
9303def warn_cxx17_compat_capture_binding : Warning<
9304  "captured structured bindings are incompatible with "
9305  "C++ standards before C++20">,
9306  InGroup<CXXPre20Compat>, DefaultIgnore;
9307
9308def err_static_data_member_not_allowed_in_local_class : Error<
9309  "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
9310
9311// C++ derived classes
9312def err_base_clause_on_union : Error<"unions cannot have base classes">;
9313def err_base_must_be_class : Error<"base specifier must name a class">;
9314def err_union_as_base_class : Error<"unions cannot be base classes">;
9315def err_circular_inheritance : Error<
9316  "circular inheritance between %0 and %1">;
9317def err_base_class_has_flexible_array_member : Error<
9318  "base class %0 has a flexible array member">;
9319def err_incomplete_base_class : Error<"base class has incomplete type">;
9320def err_duplicate_base_class : Error<
9321  "base class %0 specified more than once as a direct base class">;
9322def warn_inaccessible_base_class : Warning<
9323  "direct base %0 is inaccessible due to ambiguity:%1">,
9324  InGroup<DiagGroup<"inaccessible-base">>;
9325// FIXME: better way to display derivation?  Pass entire thing into diagclient?
9326def err_ambiguous_derived_to_base_conv : Error<
9327  "ambiguous conversion from derived class %0 to base class %1:%2">;
9328def err_ambiguous_memptr_conv : Error<
9329  "ambiguous conversion from pointer to member of %select{base|derived}0 "
9330  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
9331def ext_ms_ambiguous_direct_base : ExtWarn<
9332  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
9333  InGroup<MicrosoftInaccessibleBase>;
9334
9335def err_memptr_conv_via_virtual : Error<
9336  "conversion from pointer to member of class %0 to pointer to member "
9337  "of class %1 via virtual base %2 is not allowed">;
9338
9339// C++ member name lookup
9340def err_ambiguous_member_multiple_subobjects : Error<
9341  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
9342def err_ambiguous_member_multiple_subobject_types : Error<
9343  "member %0 found in multiple base classes of different types">;
9344def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
9345def note_ambiguous_member_type_found : Note<
9346  "member type %0 found by ambiguous name lookup">;
9347def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
9348def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
9349def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
9350  "declaration in a different namespace">;
9351def note_hidden_tag : Note<"type declaration hidden">;
9352def note_hiding_object : Note<"declaration hides type">;
9353
9354// C++ operator overloading
9355def err_operator_overload_needs_class_or_enum : Error<
9356  "overloaded %0 must have at least one parameter of class "
9357  "or enumeration type">;
9358
9359def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
9360def warn_cxx20_compat_operator_overload_static : Warning<
9361  "declaring overloaded %0 as 'static' is incompatible with C++ standards "
9362  "before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
9363def ext_operator_overload_static : ExtWarn<
9364  "declaring overloaded %0 as 'static' is a C++23 extension">, InGroup<CXX23>;
9365def err_operator_overload_static : Error<
9366  "overloaded %0 cannot be a static member function">;
9367def err_operator_overload_default_arg : Error<
9368  "parameter of overloaded %0 cannot have a default argument">;
9369
9370def ext_subscript_overload : Warning<
9371  "overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a "
9372  "C++23 extension">, InGroup<CXXPre23Compat>, DefaultIgnore;
9373def error_subscript_overload : Error<
9374  "overloaded %0 cannot have %select{no|a defaulted|more than one}1 parameter before C++23">;
9375
9376def err_operator_overload_must_be : Error<
9377  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
9378  "(has %1 parameter%s1)">;
9379
9380def err_operator_overload_must_be_member : Error<
9381  "overloaded %0 must be a non-static member function">;
9382def err_operator_overload_post_incdec_must_be_int : Error<
9383  "parameter of overloaded post-%select{increment|decrement}1 operator must "
9384  "have type 'int' (not %0)">;
9385
9386// C++ allocation and deallocation functions.
9387def err_operator_new_delete_declared_in_namespace : Error<
9388  "%0 cannot be declared inside a namespace">;
9389def err_operator_new_delete_declared_static : Error<
9390  "%0 cannot be declared static in global scope">;
9391def ext_operator_new_delete_declared_inline : ExtWarn<
9392  "replacement function %0 cannot be declared 'inline'">,
9393  InGroup<DiagGroup<"inline-new-delete">>;
9394def err_operator_new_delete_invalid_result_type : Error<
9395  "%0 must return type %1">;
9396def err_operator_new_delete_dependent_result_type : Error<
9397  "%0 cannot have a dependent return type; use %1 instead">;
9398def err_operator_new_delete_too_few_parameters : Error<
9399  "%0 must have at least one parameter">;
9400def err_operator_new_delete_template_too_few_parameters : Error<
9401  "%0 template must have at least two parameters">;
9402def warn_operator_new_returns_null : Warning<
9403  "%0 should not return a null pointer unless it is declared 'throw()'"
9404  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
9405
9406def err_operator_new_dependent_param_type : Error<
9407  "%0 cannot take a dependent type as first parameter; "
9408  "use size_t (%1) instead">;
9409def err_operator_new_param_type : Error<
9410  "%0 takes type size_t (%1) as first parameter">;
9411def err_operator_new_default_arg: Error<
9412  "parameter of %0 cannot have a default argument">;
9413def err_operator_delete_dependent_param_type : Error<
9414  "%0 cannot take a dependent type as first parameter; use %1 instead">;
9415def err_operator_delete_param_type : Error<
9416  "first parameter of %0 must have type %1">;
9417def err_destroying_operator_delete_not_usual : Error<
9418  "destroying operator delete can have only an optional size and optional "
9419  "alignment parameter">;
9420def note_implicit_delete_this_in_destructor_here : Note<
9421  "while checking implicit 'delete this' for virtual destructor">;
9422def err_builtin_operator_new_delete_not_usual : Error<
9423  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
9424  "selects non-usual %select{allocation|deallocation}0 function">;
9425def note_non_usual_function_declared_here : Note<
9426  "non-usual %0 declared here">;
9427
9428// C++ literal operators
9429def err_literal_operator_outside_namespace : Error<
9430  "literal operator %0 must be in a namespace or global scope">;
9431def err_literal_operator_id_outside_namespace : Error<
9432  "non-namespace scope '%0' cannot have a literal operator member">;
9433def err_literal_operator_default_argument : Error<
9434  "literal operator cannot have a default argument">;
9435def err_literal_operator_bad_param_count : Error<
9436  "non-template literal operator must have one or two parameters">;
9437def err_literal_operator_invalid_param : Error<
9438  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
9439def err_literal_operator_param : Error<
9440  "invalid literal operator parameter type %0, did you mean %1?">;
9441def err_literal_operator_template_with_params : Error<
9442  "literal operator template cannot have any parameters">;
9443def err_literal_operator_template : Error<
9444  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
9445def err_literal_operator_extern_c : Error<
9446  "literal operator must have C++ linkage">;
9447def ext_string_literal_operator_template : ExtWarn<
9448  "string literal operator templates are a GNU extension">,
9449  InGroup<GNUStringLiteralOperatorTemplate>;
9450def warn_user_literal_reserved : Warning<
9451  "user-defined literal suffixes %select{<ERROR>|not starting with '_'|containing '__'}0 are reserved"
9452  "%select{; no literal will invoke this operator|}1">,
9453  InGroup<UserDefinedLiterals>;
9454
9455// C++ conversion functions
9456def err_conv_function_not_member : Error<
9457  "conversion function must be a non-static member function">;
9458def err_conv_function_return_type : Error<
9459  "conversion function cannot have a return type">;
9460def err_conv_function_with_params : Error<
9461  "conversion function cannot have any parameters">;
9462def err_conv_function_variadic : Error<
9463  "conversion function cannot be variadic">;
9464def err_conv_function_to_array : Error<
9465  "conversion function cannot convert to an array type">;
9466def err_conv_function_to_function : Error<
9467  "conversion function cannot convert to a function type">;
9468def err_conv_function_with_complex_decl : Error<
9469  "cannot specify any part of a return type in the "
9470  "declaration of a conversion function"
9471  "%select{"
9472  "; put the complete type after 'operator'|"
9473  "; use a typedef to declare a conversion to %1|"
9474  "; use an alias template to declare a conversion to %1|"
9475  "}0">;
9476def err_conv_function_redeclared : Error<
9477  "conversion function cannot be redeclared">;
9478def warn_conv_to_self_not_used : Warning<
9479  "conversion function converting %0 to itself will never be used">,
9480  InGroup<ClassConversion>;
9481def warn_conv_to_base_not_used : Warning<
9482  "conversion function converting %0 to its base class %1 will never be used">,
9483  InGroup<ClassConversion>;
9484def warn_conv_to_void_not_used : Warning<
9485  "conversion function converting %0 to %1 will never be used">,
9486  InGroup<ClassConversion>;
9487
9488def warn_not_compound_assign : Warning<
9489  "use of unary operator that may be intended as compound assignment (%0=)">;
9490
9491// C++11 explicit conversion operators
9492def ext_explicit_conversion_functions : ExtWarn<
9493  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
9494def warn_cxx98_compat_explicit_conversion_functions : Warning<
9495  "explicit conversion functions are incompatible with C++98">,
9496  InGroup<CXX98Compat>, DefaultIgnore;
9497
9498// C++11 defaulted functions
9499def err_defaulted_special_member_params : Error<
9500  "an explicitly-defaulted %sub{select_special_member_kind}0 cannot "
9501  "have default arguments">;
9502def err_defaulted_special_member_variadic : Error<
9503  "an explicitly-defaulted %sub{select_special_member_kind}0 cannot "
9504  "be variadic">;
9505def err_defaulted_special_member_return_type : Error<
9506  "explicitly-defaulted %select{copy|move}0 assignment operator must "
9507  "return %1">;
9508def err_defaulted_special_member_quals : Error<
9509  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
9510  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
9511def err_defaulted_special_member_explicit_object_mismatch : Error<
9512  "the type of the explicit object parameter of an explicitly-defaulted "
9513  "%select{copy|move}0 assignment operator should match the type of the class %1">;
9514def err_defaulted_special_member_volatile_param : Error<
9515  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
9516  "may not be volatile">;
9517def err_defaulted_special_member_move_const_param : Error<
9518  "the parameter for an explicitly-defaulted move "
9519  "%select{constructor|assignment operator}0 may not be const">;
9520def err_defaulted_special_member_copy_const_param : Error<
9521  "the parameter for this explicitly-defaulted copy "
9522  "%select{constructor|assignment operator}0 is const, but a member or base "
9523  "requires it to be non-const">;
9524def err_defaulted_copy_assign_not_ref : Error<
9525  "the parameter for an explicitly-defaulted copy assignment operator must be an "
9526  "lvalue reference type">;
9527def err_incorrect_defaulted_constexpr : Error<
9528  "defaulted definition of %sub{select_special_member_kind}0 "
9529  "is not constexpr">;
9530def err_incorrect_defaulted_constexpr_with_vb: Error<
9531  "%sub{select_special_member_kind}0 cannot be 'constexpr' in a class with virtual base class">;
9532def err_incorrect_defaulted_consteval : Error<
9533  "defaulted declaration of %sub{select_special_member_kind}0 "
9534  "cannot be consteval because implicit definition is not constexpr">;
9535def warn_defaulted_method_deleted : Warning<
9536  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
9537  "deleted">, InGroup<DefaultedFunctionDeleted>;
9538def note_replace_equals_default_to_delete : Note<
9539  "replace 'default' with 'delete'">;
9540def err_out_of_line_default_deletes : Error<
9541  "defaulting this %sub{select_special_member_kind}0 "
9542  "would delete it after its first declaration">;
9543def note_deleted_type_mismatch : Note<
9544  "function is implicitly deleted because its declared type does not match "
9545  "the type of an implicit %sub{select_special_member_kind}0">;
9546def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
9547  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
9548  "different from the implicit type is incompatible with C++ standards before "
9549  "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9550def warn_vbase_moved_multiple_times : Warning<
9551  "defaulted move assignment operator of %0 will move assign virtual base "
9552  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
9553def note_vbase_moved_here : Note<
9554  "%select{%1 is a virtual base class of base class %2 declared here|"
9555  "virtual base class %1 declared here}0">;
9556
9557// C++20 defaulted comparisons
9558// This corresponds to values of Sema::DefaultedComparisonKind.
9559def select_defaulted_comparison_kind : TextSubstitution<
9560  "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
9561  "operator">;
9562def ext_defaulted_comparison : ExtWarn<
9563  "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
9564def warn_cxx17_compat_defaulted_comparison : Warning<
9565  "defaulted comparison operators are incompatible with C++ standards "
9566  "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9567def err_defaulted_comparison_template : Error<
9568  "comparison operator template cannot be defaulted">;
9569def err_defaulted_comparison_num_args : Error<
9570  "%select{non-member|member}0 %sub{select_defaulted_comparison_kind}1"
9571  " must have %select{2|1}0 parameters">;
9572def err_defaulted_comparison_param : Error<
9573  "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
9574  "; found %1, expected %2%select{| or %4}3">;
9575def err_defaulted_comparison_param_unknown : Error<
9576  "invalid parameter type for non-member defaulted"
9577  " %sub{select_defaulted_comparison_kind}0"
9578  "; found %1, expected class or reference to a constant class">;
9579def err_defaulted_comparison_param_mismatch : Error<
9580  "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
9581  "must have the same type%diff{ (found $ vs $)|}1,2">;
9582def err_defaulted_comparison_not_friend : Error<
9583  "%sub{select_defaulted_comparison_kind}0 is not a friend of"
9584  " %select{|incomplete class }1%2">;
9585def err_defaulted_comparison_non_const : Error<
9586  "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
9587  "const-qualified">;
9588def err_defaulted_comparison_return_type_not_bool : Error<
9589  "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9590  "must be 'bool', not %1">;
9591def err_defaulted_comparison_deduced_return_type_not_auto : Error<
9592  "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9593  "must be 'auto', not %1">;
9594def warn_defaulted_comparison_deleted : Warning<
9595  "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
9596  "deleted">, InGroup<DefaultedFunctionDeleted>;
9597def err_non_first_default_compare_deletes : Error<
9598  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
9599  "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
9600  "would delete it after its first declaration">;
9601def err_non_first_default_compare_in_class : Error<
9602  "defaulting this %sub{select_defaulted_comparison_kind}0 "
9603  "is not allowed because it was already declared outside the class">;
9604def note_defaulted_comparison_union : Note<
9605  "defaulted %0 is implicitly deleted because "
9606  "%2 is a %select{union-like class|union}1 with variant members">;
9607def note_defaulted_comparison_reference_member : Note<
9608  "defaulted %0 is implicitly deleted because "
9609  "class %1 has a reference member">;
9610def note_defaulted_comparison_ambiguous : Note<
9611  "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
9612  "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
9613def note_defaulted_comparison_inaccessible : Note<
9614  "defaulted %0 is implicitly deleted because it would invoke a "
9615  "%select{private|protected}3 %4%select{ member of %6|"
9616  " member of %6 to compare member %2| to compare base class %2}1">;
9617def note_defaulted_comparison_calls_deleted : Note<
9618  "defaulted %0 is implicitly deleted because it would invoke a deleted "
9619  "comparison function%select{| for member %2| for base class %2}1">;
9620def note_defaulted_comparison_no_viable_function : Note<
9621  "defaulted %0 is implicitly deleted because there is no viable "
9622  "%select{three-way comparison function|'operator=='}1 for "
9623  "%select{|member |base class }2%3">;
9624def note_defaulted_comparison_no_viable_function_synthesized : Note<
9625  "three-way comparison cannot be synthesized because there is no viable "
9626  "function for %select{'=='|'<'}0 comparison">;
9627def note_defaulted_comparison_not_rewritten_callee : Note<
9628  "defaulted %0 is implicitly deleted because this non-rewritten comparison "
9629  "function would be the best match for the comparison">;
9630def note_defaulted_comparison_not_rewritten_conversion : Note<
9631  "defaulted %0 is implicitly deleted because a builtin comparison function "
9632  "using this conversion would be the best match for the comparison">;
9633def note_defaulted_comparison_cannot_deduce : Note<
9634  "return type of defaulted 'operator<=>' cannot be deduced because "
9635  "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
9636  "is not a standard comparison category type">;
9637def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
9638  "return type of defaulted 'operator<=>' cannot be deduced because "
9639  "three-way comparison for %select{|member|base class}0 %1 "
9640  "has a deduced return type and is not yet defined">;
9641def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
9642  "%select{|member|base class}0 %1 declared here">;
9643def note_defaulted_comparison_cannot_deduce_callee : Note<
9644  "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
9645def ext_defaulted_comparison_constexpr_mismatch : Extension<
9646  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9647  "three-way comparison operator}0 that is "
9648  "declared %select{constexpr|consteval}2 but"
9649  "%select{|for which the corresponding implicit 'operator==' }0 "
9650  "invokes a non-constexpr comparison function is a C++23 extension">,
9651  InGroup<DiagGroup<"c++23-default-comp-relaxed-constexpr">>;
9652def warn_cxx23_compat_defaulted_comparison_constexpr_mismatch : Warning<
9653  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9654  "three-way comparison operator}0 that is "
9655  "declared %select{constexpr|consteval}2 but"
9656  "%select{|for which the corresponding implicit 'operator==' }0 "
9657  "invokes a non-constexpr comparison function is incompatible with C++ "
9658  "standards before C++23">,
9659  InGroup<CXXPre23Compat>, DefaultIgnore;
9660def note_defaulted_comparison_not_constexpr : Note<
9661  "non-constexpr comparison function would be used to compare "
9662  "%select{|member %1|base class %1}0">;
9663def note_defaulted_comparison_not_constexpr_here : Note<
9664  "non-constexpr comparison function declared here">;
9665def note_in_declaration_of_implicit_equality_comparison : Note<
9666  "while declaring the corresponding implicit 'operator==' "
9667  "for this defaulted 'operator<=>'">;
9668def err_volatile_comparison_operator : Error<
9669  "defaulted comparison function must not be volatile">;
9670def err_ref_qualifier_comparison_operator : Error<
9671  "ref-qualifier '&&' is not allowed on a defaulted comparison operator">;
9672
9673def ext_implicit_exception_spec_mismatch : ExtWarn<
9674  "function previously declared with an %select{explicit|implicit}0 exception "
9675  "specification redeclared with an %select{implicit|explicit}0 exception "
9676  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
9677
9678def warn_ptr_arith_precedes_bounds : Warning<
9679  "the pointer decremented by %0 refers before the beginning of the array">,
9680  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9681def warn_ptr_arith_exceeds_bounds : Warning<
9682  "the pointer incremented by %0 refers past the end of the array (that has type %1)">,
9683  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9684def warn_array_index_precedes_bounds : Warning<
9685  "array index %0 is before the beginning of the array">,
9686  InGroup<ArrayBounds>;
9687def warn_array_index_exceeds_bounds : Warning<
9688  "array index %0 is past the end of the array (that has type %1%select{|, cast to %3}2)">,
9689  InGroup<ArrayBounds>;
9690def warn_ptr_arith_exceeds_max_addressable_bounds : Warning<
9691  "the pointer incremented by %0 refers past the last possible element for an array in %1-bit "
9692  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9693  InGroup<ArrayBounds>;
9694def warn_array_index_exceeds_max_addressable_bounds : Warning<
9695  "array index %0 refers past the last possible element for an array in %1-bit "
9696  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9697  InGroup<ArrayBounds>;
9698def note_array_declared_here : Note<
9699  "array %0 declared here">;
9700
9701def warn_inconsistent_array_form : Warning<
9702  "argument %0 of type %1 with mismatched bound">,
9703  InGroup<ArrayParameter>, DefaultIgnore;
9704def note_previous_declaration_as : Note<
9705  "previously declared as %0 here">;
9706
9707def warn_printf_insufficient_data_args : Warning<
9708  "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
9709def warn_printf_data_arg_not_used : Warning<
9710  "data argument not used by format string">, InGroup<FormatExtraArgs>;
9711def warn_format_invalid_conversion : Warning<
9712  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
9713def warn_printf_incomplete_specifier : Warning<
9714  "incomplete format specifier">, InGroup<Format>;
9715def warn_missing_format_string : Warning<
9716  "format string missing">, InGroup<Format>;
9717def warn_scanf_nonzero_width : Warning<
9718  "zero field width in scanf format string is unused">,
9719  InGroup<Format>;
9720def warn_format_conversion_argument_type_mismatch : Warning<
9721  "format specifies type %0 but the argument has "
9722  "%select{type|underlying type}2 %1">,
9723  InGroup<Format>;
9724def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
9725  warn_format_conversion_argument_type_mismatch.Summary>,
9726  InGroup<FormatPedantic>;
9727def warn_format_conversion_argument_type_mismatch_confusion : Warning<
9728  warn_format_conversion_argument_type_mismatch.Summary>,
9729  InGroup<FormatTypeConfusion>, DefaultIgnore;
9730def warn_format_argument_needs_cast : Warning<
9731  "%select{values of type|enum values with underlying type}2 '%0' should not "
9732  "be used as format arguments; add an explicit cast to %1 instead">,
9733  InGroup<Format>;
9734def warn_format_argument_needs_cast_pedantic : Warning<
9735  warn_format_argument_needs_cast.Summary>,
9736  InGroup<FormatPedantic>, DefaultIgnore;
9737def warn_printf_positional_arg_exceeds_data_args : Warning <
9738  "data argument position '%0' exceeds the number of data arguments (%1)">,
9739  InGroup<Format>;
9740def warn_format_zero_positional_specifier : Warning<
9741  "position arguments in format strings start counting at 1 (not 0)">,
9742  InGroup<Format>;
9743def warn_format_invalid_positional_specifier : Warning<
9744  "invalid position specified for %select{field width|field precision}0">,
9745  InGroup<Format>;
9746def warn_format_mix_positional_nonpositional_args : Warning<
9747  "cannot mix positional and non-positional arguments in format string">,
9748  InGroup<Format>;
9749def warn_static_array_too_small : Warning<
9750  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
9751  " callee requires at least %1">,
9752  InGroup<ArrayBounds>;
9753def note_callee_static_array : Note<
9754  "callee declares array parameter as static here">;
9755def warn_empty_format_string : Warning<
9756  "format string is empty">, InGroup<FormatZeroLength>;
9757def warn_format_string_is_wide_literal : Warning<
9758  "format string should not be a wide string">, InGroup<Format>;
9759def warn_printf_format_string_contains_null_char : Warning<
9760  "format string contains '\\0' within the string body">, InGroup<Format>;
9761def warn_printf_format_string_not_null_terminated : Warning<
9762  "format string is not null-terminated">, InGroup<Format>;
9763def warn_printf_asterisk_missing_arg : Warning<
9764  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
9765  InGroup<Format>;
9766def warn_printf_asterisk_wrong_type : Warning<
9767  "field %select{width|precision}0 should have type %1, but argument has type %2">,
9768  InGroup<Format>;
9769def warn_printf_nonsensical_optional_amount: Warning<
9770  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
9771  InGroup<Format>;
9772def warn_printf_nonsensical_flag: Warning<
9773  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
9774  InGroup<Format>;
9775def warn_format_nonsensical_length: Warning<
9776  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
9777  InGroup<Format>;
9778def warn_format_non_standard_positional_arg: Warning<
9779  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
9780def warn_format_non_standard: Warning<
9781  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
9782  InGroup<FormatNonStandard>, DefaultIgnore;
9783def warn_format_non_standard_conversion_spec: Warning<
9784  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
9785  InGroup<FormatNonStandard>, DefaultIgnore;
9786def err_invalid_mask_type_size : Error<
9787  "mask type size must be between 1-byte and 8-bytes">;
9788def warn_format_invalid_annotation : Warning<
9789  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
9790  InGroup<Format>;
9791def warn_format_P_no_precision : Warning<
9792  "using '%%P' format specifier without precision">,
9793  InGroup<Format>;
9794def warn_printf_ignored_flag: Warning<
9795  "flag '%0' is ignored when flag '%1' is present">,
9796  InGroup<Format>;
9797def warn_printf_empty_objc_flag: Warning<
9798  "missing object format flag">,
9799  InGroup<Format>;
9800def warn_printf_ObjCflags_without_ObjCConversion: Warning<
9801  "object format flags cannot be used with '%0' conversion specifier">,
9802  InGroup<Format>;
9803def warn_printf_invalid_objc_flag: Warning<
9804    "'%0' is not a valid object format flag">,
9805    InGroup<Format>;
9806def warn_printf_narg_not_supported : Warning<
9807    "'%%n' specifier not supported on this platform">,
9808    InGroup<Format>;
9809def warn_scanf_scanlist_incomplete : Warning<
9810  "no closing ']' for '%%[' in scanf format string">,
9811  InGroup<Format>;
9812def warn_format_bool_as_character : Warning<
9813  "using '%0' format specifier, but argument has boolean value">,
9814  InGroup<Format>;
9815def note_format_string_defined : Note<"format string is defined here">;
9816def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
9817def note_printf_c_str: Note<"did you mean to call the %0 method?">;
9818def note_format_security_fixit: Note<
9819  "treat the string as an argument to avoid this">;
9820
9821def warn_null_arg : Warning<
9822  "null passed to a callee that requires a non-null argument">,
9823  InGroup<NonNull>;
9824def warn_null_ret : Warning<
9825  "null returned from %select{function|method}0 that requires a non-null return value">,
9826  InGroup<NonNull>;
9827
9828def err_lifetimebound_no_object_param : Error<
9829  "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
9830  "function has no implicit object parameter">;
9831def err_lifetimebound_ctor_dtor : Error<
9832  "'lifetimebound' attribute cannot be applied to a "
9833  "%select{constructor|destructor}0">;
9834
9835// CHECK: returning address/reference of stack memory
9836def warn_ret_stack_addr_ref : Warning<
9837  "%select{address of|reference to}0 stack memory associated with "
9838  "%select{local variable|parameter}2 %1 returned">,
9839  InGroup<ReturnStackAddress>;
9840def warn_ret_local_temp_addr_ref : Warning<
9841  "returning %select{address of|reference to}0 local temporary object">,
9842  InGroup<ReturnStackAddress>;
9843def warn_ret_addr_label : Warning<
9844  "returning address of label, which is local">,
9845  InGroup<ReturnStackAddress>;
9846def err_ret_local_block : Error<
9847  "returning block that lives on the local stack">;
9848def note_local_var_initializer : Note<
9849  "%select{via initialization of|binding reference}0 variable "
9850  "%select{%2 |}1here">;
9851def note_lambda_capture_initializer : Note<
9852  "%select{implicitly |}2captured%select{| by reference}3"
9853  "%select{%select{ due to use|}2 here|"
9854  " via initialization of lambda capture %0}1">;
9855def note_init_with_default_member_initializer : Note<
9856  "initializing field %0 with default member initializer">;
9857
9858// Check for initializing a member variable with the address or a reference to
9859// a constructor parameter.
9860def warn_bind_ref_member_to_parameter : Warning<
9861  "binding reference member %0 to stack allocated "
9862  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9863def warn_init_ptr_member_to_parameter_addr : Warning<
9864  "initializing pointer member %0 with the stack address of "
9865  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9866def note_ref_or_ptr_member_declared_here : Note<
9867  "%select{reference|pointer}0 member declared here">;
9868
9869def err_dangling_member : Error<
9870  "%select{reference|backing array for 'std::initializer_list'}2 "
9871  "%select{|subobject of }1member %0 "
9872  "%select{binds to|is}2 a temporary object "
9873  "whose lifetime would be shorter than the lifetime of "
9874  "the constructed object">;
9875def warn_dangling_member : Warning<
9876  "%select{reference|backing array for 'std::initializer_list'}2 "
9877  "%select{|subobject of }1member %0 "
9878  "%select{binds to|is}2 a temporary object "
9879  "whose lifetime is shorter than the lifetime of the constructed object">,
9880  InGroup<DanglingField>;
9881def warn_dangling_lifetime_pointer_member : Warning<
9882  "initializing pointer member %0 to point to a temporary object "
9883  "whose lifetime is shorter than the lifetime of the constructed object">,
9884  InGroup<DanglingGsl>;
9885def note_lifetime_extending_member_declared_here : Note<
9886  "%select{%select{reference|'std::initializer_list'}0 member|"
9887  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
9888  "declared here">;
9889def warn_dangling_variable : Warning<
9890  "%select{temporary %select{whose address is used as value of|"
9891  "%select{|implicitly }2bound to}4 "
9892  "%select{%select{|reference }4member of local variable|"
9893  "local %select{variable|reference}4}1|"
9894  "array backing "
9895  "%select{initializer list subobject of local variable|"
9896  "local initializer list}1}0 "
9897  "%select{%3 |}2will be destroyed at the end of the full-expression">,
9898  InGroup<Dangling>;
9899def warn_new_dangling_reference : Warning<
9900  "temporary bound to reference member of allocated object "
9901  "will be destroyed at the end of the full-expression">,
9902  InGroup<DanglingField>;
9903def warn_dangling_lifetime_pointer : Warning<
9904  "object backing the pointer "
9905  "will be destroyed at the end of the full-expression">,
9906  InGroup<DanglingGsl>;
9907def warn_new_dangling_initializer_list : Warning<
9908  "array backing "
9909  "%select{initializer list subobject of the allocated object|"
9910  "the allocated initializer list}0 "
9911  "will be destroyed at the end of the full-expression">,
9912  InGroup<DanglingInitializerList>;
9913def warn_unsupported_lifetime_extension : Warning<
9914  "sorry, lifetime extension of "
9915  "%select{temporary|backing array of initializer list}0 created "
9916  "by aggregate initialization using default member initializer "
9917  "is not supported; lifetime of %select{temporary|backing array}0 "
9918  "will end at the end of the full-expression">, InGroup<Dangling>;
9919
9920// For non-floating point, expressions of the form x == x or x != x
9921// should result in a warning, since these always evaluate to a constant.
9922// Array comparisons have similar warnings
9923def warn_comparison_always : Warning<
9924  "%select{self-|array }0comparison always evaluates to "
9925  "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9926  InGroup<TautologicalCompare>;
9927def warn_comparison_bitwise_always : Warning<
9928  "bitwise comparison always evaluates to %select{false|true}0">,
9929  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9930def warn_comparison_bitwise_or : Warning<
9931  "bitwise or with non-zero value always evaluates to true">,
9932  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9933def warn_tautological_negation_and_compare: Warning<
9934  "'&&' of a value and its negation always evaluates to false">,
9935  InGroup<TautologicalNegationCompare>, DefaultIgnore;
9936def warn_tautological_negation_or_compare: Warning<
9937  "'||' of a value and its negation always evaluates to true">,
9938  InGroup<TautologicalNegationCompare>, DefaultIgnore;
9939def warn_tautological_overlap_comparison : Warning<
9940  "overlapping comparisons always evaluate to %select{false|true}0">,
9941  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9942def warn_depr_array_comparison : Warning<
9943  "comparison between two arrays is deprecated; "
9944  "to compare array addresses, use unary '+' to decay operands to pointers">,
9945  InGroup<DeprecatedArrayCompare>;
9946
9947def warn_stringcompare : Warning<
9948  "result of comparison against %select{a string literal|@encode}0 is "
9949  "unspecified (use an explicit string comparison function instead)">,
9950  InGroup<StringCompare>;
9951
9952def warn_identity_field_assign : Warning<
9953  "assigning %select{field|instance variable}0 to itself">,
9954  InGroup<SelfAssignmentField>;
9955
9956// Type safety attributes
9957def err_type_tag_for_datatype_not_ice : Error<
9958  "'type_tag_for_datatype' attribute requires the initializer to be "
9959  "an %select{integer|integral}0 constant expression">;
9960def err_type_tag_for_datatype_too_large : Error<
9961  "'type_tag_for_datatype' attribute requires the initializer to be "
9962  "an %select{integer|integral}0 constant expression "
9963  "that can be represented by a 64 bit integer">;
9964def err_tag_index_out_of_range : Error<
9965  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
9966def warn_type_tag_for_datatype_wrong_kind : Warning<
9967  "this type tag was not designed to be used with this function">,
9968  InGroup<TypeSafety>;
9969def warn_type_safety_type_mismatch : Warning<
9970  "argument type %0 doesn't match specified %1 type tag "
9971  "%select{that requires %3|}2">, InGroup<TypeSafety>;
9972def warn_type_safety_null_pointer_required : Warning<
9973  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
9974
9975// Generic selections.
9976def err_assoc_type_incomplete : Error<
9977  "type %0 in generic association incomplete">;
9978def err_assoc_type_nonobject : Error<
9979  "type %0 in generic association not an object type">;
9980def err_assoc_type_variably_modified : Error<
9981  "type %0 in generic association is a variably modified type">;
9982def err_assoc_compatible_types : Error<
9983  "type %0 in generic association compatible with previously specified type %1">;
9984def note_compat_assoc : Note<
9985  "compatible type %0 specified here">;
9986def err_generic_sel_no_match : Error<
9987  "controlling expression type %0 not compatible with any generic association type">;
9988def err_generic_sel_multi_match : Error<
9989  "controlling expression type %0 compatible with %1 generic association types">;
9990
9991
9992// Blocks
9993def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
9994  " or %select{pick a deployment target that supports them|for OpenCL C 2.0"
9995  " or OpenCL C 3.0 with __opencl_c_device_enqueue feature}0">;
9996def err_block_returning_array_function : Error<
9997  "block cannot return %select{array|function}0 type %1">;
9998
9999// Builtin annotation
10000def err_builtin_annotation_first_arg : Error<
10001  "first argument to __builtin_annotation must be an integer">;
10002def err_builtin_annotation_second_arg : Error<
10003  "second argument to __builtin_annotation must be a non-wide string constant">;
10004def err_msvc_annotation_wide_str : Error<
10005  "arguments to __annotation must be wide string constants">;
10006
10007// CFString checking
10008def err_cfstring_literal_not_string_constant : Error<
10009  "CFString literal is not a string constant">;
10010def warn_cfstring_truncated : Warning<
10011  "input conversion stopped due to an input byte that does not "
10012  "belong to the input codeset UTF-8">,
10013  InGroup<DiagGroup<"CFString-literal">>;
10014
10015// os_log checking
10016// TODO: separate diagnostic for os_trace()
10017def err_os_log_format_not_string_constant : Error<
10018  "os_log() format argument is not a string constant">;
10019def err_os_log_argument_too_big : Error<
10020  "os_log() argument %0 is too big (%1 bytes, max %2)">;
10021def warn_os_log_format_narg : Error<
10022 "os_log() '%%n' format specifier is not allowed">, DefaultError;
10023
10024// Statements.
10025def err_continue_not_in_loop : Error<
10026  "'continue' statement not in loop statement">;
10027def err_break_not_in_loop_or_switch : Error<
10028  "'break' statement not in loop or switch statement">;
10029def warn_loop_ctrl_binds_to_inner : Warning<
10030  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
10031  InGroup<GccCompat>;
10032def err_omp_bind_required_on_loop : Error<
10033  "expected 'bind' clause for 'loop' construct without an enclosing OpenMP "
10034  "construct">;
10035def err_omp_loop_reduction_clause : Error<
10036  "'reduction' clause not allowed with '#pragma omp loop bind(teams)'">;
10037def warn_break_binds_to_switch : Warning<
10038  "'break' is bound to loop, GCC binds it to switch">,
10039  InGroup<GccCompat>;
10040def err_default_not_in_switch : Error<
10041  "'default' statement not in switch statement">;
10042def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
10043def warn_bool_switch_condition : Warning<
10044  "switch condition has boolean value">, InGroup<SwitchBool>;
10045def warn_case_value_overflow : Warning<
10046  "overflow converting case value to switch condition type (%0 to %1)">,
10047  InGroup<Switch>;
10048def err_duplicate_case : Error<"duplicate case value '%0'">;
10049def err_duplicate_case_differing_expr : Error<
10050  "duplicate case value: '%0' and '%1' both equal '%2'">;
10051def warn_case_empty_range : Warning<"empty case range specified">;
10052def warn_missing_case_for_condition :
10053  Warning<"no case matching constant switch condition '%0'">;
10054def err_loop_attr_conflict : Error<
10055  "conflicting loop attribute %0">;
10056def err_attribute_power_of_two_in_range : Error<
10057  "%0 attribute requires an integer argument which is a constant power of two "
10058  "between %1 and %2 inclusive; provided argument was %3">;
10059
10060def warn_def_missing_case : Warning<"%plural{"
10061  "1:enumeration value %1 not explicitly handled in switch|"
10062  "2:enumeration values %1 and %2 not explicitly handled in switch|"
10063  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
10064  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
10065  InGroup<SwitchEnum>, DefaultIgnore;
10066
10067def warn_missing_case : Warning<"%plural{"
10068  "1:enumeration value %1 not handled in switch|"
10069  "2:enumeration values %1 and %2 not handled in switch|"
10070  "3:enumeration values %1, %2, and %3 not handled in switch|"
10071  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
10072  InGroup<Switch>;
10073def warn_switch_default : Warning<"'switch' missing 'default' label">,
10074  InGroup<SwitchDefault>, DefaultIgnore;
10075
10076def warn_unannotated_fallthrough : Warning<
10077  "unannotated fall-through between switch labels">,
10078  InGroup<ImplicitFallthrough>, DefaultIgnore;
10079def warn_unannotated_fallthrough_per_function : Warning<
10080  "unannotated fall-through between switch labels in partly-annotated "
10081  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
10082def note_insert_fallthrough_fixit : Note<
10083  "insert '%0;' to silence this warning">;
10084def note_insert_break_fixit : Note<
10085  "insert 'break;' to avoid fall-through">;
10086def err_fallthrough_attr_wrong_target : Error<
10087  "%0 attribute is only allowed on empty statements">;
10088def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
10089def err_fallthrough_attr_outside_switch : Error<
10090  "fallthrough annotation is outside switch statement">;
10091def err_fallthrough_attr_invalid_placement : Error<
10092  "fallthrough annotation does not directly precede switch label">;
10093
10094def warn_unreachable_default : Warning<
10095  "default label in switch which covers all enumeration values">,
10096  InGroup<CoveredSwitchDefault>, DefaultIgnore;
10097def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
10098  InGroup<Switch>;
10099def warn_not_in_enum_assignment : Warning<"integer constant not in range "
10100  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
10101def err_typecheck_statement_requires_scalar : Error<
10102  "statement requires expression of scalar type (%0 invalid)">;
10103def err_typecheck_statement_requires_integer : Error<
10104  "statement requires expression of integer type (%0 invalid)">;
10105def err_multiple_default_labels_defined : Error<
10106  "multiple default labels in one switch">;
10107def err_switch_multiple_conversions : Error<
10108  "multiple conversions from switch condition type %0 to an integral or "
10109  "enumeration type">;
10110def note_switch_conversion : Note<
10111  "conversion to %select{integral|enumeration}0 type %1">;
10112def err_switch_explicit_conversion : Error<
10113  "switch condition type %0 requires explicit conversion to %1">;
10114def err_switch_incomplete_class_type : Error<
10115  "switch condition has incomplete class type %0">;
10116
10117def warn_empty_if_body : Warning<
10118  "if statement has empty body">, InGroup<EmptyBody>;
10119def warn_empty_for_body : Warning<
10120  "for loop has empty body">, InGroup<EmptyBody>;
10121def warn_empty_range_based_for_body : Warning<
10122  "range-based for loop has empty body">, InGroup<EmptyBody>;
10123def warn_empty_while_body : Warning<
10124  "while loop has empty body">, InGroup<EmptyBody>;
10125def warn_empty_switch_body : Warning<
10126  "switch statement has empty body">, InGroup<EmptyBody>;
10127def note_empty_body_on_separate_line : Note<
10128  "put the semicolon on a separate line to silence this warning">;
10129
10130def err_va_start_captured_stmt : Error<
10131  "'va_start' cannot be used in a captured statement">;
10132def err_va_start_outside_function : Error<
10133  "'va_start' cannot be used outside a function">;
10134def err_va_start_fixed_function : Error<
10135  "'va_start' used in function with fixed args">;
10136def err_va_start_used_in_wrong_abi_function : Error<
10137  "'va_start' used in %select{System V|Win64}0 ABI function">;
10138def err_ms_va_start_used_in_sysv_function : Error<
10139  "'__builtin_ms_va_start' used in System V ABI function">;
10140def warn_second_arg_of_va_start_not_last_named_param : Warning<
10141  "second argument to 'va_start' is not the last named parameter">,
10142  InGroup<Varargs>;
10143def warn_c17_compat_ellipsis_only_parameter : Warning<
10144  "'...' as the only parameter of a function is incompatible with C standards "
10145  "before C23">, DefaultIgnore, InGroup<CPre23Compat>;
10146def warn_va_start_type_is_undefined : Warning<
10147  "passing %select{an object that undergoes default argument promotion|"
10148  "an object of reference type|a parameter declared with the 'register' "
10149  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
10150def err_first_argument_to_va_arg_not_of_type_va_list : Error<
10151  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
10152def err_second_parameter_to_va_arg_incomplete: Error<
10153  "second argument to 'va_arg' is of incomplete type %0">;
10154def err_second_parameter_to_va_arg_abstract: Error<
10155  "second argument to 'va_arg' is of abstract type %0">;
10156def warn_second_parameter_to_va_arg_not_pod : Warning<
10157  "second argument to 'va_arg' is of non-POD type %0">,
10158  InGroup<NonPODVarargs>, DefaultError;
10159def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
10160  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
10161  InGroup<NonPODVarargs>, DefaultError;
10162def warn_second_parameter_to_va_arg_never_compatible : Warning<
10163  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
10164  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
10165
10166def warn_return_missing_expr : Warning<
10167  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
10168  InGroup<ReturnType>;
10169def ext_return_missing_expr : ExtWarn<
10170  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
10171  InGroup<ReturnType>;
10172def ext_return_has_expr : ExtWarn<
10173  "%select{void function|void method|constructor|destructor}1 %0 "
10174  "should not return a value">,
10175  DefaultError, InGroup<ReturnType>;
10176def ext_return_has_void_expr : Extension<
10177  "void %select{function|method|block}1 %0 should not return void expression">;
10178def err_return_init_list : Error<
10179  "%select{void function|void method|constructor|destructor}1 %0 "
10180  "must not return a value">;
10181def err_ctor_dtor_returns_void : Error<
10182  "%select{constructor|destructor}1 %0 must not return void expression">;
10183def warn_noreturn_function_has_return_expr : Warning<
10184  "function %0 declared 'noreturn' should not return">,
10185  InGroup<InvalidNoreturn>;
10186def warn_falloff_noreturn_function : Warning<
10187  "function declared 'noreturn' should not return">,
10188  InGroup<InvalidNoreturn>;
10189def err_noreturn_block_has_return_expr : Error<
10190  "block declared 'noreturn' should not return">;
10191def err_carries_dependency_missing_on_first_decl : Error<
10192  "%select{function|parameter}0 declared '[[carries_dependency]]' "
10193  "after its first declaration">;
10194def note_carries_dependency_missing_first_decl : Note<
10195  "declaration missing '[[carries_dependency]]' attribute is here">;
10196def err_carries_dependency_param_not_function_decl : Error<
10197  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
10198  "declaration or lambda">;
10199def err_block_on_nonlocal : Error<
10200  "__block attribute not allowed, only allowed on local variables">;
10201def err_block_on_vm : Error<
10202  "__block attribute not allowed on declaration with a variably modified type">;
10203def err_sizeless_nonlocal : Error<
10204  "non-local variable with sizeless type %0">;
10205
10206def err_vec_builtin_non_vector : Error<
10207 "first two arguments to %0 must be vectors">;
10208def err_vec_builtin_incompatible_vector : Error<
10209  "first two arguments to %0 must have the same type">;
10210def err_vsx_builtin_nonconstant_argument : Error<
10211  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
10212
10213def err_shufflevector_nonconstant_argument : Error<
10214  "index for __builtin_shufflevector must be a constant integer">;
10215def err_shufflevector_argument_too_large : Error<
10216  "index for __builtin_shufflevector must be less than the total number "
10217  "of vector elements">;
10218
10219def err_convertvector_non_vector : Error<
10220  "first argument to __builtin_convertvector must be a vector">;
10221def err_builtin_non_vector_type : Error<
10222  "%0 argument to %1 must be of vector type">;
10223def err_convertvector_incompatible_vector : Error<
10224  "first two arguments to __builtin_convertvector must have the same number of elements">;
10225
10226def err_first_argument_to_cwsc_not_call : Error<
10227  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
10228def err_first_argument_to_cwsc_block_call : Error<
10229  "first argument to __builtin_call_with_static_chain must not be a block call">;
10230def err_first_argument_to_cwsc_builtin_call : Error<
10231  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
10232def err_first_argument_to_cwsc_pdtor_call : Error<
10233  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
10234def err_second_argument_to_cwsc_not_pointer : Error<
10235  "second argument to __builtin_call_with_static_chain must be of pointer type">;
10236
10237def err_vector_incorrect_num_initializers : Error<
10238  "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
10239def err_altivec_empty_initializer : Error<"expected initializer">;
10240
10241def err_invalid_neon_type_code : Error<
10242  "incompatible constant for this __builtin_neon function">;
10243def err_argument_invalid_range : Error<
10244  "argument value %0 is outside the valid range [%1, %2]">;
10245def warn_argument_invalid_range : Warning<
10246  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
10247  InGroup<DiagGroup<"argument-outside-range">>;
10248def warn_argument_undefined_behaviour : Warning<
10249  "argument value %0 will result in undefined behaviour">,
10250  InGroup<DiagGroup<"argument-undefined-behaviour">>;
10251def err_argument_not_multiple : Error<
10252  "argument should be a multiple of %0">;
10253def err_argument_not_power_of_2 : Error<
10254  "argument should be a power of 2">;
10255def err_argument_not_shifted_byte : Error<
10256  "argument should be an 8-bit value shifted by a multiple of 8 bits">;
10257def err_argument_not_shifted_byte_or_xxff : Error<
10258  "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
10259def err_argument_not_contiguous_bit_field : Error<
10260  "argument %0 value should represent a contiguous bit field">;
10261def err_rotation_argument_to_cadd : Error<
10262  "argument should be the value 90 or 270">;
10263def err_rotation_argument_to_cmla : Error<
10264  "argument should be the value 0, 90, 180 or 270">;
10265def warn_neon_vector_initializer_non_portable : Warning<
10266  "vector initializers are not compatible with NEON intrinsics in big endian "
10267  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
10268def note_neon_vector_initializer_non_portable : Note<
10269  "consider using vld1_%0%1() to initialize a vector from memory, or "
10270  "vcreate_%0%1() to initialize from an integer constant">;
10271def note_neon_vector_initializer_non_portable_q : Note<
10272  "consider using vld1q_%0%1() to initialize a vector from memory, or "
10273  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
10274  "constants">;
10275def err_systemz_invalid_tabort_code : Error<
10276  "invalid transaction abort code">;
10277def err_64_bit_builtin_32_bit_tgt : Error<
10278  "this builtin is only available on 64-bit targets">;
10279def err_32_bit_builtin_64_bit_tgt : Error<
10280  "this builtin is only available on 32-bit targets">;
10281def err_builtin_x64_aarch64_only : Error<
10282  "this builtin is only available on x86-64 and aarch64 targets">;
10283def err_mips_builtin_requires_dsp : Error<
10284  "this builtin requires 'dsp' ASE, please use -mdsp">;
10285def err_mips_builtin_requires_dspr2 : Error<
10286  "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
10287def err_mips_builtin_requires_msa : Error<
10288  "this builtin requires 'msa' ASE, please use -mmsa">;
10289def err_ppc_builtin_requires_abi : Error<
10290  "this builtin requires ABI -mabi=%0">;
10291def err_ppc_invalid_use_mma_type : Error<
10292  "invalid use of PPC MMA type">;
10293def err_ppc_invalid_test_data_class_type : Error<
10294  "expected a 'float', 'double' or '__float128' for the first argument">;
10295def err_x86_builtin_invalid_rounding : Error<
10296  "invalid rounding argument">;
10297def err_x86_builtin_invalid_scale : Error<
10298  "scale argument must be 1, 2, 4, or 8">;
10299def err_x86_builtin_tile_arg_duplicate : Error<
10300  "tile arguments must refer to different tiles">;
10301
10302def err_builtin_target_unsupported : Error<
10303  "builtin is not supported on this target">;
10304def err_builtin_longjmp_unsupported : Error<
10305  "__builtin_longjmp is not supported for the current target">;
10306def err_builtin_setjmp_unsupported : Error<
10307  "__builtin_setjmp is not supported for the current target">;
10308
10309def err_builtin_longjmp_invalid_val : Error<
10310  "argument to __builtin_longjmp must be a constant 1">;
10311def err_builtin_requires_language : Error<"'%0' is only available in %1">;
10312
10313def err_constant_integer_arg_type : Error<
10314  "argument to %0 must be a constant integer">;
10315
10316def ext_mixed_decls_code : Extension<
10317  "mixing declarations and code is a C99 extension">,
10318  InGroup<DeclarationAfterStatement>;
10319def warn_mixed_decls_code : Warning<
10320  "mixing declarations and code is incompatible with standards before C99">,
10321  InGroup<DeclarationAfterStatement>, DefaultIgnore;
10322
10323def err_non_local_variable_decl_in_for : Error<
10324  "declaration of non-local variable in 'for' loop">;
10325def err_non_variable_decl_in_for : Error<
10326  "non-variable declaration in 'for' loop">;
10327def err_toomany_element_decls : Error<
10328  "only one element declaration is allowed">;
10329def err_selector_element_not_lvalue : Error<
10330  "selector element is not a valid lvalue">;
10331def err_selector_element_type : Error<
10332  "selector element type %0 is not a valid object">;
10333def err_selector_element_const_type : Error<
10334  "selector element of type %0 cannot be a constant lvalue expression">;
10335def err_collection_expr_type : Error<
10336  "the type %0 is not a pointer to a fast-enumerable object">;
10337def warn_collection_expr_type : Warning<
10338  "collection expression type %0 may not respond to %1">;
10339
10340def err_invalid_conversion_between_ext_vectors : Error<
10341  "invalid conversion between ext-vector type %0 and %1">;
10342
10343def warn_duplicate_attribute_exact : Warning<
10344  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
10345
10346def warn_duplicate_attribute : Warning<
10347  "attribute %0 is already applied with different arguments">,
10348  InGroup<IgnoredAttributes>;
10349def err_disallowed_duplicate_attribute : Error<
10350  "attribute %0 cannot appear more than once on a declaration">;
10351
10352def warn_sync_fetch_and_nand_semantics_change : Warning<
10353  "the semantics of this intrinsic changed with GCC "
10354  "version 4.4 - the newer semantics are provided here">,
10355  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
10356
10357// Type
10358def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
10359  InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
10360def warn_receiver_forward_class : Warning<
10361  "receiver %0 is a forward class and corresponding @interface may not exist">,
10362  InGroup<ForwardClassReceiver>;
10363def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
10364def ext_missing_type_specifier : ExtWarn<
10365  "type specifier missing, defaults to 'int'; ISO C99 and later do not support "
10366  "implicit int">, InGroup<ImplicitInt>;
10367def err_missing_type_specifier : Error<
10368  "a type specifier is required for all declarations">;
10369def err_decimal_unsupported : Error<
10370  "GNU decimal type extension not supported">;
10371def err_objc_array_of_interfaces : Error<
10372  "array of interface %0 is invalid (probably should be an array of pointers)">;
10373def ext_c99_array_usage : Extension<
10374  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10375  "feature">, InGroup<C99>;
10376def err_c99_array_usage_cxx : Error<
10377  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10378  "feature, not permitted in C++">;
10379def err_type_unsupported : Error<
10380  "%0 is not supported on this target">;
10381def err_nsconsumed_attribute_mismatch : Error<
10382  "overriding method has mismatched ns_consumed attribute on its"
10383  " parameter">;
10384def err_nsreturns_retained_attribute_mismatch : Error<
10385  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
10386  " attributes">;
10387def err_nserrordomain_invalid_decl : Error<
10388  "domain argument %select{|%1 }0does not refer to global constant">;
10389def err_nserrordomain_wrong_type : Error<
10390  "domain argument %0 does not point to an NSString or CFString constant">;
10391
10392def warn_nsconsumed_attribute_mismatch : Warning<
10393  err_nsconsumed_attribute_mismatch.Summary>, InGroup<NSConsumedMismatch>;
10394def warn_nsreturns_retained_attribute_mismatch : Warning<
10395  err_nsreturns_retained_attribute_mismatch.Summary>, InGroup<NSReturnsMismatch>;
10396
10397def note_getter_unavailable : Note<
10398  "or because setter is declared here, but no getter method %0 is found">;
10399def err_invalid_protocol_qualifiers : Error<
10400  "invalid protocol qualifiers on non-ObjC type">;
10401def warn_ivar_use_hidden : Warning<
10402  "local declaration of %0 hides instance variable">,
10403   InGroup<ShadowIvar>;
10404def warn_direct_initialize_call : Warning<
10405  "explicit call to +initialize results in duplicate call to +initialize">,
10406   InGroup<ExplicitInitializeCall>;
10407def warn_direct_super_initialize_call : Warning<
10408  "explicit call to [super initialize] should only be in implementation "
10409  "of +initialize">,
10410   InGroup<ExplicitInitializeCall>;
10411def err_ivar_use_in_class_method : Error<
10412  "instance variable %0 accessed in class method">;
10413def err_private_ivar_access : Error<"instance variable %0 is private">,
10414  AccessControl;
10415def err_protected_ivar_access : Error<"instance variable %0 is protected">,
10416  AccessControl;
10417def warn_maynot_respond : Warning<"%0 may not respond to %1">;
10418def ext_typecheck_base_super : Warning<
10419  "method parameter type "
10420  "%diff{$ does not match super class method parameter type $|"
10421  "does not match super class method parameter type}0,1">,
10422   InGroup<SuperSubClassMismatch>, DefaultIgnore;
10423def warn_missing_method_return_type : Warning<
10424  "method has no return type specified; defaults to 'id'">,
10425  InGroup<MissingMethodReturnType>, DefaultIgnore;
10426def warn_direct_ivar_access : Warning<"instance variable %0 is being "
10427  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
10428
10429// Spell-checking diagnostics
10430def err_unknown_typename : Error<
10431  "unknown type name %0">;
10432def err_unknown_type_or_class_name_suggest : Error<
10433  "unknown %select{type|class}1 name %0; did you mean %2?">;
10434def err_unknown_typename_suggest : Error<
10435  "unknown type name %0; did you mean %1?">;
10436def err_unknown_nested_typename_suggest : Error<
10437  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
10438def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
10439def err_undeclared_use_suggest : Error<
10440  "use of undeclared %0; did you mean %1?">;
10441def err_undeclared_var_use_suggest : Error<
10442  "use of undeclared identifier %0; did you mean %1?">;
10443def err_no_template : Error<"no template named %0">;
10444def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
10445def err_no_member_template : Error<"no template named %0 in %1">;
10446def err_no_member_template_suggest : Error<
10447  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
10448def err_non_template_in_template_id : Error<
10449  "%0 does not name a template but is followed by template arguments">;
10450def err_non_template_in_template_id_suggest : Error<
10451  "%0 does not name a template but is followed by template arguments; "
10452  "did you mean %1?">;
10453def err_non_template_in_member_template_id_suggest : Error<
10454  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
10455def note_non_template_in_template_id_found : Note<
10456  "non-template declaration found by name lookup">;
10457def err_mem_init_not_member_or_class_suggest : Error<
10458  "initializer %0 does not name a non-static data member or base "
10459  "class; did you mean the %select{base class|member}1 %2?">;
10460def err_field_designator_unknown_suggest : Error<
10461  "field designator %0 does not refer to any field in type %1; did you mean "
10462  "%2?">;
10463def err_typecheck_member_reference_ivar_suggest : Error<
10464  "%0 does not have a member named %1; did you mean %2?">;
10465def err_property_not_found_suggest : Error<
10466  "property %0 not found on object of type %1; did you mean %2?">;
10467def err_class_property_found : Error<
10468  "property %0 is a class property; did you mean to access it with class '%1'?">;
10469def err_ivar_access_using_property_syntax_suggest : Error<
10470  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
10471def warn_property_access_suggest : Warning<
10472"property %0 not found on object of type %1; did you mean to access property %2?">,
10473InGroup<PropertyAccessDotSyntax>;
10474def err_property_found_suggest : Error<
10475  "property %0 found on object of type %1; did you mean to access "
10476  "it with the \".\" operator?">;
10477def err_undef_interface_suggest : Error<
10478  "cannot find interface declaration for %0; did you mean %1?">;
10479def warn_undef_interface_suggest : Warning<
10480  "cannot find interface declaration for %0; did you mean %1?">;
10481def err_undef_superclass_suggest : Error<
10482  "cannot find interface declaration for %0, superclass of %1; did you mean "
10483  "%2?">;
10484def err_undeclared_protocol_suggest : Error<
10485  "cannot find protocol declaration for %0; did you mean %1?">;
10486def note_base_class_specified_here : Note<
10487  "base class %0 specified here">;
10488def err_using_directive_suggest : Error<
10489  "no namespace named %0; did you mean %1?">;
10490def err_using_directive_member_suggest : Error<
10491  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
10492def note_namespace_defined_here : Note<"namespace %0 defined here">;
10493def err_sizeof_pack_no_pack_name_suggest : Error<
10494  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
10495def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
10496
10497def err_uncasted_use_of_unknown_any : Error<
10498  "%0 has unknown type; cast it to its declared type to use it">;
10499def err_uncasted_call_of_unknown_any : Error<
10500  "%0 has unknown return type; cast the call to its declared return type">;
10501def err_uncasted_send_to_unknown_any_method : Error<
10502  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
10503  "message send to the method's return type">;
10504def err_unsupported_unknown_any_decl : Error<
10505  "%0 has unknown type, which is not supported for this kind of declaration">;
10506def err_unsupported_unknown_any_expr : Error<
10507  "unsupported expression with unknown type">;
10508def err_unsupported_unknown_any_call : Error<
10509  "call to unsupported expression with unknown type">;
10510def err_unknown_any_addrof : Error<
10511  "the address of a declaration with unknown type "
10512  "can only be cast to a pointer type">;
10513def err_unknown_any_addrof_call : Error<
10514  "address-of operator cannot be applied to a call to a function with "
10515  "unknown return type">;
10516def err_unknown_any_var_function_type : Error<
10517  "variable %0 with unknown type cannot be given a function type">;
10518def err_unknown_any_function : Error<
10519  "function %0 with unknown type must be given a function type">;
10520
10521def err_filter_expression_integral : Error<
10522  "filter expression has non-integral type %0">;
10523
10524def err_non_asm_stmt_in_naked_function : Error<
10525  "non-ASM statement in naked function is not supported">;
10526def err_asm_naked_this_ref : Error<
10527  "'this' pointer references not allowed in naked functions">;
10528def err_asm_naked_parm_ref : Error<
10529  "parameter references not allowed in naked functions">;
10530
10531// OpenCL warnings and errors.
10532def err_invalid_astype_of_different_size : Error<
10533  "invalid reinterpretation: sizes of %0 and %1 must match">;
10534def err_static_kernel : Error<
10535  "kernel functions cannot be declared static">;
10536def err_method_kernel : Error<
10537  "kernel functions cannot be class members">;
10538def err_template_kernel : Error<
10539  "kernel functions cannot be used in a template declaration, instantiation or specialization">;
10540def err_opencl_ptrptr_kernel_param : Error<
10541  "kernel parameter cannot be declared as a pointer to a pointer">;
10542def err_kernel_arg_address_space : Error<
10543  "pointer arguments to kernel functions must reside in '__global', "
10544  "'__constant' or '__local' address space">;
10545def err_opencl_ext_vector_component_invalid_length : Error<
10546  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
10547def err_opencl_function_variable : Error<
10548  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
10549def err_opencl_addrspace_scope : Error<
10550  "variables in the %0 address space can only be declared in the outermost "
10551  "scope of a kernel function">;
10552def err_static_function_scope : Error<
10553  "variables in function scope cannot be declared static">;
10554def err_opencl_bitfields : Error<
10555  "bit-fields are not supported in OpenCL">;
10556def err_opencl_vla : Error<
10557  "variable length arrays are not supported in OpenCL">;
10558def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
10559    "scalar operand type has greater rank than the type of the vector "
10560    "element. (%0 and %1)">;
10561def err_bad_kernel_param_type : Error<
10562  "%0 cannot be used as the type of a kernel parameter">;
10563def err_record_with_pointers_kernel_param : Error<
10564  "%select{struct|union}0 kernel parameters may not contain pointers">;
10565def note_within_field_of_type : Note<
10566  "within field of type %0 declared here">;
10567def note_illegal_field_declared_here : Note<
10568  "field of illegal %select{type|pointer type}0 %1 declared here">;
10569def err_opencl_type_struct_or_union_field : Error<
10570  "the %0 type cannot be used to declare a structure or union field">;
10571def err_event_t_addr_space_qual : Error<
10572  "the event_t type can only be used with __private address space qualifier">;
10573def err_expected_kernel_void_return_type : Error<
10574  "kernel must have void return type">;
10575def err_sampler_initializer_not_integer : Error<
10576  "sampler_t initialization requires 32-bit integer, not %0">;
10577def warn_sampler_initializer_invalid_bits : Warning<
10578  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
10579def err_sampler_argument_required : Error<
10580  "sampler_t variable required - got %0">;
10581def err_wrong_sampler_addressspace: Error<
10582  "sampler type cannot be used with the __local and __global address space qualifiers">;
10583def err_opencl_nonconst_global_sampler : Error<
10584  "global sampler requires a const or constant address space qualifier">;
10585def err_opencl_cast_non_zero_to_event_t : Error<
10586  "cannot cast non-zero value '%0' to 'event_t'">;
10587def err_opencl_global_invalid_addr_space : Error<
10588  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
10589def err_missing_actual_pipe_type : Error<
10590  "missing actual type specifier for pipe">;
10591def err_reference_pipe_type : Error <
10592  "pipes packet types cannot be of reference type">;
10593def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
10594def err_opencl_kernel_attr :
10595  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
10596def err_return_value_with_address_space : Error<
10597  "return type cannot be qualified with address space">;
10598def err_opencl_constant_no_init : Error<
10599  "variable in constant address space must be initialized">;
10600def err_opencl_atomic_init: Error<
10601  "atomic variable can be %select{assigned|initialized}0 to a variable only "
10602  "in global address space">;
10603def err_opencl_implicit_vector_conversion : Error<
10604  "implicit conversions between vector types (%0 and %1) are not permitted">;
10605def err_opencl_invalid_type_array : Error<
10606  "array of %0 type is invalid in OpenCL">;
10607def err_opencl_ternary_with_block : Error<
10608  "block type cannot be used as expression in ternary expression in OpenCL">;
10609def err_opencl_pointer_to_type : Error<
10610  "pointer to type %0 is invalid in OpenCL">;
10611def err_opencl_type_can_only_be_used_as_function_parameter : Error <
10612  "type %0 can only be used as a function parameter in OpenCL">;
10613def err_opencl_type_not_found : Error<
10614  "%0 type %1 not found; include the base header with -finclude-default-header">;
10615def warn_opencl_attr_deprecated_ignored : Warning <
10616  "%0 attribute is deprecated and ignored in %1">, InGroup<IgnoredAttributes>;
10617def err_opencl_variadic_function : Error<
10618  "invalid prototype, variadic arguments are not allowed in OpenCL">;
10619def err_opencl_requires_extension : Error<
10620  "use of %select{type|declaration}0 %1 requires %2 support">;
10621def ext_opencl_double_without_pragma : Extension<
10622  "Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is"
10623  " supported">;
10624def warn_opencl_generic_address_space_arg : Warning<
10625  "passing non-generic address space pointer to %0"
10626  " may cause dynamic conversion affecting performance">,
10627  InGroup<Conversion>, DefaultIgnore;
10628
10629// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
10630def err_opencl_builtin_pipe_first_arg : Error<
10631  "first argument to %0 must be a pipe type">;
10632def err_opencl_builtin_pipe_arg_num : Error<
10633  "invalid number of arguments to function: %0">;
10634def err_opencl_builtin_pipe_invalid_arg : Error<
10635  "invalid argument type to function %0 (expecting %1 having %2)">;
10636def err_opencl_builtin_pipe_invalid_access_modifier : Error<
10637  "invalid pipe access modifier (expecting %0)">;
10638
10639// OpenCL access qualifier
10640def err_opencl_invalid_access_qualifier : Error<
10641  "access qualifier can only be used for pipe and image type">;
10642def err_opencl_invalid_read_write : Error<
10643  "access qualifier %0 can not be used for %1 %select{|prior to OpenCL C version 2.0 or in version 3.0 "
10644  "and without __opencl_c_read_write_images feature}2">;
10645def err_opencl_multiple_access_qualifiers : Error<
10646  "multiple access qualifiers">;
10647def note_opencl_typedef_access_qualifier : Note<
10648  "previously declared '%0' here">;
10649
10650// OpenCL v2.0 s6.12.5 Blocks restrictions
10651def err_opencl_block_storage_type : Error<
10652  "the __block storage type is not permitted">;
10653def err_opencl_invalid_block_declaration : Error<
10654  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
10655def err_opencl_extern_block_declaration : Error<
10656  "invalid block variable declaration - using 'extern' storage class is disallowed">;
10657def err_opencl_block_ref_block : Error<
10658  "cannot refer to a block inside block">;
10659
10660// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
10661def err_opencl_builtin_to_addr_invalid_arg : Error<
10662  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
10663
10664// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
10665def err_opencl_enqueue_kernel_incorrect_args : Error<
10666  "illegal call to enqueue_kernel, incorrect argument types">;
10667def err_opencl_enqueue_kernel_local_size_args : Error<
10668  "mismatch in number of block parameters and local size arguments passed">;
10669def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
10670  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
10671def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
10672  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
10673def err_opencl_enqueue_kernel_blocks_no_args : Error<
10674  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
10675
10676def err_opencl_builtin_expected_type : Error<
10677  "illegal call to %0, expected %1 argument type">;
10678
10679// OpenCL v3.0 s6.3.7 - Vector Components
10680def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
10681  "vector component name '%0' is a feature from OpenCL version 3.0 onwards">,
10682  InGroup<OpenCLUnsupportedRGBA>;
10683
10684def err_openclcxx_placement_new : Error<
10685  "use of placement new requires explicit declaration">;
10686
10687// MIG routine annotations.
10688def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
10689  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
10690  InGroup<IgnoredAttributes>;
10691
10692def warn_imp_cast_drops_unaligned : Warning<
10693  "implicit cast from type %0 to type %1 drops __unaligned qualifier">,
10694  InGroup<DiagGroup<"unaligned-qualifier-implicit-cast">>;
10695
10696} // end of sema category
10697
10698let CategoryName = "OpenMP Issue" in {
10699// OpenMP support.
10700def err_omp_expected_var_arg : Error<
10701  "%0 is not a global variable, static local variable or static data member">;
10702def err_omp_expected_var_arg_suggest : Error<
10703  "%0 is not a global variable, static local variable or static data member; "
10704  "did you mean %1">;
10705def err_omp_global_var_arg : Error<
10706  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
10707def err_omp_ref_type_arg : Error<
10708  "arguments of '#pragma omp %0' cannot be of reference type %1">;
10709def err_omp_region_not_file_context : Error<
10710  "directive must be at file or namespace scope">;
10711def err_omp_var_scope : Error<
10712  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
10713def err_omp_var_used : Error<
10714  "'#pragma omp %0' must precede all references to variable %q1">;
10715def err_omp_var_thread_local : Error<
10716  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
10717def err_omp_private_incomplete_type : Error<
10718  "a private variable with incomplete type %0">;
10719def err_omp_firstprivate_incomplete_type : Error<
10720  "a firstprivate variable with incomplete type %0">;
10721def err_omp_lastprivate_incomplete_type : Error<
10722  "a lastprivate variable with incomplete type %0">;
10723def err_omp_reduction_incomplete_type : Error<
10724  "a reduction list item with incomplete type %0">;
10725def warn_omp_minus_in_reduction_deprecated : Warning<
10726  "minus(-) operator for reductions is deprecated; use + or user defined reduction instead">,
10727  InGroup<Deprecated>;
10728def err_omp_unexpected_clause_value : Error<
10729  "expected %0 in OpenMP clause '%1'">;
10730def err_omp_unexpected_call_to_omp_runtime_api
10731    : Error<"calls to OpenMP runtime API are not allowed within a region that "
10732            "corresponds to a construct with an order clause that specifies "
10733            "concurrent">;
10734def err_omp_expected_var_name_member_expr : Error<
10735  "expected variable name%select{| or data member of current class}0">;
10736def err_omp_expected_var_name_member_expr_with_type : Error<
10737  "expected variable%select{| or static data member|, static data member, "
10738  "or non-static data member of current class}0 of type '%1'">;
10739def err_omp_expected_var_name_member_expr_or_array_item : Error<
10740  "expected variable name%select{|, data member of current class}0, array element or array section">;
10741def err_omp_expected_addressable_lvalue_or_array_item : Error<
10742  "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">;
10743def err_omp_expected_named_var_member_or_array_expression: Error<
10744  "expected expression containing only member accesses and/or array sections based on named variables">;
10745def err_omp_bit_fields_forbidden_in_clause : Error<
10746  "bit fields cannot be used to specify storage in a '%0' clause">;
10747def err_array_section_does_not_specify_contiguous_storage : Error<
10748  "array section does not specify contiguous storage">;
10749def err_array_section_does_not_specify_length : Error<
10750  "array section does not specify length for outermost dimension">;
10751def err_omp_union_type_not_allowed : Error<
10752  "mapping of union members is not allowed">;
10753def err_omp_expected_access_to_data_field : Error<
10754  "expected access to data field">;
10755def err_omp_multiple_array_items_in_map_clause : Error<
10756  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
10757def err_omp_duplicate_map_type_modifier : Error<
10758  "same map type modifier has been specified more than once">;
10759def err_omp_duplicate_motion_modifier : Error<
10760  "same motion modifier has been specified more than once">;
10761def err_omp_pointer_mapped_along_with_derived_section : Error<
10762  "pointer cannot be mapped along with a section derived from itself">;
10763def err_omp_original_storage_is_shared_and_does_not_contain : Error<
10764  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
10765def err_omp_same_pointer_dereferenced : Error<
10766  "same pointer dereferenced in multiple different ways in map clause expressions">;
10767def note_omp_task_predetermined_firstprivate_here : Note<
10768  "predetermined as a firstprivate in a task construct here">;
10769def err_omp_threadprivate_incomplete_type : Error<
10770  "threadprivate variable with incomplete type %0">;
10771def err_omp_no_dsa_for_variable : Error<
10772  "variable %0 must have explicitly specified data sharing attributes">;
10773def err_omp_defaultmap_no_attr_for_variable : Error<
10774  "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
10775def note_omp_default_dsa_none : Note<
10776  "explicit data sharing attribute requested here">;
10777def note_omp_defaultmap_attr_none : Note<
10778  "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
10779def err_omp_wrong_dsa : Error<
10780  "%0 variable cannot be %1">;
10781def err_omp_variably_modified_type_not_supported : Error<
10782  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
10783def note_omp_explicit_dsa : Note<
10784  "defined as %0">;
10785def note_omp_predetermined_dsa : Note<
10786  "%select{static data member is predetermined as shared|"
10787  "variable with static storage duration is predetermined as shared|"
10788  "loop iteration variable is predetermined as private|"
10789  "loop iteration variable is predetermined as linear|"
10790  "loop iteration variable is predetermined as lastprivate|"
10791  "constant variable is predetermined as shared|"
10792  "global variable is predetermined as shared|"
10793  "non-shared variable in a task construct is predetermined as firstprivate|"
10794  "variable with automatic storage duration is predetermined as private}0"
10795  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
10796def note_omp_implicit_dsa : Note<
10797  "implicitly determined as %0">;
10798def err_omp_loop_var_dsa : Error<
10799  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
10800def err_omp_not_for : Error<
10801  "%select{statement after '#pragma omp %1' must be a for loop|"
10802  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
10803def note_omp_collapse_ordered_expr : Note<
10804  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
10805def err_omp_negative_expression_in_clause : Error<
10806  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
10807def err_omp_not_integral : Error<
10808  "expression must have integral or unscoped enumeration "
10809  "type, not %0">;
10810def err_omp_threadprivate_in_target : Error<
10811  "threadprivate variables cannot be used in target constructs">;
10812def err_omp_incomplete_type : Error<
10813  "expression has incomplete class type %0">;
10814def err_omp_explicit_conversion : Error<
10815  "expression requires explicit conversion from %0 to %1">;
10816def note_omp_conversion_here : Note<
10817  "conversion to %select{integral|enumeration}0 type %1 declared here">;
10818def err_omp_ambiguous_conversion : Error<
10819  "ambiguous conversion from type %0 to an integral or unscoped "
10820  "enumeration type">;
10821def err_omp_iterator_not_integral_or_pointer : Error<
10822  "expected integral or pointer type as the iterator-type, not %0">;
10823def err_omp_iterator_step_not_integral : Error<
10824  "iterator step expression %0 is not the integral expression">;
10825def err_omp_iterator_step_constant_zero : Error<
10826  "iterator step expression %0 evaluates to 0">;
10827def err_omp_required_access : Error<
10828  "%0 variable must be %1">;
10829def err_omp_const_variable : Error<
10830  "const-qualified variable cannot be %0">;
10831def err_omp_const_not_mutable_variable : Error<
10832  "const-qualified variable without mutable fields cannot be %0">;
10833def err_omp_const_list_item : Error<
10834  "const-qualified list item cannot be %0">;
10835def err_omp_linear_incomplete_type : Error<
10836  "a linear variable with incomplete type %0">;
10837def err_omp_linear_expected_int_or_ptr : Error<
10838  "argument of a linear clause should be of integral or pointer "
10839  "type, not %0">;
10840def warn_omp_linear_step_zero : Warning<
10841  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
10842  InGroup<OpenMPClauses>;
10843def warn_omp_alignment_not_power_of_two : Warning<
10844  "aligned clause will be ignored because the requested alignment is not a power of 2">,
10845  InGroup<OpenMPClauses>;
10846def err_omp_invalid_target_decl : Error<
10847  "%0 used in declare target directive is not a variable or a function name">;
10848def err_omp_declare_target_to_and_link : Error<
10849  "%0 must not appear in both clauses 'to' and 'link'">;
10850def warn_omp_not_in_target_context : Warning<
10851  "declaration is not declared in any declare target region">,
10852  InGroup<OpenMPTarget>;
10853def err_omp_function_in_link_clause : Error<
10854  "function name is not allowed in 'link' clause">;
10855def err_omp_aligned_expected_array_or_ptr : Error<
10856  "argument of aligned clause should be array"
10857  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
10858  ", not %0">;
10859def err_omp_used_in_clause_twice : Error<
10860  "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
10861def err_omp_local_var_in_threadprivate_init : Error<
10862  "variable with local storage in initial value of threadprivate variable">;
10863def err_omp_loop_not_canonical_init : Error<
10864  "initialization clause of OpenMP for loop is not in canonical form "
10865  "('var = init' or 'T var = init')">;
10866def ext_omp_loop_not_canonical_init : ExtWarn<
10867  "initialization clause of OpenMP for loop is not in canonical form "
10868  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
10869def err_omp_loop_not_canonical_cond : Error<
10870  "condition of OpenMP for loop must be a relational comparison "
10871  "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
10872def err_omp_loop_not_canonical_incr : Error<
10873  "increment clause of OpenMP for loop must perform simple addition "
10874  "or subtraction on loop variable %0">;
10875def err_omp_loop_variable_type : Error<
10876  "variable must be of integer or %select{pointer|random access iterator}0 type">;
10877def err_omp_loop_incr_not_compatible : Error<
10878  "increment expression must cause %0 to %select{decrease|increase}1 "
10879  "on each iteration of OpenMP for loop">;
10880def note_omp_loop_cond_requres_compatible_incr : Note<
10881  "loop step is expected to be %select{negative|positive}0 due to this condition">;
10882def err_omp_loop_diff_cxx : Error<
10883  "could not calculate number of iterations calling 'operator-' with "
10884  "upper and lower loop bounds">;
10885def err_omp_loop_cannot_use_stmt : Error<
10886  "'%0' statement cannot be used in OpenMP for loop">;
10887def err_omp_simd_region_cannot_use_stmt : Error<
10888  "'%0' statement cannot be used in OpenMP simd region">;
10889def warn_omp_loop_64_bit_var : Warning<
10890  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
10891  InGroup<OpenMPLoopForm>;
10892def err_omp_unknown_reduction_identifier_prior_omp_6_0 : Error<
10893  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
10894  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10895def err_omp_unknown_reduction_identifier_since_omp_6_0 : Error<
10896  "incorrect reduction identifier, expected one of '+', '*', '&', '|', '^', "
10897  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10898def err_omp_not_resolved_reduction_identifier : Error<
10899  "unable to resolve declare reduction construct for type %0">;
10900def err_omp_reduction_ref_type_arg : Error<
10901  "argument of OpenMP clause '%0' must reference the same object in all threads">;
10902def err_omp_clause_not_arithmetic_type_arg : Error<
10903  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
10904def err_omp_clause_floating_type_arg : Error<
10905  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
10906def err_omp_once_referenced : Error<
10907  "variable can appear only once in OpenMP '%0' clause">;
10908def err_omp_once_referenced_in_target_update : Error<
10909  "variable can appear only once in OpenMP 'target update' construct">;
10910def note_omp_referenced : Note<
10911  "previously referenced here">;
10912def err_omp_reduction_in_task : Error<
10913  "reduction variables may not be accessed in an explicit task">;
10914def err_omp_reduction_id_not_compatible : Error<
10915  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
10916def err_omp_reduction_identifier_mismatch : Error<
10917  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
10918def note_omp_previous_reduction_identifier : Note<
10919  "previously marked as task_reduction with different reduction operation">;
10920def err_omp_prohibited_region : Error<
10921  "region cannot be%select{| closely}0 nested inside '%1' region"
10922  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
10923  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
10924  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
10925  "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
10926  "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
10927def err_omp_prohibited_region_simd : Error<
10928  "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
10929def err_omp_prohibited_region_atomic : Error<
10930  "OpenMP constructs may not be nested inside an atomic region">;
10931def err_omp_prohibited_region_order
10932    : Error<"construct '%0' not allowed in a region associated with a "
10933            "directive with 'order' clause">;
10934def err_omp_prohibited_region_critical_same_name : Error<
10935  "cannot nest 'critical' regions having the same name %0">;
10936def note_omp_previous_critical_region : Note<
10937  "previous 'critical' region starts here">;
10938def err_omp_several_directives_in_region : Error<
10939  "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
10940def note_omp_previous_directive : Note<
10941  "previous '%0' directive used here">;
10942def err_omp_sections_not_compound_stmt : Error<
10943  "the statement for '#pragma omp sections' must be a compound statement">;
10944def err_omp_parallel_sections_not_compound_stmt : Error<
10945  "the statement for '#pragma omp parallel sections' must be a compound statement">;
10946def err_omp_orphaned_section_directive : Error<
10947  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
10948  " must be closely nested to a sections region%select{|, not a %1 region}0">;
10949def err_omp_sections_substmt_not_section : Error<
10950  "statement in 'omp sections' directive must be enclosed into a section region">;
10951def err_omp_parallel_sections_substmt_not_section : Error<
10952  "statement in 'omp parallel sections' directive must be enclosed into a section region">;
10953def err_omp_parallel_reduction_in_task_firstprivate : Error<
10954  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
10955def err_omp_atomic_read_not_expression_statement : Error<
10956  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
10957  " where v and x are both lvalue expressions with scalar type">;
10958def note_omp_atomic_read_write: Note<
10959  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
10960def err_omp_atomic_write_not_expression_statement : Error<
10961  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
10962  " where x is a lvalue expression with scalar type">;
10963def err_omp_atomic_update_not_expression_statement : Error<
10964  "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',"
10965  " where x is an lvalue expression with scalar type">;
10966def err_omp_atomic_not_expression_statement : Error<
10967  "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',"
10968  " where x is an lvalue expression with scalar type">;
10969def note_omp_atomic_update: Note<
10970  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
10971  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
10972  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
10973def err_omp_atomic_capture_not_expression_statement : Error<
10974  "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',"
10975  " where x and v are both lvalue expressions with scalar type">;
10976def err_omp_atomic_capture_not_compound_statement : Error<
10977  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
10978  " '{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;}',"
10979  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
10980  " where x is an lvalue expression with scalar type">;
10981def note_omp_atomic_capture: Note<
10982  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
10983def err_omp_atomic_compare : Error<
10984  "the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}',"
10985  " '{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;}',"
10986  " 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type,"
10987  " and 'ordop' is one of '<' or '>'.">;
10988def err_omp_atomic_compare_capture : Error<
10989  "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;}}',"
10990  " '{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;}',"
10991  " '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,"
10992  " and 'ordop' is one of '<' or '>'.">;
10993def note_omp_atomic_compare: Note<
10994  "%select{expected compound statement|expected exactly one expression statement|expected assignment statement|expected conditional operator|expect result value to be at false expression|"
10995  "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'|"
10996  "expect lvalue for result value|expect scalar value|expect integer value|unexpected 'else' statement|expect '==' operator|expect an assignment statement 'v = x'|"
10997  "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">;
10998def err_omp_atomic_fail_wrong_or_no_clauses : Error<"expected a memory order clause">;
10999def err_omp_atomic_fail_no_compare : Error<"expected 'compare' clause with the 'fail' modifier">;
11000def err_omp_atomic_several_clauses : Error<
11001  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
11002def err_omp_several_mem_order_clauses : Error<
11003  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
11004def err_omp_atomic_incompatible_mem_order_clause : Error<
11005  "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
11006def note_omp_previous_mem_order_clause : Note<
11007  "'%0' clause used here">;
11008def err_omp_target_contains_not_only_teams : Error<
11009  "target construct with nested teams region contains statements outside of the teams construct">;
11010def note_omp_nested_teams_construct_here : Note<
11011  "nested teams construct here">;
11012def note_omp_nested_statement_here : Note<
11013  "%select{statement|directive}0 outside teams construct here">;
11014def err_omp_single_copyprivate_with_nowait : Error<
11015  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
11016def err_omp_nowait_clause_without_depend: Error<
11017  "directive '#pragma omp taskwait' cannot use 'nowait' clause without 'depend' clause">;
11018def note_omp_nowait_clause_here : Note<
11019  "'nowait' clause is here">;
11020def err_omp_single_decl_in_declare_simd_variant : Error<
11021  "single declaration is expected after 'declare %select{simd|variant}0' directive">;
11022def err_omp_function_expected : Error<
11023  "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
11024def err_omp_wrong_cancel_region : Error<
11025  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
11026def err_omp_parent_cancel_region_nowait : Error<
11027  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
11028def err_omp_parent_cancel_region_ordered : Error<
11029  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
11030def 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">;
11031def 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">;
11032def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
11033def err_omp_mapper_wrong_type : Error<
11034  "mapper type must be of struct, union or class type">;
11035def err_omp_declare_mapper_wrong_var : Error<
11036  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
11037def err_omp_declare_mapper_redefinition : Error<
11038  "redefinition of user-defined mapper for type %0 with name %1">;
11039def err_omp_invalid_mapper: Error<
11040  "cannot find a valid user-defined mapper for type %0 with name %1">;
11041def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
11042def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
11043def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
11044def err_omp_typecheck_section_value : Error<
11045  "subscripted value is not an array or pointer">;
11046def err_omp_typecheck_section_not_integer : Error<
11047  "array section %select{lower bound|length}0 is not an integer">;
11048def err_omp_typecheck_shaping_not_integer : Error<
11049  "array shaping operation dimension is not an integer">;
11050def err_omp_shaping_dimension_not_positive : Error<
11051  "array shaping dimension is evaluated to a non-positive value %0">;
11052def err_omp_section_function_type : Error<
11053  "section of pointer to function type %0">;
11054def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
11055  InGroup<CharSubscript>, DefaultIgnore;
11056def err_omp_section_incomplete_type : Error<
11057  "section of pointer to incomplete type %0">;
11058def err_omp_section_not_subset_of_array : Error<
11059  "array section must be a subset of the original array">;
11060def err_omp_section_length_negative : Error<
11061  "section length is evaluated to a negative value %0">;
11062def err_omp_section_stride_non_positive : Error<
11063  "section stride is evaluated to a non-positive value %0">;
11064def err_omp_section_length_undefined : Error<
11065  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
11066def err_omp_wrong_linear_modifier : Error<
11067  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
11068def err_omp_wrong_linear_modifier_non_reference : Error<
11069  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
11070def err_omp_step_simple_modifier_exclusive : Error<
11071  "step simple modifier is exclusive and can't be use with 'val', 'uval' or 'ref' modifier">;
11072def err_omp_wrong_simdlen_safelen_values : Error<
11073  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
11074def err_omp_wrong_if_directive_name_modifier : Error<
11075  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
11076def err_omp_no_more_if_clause : Error<
11077  "no more 'if' clause is allowed">;
11078def err_omp_unnamed_if_clause : Error<
11079  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
11080def note_omp_previous_named_if_clause : Note<
11081  "previous clause with directive name modifier specified here">;
11082def err_omp_ordered_directive_with_param : Error<
11083  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
11084def err_omp_ordered_directive_without_param : Error<
11085  "'ordered' directive with '%0' clause cannot be closely nested inside ordered region without specified parameter">;
11086def note_omp_ordered_param : Note<
11087  "'ordered' clause%select{| with specified parameter}0">;
11088def err_omp_expected_base_var_name : Error<
11089  "expected variable name as a base of the array %select{subscript|section}0">;
11090def err_omp_map_shared_storage : Error<
11091  "variable already marked as mapped in current construct">;
11092def err_omp_invalid_map_type_for_directive : Error<
11093  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
11094def err_omp_invalid_map_type_modifier_for_directive : Error<
11095  "map type modifier '%0' is not allowed for '#pragma omp %1'">;
11096def err_omp_no_clause_for_directive : Error<
11097  "expected at least one %0 clause for '#pragma omp %1'">;
11098def err_omp_threadprivate_in_clause : Error<
11099  "threadprivate variables are not allowed in '%0' clause">;
11100def err_omp_wrong_ordered_loop_count : Error<
11101  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
11102def note_collapse_loop_count : Note<
11103  "parameter of the 'collapse' clause">;
11104def err_omp_clauses_mutually_exclusive : Error<
11105  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
11106def note_omp_previous_clause : Note<
11107  "'%0' clause is specified here">;
11108def err_omp_hint_clause_no_name : Error<
11109  "the name of the construct must be specified in presence of 'hint' clause">;
11110def err_omp_critical_with_hint : Error<
11111  "constructs with the same name must have a 'hint' clause with the same value">;
11112def note_omp_critical_hint_here : Note<
11113  "%select{|previous }0'hint' clause with value '%1'">;
11114def note_omp_critical_no_hint : Note<
11115  "%select{|previous }0directive with no 'hint' clause specified">;
11116def err_omp_depend_clause_thread_simd : Error<
11117  "'%0' clauses cannot be mixed with '%1' clause">;
11118def err_omp_depend_sink_expected_loop_iteration : Error<
11119  "expected%select{| %1}0 loop iteration variable">;
11120def err_omp_depend_sink_unexpected_expr : Error<
11121  "unexpected expression: number of expressions is larger than the number of associated loops">;
11122def err_omp_depend_sink_expected_plus_minus : Error<
11123  "expected '+' or '-' operation">;
11124def err_omp_taskwait_depend_mutexinoutset_not_allowed : Error<
11125  "'mutexinoutset' modifier not allowed in 'depend' clause on 'taskwait' directive">;
11126def err_omp_sink_and_source_not_allowed : Error<
11127  "'%0(%select{source|sink:vec}1)' clause%select{|s}1 cannot be mixed with '%0(%select{sink:vec|source}1)' clause%select{s|}1">;
11128def err_omp_depend_zero_length_array_section_not_allowed : Error<
11129  "zero-length array section is not allowed in 'depend' clause">;
11130def err_omp_depend_sink_source_with_modifier : Error<
11131  "depend modifier cannot be used with 'sink' or 'source' depend type">;
11132def err_omp_depend_modifier_not_iterator : Error<
11133  "expected iterator specification as depend modifier">;
11134def err_omp_map_modifier_not_iterator : Error<
11135  "expected iterator specification as map modifier">;
11136def err_omp_linear_ordered : Error<
11137  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
11138def err_omp_unexpected_schedule_modifier : Error<
11139  "modifier '%0' cannot be used along with modifier '%1'">;
11140def err_omp_schedule_nonmonotonic_static : Error<
11141  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
11142def err_omp_simple_clause_incompatible_with_ordered : Error<
11143  "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
11144def err_omp_ordered_simd : Error<
11145  "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
11146def err_omp_variable_in_given_clause_and_dsa : Error<
11147  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
11148def err_omp_param_or_this_in_clause : Error<
11149  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
11150def err_omp_expected_uniform_param : Error<
11151  "expected a reference to a parameter specified in a 'uniform' clause">;
11152def err_omp_expected_int_param : Error<
11153  "expected a reference to an integer-typed parameter">;
11154def err_omp_at_least_one_motion_clause_required : Error<
11155  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
11156def err_omp_cannot_update_with_internal_linkage : Error<
11157  "the host cannot update a declare target variable that is not externally visible.">;
11158def err_omp_usedeviceptr_not_a_pointer : Error<
11159  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
11160def err_omp_argument_type_isdeviceptr : Error <
11161  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
11162def warn_omp_nesting_simd : Warning<
11163  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
11164  InGroup<SourceUsesOpenMP>;
11165def err_omp_orphaned_device_directive : Error<
11166  "orphaned 'omp %0' directives are prohibited"
11167  "; perhaps you forget to enclose the directive into a "
11168  "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
11169def err_omp_reduction_non_addressable_expression : Error<
11170  "expected addressable reduction item for the task-based directives">;
11171def err_omp_reduction_with_nogroup : Error<
11172  "'reduction' clause cannot be used with 'nogroup' clause">;
11173def err_omp_reduction_vla_unsupported : Error<
11174  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
11175def err_omp_linear_distribute_var_non_loop_iteration : Error<
11176  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
11177def warn_omp_non_trivial_type_mapped : Warning<
11178  "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
11179  InGroup<OpenMPMapping>;
11180def err_omp_requires_clause_redeclaration : Error <
11181  "Only one %0 clause can appear on a requires directive in a single translation unit">;
11182def note_omp_requires_previous_clause : Note <
11183  "%0 clause previously used here">;
11184def err_omp_directive_before_requires : Error <
11185  "'%0' region encountered before requires directive with '%1' clause">;
11186def note_omp_requires_encountered_directive : Note <
11187  "'%0' previously encountered here">;
11188def err_omp_device_ancestor_without_requires_reverse_offload : Error <
11189  "Device clause with ancestor device-modifier used without specifying 'requires reverse_offload'">;
11190def err_omp_invalid_scope : Error <
11191  "'#pragma omp %0' directive must appear only in file scope">;
11192def note_omp_invalid_length_on_this_ptr_mapping : Note <
11193  "expected length on mapping of 'this' array section expression to be '1'">;
11194def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
11195  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
11196def note_omp_invalid_subscript_on_this_ptr_map : Note <
11197  "expected 'this' subscript expression on map clause to be 'this[0]'">;
11198def err_omp_invalid_map_this_expr : Error <
11199  "invalid 'this' expression on 'map' clause">;
11200def err_omp_implied_type_not_found : Error<
11201  "'%0' type not found; include <omp.h>">;
11202def err_omp_expected_omp_depend_t_lvalue : Error<
11203  "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
11204def err_omp_depobj_expected : Error<
11205  "expected depobj expression">;
11206def err_omp_depobj_single_clause_expected : Error<
11207  "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
11208def err_omp_scan_single_clause_expected : Error<
11209  "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
11210def err_omp_inclusive_exclusive_not_reduction : Error<
11211  "the list item must appear in 'reduction' clause with the 'inscan' modifier "
11212  "of the parent directive">;
11213def err_omp_reduction_not_inclusive_exclusive : Error<
11214  "the inscan reduction list item must appear as a list item in an 'inclusive' or"
11215  " 'exclusive' clause on an inner 'omp scan' directive">;
11216def err_omp_wrong_inscan_reduction : Error<
11217  "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
11218  " 'omp parallel for', or 'omp parallel for simd' directive">;
11219def err_omp_inscan_reduction_expected : Error<
11220  "expected 'reduction' clause with the 'inscan' modifier">;
11221def note_omp_previous_inscan_reduction : Note<
11222  "'reduction' clause with 'inscan' modifier is used here">;
11223def err_omp_expected_predefined_allocator : Error<
11224  "expected one of the predefined allocators for the variables with the static "
11225  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
11226  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
11227  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
11228def warn_omp_used_different_allocator : Warning<
11229  "allocate directive specifies %select{default|'%1'}0 allocator while "
11230  "previously used %select{default|'%3'}2">,
11231  InGroup<OpenMPClauses>;
11232def note_omp_previous_allocator : Note<
11233  "previous allocator is specified here">;
11234def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
11235  "inside of the target region; provide an 'allocator' clause or use 'requires'"
11236  " directive with the 'dynamic_allocators' clause">;
11237def err_expected_allocator_expression : Error<"expected an allocator expression "
11238  "inside of the target region; provide an allocator expression or use 'requires'"
11239  " directive with the 'dynamic_allocators' clause">;
11240def warn_omp_allocate_thread_on_task_target_directive : Warning<
11241  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
11242  InGroup<OpenMPClauses>;
11243def err_omp_expected_private_copy_for_allocate : Error<
11244  "the referenced item is not found in any private clause on the same directive">;
11245def err_omp_stmt_depends_on_loop_counter : Error<
11246  "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
11247def err_omp_invariant_dependency : Error<
11248  "expected loop invariant expression">;
11249def err_omp_invariant_or_linear_dependency : Error<
11250  "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
11251def err_omp_wrong_dependency_iterator_type : Error<
11252  "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
11253def err_target_unsupported_type
11254    : Error<"%0 requires %select{|%2 bit size}1 %3 %select{|return }4type support,"
11255            " but target '%5' does not support it">;
11256def err_omp_lambda_capture_in_declare_target_not_to : Error<
11257  "variable captured in declare target region must appear in a to clause">;
11258def err_omp_device_type_mismatch : Error<
11259  "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
11260def err_omp_wrong_device_function_call : Error<
11261  "function with 'device_type(%0)' is not available on %select{device|host}1">;
11262def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
11263def warn_omp_declare_target_after_first_use : Warning<
11264  "declaration marked as declare target after first use, it may lead to incorrect results">,
11265  InGroup<OpenMPTarget>;
11266def err_omp_declare_variant_incompat_attributes : Error<
11267  "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
11268def warn_omp_declare_variant_score_not_constant
11269    : Warning<"score expressions in the OpenMP context selector need to be "
11270              "constant; %0 is not and will be ignored">,
11271      InGroup<SourceUsesOpenMP>;
11272def err_omp_declare_variant_user_condition_not_constant
11273    : Error<"the user condition in the OpenMP context selector needs to be "
11274            "constant; %0 is not">;
11275def warn_omp_declare_variant_after_used : Warning<
11276  "'#pragma omp declare variant' cannot be applied for function after first "
11277  "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
11278def warn_omp_declare_variant_after_emitted : Warning<
11279  "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
11280  " the original function might be used">, InGroup<SourceUsesOpenMP>;
11281def err_omp_declare_variant_doesnt_support : Error<
11282  "'#pragma omp declare variant' does not "
11283  "support %select{function templates|virtual functions|"
11284  "deduced return types|constructors|destructors|deleted functions|"
11285  "defaulted functions|constexpr functions|consteval function}0">;
11286def err_omp_declare_variant_diff : Error<
11287  "function with '#pragma omp declare variant' has a different %select{calling convention"
11288  "|return type|constexpr specification|inline specification|storage class|"
11289  "linkage}0">;
11290def err_omp_declare_variant_prototype_required : Error<
11291  "function with '#pragma omp declare variant' must have a prototype when "
11292  "'append_args' is used">;
11293def err_omp_interop_type_not_found : Error<
11294  "'omp_interop_t' must be defined when 'append_args' clause is used; include <omp.h>">;
11295def err_omp_declare_variant_incompat_types : Error<
11296  "variant in '#pragma omp declare variant' with type %0 is incompatible with"
11297  " type %1%select{| with appended arguments}2">;
11298def err_omp_declare_variant_same_base_function : Error<
11299  "variant in '#pragma omp declare variant' is the same as the base function">;
11300def warn_omp_declare_variant_marked_as_declare_variant : Warning<
11301  "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
11302  >, InGroup<SourceUsesOpenMP>;
11303def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
11304def err_omp_one_defaultmap_each_category: Error<
11305  "at most one defaultmap clause for each variable-category can appear on the directive">;
11306def err_omp_lastprivate_conditional_non_scalar : Error<
11307  "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
11308  >;
11309def err_omp_flush_order_clause_and_list : Error<
11310  "'flush' directive with memory order clause '%0' cannot have the list">;
11311def note_omp_flush_order_clause_here : Note<
11312  "memory order clause '%0' is specified here">;
11313def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
11314  "expected addressable lvalue in '%0' clause">;
11315def err_omp_var_expected : Error<
11316  "expected variable of the '%0' type%select{|, not %2}1">;
11317def err_omp_non_pointer_type_array_shaping_base : Error<
11318  "expected expression with a pointer to a complete type as a base of an array "
11319  "shaping operation">;
11320def err_omp_reduction_task_not_parallel_or_worksharing : Error<
11321  "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
11322  " worksharing constructs">;
11323def err_omp_expected_array_alloctraits : Error<
11324  "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
11325def err_omp_predefined_allocator_with_traits : Error<
11326  "predefined allocator cannot have traits specified">;
11327def note_omp_predefined_allocator : Note<
11328  "predefined trait '%0' used here">;
11329def err_omp_nonpredefined_allocator_without_traits : Error<
11330  "non-predefined allocator must have traits specified">;
11331def err_omp_allocator_used_in_clauses : Error<
11332  "allocators used in 'uses_allocators' clause cannot appear in other "
11333  "data-sharing or data-mapping attribute clauses">;
11334def err_omp_allocator_not_in_uses_allocators : Error<
11335  "allocator must be specified in the 'uses_allocators' clause">;
11336def note_omp_protected_structured_block
11337    : Note<"jump bypasses OpenMP structured block">;
11338def note_omp_exits_structured_block
11339    : Note<"jump exits scope of OpenMP structured block">;
11340def err_omp_lastprivate_loop_var_non_loop_iteration : Error<
11341  "only loop iteration variables are allowed in 'lastprivate' clause in "
11342  "'omp %0' directives">;
11343def err_omp_interop_variable_expected : Error<
11344  "expected%select{| non-const}0 variable of type 'omp_interop_t'">;
11345def err_omp_interop_variable_wrong_type : Error<
11346  "interop variable must be of type 'omp_interop_t'">;
11347def err_omp_interop_prefer_type : Error<
11348  "prefer_list item must be a string literal or constant integral "
11349  "expression">;
11350def err_omp_interop_bad_depend_clause : Error<
11351  "'depend' clause requires the 'targetsync' interop type">;
11352def err_omp_interop_var_multiple_actions : Error<
11353  "interop variable %0 used in multiple action clauses">;
11354def err_omp_dispatch_statement_call
11355    : Error<"statement after '#pragma omp dispatch' must be a direct call"
11356            " to a target function or an assignment to one">;
11357def err_omp_unroll_full_variable_trip_count : Error<
11358  "loop to be fully unrolled must have a constant trip count">;
11359def note_omp_directive_here : Note<"'%0' directive found here">;
11360def err_omp_instantiation_not_supported
11361    : Error<"instantiation of '%0' not supported yet">;
11362def err_omp_adjust_arg_multiple_clauses : Error<
11363  "'adjust_arg' argument %0 used in multiple clauses">;
11364def err_omp_clause_requires_dispatch_construct : Error<
11365  "'%0' clause requires 'dispatch' context selector">;
11366def err_omp_append_args_with_varargs : Error<
11367  "'append_args' is not allowed with varargs functions">;
11368def err_openmp_vla_in_task_untied : Error<
11369  "variable length arrays are not supported in OpenMP tasking regions with 'untied' clause">;
11370def warn_omp_unterminated_declare_target : Warning<
11371  "expected '#pragma omp end declare target' at end of file to match '#pragma omp %0'">,
11372  InGroup<SourceUsesOpenMP>;
11373def err_ompx_bare_no_grid : Error<
11374  "'ompx_bare' clauses requires explicit grid size via 'num_teams' and 'thread_limit' clauses">;
11375} // end of OpenMP category
11376
11377let CategoryName = "Related Result Type Issue" in {
11378// Objective-C related result type compatibility
11379def warn_related_result_type_compatibility_class : Warning<
11380  "method is expected to return an instance of its class type "
11381  "%diff{$, but is declared to return $|"
11382  ", but is declared to return different type}0,1">;
11383def warn_related_result_type_compatibility_protocol : Warning<
11384  "protocol method is expected to return an instance of the implementing "
11385  "class, but is declared to return %0">;
11386def note_related_result_type_family : Note<
11387  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
11388  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
11389  "self}1' method family%select{| and is expected to return an instance of its "
11390  "class type}0">;
11391def note_related_result_type_overridden : Note<
11392  "overridden method returns an instance of its class type">;
11393def note_related_result_type_inferred : Note<
11394  "%select{class|instance}0 method %1 is assumed to return an instance of "
11395  "its receiver type (%2)">;
11396def note_related_result_type_explicit : Note<
11397  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
11398  "%select{| and is expected to return an instance of its class type}0">;
11399def err_invalid_type_for_program_scope_var : Error<
11400  "the %0 type cannot be used to declare a program scope variable">;
11401
11402}
11403
11404let CategoryName = "Modules Issue" in {
11405def err_module_decl_in_module_map_module : Error<
11406  "'module' declaration found while building module from module map">;
11407def err_module_decl_in_header_unit : Error<
11408  "'module' declaration found while building header unit">;
11409def err_module_interface_implementation_mismatch : Error<
11410  "missing 'export' specifier in module declaration while "
11411  "building module interface">;
11412def err_current_module_name_mismatch : Error<
11413  "module name '%0' specified on command line does not match name of module">;
11414def err_module_redefinition : Error<
11415  "redefinition of module '%0'">;
11416def note_prev_module_definition : Note<"previously defined here">;
11417def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
11418def err_module_not_defined : Error<
11419  "definition of module '%0' is not available; use -fmodule-file= to specify "
11420  "path to precompiled module interface">;
11421def err_module_redeclaration : Error<
11422  "translation unit contains multiple module declarations">;
11423def note_prev_module_declaration : Note<"previous module declaration is here">;
11424def err_module_declaration_missing : Error<
11425  "missing 'export module' declaration in module interface unit">;
11426def err_module_declaration_missing_after_global_module_introducer : Error<
11427  "missing 'module' declaration at end of global module fragment "
11428  "introduced here">;
11429def err_module_private_specialization : Error<
11430  "%select{template|partial|member}0 specialization cannot be "
11431  "declared __module_private__">;
11432def err_module_private_local : Error<
11433  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
11434  "__module_private__">;
11435def err_module_private_local_class : Error<
11436  "local %select{struct|interface|union|class|enum}0 cannot be declared "
11437  "__module_private__">;
11438def err_module_unimported_use : Error<
11439  "%select{declaration|definition|default argument|"
11440  "explicit specialization|partial specialization}0 of %1 must be imported "
11441  "from module '%2' before it is required">;
11442def err_module_unimported_use_header : Error<
11443  "%select{missing '#include'|missing '#include %3'}2; "
11444  "%select{||default argument of |explicit specialization of |"
11445  "partial specialization of }0%1 must be "
11446  "%select{declared|defined|defined|declared|declared}0 "
11447  "before it is used">;
11448def err_module_unimported_use_multiple : Error<
11449  "%select{declaration|definition|default argument|"
11450  "explicit specialization|partial specialization}0 of %1 must be imported "
11451  "from one of the following modules before it is required:%2">;
11452def note_unreachable_entity : Note<
11453  "%select{declaration|definition|default argument declared|"
11454  "explicit specialization declared|partial specialization declared}0 here "
11455  "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
11456def ext_module_import_in_extern_c : ExtWarn<
11457  "import of C++ module '%0' appears within extern \"C\" language linkage "
11458  "specification">, DefaultError,
11459  InGroup<DiagGroup<"module-import-in-extern-c">>;
11460def err_module_import_not_at_top_level_fatal : Error<
11461  "import of module '%0' appears within %1">, DefaultFatal;
11462def ext_module_import_not_at_top_level_noop : ExtWarn<
11463  "redundant #include of module '%0' appears within %1">, DefaultError,
11464  InGroup<DiagGroup<"modules-import-nested-redundant">>;
11465def note_module_import_not_at_top_level : Note<"%0 begins here">;
11466def err_module_self_import : Error<
11467  "import of module '%0' appears within same top-level module '%1'">;
11468def err_module_self_import_cxx20 : Error<
11469  "import of module '%0' appears within its own %select{interface|implementation}1">;
11470def err_module_import_in_implementation : Error<
11471  "@import of module '%0' in implementation of '%1'; use #import">;
11472
11473// C++ Modules
11474def err_module_import_non_interface_nor_parition : Error<
11475  "import of module '%0' imported non C++20 importable modules">;
11476def err_module_decl_not_at_start : Error<
11477  "module declaration must occur at the start of the translation unit">;
11478def note_global_module_introducer_missing : Note<
11479  "add 'module;' to the start of the file to introduce a "
11480  "global module fragment">;
11481def err_export_within_anonymous_namespace : Error<
11482  "export declaration appears within anonymous namespace">;
11483def note_anonymous_namespace : Note<"anonymous namespace begins here">;
11484def note_export : Note<"export block begins here">;
11485def err_export_within_export : Error<
11486  "export declaration appears within another export declaration">;
11487def err_export_anon_ns_internal : Error<
11488  "anonymous namespaces cannot be exported">;
11489def err_export_internal : Error<
11490  "declaration of %0 with internal linkage cannot be exported">;
11491def err_export_using_internal : Error<
11492  "using declaration referring to %1 with %select{internal|module|unknown}0 "
11493  "linkage cannot be exported">;
11494def err_export_not_in_module_interface : Error<
11495  "export declaration can only be used within a module purview">;
11496def err_export_inline_not_defined : Error<
11497  "inline function not defined%select{| before the private module fragment}0">;
11498def err_export_partition_impl : Error<
11499  "module partition implementations cannot be exported">;
11500def err_export_in_private_module_fragment : Error<
11501  "export declaration cannot be used in a private module fragment">;
11502def note_private_module_fragment : Note<
11503  "private module fragment begins here">;
11504def err_private_module_fragment_not_module : Error<
11505  "private module fragment declaration with no preceding module declaration">;
11506def err_private_module_fragment_redefined : Error<
11507  "private module fragment redefined">;
11508def err_private_module_fragment_not_module_interface : Error<
11509  "private module fragment in module implementation unit">;
11510def note_not_module_interface_add_export : Note<
11511  "add 'export' here if this is intended to be a module interface unit">;
11512def err_invalid_module_name : Error<"%0 is an invalid name for a module">;
11513def err_extern_def_in_header_unit : Error<
11514  "non-inline external definitions are not permitted in C++ header units">;
11515
11516def warn_experimental_header_unit : Warning<
11517  "the implementation of header units is in an experimental phase">,
11518  InGroup<DiagGroup<"experimental-header-units">>;
11519
11520def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
11521  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
11522  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
11523def note_equivalent_internal_linkage_decl : Note<
11524  "declared here%select{ in module '%1'|}0">;
11525
11526def note_redefinition_modules_same_file : Note<
11527  "'%0' included multiple times, additional include site in header from module '%1'">;
11528def note_redefinition_include_same_file : Note<
11529  "'%0' included multiple times, additional include site here">;
11530}
11531
11532let CategoryName = "Coroutines Issue" in {
11533def err_return_in_coroutine : Error<
11534  "return statement not allowed in coroutine; did you mean 'co_return'?">;
11535def note_declared_coroutine_here : Note<
11536  "function is a coroutine due to use of '%0' here">;
11537def err_coroutine_objc_method : Error<
11538  "Objective-C methods as coroutines are not yet supported">;
11539def err_coroutine_unevaluated_context : Error<
11540  "'%0' cannot be used in an unevaluated context">;
11541def err_coroutine_within_handler : Error<
11542  "'%0' cannot be used in the handler of a try block">;
11543def err_coroutine_outside_function : Error<
11544  "'%0' cannot be used outside a function">;
11545def err_coroutine_invalid_func_context : Error<
11546  "'%1' cannot be used in %select{a constructor|a destructor"
11547  "|the 'main' function|a constexpr function"
11548  "|a function with a deduced return type|a varargs function"
11549  "|a consteval function}0">;
11550def err_implied_coroutine_type_not_found : Error<
11551  "%0 type was not found; include <coroutine> before defining "
11552  "a coroutine">;
11553def err_implicit_coroutine_std_nothrow_type_not_found : Error<
11554  "std::nothrow was not found; include <new> before defining a coroutine which "
11555  "uses get_return_object_on_allocation_failure()">;
11556def err_malformed_std_nothrow : Error<
11557  "std::nothrow must be a valid variable declaration">;
11558def err_malformed_std_coroutine_handle : Error<
11559  "std::coroutine_handle isn't a class template">;
11560def err_coroutine_handle_missing_member : Error<
11561  "std::coroutine_handle must have a member named '%0'">;
11562def err_malformed_std_coroutine_traits : Error<
11563  "std::coroutine_traits isn't a class template">;
11564def err_implied_std_coroutine_traits_promise_type_not_found : Error<
11565  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
11566def err_implied_std_coroutine_traits_promise_type_not_class : Error<
11567  "this function cannot be a coroutine: %0 is not a class">;
11568def err_coroutine_promise_type_incomplete : Error<
11569  "this function cannot be a coroutine: %0 is an incomplete type">;
11570def err_coroutine_type_missing_specialization : Error<
11571  "this function cannot be a coroutine: missing definition of "
11572  "specialization %0">;
11573def err_coroutine_promise_incompatible_return_functions : Error<
11574  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
11575def note_coroutine_promise_implicit_await_transform_required_here : Note<
11576  "call to 'await_transform' implicitly required by 'co_await' here">;
11577def note_coroutine_promise_suspend_implicitly_required : Note<
11578  "call to '%select{initial_suspend|final_suspend}0' implicitly "
11579  "required by the %select{initial suspend point|final suspend point}0">;
11580def err_coroutine_promise_unhandled_exception_required : Error<
11581  "%0 is required to declare the member 'unhandled_exception()'">;
11582def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
11583  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
11584  InGroup<CoroutineMissingUnhandledException>;
11585def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
11586  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
11587def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
11588  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
11589def err_coroutine_promise_new_requires_nothrow : Error<
11590  "%0 is required to have a non-throwing noexcept specification when the promise "
11591   "type declares 'get_return_object_on_allocation_failure()'">;
11592def note_coroutine_promise_call_implicitly_required : Note<
11593  "call to %0 implicitly required by coroutine function here">;
11594def err_await_suspend_invalid_return_type : Error<
11595  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
11596>;
11597def note_await_ready_no_bool_conversion : Note<
11598  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
11599>;
11600def warn_coroutine_handle_address_invalid_return_type : Warning <
11601  "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">,
11602  InGroup<Coroutine>;
11603def err_coroutine_promise_final_suspend_requires_nothrow : Error<
11604  "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
11605>;
11606def note_coroutine_function_declare_noexcept : Note<
11607  "must be declared with 'noexcept'"
11608>;
11609def warn_always_inline_coroutine : Warning<
11610  "this coroutine may be split into pieces; not every piece is guaranteed to be inlined"
11611  >,
11612  InGroup<AlwaysInlineCoroutine>;
11613def err_coroutine_unusable_new : Error<
11614  "'operator new' provided by %0 is not usable with the function signature of %1"
11615>;
11616def err_coroutine_unfound_nothrow_new : Error <
11617  "unable to find %select{'::operator new(size_t, nothrow_t)'|"
11618  "'::operator new(size_t, align_val_t, nothrow_t)'}1 for %0"
11619>;
11620def warn_non_aligned_allocation_function : Warning <
11621  "under -fcoro-aligned-allocation, the non-aligned allocation function "
11622  "for the promise type %0 has higher precedence than the global aligned "
11623  "allocation function">,
11624  InGroup<CoroNonAlignedAllocationFunction>;
11625def err_conflicting_aligned_options : Error <
11626  "conflicting option '-fcoro-aligned-allocation' and '-fno-aligned-allocation'"
11627>;
11628def err_coro_invalid_addr_of_label : Error<
11629  "the GNU address of label extension is not allowed in coroutines."
11630>;
11631def err_coroutine_return_type : Error<
11632  "function returns a type %0 marked with [[clang::coro_return_type]] but is neither a coroutine nor a coroutine wrapper; "
11633  "non-coroutines should be marked with [[clang::coro_wrapper]] to allow returning coroutine return type"
11634>;
11635} // end of coroutines issue category
11636
11637let CategoryName = "Documentation Issue" in {
11638def warn_not_a_doxygen_trailing_member_comment : Warning<
11639  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
11640def warn_splice_in_doxygen_comment : Warning<
11641  "line splicing in Doxygen comments are not supported">, InGroup<Documentation>, DefaultIgnore;
11642} // end of documentation issue category
11643
11644let CategoryName = "Nullability Issue" in {
11645
11646def warn_mismatched_nullability_attr : Warning<
11647  "nullability specifier %0 conflicts with existing specifier %1">,
11648  InGroup<Nullability>;
11649
11650def warn_nullability_declspec : Warning<
11651  "nullability specifier %0 cannot be applied "
11652  "to non-pointer type %1; did you mean to apply the specifier to the "
11653  "%select{pointer|block pointer|member pointer|function pointer|"
11654  "member function pointer}2?">,
11655  InGroup<NullabilityDeclSpec>,
11656  DefaultError;
11657
11658def note_nullability_here : Note<"%0 specified here">;
11659
11660def err_nullability_nonpointer : Error<
11661  "nullability specifier %0 cannot be applied to non-pointer type %1">;
11662
11663def warn_nullability_lost : Warning<
11664  "implicit conversion from nullable pointer %0 to non-nullable pointer "
11665  "type %1">,
11666  InGroup<NullableToNonNullConversion>, DefaultIgnore;
11667def warn_zero_as_null_pointer_constant : Warning<
11668  "zero as null pointer constant">,
11669  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
11670
11671def err_nullability_cs_multilevel : Error<
11672  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
11673def note_nullability_type_specifier : Note<
11674  "use nullability type specifier %0 to affect the innermost "
11675  "pointer type of %1">;
11676
11677def warn_null_resettable_setter : Warning<
11678  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
11679  InGroup<Nullability>;
11680
11681def warn_nullability_missing : Warning<
11682  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
11683  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
11684  InGroup<NullabilityCompleteness>;
11685def warn_nullability_missing_array : Warning<
11686  "array parameter is missing a nullability type specifier (_Nonnull, "
11687  "_Nullable, or _Null_unspecified)">,
11688  InGroup<NullabilityCompletenessOnArrays>;
11689def note_nullability_fix_it : Note<
11690  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
11691  "%select{pointer|block pointer|member pointer|array parameter}1 "
11692  "%select{should never be null|may be null|should not declare nullability}0">;
11693
11694def warn_nullability_inferred_on_nested_type : Warning<
11695  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
11696  "deprecated">,
11697  InGroup<NullabilityInferredOnNestedType>;
11698
11699def err_objc_type_arg_explicit_nullability : Error<
11700  "type argument %0 cannot explicitly specify nullability">;
11701
11702def err_objc_type_param_bound_explicit_nullability : Error<
11703  "type parameter %0 bound %1 cannot explicitly specify nullability">;
11704
11705}
11706
11707let CategoryName = "Generics Issue" in {
11708
11709def err_objc_type_param_bound_nonobject : Error<
11710  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
11711
11712def err_objc_type_param_bound_missing_pointer : Error<
11713  "missing '*' in type bound %0 for type parameter %1">;
11714def err_objc_type_param_bound_qualified : Error<
11715  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
11716
11717def err_objc_type_param_redecl : Error<
11718  "redeclaration of type parameter %0">;
11719
11720def err_objc_type_param_arity_mismatch : Error<
11721  "%select{forward class declaration|class definition|category|extension}0 has "
11722  "too %select{few|many}1 type parameters (expected %2, have %3)">;
11723
11724def err_objc_type_param_bound_conflict : Error<
11725  "type bound %0 for type parameter %1 conflicts with "
11726  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
11727
11728def err_objc_type_param_variance_conflict : Error<
11729  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
11730  "%select{in|co|contra}2variant type parameter %3">;
11731
11732def note_objc_type_param_here : Note<"type parameter %0 declared here">;
11733
11734def err_objc_type_param_bound_missing : Error<
11735  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
11736
11737def err_objc_parameterized_category_nonclass : Error<
11738  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
11739  "parameters">;
11740
11741def err_objc_parameterized_forward_class : Error<
11742  "forward declaration of non-parameterized class %0 cannot have type "
11743  "parameters">;
11744
11745def err_objc_parameterized_forward_class_first : Error<
11746  "class %0 previously declared with type parameters">;
11747
11748def err_objc_type_arg_missing_star : Error<
11749  "type argument %0 must be a pointer (requires a '*')">;
11750def err_objc_type_arg_qualified : Error<
11751  "type argument %0 cannot be qualified with '%1'">;
11752
11753def err_objc_type_arg_missing : Error<
11754  "no type or protocol named %0">;
11755
11756def err_objc_type_args_and_protocols : Error<
11757  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
11758  "%select{protocol|type}0 (%2)">;
11759
11760def err_objc_type_args_non_class : Error<
11761  "type arguments cannot be applied to non-class type %0">;
11762
11763def err_objc_type_args_non_parameterized_class : Error<
11764  "type arguments cannot be applied to non-parameterized class %0">;
11765
11766def err_objc_type_args_specialized_class : Error<
11767  "type arguments cannot be applied to already-specialized class type %0">;
11768
11769def err_objc_type_args_wrong_arity : Error<
11770  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
11771}
11772
11773def err_type_available_only_in_default_eval_method : Error<
11774  "cannot use type '%0' within '#pragma clang fp eval_method'; type is set "
11775  "according to the default eval method for the translation unit">;
11776
11777def err_objc_type_arg_not_id_compatible : Error<
11778  "type argument %0 is neither an Objective-C object nor a block type">;
11779
11780def err_objc_type_arg_does_not_match_bound : Error<
11781  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
11782
11783def warn_objc_redundant_qualified_class_type : Warning<
11784  "parameterized class %0 already conforms to the protocols listed; did you "
11785  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
11786
11787def warn_block_literal_attributes_on_omitted_return_type : Warning<
11788  "attribute %0 ignored, because it cannot be applied to omitted return type">,
11789  InGroup<IgnoredAttributes>;
11790
11791def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
11792  "'%0' qualifier on omitted return type %1 has no effect">,
11793  InGroup<IgnoredQualifiers>;
11794
11795def warn_shadow_field : Warning<
11796  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
11797  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
11798def note_shadow_field : Note<"declared here">;
11799
11800def err_multiversion_required_in_redecl : Error<
11801  "function declaration is missing %select{'target'|'cpu_specific' or "
11802  "'cpu_dispatch'|'target_version'}0 attribute in a multiversioned function">;
11803def note_multiversioning_caused_here : Note<
11804  "function multiversioning caused by this declaration">;
11805def err_multiversion_after_used : Error<
11806  "function declaration cannot become a multiversioned function after first "
11807  "usage">;
11808def err_bad_multiversion_option : Error<
11809  "function multiversioning doesn't support %select{feature|architecture}0 "
11810  "'%1'">;
11811def err_multiversion_duplicate : Error<
11812  "multiversioned function redeclarations require identical target attributes">;
11813def err_multiversion_noproto : Error<
11814  "multiversioned function must have a prototype">;
11815def err_multiversion_disallowed_other_attr
11816    : Error<"attribute "
11817            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
11818            "multiversioning cannot be combined"
11819            " with attribute %1">;
11820def err_multiversion_diff : Error<
11821  "multiversioned function declaration has a different %select{calling convention"
11822  "|return type|constexpr specification|inline specification|linkage|"
11823  "language linkage}0">;
11824def err_multiversion_doesnt_support
11825    : Error<"attribute "
11826            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
11827            "multiversioned functions do not "
11828            "yet support %select{function templates|virtual functions|"
11829            "deduced return types|constructors|destructors|deleted functions|"
11830            "defaulted functions|constexpr functions|consteval "
11831            "function|lambdas}1">;
11832def err_multiversion_not_allowed_on_main : Error<
11833  "'main' cannot be a multiversioned function">;
11834def err_multiversion_not_supported : Error<
11835 "function multiversioning is not supported on the current target">;
11836def err_multiversion_types_mixed : Error<
11837  "multiversioning attributes cannot be combined">;
11838def err_cpu_dispatch_mismatch : Error<
11839 "'cpu_dispatch' function redeclared with different CPUs">;
11840def err_cpu_specific_multiple_defs : Error<
11841 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
11842def warn_multiversion_duplicate_entries : Warning<
11843 "CPU list contains duplicate entries; attribute ignored">,
11844  InGroup<FunctionMultiVersioning>;
11845def warn_dispatch_body_ignored : Warning<
11846  "body of cpu_dispatch function will be ignored">,
11847  InGroup<FunctionMultiVersioning>;
11848def err_target_clone_must_have_default
11849    : Error<"'target_clones' multiversioning requires a default target">;
11850def err_target_clone_doesnt_match
11851    : Error<"'target_clones' attribute does not match previous declaration">;
11852def warn_target_clone_mixed_values
11853    : ExtWarn<
11854          "mixing 'target_clones' specifier mechanisms is permitted for GCC "
11855          "compatibility; use a comma separated sequence of string literals, "
11856          "or a string literal containing a comma-separated list of versions">,
11857      InGroup<TargetClonesMixedSpecifiers>;
11858def warn_target_clone_duplicate_options
11859    : Warning<"version list contains duplicate entries">,
11860      InGroup<FunctionMultiVersioning>;
11861def warn_target_clone_no_impact_options
11862    : Warning<"version list contains entries that don't impact code generation">,
11863      InGroup<FunctionMultiVersioning>;
11864
11865// three-way comparison operator diagnostics
11866def err_implied_comparison_category_type_not_found : Error<
11867  "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
11868  "because type '%0' was not found; include <compare>">;
11869def err_spaceship_argument_narrowing : Error<
11870  "argument to 'operator<=>' "
11871  "%select{cannot be narrowed from type %1 to %2|"
11872  "evaluates to %1, which cannot be narrowed to type %2}0">;
11873def err_std_compare_type_not_supported : Error<
11874  "standard library implementation of %0 is not supported; "
11875   "%select{member '%2' does not have expected form|"
11876   "member '%2' is missing|"
11877   "the type is not trivially copyable|"
11878   "the type does not have the expected form}1">;
11879def note_rewriting_operator_as_spaceship : Note<
11880  "while rewriting comparison as call to 'operator<=>' declared here">;
11881def err_three_way_vector_comparison : Error<
11882  "three-way comparison between vectors is not supported">;
11883
11884// Memory Tagging Extensions (MTE) diagnostics
11885def err_memtag_arg_null_or_pointer : Error<
11886  "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
11887def err_memtag_any2arg_pointer : Error<
11888  "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
11889def err_memtag_arg_must_be_pointer : Error<
11890  "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
11891def err_memtag_arg_must_be_integer : Error<
11892  "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
11893
11894def warn_dereference_of_noderef_type : Warning<
11895  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
11896def warn_dereference_of_noderef_type_no_decl : Warning<
11897  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
11898def warn_noderef_on_non_pointer_or_array : Warning<
11899  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
11900def warn_noderef_to_dereferenceable_pointer : Warning<
11901  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
11902
11903def err_builtin_launder_invalid_arg : Error<
11904  "%select{non-pointer|function pointer|void pointer}0 argument to "
11905  "'__builtin_launder' is not allowed">;
11906
11907def err_builtin_invalid_arg_type: Error <
11908  "%ordinal0 argument must be a "
11909  "%select{vector, integer or floating point type|matrix|"
11910  "pointer to a valid matrix element type|"
11911  "signed integer or floating point type|vector type|"
11912  "floating point type|"
11913  "vector of integers}1 (was %2)">;
11914
11915def err_builtin_matrix_disabled: Error<
11916  "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
11917def err_matrix_index_not_integer: Error<
11918  "matrix %select{row|column}0 index is not an integer">;
11919def err_matrix_index_outside_range: Error<
11920  "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
11921def err_matrix_incomplete_index: Error<
11922  "single subscript expressions are not allowed for matrix values">;
11923def err_matrix_separate_incomplete_index: Error<
11924  "matrix row and column subscripts cannot be separated by any expression">;
11925def err_matrix_subscript_comma: Error<
11926  "comma expressions are not allowed as indices in matrix subscript expressions">;
11927def err_builtin_matrix_scalar_unsigned_arg: Error<
11928  "%0 argument must be a constant unsigned integer expression">;
11929def err_builtin_matrix_pointer_arg_mismatch: Error<
11930  "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
11931def err_builtin_matrix_store_to_const: Error<
11932  "cannot store matrix to read-only pointer">;
11933def err_builtin_matrix_stride_too_small: Error<
11934  "stride must be greater or equal to the number of rows">;
11935def err_builtin_matrix_invalid_dimension: Error<
11936  "%0 dimension is outside the allowed range [1, %1]">;
11937
11938def warn_mismatched_import : Warning<
11939  "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
11940  "previous declaration">,
11941  InGroup<IgnoredAttributes>;
11942def warn_import_on_definition : Warning<
11943  "import %select{module|name}0 cannot be applied to a function with a definition">,
11944  InGroup<IgnoredAttributes>;
11945
11946def err_preserve_field_info_not_field : Error<
11947  "__builtin_preserve_field_info argument %0 not a field access">;
11948def err_preserve_field_info_not_const: Error<
11949  "__builtin_preserve_field_info argument %0 not a constant">;
11950def err_btf_type_id_not_const: Error<
11951  "__builtin_btf_type_id argument %0 not a constant">;
11952def err_preserve_type_info_invalid : Error<
11953  "__builtin_preserve_type_info argument %0 invalid">;
11954def err_preserve_type_info_not_const: Error<
11955  "__builtin_preserve_type_info argument %0 not a constant">;
11956def err_preserve_enum_value_invalid : Error<
11957  "__builtin_preserve_enum_value argument %0 invalid">;
11958def err_preserve_enum_value_not_const: Error<
11959  "__builtin_preserve_enum_value argument %0 not a constant">;
11960
11961def err_bit_cast_non_trivially_copyable : Error<
11962  "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
11963def err_bit_cast_type_size_mismatch : Error<
11964  "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
11965
11966// SYCL-specific diagnostics
11967def warn_sycl_kernel_num_of_template_params : Warning<
11968  "'sycl_kernel' attribute only applies to a function template with at least"
11969  " two template parameters">, InGroup<IgnoredAttributes>;
11970def warn_sycl_kernel_invalid_template_param_type : Warning<
11971  "template parameter of a function template with the 'sycl_kernel' attribute"
11972  " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
11973def warn_sycl_kernel_num_of_function_params : Warning<
11974  "function template with 'sycl_kernel' attribute must have a single parameter">,
11975  InGroup<IgnoredAttributes>;
11976def warn_sycl_kernel_return_type : Warning<
11977  "function template with 'sycl_kernel' attribute must have a 'void' return type">,
11978  InGroup<IgnoredAttributes>;
11979def err_sycl_special_type_num_init_method : Error<
11980  "types with 'sycl_special_class' attribute must have one and only one '__init' "
11981  "method defined">;
11982
11983def warn_cuda_maxclusterrank_sm_90 : Warning<
11984  "maxclusterrank requires sm_90 or higher, CUDA arch provided: %0, ignoring "
11985  "%1 attribute">, InGroup<IgnoredAttributes>;
11986
11987def err_bit_int_bad_size : Error<"%select{signed|unsigned}0 _BitInt must "
11988                                 "have a bit size of at least %select{2|1}0">;
11989def err_bit_int_max_size : Error<"%select{signed|unsigned}0 _BitInt of bit "
11990                                 "sizes greater than %1 not supported">;
11991
11992// errors of expect.with.probability
11993def err_probability_not_constant_float : Error<
11994   "probability argument to __builtin_expect_with_probability must be constant "
11995   "floating-point expression">;
11996def err_probability_out_of_range : Error<
11997   "probability argument to __builtin_expect_with_probability is outside the "
11998   "range [0.0, 1.0]">;
11999
12000// TCB warnings
12001def err_tcb_conflicting_attributes : Error<
12002  "attributes '%0(\"%2\")' and '%1(\"%2\")' are mutually exclusive">;
12003def warn_tcb_enforcement_violation : Warning<
12004  "calling %0 is a violation of trusted computing base '%1'">,
12005  InGroup<DiagGroup<"tcb-enforcement">>;
12006
12007// RISC-V builtin required extension warning
12008def err_riscv_builtin_requires_extension : Error<
12009  "builtin requires%select{| at least one of the following extensions}0: %1">;
12010def err_riscv_builtin_invalid_lmul : Error<
12011  "LMUL argument must be in the range [0,3] or [5,7]">;
12012def err_riscv_type_requires_extension : Error<
12013  "RISC-V type %0 requires the '%1' extension"
12014>;
12015
12016def err_std_source_location_impl_not_found : Error<
12017  "'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called">;
12018def err_std_source_location_impl_malformed : Error<
12019  "'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'">;
12020
12021// HLSL Diagnostics
12022def err_hlsl_attr_unsupported_in_stage : Error<"attribute %0 is unsupported in '%1' shaders, requires %select{|one of the following: }2%3">;
12023def err_hlsl_attr_invalid_type : Error<
12024   "attribute %0 only applies to a field or parameter of type '%1'">;
12025def err_hlsl_attr_invalid_ast_node : Error<
12026   "attribute %0 only applies to %1">;
12027def err_hlsl_entry_shader_attr_mismatch : Error<
12028   "%0 attribute on entry function does not match the target profile">;
12029def err_hlsl_numthreads_argument_oor : Error<"argument '%select{X|Y|Z}0' to numthreads attribute cannot exceed %1">;
12030def err_hlsl_numthreads_invalid : Error<"total number of threads cannot exceed %0">;
12031def err_hlsl_missing_numthreads : Error<"missing numthreads attribute for %0 shader entry">;
12032def err_hlsl_attribute_param_mismatch : Error<"%0 attribute parameters do not match the previous declaration">;
12033def err_hlsl_duplicate_parameter_modifier : Error<"duplicate parameter modifier %0">;
12034def err_hlsl_missing_semantic_annotation : Error<
12035  "semantic annotations must be present for all parameters of an entry "
12036  "function or patch constant function">;
12037def err_hlsl_init_priority_unsupported : Error<
12038  "initializer priorities are not supported in HLSL">;
12039
12040def err_hlsl_unsupported_register_type : Error<"invalid resource class specifier '%0' used; expected 'b', 's', 't', or 'u'">;
12041def err_hlsl_unsupported_register_number : Error<"register number should be an integer">;
12042def err_hlsl_expected_space : Error<"invalid space specifier '%0' used; expected 'space' followed by an integer, like space1">;
12043def err_hlsl_pointers_unsupported : Error<
12044  "%select{pointers|references}0 are unsupported in HLSL">;
12045
12046def err_hlsl_operator_unsupported : Error<
12047  "the '%select{&|*|->}0' operator is unsupported in HLSL">;
12048
12049def err_hlsl_param_qualifier_mismatch :
12050  Error<"conflicting parameter qualifier %0 on parameter %1">;
12051
12052// Layout randomization diagnostics.
12053def err_non_designated_init_used : Error<
12054  "a randomized struct can only be initialized with a designated initializer">;
12055def err_cast_from_randomized_struct : Error<
12056  "casting from randomized structure pointer type %0 to %1">;
12057
12058// Unsafe buffer usage diagnostics.
12059def warn_unsafe_buffer_variable : Warning<
12060  "%0 is an %select{unsafe pointer used for buffer access|unsafe buffer that "
12061  "does not perform bounds checks}1">,
12062  InGroup<UnsafeBufferUsage>, DefaultIgnore;
12063def warn_unsafe_buffer_operation : Warning<
12064  "%select{unsafe pointer operation|unsafe pointer arithmetic|"
12065  "unsafe buffer access|function introduces unsafe buffer manipulation|unsafe invocation of span::data}0">,
12066  InGroup<UnsafeBufferUsage>, DefaultIgnore;
12067def note_unsafe_buffer_operation : Note<
12068  "used%select{| in pointer arithmetic| in buffer access}0 here">;
12069def note_unsafe_buffer_variable_fixit_group : Note<
12070  "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">;
12071def note_unsafe_buffer_variable_fixit_together : Note<
12072  "change type of %0 to '%select{std::span|std::array|std::span::iterator}1' to preserve bounds information"
12073  "%select{|, and change %2 to safe types to make function %4 bounds-safe}3">;
12074def note_safe_buffer_usage_suggestions_disabled : Note<
12075  "pass -fsafe-buffer-usage-suggestions to receive code hardening suggestions">;
12076#ifndef NDEBUG
12077// Not a user-facing diagnostic. Useful for debugging false negatives in
12078// -fsafe-buffer-usage-suggestions (i.e. lack of -Wunsafe-buffer-usage fixits).
12079def note_safe_buffer_debug_mode : Note<"safe buffers debug: %0">;
12080#endif
12081
12082def err_builtin_pass_in_regs_non_class : Error<
12083  "argument %0 is not an unqualified class type">;
12084
12085
12086// WebAssembly reference type and table diagnostics.
12087def err_wasm_reference_pr : Error<
12088  "%select{pointer|reference}0 to WebAssembly reference type is not allowed">;
12089def err_wasm_ca_reference : Error<
12090  "cannot %select{capture|take address of}0 WebAssembly reference">;
12091def err_wasm_funcref_not_wasm : Error<
12092  "invalid use of '__funcref' keyword outside the WebAssembly triple">;
12093def err_wasm_table_pr : Error<
12094  "cannot form a %select{pointer|reference}0 to a WebAssembly table">;
12095def err_typecheck_wasm_table_must_have_zero_length : Error<
12096  "only zero-length WebAssembly tables are currently supported">;
12097def err_wasm_table_in_function : Error<
12098  "WebAssembly table cannot be declared within a function">;
12099def err_wasm_table_as_function_parameter : Error<
12100  "cannot use WebAssembly table as a function parameter">;
12101def err_wasm_table_invalid_uett_operand : Error<
12102  "invalid application of '%0' to WebAssembly table">;
12103def err_wasm_cast_table : Error<
12104  "cannot cast %select{to|from}0 a WebAssembly table">;
12105def err_wasm_table_conditional_expression : Error<
12106  "cannot use a WebAssembly table within a branch of a conditional expression">;
12107def err_wasm_table_art : Error<
12108  "cannot %select{assign|return|throw|subscript}0 a WebAssembly table">;
12109def err_wasm_reftype_tc : Error<
12110  "cannot %select{throw|catch}0 a WebAssembly reference type">;
12111def err_wasm_reftype_exception_spec : Error<
12112  "WebAssembly reference type not allowed in exception specification">;
12113def err_wasm_table_must_be_static : Error<
12114  "WebAssembly table must be static">;
12115def err_wasm_reftype_multidimensional_array : Error<
12116  "multi-dimensional arrays of WebAssembly references are not allowed">;
12117def err_wasm_builtin_arg_must_be_table_type : Error <
12118  "%ordinal0 argument must be a WebAssembly table">;
12119def err_wasm_builtin_arg_must_match_table_element_type : Error <
12120  "%ordinal0 argument must match the element type of the WebAssembly table in the %ordinal1 argument">;
12121def err_wasm_builtin_arg_must_be_integer_type : Error <
12122  "%ordinal0 argument must be an integer">;
12123} // end of sema component.
12124