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}0 "
87  "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 warn_float_overflow : Warning<
116  "magnitude of floating-point constant too large for type %0; maximum is %1">,
117   InGroup<LiteralRange>;
118def warn_float_underflow : Warning<
119  "magnitude of floating-point constant too small for type %0; minimum is %1">,
120  InGroup<LiteralRange>;
121def warn_float_compare_literal : Warning<
122  "floating-point comparison is always %select{true|false}0; "
123  "constant cannot be represented exactly in type %1">,
124  InGroup<LiteralRange>;
125def warn_double_const_requires_fp64 : Warning<
126  "double precision constant requires %select{cl_khr_fp64|cl_khr_fp64 and __opencl_c_fp64}0, "
127  "casting to single precision">;
128def err_half_const_requires_fp16 : Error<
129  "half precision constant requires cl_khr_fp16">;
130
131// C99 variable-length arrays
132def ext_vla : Extension<"variable length arrays are a C99 feature">,
133  InGroup<VLAExtension>;
134def warn_vla_used : Warning<"variable length array used">,
135  InGroup<VLA>, DefaultIgnore;
136def err_vla_in_sfinae : Error<
137  "variable length array cannot be formed during template argument deduction">;
138def err_array_star_in_function_definition : Error<
139  "variable length array must be bound in function definition">;
140def err_vla_decl_in_file_scope : Error<
141  "variable length array declaration not allowed at file scope">;
142def err_vla_decl_has_static_storage : Error<
143  "variable length array declaration cannot have 'static' storage duration">;
144def err_vla_decl_has_extern_linkage : Error<
145  "variable length array declaration cannot have 'extern' linkage">;
146def ext_vla_folded_to_constant : ExtWarn<
147  "variable length array folded to constant array as an extension">,
148  InGroup<GNUFoldingConstant>;
149def err_vla_unsupported : Error<
150  "variable length arrays are not supported for the current target">;
151def note_vla_unsupported : Note<
152  "variable length arrays are not supported for the current target">;
153
154// C99 variably modified types
155def err_variably_modified_template_arg : Error<
156  "variably modified type %0 cannot be used as a template argument">;
157def err_variably_modified_nontype_template_param : Error<
158  "non-type template parameter of variably modified type %0">;
159def err_variably_modified_new_type : Error<
160  "'new' cannot allocate object of variably modified type %0">;
161
162// C99 Designated Initializers
163def ext_designated_init : Extension<
164  "designated initializers are a C99 feature">, InGroup<C99Designator>;
165def err_array_designator_negative : Error<
166  "array designator value '%0' is negative">;
167def err_array_designator_empty_range : Error<
168  "array designator range [%0, %1] is empty">;
169def err_array_designator_non_array : Error<
170  "array designator cannot initialize non-array type %0">;
171def err_array_designator_too_large : Error<
172  "array designator index (%0) exceeds array bounds (%1)">;
173def err_field_designator_non_aggr : Error<
174  "field designator cannot initialize a "
175  "%select{non-struct, non-union|non-class}0 type %1">;
176def err_field_designator_unknown : Error<
177  "field designator %0 does not refer to any field in type %1">;
178def err_field_designator_nonfield : Error<
179  "field designator %0 does not refer to a non-static data member">;
180def note_field_designator_found : Note<"field designator refers here">;
181def err_designator_for_scalar_or_sizeless_init : Error<
182  "designator in initializer for %select{scalar|indivisible sizeless}0 "
183  "type %1">;
184def warn_initializer_overrides : Warning<
185  "initializer %select{partially |}0overrides prior initialization of "
186  "this subobject">, InGroup<InitializerOverrides>;
187def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Text>,
188  InGroup<InitializerOverrides>, SFINAEFailure;
189def err_initializer_overrides_destructed : Error<
190  "initializer would partially override prior initialization of object of "
191  "type %1 with non-trivial destruction">;
192def note_previous_initializer : Note<
193  "previous initialization %select{|with side effects }0is here"
194  "%select{| (side effects will not occur at run time)}0">;
195def err_designator_into_flexible_array_member : Error<
196  "designator into flexible array member subobject">;
197def note_flexible_array_member : Note<
198  "initialized flexible array member %0 is here">;
199def ext_flexible_array_init : Extension<
200  "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
201
202// C++20 designated initializers
203def ext_cxx_designated_init : Extension<
204  "designated initializers are a C++20 extension">, InGroup<CXX20Designator>,
205  SuppressInSystemMacro;
206def warn_cxx17_compat_designated_init : Warning<
207  "designated initializers are incompatible with C++ standards before C++20">,
208  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
209def ext_designated_init_mixed : ExtWarn<
210  "mixture of designated and non-designated initializers in the same "
211  "initializer list is a C99 extension">, InGroup<C99Designator>;
212def note_designated_init_mixed : Note<
213  "first non-designated initializer is here">;
214def ext_designated_init_array : ExtWarn<
215  "array designators are a C99 extension">, InGroup<C99Designator>;
216def ext_designated_init_nested : ExtWarn<
217  "nested designators are a C99 extension">, InGroup<C99Designator>;
218def ext_designated_init_reordered : ExtWarn<
219  "ISO C++ requires field designators to be specified in declaration order; "
220  "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
221  SFINAEFailure;
222def note_previous_field_init : Note<
223  "previous initialization for field %0 is here">;
224def ext_designated_init_brace_elision : ExtWarn<
225  "brace elision for designated initializer is a C99 extension">,
226  InGroup<C99Designator>, SFINAEFailure;
227
228// Declarations.
229def ext_plain_complex : ExtWarn<
230  "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
231def ext_imaginary_constant : Extension<
232  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
233def ext_integer_complex : Extension<
234  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
235
236def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
237  "'_Fract' or '_Accum', not '%0'">;
238def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
239def err_invalid_width_spec : Error<
240  "'%select{|short|long|long long}0 %1' is invalid">;
241def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
242
243def ext_auto_type_specifier : ExtWarn<
244  "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
245def warn_auto_storage_class : Warning<
246  "'auto' storage class specifier is redundant and incompatible with C++11">,
247  InGroup<CXX11Compat>, DefaultIgnore;
248
249def warn_deprecated_register : Warning<
250  "'register' storage class specifier is deprecated "
251  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
252def ext_register_storage_class : ExtWarn<
253  "ISO C++17 does not allow 'register' storage class specifier">,
254  DefaultError, InGroup<Register>;
255
256def err_invalid_decl_spec_combination : Error<
257  "cannot combine with previous '%0' declaration specifier">;
258def err_invalid_vector_decl_spec_combination : Error<
259  "cannot combine with previous '%0' declaration specifier. "
260  "'__vector' must be first">;
261def err_invalid_pixel_decl_spec_combination : Error<
262  "'__pixel' must be preceded by '__vector'.  "
263  "'%0' declaration specifier not allowed here">;
264def err_invalid_vector_bool_decl_spec : Error<
265  "cannot use '%0' with '__vector bool'">;
266def err_invalid_vector_long_decl_spec : Error<
267  "cannot use 'long' with '__vector'">;
268def err_invalid_vector_float_decl_spec : Error<
269  "cannot use 'float' with '__vector'">;
270def err_invalid_vector_double_decl_spec : Error <
271  "use of 'double' with '__vector' requires VSX support to be enabled "
272  "(available on POWER7 or later)">;
273def err_invalid_vector_bool_int128_decl_spec : Error <
274  "use of '__int128' with '__vector bool' requires VSX support enabled (on "
275  "POWER10 or later)">;
276def err_invalid_vector_int128_decl_spec : Error<
277  "use of '__int128' with '__vector' requires extended Altivec support"
278  " (available on POWER8 or later)">;
279def err_invalid_vector_long_long_decl_spec : Error <
280  "use of 'long long' with '__vector' requires VSX support (available on "
281  "POWER7 or later) to be enabled">;
282def err_invalid_vector_long_double_decl_spec : Error<
283  "cannot use 'long double' with '__vector'">;
284def warn_vector_long_decl_spec_combination : Warning<
285  "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
286
287def err_redeclaration_different_type : Error<
288  "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
289def err_bad_variable_name : Error<
290  "%0 cannot be the name of a variable or data member">;
291def err_bad_parameter_name : Error<
292  "%0 cannot be the name of a parameter">;
293def err_bad_parameter_name_template_id : Error<
294  "parameter name cannot have template arguments">;
295def ext_parameter_name_omitted_c2x : ExtWarn<
296  "omitting the parameter name in a function definition is a C2x extension">,
297  InGroup<C2x>;
298def err_anyx86_interrupt_attribute : Error<
299  "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
300  "have %select{a 'void' return type|"
301  "only a pointer parameter optionally followed by an integer parameter|"
302  "a pointer as the first parameter|a %2 type as the second parameter}1">;
303def err_anyx86_interrupt_called : Error<
304  "interrupt service routine cannot be called directly">;
305def warn_anyx86_interrupt_regsave : Warning<
306  "interrupt service routine should only call a function"
307  " with attribute 'no_caller_saved_registers'">,
308  InGroup<DiagGroup<"interrupt-service-routine">>;
309def warn_arm_interrupt_calling_convention : Warning<
310   "call to function without interrupt attribute could clobber interruptee's VFP registers">,
311   InGroup<Extra>;
312def warn_interrupt_attribute_invalid : Warning<
313   "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
314   "functions that have %select{no parameters|a 'void' return type}1">,
315   InGroup<IgnoredAttributes>;
316def warn_riscv_repeated_interrupt_attribute : Warning<
317  "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
318def note_riscv_repeated_interrupt_attribute : Note<
319  "repeated RISC-V 'interrupt' attribute is here">;
320def warn_unused_parameter : Warning<"unused parameter %0">,
321  InGroup<UnusedParameter>, DefaultIgnore;
322def warn_unused_but_set_parameter : Warning<"parameter %0 set but not used">,
323  InGroup<UnusedButSetParameter>, DefaultIgnore;
324def warn_unused_variable : Warning<"unused variable %0">,
325  InGroup<UnusedVariable>, DefaultIgnore;
326def warn_unused_but_set_variable : Warning<"variable %0 set but not used">,
327  InGroup<UnusedButSetVariable>, DefaultIgnore;
328def warn_unused_local_typedef : Warning<
329  "unused %select{typedef|type alias}0 %1">,
330  InGroup<UnusedLocalTypedef>, DefaultIgnore;
331def warn_unused_property_backing_ivar :
332  Warning<"ivar %0 which backs the property is not "
333  "referenced in this property's accessor">,
334  InGroup<UnusedPropertyIvar>, DefaultIgnore;
335def warn_unused_const_variable : Warning<"unused variable %0">,
336  InGroup<UnusedConstVariable>, DefaultIgnore;
337def warn_unused_exception_param : Warning<"unused exception parameter %0">,
338  InGroup<UnusedExceptionParameter>, DefaultIgnore;
339def warn_decl_in_param_list : Warning<
340  "declaration of %0 will not be visible outside of this function">,
341  InGroup<Visibility>;
342def warn_redefinition_in_param_list : Warning<
343  "redefinition of %0 will not be visible outside of this function">,
344  InGroup<Visibility>;
345def warn_empty_parens_are_function_decl : Warning<
346  "empty parentheses interpreted as a function declaration">,
347  InGroup<VexingParse>;
348def warn_parens_disambiguated_as_function_declaration : Warning<
349  "parentheses were disambiguated as a function declaration">,
350  InGroup<VexingParse>;
351def warn_parens_disambiguated_as_variable_declaration : Warning<
352  "parentheses were disambiguated as redundant parentheses around declaration "
353  "of variable named %0">, InGroup<VexingParse>;
354def warn_redundant_parens_around_declarator : Warning<
355  "redundant parentheses surrounding declarator">,
356  InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
357def note_additional_parens_for_variable_declaration : Note<
358  "add a pair of parentheses to declare a variable">;
359def note_raii_guard_add_name : Note<
360  "add a variable name to declare a %0 initialized with %1">;
361def note_function_style_cast_add_parentheses : Note<
362  "add enclosing parentheses to perform a function-style cast">;
363def note_remove_parens_for_variable_declaration : Note<
364  "remove parentheses to silence this warning">;
365def note_empty_parens_function_call : Note<
366  "change this ',' to a ';' to call %0">;
367def note_empty_parens_default_ctor : Note<
368  "remove parentheses to declare a variable">;
369def note_empty_parens_zero_initialize : Note<
370  "replace parentheses with an initializer to declare a variable">;
371def warn_unused_function : Warning<"unused function %0">,
372  InGroup<UnusedFunction>, DefaultIgnore;
373def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
374  InGroup<UnusedTemplate>, DefaultIgnore;
375def warn_unused_member_function : Warning<"unused member function %0">,
376  InGroup<UnusedMemberFunction>, DefaultIgnore;
377def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
378  InGroup<UsedButMarkedUnused>, DefaultIgnore;
379def warn_unneeded_internal_decl : Warning<
380  "%select{function|variable}0 %1 is not needed and will not be emitted">,
381  InGroup<UnneededInternalDecl>, DefaultIgnore;
382def warn_unneeded_static_internal_decl : Warning<
383  "'static' function %0 declared in header file "
384  "should be declared 'static inline'">,
385  InGroup<UnneededInternalDecl>, DefaultIgnore;
386def warn_unneeded_member_function : Warning<
387  "member function %0 is not needed and will not be emitted">,
388  InGroup<UnneededMemberFunction>, DefaultIgnore;
389def warn_unused_private_field: Warning<"private field %0 is not used">,
390  InGroup<UnusedPrivateField>, DefaultIgnore;
391def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
392  "%select{used|required to be captured for this use}1">,
393  InGroup<UnusedLambdaCapture>, DefaultIgnore;
394
395def warn_reserved_extern_symbol: Warning<
396  "identifier %0 is reserved because %select{"
397  "<ERROR>|" // ReservedIdentifierStatus::NotReserved
398  "it starts with '_' at global scope|"
399  "it starts with '_' and has C language linkage|"
400  "it starts with '__'|"
401  "it starts with '_' followed by a capital letter|"
402  "it contains '__'}1">,
403  InGroup<ReservedIdentifier>, DefaultIgnore;
404
405def warn_parameter_size: Warning<
406  "%0 is a large (%1 bytes) pass-by-value argument; "
407  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
408def warn_return_value_size: Warning<
409  "return value of %0 is a large (%1 bytes) pass-by-value object; "
410  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
411def warn_return_value_udt: Warning<
412  "%0 has C-linkage specified, but returns user-defined type %1 which is "
413  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
414def warn_return_value_udt_incomplete: Warning<
415  "%0 has C-linkage specified, but returns incomplete type %1 which could be "
416  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
417def warn_implicit_function_decl : Warning<
418  "implicit declaration of function %0">,
419  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
420def ext_implicit_function_decl_c99 : ExtWarn<
421  "call to undeclared function %0; ISO C99 and later do not support implicit "
422  "function declarations">, InGroup<ImplicitFunctionDeclare>;
423def note_function_suggestion : Note<"did you mean %0?">;
424
425def err_ellipsis_first_param : Error<
426  "ISO C requires a named parameter before '...'">;
427def err_declarator_need_ident : Error<"declarator requires an identifier">;
428def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
429def err_language_linkage_spec_not_ascii : Error<
430  "string literal in language linkage specifier cannot have an "
431  "encoding-prefix">;
432def ext_use_out_of_scope_declaration : ExtWarn<
433  "use of out-of-scope declaration of %0%select{| whose type is not "
434  "compatible with that of an implicit declaration}1">,
435  InGroup<DiagGroup<"out-of-scope-function">>;
436def err_inline_non_function : Error<
437  "'inline' can only appear on functions%select{| and non-local variables}0">;
438def err_noreturn_non_function : Error<
439  "'_Noreturn' can only appear on functions">;
440def warn_qual_return_type : Warning<
441  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
442  InGroup<IgnoredQualifiers>, DefaultIgnore;
443def warn_deprecated_redundant_constexpr_static_def : Warning<
444  "out-of-line definition of constexpr static data member is redundant "
445  "in C++17 and is deprecated">,
446  InGroup<Deprecated>, DefaultIgnore;
447
448def warn_decl_shadow :
449  Warning<"declaration shadows a %select{"
450          "local variable|"
451          "variable in %2|"
452          "static data member of %2|"
453          "field of %2|"
454          "typedef in %2|"
455          "type alias in %2|"
456          "structured binding}1">,
457  InGroup<Shadow>, DefaultIgnore, SuppressInSystemMacro;
458def warn_decl_shadow_uncaptured_local :
459  Warning<warn_decl_shadow.Text>,
460  InGroup<ShadowUncapturedLocal>, DefaultIgnore;
461def warn_ctor_parm_shadows_field:
462  Warning<"constructor parameter %0 shadows the field %1 of %2">,
463  InGroup<ShadowFieldInConstructor>, DefaultIgnore;
464def warn_modifying_shadowing_decl :
465  Warning<"modifying constructor parameter %0 that shadows a "
466          "field of %1">,
467  InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
468
469// C++ decomposition declarations
470def err_decomp_decl_context : Error<
471  "decomposition declaration not permitted in this context">;
472def warn_cxx14_compat_decomp_decl : Warning<
473  "decomposition declarations are incompatible with "
474  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
475def ext_decomp_decl : ExtWarn<
476  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
477def ext_decomp_decl_cond : ExtWarn<
478  "ISO C++17 does not permit structured binding declaration in a condition">,
479  InGroup<DiagGroup<"binding-in-condition">>;
480def err_decomp_decl_spec : Error<
481  "decomposition declaration cannot be declared "
482  "%plural{1:'%1'|:with '%1' specifiers}0">;
483def ext_decomp_decl_spec : ExtWarn<
484  "decomposition declaration declared "
485  "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
486  InGroup<CXX20>;
487def warn_cxx17_compat_decomp_decl_spec : Warning<
488  "decomposition declaration declared "
489  "%plural{1:'%1'|:with '%1' specifiers}0 "
490  "is incompatible with C++ standards before C++20">,
491  InGroup<CXXPre20Compat>, DefaultIgnore;
492def err_decomp_decl_type : Error<
493  "decomposition declaration cannot be declared with type %0; "
494  "declared type must be 'auto' or reference to 'auto'">;
495def err_decomp_decl_parens : Error<
496  "decomposition declaration cannot be declared with parentheses">;
497def err_decomp_decl_template : Error<
498  "decomposition declaration template not supported">;
499def err_decomp_decl_not_alone : Error<
500  "decomposition declaration must be the only declaration in its group">;
501def err_decomp_decl_requires_init : Error<
502  "decomposition declaration %0 requires an initializer">;
503def err_decomp_decl_wrong_number_bindings : Error<
504  "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
505  "%select{%plural{0:no|:only %1}1|%1}4 "
506  "%plural{1:name was|:names were}1 provided">;
507def err_decomp_decl_unbindable_type : Error<
508  "cannot decompose %select{union|non-class, non-array}1 type %2">;
509def err_decomp_decl_multiple_bases_with_members : Error<
510  "cannot decompose class type %1: "
511  "%select{its base classes %2 and|both it and its base class}0 %3 "
512  "have non-static data members">;
513def err_decomp_decl_ambiguous_base : Error<
514  "cannot decompose members of ambiguous base class %1 of %0:%2">;
515def err_decomp_decl_inaccessible_base : Error<
516  "cannot decompose members of inaccessible base class %1 of %0">,
517  AccessControl;
518def err_decomp_decl_inaccessible_field : Error<
519  "cannot decompose %select{private|protected}0 member %1 of %3">,
520  AccessControl;
521def err_decomp_decl_lambda : Error<
522  "cannot decompose lambda closure type">;
523def err_decomp_decl_anon_union_member : Error<
524  "cannot decompose class type %0 because it has an anonymous "
525  "%select{struct|union}1 member">;
526def err_decomp_decl_std_tuple_element_not_specialized : Error<
527  "cannot decompose this type; 'std::tuple_element<%0>::type' "
528  "does not name a type">;
529def err_decomp_decl_std_tuple_size_not_constant : Error<
530  "cannot decompose this type; 'std::tuple_size<%0>::value' "
531  "is not a valid integral constant expression">;
532def note_in_binding_decl_init : Note<
533  "in implicit initialization of binding declaration %0">;
534
535def err_std_type_trait_not_class_template : Error<
536  "unsupported standard library implementation: "
537  "'std::%0' is not a class template">;
538
539// C++ using declarations
540def err_using_requires_qualname : Error<
541  "using declaration requires a qualified name">;
542def err_using_typename_non_type : Error<
543  "'typename' keyword used on a non-type">;
544def err_using_dependent_value_is_type : Error<
545  "dependent using declaration resolved to type without 'typename'">;
546def err_using_decl_nested_name_specifier_is_not_class : Error<
547  "using declaration in class refers into '%0', which is not a class">;
548def warn_cxx17_compat_using_decl_non_member_enumerator : Warning<
549  "member using declaration naming non-class '%0' enumerator is "
550  "incompatible with C++ standards before C++20">, InGroup<CXXPre20Compat>,
551  DefaultIgnore;
552def err_using_decl_nested_name_specifier_is_current_class : Error<
553  "using declaration refers to its own class">;
554def err_using_decl_nested_name_specifier_is_not_base_class : Error<
555  "using declaration refers into '%0', which is not a base class of %1">;
556def err_using_decl_constructor_not_in_direct_base : Error<
557  "%0 is not a direct base of %1, cannot inherit constructors">;
558def err_using_decl_can_not_refer_to_class_member : Error<
559  "using declaration cannot refer to class member">;
560def warn_cxx17_compat_using_decl_class_member_enumerator : Warning<
561  "member using declaration naming a non-member enumerator is incompatible "
562  "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
563def err_using_enum_is_dependent : Error<
564  "using-enum cannot name a dependent type">;
565def err_ambiguous_inherited_constructor : Error<
566  "constructor of %0 inherited from multiple base class subobjects">;
567def note_ambiguous_inherited_constructor_using : Note<
568  "inherited from base class %0 here">;
569def note_using_decl_class_member_workaround : Note<
570  "use %select{an alias declaration|a typedef declaration|a reference|"
571  "a const variable|a constexpr variable}0 instead">;
572def err_using_decl_can_not_refer_to_namespace : Error<
573  "using declaration cannot refer to a namespace">;
574def warn_cxx17_compat_using_decl_scoped_enumerator: Warning<
575  "using declaration naming a scoped enumerator is incompatible with "
576  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
577def ext_using_decl_scoped_enumerator : ExtWarn<
578  "using declaration naming a scoped enumerator is a C++20 extension">,
579  InGroup<CXX20>;
580def err_using_decl_constructor : Error<
581  "using declaration cannot refer to a constructor">;
582def warn_cxx98_compat_using_decl_constructor : Warning<
583  "inheriting constructors are incompatible with C++98">,
584  InGroup<CXX98Compat>, DefaultIgnore;
585def err_using_decl_destructor : Error<
586  "using declaration cannot refer to a destructor">;
587def err_using_decl_template_id : Error<
588  "using declaration cannot refer to a template specialization">;
589def note_using_decl_target : Note<"target of using declaration">;
590def note_using_decl_conflict : Note<"conflicting declaration">;
591def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
592def err_using_decl_conflict : Error<
593  "target of using declaration conflicts with declaration already in scope">;
594def err_using_decl_conflict_reverse : Error<
595  "declaration conflicts with target of using declaration already in scope">;
596def note_using_decl : Note<"%select{|previous }0using declaration">;
597def err_using_decl_redeclaration_expansion : Error<
598  "using declaration pack expansion at block scope produces multiple values">;
599def err_use_of_empty_using_if_exists : Error<
600  "reference to unresolved using declaration">;
601def note_empty_using_if_exists_here : Note<
602  "using declaration annotated with 'using_if_exists' here">;
603def err_using_if_exists_on_ctor : Error<
604  "'using_if_exists' attribute cannot be applied to an inheriting constructor">;
605def err_using_enum_decl_redeclaration : Error<
606  "redeclaration of using-enum declaration">;
607def note_using_enum_decl : Note<"%select{|previous }0using-enum declaration">;
608
609def warn_access_decl_deprecated : Warning<
610  "access declarations are deprecated; use using declarations instead">,
611  InGroup<Deprecated>;
612def err_access_decl : Error<
613  "ISO C++11 does not allow access declarations; "
614  "use using declarations instead">;
615def warn_deprecated_copy : Warning<
616  "definition of implicit copy %select{constructor|assignment operator}1 "
617  "for %0 is deprecated because it has a user-declared copy "
618  "%select{assignment operator|constructor}1">,
619  InGroup<DeprecatedCopy>, DefaultIgnore;
620def warn_deprecated_copy_with_dtor : Warning<
621  "definition of implicit copy %select{constructor|assignment operator}1 "
622  "for %0 is deprecated because it has a user-declared destructor">,
623  InGroup<DeprecatedCopyWithDtor>, DefaultIgnore;
624def warn_deprecated_copy_with_user_provided_copy: Warning<
625  "definition of implicit copy %select{constructor|assignment operator}1 "
626  "for %0 is deprecated because it has a user-provided copy "
627  "%select{assignment operator|constructor}1">,
628  InGroup<DeprecatedCopyWithUserProvidedCopy>, DefaultIgnore;
629def warn_deprecated_copy_with_user_provided_dtor : Warning<
630  "definition of implicit copy %select{constructor|assignment operator}1 "
631  "for %0 is deprecated because it has a user-provided destructor">,
632  InGroup<DeprecatedCopyWithUserProvidedDtor>, DefaultIgnore;
633def warn_cxx17_compat_exception_spec_in_signature : Warning<
634  "mangled name of %0 will change in C++17 due to non-throwing exception "
635  "specification in function signature">, InGroup<CXX17CompatMangling>;
636
637def warn_global_constructor : Warning<
638  "declaration requires a global constructor">,
639  InGroup<GlobalConstructors>, DefaultIgnore;
640def warn_global_destructor : Warning<
641  "declaration requires a global destructor">,
642   InGroup<GlobalConstructors>, DefaultIgnore;
643def warn_exit_time_destructor : Warning<
644  "declaration requires an exit-time destructor">,
645  InGroup<ExitTimeDestructors>, DefaultIgnore;
646
647def err_invalid_thread : Error<
648  "'%0' is only allowed on variable declarations">;
649def err_thread_non_global : Error<
650  "'%0' variables must have global storage">;
651def err_thread_unsupported : Error<
652  "thread-local storage is not supported for the current target">;
653
654// FIXME: Combine fallout warnings to just one warning.
655def warn_maybe_falloff_nonvoid_function : Warning<
656  "non-void function does not return a value in all control paths">,
657  InGroup<ReturnType>;
658def warn_falloff_nonvoid_function : Warning<
659  "non-void function does not return a value">,
660  InGroup<ReturnType>;
661def err_maybe_falloff_nonvoid_block : Error<
662  "non-void block does not return a value in all control paths">;
663def err_falloff_nonvoid_block : Error<
664  "non-void block does not return a value">;
665def warn_maybe_falloff_nonvoid_coroutine : Warning<
666  "non-void coroutine does not return a value in all control paths">,
667  InGroup<ReturnType>;
668def warn_falloff_nonvoid_coroutine : Warning<
669  "non-void coroutine does not return a value">,
670  InGroup<ReturnType>;
671def warn_suggest_noreturn_function : Warning<
672  "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
673  InGroup<MissingNoreturn>, DefaultIgnore;
674def warn_suggest_noreturn_block : Warning<
675  "block could be declared with attribute 'noreturn'">,
676  InGroup<MissingNoreturn>, DefaultIgnore;
677
678// Unreachable code.
679def warn_unreachable : Warning<
680  "code will never be executed">,
681  InGroup<UnreachableCode>, DefaultIgnore;
682def warn_unreachable_break : Warning<
683  "'break' will never be executed">,
684  InGroup<UnreachableCodeBreak>, DefaultIgnore;
685def warn_unreachable_return : Warning<
686  "'return' will never be executed">,
687  InGroup<UnreachableCodeReturn>, DefaultIgnore;
688def warn_unreachable_loop_increment : Warning<
689  "loop will run at most once (loop increment never executed)">,
690  InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
691def warn_unreachable_fallthrough_attr : Warning<
692  "fallthrough annotation in unreachable code">,
693  InGroup<UnreachableCodeFallthrough>, DefaultIgnore;
694def note_unreachable_silence : Note<
695  "silence by adding parentheses to mark code as explicitly dead">;
696def warn_unreachable_association : Warning<
697  "due to lvalue conversion of the controlling expression, association of type "
698  "%0 will never be selected because it is %select{of array type|qualified}1">,
699  InGroup<UnreachableCodeGenericAssoc>;
700
701/// Built-in functions.
702def ext_implicit_lib_function_decl : ExtWarn<
703  "implicitly declaring library function '%0' with type %1">,
704  InGroup<ImplicitFunctionDeclare>;
705def ext_implicit_lib_function_decl_c99 : ExtWarn<
706  "call to undeclared library function '%0' with type %1; ISO C99 and later "
707  "do not support implicit function declarations">,
708  InGroup<ImplicitFunctionDeclare>;
709def note_include_header_or_declare : Note<
710  "include the header <%0> or explicitly provide a declaration for '%1'">;
711def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
712def warn_implicit_decl_no_jmp_buf
713    : Warning<"declaration of built-in function '%0' requires the declaration"
714    " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
715      InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
716def warn_implicit_decl_requires_sysheader : Warning<
717  "declaration of built-in function '%1' requires inclusion of the header <%0>">,
718  InGroup<BuiltinRequiresHeader>;
719def warn_redecl_library_builtin : Warning<
720  "incompatible redeclaration of library function %0">,
721  InGroup<DiagGroup<"incompatible-library-redeclaration">>;
722def err_builtin_definition : Error<"definition of builtin function %0">;
723def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
724def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
725def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
726  "%select{GCP|CDE}1">;
727def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
728def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
729def err_invalid_cpu_specific_dispatch_value : Error<
730"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
731def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
732  InGroup<ImplicitFunctionDeclare>, DefaultError;
733def warn_cstruct_memaccess : Warning<
734  "%select{destination for|source of|first operand of|second operand of}0 this "
735  "%1 call is a pointer to record %2 that is not trivial to "
736  "%select{primitive-default-initialize|primitive-copy}3">,
737  InGroup<NonTrivialMemaccess>;
738def note_nontrivial_field : Note<
739  "field is non-trivial to %select{copy|default-initialize}0">;
740def err_non_trivial_c_union_in_invalid_context : Error<
741  "cannot %select{"
742  "use type %1 for a function/method parameter|"
743  "use type %1 for function/method return|"
744  "default-initialize an object of type %1|"
745  "declare an automatic variable of type %1|"
746  "copy-initialize an object of type %1|"
747  "assign to a variable of type %1|"
748  "construct an automatic compound literal of type %1|"
749  "capture a variable of type %1|"
750  "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
751  "}3 "
752  "since it %select{contains|is}2 a union that is non-trivial to "
753  "%select{default-initialize|destruct|copy}0">;
754def note_non_trivial_c_union : Note<
755  "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
756  "non-trivial to %select{default-initialize|destruct|copy}1">;
757def warn_dyn_class_memaccess : Warning<
758  "%select{destination for|source of|first operand of|second operand of}0 this "
759  "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
760  "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
761  InGroup<DynamicClassMemaccess>;
762def note_bad_memaccess_silence : Note<
763  "explicitly cast the pointer to silence this warning">;
764def warn_sizeof_pointer_expr_memaccess : Warning<
765  "'%0' call operates on objects of type %1 while the size is based on a "
766  "different type %2">,
767  InGroup<SizeofPointerMemaccess>;
768def warn_sizeof_pointer_expr_memaccess_note : Note<
769  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
770  "it by the number of elements)|remove the addressof in the argument to "
771  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
772  "length}0?">;
773def warn_sizeof_pointer_type_memaccess : Warning<
774  "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
775  "%select{destination|source}2; expected %3 or an explicit length">,
776  InGroup<SizeofPointerMemaccess>;
777def warn_strlcpycat_wrong_size : Warning<
778  "size argument in %0 call appears to be size of the source; "
779  "expected the size of the destination">,
780  InGroup<DiagGroup<"strlcpy-strlcat-size">>;
781def note_strlcpycat_wrong_size : Note<
782  "change size argument to be the size of the destination">;
783def warn_memsize_comparison : Warning<
784  "size argument in %0 call is a comparison">,
785  InGroup<DiagGroup<"memsize-comparison">>;
786def note_memsize_comparison_paren : Note<
787  "did you mean to compare the result of %0 instead?">;
788def note_memsize_comparison_cast_silence : Note<
789  "explicitly cast the argument to size_t to silence this warning">;
790def warn_suspicious_sizeof_memset : Warning<
791  "%select{'size' argument to memset is '0'|"
792  "setting buffer to a 'sizeof' expression}0"
793  "; did you mean to transpose the last two arguments?">,
794  InGroup<MemsetTransposedArgs>;
795def note_suspicious_sizeof_memset_silence : Note<
796  "%select{parenthesize the third argument|"
797  "cast the second argument to 'int'}0 to silence">;
798def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
799  InGroup<SuspiciousBzero>;
800def note_suspicious_bzero_size_silence : Note<
801  "parenthesize the second argument to silence">;
802
803def warn_strncat_large_size : Warning<
804  "the value of the size argument in 'strncat' is too large, might lead to a "
805  "buffer overflow">, InGroup<StrncatSize>;
806def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
807  "to be size of the source">, InGroup<StrncatSize>;
808def warn_strncat_wrong_size : Warning<
809  "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
810def note_strncat_wrong_size : Note<
811  "change the argument to be the free space in the destination buffer minus "
812  "the terminating null byte">;
813
814def warn_assume_side_effects : Warning<
815  "the argument to %0 has side effects that will be discarded">,
816  InGroup<DiagGroup<"assume">>;
817def warn_assume_attribute_string_unknown : Warning<
818  "unknown assumption string '%0'; attribute is potentially ignored">,
819  InGroup<UnknownAssumption>;
820def warn_assume_attribute_string_unknown_suggested : Warning<
821  "unknown assumption string '%0' may be misspelled; attribute is potentially "
822  "ignored, did you mean '%1'?">,
823  InGroup<MisspelledAssumption>;
824
825def warn_builtin_chk_overflow : Warning<
826  "'%0' will always overflow; destination buffer has size %1,"
827  " but size argument is %2">,
828  InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
829
830def warn_fortify_source_overflow
831  : Warning<warn_builtin_chk_overflow.Text>, InGroup<FortifySource>;
832def warn_fortify_source_size_mismatch : Warning<
833  "'%0' size argument is too large; destination buffer has size %1,"
834  " but size argument is %2">, InGroup<FortifySource>;
835
836def warn_fortify_strlen_overflow: Warning<
837  "'%0' will always overflow; destination buffer has size %1,"
838  " but the source string has length %2 (including NUL byte)">,
839  InGroup<FortifySource>;
840
841def warn_fortify_source_format_overflow : Warning<
842  "'%0' will always overflow; destination buffer has size %1,"
843  " but format string expands to at least %2">,
844  InGroup<FortifySource>;
845
846def warn_fortify_scanf_overflow : Warning<
847  "'%0' may overflow; destination buffer in argument %1 has size "
848  "%2, but the corresponding specifier may require size %3">,
849  InGroup<FortifySource>;
850
851def err_function_start_invalid_type: Error<
852  "argument must be a function">;
853
854/// main()
855// static main() is not an error in C, just in C++.
856def warn_static_main : Warning<"'main' should not be declared static">,
857    InGroup<Main>;
858def err_static_main : Error<"'main' is not allowed to be declared static">;
859def err_inline_main : Error<"'main' is not allowed to be declared inline">;
860def ext_variadic_main : ExtWarn<
861  "'main' is not allowed to be declared variadic">, InGroup<Main>;
862def ext_noreturn_main : ExtWarn<
863  "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
864def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
865def err_constexpr_main : Error<
866  "'main' is not allowed to be declared %select{constexpr|consteval}0">;
867def err_deleted_main : Error<"'main' is not allowed to be deleted">;
868def err_mainlike_template_decl : Error<"%0 cannot be a template">;
869def err_main_returns_nonint : Error<"'main' must return 'int'">;
870def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
871    InGroup<MainReturnType>;
872def note_main_change_return_type : Note<"change return type to 'int'">;
873def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
874    "must be 0, 2, or 3">;
875def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
876    InGroup<Main>;
877def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
878    "parameter of 'main' (%select{argument count|argument array|environment|"
879    "platform-specific data}0) must be of type %1">;
880def warn_main_returns_bool_literal : Warning<"bool literal returned from "
881    "'main'">, InGroup<Main>;
882def err_main_global_variable :
883    Error<"main cannot be declared as global variable">;
884def warn_main_redefined : Warning<"variable named 'main' with external linkage "
885    "has undefined behavior">, InGroup<Main>;
886def ext_main_used : Extension<
887  "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
888
889/// parser diagnostics
890def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
891  InGroup<MissingDeclarations>;
892def err_no_declarators : Error<"declaration does not declare anything">;
893def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
894  InGroup<MissingDeclarations>;
895def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
896
897def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
898  "anonymous non-C-compatible type given name for linkage purposes "
899  "by %select{typedef|alias}0 declaration; "
900  "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
901def err_non_c_like_anon_struct_in_typedef : Error<
902  "anonymous non-C-compatible type given name for linkage purposes "
903  "by %select{typedef|alias}0 declaration after its linkage was computed; "
904  "add a tag name here to establish linkage prior to definition">;
905def err_typedef_changes_linkage : Error<
906  "unsupported: anonymous type given name for linkage purposes "
907  "by %select{typedef|alias}0 declaration after its linkage was computed; "
908  "add a tag name here to establish linkage prior to definition">;
909def note_non_c_like_anon_struct : Note<
910  "type is not C-compatible due to this "
911  "%select{base class|default member initializer|lambda expression|"
912  "friend declaration|member declaration}0">;
913def note_typedef_for_linkage_here : Note<
914  "type is given name %0 for linkage purposes by this "
915  "%select{typedef|alias}1 declaration">;
916
917def err_statically_allocated_object : Error<
918  "interface type cannot be statically allocated">;
919def err_object_cannot_be_passed_returned_by_value : Error<
920  "interface type %1 cannot be %select{returned|passed}0 by value"
921  "; did you forget * in %1?">;
922def err_parameters_retval_cannot_have_fp16_type : Error<
923  "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
924def err_opencl_half_load_store : Error<
925  "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
926  "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
927def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
928def err_opencl_half_declaration : Error<
929  "declaring variable of type %0 is not allowed">;
930def err_opencl_invalid_param : Error<
931  "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
932def err_opencl_invalid_return : Error<
933  "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
934def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
935def warn_pragma_options_align_reset_failed : Warning<
936  "#pragma options align=reset failed: %0">,
937  InGroup<IgnoredPragmas>;
938def err_pragma_options_align_mac68k_target_unsupported : Error<
939  "mac68k alignment pragma is not supported on this target">;
940def warn_pragma_align_not_xl_compatible : Warning<
941  "#pragma align(packed) may not be compatible with objects generated with AIX XL C/C++">,
942  InGroup<AIXCompat>;
943def warn_pragma_pack_invalid_alignment : Warning<
944  "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
945  InGroup<IgnoredPragmas>;
946def err_pragma_pack_invalid_alignment : Error<
947  warn_pragma_pack_invalid_alignment.Text>;
948def warn_pragma_pack_non_default_at_include : Warning<
949  "non-default #pragma pack value changes the alignment of struct or union "
950  "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
951  DefaultIgnore;
952def warn_pragma_pack_modified_after_include : Warning<
953  "the current #pragma pack alignment value is modified in the included "
954  "file">, InGroup<PragmaPack>;
955def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
956  "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
957def note_pragma_pack_here : Note<
958  "previous '#pragma pack' directive that modifies alignment is here">;
959def note_pragma_pack_pop_instead_reset : Note<
960  "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
961// Follow the Microsoft implementation.
962def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
963def warn_pragma_pack_pop_identifier_and_alignment : Warning<
964  "specifying both a name and alignment to 'pop' is undefined">;
965def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
966  InGroup<IgnoredPragmas>;
967def err_pragma_fc_pp_scope : Error<
968  "'#pragma float_control push/pop' can only appear at file or namespace scope "
969  "or within a language linkage specification">;
970def err_pragma_fc_noprecise_requires_nofenv : Error<
971  "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
972def err_pragma_fc_except_requires_precise : Error<
973  "'#pragma float_control(except, on)' is illegal when precise is disabled">;
974def err_pragma_fc_noprecise_requires_noexcept : Error<
975  "'#pragma float_control(precise, off)' is illegal when except is enabled">;
976def err_pragma_fenv_requires_precise : Error<
977  "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
978def warn_cxx_ms_struct :
979  Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
980          "with base classes or virtual functions">,
981  DefaultError, InGroup<IncompatibleMSStruct>;
982def err_pragma_pack_identifer_not_supported : Error<
983  "specifying an identifier within `#pragma pack` is not supported on this target">;
984def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
985def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
986def err_invalid_super_scope : Error<"invalid use of '__super', "
987  "this keyword can only be used inside class or member function scope">;
988def err_super_in_lambda_unsupported : Error<
989  "use of '__super' inside a lambda is unsupported">;
990
991def err_pragma_expected_file_scope : Error<
992  "'#pragma %0' can only appear at file scope">;
993def err_pragma_alloc_text_c_linkage: Error<
994  "'#pragma alloc_text' is applicable only to functions with C linkage">;
995def err_pragma_alloc_text_not_function: Error<
996  "'#pragma alloc_text' is applicable only to functions">;
997
998def warn_pragma_unused_undeclared_var : Warning<
999  "undeclared variable %0 used as an argument for '#pragma unused'">,
1000  InGroup<IgnoredPragmas>;
1001def warn_atl_uuid_deprecated : Warning<
1002  "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
1003  InGroup<DeprecatedDeclarations>;
1004def warn_pragma_unused_expected_var_arg : Warning<
1005  "only variables can be arguments to '#pragma unused'">,
1006  InGroup<IgnoredPragmas>;
1007def err_pragma_push_visibility_mismatch : Error<
1008  "#pragma visibility push with no matching #pragma visibility pop">;
1009def note_surrounding_namespace_ends_here : Note<
1010  "surrounding namespace with visibility attribute ends here">;
1011def err_pragma_pop_visibility_mismatch : Error<
1012  "#pragma visibility pop with no matching #pragma visibility push">;
1013def note_surrounding_namespace_starts_here : Note<
1014  "surrounding namespace with visibility attribute starts here">;
1015def err_pragma_loop_invalid_argument_type : Error<
1016  "invalid argument of type %0; expected an integer type">;
1017def err_pragma_loop_invalid_argument_value : Error<
1018  "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
1019def err_pragma_loop_compatibility : Error<
1020  "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
1021def err_pragma_loop_precedes_nonloop : Error<
1022  "expected a for, while, or do-while loop to follow '%0'">;
1023
1024def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
1025  "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
1026  "those declarations">;
1027def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
1028  "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
1029def err_pragma_attribute_invalid_matchers : Error<
1030  "attribute %0 can't be applied to %1">;
1031def err_pragma_attribute_stack_mismatch : Error<
1032  "'#pragma clang attribute %select{%1.|}0pop' with no matching"
1033  " '#pragma clang attribute %select{%1.|}0push'">;
1034def warn_pragma_attribute_unused : Warning<
1035  "unused attribute %0 in '#pragma clang attribute push' region">,
1036  InGroup<PragmaClangAttribute>;
1037def note_pragma_attribute_region_ends_here : Note<
1038  "'#pragma clang attribute push' regions ends here">;
1039def err_pragma_attribute_no_pop_eof : Error<"unterminated "
1040  "'#pragma clang attribute push' at end of file">;
1041def note_pragma_attribute_applied_decl_here : Note<
1042  "when applied to this declaration">;
1043def err_pragma_attr_attr_no_push : Error<
1044  "'#pragma clang attribute' attribute with no matching "
1045  "'#pragma clang attribute push'">;
1046
1047/// Objective-C parser diagnostics
1048def err_duplicate_class_def : Error<
1049  "duplicate interface definition for class %0">;
1050def err_undef_superclass : Error<
1051  "cannot find interface declaration for %0, superclass of %1">;
1052def err_forward_superclass : Error<
1053  "attempting to use the forward class %0 as superclass of %1">;
1054def err_no_nsconstant_string_class : Error<
1055  "cannot find interface declaration for %0">;
1056def err_recursive_superclass : Error<
1057  "trying to recursively use %0 as superclass of %1">;
1058def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
1059def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
1060def warn_duplicate_protocol_def : Warning<
1061  "duplicate protocol definition of %0 is ignored">,
1062  InGroup<DiagGroup<"duplicate-protocol">>;
1063def err_protocol_has_circular_dependency : Error<
1064  "protocol has circular dependency">;
1065def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
1066def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
1067def err_atprotocol_protocol : Error<
1068  "@protocol is using a forward protocol declaration of %0">;
1069def warn_readonly_property : Warning<
1070  "attribute 'readonly' of property %0 restricts attribute "
1071  "'readwrite' of property inherited from %1">,
1072  InGroup<PropertyAttr>;
1073
1074def warn_property_attribute : Warning<
1075  "'%1' attribute on property %0 does not match the property inherited from %2">,
1076  InGroup<PropertyAttr>;
1077def warn_property_types_are_incompatible : Warning<
1078  "property type %0 is incompatible with type %1 inherited from %2">,
1079  InGroup<DiagGroup<"incompatible-property-type">>;
1080def warn_protocol_property_mismatch : Warning<
1081  "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
1082  "getter %1|with setter %1}0 was selected for synthesis">,
1083  InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
1084def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Text>;
1085def err_undef_interface : Error<"cannot find interface declaration for %0">;
1086def err_category_forward_interface : Error<
1087  "cannot define %select{category|class extension}0 for undefined class %1">;
1088def err_class_extension_after_impl : Error<
1089  "cannot declare class extension for %0 after class implementation">;
1090def note_implementation_declared : Note<
1091  "class implementation is declared here">;
1092def note_while_in_implementation : Note<
1093  "detected while default synthesizing properties in class implementation">;
1094def note_class_declared : Note<
1095  "class is declared here">;
1096def note_receiver_class_declared : Note<
1097  "receiver is instance of class declared here">;
1098def note_receiver_expr_here : Note<
1099  "receiver expression is here">;
1100def note_receiver_is_id : Note<
1101  "receiver is treated with 'id' type for purpose of method lookup">;
1102def note_suppressed_class_declare : Note<
1103  "class with specified objc_requires_property_definitions attribute is declared here">;
1104def err_objc_root_class_subclass : Error<
1105  "objc_root_class attribute may only be specified on a root class declaration">;
1106def err_restricted_superclass_mismatch : Error<
1107  "cannot subclass a class that was declared with the "
1108  "'objc_subclassing_restricted' attribute">;
1109def err_class_stub_subclassing_mismatch : Error<
1110  "'objc_class_stub' attribute cannot be specified on a class that does not "
1111  "have the 'objc_subclassing_restricted' attribute">;
1112def err_implementation_of_class_stub : Error<
1113  "cannot declare implementation of a class declared with the "
1114  "'objc_class_stub' attribute">;
1115def warn_objc_root_class_missing : Warning<
1116  "class %0 defined without specifying a base class">,
1117  InGroup<ObjCRootClass>;
1118def err_objc_runtime_visible_category : Error<
1119  "cannot implement a category for class %0 that is only visible via the "
1120  "Objective-C runtime">;
1121def err_objc_runtime_visible_subclass : Error<
1122  "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1123  "Objective-C runtime">;
1124def note_objc_needs_superclass : Note<
1125  "add a super class to fix this problem">;
1126def err_conflicting_super_class : Error<"conflicting super class name %0">;
1127def err_dup_implementation_class : Error<"reimplementation of class %0">;
1128def err_dup_implementation_category : Error<
1129  "reimplementation of category %1 for class %0">;
1130def err_conflicting_ivar_type : Error<
1131  "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1132def err_duplicate_ivar_declaration : Error<
1133  "instance variable is already declared">;
1134def warn_on_superclass_use : Warning<
1135  "class implementation may not have super class">;
1136def err_conflicting_ivar_bitwidth : Error<
1137  "instance variable %0 has conflicting bit-field width">;
1138def err_conflicting_ivar_name : Error<
1139  "conflicting instance variable names: %0 vs %1">;
1140def err_inconsistent_ivar_count : Error<
1141  "inconsistent number of instance variables specified">;
1142def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1143  InGroup<DiagGroup<"incomplete-implementation">>;
1144def warn_objc_boxing_invalid_utf8_string : Warning<
1145  "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1146  InGroup<ObjCBoxing>;
1147
1148def err_objc_non_runtime_protocol_in_protocol_expr : Error<
1149  "cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression">;
1150def err_objc_direct_on_protocol : Error<
1151  "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1152  "declared in an Objective-C protocol">;
1153def err_objc_direct_duplicate_decl : Error<
1154  "%select{|direct }0%select{method|property}1 declaration conflicts "
1155  "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1156def err_objc_direct_impl_decl_mismatch : Error<
1157  "direct method was declared in %select{the primary interface|an extension|a category}0 "
1158  "but is implemented in %select{the primary interface|a category|a different category}1">;
1159def err_objc_direct_missing_on_decl : Error<
1160  "direct method implementation was previously declared not direct">;
1161def err_objc_direct_on_override : Error<
1162  "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1163def err_objc_override_direct_method : Error<
1164  "cannot override a method that is declared direct by a superclass">;
1165def warn_objc_direct_ignored : Warning<
1166  "%0 attribute isn't implemented by this Objective-C runtime">,
1167  InGroup<IgnoredAttributes>;
1168def warn_objc_direct_property_ignored : Warning<
1169  "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1170  InGroup<IgnoredAttributes>;
1171def err_objc_direct_dynamic_property : Error<
1172  "direct property cannot be @dynamic">;
1173def err_objc_direct_protocol_conformance : Error<
1174  "%select{category %1|class extension}0 cannot conform to protocol %2 because "
1175  "of direct members declared in interface %3">;
1176def note_direct_member_here : Note<"direct member declared here">;
1177
1178def warn_conflicting_overriding_ret_types : Warning<
1179  "conflicting return type in "
1180  "declaration of %0%diff{: $ vs $|}1,2">,
1181  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1182
1183def warn_conflicting_ret_types : Warning<
1184  "conflicting return type in "
1185  "implementation of %0%diff{: $ vs $|}1,2">,
1186  InGroup<MismatchedReturnTypes>;
1187
1188def warn_conflicting_overriding_ret_type_modifiers : Warning<
1189  "conflicting distributed object modifiers on return type "
1190  "in declaration of %0">,
1191  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1192
1193def warn_conflicting_ret_type_modifiers : Warning<
1194  "conflicting distributed object modifiers on return type "
1195  "in implementation of %0">,
1196  InGroup<DistributedObjectModifiers>;
1197
1198def warn_non_covariant_overriding_ret_types : Warning<
1199  "conflicting return type in "
1200  "declaration of %0: %1 vs %2">,
1201  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1202
1203def warn_non_covariant_ret_types : Warning<
1204  "conflicting return type in "
1205  "implementation of %0: %1 vs %2">,
1206  InGroup<MethodSignatures>, DefaultIgnore;
1207
1208def warn_conflicting_overriding_param_types : Warning<
1209  "conflicting parameter types in "
1210  "declaration of %0%diff{: $ vs $|}1,2">,
1211  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1212
1213def warn_conflicting_param_types : Warning<
1214  "conflicting parameter types in "
1215  "implementation of %0%diff{: $ vs $|}1,2">,
1216  InGroup<MismatchedParameterTypes>;
1217
1218def warn_conflicting_param_modifiers : Warning<
1219  "conflicting distributed object modifiers on parameter type "
1220  "in implementation of %0">,
1221  InGroup<DistributedObjectModifiers>;
1222
1223def warn_conflicting_overriding_param_modifiers : Warning<
1224  "conflicting distributed object modifiers on parameter type "
1225  "in declaration of %0">,
1226  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1227
1228def warn_non_contravariant_overriding_param_types : Warning<
1229  "conflicting parameter types in "
1230  "declaration of %0: %1 vs %2">,
1231  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1232
1233def warn_non_contravariant_param_types : Warning<
1234  "conflicting parameter types in "
1235  "implementation of %0: %1 vs %2">,
1236  InGroup<MethodSignatures>, DefaultIgnore;
1237
1238def warn_conflicting_overriding_variadic :Warning<
1239  "conflicting variadic declaration of method and its "
1240  "implementation">,
1241  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1242
1243def warn_conflicting_variadic :Warning<
1244  "conflicting variadic declaration of method and its "
1245  "implementation">;
1246
1247def warn_category_method_impl_match:Warning<
1248  "category is implementing a method which will also be implemented"
1249  " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1250
1251def warn_implements_nscopying : Warning<
1252"default assign attribute on property %0 which implements "
1253"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1254
1255def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1256  InGroup<ObjCMultipleMethodNames>;
1257def warn_strict_multiple_method_decl : Warning<
1258  "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1259def warn_accessor_property_type_mismatch : Warning<
1260  "type of property %0 does not match type of accessor %1">;
1261def note_conv_function_declared_at : Note<"type conversion function declared here">;
1262def note_method_declared_at : Note<"method %0 declared here">;
1263def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1264def note_property_attribute : Note<"property %0 is declared "
1265  "%select{deprecated|unavailable|partial}1 here">;
1266def err_setter_type_void : Error<"type of setter must be void">;
1267def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1268def warn_duplicate_method_decl :
1269  Warning<"multiple declarations of method %0 found and ignored">,
1270  InGroup<MethodDuplicate>, DefaultIgnore;
1271def warn_objc_cdirective_format_string :
1272  Warning<"using %0 directive in %select{NSString|CFString}1 "
1273          "which is being passed as a formatting argument to the formatting "
1274          "%select{method|CFfunction}2">,
1275  InGroup<ObjCCStringFormat>, DefaultIgnore;
1276def err_objc_var_decl_inclass :
1277    Error<"cannot declare variable inside @interface or @protocol">;
1278def err_missing_method_context : Error<
1279  "missing context for method declaration">;
1280def err_objc_property_attr_mutually_exclusive : Error<
1281  "property attributes '%0' and '%1' are mutually exclusive">;
1282def err_objc_property_requires_object : Error<
1283  "property with '%0' attribute must be of object type">;
1284def warn_objc_property_assign_on_object : Warning<
1285  "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1286  InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1287def warn_objc_property_no_assignment_attribute : Warning<
1288  "no 'assign', 'retain', or 'copy' attribute is specified - "
1289  "'assign' is assumed">,
1290  InGroup<ObjCPropertyNoAttribute>;
1291def warn_objc_isa_use : Warning<
1292  "direct access to Objective-C's isa is deprecated in favor of "
1293  "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1294def warn_objc_isa_assign : Warning<
1295  "assignment to Objective-C's isa is deprecated in favor of "
1296  "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1297def warn_objc_pointer_masking : Warning<
1298  "bitmasking for introspection of Objective-C object pointers is strongly "
1299  "discouraged">,
1300  InGroup<ObjCPointerIntrospect>;
1301def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
1302  InGroup<ObjCPointerIntrospectPerformSelector>;
1303def warn_objc_property_default_assign_on_object : Warning<
1304  "default property attribute 'assign' not appropriate for object">,
1305  InGroup<ObjCPropertyNoAttribute>;
1306def warn_property_attr_mismatch : Warning<
1307  "property attribute in class extension does not match the primary class">,
1308  InGroup<PropertyAttr>;
1309def warn_property_implicitly_mismatched : Warning <
1310  "primary property declaration is implicitly strong while redeclaration "
1311  "in class extension is weak">,
1312  InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1313def warn_objc_property_copy_missing_on_block : Warning<
1314    "'copy' attribute must be specified for the block property "
1315    "when -fobjc-gc-only is specified">;
1316def warn_objc_property_retain_of_block : Warning<
1317    "retain'ed block property does not copy the block "
1318    "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1319def warn_objc_readonly_property_has_setter : Warning<
1320    "setter cannot be specified for a readonly property">,
1321    InGroup<ObjCReadonlyPropertyHasSetter>;
1322def warn_atomic_property_rule : Warning<
1323  "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1324  "with a user defined %select{getter|setter}2">,
1325  InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1326def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1327  "synthesized, or both be user defined,or the property must be nonatomic">;
1328def err_atomic_property_nontrivial_assign_op : Error<
1329  "atomic property of reference type %0 cannot have non-trivial assignment"
1330  " operator">;
1331def warn_cocoa_naming_owned_rule : Warning<
1332  "property follows Cocoa naming"
1333  " convention for returning 'owned' objects">,
1334  InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1335def err_cocoa_naming_owned_rule : Error<
1336  "property follows Cocoa naming"
1337  " convention for returning 'owned' objects">;
1338def note_cocoa_naming_declare_family : Note<
1339  "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1340  "object">;
1341def warn_auto_synthesizing_protocol_property :Warning<
1342  "auto property synthesis will not synthesize property %0"
1343  " declared in protocol %1">,
1344  InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1345def note_add_synthesize_directive : Note<
1346  "add a '@synthesize' directive">;
1347def warn_no_autosynthesis_shared_ivar_property : Warning <
1348  "auto property synthesis will not synthesize property "
1349  "%0 because it cannot share an ivar with another synthesized property">,
1350  InGroup<ObjCNoPropertyAutoSynthesis>;
1351def warn_no_autosynthesis_property : Warning<
1352  "auto property synthesis will not synthesize property "
1353  "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1354  "via another property">,
1355  InGroup<ObjCNoPropertyAutoSynthesis>;
1356def warn_autosynthesis_property_in_superclass : Warning<
1357  "auto property synthesis will not synthesize property "
1358  "%0; it will be implemented by its superclass, use @dynamic to "
1359  "acknowledge intention">,
1360  InGroup<ObjCNoPropertyAutoSynthesis>;
1361def warn_autosynthesis_property_ivar_match :Warning<
1362  "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1363  "%2, not existing instance variable %3">,
1364  InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1365def warn_missing_explicit_synthesis : Warning <
1366  "auto property synthesis is synthesizing property not explicitly synthesized">,
1367  InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1368def warn_property_getter_owning_mismatch : Warning<
1369  "property declared as returning non-retained objects"
1370  "; getter returning retained objects">;
1371def warn_property_redecl_getter_mismatch : Warning<
1372  "getter name mismatch between property redeclaration (%1) and its original "
1373  "declaration (%0)">, InGroup<PropertyAttr>;
1374def err_property_setter_ambiguous_use : Error<
1375  "synthesized properties %0 and %1 both claim setter %2 -"
1376  " use of this setter will cause unexpected behavior">;
1377def warn_default_atomic_custom_getter_setter : Warning<
1378  "atomic by default property %0 has a user defined %select{getter|setter}1 "
1379  "(property should be marked 'atomic' if this is intended)">,
1380  InGroup<CustomAtomic>, DefaultIgnore;
1381def err_use_continuation_class : Error<
1382  "illegal redeclaration of property in class extension %0"
1383  " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1384def err_type_mismatch_continuation_class : Error<
1385  "type of property %0 in class extension does not match "
1386  "property type in primary class">;
1387def err_use_continuation_class_redeclaration_readwrite : Error<
1388  "illegal redeclaration of 'readwrite' property in class extension %0"
1389  " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1390  "'readonly' public property?)">;
1391def err_continuation_class : Error<"class extension has no primary class">;
1392def err_property_type : Error<"property cannot have array or function type %0">;
1393def err_missing_property_context : Error<
1394  "missing context for property implementation declaration">;
1395def err_bad_property_decl : Error<
1396  "property implementation must have its declaration in interface %0 or one of "
1397  "its extensions">;
1398def err_category_property : Error<
1399  "property declared in category %0 cannot be implemented in "
1400  "class implementation">;
1401def note_property_declare : Note<
1402  "property declared here">;
1403def note_protocol_property_declare : Note<
1404  "it could also be property "
1405  "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1406  "%1|with setter %1}0 declared here">;
1407def note_property_synthesize : Note<
1408  "property synthesized here">;
1409def err_synthesize_category_decl : Error<
1410  "@synthesize not allowed in a category's implementation">;
1411def err_synthesize_on_class_property : Error<
1412  "@synthesize not allowed on a class property %0">;
1413def err_missing_property_interface : Error<
1414  "property implementation in a category with no category declaration">;
1415def err_bad_category_property_decl : Error<
1416  "property implementation must have its declaration in the category %0">;
1417def err_bad_property_context : Error<
1418  "property implementation must be in a class or category implementation">;
1419def err_missing_property_ivar_decl : Error<
1420  "synthesized property %0 must either be named the same as a compatible"
1421  " instance variable or must explicitly name an instance variable">;
1422def err_arc_perform_selector_retains : Error<
1423  "performSelector names a selector which retains the object">;
1424def warn_arc_perform_selector_leaks : Warning<
1425  "performSelector may cause a leak because its selector is unknown">,
1426  InGroup<DiagGroup<"arc-performSelector-leaks">>;
1427def warn_dealloc_in_category : Warning<
1428"-dealloc is being overridden in a category">,
1429InGroup<DeallocInCategory>;
1430def err_gc_weak_property_strong_type : Error<
1431  "weak attribute declared on a __strong type property in GC mode">;
1432def warn_arc_repeated_use_of_weak : Warning <
1433  "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1434  "accessed multiple times in this %select{function|method|block|lambda}2 "
1435  "but may be unpredictably set to nil; assign to a strong variable to keep "
1436  "the object alive">,
1437  InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1438def warn_implicitly_retains_self : Warning <
1439  "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1440  "this is intended behavior">,
1441  InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1442def warn_arc_possible_repeated_use_of_weak : Warning <
1443  "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1444  "be accessed multiple times in this %select{function|method|block|lambda}2 "
1445  "and may be unpredictably set to nil; assign to a strong variable to keep "
1446  "the object alive">,
1447  InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1448def note_arc_weak_also_accessed_here : Note<
1449  "also accessed here">;
1450def err_incomplete_synthesized_property : Error<
1451  "cannot synthesize property %0 with incomplete type %1">;
1452
1453def err_property_ivar_type : Error<
1454  "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1455def err_property_accessor_type : Error<
1456  "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1457def err_ivar_in_superclass_use : Error<
1458  "property %0 attempting to use instance variable %1 declared in super class %2">;
1459def err_weak_property : Error<
1460  "existing instance variable %1 for __weak property %0 must be __weak">;
1461def err_strong_property : Error<
1462  "existing instance variable %1 for strong property %0 may not be __weak">;
1463def err_dynamic_property_ivar_decl : Error<
1464  "dynamic property cannot have instance variable specification">;
1465def err_duplicate_ivar_use : Error<
1466  "synthesized properties %0 and %1 both claim instance variable %2">;
1467def err_property_implemented : Error<"property %0 is already implemented">;
1468def warn_objc_missing_super_call : Warning<
1469  "method possibly missing a [super %0] call">,
1470  InGroup<ObjCMissingSuperCalls>;
1471def err_dealloc_bad_result_type : Error<
1472  "dealloc return type must be correctly specified as 'void' under ARC, "
1473  "instead of %0">;
1474def warn_undeclared_selector : Warning<
1475  "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1476def warn_undeclared_selector_with_typo : Warning<
1477  "undeclared selector %0; did you mean %1?">,
1478  InGroup<UndeclaredSelector>, DefaultIgnore;
1479def warn_implicit_atomic_property : Warning<
1480  "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1481def note_auto_readonly_iboutlet_fixup_suggest : Note<
1482  "property should be changed to be readwrite">;
1483def warn_auto_readonly_iboutlet_property : Warning<
1484  "readonly IBOutlet property %0 when auto-synthesized may "
1485  "not work correctly with 'nib' loader">,
1486  InGroup<DiagGroup<"readonly-iboutlet-property">>;
1487def warn_auto_implicit_atomic_property : Warning<
1488  "property is assumed atomic when auto-synthesizing the property">,
1489  InGroup<ImplicitAtomic>, DefaultIgnore;
1490def warn_unimplemented_selector:  Warning<
1491  "no method with selector %0 is implemented in this translation unit">,
1492  InGroup<Selector>, DefaultIgnore;
1493def warn_unimplemented_protocol_method : Warning<
1494  "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1495def warn_multiple_selectors: Warning<
1496  "several methods with selector %0 of mismatched types are found "
1497  "for the @selector expression">,
1498  InGroup<SelectorTypeMismatch>, DefaultIgnore;
1499def err_direct_selector_expression : Error<
1500  "@selector expression formed with direct selector %0">;
1501def warn_potentially_direct_selector_expression : Warning<
1502  "@selector expression formed with potentially direct selector %0">,
1503  InGroup<ObjCPotentiallyDirectSelector>;
1504def warn_strict_potentially_direct_selector_expression : Warning<
1505  warn_potentially_direct_selector_expression.Text>,
1506  InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1507
1508def err_objc_kindof_nonobject : Error<
1509  "'__kindof' specifier cannot be applied to non-object type %0">;
1510def err_objc_kindof_wrong_position : Error<
1511  "'__kindof' type specifier must precede the declarator">;
1512
1513def err_objc_method_unsupported_param_ret_type : Error<
1514  "%0 %select{parameter|return}1 type is unsupported; "
1515  "support for vector types for this target is introduced in %2">;
1516
1517def warn_messaging_unqualified_id : Warning<
1518  "messaging unqualified id">, DefaultIgnore,
1519  InGroup<DiagGroup<"objc-messaging-id">>;
1520def err_messaging_unqualified_id_with_direct_method : Error<
1521  "messaging unqualified id with a method that is possibly direct">;
1522def err_messaging_super_with_direct_method : Error<
1523  "messaging super with a direct method">;
1524def err_messaging_class_with_direct_method : Error<
1525  "messaging a Class with a method that is possibly direct">;
1526
1527// C++ declarations
1528def err_static_assert_expression_is_not_constant : Error<
1529  "static assertion expression is not an integral constant expression">;
1530def err_constexpr_if_condition_expression_is_not_constant : Error<
1531  "constexpr if condition is not a constant expression">;
1532def err_static_assert_failed : Error<"static assertion failed%select{: %1|}0">;
1533def err_static_assert_requirement_failed : Error<
1534  "static assertion failed due to requirement '%0'%select{: %2|}1">;
1535
1536def warn_consteval_if_always_true : Warning<
1537  "consteval if is always true in an %select{unevaluated|immediate}0 context">,
1538  InGroup<DiagGroup<"redundant-consteval-if">>;
1539
1540def ext_inline_variable : ExtWarn<
1541  "inline variables are a C++17 extension">, InGroup<CXX17>;
1542def warn_cxx14_compat_inline_variable : Warning<
1543  "inline variables are incompatible with C++ standards before C++17">,
1544  DefaultIgnore, InGroup<CXXPre17Compat>;
1545
1546def warn_inline_namespace_reopened_noninline : Warning<
1547  "inline namespace reopened as a non-inline namespace">,
1548  InGroup<InlineNamespaceReopenedNoninline>;
1549def err_inline_namespace_mismatch : Error<
1550  "non-inline namespace cannot be reopened as inline">;
1551
1552def err_unexpected_friend : Error<
1553  "friends can only be classes or functions">;
1554def ext_enum_friend : ExtWarn<
1555  "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1556def warn_cxx98_compat_enum_friend : Warning<
1557  "befriending enumeration type %0 is incompatible with C++98">,
1558  InGroup<CXX98Compat>, DefaultIgnore;
1559def ext_nonclass_type_friend : ExtWarn<
1560  "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1561def warn_cxx98_compat_nonclass_type_friend : Warning<
1562  "non-class friend type %0 is incompatible with C++98">,
1563  InGroup<CXX98Compat>, DefaultIgnore;
1564def err_friend_is_member : Error<
1565  "friends cannot be members of the declaring class">;
1566def warn_cxx98_compat_friend_is_member : Warning<
1567  "friend declaration naming a member of the declaring class is incompatible "
1568  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1569def ext_unelaborated_friend_type : ExtWarn<
1570  "unelaborated friend declaration is a C++11 extension; specify "
1571  "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1572  InGroup<CXX11>;
1573def warn_cxx98_compat_unelaborated_friend_type : Warning<
1574  "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1575  "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1576def err_qualified_friend_no_match : Error<
1577  "friend declaration of %0 does not match any declaration in %1">;
1578def err_introducing_special_friend : Error<
1579  "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1580  " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1581  "as a friend">;
1582def err_tagless_friend_type_template : Error<
1583  "friend type templates must use an elaborated type">;
1584def err_no_matching_local_friend : Error<
1585  "no matching function found in local scope">;
1586def err_no_matching_local_friend_suggest : Error<
1587  "no matching function %0 found in local scope; did you mean %3?">;
1588def err_partial_specialization_friend : Error<
1589  "partial specialization cannot be declared as a friend">;
1590def err_qualified_friend_def : Error<
1591  "friend function definition cannot be qualified with '%0'">;
1592def err_friend_def_in_local_class : Error<
1593  "friend function cannot be defined in a local class">;
1594def err_friend_not_first_in_declaration : Error<
1595  "'friend' must appear first in a non-function declaration">;
1596def err_using_decl_friend : Error<
1597  "cannot befriend target of using declaration">;
1598def warn_template_qualified_friend_unsupported : Warning<
1599  "dependent nested name specifier '%0' for friend class declaration is "
1600  "not supported; turning off access control for %1">,
1601  InGroup<UnsupportedFriend>;
1602def warn_template_qualified_friend_ignored : Warning<
1603  "dependent nested name specifier '%0' for friend template declaration is "
1604  "not supported; ignoring this friend declaration">,
1605  InGroup<UnsupportedFriend>;
1606def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1607  "unqualified friend declaration referring to type outside of the nearest "
1608  "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1609  InGroup<MicrosoftUnqualifiedFriend>;
1610def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1611
1612def err_invalid_base_in_interface : Error<
1613  "interface type cannot inherit from "
1614  "%select{struct|non-public interface|class}0 %1">;
1615
1616def err_abstract_type_in_decl : Error<
1617  "%select{return|parameter|variable|field|instance variable|"
1618  "synthesized instance variable}0 type %1 is an abstract class">;
1619def err_allocation_of_abstract_type : Error<
1620  "allocating an object of abstract class type %0">;
1621def err_throw_abstract_type : Error<
1622  "cannot throw an object of abstract type %0">;
1623def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1624def err_capture_of_abstract_type : Error<
1625  "by-copy capture of value of abstract type %0">;
1626def err_capture_of_incomplete_or_sizeless_type : Error<
1627  "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1628def err_capture_default_non_local : Error<
1629  "non-local lambda expression cannot have a capture-default">;
1630
1631def err_multiple_final_overriders : Error<
1632  "virtual function %q0 has more than one final overrider in %1">;
1633def note_final_overrider : Note<"final overrider of %q0 in %1">;
1634
1635def err_type_defined_in_type_specifier : Error<
1636  "%0 cannot be defined in a type specifier">;
1637def err_type_defined_in_result_type : Error<
1638  "%0 cannot be defined in the result type of a function">;
1639def err_type_defined_in_param_type : Error<
1640  "%0 cannot be defined in a parameter type">;
1641def err_type_defined_in_alias_template : Error<
1642  "%0 cannot be defined in a type alias template">;
1643def err_type_defined_in_condition : Error<
1644  "%0 cannot be defined in a condition">;
1645def err_type_defined_in_enum : Error<
1646  "%0 cannot be defined in an enumeration">;
1647
1648def note_pure_virtual_function : Note<
1649  "unimplemented pure virtual method %0 in %1">;
1650
1651def note_pure_qualified_call_kext : Note<
1652  "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1653
1654def err_deleted_decl_not_first : Error<
1655  "deleted definition must be first declaration">;
1656
1657def err_deleted_override : Error<
1658  "deleted function %0 cannot override a non-deleted function">;
1659def err_non_deleted_override : Error<
1660  "non-deleted function %0 cannot override a deleted function">;
1661def err_consteval_override : Error<
1662  "consteval function %0 cannot override a non-consteval function">;
1663def err_non_consteval_override : Error<
1664  "non-consteval function %0 cannot override a consteval function">;
1665
1666def warn_weak_vtable : Warning<
1667  "%0 has no out-of-line virtual method definitions; its vtable will be "
1668  "emitted in every translation unit">,
1669  InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1670def warn_weak_template_vtable : Warning<
1671  "this warning is no longer in use and will be removed in the next release">,
1672  InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1673
1674def ext_using_undefined_std : ExtWarn<
1675  "using directive refers to implicitly-defined namespace 'std'">;
1676
1677// C++ exception specifications
1678def err_exception_spec_in_typedef : Error<
1679  "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1680def err_distant_exception_spec : Error<
1681  "exception specifications are not allowed beyond a single level "
1682  "of indirection">;
1683def err_incomplete_in_exception_spec : Error<
1684  "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1685  "in exception specification">;
1686def err_sizeless_in_exception_spec : Error<
1687  "%select{|reference to }0sizeless type %1 is not allowed "
1688  "in exception specification">;
1689def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Text>,
1690  InGroup<MicrosoftExceptionSpec>;
1691def err_rref_in_exception_spec : Error<
1692  "rvalue reference type %0 is not allowed in exception specification">;
1693def err_mismatched_exception_spec : Error<
1694  "exception specification in declaration does not match previous declaration">;
1695def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Text>,
1696  InGroup<MicrosoftExceptionSpec>;
1697def err_override_exception_spec : Error<
1698  "exception specification of overriding function is more lax than "
1699  "base version">;
1700def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Text>,
1701  InGroup<MicrosoftExceptionSpec>;
1702def err_incompatible_exception_specs : Error<
1703  "target exception specification is not superset of source">;
1704def warn_incompatible_exception_specs : Warning<
1705  err_incompatible_exception_specs.Text>, InGroup<IncompatibleExceptionSpec>;
1706def err_deep_exception_specs_differ : Error<
1707  "exception specifications of %select{return|argument}0 types differ">;
1708def warn_deep_exception_specs_differ : Warning<
1709  err_deep_exception_specs_differ.Text>, InGroup<IncompatibleExceptionSpec>;
1710def err_missing_exception_specification : Error<
1711  "%0 is missing exception specification '%1'">;
1712def ext_missing_exception_specification : ExtWarn<
1713  err_missing_exception_specification.Text>,
1714  InGroup<DiagGroup<"missing-exception-spec">>;
1715def err_exception_spec_not_parsed : Error<
1716  "exception specification is not available until end of class definition">;
1717def err_exception_spec_cycle : Error<
1718  "exception specification of %0 uses itself">;
1719def err_exception_spec_incomplete_type : Error<
1720  "exception specification needed for member of incomplete class %0">;
1721def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1722  "dynamic exception specifications with types are currently ignored in wasm">,
1723  InGroup<WebAssemblyExceptionSpec>;
1724
1725// C++ access checking
1726def err_class_redeclared_with_different_access : Error<
1727  "%0 redeclared with '%1' access">;
1728def err_access : Error<
1729  "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1730def ext_ms_using_declaration_inaccessible : ExtWarn<
1731  "using declaration referring to inaccessible member '%0' (which refers "
1732  "to accessible member '%1') is a Microsoft compatibility extension">,
1733    AccessControl, InGroup<MicrosoftUsingDecl>;
1734def err_access_ctor : Error<
1735  "calling a %select{private|protected}0 constructor of class %2">,
1736  AccessControl;
1737def ext_rvalue_to_reference_access_ctor : Extension<
1738  "C++98 requires an accessible copy constructor for class %2 when binding "
1739  "a reference to a temporary; was %select{private|protected}0">,
1740  AccessControl, InGroup<BindToTemporaryCopy>;
1741def err_access_base_ctor : Error<
1742  // The ERRORs represent other special members that aren't constructors, in
1743  // hopes that someone will bother noticing and reporting if they appear
1744  "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1745  "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1746  "|*ERROR*|}2constructor">, AccessControl;
1747def err_access_field_ctor : Error<
1748  // The ERRORs represent other special members that aren't constructors, in
1749  // hopes that someone will bother noticing and reporting if they appear
1750  "field of type %0 has %select{private|protected}2 "
1751  "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1752  AccessControl;
1753def err_access_friend_function : Error<
1754  "friend function %1 is a %select{private|protected}0 member of %3">,
1755  AccessControl;
1756
1757def err_access_dtor : Error<
1758  "calling a %select{private|protected}1 destructor of class %0">,
1759  AccessControl;
1760def err_access_dtor_base :
1761    Error<"base class %0 has %select{private|protected}1 destructor">,
1762    AccessControl;
1763def err_access_dtor_vbase :
1764    Error<"inherited virtual base class %1 has "
1765    "%select{private|protected}2 destructor">,
1766    AccessControl;
1767def err_access_dtor_temp :
1768    Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1769    AccessControl;
1770def err_access_dtor_exception :
1771    Error<"exception object of type %0 has %select{private|protected}1 "
1772          "destructor">, AccessControl;
1773def err_access_dtor_field :
1774    Error<"field of type %1 has %select{private|protected}2 destructor">,
1775    AccessControl;
1776def err_access_dtor_var :
1777    Error<"variable of type %1 has %select{private|protected}2 destructor">,
1778    AccessControl;
1779def err_access_dtor_ivar :
1780    Error<"instance variable of type %0 has %select{private|protected}1 "
1781          "destructor">,
1782    AccessControl;
1783def note_previous_access_declaration : Note<
1784  "previously declared '%1' here">;
1785def note_access_natural : Note<
1786  "%select{|implicitly }1declared %select{private|protected}0 here">;
1787def note_access_constrained_by_path : Note<
1788  "constrained by %select{|implicitly }1%select{private|protected}0"
1789  " inheritance here">;
1790def note_access_protected_restricted_noobject : Note<
1791  "must name member using the type of the current context %0">;
1792def note_access_protected_restricted_ctordtor : Note<
1793  "protected %select{constructor|destructor}0 can only be used to "
1794  "%select{construct|destroy}0 a base class subobject">;
1795def note_access_protected_restricted_object : Note<
1796  "can only access this member on an object of type %0">;
1797def warn_cxx98_compat_sfinae_access_control : Warning<
1798  "substitution failure due to access control is incompatible with C++98">,
1799  InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1800
1801// C++ name lookup
1802def err_incomplete_nested_name_spec : Error<
1803  "incomplete type %0 named in nested name specifier">;
1804def err_incomplete_enum : Error<
1805  "enumeration %0 is incomplete">;
1806def err_dependent_nested_name_spec : Error<
1807  "nested name specifier for a declaration cannot depend on a template "
1808  "parameter">;
1809def err_nested_name_member_ref_lookup_ambiguous : Error<
1810  "lookup of %0 in member access expression is ambiguous">;
1811def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1812  "lookup of %0 in member access expression is ambiguous; using member of %1">,
1813  InGroup<AmbigMemberTemplate>;
1814def note_ambig_member_ref_object_type : Note<
1815  "lookup in the object type %0 refers here">;
1816def note_ambig_member_ref_scope : Note<
1817  "lookup from the current scope refers here">;
1818def err_qualified_member_nonclass : Error<
1819  "qualified member access refers to a member in %0">;
1820def err_incomplete_member_access : Error<
1821  "member access into incomplete type %0">;
1822def err_incomplete_type : Error<
1823  "incomplete type %0 where a complete type is required">;
1824def warn_cxx98_compat_enum_nested_name_spec : Warning<
1825  "enumeration type in nested name specifier is incompatible with C++98">,
1826  InGroup<CXX98Compat>, DefaultIgnore;
1827def err_nested_name_spec_is_not_class : Error<
1828  "%0 cannot appear before '::' because it is not a class"
1829  "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1830def ext_nested_name_spec_is_enum : ExtWarn<
1831  "use of enumeration in a nested name specifier is a C++11 extension">,
1832  InGroup<CXX11>;
1833def err_out_of_line_qualified_id_type_names_constructor : Error<
1834  "qualified reference to %0 is a constructor name rather than a "
1835  "%select{template name|type}1 in this context">;
1836def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1837  "ISO C++ specifies that "
1838  "qualified reference to %0 is a constructor name rather than a "
1839  "%select{template name|type}1 in this context, despite preceding "
1840  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1841  InGroup<DiagGroup<"injected-class-name">>;
1842
1843// C++ class members
1844def err_storageclass_invalid_for_member : Error<
1845  "storage class specified for a member declaration">;
1846def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1847def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1848def ext_mutable_reference : ExtWarn<
1849  "'mutable' on a reference type is a Microsoft extension">,
1850  InGroup<MicrosoftMutableReference>;
1851def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1852def err_mutable_nonmember : Error<
1853  "'mutable' can only be applied to member variables">;
1854def err_virtual_in_union : Error<
1855  "unions cannot have virtual functions">;
1856def err_virtual_non_function : Error<
1857  "'virtual' can only appear on non-static member functions">;
1858def err_virtual_out_of_class : Error<
1859  "'virtual' can only be specified inside the class definition">;
1860def err_virtual_member_function_template : Error<
1861  "'virtual' cannot be specified on member function templates">;
1862def err_static_overrides_virtual : Error<
1863  "'static' member function %0 overrides a virtual function in a base class">;
1864def err_explicit_non_function : Error<
1865  "'explicit' can only appear on non-static member functions">;
1866def err_explicit_out_of_class : Error<
1867  "'explicit' can only be specified inside the class definition">;
1868def err_explicit_non_ctor_or_conv_function : Error<
1869  "'explicit' can only be applied to a constructor or conversion function">;
1870def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1871def err_static_out_of_line : Error<
1872  "'static' can only be specified inside the class definition">;
1873def ext_static_out_of_line : ExtWarn<
1874  err_static_out_of_line.Text>,
1875  InGroup<MicrosoftTemplate>;
1876def err_storage_class_for_static_member : Error<
1877  "static data member definition cannot specify a storage class">;
1878def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1879def err_not_integral_type_bitfield : Error<
1880  "bit-field %0 has non-integral type %1">;
1881def err_not_integral_type_anon_bitfield : Error<
1882  "anonymous bit-field has non-integral type %0">;
1883def err_anon_bitfield_qualifiers : Error<
1884  "anonymous bit-field cannot have qualifiers">;
1885def err_member_function_initialization : Error<
1886  "initializer on function does not look like a pure-specifier">;
1887def err_non_virtual_pure : Error<
1888  "%0 is not virtual and cannot be declared pure">;
1889def ext_pure_function_definition : ExtWarn<
1890  "function definition with pure-specifier is a Microsoft extension">,
1891  InGroup<MicrosoftPureDefinition>;
1892def err_qualified_member_of_unrelated : Error<
1893  "%q0 is not a member of class %1">;
1894
1895def err_member_function_call_bad_cvr : Error<
1896  "'this' argument to member function %0 has type %1, but function is not marked "
1897  "%select{const|restrict|const or restrict|volatile|const or volatile|"
1898  "volatile or restrict|const, volatile, or restrict}2">;
1899def err_member_function_call_bad_ref : Error<
1900  "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1901  "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1902def err_member_function_call_bad_type : Error<
1903  "cannot initialize object parameter of type %0 with an expression "
1904  "of type %1">;
1905
1906def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1907  "call to pure virtual member function %0 has undefined behavior; "
1908  "overrides of %0 in subclasses are not available in the "
1909  "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1910
1911def select_special_member_kind : TextSubstitution<
1912  "%select{default constructor|copy constructor|move constructor|"
1913  "copy assignment operator|move assignment operator|destructor}0">;
1914
1915def note_member_declared_at : Note<"member is declared here">;
1916def note_ivar_decl : Note<"instance variable is declared here">;
1917def note_bitfield_decl : Note<"bit-field is declared here">;
1918def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1919def note_member_synthesized_at : Note<
1920  "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
1921  "first required here">;
1922def note_comparison_synthesized_at : Note<
1923  "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
1924  "first required here">;
1925def err_missing_default_ctor : Error<
1926  "%select{constructor for %1 must explicitly initialize the|"
1927  "implicit default constructor for %1 must explicitly initialize the|"
1928  "cannot use constructor inherited from base class %4;}0 "
1929  "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1930  "does not have a default constructor">;
1931def note_due_to_dllexported_class : Note<
1932  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1933
1934def err_illegal_union_or_anon_struct_member : Error<
1935  "%select{anonymous struct|union}0 member %1 has a non-trivial "
1936  "%sub{select_special_member_kind}2">;
1937
1938def warn_frame_address : Warning<
1939  "calling '%0' with a nonzero argument is unsafe">,
1940  InGroup<FrameAddress>, DefaultIgnore;
1941
1942def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1943  "%select{anonymous struct|union}0 member %1 with a non-trivial "
1944  "%sub{select_special_member_kind}2 is incompatible with C++98">,
1945  InGroup<CXX98Compat>, DefaultIgnore;
1946
1947def note_nontrivial_virtual_dtor : Note<
1948  "destructor for %0 is not trivial because it is virtual">;
1949def note_nontrivial_has_virtual : Note<
1950  "because type %0 has a virtual %select{member function|base class}1">;
1951def note_nontrivial_no_def_ctor : Note<
1952  "because %select{base class of |field of |}0type %1 has no "
1953  "default constructor">;
1954def note_user_declared_ctor : Note<
1955  "implicit default constructor suppressed by user-declared constructor">;
1956def note_nontrivial_no_copy : Note<
1957  "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1958  "assignment operator|<<ERROR>>}2 can be used to "
1959  "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1960  "%select{base class|field|an object}0 of type %3">;
1961def note_nontrivial_user_provided : Note<
1962  "because %select{base class of |field of |}0type %1 has a user-provided "
1963  "%sub{select_special_member_kind}2">;
1964def note_nontrivial_default_member_init : Note<
1965  "because field %0 has an initializer">;
1966def note_nontrivial_param_type : Note<
1967  "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
1968def note_nontrivial_default_arg : Note<"because it has a default argument">;
1969def note_nontrivial_variadic : Note<"because it is a variadic function">;
1970def note_nontrivial_subobject : Note<
1971  "because the function selected to %select{construct|copy|move|copy|move|"
1972  "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
1973def note_nontrivial_objc_ownership : Note<
1974  "because type %0 has a member with %select{no|no|__strong|__weak|"
1975  "__autoreleasing}1 ownership">;
1976
1977/// Selector for a TagTypeKind value.
1978def select_tag_type_kind : TextSubstitution<
1979  "%select{struct|interface|union|class|enum}0">;
1980
1981def err_static_data_member_not_allowed_in_anon_struct : Error<
1982  "static data member %0 not allowed in anonymous "
1983  "%sub{select_tag_type_kind}1">;
1984def ext_static_data_member_in_union : ExtWarn<
1985  "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
1986def warn_cxx98_compat_static_data_member_in_union : Warning<
1987  "static data member %0 in union is incompatible with C++98">,
1988  InGroup<CXX98Compat>, DefaultIgnore;
1989def ext_union_member_of_reference_type : ExtWarn<
1990  "union member %0 has reference type %1, which is a Microsoft extension">,
1991  InGroup<MicrosoftUnionMemberReference>;
1992def err_union_member_of_reference_type : Error<
1993  "union member %0 has reference type %1">;
1994def ext_anonymous_struct_union_qualified : Extension<
1995  "anonymous %select{struct|union}0 cannot be '%1'">;
1996def err_different_return_type_for_overriding_virtual_function : Error<
1997  "virtual function %0 has a different return type "
1998  "%diff{($) than the function it overrides (which has return type $)|"
1999  "than the function it overrides}1,2">;
2000def note_overridden_virtual_function : Note<
2001  "overridden virtual function is here">;
2002def err_conflicting_overriding_cc_attributes : Error<
2003  "virtual function %0 has different calling convention attributes "
2004  "%diff{($) than the function it overrides (which has calling convention $)|"
2005  "than the function it overrides}1,2">;
2006def warn_overriding_method_missing_noescape : Warning<
2007  "parameter of overriding method should be annotated with "
2008  "__attribute__((noescape))">, InGroup<MissingNoEscape>;
2009def note_overridden_marked_noescape : Note<
2010  "parameter of overridden method is annotated with __attribute__((noescape))">;
2011def note_cat_conform_to_noescape_prot : Note<
2012  "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
2013
2014def err_covariant_return_inaccessible_base : Error<
2015  "invalid covariant return for virtual function: %1 is a "
2016  "%select{private|protected}2 base class of %0">, AccessControl;
2017def err_covariant_return_ambiguous_derived_to_base_conv : Error<
2018  "return type of virtual function %3 is not covariant with the return type of "
2019  "the function it overrides (ambiguous conversion from derived class "
2020  "%0 to base class %1:%2)">;
2021def err_covariant_return_not_derived : Error<
2022  "return type of virtual function %0 is not covariant with the return type of "
2023  "the function it overrides (%1 is not derived from %2)">;
2024def err_covariant_return_incomplete : Error<
2025  "return type of virtual function %0 is not covariant with the return type of "
2026  "the function it overrides (%1 is incomplete)">;
2027def err_covariant_return_type_different_qualifications : Error<
2028  "return type of virtual function %0 is not covariant with the return type of "
2029  "the function it overrides (%1 has different qualifiers than %2)">;
2030def err_covariant_return_type_class_type_more_qualified : Error<
2031  "return type of virtual function %0 is not covariant with the return type of "
2032  "the function it overrides (class type %1 is more qualified than class "
2033  "type %2">;
2034
2035// C++ implicit special member functions
2036def note_in_declaration_of_implicit_special_member : Note<
2037  "while declaring the implicit %sub{select_special_member_kind}1"
2038  " for %0">;
2039
2040// C++ constructors
2041def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
2042def err_invalid_qualified_constructor : Error<
2043  "'%0' qualifier is not allowed on a constructor">;
2044def err_ref_qualifier_constructor : Error<
2045  "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
2046
2047def err_constructor_return_type : Error<
2048  "constructor cannot have a return type">;
2049def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
2050def err_constructor_byvalue_arg : Error<
2051  "copy constructor must pass its first argument by reference">;
2052def warn_no_constructor_for_refconst : Warning<
2053  "%select{struct|interface|union|class|enum}0 %1 does not declare any "
2054  "constructor to initialize its non-modifiable members">;
2055def note_refconst_member_not_initialized : Note<
2056  "%select{const|reference}0 member %1 will never be initialized">;
2057def ext_ms_explicit_constructor_call : ExtWarn<
2058  "explicit constructor calls are a Microsoft extension">,
2059  InGroup<MicrosoftExplicitConstructorCall>;
2060
2061// C++ destructors
2062def err_destructor_not_member : Error<
2063  "destructor must be a non-static member function">;
2064def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
2065def err_invalid_qualified_destructor : Error<
2066  "'%0' qualifier is not allowed on a destructor">;
2067def err_ref_qualifier_destructor : Error<
2068  "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
2069def err_destructor_return_type : Error<"destructor cannot have a return type">;
2070def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
2071def err_destructor_with_params : Error<"destructor cannot have any parameters">;
2072def err_destructor_variadic : Error<"destructor cannot be variadic">;
2073def ext_destructor_typedef_name : ExtWarn<
2074  "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
2075  "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
2076def err_undeclared_destructor_name : Error<
2077  "undeclared identifier %0 in destructor name">;
2078def err_destructor_name : Error<
2079  "expected the class name after '~' to name the enclosing class">;
2080def err_destructor_name_nontype : Error<
2081  "identifier %0 after '~' in destructor name does not name a type">;
2082def err_destructor_expr_mismatch : Error<
2083  "identifier %0 in object destruction expression does not name the type "
2084  "%1 of the object being destroyed">;
2085def err_destructor_expr_nontype : Error<
2086  "identifier %0 in object destruction expression does not name a type">;
2087def err_destructor_expr_type_mismatch : Error<
2088  "destructor type %0 in object destruction expression does not match the "
2089  "type %1 of the object being destroyed">;
2090def note_destructor_type_here : Note<
2091  "type %0 found by destructor name lookup">;
2092def note_destructor_nontype_here : Note<
2093  "non-type declaration found by destructor name lookup">;
2094def ext_dtor_named_in_wrong_scope : Extension<
2095  "ISO C++ requires the name after '::~' to be found in the same scope as "
2096  "the name before '::~'">, InGroup<DtorName>;
2097def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
2098  "qualified destructor name only found in lexical scope; omit the qualifier "
2099  "to find this type name by unqualified lookup">, InGroup<DtorName>;
2100def ext_dtor_name_ambiguous : Extension<
2101  "ISO C++ considers this destructor name lookup to be ambiguous">,
2102  InGroup<DtorName>;
2103
2104def err_destroy_attr_on_non_static_var : Error<
2105  "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
2106  " variable with static or thread storage duration">;
2107
2108def err_destructor_template : Error<
2109  "destructor cannot be declared as a template">;
2110
2111// C++ initialization
2112def err_init_conversion_failed : Error<
2113  "cannot initialize %select{a variable|a parameter|template parameter|"
2114  "return object|statement expression result|an "
2115  "exception object|a member subobject|an array element|a new value|a value|a "
2116  "base class|a constructor delegation|a vector element|a block element|a "
2117  "block element|a complex element|a lambda capture|a compound literal "
2118  "initializer|a related result|a parameter of CF audited function}0 "
2119  "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2120  "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2121  "%select{|: different classes%diff{ ($ vs $)|}5,6"
2122  "|: different number of parameters (%5 vs %6)"
2123  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2124  "|: different return type%diff{ ($ vs $)|}5,6"
2125  "|: different qualifiers (%5 vs %6)"
2126  "|: different exception specifications}4">;
2127def note_forward_class_conversion : Note<"%0 is not defined, but forward "
2128  "declared here; conversion would be valid if it was derived from %1">;
2129
2130def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2131  "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2132def err_lvalue_reference_bind_to_initlist : Error<
2133  "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2134  "initializer list temporary">;
2135def err_lvalue_reference_bind_to_temporary : Error<
2136  "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2137  "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2138def err_lvalue_reference_bind_to_unrelated : Error<
2139  "%select{non-const|volatile}0 lvalue reference "
2140  "%diff{to type $ cannot bind to a value of unrelated type $|"
2141  "cannot bind to a value of unrelated type}1,2">;
2142def err_reference_bind_drops_quals : Error<
2143  "binding reference %diff{of type $ to value of type $|to value}0,1 "
2144  "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2145  "not permitted due to incompatible qualifiers}2">;
2146def err_reference_bind_failed : Error<
2147  "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2148  "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2149  "incompatible type}0,3">;
2150def err_reference_bind_temporary_addrspace : Error<
2151  "reference of type %0 cannot bind to a temporary object because of "
2152  "address space mismatch">;
2153def err_reference_bind_init_list : Error<
2154  "reference to type %0 cannot bind to an initializer list">;
2155def err_init_list_bad_dest_type : Error<
2156  "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2157  "list">;
2158def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2159  "aggregate initialization of type %0 with user-declared constructors "
2160  "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2161
2162def err_reference_bind_to_bitfield : Error<
2163  "%select{non-const|volatile}0 reference cannot bind to "
2164  "bit-field%select{| %1}2">;
2165def err_reference_bind_to_vector_element : Error<
2166  "%select{non-const|volatile}0 reference cannot bind to vector element">;
2167def err_reference_bind_to_matrix_element : Error<
2168  "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2169def err_reference_var_requires_init : Error<
2170  "declaration of reference variable %0 requires an initializer">;
2171def err_reference_without_init : Error<
2172  "reference to type %0 requires an initializer">;
2173def note_value_initialization_here : Note<
2174  "in value-initialization of type %0 here">;
2175def err_reference_has_multiple_inits : Error<
2176  "reference cannot be initialized with multiple values">;
2177def err_init_non_aggr_init_list : Error<
2178  "initialization of non-aggregate type %0 with an initializer list">;
2179def err_init_reference_member_uninitialized : Error<
2180  "reference member of type %0 uninitialized">;
2181def note_uninit_reference_member : Note<
2182  "uninitialized reference member is here">;
2183def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2184  InGroup<Uninitialized>;
2185def warn_base_class_is_uninit : Warning<
2186  "base class %0 is uninitialized when used here to access %q1">,
2187  InGroup<Uninitialized>;
2188def warn_reference_field_is_uninit : Warning<
2189  "reference %0 is not yet bound to a value when used here">,
2190  InGroup<Uninitialized>;
2191def note_uninit_in_this_constructor : Note<
2192  "during field initialization in %select{this|the implicit default}0 "
2193  "constructor">;
2194def warn_static_self_reference_in_init : Warning<
2195  "static variable %0 is suspiciously used within its own initialization">,
2196  InGroup<UninitializedStaticSelfInit>;
2197def warn_uninit_self_reference_in_init : Warning<
2198  "variable %0 is uninitialized when used within its own initialization">,
2199  InGroup<Uninitialized>;
2200def warn_uninit_self_reference_in_reference_init : Warning<
2201  "reference %0 is not yet bound to a value when used within its own"
2202  " initialization">,
2203  InGroup<Uninitialized>;
2204def warn_uninit_var : Warning<
2205  "variable %0 is uninitialized when %select{used here|captured by block}1">,
2206  InGroup<Uninitialized>, DefaultIgnore;
2207def warn_sometimes_uninit_var : Warning<
2208  "variable %0 is %select{used|captured}1 uninitialized whenever "
2209  "%select{'%3' condition is %select{true|false}4|"
2210  "'%3' loop %select{is entered|exits because its condition is false}4|"
2211  "'%3' loop %select{condition is true|exits because its condition is false}4|"
2212  "switch %3 is taken|"
2213  "its declaration is reached|"
2214  "%3 is called}2">,
2215  InGroup<UninitializedSometimes>, DefaultIgnore;
2216def warn_maybe_uninit_var : Warning<
2217  "variable %0 may be uninitialized when "
2218  "%select{used here|captured by block}1">,
2219  InGroup<UninitializedMaybe>, DefaultIgnore;
2220def note_var_declared_here : Note<"variable %0 is declared here">;
2221def note_uninit_var_use : Note<
2222  "%select{uninitialized use occurs|variable is captured by block}0 here">;
2223def warn_uninit_byref_blockvar_captured_by_block : Warning<
2224  "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2225  "block">, InGroup<Uninitialized>, DefaultIgnore;
2226def note_block_var_fixit_add_initialization : Note<
2227  "did you mean to use __block %0?">;
2228def note_in_omitted_aggregate_initializer : Note<
2229  "in implicit initialization of %select{"
2230  "array element %1 with omitted initializer|"
2231  "field %1 with omitted initializer|"
2232  "trailing array elements in runtime-sized array new}0">;
2233def note_in_reference_temporary_list_initializer : Note<
2234  "in initialization of temporary of type %0 created to "
2235  "list-initialize this reference">;
2236def note_var_fixit_add_initialization : Note<
2237  "initialize the variable %0 to silence this warning">;
2238def note_uninit_fixit_remove_cond : Note<
2239  "remove the %select{'%1' if its condition|condition if it}0 "
2240  "is always %select{false|true}2">;
2241def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2242def err_list_init_in_parens : Error<
2243  "cannot initialize %select{non-class|reference}0 type %1 with a "
2244  "parenthesized initializer list">;
2245
2246def warn_uninit_const_reference : Warning<
2247  "variable %0 is uninitialized when passed as a const reference argument "
2248  "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2249
2250def warn_unsequenced_mod_mod : Warning<
2251  "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2252def warn_unsequenced_mod_use : Warning<
2253  "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2254
2255def select_initialized_entity_kind : TextSubstitution<
2256  "%select{copying variable|copying parameter|initializing template parameter|"
2257  "returning object|initializing statement expression result|"
2258  "throwing object|copying member subobject|copying array element|"
2259  "allocating object|copying temporary|initializing base subobject|"
2260  "initializing vector element|capturing value}0">;
2261
2262def err_temp_copy_no_viable : Error<
2263  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2264def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2265  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2266  "C++98 requires a copy constructor when binding a reference to a temporary">,
2267  InGroup<BindToTemporaryCopy>;
2268def err_temp_copy_ambiguous : Error<
2269  "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2270  "of type %1">;
2271def err_temp_copy_deleted : Error<
2272  "%sub{select_initialized_entity_kind}0 of type %1 "
2273  "invokes deleted constructor">;
2274def err_temp_copy_incomplete : Error<
2275  "copying a temporary object of incomplete type %0">;
2276def warn_cxx98_compat_temp_copy : Warning<
2277  "%sub{select_initialized_entity_kind}1 "
2278  "of type %2 when binding a reference to a temporary would %select{invoke "
2279  "an inaccessible constructor|find no viable constructor|find ambiguous "
2280  "constructors|invoke a deleted constructor}0 in C++98">,
2281  InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2282def err_selected_explicit_constructor : Error<
2283  "chosen constructor is explicit in copy-initialization">;
2284def note_explicit_ctor_deduction_guide_here : Note<
2285  "explicit %select{constructor|deduction guide}0 declared here">;
2286
2287// C++11 decltype
2288def err_decltype_in_declarator : Error<
2289    "'decltype' cannot be used to name a declaration">;
2290
2291// C++11 auto
2292def warn_cxx98_compat_auto_type_specifier : Warning<
2293  "'auto' type specifier is incompatible with C++98">,
2294  InGroup<CXX98Compat>, DefaultIgnore;
2295def err_auto_variable_cannot_appear_in_own_initializer : Error<
2296  "variable %0 declared with deduced type %1 "
2297  "cannot appear in its own initializer">;
2298def err_binding_cannot_appear_in_own_initializer : Error<
2299  "binding %0 cannot appear in the initializer of its own "
2300  "decomposition declaration">;
2301def err_illegal_decl_array_of_auto : Error<
2302  "'%0' declared as array of %1">;
2303def err_new_array_of_auto : Error<
2304  "cannot allocate array of 'auto'">;
2305def err_auto_not_allowed : Error<
2306  "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2307  "use of "
2308  "%select{class template|function template|variable template|alias template|"
2309  "template template parameter|concept|template}2 %3 requires template "
2310  "arguments; argument deduction}0 not allowed "
2311  "%select{in function prototype"
2312  "|in non-static struct member|in struct member"
2313  "|in non-static union member|in union member"
2314  "|in non-static class member|in interface member"
2315  "|in exception declaration|in template parameter until C++17|in block literal"
2316  "|in template argument|in typedef|in type alias|in function return type"
2317  "|in conversion function type|here|in lambda parameter"
2318  "|in type allocated by 'new'|in K&R-style function parameter"
2319  "|in template parameter|in friend declaration|in function prototype that is "
2320  "not a function declaration|in requires expression parameter}1">;
2321def err_dependent_deduced_tst : Error<
2322  "typename specifier refers to "
2323  "%select{class template|function template|variable template|alias template|"
2324  "template template parameter|template}0 member in %1; "
2325  "argument deduction not allowed here">;
2326def err_deduced_tst : Error<
2327  "typename specifier refers to "
2328  "%select{class template|function template|variable template|alias template|"
2329  "template template parameter|template}0; argument deduction not allowed "
2330  "here">;
2331def err_auto_not_allowed_var_inst : Error<
2332  "'auto' variable template instantiation is not allowed">;
2333def err_auto_var_requires_init : Error<
2334  "declaration of variable %0 with deduced type %1 requires an initializer">;
2335def err_auto_new_requires_ctor_arg : Error<
2336  "new expression for type %0 requires a constructor argument">;
2337def ext_auto_new_list_init : Extension<
2338  "ISO C++ standards before C++17 do not allow new expression for "
2339  "type %0 to use list-initialization">, InGroup<CXX17>;
2340def err_auto_var_init_no_expression : Error<
2341  "initializer for variable %0 with type %1 is empty">;
2342def err_auto_expr_init_no_expression : Error<
2343  "initializer for functional-style cast to %0 is empty">;
2344def err_auto_var_init_multiple_expressions : Error<
2345  "initializer for variable %0 with type %1 contains multiple expressions">;
2346def err_auto_expr_init_multiple_expressions : Error<
2347  "initializer for functional-style cast to %0 contains multiple expressions">;
2348def err_auto_var_init_paren_braces : Error<
2349  "cannot deduce type for variable %1 with type %2 from "
2350  "%select{parenthesized|nested}0 initializer list">;
2351def err_auto_new_ctor_multiple_expressions : Error<
2352  "new expression for type %0 contains multiple constructor arguments">;
2353def err_auto_expr_init_paren_braces : Error<
2354  "cannot deduce actual type for %1 from "
2355  "%select{parenthesized|nested}0 initializer list">;
2356def warn_cxx20_compat_auto_expr : Warning<
2357  "'auto' as a functional-style cast is incompatible with C++ standards "
2358  "before C++2b">, InGroup<CXXPre2bCompat>, DefaultIgnore;
2359def err_auto_missing_trailing_return : Error<
2360  "'auto' return without trailing return type; deduced return types are a "
2361  "C++14 extension">;
2362def err_deduced_return_type : Error<
2363  "deduced return types are a C++14 extension">;
2364def err_trailing_return_without_auto : Error<
2365  "function with trailing return type must specify return type 'auto', not %0">;
2366def err_trailing_return_in_parens : Error<
2367  "trailing return type may not be nested within parentheses">;
2368def err_auto_var_deduction_failure : Error<
2369  "variable %0 with type %1 has incompatible initializer of type %2">;
2370def err_auto_var_deduction_failure_from_init_list : Error<
2371  "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2372def err_auto_expr_deduction_failure : Error<
2373  "functional-style cast to %0 has incompatible initializer of type %1">;
2374def err_auto_new_deduction_failure : Error<
2375  "new expression for type %0 has incompatible constructor argument of type %1">;
2376def err_auto_inconsistent_deduction : Error<
2377  "deduced conflicting types %diff{($ vs $) |}0,1"
2378  "for initializer list element type">;
2379def err_auto_different_deductions : Error<
2380  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2381  "deduced as %1 in declaration of %2 and "
2382  "deduced as %3 in declaration of %4">;
2383def err_auto_non_deduced_not_alone : Error<
2384  "%select{function with deduced return type|"
2385  "declaration with trailing return type}0 "
2386  "must be the only declaration in its group">;
2387def err_implied_std_initializer_list_not_found : Error<
2388  "cannot deduce type of initializer list because std::initializer_list was "
2389  "not found; include <initializer_list>">;
2390def err_malformed_std_initializer_list : Error<
2391  "std::initializer_list must be a class template with a single type parameter">;
2392def err_auto_init_list_from_c : Error<
2393  "cannot use __auto_type with initializer list in C">;
2394def err_auto_bitfield : Error<
2395  "cannot pass bit-field as __auto_type initializer in C">;
2396
2397// C++1y decltype(auto) type
2398def err_decltype_auto_invalid : Error<
2399  "'decltype(auto)' not allowed here">;
2400def err_decltype_auto_cannot_be_combined : Error<
2401  "'decltype(auto)' cannot be combined with other type specifiers">;
2402def err_decltype_auto_function_declarator_not_declaration : Error<
2403  "'decltype(auto)' can only be used as a return type "
2404  "in a function declaration">;
2405def err_decltype_auto_compound_type : Error<
2406  "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2407def err_decltype_auto_initializer_list : Error<
2408  "cannot deduce 'decltype(auto)' from initializer list">;
2409
2410// C++17 deduced class template specialization types
2411def err_deduced_class_template_compound_type : Error<
2412  "cannot %select{form pointer to|form reference to|form array of|"
2413  "form function returning|use parentheses when declaring variable with}0 "
2414  "deduced class template specialization type">;
2415def err_deduced_non_class_template_specialization_type : Error<
2416  "%select{<error>|function template|variable template|alias template|"
2417  "template template parameter|concept|template}0 %1 requires template "
2418  "arguments; argument deduction only allowed for class templates">;
2419def err_deduced_class_template_ctor_ambiguous : Error<
2420  "ambiguous deduction for template arguments of %0">;
2421def err_deduced_class_template_ctor_no_viable : Error<
2422  "no viable constructor or deduction guide for deduction of "
2423  "template arguments of %0">;
2424def err_deduced_class_template_incomplete : Error<
2425  "template %0 has no definition and no %select{|viable }1deduction guides "
2426  "for deduction of template arguments">;
2427def err_deduced_class_template_deleted : Error<
2428  "class template argument deduction for %0 selected a deleted constructor">;
2429def err_deduced_class_template_explicit : Error<
2430  "class template argument deduction for %0 selected an explicit "
2431  "%select{constructor|deduction guide}1 for copy-list-initialization">;
2432def err_deduction_guide_no_trailing_return_type : Error<
2433  "deduction guide declaration without trailing return type">;
2434def err_deduction_guide_bad_trailing_return_type : Error<
2435  "deduced type %1 of deduction guide is not %select{|written as }2"
2436  "a specialization of template %0">;
2437def err_deduction_guide_with_complex_decl : Error<
2438  "cannot specify any part of a return type in the "
2439  "declaration of a deduction guide">;
2440def err_deduction_guide_invalid_specifier : Error<
2441  "deduction guide cannot be declared '%0'">;
2442def err_deduction_guide_name_not_class_template : Error<
2443  "cannot specify deduction guide for "
2444  "%select{<error>|function template|variable template|alias template|"
2445  "template template parameter|concept|dependent template name}0 %1">;
2446def err_deduction_guide_wrong_scope : Error<
2447  "deduction guide must be declared in the same scope as template %q0">;
2448def err_deduction_guide_defines_function : Error<
2449  "deduction guide cannot have a function definition">;
2450def err_deduction_guide_redeclared : Error<
2451  "redeclaration of deduction guide">;
2452def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2453  "%select{explicitly instantiated|explicitly specialized}0">;
2454def err_deduction_guide_template_not_deducible : Error<
2455  "deduction guide template contains "
2456  "%select{a template parameter|template parameters}0 that cannot be "
2457  "deduced">;
2458def err_deduction_guide_wrong_access : Error<
2459  "deduction guide has different access from the corresponding "
2460  "member template">;
2461def note_deduction_guide_template_access : Note<
2462  "member template declared %0 here">;
2463def note_deduction_guide_access : Note<
2464  "deduction guide declared %0 by intervening access specifier">;
2465def warn_cxx14_compat_class_template_argument_deduction : Warning<
2466  "class template argument deduction is incompatible with C++ standards "
2467  "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2468  InGroup<CXXPre17Compat>, DefaultIgnore;
2469def warn_ctad_maybe_unsupported : Warning<
2470  "%0 may not intend to support class template argument deduction">,
2471  InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2472def note_suppress_ctad_maybe_unsupported : Note<
2473  "add a deduction guide to suppress this warning">;
2474
2475
2476// C++14 deduced return types
2477def err_auto_fn_deduction_failure : Error<
2478  "cannot deduce return type %0 from returned value of type %1">;
2479def err_auto_fn_different_deductions : Error<
2480  "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2481  "deduced as %2 in earlier return statement">;
2482def err_auto_fn_used_before_defined : Error<
2483  "function %0 with deduced return type cannot be used before it is defined">;
2484def err_auto_fn_no_return_but_not_auto : Error<
2485  "cannot deduce return type %0 for function with no return statements">;
2486def err_auto_fn_return_void_but_not_auto : Error<
2487  "cannot deduce return type %0 from omitted return expression">;
2488def err_auto_fn_return_init_list : Error<
2489  "cannot deduce return type from initializer list">;
2490def err_auto_fn_virtual : Error<
2491  "function with deduced return type cannot be virtual">;
2492def warn_cxx11_compat_deduced_return_type : Warning<
2493  "return type deduction is incompatible with C++ standards before C++14">,
2494  InGroup<CXXPre14Compat>, DefaultIgnore;
2495
2496// C++11 override control
2497def override_keyword_only_allowed_on_virtual_member_functions : Error<
2498  "only virtual member functions can be marked '%0'">;
2499def override_keyword_hides_virtual_member_function : Error<
2500  "non-virtual member function marked '%0' hides virtual member "
2501  "%select{function|functions}1">;
2502def err_function_marked_override_not_overriding : Error<
2503  "%0 marked 'override' but does not override any member functions">;
2504def warn_destructor_marked_not_override_overriding : TextSubstitution <
2505  "%0 overrides a destructor but is not marked 'override'">;
2506def warn_function_marked_not_override_overriding : TextSubstitution <
2507  "%0 overrides a member function but is not marked 'override'">;
2508def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2509  "%sub{warn_destructor_marked_not_override_overriding}0">,
2510  InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2511def warn_inconsistent_function_marked_not_override_overriding : Warning <
2512  "%sub{warn_function_marked_not_override_overriding}0">,
2513  InGroup<CXX11WarnInconsistentOverrideMethod>;
2514def warn_suggest_destructor_marked_not_override_overriding : Warning <
2515  "%sub{warn_destructor_marked_not_override_overriding}0">,
2516  InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2517def warn_suggest_function_marked_not_override_overriding : Warning <
2518  "%sub{warn_function_marked_not_override_overriding}0">,
2519  InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2520def err_class_marked_final_used_as_base : Error<
2521  "base %0 is marked '%select{final|sealed}1'">;
2522def warn_abstract_final_class : Warning<
2523  "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2524def warn_final_dtor_non_final_class : Warning<
2525  "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2526  InGroup<FinalDtorNonFinalClass>;
2527def note_final_dtor_non_final_class_silence : Note<
2528  "mark %0 as '%select{final|sealed}1' to silence this warning">;
2529
2530// C++11 attributes
2531def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2532
2533// C++11 final
2534def err_final_function_overridden : Error<
2535  "declaration of %0 overrides a '%select{final|sealed}1' function">;
2536
2537// C++11 scoped enumerations
2538def err_enum_invalid_underlying : Error<
2539  "non-integral type %0 is an invalid underlying type">;
2540def err_enumerator_too_large : Error<
2541  "enumerator value is not representable in the underlying type %0">;
2542def ext_enumerator_too_large : Extension<
2543  "enumerator value is not representable in the underlying type %0">,
2544  InGroup<MicrosoftEnumValue>;
2545def err_enumerator_wrapped : Error<
2546  "enumerator value %0 is not representable in the underlying type %1">;
2547def err_enum_redeclare_type_mismatch : Error<
2548  "enumeration redeclared with different underlying type %0 (was %1)">;
2549def err_enum_redeclare_fixed_mismatch : Error<
2550  "enumeration previously declared with %select{non|}0fixed underlying type">;
2551def err_enum_redeclare_scoped_mismatch : Error<
2552  "enumeration previously declared as %select{un|}0scoped">;
2553def err_only_enums_have_underlying_types : Error<
2554  "only enumeration types have underlying types">;
2555def err_underlying_type_of_incomplete_enum : Error<
2556  "cannot determine underlying type of incomplete enumeration type %0">;
2557
2558// C++11 delegating constructors
2559def err_delegating_ctor : Error<
2560  "delegating constructors are permitted only in C++11">;
2561def warn_cxx98_compat_delegating_ctor : Warning<
2562  "delegating constructors are incompatible with C++98">,
2563  InGroup<CXX98Compat>, DefaultIgnore;
2564def err_delegating_initializer_alone : Error<
2565  "an initializer for a delegating constructor must appear alone">;
2566def warn_delegating_ctor_cycle : Warning<
2567  "constructor for %0 creates a delegation cycle">, DefaultError,
2568  InGroup<DelegatingCtorCycles>;
2569def note_it_delegates_to : Note<"it delegates to">;
2570def note_which_delegates_to : Note<"which delegates to">;
2571
2572// C++11 range-based for loop
2573def err_for_range_decl_must_be_var : Error<
2574  "for range declaration must declare a variable">;
2575def err_for_range_storage_class : Error<
2576  "loop variable %0 may not be declared %select{'extern'|'static'|"
2577  "'__private_extern__'|'auto'|'register'|'constexpr'|'thread_local'}1">;
2578def err_type_defined_in_for_range : Error<
2579  "types may not be defined in a for range declaration">;
2580def err_for_range_deduction_failure : Error<
2581  "cannot use type %0 as a range">;
2582def err_for_range_incomplete_type : Error<
2583  "cannot use incomplete type %0 as a range">;
2584def err_for_range_iter_deduction_failure : Error<
2585  "cannot use type %0 as an iterator">;
2586def ext_for_range_begin_end_types_differ : ExtWarn<
2587  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2588  InGroup<CXX17>;
2589def warn_for_range_begin_end_types_differ : Warning<
2590  "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2591  "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2592def note_in_for_range: Note<
2593  "when looking up '%select{begin|end}0' function for range expression "
2594  "of type %1">;
2595def err_for_range_invalid: Error<
2596  "invalid range expression of type %0; no viable '%select{begin|end}1' "
2597  "function available">;
2598def note_for_range_member_begin_end_ignored : Note<
2599  "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2600def err_range_on_array_parameter : Error<
2601  "cannot build range expression with array function parameter %0 since "
2602  "parameter with array type %1 is treated as pointer type %2">;
2603def err_for_range_dereference : Error<
2604  "invalid range expression of type %0; did you mean to dereference it "
2605  "with '*'?">;
2606def note_for_range_invalid_iterator : Note <
2607  "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2608def note_for_range_begin_end : Note<
2609  "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2610def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2611  "loop variable %0 "
2612  "%diff{of type $ binds to a temporary constructed from type $"
2613  "|binds to a temporary constructed from a different type}1,2">,
2614  InGroup<RangeLoopConstruct>, DefaultIgnore;
2615def note_use_type_or_non_reference : Note<
2616  "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2617def warn_for_range_ref_binds_ret_temp : Warning<
2618  "loop variable %0 binds to a temporary value produced by a range of type %1">,
2619  InGroup<RangeLoopBindReference>, DefaultIgnore;
2620def note_use_non_reference_type : Note<"use non-reference type %0">;
2621def warn_for_range_copy : Warning<
2622  "loop variable %0 creates a copy from type %1">,
2623  InGroup<RangeLoopConstruct>, DefaultIgnore;
2624def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2625def err_objc_for_range_init_stmt : Error<
2626  "initialization statement is not supported when iterating over Objective-C "
2627  "collection">;
2628
2629// C++11 constexpr
2630def warn_cxx98_compat_constexpr : Warning<
2631  "'constexpr' specifier is incompatible with C++98">,
2632  InGroup<CXX98Compat>, DefaultIgnore;
2633// FIXME: Maybe this should also go in -Wc++14-compat?
2634def warn_cxx14_compat_constexpr_not_const : Warning<
2635  "'constexpr' non-static member function will not be implicitly 'const' "
2636  "in C++14; add 'const' to avoid a change in behavior">,
2637  InGroup<DiagGroup<"constexpr-not-const">>;
2638def err_invalid_consteval_take_address : Error<
2639  "cannot take address of consteval function %0 outside"
2640  " of an immediate invocation">;
2641def err_invalid_consteval_call : Error<
2642  "call to consteval function %q0 is not a constant expression">;
2643def err_invalid_consteval_decl_kind : Error<
2644  "%0 cannot be declared consteval">;
2645def err_invalid_constexpr : Error<
2646  "%select{function parameter|typedef}0 "
2647  "cannot be %sub{select_constexpr_spec_kind}1">;
2648def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2649  "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2650def err_constexpr_tag : Error<
2651  "%select{class|struct|interface|union|enum}0 "
2652  "cannot be marked %sub{select_constexpr_spec_kind}1">;
2653def err_constexpr_dtor : Error<
2654  "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2655def err_constexpr_dtor_subobject : Error<
2656  "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2657  "%select{data member %2|base class %3}1 does not have a "
2658  "constexpr destructor">;
2659def note_constexpr_dtor_subobject : Note<
2660  "%select{data member %1|base class %2}0 declared here">;
2661def err_constexpr_wrong_decl_kind : Error<
2662  "%sub{select_constexpr_spec_kind}0 can only be used "
2663  "in %select{|variable and function|function|variable}0 declarations">;
2664def err_invalid_constexpr_var_decl : Error<
2665  "constexpr variable declaration must be a definition">;
2666def err_constexpr_static_mem_var_requires_init : Error<
2667  "declaration of constexpr static data member %0 requires an initializer">;
2668def err_constexpr_var_non_literal : Error<
2669  "constexpr variable cannot have non-literal type %0">;
2670def err_constexpr_var_requires_const_init : Error<
2671  "constexpr variable %0 must be initialized by a constant expression">;
2672def err_constexpr_var_requires_const_destruction : Error<
2673  "constexpr variable %0 must have constant destruction">;
2674def err_constexpr_redecl_mismatch : Error<
2675  "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2676  " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2677def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2678def warn_cxx17_compat_constexpr_virtual : Warning<
2679  "virtual constexpr functions are incompatible with "
2680  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2681def err_constexpr_virtual_base : Error<
2682  "constexpr %select{member function|constructor}0 not allowed in "
2683  "%select{struct|interface|class}1 with virtual base "
2684  "%plural{1:class|:classes}2">;
2685def note_non_literal_incomplete : Note<
2686  "incomplete type %0 is not a literal type">;
2687def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2688  "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2689def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2690def err_constexpr_non_literal_return : Error<
2691  "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2692def err_constexpr_non_literal_param : Error<
2693  "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2694  "not a literal type">;
2695def err_constexpr_body_invalid_stmt : Error<
2696  "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2697def ext_constexpr_body_invalid_stmt : ExtWarn<
2698  "use of this statement in a constexpr %select{function|constructor}0 "
2699  "is a C++14 extension">, InGroup<CXX14>;
2700def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2701  "use of this statement in a constexpr %select{function|constructor}0 "
2702  "is incompatible with C++ standards before C++14">,
2703  InGroup<CXXPre14Compat>, DefaultIgnore;
2704def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2705  "use of this statement in a constexpr %select{function|constructor}0 "
2706  "is a C++20 extension">, InGroup<CXX20>;
2707def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2708  "use of this statement in a constexpr %select{function|constructor}0 "
2709  "is incompatible with C++ standards before C++20">,
2710  InGroup<CXXPre20Compat>, DefaultIgnore;
2711def ext_constexpr_body_invalid_stmt_cxx2b : ExtWarn<
2712  "use of this statement in a constexpr %select{function|constructor}0 "
2713  "is a C++2b extension">, InGroup<CXX2b>;
2714def warn_cxx20_compat_constexpr_body_invalid_stmt : Warning<
2715  "use of this statement in a constexpr %select{function|constructor}0 "
2716  "is incompatible with C++ standards before C++2b">,
2717  InGroup<CXXPre2bCompat>, DefaultIgnore;
2718def ext_constexpr_type_definition : ExtWarn<
2719  "type definition in a constexpr %select{function|constructor}0 "
2720  "is a C++14 extension">, InGroup<CXX14>;
2721def warn_cxx11_compat_constexpr_type_definition : Warning<
2722  "type definition in a constexpr %select{function|constructor}0 "
2723  "is incompatible with C++ standards before C++14">,
2724  InGroup<CXXPre14Compat>, DefaultIgnore;
2725def err_constexpr_vla : Error<
2726  "variably-modified type %0 cannot be used in a constexpr "
2727  "%select{function|constructor}1">;
2728def ext_constexpr_local_var : ExtWarn<
2729  "variable declaration in a constexpr %select{function|constructor}0 "
2730  "is a C++14 extension">, InGroup<CXX14>;
2731def warn_cxx11_compat_constexpr_local_var : Warning<
2732  "variable declaration in a constexpr %select{function|constructor}0 "
2733  "is incompatible with C++ standards before C++14">,
2734  InGroup<CXXPre14Compat>, DefaultIgnore;
2735def ext_constexpr_static_var : ExtWarn<
2736  "definition of a %select{static|thread_local}1 variable "
2737  "in a constexpr %select{function|constructor}0 "
2738  "is a C++2b extension">, InGroup<CXX2b>;
2739def warn_cxx20_compat_constexpr_var : Warning<
2740  "definition of a %select{static variable|thread_local variable|variable "
2741  "of non-literal type}1 in a constexpr %select{function|constructor}0 "
2742  "is incompatible with C++ standards before C++2b">,
2743  InGroup<CXXPre2bCompat>, DefaultIgnore;
2744def err_constexpr_local_var_non_literal_type : Error<
2745  "variable of non-literal type %1 cannot be defined in a constexpr "
2746  "%select{function|constructor}0 before C++2b">;
2747def ext_constexpr_local_var_no_init : ExtWarn<
2748  "uninitialized variable in a constexpr %select{function|constructor}0 "
2749  "is a C++20 extension">, InGroup<CXX20>;
2750def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2751  "uninitialized variable in a constexpr %select{function|constructor}0 "
2752  "is incompatible with C++ standards before C++20">,
2753  InGroup<CXXPre20Compat>, DefaultIgnore;
2754def ext_constexpr_function_never_constant_expr : ExtWarn<
2755  "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2756  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2757def err_attr_cond_never_constant_expr : Error<
2758  "%0 attribute expression never produces a constant expression">;
2759def err_diagnose_if_invalid_diagnostic_type : Error<
2760  "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2761  "instead">;
2762def err_constexpr_body_no_return : Error<
2763  "no return statement in %select{constexpr|consteval}0 function">;
2764def err_constexpr_return_missing_expr : Error<
2765  "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2766def warn_cxx11_compat_constexpr_body_no_return : Warning<
2767  "constexpr function with no return statements is incompatible with C++ "
2768  "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2769def ext_constexpr_body_multiple_return : ExtWarn<
2770  "multiple return statements in constexpr function is a C++14 extension">,
2771  InGroup<CXX14>;
2772def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2773  "multiple return statements in constexpr function "
2774  "is incompatible with C++ standards before C++14">,
2775  InGroup<CXXPre14Compat>, DefaultIgnore;
2776def note_constexpr_body_previous_return : Note<
2777  "previous return statement is here">;
2778
2779// C++20 function try blocks in constexpr
2780def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2781  "function try block in constexpr %select{function|constructor}0 is "
2782  "a C++20 extension">, InGroup<CXX20>;
2783def warn_cxx17_compat_constexpr_function_try_block : Warning<
2784  "function try block in constexpr %select{function|constructor}0 is "
2785  "incompatible with C++ standards before C++20">,
2786  InGroup<CXXPre20Compat>, DefaultIgnore;
2787
2788def ext_constexpr_union_ctor_no_init : ExtWarn<
2789  "constexpr union constructor that does not initialize any member "
2790  "is a C++20 extension">, InGroup<CXX20>;
2791def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2792  "constexpr union constructor that does not initialize any member "
2793  "is incompatible with C++ standards before C++20">,
2794  InGroup<CXXPre20Compat>, DefaultIgnore;
2795def ext_constexpr_ctor_missing_init : ExtWarn<
2796  "constexpr constructor that does not initialize all members "
2797  "is a C++20 extension">, InGroup<CXX20>;
2798def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2799  "constexpr constructor that does not initialize all members "
2800  "is incompatible with C++ standards before C++20">,
2801  InGroup<CXXPre20Compat>, DefaultIgnore;
2802def note_constexpr_ctor_missing_init : Note<
2803  "member not initialized by constructor">;
2804def note_non_literal_no_constexpr_ctors : Note<
2805  "%0 is not literal because it is not an aggregate and has no constexpr "
2806  "constructors other than copy or move constructors">;
2807def note_non_literal_base_class : Note<
2808  "%0 is not literal because it has base class %1 of non-literal type">;
2809def note_non_literal_field : Note<
2810  "%0 is not literal because it has data member %1 of "
2811  "%select{non-literal|volatile}3 type %2">;
2812def note_non_literal_user_provided_dtor : Note<
2813  "%0 is not literal because it has a user-provided destructor">;
2814def note_non_literal_nontrivial_dtor : Note<
2815  "%0 is not literal because it has a non-trivial destructor">;
2816def note_non_literal_non_constexpr_dtor : Note<
2817  "%0 is not literal because its destructor is not constexpr">;
2818def note_non_literal_lambda : Note<
2819  "lambda closure types are non-literal types before C++17">;
2820def warn_private_extern : Warning<
2821  "use of __private_extern__ on a declaration may not produce external symbol "
2822  "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2823def note_private_extern : Note<
2824  "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2825
2826// C++ Concepts
2827def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2828  "concept declarations may only appear in global or namespace scope">;
2829def err_concept_no_parameters : Error<
2830  "concept template parameter list must have at least one parameter; explicit "
2831  "specialization of concepts is not allowed">;
2832def err_concept_extra_headers : Error<
2833  "extraneous template parameter list in concept definition">;
2834def err_concept_no_associated_constraints : Error<
2835  "concept cannot have associated constraints">;
2836def err_non_constant_constraint_expression : Error<
2837  "substitution into constraint expression resulted in a non-constant "
2838  "expression">;
2839def err_non_bool_atomic_constraint : Error<
2840  "atomic constraint must be of type 'bool' (found %0)">;
2841def err_template_arg_list_constraints_not_satisfied : Error<
2842  "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2843  "template template parameter|template}0 %1%2">;
2844def note_substituted_constraint_expr_is_ill_formed : Note<
2845  "because substituted constraint expression is ill-formed%0">;
2846def note_atomic_constraint_evaluated_to_false : Note<
2847  "%select{and|because}0 '%1' evaluated to false">;
2848def note_concept_specialization_constraint_evaluated_to_false : Note<
2849  "%select{and|because}0 '%1' evaluated to false">;
2850def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2851  "%select{and|because}0 %1 does not satisfy %2">;
2852def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2853  "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2854def err_constrained_virtual_method : Error<
2855  "virtual function cannot have a requires clause">;
2856def err_trailing_requires_clause_on_deduction_guide : Error<
2857  "deduction guide cannot have a requires clause">;
2858def err_constrained_non_templated_function
2859    : Error<"non-templated function cannot have a requires clause">;
2860def err_reference_to_function_with_unsatisfied_constraints : Error<
2861  "invalid reference to function %0: constraints not satisfied">;
2862def err_requires_expr_local_parameter_default_argument : Error<
2863  "default arguments not allowed for parameters of a requires expression">;
2864def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2865  "constraint variable %0 cannot be used in an evaluated context">;
2866def note_expr_requirement_expr_substitution_error : Note<
2867  "%select{and|because}0 '%1' would be invalid: %2">;
2868def note_expr_requirement_expr_unknown_substitution_error : Note<
2869  "%select{and|because}0 '%1' would be invalid">;
2870def note_expr_requirement_noexcept_not_met : Note<
2871  "%select{and|because}0 '%1' may throw an exception">;
2872def note_expr_requirement_type_requirement_substitution_error : Note<
2873  "%select{and|because}0 '%1' would be invalid: %2">;
2874def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
2875  "%select{and|because}0 '%1' would be invalid">;
2876def note_expr_requirement_constraints_not_satisfied : Note<
2877  "%select{and|because}0 type constraint '%1' was not satisfied:">;
2878def note_expr_requirement_constraints_not_satisfied_simple : Note<
2879  "%select{and|because}0 %1 does not satisfy %2:">;
2880def note_type_requirement_substitution_error : Note<
2881  "%select{and|because}0 '%1' would be invalid: %2">;
2882def note_type_requirement_unknown_substitution_error : Note<
2883  "%select{and|because}0 '%1' would be invalid">;
2884def note_nested_requirement_substitution_error : Note<
2885  "%select{and|because}0 '%1' would be invalid: %2">;
2886def note_nested_requirement_unknown_substitution_error : Note<
2887  "%select{and|because}0 '%1' would be invalid">;
2888def note_ambiguous_atomic_constraints : Note<
2889  "similar constraint expressions not considered equivalent; constraint "
2890  "expressions cannot be considered equivalent unless they originate from the "
2891  "same concept">;
2892def note_ambiguous_atomic_constraints_similar_expression : Note<
2893  "similar constraint expression here">;
2894def err_unsupported_placeholder_constraint : Error<
2895  "constrained placeholder types other than simple 'auto' on non-type template "
2896  "parameters not supported yet">;
2897
2898def err_template_different_requires_clause : Error<
2899  "requires clause differs in template redeclaration">;
2900def err_template_different_type_constraint : Error<
2901  "type constraint differs in template redeclaration">;
2902def err_template_template_parameter_not_at_least_as_constrained : Error<
2903  "template template argument %0 is more constrained than template template "
2904  "parameter %1">;
2905
2906def err_type_constraint_non_type_concept : Error<
2907  "concept named in type constraint is not a type concept">;
2908def err_type_constraint_missing_arguments : Error<
2909  "%0 requires more than 1 template argument; provide the remaining arguments "
2910  "explicitly to use it here">;
2911def err_placeholder_constraints_not_satisfied : Error<
2912  "deduced type %0 does not satisfy %1">;
2913
2914// C++11 char16_t/char32_t
2915def warn_cxx98_compat_unicode_type : Warning<
2916  "'%0' type specifier is incompatible with C++98">,
2917  InGroup<CXX98Compat>, DefaultIgnore;
2918def warn_cxx17_compat_unicode_type : Warning<
2919  "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2920  InGroup<CXXPre20Compat>, DefaultIgnore;
2921
2922// __make_integer_seq
2923def err_integer_sequence_negative_length : Error<
2924  "integer sequences must have non-negative sequence length">;
2925def err_integer_sequence_integral_element_type : Error<
2926  "integer sequences must have integral element type">;
2927
2928// __type_pack_element
2929def err_type_pack_element_out_of_bounds : Error<
2930  "a parameter pack may not be accessed at an out of bounds index">;
2931
2932// Objective-C++
2933def err_objc_decls_may_only_appear_in_global_scope : Error<
2934  "Objective-C declarations may only appear in global scope">;
2935def warn_auto_var_is_id : Warning<
2936  "'auto' deduced as 'id' in declaration of %0">,
2937  InGroup<DiagGroup<"auto-var-id">>;
2938
2939// Attributes
2940def warn_attribute_ignored_no_calls_in_stmt: Warning<
2941  "%0 attribute is ignored because there exists no call expression inside the "
2942  "statement">,
2943  InGroup<IgnoredAttributes>;
2944
2945def warn_function_attribute_ignored_in_stmt : Warning<
2946  "attribute is ignored on this statement as it only applies to functions; "
2947  "use '%0' on statements">,
2948  InGroup<IgnoredAttributes>;
2949
2950def err_musttail_needs_trivial_args : Error<
2951  "tail call requires that the return value, all parameters, and any "
2952  "temporaries created by the expression are trivially destructible">;
2953def err_musttail_needs_call : Error<
2954  "%0 attribute requires that the return value is the result of a function call"
2955  >;
2956def err_musttail_needs_prototype : Error<
2957  "%0 attribute requires that both caller and callee functions have a "
2958  "prototype">;
2959def note_musttail_fix_non_prototype : Note<
2960  "add 'void' to the parameter list to turn an old-style K&R function "
2961  "declaration into a prototype">;
2962def err_musttail_structors_forbidden : Error<"cannot perform a tail call "
2963  "%select{from|to}0 a %select{constructor|destructor}1">;
2964def note_musttail_structors_forbidden : Note<"target "
2965  "%select{constructor|destructor}0 is declared here">;
2966def err_musttail_forbidden_from_this_context : Error<
2967  "%0 attribute cannot be used from "
2968  "%select{a block|an Objective-C function|this context}1">;
2969def err_musttail_member_mismatch : Error<
2970  "%select{non-member|static member|non-static member}0 "
2971  "function cannot perform a tail call to "
2972  "%select{non-member|static member|non-static member|pointer-to-member}1 "
2973  "function%select{| %3}2">;
2974def note_musttail_callee_defined_here : Note<"%0 declared here">;
2975def note_tail_call_required : Note<"tail call required by %0 attribute here">;
2976def err_musttail_mismatch : Error<
2977  "cannot perform a tail call to function%select{| %1}0 because its signature "
2978  "is incompatible with the calling function">;
2979def note_musttail_mismatch : Note<
2980    "target function "
2981    "%select{is a member of different class%diff{ (expected $ but has $)|}1,2"
2982    "|has different number of parameters (expected %1 but has %2)"
2983    "|has type mismatch at %ordinal3 parameter"
2984    "%diff{ (expected $ but has $)|}1,2"
2985    "|has different return type%diff{ ($ expected but has $)|}1,2}0">;
2986def err_musttail_callconv_mismatch : Error<
2987  "cannot perform a tail call to function%select{| %1}0 because it uses an "
2988  "incompatible calling convention">;
2989def note_musttail_callconv_mismatch : Note<
2990  "target function has calling convention %1 (expected %0)">;
2991def err_musttail_scope : Error<
2992  "cannot perform a tail call from this return statement">;
2993def err_musttail_no_variadic : Error<
2994  "%0 attribute may not be used with variadic functions">;
2995
2996def err_nsobject_attribute : Error<
2997  "'NSObject' attribute is for pointer types only">;
2998def err_attributes_are_not_compatible : Error<
2999  "%0 and %1 attributes are not compatible">;
3000def err_attribute_invalid_argument : Error<
3001  "%select{a reference type|an array type|a non-vector or "
3002  "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
3003def err_attribute_wrong_number_arguments : Error<
3004  "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
3005  ":requires exactly %1 arguments}1">;
3006def err_attribute_wrong_number_arguments_for : Error <
3007  "%0 attribute references function %1, which %plural{0:takes no arguments|1:takes one argument|"
3008  ":takes exactly %2 arguments}2">;
3009def err_attribute_bounds_for_function : Error<
3010  "%0 attribute references parameter %1, but the function %2 has only %3 parameters">;
3011def err_attribute_no_member_function : Error<
3012  "%0 attribute cannot be applied to non-static member functions">;
3013def err_attribute_parameter_types : Error<
3014  "%0 attribute parameter types do not match: parameter %1 of function %2 has type %3, "
3015  "but parameter %4 of function %5 has type %6">;
3016
3017def err_attribute_too_many_arguments : Error<
3018  "%0 attribute takes no more than %1 argument%s1">;
3019def err_attribute_too_few_arguments : Error<
3020  "%0 attribute takes at least %1 argument%s1">;
3021def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
3022def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
3023def err_attribute_bad_neon_vector_size : Error<
3024  "Neon vector size must be 64 or 128 bits">;
3025def err_attribute_invalid_sve_type : Error<
3026  "%0 attribute applied to non-SVE type %1">;
3027def err_attribute_bad_sve_vector_size : Error<
3028  "invalid SVE vector size '%0', must match value set by "
3029  "'-msve-vector-bits' ('%1')">;
3030def err_attribute_arm_feature_sve_bits_unsupported : Error<
3031  "%0 is only supported when '-msve-vector-bits=<bits>' is specified with a "
3032  "value of 128, 256, 512, 1024 or 2048.">;
3033def err_attribute_requires_positive_integer : Error<
3034  "%0 attribute requires a %select{positive|non-negative}1 "
3035  "integral compile time constant expression">;
3036def err_attribute_requires_opencl_version : Error<
3037  "attribute %0 is supported in the OpenCL version %1%select{| onwards}2">;
3038def err_invalid_branch_protection_spec : Error<
3039  "invalid or misplaced branch protection specification '%0'">;
3040def warn_unsupported_branch_protection_spec : Warning<
3041  "unsupported branch protection specification '%0'">, InGroup<BranchProtection>;
3042
3043def warn_unsupported_target_attribute
3044    : Warning<"%select{unsupported|duplicate|unknown}0%select{| architecture|"
3045              " tune CPU}1 '%2' in the '%select{target|target_clones}3' "
3046              "attribute string; '%select{target|target_clones}3' "
3047              "attribute ignored">,
3048      InGroup<IgnoredAttributes>;
3049def err_attribute_unsupported
3050    : Error<"%0 attribute is not supported on targets missing %1;"
3051            " specify an appropriate -march= or -mcpu=">;
3052// The err_*_attribute_argument_not_int are separate because they're used by
3053// VerifyIntegerConstantExpression.
3054def err_aligned_attribute_argument_not_int : Error<
3055  "'aligned' attribute requires integer constant">;
3056def err_align_value_attribute_argument_not_int : Error<
3057  "'align_value' attribute requires integer constant">;
3058def err_alignas_attribute_wrong_decl_type : Error<
3059  "%0 attribute cannot be applied to %select{a function parameter|"
3060  "a variable with 'register' storage class|a 'catch' variable|a bit-field|"
3061  "an enumeration}1">;
3062def err_alignas_missing_on_definition : Error<
3063  "%0 must be specified on definition if it is specified on any declaration">;
3064def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
3065def err_alignas_mismatch : Error<
3066  "redeclaration has different alignment requirement (%1 vs %0)">;
3067def err_alignas_underaligned : Error<
3068  "requested alignment is less than minimum alignment of %1 for type %0">;
3069def warn_aligned_attr_underaligned : Warning<err_alignas_underaligned.Text>,
3070  InGroup<IgnoredAttributes>;
3071def err_attribute_sizeless_type : Error<
3072  "%0 attribute cannot be applied to sizeless type %1">;
3073def err_attribute_argument_n_type : Error<
3074  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
3075  "constant|a string|an identifier|a constant expression|a builtin function}2">;
3076def err_attribute_argument_type : Error<
3077  "%0 attribute requires %select{int or bool|an integer "
3078  "constant|a string|an identifier}1">;
3079def err_attribute_argument_out_of_range : Error<
3080  "%0 attribute requires integer constant between %1 and %2 inclusive">;
3081def err_init_priority_object_attr : Error<
3082  "can only use 'init_priority' attribute on file-scope definitions "
3083  "of objects of class type">;
3084def err_attribute_argument_out_of_bounds : Error<
3085  "%0 attribute parameter %1 is out of bounds">;
3086def err_attribute_only_once_per_parameter : Error<
3087  "%0 attribute can only be applied once per parameter">;
3088def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
3089def note_previous_uuid : Note<"previous uuid specified here">;
3090def warn_attribute_pointers_only : Warning<
3091  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
3092  InGroup<IgnoredAttributes>;
3093def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
3094def err_attribute_integers_only : Error<
3095  "%0 attribute argument may only refer to a function parameter of integer "
3096  "type">;
3097def warn_attribute_return_pointers_only : Warning<
3098  "%0 attribute only applies to return values that are pointers">,
3099  InGroup<IgnoredAttributes>;
3100def warn_attribute_return_pointers_refs_only : Warning<
3101  "%0 attribute only applies to return values that are pointers or references">,
3102  InGroup<IgnoredAttributes>;
3103def warn_attribute_pointer_or_reference_only : Warning<
3104  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
3105  InGroup<IgnoredAttributes>;
3106def err_attribute_no_member_pointers : Error<
3107  "%0 attribute cannot be used with pointers to members">;
3108def err_attribute_invalid_implicit_this_argument : Error<
3109  "%0 attribute is invalid for the implicit this argument">;
3110def err_ownership_type : Error<
3111  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
3112def err_ownership_returns_index_mismatch : Error<
3113  "'ownership_returns' attribute index does not match; here it is %0">;
3114def note_ownership_returns_index_mismatch : Note<
3115  "declared with index %0 here">;
3116def err_format_strftime_third_parameter : Error<
3117  "strftime format attribute requires 3rd parameter to be 0">;
3118def err_format_attribute_not : Error<"format argument not a string type">;
3119def err_format_attribute_result_not : Error<"function does not return %0">;
3120def err_format_attribute_implicit_this_format_string : Error<
3121  "format attribute cannot specify the implicit this argument as the format "
3122  "string">;
3123def err_callback_attribute_no_callee : Error<
3124  "'callback' attribute specifies no callback callee">;
3125def err_callback_attribute_invalid_callee : Error<
3126  "'callback' attribute specifies invalid callback callee">;
3127def err_callback_attribute_multiple : Error<
3128  "multiple 'callback' attributes specified">;
3129def err_callback_attribute_argument_unknown : Error<
3130  "'callback' attribute argument %0 is not a known function parameter">;
3131def err_callback_callee_no_function_type : Error<
3132  "'callback' attribute callee does not have function type">;
3133def err_callback_callee_is_variadic : Error<
3134  "'callback' attribute callee may not be variadic">;
3135def err_callback_implicit_this_not_available : Error<
3136  "'callback' argument at position %0 references unavailable implicit 'this'">;
3137def err_init_method_bad_return_type : Error<
3138  "init methods must return an object pointer type, not %0">;
3139def err_attribute_invalid_size : Error<
3140  "vector size not an integral multiple of component size">;
3141def err_attribute_zero_size : Error<"zero %0 size">;
3142def err_attribute_size_too_large : Error<"%0 size too large">;
3143def err_typecheck_sve_ambiguous : Error<
3144  "cannot combine fixed-length and sizeless SVE vectors in expression, result is ambiguous (%0 and %1)">;
3145def err_typecheck_sve_gnu_ambiguous : Error<
3146  "cannot combine GNU and SVE vectors in expression, result is ambiguous (%0 and %1)">;
3147def err_typecheck_vector_not_convertable_implict_truncation : Error<
3148   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
3149   " %2 as implicit conversion would cause truncation">;
3150def err_typecheck_vector_not_convertable : Error<
3151  "cannot convert between vector values of different size (%0 and %1)">;
3152def err_typecheck_vector_not_convertable_non_scalar : Error<
3153  "cannot convert between vector and non-scalar values (%0 and %1)">;
3154def err_typecheck_vector_lengths_not_equal : Error<
3155  "vector operands do not have the same number of elements (%0 and %1)">;
3156def warn_typecheck_vector_element_sizes_not_equal : Warning<
3157  "vector operands do not have the same elements sizes (%0 and %1)">,
3158  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
3159def err_ext_vector_component_exceeds_length : Error<
3160  "vector component access exceeds type %0">;
3161def err_ext_vector_component_name_illegal : Error<
3162  "illegal vector component name '%0'">;
3163def err_attribute_address_space_negative : Error<
3164  "address space is negative">;
3165def err_attribute_address_space_too_high : Error<
3166  "address space is larger than the maximum supported (%0)">;
3167def err_attribute_address_multiple_qualifiers : Error<
3168  "multiple address spaces specified for type">;
3169def warn_attribute_address_multiple_identical_qualifiers : Warning<
3170  "multiple identical address spaces specified for type">,
3171  InGroup<DuplicateDeclSpecifier>;
3172def err_attribute_not_clinkage : Error<
3173  "function type with %0 attribute must have C linkage">;
3174def err_function_decl_cmse_ns_call : Error<
3175  "functions may not be declared with 'cmse_nonsecure_call' attribute">;
3176def err_attribute_address_function_type : Error<
3177  "function type may not be qualified with an address space">;
3178def err_as_qualified_auto_decl : Error<
3179  "automatic variable qualified with an%select{| invalid}0 address space">;
3180def err_arg_with_address_space : Error<
3181  "parameter may not be qualified with an address space">;
3182def err_field_with_address_space : Error<
3183  "field may not be qualified with an address space">;
3184def err_compound_literal_with_address_space : Error<
3185  "compound literal in function scope may not be qualified with an address space">;
3186def err_address_space_mismatch_templ_inst : Error<
3187  "conflicting address space qualifiers are provided between types %0 and %1">;
3188def err_attr_objc_ownership_redundant : Error<
3189  "the type %0 is already explicitly ownership-qualified">;
3190def err_invalid_nsnumber_type : Error<
3191  "%0 is not a valid literal type for NSNumber">;
3192def err_objc_illegal_boxed_expression_type : Error<
3193  "illegal type %0 used in a boxed expression">;
3194def err_objc_non_trivially_copyable_boxed_expression_type : Error<
3195  "non-trivially copyable type %0 cannot be used in a boxed expression">;
3196def err_objc_incomplete_boxed_expression_type : Error<
3197  "incomplete type %0 used in a boxed expression">;
3198def err_undeclared_objc_literal_class : Error<
3199  "definition of class %0 must be available to use Objective-C "
3200  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
3201  "string literals}1">;
3202def err_undeclared_boxing_method : Error<
3203  "declaration of %0 is missing in %1 class">;
3204def err_objc_literal_method_sig : Error<
3205  "literal construction method %0 has incompatible signature">;
3206def note_objc_literal_method_param : Note<
3207  "%select{first|second|third}0 parameter has unexpected type %1 "
3208  "(should be %2)">;
3209def note_objc_literal_method_return : Note<
3210  "method returns unexpected type %0 (should be an object type)">;
3211def err_invalid_collection_element : Error<
3212  "collection element of type %0 is not an Objective-C object">;
3213def err_box_literal_collection : Error<
3214  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3215  "in a collection">;
3216def warn_objc_literal_comparison : Warning<
3217  "direct comparison of %select{an array literal|a dictionary literal|"
3218  "a numeric literal|a boxed expression|}0 has undefined behavior">,
3219  InGroup<ObjCLiteralComparison>;
3220def err_missing_atsign_prefix : Error<
3221  "%select{string|numeric}0 literal must be prefixed by '@'">;
3222def warn_objc_string_literal_comparison : Warning<
3223  "direct comparison of a string literal has undefined behavior">,
3224  InGroup<ObjCStringComparison>;
3225def warn_concatenated_literal_array_init : Warning<
3226  "suspicious concatenation of string literals in an array initialization; "
3227  "did you mean to separate the elements with a comma?">,
3228  InGroup<StringConcatation>, DefaultIgnore;
3229def warn_concatenated_nsarray_literal : Warning<
3230  "concatenated NSString literal for an NSArray expression - "
3231  "possibly missing a comma">,
3232  InGroup<ObjCStringConcatenation>;
3233def note_objc_literal_comparison_isequal : Note<
3234  "use 'isEqual:' instead">;
3235def warn_objc_collection_literal_element : Warning<
3236  "object of type %0 is not compatible with "
3237  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3238  InGroup<ObjCLiteralConversion>;
3239def warn_nsdictionary_duplicate_key : Warning<
3240  "duplicate key in dictionary literal">,
3241  InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3242def note_nsdictionary_duplicate_key_here : Note<
3243  "previous equal key is here">;
3244def err_swift_param_attr_not_swiftcall : Error<
3245  "'%0' parameter can only be used with swiftcall%select{ or swiftasynccall|}1 "
3246  "calling convention%select{|s}1">;
3247def err_swift_indirect_result_not_first : Error<
3248  "'swift_indirect_result' parameters must be first parameters of function">;
3249def err_swift_error_result_not_after_swift_context : Error<
3250  "'swift_error_result' parameter must follow 'swift_context' parameter">;
3251def err_swift_abi_parameter_wrong_type : Error<
3252  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3253  "type here is %2">;
3254
3255def err_attribute_argument_invalid : Error<
3256  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3257  "min must not be greater than max}1">;
3258def err_attribute_argument_is_zero : Error<
3259  "%0 attribute must be greater than 0">;
3260def warn_attribute_argument_n_negative : Warning<
3261  "%0 attribute parameter %1 is negative and will be ignored">,
3262  InGroup<CudaCompat>;
3263def err_property_function_in_objc_container : Error<
3264  "use of Objective-C property in function nested in Objective-C "
3265  "container not supported, move function outside its container">;
3266
3267let CategoryName = "Cocoa API Issue" in {
3268def warn_objc_redundant_literal_use : Warning<
3269  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3270}
3271
3272def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3273  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3274
3275def err_aix_attr_unsupported_tls_model : Error<"TLS model '%0' is not yet supported on AIX">;
3276
3277def err_tls_var_aligned_over_maximum : Error<
3278  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3279  "alignment (%2) for a thread-local variable on this target">;
3280
3281def err_only_annotate_after_access_spec : Error<
3282  "access specifier can only have annotation attributes">;
3283
3284def err_attribute_section_invalid_for_target : Error<
3285  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3286def err_pragma_section_invalid_for_target : Error<
3287  "argument to #pragma section is not valid for this target: %0">;
3288def warn_attribute_section_drectve : Warning<
3289  "#pragma %0(\".drectve\") has undefined behavior, "
3290  "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3291def warn_mismatched_section : Warning<
3292  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3293def warn_attribute_section_on_redeclaration : Warning<
3294  "section attribute is specified on redeclared variable">, InGroup<Section>;
3295def err_mismatched_code_seg_base : Error<
3296  "derived class must specify the same code segment as its base classes">;
3297def err_mismatched_code_seg_override : Error<
3298  "overriding virtual function must specify the same code segment as its overridden function">;
3299def err_conflicting_codeseg_attribute : Error<
3300  "conflicting code segment specifiers">;
3301def warn_duplicate_codeseg_attribute : Warning<
3302  "duplicate code segment specifiers">, InGroup<Section>;
3303
3304def err_anonymous_property: Error<
3305  "anonymous property is not supported">;
3306def err_property_is_variably_modified : Error<
3307  "property %0 has a variably modified type">;
3308def err_no_accessor_for_property : Error<
3309  "no %select{getter|setter}0 defined for property %1">;
3310def err_cannot_find_suitable_accessor : Error<
3311  "cannot find suitable %select{getter|setter}0 for property %1">;
3312
3313def warn_alloca : Warning<
3314  "use of function %0 is discouraged; there is no way to check for failure but "
3315  "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3316  InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3317
3318def warn_alloca_align_alignof : Warning<
3319  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3320  InGroup<DiagGroup<"alloca-with-align-alignof">>;
3321
3322def err_alignment_too_small : Error<
3323  "requested alignment must be %0 or greater">;
3324def err_alignment_too_big : Error<
3325  "requested alignment must be %0 or smaller">;
3326def err_alignment_not_power_of_two : Error<
3327  "requested alignment is not a power of 2">;
3328def warn_alignment_not_power_of_two : Warning<
3329  err_alignment_not_power_of_two.Text>,
3330  InGroup<DiagGroup<"non-power-of-two-alignment">>;
3331def err_alignment_dependent_typedef_name : Error<
3332  "requested alignment is dependent but declaration is not dependent">;
3333
3334def warn_alignment_builtin_useless : Warning<
3335  "%select{aligning a value|the result of checking whether a value is aligned}0"
3336  " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3337def err_attribute_aligned_too_great : Error<
3338  "requested alignment must be %0 bytes or smaller">;
3339def warn_assume_aligned_too_great
3340    : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3341              "alignment assumed">,
3342      InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3343def warn_not_xl_compatible
3344    : Warning<"alignment of 16 bytes for a struct member is not binary "
3345              "compatible with IBM XL C/C++ for AIX 16.1.0 or older">,
3346      InGroup<AIXCompat>;
3347def note_misaligned_member_used_here : Note<
3348    "passing byval argument %0 with potentially incompatible alignment here">;
3349def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3350  "%q0 redeclared without %1 attribute: previous %1 ignored">,
3351  InGroup<MicrosoftInconsistentDllImport>;
3352def warn_redeclaration_without_import_attribute : Warning<
3353  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3354  InGroup<MicrosoftInconsistentDllImport>;
3355def warn_dllimport_dropped_from_inline_function : Warning<
3356  "%q0 redeclared inline; %1 attribute ignored">,
3357  InGroup<IgnoredAttributes>;
3358def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3359  " exception specification; attribute ignored">,
3360  InGroup<IgnoredAttributes>;
3361def warn_attribute_ignored_on_non_definition :
3362  Warning<"%0 attribute ignored on a non-definition declaration">,
3363  InGroup<IgnoredAttributes>;
3364def warn_attribute_ignored_on_inline :
3365  Warning<"%0 attribute ignored on inline function">,
3366  InGroup<IgnoredAttributes>;
3367def warn_nocf_check_attribute_ignored :
3368  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3369  InGroup<IgnoredAttributes>;
3370def warn_attribute_after_definition_ignored : Warning<
3371  "attribute %0 after definition is ignored">,
3372   InGroup<IgnoredAttributes>;
3373def warn_attributes_likelihood_ifstmt_conflict
3374    : Warning<"conflicting attributes %0 are ignored">,
3375      InGroup<IgnoredAttributes>;
3376def warn_cxx11_gnu_attribute_on_type : Warning<
3377  "attribute %0 ignored, because it cannot be applied to a type">,
3378  InGroup<IgnoredAttributes>;
3379def warn_unhandled_ms_attribute_ignored : Warning<
3380  "__declspec attribute %0 is not supported">,
3381  InGroup<IgnoredAttributes>;
3382def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3383  "attribute %0 has no effect when annotating an infinite loop">,
3384   InGroup<IgnoredAttributes>;
3385def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3386  "annotating the infinite loop here">;
3387def warn_attribute_has_no_effect_on_compile_time_if : Warning<
3388  "attribute %0 has no effect when annotating an 'if %select{constexpr|consteval}1' statement">,
3389   InGroup<IgnoredAttributes>;
3390def note_attribute_has_no_effect_on_compile_time_if_here : Note<
3391  "annotating the 'if %select{constexpr|consteval}0' statement here">;
3392def err_decl_attribute_invalid_on_stmt : Error<
3393  "%0 attribute cannot be applied to a statement">;
3394def err_attribute_invalid_on_decl : Error<
3395  "%0 attribute cannot be applied to a declaration">;
3396def warn_type_attribute_deprecated_on_decl : Warning<
3397  "applying attribute %0 to a declaration is deprecated; apply it to the type instead">,
3398  InGroup<DeprecatedAttributes>;
3399def warn_declspec_attribute_ignored : Warning<
3400  "attribute %0 is ignored, place it after "
3401  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
3402  "type declaration">, InGroup<IgnoredAttributes>;
3403def warn_attribute_precede_definition : Warning<
3404  "attribute declaration must precede definition">,
3405  InGroup<IgnoredAttributes>;
3406def warn_attribute_void_function_method : Warning<
3407  "attribute %0 cannot be applied to "
3408  "%select{functions|Objective-C method}1 without return value">,
3409  InGroup<IgnoredAttributes>;
3410def warn_attribute_weak_on_field : Warning<
3411  "__weak attribute cannot be specified on a field declaration">,
3412  InGroup<IgnoredAttributes>;
3413def warn_gc_attribute_weak_on_local : Warning<
3414  "Objective-C GC does not allow weak variables on the stack">,
3415  InGroup<IgnoredAttributes>;
3416def warn_nsobject_attribute : Warning<
3417  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3418  InGroup<NSobjectAttribute>;
3419def warn_independentclass_attribute : Warning<
3420  "'objc_independent_class' attribute may be put on a typedef only; "
3421  "attribute is ignored">,
3422  InGroup<IndependentClassAttribute>;
3423def warn_ptr_independentclass_attribute : Warning<
3424  "'objc_independent_class' attribute may be put on Objective-C object "
3425  "pointer type only; attribute is ignored">,
3426  InGroup<IndependentClassAttribute>;
3427def warn_attribute_weak_on_local : Warning<
3428  "__weak attribute cannot be specified on an automatic variable when ARC "
3429  "is not enabled">,
3430  InGroup<IgnoredAttributes>;
3431def warn_weak_identifier_undeclared : Warning<
3432  "weak identifier %0 never declared">;
3433def warn_attribute_cmse_entry_static : Warning<
3434  "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3435  InGroup<IgnoredAttributes>;
3436def warn_cmse_nonsecure_union : Warning<
3437  "passing union across security boundary via %select{parameter %1|return value}0 "
3438  "may leak information">,
3439  InGroup<DiagGroup<"cmse-union-leak">>;
3440def err_attribute_weak_static : Error<
3441  "weak declaration cannot have internal linkage">;
3442def err_attribute_selectany_non_extern_data : Error<
3443  "'selectany' can only be applied to data items with external linkage">;
3444def err_declspec_thread_on_thread_variable : Error<
3445  "'__declspec(thread)' applied to variable that already has a "
3446  "thread-local storage specifier">;
3447def err_attribute_dll_not_extern : Error<
3448  "%q0 must have external linkage when declared %q1">;
3449def err_attribute_dll_thread_local : Error<
3450  "%q0 cannot be thread local when declared %q1">;
3451def err_attribute_dll_lambda : Error<
3452  "lambda cannot be declared %0">;
3453def warn_attribute_invalid_on_definition : Warning<
3454  "'%0' attribute cannot be specified on a definition">,
3455  InGroup<IgnoredAttributes>;
3456def err_attribute_dll_redeclaration : Error<
3457  "redeclaration of %q0 cannot add %q1 attribute">;
3458def warn_attribute_dll_redeclaration : Warning<
3459  "redeclaration of %q0 should not add %q1 attribute">,
3460  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3461def err_attribute_dllimport_function_definition : Error<
3462  "dllimport cannot be applied to non-inline function definition">;
3463def err_attribute_dll_deleted : Error<
3464  "attribute %q0 cannot be applied to a deleted function">;
3465def err_attribute_dllimport_data_definition : Error<
3466  "definition of dllimport data">;
3467def err_attribute_dllimport_static_field_definition : Error<
3468  "definition of dllimport static field not allowed">;
3469def warn_attribute_dllimport_static_field_definition : Warning<
3470  "definition of dllimport static field">,
3471  InGroup<DiagGroup<"dllimport-static-field-def">>;
3472def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3473  "explicit instantiation declaration should not be 'dllexport'">,
3474  InGroup<DllexportExplicitInstantiationDecl>;
3475def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3476  "'dllexport' attribute ignored on explicit instantiation definition">,
3477  InGroup<IgnoredAttributes>;
3478def warn_invalid_initializer_from_system_header : Warning<
3479  "invalid constructor from class in system header, should not be explicit">,
3480  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3481def note_used_in_initialization_here : Note<"used in initialization here">;
3482def err_attribute_dll_member_of_dll_class : Error<
3483  "attribute %q0 cannot be applied to member of %q1 class">;
3484def warn_attribute_dll_instantiated_base_class : Warning<
3485  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3486  "base class template without dll attribute is not supported">,
3487  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3488def err_attribute_dll_ambiguous_default_ctor : Error<
3489  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3490def err_attribute_weakref_not_static : Error<
3491  "weakref declaration must have internal linkage">;
3492def err_attribute_weakref_not_global_context : Error<
3493  "weakref declaration of %0 must be in a global context">;
3494def err_attribute_weakref_without_alias : Error<
3495  "weakref declaration of %0 must also have an alias attribute">;
3496def err_alias_not_supported_on_darwin : Error <
3497  "aliases are not supported on darwin">;
3498def warn_attribute_wrong_decl_type_str : Warning<
3499  "%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
3500def err_attribute_wrong_decl_type_str : Error<
3501  warn_attribute_wrong_decl_type_str.Text>;
3502def warn_attribute_wrong_decl_type : Warning<
3503  "%0 attribute only applies to %select{"
3504  "functions"
3505  "|unions"
3506  "|variables and functions"
3507  "|functions and methods"
3508  "|functions, methods and blocks"
3509  "|functions, methods, and parameters"
3510  "|variables"
3511  "|variables and fields"
3512  "|variables, data members and tag types"
3513  "|types and namespaces"
3514  "|variables, functions and classes"
3515  "|kernel functions"
3516  "|non-K&R-style functions}1">,
3517  InGroup<IgnoredAttributes>;
3518def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
3519def warn_type_attribute_wrong_type : Warning<
3520  "'%0' only applies to %select{function|pointer|"
3521  "Objective-C object or block pointer}1 types; type here is %2">,
3522  InGroup<IgnoredAttributes>;
3523def warn_incomplete_encoded_type : Warning<
3524  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3525  InGroup<DiagGroup<"encode-type">>;
3526def warn_gnu_inline_attribute_requires_inline : Warning<
3527  "'gnu_inline' attribute requires function to be marked 'inline',"
3528  " attribute ignored">,
3529  InGroup<IgnoredAttributes>;
3530def warn_gnu_inline_cplusplus_without_extern : Warning<
3531  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3532  " available, this changed in Clang 10">,
3533  InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3534def err_attribute_vecreturn_only_vector_member : Error<
3535  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3536def err_attribute_vecreturn_only_pod_record : Error<
3537  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3538def err_cconv_change : Error<
3539  "function declared '%0' here was previously declared "
3540  "%select{'%2'|without calling convention}1">;
3541def warn_cconv_unsupported : Warning<
3542  "%0 calling convention is not supported %select{"
3543  // Use CallingConventionIgnoredReason Enum to specify these.
3544  "for this target"
3545  "|on variadic function"
3546  "|on constructor/destructor"
3547  "|on builtin function"
3548  "}1">,
3549  InGroup<IgnoredAttributes>;
3550def error_cconv_unsupported : Error<warn_cconv_unsupported.Text>;
3551def err_cconv_knr : Error<
3552  "function with no prototype cannot use the %0 calling convention">;
3553def warn_cconv_knr : Warning<
3554  err_cconv_knr.Text>,
3555  InGroup<DiagGroup<"missing-prototype-for-cc">>;
3556def err_cconv_varargs : Error<
3557  "variadic function cannot use %0 calling convention">;
3558def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3559  "attribute was previously declared "
3560  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3561def err_function_attribute_mismatch : Error<
3562  "function declared with %0 attribute "
3563  "was previously declared without the %0 attribute">;
3564def err_objc_precise_lifetime_bad_type : Error<
3565  "objc_precise_lifetime only applies to retainable types; type here is %0">;
3566def warn_objc_precise_lifetime_meaningless : Error<
3567  "objc_precise_lifetime is not meaningful for "
3568  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3569def err_invalid_pcs : Error<"invalid PCS type">;
3570def warn_attribute_not_on_decl : Warning<
3571  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3572def err_base_specifier_attribute : Error<
3573  "%0 attribute cannot be applied to a base specifier">;
3574def warn_declspec_allocator_nonpointer : Warning<
3575  "ignoring __declspec(allocator) because the function return type %0 is not "
3576  "a pointer or reference type">, InGroup<IgnoredAttributes>;
3577def err_cconv_incomplete_param_type : Error<
3578  "parameter %0 must have a complete type to use function %1 with the %2 "
3579  "calling convention">;
3580def err_attribute_output_parameter : Error<
3581  "attribute only applies to output parameters">;
3582
3583def ext_cannot_use_trivial_abi : ExtWarn<
3584  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3585def note_cannot_use_trivial_abi_reason : Note<
3586  "'trivial_abi' is disallowed on %0 because %select{"
3587  "its copy constructors and move constructors are all deleted|"
3588  "it is polymorphic|"
3589  "it has a base of a non-trivial class type|it has a virtual base|"
3590  "it has a __weak field|it has a field of a non-trivial class type}1">;
3591
3592// Availability attribute
3593def warn_availability_unknown_platform : Warning<
3594  "unknown platform %0 in availability macro">, InGroup<Availability>;
3595def warn_availability_version_ordering : Warning<
3596  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3597  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3598  "attribute ignored">, InGroup<Availability>;
3599def warn_mismatched_availability: Warning<
3600  "availability does not match previous declaration">, InGroup<Availability>;
3601def warn_mismatched_availability_override : Warning<
3602  "%select{|overriding }4method %select{introduced after|"
3603  "deprecated before|obsoleted before}0 "
3604  "%select{the protocol method it implements|overridden method}4 "
3605  "on %1 (%2 vs. %3)">, InGroup<Availability>;
3606def warn_mismatched_availability_override_unavail : Warning<
3607  "%select{|overriding }1method cannot be unavailable on %0 when "
3608  "%select{the protocol method it implements|its overridden method}1 is "
3609  "available">,
3610  InGroup<Availability>;
3611def warn_availability_on_static_initializer : Warning<
3612  "ignoring availability attribute %select{on '+load' method|"
3613  "with constructor attribute|with destructor attribute}0">,
3614  InGroup<Availability>;
3615def note_overridden_method : Note<
3616  "overridden method is here">;
3617def warn_availability_swift_unavailable_deprecated_only : Warning<
3618  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3619  InGroup<Availability>;
3620def note_protocol_method : Note<
3621  "protocol method is here">;
3622def warn_availability_fuchsia_unavailable_minor : Warning<
3623  "Fuchsia API Level prohibits specifying a minor or sub-minor version">,
3624  InGroup<Availability>;
3625
3626def warn_unguarded_availability :
3627  Warning<"%0 is only available on %1 %2 or newer">,
3628  InGroup<UnguardedAvailability>, DefaultIgnore;
3629def warn_unguarded_availability_new :
3630  Warning<warn_unguarded_availability.Text>,
3631  InGroup<UnguardedAvailabilityNew>;
3632def note_decl_unguarded_availability_silence : Note<
3633  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3634def note_unguarded_available_silence : Note<
3635  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3636  " this warning">;
3637def warn_at_available_unchecked_use : Warning<
3638  "%select{@available|__builtin_available}0 does not guard availability here; "
3639  "use if (%select{@available|__builtin_available}0) instead">,
3640  InGroup<DiagGroup<"unsupported-availability-guard">>;
3641
3642def warn_missing_sdksettings_for_availability_checking : Warning<
3643  "%0 availability is ignored without a valid 'SDKSettings.json' in the SDK">,
3644  InGroup<DiagGroup<"ignored-availability-without-sdk-settings">>;
3645
3646// Thread Safety Attributes
3647def warn_thread_attribute_ignored : Warning<
3648  "ignoring %0 attribute because its argument is invalid">,
3649  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3650def warn_thread_attribute_not_on_non_static_member : Warning<
3651  "%0 attribute without capability arguments can only be applied to non-static "
3652  "methods of a class">,
3653  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3654def warn_thread_attribute_not_on_capability_member : Warning<
3655  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3656  "annotated with 'capability' or 'scoped_lockable' attribute">,
3657  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3658def warn_thread_attribute_argument_not_lockable : Warning<
3659  "%0 attribute requires arguments whose type is annotated "
3660  "with 'capability' attribute; type here is %1">,
3661  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3662def warn_thread_attribute_decl_not_lockable : Warning<
3663  "%0 attribute can only be applied in a context annotated "
3664  "with 'capability' attribute">,
3665  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3666def warn_thread_attribute_decl_not_pointer : Warning<
3667  "%0 only applies to pointer types; type here is %1">,
3668  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3669def err_attribute_argument_out_of_bounds_extra_info : Error<
3670  "%0 attribute parameter %1 is out of bounds: "
3671  "%plural{0:no parameters to index into|"
3672  "1:can only be 1, since there is one parameter|"
3673  ":must be between 1 and %2}2">;
3674
3675// Thread Safety Analysis
3676def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3677  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3678def warn_unlock_kind_mismatch : Warning<
3679  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3680  "%select{shared|exclusive}3 access">,
3681  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3682def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3683  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3684def warn_no_unlock : Warning<
3685  "%0 '%1' is still held at the end of function">,
3686  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3687def warn_expecting_locked : Warning<
3688  "expecting %0 '%1' to be held at the end of function">,
3689  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3690// FIXME: improve the error message about locks not in scope
3691def warn_lock_some_predecessors : Warning<
3692  "%0 '%1' is not held on every path through here">,
3693  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3694def warn_expecting_lock_held_on_loop : Warning<
3695  "expecting %0 '%1' to be held at start of each loop">,
3696  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3697def note_locked_here : Note<"%0 acquired here">;
3698def note_unlocked_here : Note<"%0 released here">;
3699def warn_lock_exclusive_and_shared : Warning<
3700  "%0 '%1' is acquired exclusively and shared in the same scope">,
3701  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3702def note_lock_exclusive_and_shared : Note<
3703  "the other acquisition of %0 '%1' is here">;
3704def warn_variable_requires_any_lock : Warning<
3705  "%select{reading|writing}1 variable %0 requires holding "
3706  "%select{any mutex|any mutex exclusively}1">,
3707  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3708def warn_var_deref_requires_any_lock : Warning<
3709  "%select{reading|writing}1 the value pointed to by %0 requires holding "
3710  "%select{any mutex|any mutex exclusively}1">,
3711  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3712def warn_fun_excludes_mutex : Warning<
3713  "cannot call function '%1' while %0 '%2' is held">,
3714  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3715def warn_cannot_resolve_lock : Warning<
3716  "cannot resolve lock expression">,
3717  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3718def warn_acquired_before : Warning<
3719  "%0 '%1' must be acquired before '%2'">,
3720  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3721def warn_acquired_before_after_cycle : Warning<
3722  "Cycle in acquired_before/after dependencies, starting with '%0'">,
3723  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3724
3725
3726// Thread safety warnings negative capabilities
3727def warn_acquire_requires_negative_cap : Warning<
3728  "acquiring %0 '%1' requires negative capability '%2'">,
3729  InGroup<ThreadSafetyNegative>, DefaultIgnore;
3730def warn_fun_requires_negative_cap : Warning<
3731  "calling function %0 requires negative capability '%1'">,
3732  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3733
3734// Thread safety warnings on pass by reference
3735def warn_guarded_pass_by_reference : Warning<
3736  "passing variable %1 by reference requires holding %0 "
3737  "%select{'%2'|'%2' exclusively}3">,
3738  InGroup<ThreadSafetyReference>, DefaultIgnore;
3739def warn_pt_guarded_pass_by_reference : Warning<
3740  "passing the value that %1 points to by reference requires holding %0 "
3741  "%select{'%2'|'%2' exclusively}3">,
3742  InGroup<ThreadSafetyReference>, DefaultIgnore;
3743
3744// Imprecise thread safety warnings
3745def warn_variable_requires_lock : Warning<
3746  "%select{reading|writing}3 variable %1 requires holding %0 "
3747  "%select{'%2'|'%2' exclusively}3">,
3748  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3749def warn_var_deref_requires_lock : Warning<
3750  "%select{reading|writing}3 the value pointed to by %1 requires "
3751  "holding %0 %select{'%2'|'%2' exclusively}3">,
3752  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3753def warn_fun_requires_lock : Warning<
3754  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3755  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3756
3757// Precise thread safety warnings
3758def warn_variable_requires_lock_precise :
3759  Warning<warn_variable_requires_lock.Text>,
3760  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3761def warn_var_deref_requires_lock_precise :
3762  Warning<warn_var_deref_requires_lock.Text>,
3763  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3764def warn_fun_requires_lock_precise :
3765  Warning<warn_fun_requires_lock.Text>,
3766  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3767def note_found_mutex_near_match : Note<"found near match '%0'">;
3768
3769// Verbose thread safety warnings
3770def warn_thread_safety_verbose : Warning<"thread safety verbose warning">,
3771  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3772def note_thread_warning_in_fun : Note<"thread warning in function %0">;
3773def note_guarded_by_declared_here : Note<"guarded_by declared here">;
3774
3775// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3776def warn_thread_safety_beta : Warning<"thread safety beta warning">,
3777  InGroup<ThreadSafetyBeta>, DefaultIgnore;
3778
3779// Consumed warnings
3780def warn_use_in_invalid_state : Warning<
3781  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3782  "state">, InGroup<Consumed>, DefaultIgnore;
3783def warn_use_of_temp_in_invalid_state : Warning<
3784  "invalid invocation of method '%0' on a temporary object while it is in the "
3785  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3786def warn_attr_on_unconsumable_class : Warning<
3787  "consumed analysis attribute is attached to member of class %0 which isn't "
3788  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3789def warn_return_typestate_for_unconsumable_type : Warning<
3790  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3791  DefaultIgnore;
3792def warn_return_typestate_mismatch : Warning<
3793  "return value not in expected state; expected '%0', observed '%1'">,
3794  InGroup<Consumed>, DefaultIgnore;
3795def warn_loop_state_mismatch : Warning<
3796  "state of variable '%0' must match at the entry and exit of loop">,
3797  InGroup<Consumed>, DefaultIgnore;
3798def warn_param_return_typestate_mismatch : Warning<
3799  "parameter '%0' not in expected state when the function returns: expected "
3800  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3801def warn_param_typestate_mismatch : Warning<
3802  "argument not in expected state; expected '%0', observed '%1'">,
3803  InGroup<Consumed>, DefaultIgnore;
3804
3805// no_sanitize attribute
3806def warn_unknown_sanitizer_ignored : Warning<
3807  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3808
3809def warn_impcast_vector_scalar : Warning<
3810  "implicit conversion turns vector to scalar: %0 to %1">,
3811  InGroup<Conversion>, DefaultIgnore;
3812def warn_impcast_complex_scalar : Warning<
3813  "implicit conversion discards imaginary component: %0 to %1">,
3814  InGroup<Conversion>, DefaultIgnore;
3815def err_impcast_complex_scalar : Error<
3816  "implicit conversion from %0 to %1 is not permitted in C++">;
3817def warn_impcast_float_precision : Warning<
3818  "implicit conversion loses floating-point precision: %0 to %1">,
3819  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3820def warn_impcast_float_result_precision : Warning<
3821  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3822  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3823def warn_impcast_double_promotion : Warning<
3824  "implicit conversion increases floating-point precision: %0 to %1">,
3825  InGroup<DoublePromotion>, DefaultIgnore;
3826def warn_impcast_integer_sign : Warning<
3827  "implicit conversion changes signedness: %0 to %1">,
3828  InGroup<SignConversion>, DefaultIgnore;
3829def warn_impcast_integer_sign_conditional : Warning<
3830  "operand of ? changes signedness: %0 to %1">,
3831  InGroup<SignConversion>, DefaultIgnore;
3832def warn_impcast_integer_precision : Warning<
3833  "implicit conversion loses integer precision: %0 to %1">,
3834  InGroup<ImplicitIntConversion>, DefaultIgnore;
3835def warn_impcast_high_order_zero_bits : Warning<
3836  "higher order bits are zeroes after implicit conversion">,
3837  InGroup<ImplicitIntConversion>, DefaultIgnore;
3838def warn_impcast_nonnegative_result : Warning<
3839  "the resulting value is always non-negative after implicit conversion">,
3840  InGroup<SignConversion>, DefaultIgnore;
3841def warn_impcast_integer_64_32 : Warning<
3842  "implicit conversion loses integer precision: %0 to %1">,
3843  InGroup<Shorten64To32>, DefaultIgnore;
3844def warn_impcast_integer_precision_constant : Warning<
3845  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3846  InGroup<ConstantConversion>;
3847def warn_impcast_bitfield_precision_constant : Warning<
3848  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3849  InGroup<BitFieldConstantConversion>;
3850def warn_impcast_constant_value_to_objc_bool : Warning<
3851  "implicit conversion from constant value %0 to 'BOOL'; "
3852  "the only well defined values for 'BOOL' are YES and NO">,
3853  InGroup<ObjCBoolConstantConversion>;
3854
3855def warn_impcast_fixed_point_range : Warning<
3856  "implicit conversion from %0 cannot fit within the range of values for %1">,
3857  InGroup<ImplicitFixedPointConversion>;
3858
3859def warn_impcast_literal_float_to_integer : Warning<
3860  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3861  InGroup<LiteralConversion>;
3862def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3863  "implicit conversion of out of range value from %0 to %1 is undefined">,
3864  InGroup<LiteralConversion>;
3865def warn_impcast_float_integer : Warning<
3866  "implicit conversion turns floating-point number into integer: %0 to %1">,
3867  InGroup<FloatConversion>, DefaultIgnore;
3868def warn_impcast_float_to_objc_signed_char_bool : Warning<
3869  "implicit conversion from floating-point type %0 to 'BOOL'">,
3870  InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
3871def warn_impcast_int_to_objc_signed_char_bool : Warning<
3872  "implicit conversion from integral type %0 to 'BOOL'">,
3873  InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
3874
3875// Implicit int -> float conversion precision loss warnings.
3876def warn_impcast_integer_float_precision : Warning<
3877  "implicit conversion from %0 to %1 may lose precision">,
3878  InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
3879def warn_impcast_integer_float_precision_constant : Warning<
3880  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3881  InGroup<ImplicitConstIntFloatConversion>;
3882
3883def warn_impcast_float_to_integer : Warning<
3884  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3885  InGroup<FloatOverflowConversion>, DefaultIgnore;
3886def warn_impcast_float_to_integer_out_of_range : Warning<
3887  "implicit conversion of out of range value from %0 to %1 is undefined">,
3888  InGroup<FloatOverflowConversion>, DefaultIgnore;
3889def warn_impcast_float_to_integer_zero : Warning<
3890  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3891  InGroup<FloatZeroConversion>, DefaultIgnore;
3892
3893def warn_impcast_string_literal_to_bool : Warning<
3894  "implicit conversion turns string literal into bool: %0 to %1">,
3895  InGroup<StringConversion>, DefaultIgnore;
3896def warn_impcast_different_enum_types : Warning<
3897  "implicit conversion from enumeration type %0 to different enumeration type "
3898  "%1">, InGroup<EnumConversion>;
3899def warn_impcast_bool_to_null_pointer : Warning<
3900    "initialization of pointer of type %0 to null from a constant boolean "
3901    "expression">, InGroup<BoolConversion>;
3902def warn_non_literal_null_pointer : Warning<
3903    "expression which evaluates to zero treated as a null pointer constant of "
3904    "type %0">, InGroup<NonLiteralNullConversion>;
3905def warn_pointer_compare : Warning<
3906    "comparing a pointer to a null character constant; did you mean "
3907    "to compare to %select{NULL|(void *)0}0?">,
3908    InGroup<DiagGroup<"pointer-compare">>;
3909def warn_impcast_null_pointer_to_integer : Warning<
3910    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
3911    InGroup<NullConversion>;
3912def warn_impcast_floating_point_to_bool : Warning<
3913    "implicit conversion turns floating-point number into bool: %0 to %1">,
3914    InGroup<ImplicitConversionFloatingPointToBool>;
3915def ext_ms_impcast_fn_obj : ExtWarn<
3916  "implicit conversion between pointer-to-function and pointer-to-object is a "
3917  "Microsoft extension">, InGroup<MicrosoftCast>;
3918
3919def warn_impcast_pointer_to_bool : Warning<
3920    "address of%select{| function| array}0 '%1' will always evaluate to "
3921    "'true'">,
3922    InGroup<PointerBoolConversion>;
3923def warn_cast_nonnull_to_bool : Warning<
3924    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
3925    "'true' on first encounter">,
3926    InGroup<PointerBoolConversion>;
3927def warn_this_bool_conversion : Warning<
3928  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
3929  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
3930def warn_address_of_reference_bool_conversion : Warning<
3931  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3932  "code; pointer may be assumed to always convert to true">,
3933  InGroup<UndefinedBoolConversion>;
3934
3935def warn_xor_used_as_pow : Warning<
3936  "result of '%0' is %1; did you mean exponentiation?">,
3937  InGroup<XorUsedAsPow>;
3938def warn_xor_used_as_pow_base_extra : Warning<
3939  "result of '%0' is %1; did you mean '%2' (%3)?">,
3940  InGroup<XorUsedAsPow>;
3941def warn_xor_used_as_pow_base : Warning<
3942  "result of '%0' is %1; did you mean '%2'?">,
3943  InGroup<XorUsedAsPow>;
3944def note_xor_used_as_pow_silence : Note<
3945  "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
3946
3947def warn_null_pointer_compare : Warning<
3948    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
3949    "equal to a null pointer is always %select{true|false}2">,
3950    InGroup<TautologicalPointerCompare>;
3951def warn_nonnull_expr_compare : Warning<
3952    "comparison of nonnull %select{function call|parameter}0 '%1' "
3953    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
3954    "encounter">,
3955    InGroup<TautologicalPointerCompare>;
3956def warn_this_null_compare : Warning<
3957  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
3958  "assumed to always evaluate to %select{true|false}0">,
3959  InGroup<TautologicalUndefinedCompare>;
3960def warn_address_of_reference_null_compare : Warning<
3961  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3962  "code; comparison may be assumed to always evaluate to "
3963  "%select{true|false}0">,
3964  InGroup<TautologicalUndefinedCompare>;
3965def note_reference_is_return_value : Note<"%0 returns a reference">;
3966
3967def note_pointer_declared_here : Note<
3968  "pointer %0 declared here">;
3969def warn_division_sizeof_ptr : Warning<
3970  "'%0' will return the size of the pointer, not the array itself">,
3971  InGroup<DiagGroup<"sizeof-pointer-div">>;
3972def warn_division_sizeof_array : Warning<
3973  "expression does not compute the number of elements in this array; element "
3974  "type is %0, not %1">,
3975  InGroup<DiagGroup<"sizeof-array-div">>;
3976
3977def note_function_warning_silence : Note<
3978    "prefix with the address-of operator to silence this warning">;
3979def note_function_to_function_call : Note<
3980    "suffix with parentheses to turn this into a function call">;
3981def warn_impcast_objective_c_literal_to_bool : Warning<
3982    "implicit boolean conversion of Objective-C object literal always "
3983    "evaluates to true">,
3984    InGroup<ObjCLiteralConversion>;
3985
3986def warn_cast_align : Warning<
3987  "cast from %0 to %1 increases required alignment from %2 to %3">,
3988  InGroup<CastAlign>, DefaultIgnore;
3989def warn_old_style_cast : Warning<
3990  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore,
3991  SuppressInSystemMacro;
3992
3993// Separate between casts to void* and non-void* pointers.
3994// Some APIs use (abuse) void* for something like a user context,
3995// and often that value is an integer even if it isn't a pointer itself.
3996// Having a separate warning flag allows users to control the warning
3997// for their workflow.
3998def warn_int_to_pointer_cast : Warning<
3999  "cast to %1 from smaller integer type %0">,
4000  InGroup<IntToPointerCast>;
4001def warn_int_to_void_pointer_cast : Warning<
4002  "cast to %1 from smaller integer type %0">,
4003  InGroup<IntToVoidPointerCast>;
4004def warn_pointer_to_int_cast : Warning<
4005  "cast to smaller integer type %1 from %0">,
4006  InGroup<PointerToIntCast>;
4007def warn_pointer_to_enum_cast : Warning<
4008  warn_pointer_to_int_cast.Text>,
4009  InGroup<PointerToEnumCast>;
4010def warn_void_pointer_to_int_cast : Warning<
4011  "cast to smaller integer type %1 from %0">,
4012  InGroup<VoidPointerToIntCast>;
4013def warn_void_pointer_to_enum_cast : Warning<
4014  warn_void_pointer_to_int_cast.Text>,
4015  InGroup<VoidPointerToEnumCast>;
4016
4017def warn_attribute_ignored_for_field_of_type : Warning<
4018  "%0 attribute ignored for field of type %1">,
4019  InGroup<IgnoredAttributes>;
4020def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
4021  "enums in the Microsoft ABI are signed integers by default; consider giving "
4022  "the enum %0 an unsigned underlying type to make this code portable">,
4023  InGroup<SignedEnumBitfield>, DefaultIgnore;
4024def warn_attribute_packed_for_bitfield : Warning<
4025  "'packed' attribute was ignored on bit-fields with single-byte alignment "
4026  "in older versions of GCC and Clang">,
4027  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
4028def warn_transparent_union_attribute_field_size_align : Warning<
4029  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
4030  "%select{alignment|size}0 of the first field in transparent union; "
4031  "transparent_union attribute ignored">,
4032  InGroup<IgnoredAttributes>;
4033def note_transparent_union_first_field_size_align : Note<
4034  "%select{alignment|size}0 of first field is %1 bits">;
4035def warn_transparent_union_attribute_not_definition : Warning<
4036  "transparent_union attribute can only be applied to a union definition; "
4037  "attribute ignored">,
4038  InGroup<IgnoredAttributes>;
4039def warn_transparent_union_attribute_floating : Warning<
4040  "first field of a transparent union cannot have %select{floating point|"
4041  "vector}0 type %1; transparent_union attribute ignored">,
4042  InGroup<IgnoredAttributes>;
4043def warn_transparent_union_attribute_zero_fields : Warning<
4044  "transparent union definition must contain at least one field; "
4045  "transparent_union attribute ignored">,
4046  InGroup<IgnoredAttributes>;
4047def warn_attribute_type_not_supported : Warning<
4048  "%0 attribute argument not supported: %1">,
4049  InGroup<IgnoredAttributes>;
4050def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
4051  InGroup<IgnoredAttributes>;
4052def warn_attribute_protected_visibility :
4053  Warning<"target does not support 'protected' visibility; using 'default'">,
4054  InGroup<DiagGroup<"unsupported-visibility">>;
4055def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
4056def note_previous_attribute : Note<"previous attribute is here">;
4057def note_conflicting_attribute : Note<"conflicting attribute is here">;
4058def note_attribute : Note<"attribute is here">;
4059def err_mismatched_ms_inheritance : Error<
4060  "inheritance model does not match %select{definition|previous declaration}0">;
4061def warn_ignored_ms_inheritance : Warning<
4062  "inheritance model ignored on %select{primary template|partial specialization}0">,
4063  InGroup<IgnoredAttributes>;
4064def note_previous_ms_inheritance : Note<
4065  "previous inheritance model specified here">;
4066def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
4067def err_mode_not_primitive : Error<
4068  "mode attribute only supported for integer and floating-point types">;
4069def err_mode_wrong_type : Error<
4070  "type of machine mode does not match type of base type">;
4071def warn_vector_mode_deprecated : Warning<
4072  "specifying vector types with the 'mode' attribute is deprecated; "
4073  "use the 'vector_size' attribute instead">,
4074  InGroup<DeprecatedAttributes>;
4075def warn_deprecated_noreturn_spelling : Warning<
4076  "the '[[_Noreturn]]' attribute spelling is deprecated in C2x; use "
4077  "'[[noreturn]]' instead">, InGroup<DeprecatedAttributes>;
4078def err_complex_mode_vector_type : Error<
4079  "type of machine mode does not support base vector types">;
4080def err_enum_mode_vector_type : Error<
4081  "mode %0 is not supported for enumeration types">;
4082def warn_attribute_nonnull_no_pointers : Warning<
4083  "'nonnull' attribute applied to function with no pointer arguments">,
4084  InGroup<IgnoredAttributes>;
4085def warn_attribute_nonnull_parm_no_args : Warning<
4086  "'nonnull' attribute when used on parameters takes no arguments">,
4087  InGroup<IgnoredAttributes>;
4088def warn_function_stmt_attribute_precedence : Warning<
4089  "statement attribute %0 has higher precedence than function attribute "
4090  "'%select{always_inline|flatten|noinline}1'">,
4091  InGroup<IgnoredAttributes>;
4092def note_declared_nonnull : Note<
4093  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
4094def warn_attribute_sentinel_named_arguments : Warning<
4095  "'sentinel' attribute requires named arguments">,
4096  InGroup<IgnoredAttributes>;
4097def warn_attribute_sentinel_not_variadic : Warning<
4098  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
4099  InGroup<IgnoredAttributes>;
4100def warn_deprecated_ignored_on_using : Warning<
4101  "%0 currently has no effect on a using declaration">,
4102  InGroup<IgnoredAttributes>;
4103def err_attribute_sentinel_less_than_zero : Error<
4104  "'sentinel' parameter 1 less than zero">;
4105def err_attribute_sentinel_not_zero_or_one : Error<
4106  "'sentinel' parameter 2 not 0 or 1">;
4107def warn_cleanup_ext : Warning<
4108  "GCC does not allow the 'cleanup' attribute argument to be anything other "
4109  "than a simple identifier">,
4110  InGroup<GccCompat>;
4111def err_attribute_cleanup_arg_not_function : Error<
4112  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
4113def err_attribute_cleanup_func_must_take_one_arg : Error<
4114  "'cleanup' function %0 must take 1 parameter">;
4115def err_attribute_cleanup_func_arg_incompatible_type : Error<
4116  "'cleanup' function %0 parameter has "
4117  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
4118def err_attribute_regparm_wrong_platform : Error<
4119  "'regparm' is not valid on this platform">;
4120def err_attribute_regparm_invalid_number : Error<
4121  "'regparm' parameter must be between 0 and %0 inclusive">;
4122def err_attribute_not_supported_in_lang : Error<
4123  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
4124def err_attribute_not_supported_on_arch
4125    : Error<"%0 attribute is not supported on '%1'">;
4126def warn_gcc_ignores_type_attr : Warning<
4127  "GCC does not allow the %0 attribute to be written on a type">,
4128  InGroup<GccCompat>;
4129def warn_gcc_requires_variadic_function : Warning<
4130  "GCC requires a function with the %0 attribute to be variadic">,
4131  InGroup<GccCompat>;
4132
4133// Clang-Specific Attributes
4134def warn_attribute_iboutlet : Warning<
4135  "%0 attribute can only be applied to instance variables or properties">,
4136  InGroup<IgnoredAttributes>;
4137def err_iboutletcollection_type : Error<
4138  "invalid type %0 as argument of iboutletcollection attribute">;
4139def err_iboutletcollection_builtintype : Error<
4140  "type argument of iboutletcollection attribute cannot be a builtin type">;
4141def warn_iboutlet_object_type : Warning<
4142  "%select{instance variable|property}2 with %0 attribute must "
4143  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
4144def warn_iboutletcollection_property_assign : Warning<
4145  "IBOutletCollection properties should be copy/strong and not assign">,
4146  InGroup<ObjCInvalidIBOutletProperty>;
4147
4148def err_attribute_overloadable_mismatch : Error<
4149  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
4150def note_attribute_overloadable_prev_overload : Note<
4151  "previous %select{unmarked |}0overload of function is here">;
4152def err_attribute_overloadable_no_prototype : Error<
4153  "'overloadable' function %0 must have a prototype">;
4154def err_attribute_overloadable_multiple_unmarked_overloads : Error<
4155  "at most one overload for a given name may lack the 'overloadable' "
4156  "attribute">;
4157def warn_attribute_no_builtin_invalid_builtin_name : Warning<
4158  "'%0' is not a valid builtin name for %1">,
4159  InGroup<DiagGroup<"invalid-no-builtin-names">>;
4160def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
4161  "empty %0 cannot be composed with named ones">;
4162def err_attribute_no_builtin_on_non_definition : Error<
4163  "%0 attribute is permitted on definitions only">;
4164def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
4165  "%0 attribute has no effect on defaulted or deleted functions">;
4166def warn_ns_attribute_wrong_return_type : Warning<
4167  "%0 attribute only applies to %select{functions|methods|properties}1 that "
4168  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
4169  InGroup<IgnoredAttributes>;
4170def err_ns_attribute_wrong_parameter_type : Error<
4171  "%0 attribute only applies to "
4172  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
4173def warn_ns_attribute_wrong_parameter_type : Warning<
4174  "%0 attribute only applies to "
4175  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
4176  InGroup<IgnoredAttributes>;
4177def warn_objc_requires_super_protocol : Warning<
4178  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
4179  InGroup<DiagGroup<"requires-super-attribute">>;
4180def note_protocol_decl : Note<
4181  "protocol is declared here">;
4182def note_protocol_decl_undefined : Note<
4183  "protocol %0 has no definition">;
4184def err_attribute_preferred_name_arg_invalid : Error<
4185  "argument %0 to 'preferred_name' attribute is not a typedef for "
4186  "a specialization of %1">;
4187def err_attribute_builtin_alias : Error<
4188  "%0 attribute can only be applied to a ARM, HLSL or RISC-V builtin">;
4189
4190// called-once attribute diagnostics.
4191def err_called_once_attribute_wrong_type : Error<
4192  "'called_once' attribute only applies to function-like parameters">;
4193
4194def warn_completion_handler_never_called : Warning<
4195  "%select{|captured }1completion handler is never called">,
4196  InGroup<CompletionHandler>, DefaultIgnore;
4197def warn_called_once_never_called : Warning<
4198  "%select{|captured }1%0 parameter marked 'called_once' is never called">,
4199  InGroup<CalledOnceParameter>;
4200
4201def warn_completion_handler_never_called_when : Warning<
4202  "completion handler is never %select{used|called}1 when "
4203  "%select{taking true branch|taking false branch|"
4204  "handling this case|none of the cases applies|"
4205  "entering the loop|skipping the loop|taking one of the branches}2">,
4206  InGroup<CompletionHandler>, DefaultIgnore;
4207def warn_called_once_never_called_when : Warning<
4208  "%0 parameter marked 'called_once' is never %select{used|called}1 when "
4209  "%select{taking true branch|taking false branch|"
4210  "handling this case|none of the cases applies|"
4211  "entering the loop|skipping the loop|taking one of the branches}2">,
4212  InGroup<CalledOnceParameter>;
4213
4214def warn_completion_handler_called_twice : Warning<
4215  "completion handler is called twice">,
4216  InGroup<CompletionHandler>, DefaultIgnore;
4217def warn_called_once_gets_called_twice : Warning<
4218  "%0 parameter marked 'called_once' is called twice">,
4219  InGroup<CalledOnceParameter>;
4220def note_called_once_gets_called_twice : Note<
4221  "previous call is here%select{; set to nil to indicate "
4222  "it cannot be called afterwards|}0">;
4223
4224// objc_designated_initializer attribute diagnostics.
4225def warn_objc_designated_init_missing_super_call : Warning<
4226  "designated initializer missing a 'super' call to a designated initializer of the super class">,
4227  InGroup<ObjCDesignatedInit>;
4228def note_objc_designated_init_marked_here : Note<
4229  "method marked as designated initializer of the class here">;
4230def warn_objc_designated_init_non_super_designated_init_call : Warning<
4231  "designated initializer should only invoke a designated initializer on 'super'">,
4232  InGroup<ObjCDesignatedInit>;
4233def warn_objc_designated_init_non_designated_init_call : Warning<
4234  "designated initializer invoked a non-designated initializer">,
4235  InGroup<ObjCDesignatedInit>;
4236def warn_objc_secondary_init_super_init_call : Warning<
4237  "convenience initializer should not invoke an initializer on 'super'">,
4238  InGroup<ObjCDesignatedInit>;
4239def warn_objc_secondary_init_missing_init_call : Warning<
4240  "convenience initializer missing a 'self' call to another initializer">,
4241  InGroup<ObjCDesignatedInit>;
4242def warn_objc_implementation_missing_designated_init_override : Warning<
4243  "method override for the designated initializer of the superclass %objcinstance0 not found">,
4244  InGroup<ObjCDesignatedInit>;
4245def err_designated_init_attr_non_init : Error<
4246  "'objc_designated_initializer' attribute only applies to init methods "
4247  "of interface or class extension declarations">;
4248
4249// objc_bridge attribute diagnostics.
4250def err_objc_attr_not_id : Error<
4251  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
4252def err_objc_attr_typedef_not_id : Error<
4253  "parameter of %0 attribute must be 'id' when used on a typedef">;
4254def err_objc_attr_typedef_not_void_pointer : Error<
4255  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
4256def err_objc_cf_bridged_not_interface : Error<
4257  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
4258def err_objc_ns_bridged_invalid_cfobject : Error<
4259  "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
4260def warn_objc_invalid_bridge : Warning<
4261  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
4262def warn_objc_invalid_bridge_to_cf : Warning<
4263  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
4264
4265// objc_bridge_related attribute diagnostics.
4266def err_objc_bridged_related_invalid_class : Error<
4267  "could not find Objective-C class %0 to convert %1 to %2">;
4268def err_objc_bridged_related_invalid_class_name : Error<
4269  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
4270def err_objc_bridged_related_known_method : Error<
4271 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
4272 "method for this conversion">;
4273
4274def err_objc_attr_protocol_requires_definition : Error<
4275  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
4276
4277// Swift attributes.
4278def warn_attr_swift_name_function
4279  : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
4280    InGroup<SwiftNameAttribute>;
4281def warn_attr_swift_name_invalid_identifier
4282  : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4283    InGroup<SwiftNameAttribute>;
4284def warn_attr_swift_name_decl_kind
4285  : Warning<"%0 attribute cannot be applied to this declaration">,
4286    InGroup<SwiftNameAttribute>;
4287def warn_attr_swift_name_subscript_invalid_parameter
4288  : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4289        "have at least one parameter|"
4290        "have a 'self:' parameter}1">,
4291    InGroup<SwiftNameAttribute>;
4292def warn_attr_swift_name_missing_parameters
4293  : Warning<"%0 attribute is missing parameter label clause">,
4294    InGroup<SwiftNameAttribute>;
4295def warn_attr_swift_name_setter_parameters
4296  : Warning<"%0 attribute for setter must have one parameter for new value">,
4297    InGroup<SwiftNameAttribute>;
4298def warn_attr_swift_name_multiple_selfs
4299  : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4300    InGroup<SwiftNameAttribute>;
4301def warn_attr_swift_name_getter_parameters
4302  : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4303    InGroup<SwiftNameAttribute>;
4304def warn_attr_swift_name_subscript_setter_no_newValue
4305  : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4306    InGroup<SwiftNameAttribute>;
4307def warn_attr_swift_name_subscript_setter_multiple_newValues
4308  : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4309    InGroup<SwiftNameAttribute>;
4310def warn_attr_swift_name_subscript_getter_newValue
4311  : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4312    InGroup<SwiftNameAttribute>;
4313def warn_attr_swift_name_num_params
4314  : Warning<"too %select{few|many}0 parameters in the signature specified by "
4315            "the %1 attribute (expected %2; got %3)">,
4316    InGroup<SwiftNameAttribute>;
4317def warn_attr_swift_name_decl_missing_params
4318  : Warning<"%0 attribute cannot be applied to a %select{function|method}1 "
4319            "with no parameters">,
4320    InGroup<SwiftNameAttribute>;
4321
4322def err_attr_swift_error_no_error_parameter : Error<
4323  "%0 attribute can only be applied to a %select{function|method}1 with an "
4324  "error parameter">;
4325def err_attr_swift_error_return_type : Error<
4326  "%0 attribute with '%1' convention can only be applied to a "
4327  "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4328
4329def err_swift_async_no_access : Error<
4330  "first argument to 'swift_async' must be either 'none', 'swift_private', or "
4331  "'not_swift_private'">;
4332def err_swift_async_bad_block_type : Error<
4333  "'swift_async' completion handler parameter must have block type returning"
4334  " 'void', type here is %0">;
4335
4336def err_swift_async_error_without_swift_async : Error<
4337  "%0 attribute must be applied to a %select{function|method}1 annotated "
4338  "with non-'none' attribute 'swift_async'">;
4339def err_swift_async_error_no_error_parameter : Error<
4340  "%0 attribute with 'nonnull_error' convention can only be applied to a "
4341  "%select{function|method}1 with a completion handler with an error "
4342  "parameter">;
4343def err_swift_async_error_non_integral : Error<
4344  "%0 attribute with '%1' convention must have an integral-typed parameter "
4345  "in completion handler at index %2, type here is %3">;
4346
4347def warn_ignored_objc_externally_retained : Warning<
4348  "'objc_externally_retained' can only be applied to local variables "
4349  "%select{of retainable type|with strong ownership}0">,
4350  InGroup<IgnoredAttributes>;
4351
4352// Function Parameter Semantic Analysis.
4353def err_param_with_void_type : Error<"argument may not have 'void' type">;
4354def err_void_only_param : Error<
4355  "'void' must be the first and only parameter if specified">;
4356def err_void_param_qualified : Error<
4357  "'void' as parameter must not have type qualifiers">;
4358def err_ident_list_in_fn_declaration : Error<
4359  "a parameter list without types is only allowed in a function definition">;
4360def ext_param_not_declared : ExtWarn<
4361  "parameter %0 was not declared, defaults to 'int'; ISO C99 and later do not "
4362  "support implicit int">, InGroup<ImplicitInt>;
4363def err_param_default_argument : Error<
4364  "C does not support default arguments">;
4365def err_param_default_argument_redefinition : Error<
4366  "redefinition of default argument">;
4367def ext_param_default_argument_redefinition : ExtWarn<
4368  err_param_default_argument_redefinition.Text>,
4369  InGroup<MicrosoftDefaultArgRedefinition>;
4370def err_param_default_argument_missing : Error<
4371  "missing default argument on parameter">;
4372def err_param_default_argument_missing_name : Error<
4373  "missing default argument on parameter %0">;
4374def err_param_default_argument_references_param : Error<
4375  "default argument references parameter %0">;
4376def err_param_default_argument_references_local : Error<
4377  "default argument references local variable %0 of enclosing function">;
4378def err_param_default_argument_references_this : Error<
4379  "default argument references 'this'">;
4380def err_param_default_argument_nonfunc : Error<
4381  "default arguments can only be specified for parameters in a function "
4382  "declaration">;
4383def err_param_default_argument_template_redecl : Error<
4384  "default arguments cannot be added to a function template that has already "
4385  "been declared">;
4386def err_param_default_argument_member_template_redecl : Error<
4387  "default arguments cannot be added to an out-of-line definition of a member "
4388  "of a %select{class template|class template partial specialization|nested "
4389  "class in a template}0">;
4390def err_param_default_argument_on_parameter_pack : Error<
4391  "parameter pack cannot have a default argument">;
4392def err_uninitialized_member_for_assign : Error<
4393  "cannot define the implicit copy assignment operator for %0, because "
4394  "non-static %select{reference|const}1 member %2 cannot use copy "
4395  "assignment operator">;
4396def err_uninitialized_member_in_ctor : Error<
4397  "%select{constructor for %1|"
4398  "implicit default constructor for %1|"
4399  "cannot use constructor inherited from %1:}0 must explicitly "
4400  "initialize the %select{reference|const}2 member %3">;
4401def err_default_arg_makes_ctor_special : Error<
4402  "addition of default argument on redeclaration makes this constructor a "
4403  "%select{default|copy|move}0 constructor">;
4404def err_stmt_expr_in_default_arg : Error<
4405  "default %select{argument|non-type template argument}0 may not use a GNU "
4406  "statement expression">;
4407
4408def err_use_of_default_argument_to_function_declared_later : Error<
4409  "use of default argument to function %0 that is declared later in class %1">;
4410def note_default_argument_declared_here : Note<
4411  "default argument declared here">;
4412def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4413def note_recursive_default_argument_used_here : Note<
4414  "default argument used here">;
4415
4416def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4417  "%diff{promoted type $ of K&R function parameter is not compatible with the "
4418  "parameter type $|promoted type of K&R function parameter is not compatible "
4419  "with parameter type}0,1 declared in a previous prototype">,
4420  InGroup<KNRPromotedParameter>;
4421
4422
4423// C++ Overloading Semantic Analysis.
4424def err_ovl_diff_return_type : Error<
4425  "functions that differ only in their return type cannot be overloaded">;
4426def err_ovl_static_nonstatic_member : Error<
4427  "static and non-static member functions with the same parameter types "
4428  "cannot be overloaded">;
4429
4430let Deferrable = 1 in {
4431
4432def err_ovl_no_viable_function_in_call : Error<
4433  "no matching function for call to %0">;
4434def err_ovl_no_viable_member_function_in_call : Error<
4435  "no matching member function for call to %0">;
4436def err_ovl_ambiguous_call : Error<
4437  "call to %0 is ambiguous">;
4438def err_ovl_deleted_call : Error<"call to deleted function %0">;
4439def err_ovl_ambiguous_member_call : Error<
4440  "call to member function %0 is ambiguous">;
4441def err_ovl_deleted_member_call : Error<
4442  "call to deleted member function %0">;
4443def note_ovl_too_many_candidates : Note<
4444    "remaining %0 candidate%s0 omitted; "
4445    "pass -fshow-overloads=all to show them">;
4446
4447def select_ovl_candidate_kind : TextSubstitution<
4448  "%select{function|function|function (with reversed parameter order)|"
4449    "constructor|"
4450    "constructor (the implicit default constructor)|"
4451    "constructor (the implicit copy constructor)|"
4452    "constructor (the implicit move constructor)|"
4453    "function (the implicit copy assignment operator)|"
4454    "function (the implicit move assignment operator)|"
4455    "function (the implicit 'operator==' for this 'operator<=>)'|"
4456    "inherited constructor}0%select{| template| %2}1">;
4457
4458def note_ovl_candidate : Note<
4459    "candidate %sub{select_ovl_candidate_kind}0,1,3"
4460    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4461    "| has different number of parameters (expected %5 but has %6)"
4462    "| has type mismatch at %ordinal5 parameter"
4463    "%diff{ (expected $ but has $)|}6,7"
4464    "| has different return type%diff{ ($ expected but has $)|}5,6"
4465    "| has different qualifiers (expected %5 but found %6)"
4466    "| has different exception specification}4">;
4467
4468def note_ovl_candidate_explicit : Note<
4469    "explicit %select{constructor|conversion function|deduction guide}0 "
4470    "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4471def note_ovl_candidate_inherited_constructor : Note<
4472    "constructor from base class %0 inherited here">;
4473def note_ovl_candidate_inherited_constructor_slice : Note<
4474    "candidate %select{constructor|template}0 ignored: "
4475    "inherited constructor cannot be used to %select{copy|move}1 object">;
4476def note_ovl_candidate_illegal_constructor : Note<
4477    "candidate %select{constructor|template}0 ignored: "
4478    "instantiation %select{takes|would take}0 its own class type by value">;
4479def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4480    "candidate constructor ignored: cannot be used to construct an object "
4481    "in address space %0">;
4482def note_ovl_candidate_bad_deduction : Note<
4483    "candidate template ignored: failed template argument deduction">;
4484def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4485    "couldn't infer template argument %0">;
4486def note_ovl_candidate_incomplete_deduction_pack : Note<
4487    "candidate template ignored: "
4488    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4489    "expanded parameter in deduced argument pack %2">;
4490def note_ovl_candidate_inconsistent_deduction : Note<
4491    "candidate template ignored: deduced %select{conflicting types|"
4492    "conflicting values|conflicting templates|packs of different lengths}0 "
4493    "for parameter %1%diff{ ($ vs. $)|}2,3">;
4494def note_ovl_candidate_inconsistent_deduction_types : Note<
4495    "candidate template ignored: deduced values %diff{"
4496    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4497    "%1 and %3 of conflicting types for parameter %0}2,4">;
4498def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4499    "candidate template ignored: invalid explicitly-specified argument "
4500    "for template parameter %0">;
4501def note_ovl_candidate_unsatisfied_constraints : Note<
4502    "candidate template ignored: constraints not satisfied%0">;
4503def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4504    "candidate template ignored: invalid explicitly-specified argument "
4505    "for %ordinal0 template parameter">;
4506def note_ovl_candidate_instantiation_depth : Note<
4507    "candidate template ignored: substitution exceeded maximum template "
4508    "instantiation depth">;
4509def note_ovl_candidate_underqualified : Note<
4510    "candidate template ignored: cannot deduce a type for %0 that would "
4511    "make %2 equal %1">;
4512def note_ovl_candidate_substitution_failure : Note<
4513    "candidate template ignored: substitution failure%0%1">;
4514def note_ovl_candidate_disabled_by_enable_if : Note<
4515    "candidate template ignored: disabled by %0%1">;
4516def note_ovl_candidate_disabled_by_requirement : Note<
4517    "candidate template ignored: requirement '%0' was not satisfied%1">;
4518def note_ovl_candidate_has_pass_object_size_params: Note<
4519    "candidate address cannot be taken because parameter %0 has "
4520    "pass_object_size attribute">;
4521def err_diagnose_if_succeeded : Error<"%0">;
4522def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4523    ShowInSystemHeader;
4524def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4525    "candidate disabled: %0">;
4526def err_addrof_function_disabled_by_enable_if_attr : Error<
4527    "cannot take address of function %0 because it has one or more "
4528    "non-tautological enable_if conditions">;
4529def err_addrof_function_constraints_not_satisfied : Error<
4530    "cannot take address of function %0 because its constraints are not "
4531    "satisfied">;
4532def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4533    "candidate function made ineligible by enable_if">;
4534def note_ovl_candidate_deduced_mismatch : Note<
4535    "candidate template ignored: deduced type "
4536    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4537    "adjusted type $ of %select{|element of }4argument"
4538    "|of %select{|element of }4%ordinal0 parameter does not match "
4539    "adjusted type of %select{|element of }4argument}1,2%3">;
4540def note_ovl_candidate_non_deduced_mismatch : Note<
4541    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4542// This note is needed because the above note would sometimes print two
4543// different types with the same name.  Remove this note when the above note
4544// can handle that case properly.
4545def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4546    "candidate template ignored: could not match %q0 against %q1">;
4547
4548// Note that we don't treat templates differently for this diagnostic.
4549def note_ovl_candidate_arity : Note<"candidate "
4550    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4551    "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
4552    "%plural{1:was|:were}5 provided">;
4553
4554def note_ovl_candidate_arity_one : Note<"candidate "
4555    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4556    "%select{requires at least|allows at most single|requires single}3 "
4557    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4558
4559def note_ovl_candidate_deleted : Note<
4560    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4561    "%select{explicitly made unavailable|explicitly deleted|"
4562    "implicitly deleted}3">;
4563
4564// Giving the index of the bad argument really clutters this message, and
4565// it's relatively unimportant because 1) it's generally obvious which
4566// argument(s) are of the given object type and 2) the fix is usually
4567// to complete the type, which doesn't involve changes to the call line
4568// anyway.  If people complain, we can change it.
4569def note_ovl_candidate_bad_conv_incomplete : Note<
4570    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4571    "cannot convert argument of incomplete type "
4572    "%diff{$ to $|to parameter type}3,4 for "
4573    "%select{%ordinal6 argument|object argument}5"
4574    "%select{|; dereference the argument with *|"
4575    "; take the address of the argument with &|"
4576    "; remove *|"
4577    "; remove &}7">;
4578def note_ovl_candidate_bad_list_argument : Note<
4579    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4580    "%select{cannot convert initializer list|too few initializers in list"
4581    "|too many initializers in list}7 argument to %4">;
4582def note_ovl_candidate_bad_overload : Note<
4583    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4584    "no overload of %4 matching %3 for %ordinal5 argument">;
4585def note_ovl_candidate_bad_conv : Note<
4586    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4587    "no known conversion "
4588    "%diff{from $ to $|from argument type to parameter type}3,4 for "
4589    "%select{%ordinal6 argument|object argument}5"
4590    "%select{|; dereference the argument with *|"
4591    "; take the address of the argument with &|"
4592    "; remove *|"
4593    "; remove &}7">;
4594def note_ovl_candidate_bad_arc_conv : Note<
4595    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4596    "cannot implicitly convert argument "
4597    "%diff{of type $ to $|type to parameter type}3,4 for "
4598    "%select{%ordinal6 argument|object argument}5 under ARC">;
4599def note_ovl_candidate_bad_value_category : Note<
4600    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4601    "expects an %select{lvalue|rvalue}5 for "
4602    "%select{%ordinal4 argument|object argument}3">;
4603def note_ovl_candidate_bad_addrspace : Note<
4604    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4605    "cannot %select{pass pointer to|bind reference in}5 %3 "
4606    "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4607    "argument">;
4608def note_ovl_candidate_bad_addrspace_this : Note<
4609    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4610    "'this' object is in %3, but method expects object in %4">;
4611def note_ovl_candidate_bad_gc : Note<
4612    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4613    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4614    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4615def note_ovl_candidate_bad_ownership : Note<
4616    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4617    "%select{%ordinal7|'this'}6 argument (%3) has "
4618    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4619    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4620    "__autoreleasing}5 ownership">;
4621def note_ovl_candidate_bad_cvr_this : Note<
4622    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4623    "'this' argument has type %3, but method is not marked "
4624    "%select{const|restrict|const or restrict|volatile|const or volatile|"
4625    "volatile or restrict|const, volatile, or restrict}4">;
4626def note_ovl_candidate_bad_cvr : Note<
4627    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4628    "%ordinal5 argument (%3) would lose "
4629    "%select{const|restrict|const and restrict|volatile|const and volatile|"
4630    "volatile and restrict|const, volatile, and restrict}4 qualifier"
4631    "%select{||s||s|s|s}4">;
4632def note_ovl_candidate_bad_unaligned : Note<
4633    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4634    "%ordinal5 argument (%3) would lose __unaligned qualifier">;
4635def note_ovl_candidate_bad_base_to_derived_conv : Note<
4636    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4637    "cannot %select{convert from|convert from|bind}3 "
4638    "%select{base class pointer|superclass|base class object of type}3 %4 to "
4639    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4640    "%ordinal6 argument">;
4641def note_ovl_candidate_bad_target : Note<
4642    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4643    "call to "
4644    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4645    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4646def note_ovl_candidate_constraints_not_satisfied : Note<
4647    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4648    "not satisfied">;
4649def note_implicit_member_target_infer_collision : Note<
4650    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4651    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4652    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4653
4654def note_ambiguous_type_conversion: Note<
4655    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4656def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4657def err_ovl_no_viable_function_in_init : Error<
4658  "no matching constructor for initialization of %0">;
4659def err_ovl_no_conversion_in_cast : Error<
4660  "cannot convert %1 to %2 without a conversion operator">;
4661def err_ovl_no_viable_conversion_in_cast : Error<
4662  "no matching conversion for %select{|static_cast|reinterpret_cast|"
4663  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4664def err_ovl_ambiguous_conversion_in_cast : Error<
4665  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4666  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4667def err_ovl_deleted_conversion_in_cast : Error<
4668  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4669  "functional-style cast|}0 from %1 to %2 uses deleted function">;
4670def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4671def err_ref_init_ambiguous : Error<
4672  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4673def err_ovl_deleted_init : Error<
4674  "call to deleted constructor of %0">;
4675def err_ovl_deleted_special_init : Error<
4676  "call to implicitly-deleted %select{default constructor|copy constructor|"
4677  "move constructor|copy assignment operator|move assignment operator|"
4678  "destructor|function}0 of %1">;
4679def err_ovl_ambiguous_oper_unary : Error<
4680  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4681def err_ovl_ambiguous_oper_binary : Error<
4682  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4683def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4684  "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4685  "and %2) to be ambiguous despite there being a unique best viable function"
4686  "%select{ with non-reversed arguments|}3">,
4687  InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4688def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4689  "ambiguity is between a regular call to this operator and a call with the "
4690  "argument order reversed">;
4691def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4692  "candidate function with non-reversed arguments">;
4693def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4694  "ambiguous candidate function with reversed arguments">;
4695def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4696def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4697def err_ovl_deleted_oper : Error<
4698  "overload resolution selected deleted operator '%0'">;
4699def err_ovl_deleted_special_oper : Error<
4700  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4701  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4702  "implicitly deleted">;
4703def err_ovl_deleted_comparison : Error<
4704  "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4705def err_ovl_rewrite_equalequal_not_bool : Error<
4706  "return type %0 of selected 'operator==' function for rewritten "
4707  "'%1' comparison is not 'bool'">;
4708def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4709  "ISO C++20 requires return type of selected 'operator==' function for "
4710  "rewritten '%1' comparison to be 'bool', not %0">,
4711  InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4712def err_ovl_no_viable_subscript :
4713    Error<"no viable overloaded operator[] for type %0">;
4714def err_ovl_no_oper :
4715    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4716def err_ovl_unresolvable : Error<
4717  "reference to %select{overloaded|multiversioned}1 function could not be "
4718  "resolved; did you mean to call it%select{| with no arguments}0?">;
4719def err_bound_member_function : Error<
4720  "reference to non-static member function must be called"
4721  "%select{|; did you mean to call it with no arguments?}0">;
4722def note_possible_target_of_call : Note<"possible target for call">;
4723def err_no_viable_destructor : Error<
4724  "no viable destructor found for class %0">;
4725def err_ambiguous_destructor : Error<
4726  "destructor of class %0 is ambiguous">;
4727
4728def err_ovl_no_viable_object_call : Error<
4729  "no matching function for call to object of type %0">;
4730def err_ovl_ambiguous_object_call : Error<
4731  "call to object of type %0 is ambiguous">;
4732def err_ovl_ambiguous_subscript_call : Error<
4733  "call to subscript operator of type %0 is ambiguous">;
4734def err_ovl_deleted_object_call : Error<
4735  "call to deleted function call operator in type %0">;
4736def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4737def err_member_call_without_object : Error<
4738  "call to non-static member function without an object argument">;
4739
4740// C++ Address of Overloaded Function
4741def err_addr_ovl_no_viable : Error<
4742  "address of overloaded function %0 does not match required type %1">;
4743def err_addr_ovl_ambiguous : Error<
4744  "address of overloaded function %0 is ambiguous">;
4745def err_addr_ovl_not_func_ptrref : Error<
4746  "address of overloaded function %0 cannot be converted to type %1">;
4747def err_addr_ovl_no_qualifier : Error<
4748  "cannot form member pointer of type %0 without '&' and class name">;
4749
4750} // let Deferrable
4751
4752// C++11 Literal Operators
4753def err_ovl_no_viable_literal_operator : Error<
4754  "no matching literal operator for call to %0"
4755  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4756  "%select{| or 'const char *'}4"
4757  "%select{|, and no matching literal operator template}5">;
4758
4759// C++ Template Declarations
4760def err_template_param_shadow : Error<
4761  "declaration of %0 shadows template parameter">;
4762def ext_template_param_shadow : ExtWarn<
4763  err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
4764def note_template_param_here : Note<"template parameter is declared here">;
4765def warn_template_export_unsupported : Warning<
4766  "exported templates are unsupported">;
4767def err_template_outside_namespace_or_class_scope : Error<
4768  "templates can only be declared in namespace or class scope">;
4769def err_template_inside_local_class : Error<
4770  "templates cannot be declared inside of a local class">;
4771def err_template_linkage : Error<"templates must have C++ linkage">;
4772def err_template_typedef : Error<"a typedef cannot be a template">;
4773def err_template_unnamed_class : Error<
4774  "cannot declare a class template with no name">;
4775def err_template_param_list_different_arity : Error<
4776  "%select{too few|too many}0 template parameters in template "
4777  "%select{|template parameter }1redeclaration">;
4778def note_template_param_list_different_arity : Note<
4779  "%select{too few|too many}0 template parameters in template template "
4780  "argument">;
4781def note_template_prev_declaration : Note<
4782  "previous template %select{declaration|template parameter}0 is here">;
4783def err_template_param_different_kind : Error<
4784  "template parameter has a different kind in template "
4785  "%select{|template parameter }0redeclaration">;
4786def note_template_param_different_kind : Note<
4787  "template parameter has a different kind in template argument">;
4788
4789def err_invalid_decl_specifier_in_nontype_parm : Error<
4790  "invalid declaration specifier in template non-type parameter">;
4791
4792def err_template_nontype_parm_different_type : Error<
4793  "template non-type parameter has a different type %0 in template "
4794  "%select{|template parameter }1redeclaration">;
4795
4796def note_template_nontype_parm_different_type : Note<
4797  "template non-type parameter has a different type %0 in template argument">;
4798def note_template_nontype_parm_prev_declaration : Note<
4799  "previous non-type template parameter with type %0 is here">;
4800def err_template_nontype_parm_bad_type : Error<
4801  "a non-type template parameter cannot have type %0">;
4802def err_template_nontype_parm_bad_structural_type : Error<
4803  "a non-type template parameter cannot have type %0 before C++20">;
4804def err_template_nontype_parm_incomplete : Error<
4805  "non-type template parameter has incomplete type %0">;
4806def err_template_nontype_parm_not_literal : Error<
4807  "non-type template parameter has non-literal type %0">;
4808def err_template_nontype_parm_rvalue_ref : Error<
4809  "non-type template parameter has rvalue reference type %0">;
4810def err_template_nontype_parm_not_structural : Error<
4811  "type %0 of non-type template parameter is not a structural type">;
4812def note_not_structural_non_public : Note<
4813  "%0 is not a structural type because it has a "
4814  "%select{non-static data member|base class}1 that is not public">;
4815def note_not_structural_mutable_field : Note<
4816  "%0 is not a structural type because it has a mutable "
4817  "non-static data member">;
4818def note_not_structural_rvalue_ref_field : Note<
4819  "%0 is not a structural type because it has a non-static data member "
4820  "of rvalue reference type">;
4821def note_not_structural_subobject : Note<
4822  "%0 is not a structural type because it has a "
4823  "%select{non-static data member|base class}1 of non-structural type %2">;
4824def warn_cxx17_compat_template_nontype_parm_type : Warning<
4825  "non-type template parameter of type %0 is incompatible with "
4826  "C++ standards before C++20">,
4827  DefaultIgnore, InGroup<CXXPre20Compat>;
4828def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
4829  "non-type template parameters declared with %0 are incompatible with C++ "
4830  "standards before C++17">,
4831  DefaultIgnore, InGroup<CXXPre17Compat>;
4832def err_template_param_default_arg_redefinition : Error<
4833  "template parameter redefines default argument">;
4834def err_template_param_default_arg_inconsistent_redefinition : Error<
4835  "template parameter default argument is inconsistent with previous definition">;
4836def note_template_param_prev_default_arg : Note<
4837  "previous default template argument defined here">;
4838def note_template_param_prev_default_arg_in_other_module : Note<
4839  "previous default template argument defined in module %0">;
4840def err_template_param_default_arg_missing : Error<
4841  "template parameter missing a default argument">;
4842def ext_template_parameter_default_in_function_template : ExtWarn<
4843  "default template arguments for a function template are a C++11 extension">,
4844  InGroup<CXX11>;
4845def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
4846  "default template arguments for a function template are incompatible with C++98">,
4847  InGroup<CXX98Compat>, DefaultIgnore;
4848def err_template_parameter_default_template_member : Error<
4849  "cannot add a default template argument to the definition of a member of a "
4850  "class template">;
4851def err_template_parameter_default_friend_template : Error<
4852  "default template argument not permitted on a friend template">;
4853def err_template_template_parm_no_parms : Error<
4854  "template template parameter must have its own template parameters">;
4855
4856def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
4857  InGroup<CXX14>;
4858def warn_cxx11_compat_variable_template : Warning<
4859  "variable templates are incompatible with C++ standards before C++14">,
4860  InGroup<CXXPre14Compat>, DefaultIgnore;
4861def err_template_variable_noparams : Error<
4862  "extraneous 'template<>' in declaration of variable %0">;
4863def err_template_member : Error<"member %0 declared as a template">;
4864def err_member_with_template_arguments : Error<"member %0 cannot have template arguments">;
4865def err_template_member_noparams : Error<
4866  "extraneous 'template<>' in declaration of member %0">;
4867def err_template_tag_noparams : Error<
4868  "extraneous 'template<>' in declaration of %0 %1">;
4869
4870def warn_cxx17_compat_adl_only_template_id : Warning<
4871  "use of function template name with no prior function template "
4872  "declaration in function call with explicit template arguments "
4873  "is incompatible with C++ standards before C++20">,
4874  InGroup<CXXPre20Compat>, DefaultIgnore;
4875def ext_adl_only_template_id : ExtWarn<
4876  "use of function template name with no prior declaration in function call "
4877  "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
4878
4879def warn_unqualified_call_to_std_cast_function : Warning<
4880  "unqualified call to '%0'">, InGroup<DiagGroup<"unqualified-std-cast-call">>;
4881
4882// C++ Template Argument Lists
4883def err_template_missing_args : Error<
4884  "use of "
4885  "%select{class template|function template|variable template|alias template|"
4886  "template template parameter|concept|template}0 %1 requires template "
4887  "arguments">;
4888def err_template_arg_list_different_arity : Error<
4889  "%select{too few|too many}0 template arguments for "
4890  "%select{class template|function template|variable template|alias template|"
4891  "template template parameter|concept|template}1 %2">;
4892def note_template_decl_here : Note<"template is declared here">;
4893def err_template_arg_must_be_type : Error<
4894  "template argument for template type parameter must be a type">;
4895def err_template_arg_must_be_type_suggest : Error<
4896  "template argument for template type parameter must be a type; "
4897  "did you forget 'typename'?">;
4898def ext_ms_template_type_arg_missing_typename : ExtWarn<
4899  "template argument for template type parameter must be a type; "
4900  "omitted 'typename' is a Microsoft extension">,
4901  InGroup<MicrosoftTemplate>;
4902def err_template_arg_must_be_expr : Error<
4903  "template argument for non-type template parameter must be an expression">;
4904def err_template_arg_nontype_ambig : Error<
4905  "template argument for non-type template parameter is treated as function type %0">;
4906def err_template_arg_must_be_template : Error<
4907  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
4908def ext_template_arg_local_type : ExtWarn<
4909  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
4910def ext_template_arg_unnamed_type : ExtWarn<
4911  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
4912def warn_cxx98_compat_template_arg_local_type : Warning<
4913  "local type %0 as template argument is incompatible with C++98">,
4914  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
4915def warn_cxx98_compat_template_arg_unnamed_type : Warning<
4916  "unnamed type as template argument is incompatible with C++98">,
4917  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
4918def note_template_unnamed_type_here : Note<
4919  "unnamed type used in template argument was declared here">;
4920def err_template_arg_overload_type : Error<
4921  "template argument is the type of an unresolved overloaded function">;
4922def err_template_arg_not_valid_template : Error<
4923  "template argument does not refer to a class or alias template, or template "
4924  "template parameter">;
4925def note_template_arg_refers_here_func : Note<
4926  "template argument refers to function template %0, here">;
4927def err_template_arg_template_params_mismatch : Error<
4928  "template template argument has different template parameters than its "
4929  "corresponding template template parameter">;
4930def err_template_arg_not_integral_or_enumeral : Error<
4931  "non-type template argument of type %0 must have an integral or enumeration"
4932  " type">;
4933def err_template_arg_not_ice : Error<
4934  "non-type template argument of type %0 is not an integral constant "
4935  "expression">;
4936def err_template_arg_not_address_constant : Error<
4937  "non-type template argument of type %0 is not a constant expression">;
4938def warn_cxx98_compat_template_arg_null : Warning<
4939  "use of null pointer as non-type template argument is incompatible with "
4940  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4941def err_template_arg_untyped_null_constant : Error<
4942  "null non-type template argument must be cast to template parameter type %0">;
4943def err_template_arg_wrongtype_null_constant : Error<
4944  "null non-type template argument of type %0 does not match template parameter "
4945  "of type %1">;
4946def err_non_type_template_parm_type_deduction_failure : Error<
4947  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
4948def err_deduced_non_type_template_arg_type_mismatch : Error<
4949  "deduced non-type template argument does not have the same type as the "
4950  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
4951def err_non_type_template_arg_subobject : Error<
4952  "non-type template argument refers to subobject '%0'">;
4953def err_non_type_template_arg_addr_label_diff : Error<
4954  "template argument / label address difference / what did you expect?">;
4955def err_non_type_template_arg_unsupported : Error<
4956  "sorry, non-type template argument of type %0 is not yet supported">;
4957def err_template_arg_not_convertible : Error<
4958  "non-type template argument of type %0 cannot be converted to a value "
4959  "of type %1">;
4960def warn_template_arg_negative : Warning<
4961  "non-type template argument with value '%0' converted to '%1' for unsigned "
4962  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4963def warn_template_arg_too_large : Warning<
4964  "non-type template argument value '%0' truncated to '%1' for "
4965  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4966def err_template_arg_no_ref_bind : Error<
4967  "non-type template parameter of reference type "
4968  "%diff{$ cannot bind to template argument of type $"
4969  "|cannot bind to template of incompatible argument type}0,1">;
4970def err_template_arg_ref_bind_ignores_quals : Error<
4971  "reference binding of non-type template parameter "
4972  "%diff{of type $ to template argument of type $|to template argument}0,1 "
4973  "ignores qualifiers">;
4974def err_template_arg_not_decl_ref : Error<
4975  "non-type template argument does not refer to any declaration">;
4976def err_template_arg_not_address_of : Error<
4977  "non-type template argument for template parameter of pointer type %0 must "
4978  "have its address taken">;
4979def err_template_arg_address_of_non_pointer : Error<
4980  "address taken in non-type template argument for template parameter of "
4981  "reference type %0">;
4982def err_template_arg_reference_var : Error<
4983  "non-type template argument of reference type %0 is not an object">;
4984def err_template_arg_field : Error<
4985  "non-type template argument refers to non-static data member %0">;
4986def err_template_arg_method : Error<
4987  "non-type template argument refers to non-static member function %0">;
4988def err_template_arg_object_no_linkage : Error<
4989  "non-type template argument refers to %select{function|object}0 %1 that "
4990  "does not have linkage">;
4991def warn_cxx98_compat_template_arg_object_internal : Warning<
4992  "non-type template argument referring to %select{function|object}0 %1 with "
4993  "internal linkage is incompatible with C++98">,
4994  InGroup<CXX98Compat>, DefaultIgnore;
4995def ext_template_arg_object_internal : ExtWarn<
4996  "non-type template argument referring to %select{function|object}0 %1 with "
4997  "internal linkage is a C++11 extension">, InGroup<CXX11>;
4998def err_template_arg_thread_local : Error<
4999  "non-type template argument refers to thread-local object">;
5000def note_template_arg_internal_object : Note<
5001  "non-type template argument refers to %select{function|object}0 here">;
5002def note_template_arg_refers_here : Note<
5003  "non-type template argument refers here">;
5004def err_template_arg_not_object_or_func : Error<
5005  "non-type template argument does not refer to an object or function">;
5006def err_template_arg_not_pointer_to_member_form : Error<
5007  "non-type template argument is not a pointer to member constant">;
5008def err_template_arg_member_ptr_base_derived_not_supported : Error<
5009  "sorry, non-type template argument of pointer-to-member type %1 that refers "
5010  "to member %q0 of a different class is not supported yet">;
5011def ext_template_arg_extra_parens : ExtWarn<
5012  "address non-type template argument cannot be surrounded by parentheses">;
5013def warn_cxx98_compat_template_arg_extra_parens : Warning<
5014  "redundant parentheses surrounding address non-type template argument are "
5015  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5016def err_pointer_to_member_type : Error<
5017  "invalid use of pointer to member type after %select{.*|->*}0">;
5018def err_pointer_to_member_call_drops_quals : Error<
5019  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
5020def err_pointer_to_member_oper_value_classify: Error<
5021  "pointer-to-member function type %0 can only be called on an "
5022  "%select{rvalue|lvalue}1">;
5023def ext_pointer_to_const_ref_member_on_rvalue : Extension<
5024  "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
5025  InGroup<CXX20>, SFINAEFailure;
5026def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
5027  "invoking a pointer to a 'const &' member function on an rvalue is "
5028  "incompatible with C++ standards before C++20">,
5029  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
5030def ext_ms_deref_template_argument: ExtWarn<
5031  "non-type template argument containing a dereference operation is a "
5032  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5033def ext_ms_delayed_template_argument: ExtWarn<
5034  "using the undeclared type %0 as a default template argument is a "
5035  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5036def err_template_arg_deduced_incomplete_pack : Error<
5037  "deduced incomplete pack %0 for template parameter %1">;
5038
5039// C++ template specialization
5040def err_template_spec_unknown_kind : Error<
5041  "can only provide an explicit specialization for a class template, function "
5042  "template, variable template, or a member function, static data member, "
5043  "%select{or member class|member class, or member enumeration}0 of a "
5044  "class template">;
5045def note_specialized_entity : Note<
5046  "explicitly specialized declaration is here">;
5047def err_template_spec_decl_function_scope : Error<
5048  "explicit specialization of %0 in function scope">;
5049def err_template_spec_decl_friend : Error<
5050  "cannot declare an explicit specialization in a friend">;
5051def err_template_spec_redecl_out_of_scope : Error<
5052  "%select{class template|class template partial|variable template|"
5053  "variable template partial|function template|member "
5054  "function|static data member|member class|member enumeration}0 "
5055  "specialization of %1 not in %select{a namespace enclosing %2|"
5056  "class %2 or an enclosing namespace}3">;
5057def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
5058  "%select{class template|class template partial|variable template|"
5059  "variable template partial|function template|member "
5060  "function|static data member|member class|member enumeration}0 "
5061  "specialization of %1 not in %select{a namespace enclosing %2|"
5062  "class %2 or an enclosing namespace}3 "
5063  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
5064def err_template_spec_redecl_global_scope : Error<
5065  "%select{class template|class template partial|variable template|"
5066  "variable template partial|function template|member "
5067  "function|static data member|member class|member enumeration}0 "
5068  "specialization of %1 must occur at global scope">;
5069def err_spec_member_not_instantiated : Error<
5070  "specialization of member %q0 does not specialize an instantiated member">;
5071def note_specialized_decl : Note<"attempt to specialize declaration here">;
5072def err_specialization_after_instantiation : Error<
5073  "explicit specialization of %0 after instantiation">;
5074def note_instantiation_required_here : Note<
5075  "%select{implicit|explicit}0 instantiation first required here">;
5076def err_template_spec_friend : Error<
5077  "template specialization declaration cannot be a friend">;
5078def err_template_spec_default_arg : Error<
5079  "default argument not permitted on an explicit "
5080  "%select{instantiation|specialization}0 of function %1">;
5081def err_not_class_template_specialization : Error<
5082  "cannot specialize a %select{dependent template|template template "
5083  "parameter}0">;
5084def ext_explicit_specialization_storage_class : ExtWarn<
5085  "explicit specialization cannot have a storage class">;
5086def err_explicit_specialization_inconsistent_storage_class : Error<
5087  "explicit specialization has extraneous, inconsistent storage class "
5088  "'%select{none|extern|static|__private_extern__|auto|register}0'">;
5089def err_dependent_function_template_spec_no_match : Error<
5090  "no candidate function template was found for dependent"
5091  " friend function template specialization">;
5092def note_dependent_function_template_spec_discard_reason : Note<
5093  "candidate ignored: %select{not a function template"
5094  "|not a member of the enclosing namespace;"
5095  " did you mean to explicitly qualify the specialization?}0">;
5096
5097// C++ class template specializations and out-of-line definitions
5098def err_template_spec_needs_header : Error<
5099  "template specialization requires 'template<>'">;
5100def err_template_spec_needs_template_parameters : Error<
5101  "template specialization or definition requires a template parameter list "
5102  "corresponding to the nested type %0">;
5103def err_template_param_list_matches_nontemplate : Error<
5104  "template parameter list matching the non-templated nested type %0 should "
5105  "be empty ('template<>')">;
5106def err_alias_template_extra_headers : Error<
5107  "extraneous template parameter list in alias template declaration">;
5108def err_template_spec_extra_headers : Error<
5109  "extraneous template parameter list in template specialization or "
5110  "out-of-line template definition">;
5111def warn_template_spec_extra_headers : Warning<
5112  "extraneous template parameter list in template specialization">;
5113def note_explicit_template_spec_does_not_need_header : Note<
5114  "'template<>' header not required for explicitly-specialized class %0 "
5115  "declared here">;
5116def err_template_qualified_declarator_no_match : Error<
5117  "nested name specifier '%0' for declaration does not refer into a class, "
5118  "class template or class template partial specialization">;
5119def err_specialize_member_of_template : Error<
5120  "cannot specialize %select{|(with 'template<>') }0a member of an "
5121  "unspecialized template">;
5122
5123// C++ Class Template Partial Specialization
5124def err_default_arg_in_partial_spec : Error<
5125    "default template argument in a class template partial specialization">;
5126def err_dependent_non_type_arg_in_partial_spec : Error<
5127    "type of specialized non-type template argument depends on a template "
5128    "parameter of the partial specialization">;
5129def note_dependent_non_type_default_arg_in_partial_spec : Note<
5130    "template parameter is used in default argument declared here">;
5131def err_dependent_typed_non_type_arg_in_partial_spec : Error<
5132    "non-type template argument specializes a template parameter with "
5133    "dependent type %0">;
5134def err_partial_spec_args_match_primary_template : Error<
5135    "%select{class|variable}0 template partial specialization does not "
5136    "specialize any template argument; to %select{declare|define}1 the "
5137    "primary template, remove the template argument list">;
5138def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
5139    "%select{class|variable}0 template partial specialization is not "
5140    "more specialized than the primary template">, DefaultError,
5141    InGroup<DiagGroup<"invalid-partial-specialization">>;
5142def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
5143def ext_partial_specs_not_deducible : ExtWarn<
5144    "%select{class|variable}0 template partial specialization contains "
5145    "%select{a template parameter|template parameters}1 that cannot be "
5146    "deduced; this partial specialization will never be used">,
5147    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
5148def note_non_deducible_parameter : Note<
5149    "non-deducible template parameter %0">;
5150def err_partial_spec_ordering_ambiguous : Error<
5151    "ambiguous partial specializations of %0">;
5152def note_partial_spec_match : Note<"partial specialization matches %0">;
5153def err_partial_spec_redeclared : Error<
5154  "class template partial specialization %0 cannot be redeclared">;
5155def note_prev_partial_spec_here : Note<
5156  "previous declaration of class template partial specialization %0 is here">;
5157def err_partial_spec_fully_specialized : Error<
5158  "partial specialization of %0 does not use any of its template parameters">;
5159
5160// C++ Variable Template Partial Specialization
5161def err_var_partial_spec_redeclared : Error<
5162  "variable template partial specialization %0 cannot be redefined">;
5163def note_var_prev_partial_spec_here : Note<
5164  "previous declaration of variable template partial specialization is here">;
5165def err_var_spec_no_template : Error<
5166  "no variable template matches%select{| partial}0 specialization">;
5167def err_var_spec_no_template_but_method : Error<
5168  "no variable template matches specialization; "
5169  "did you mean to use %0 as function template instead?">;
5170
5171// C++ Function template specializations
5172def err_function_template_spec_no_match : Error<
5173    "no function template matches function template specialization %0">;
5174def err_function_template_spec_ambiguous : Error<
5175    "function template specialization %0 ambiguously refers to more than one "
5176    "function template; explicitly specify%select{| additional}1 template "
5177    "arguments to identify a particular function template">;
5178def note_function_template_spec_matched : Note<
5179    "function template %q0 matches specialization %1">;
5180def err_function_template_partial_spec : Error<
5181    "function template partial specialization is not allowed">;
5182
5183// C++ Template Instantiation
5184def err_template_recursion_depth_exceeded : Error<
5185  "recursive template instantiation exceeded maximum depth of %0">,
5186  DefaultFatal, NoSFINAE;
5187def note_template_recursion_depth : Note<
5188  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
5189
5190def err_template_instantiate_within_definition : Error<
5191  "%select{implicit|explicit}0 instantiation of template %1 within its"
5192  " own definition">;
5193def err_template_instantiate_undefined : Error<
5194  "%select{implicit|explicit}0 instantiation of undefined template %1">;
5195def err_implicit_instantiate_member_undefined : Error<
5196  "implicit instantiation of undefined member %0">;
5197def note_template_class_instantiation_was_here : Note<
5198  "class template %0 was instantiated here">;
5199def note_template_class_explicit_specialization_was_here : Note<
5200  "class template %0 was explicitly specialized here">;
5201def note_template_class_instantiation_here : Note<
5202  "in instantiation of template class %q0 requested here">;
5203def note_template_member_class_here : Note<
5204  "in instantiation of member class %q0 requested here">;
5205def note_template_member_function_here : Note<
5206  "in instantiation of member function %q0 requested here">;
5207def note_function_template_spec_here : Note<
5208  "in instantiation of function template specialization %q0 requested here">;
5209def note_template_static_data_member_def_here : Note<
5210  "in instantiation of static data member %q0 requested here">;
5211def note_template_variable_def_here : Note<
5212  "in instantiation of variable template specialization %q0 requested here">;
5213def note_template_enum_def_here : Note<
5214  "in instantiation of enumeration %q0 requested here">;
5215def note_template_nsdmi_here : Note<
5216  "in instantiation of default member initializer %q0 requested here">;
5217def note_template_type_alias_instantiation_here : Note<
5218  "in instantiation of template type alias %0 requested here">;
5219def note_template_exception_spec_instantiation_here : Note<
5220  "in instantiation of exception specification for %0 requested here">;
5221def note_template_requirement_instantiation_here : Note<
5222  "in instantiation of requirement here">;
5223def warn_var_template_missing : Warning<"instantiation of variable %q0 "
5224  "required here, but no definition is available">,
5225  InGroup<UndefinedVarTemplate>;
5226def warn_func_template_missing : Warning<"instantiation of function %q0 "
5227  "required here, but no definition is available">,
5228  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
5229def note_forward_template_decl : Note<
5230  "forward declaration of template entity is here">;
5231def note_inst_declaration_hint : Note<"add an explicit instantiation "
5232  "declaration to suppress this warning if %q0 is explicitly instantiated in "
5233  "another translation unit">;
5234def note_evaluating_exception_spec_here : Note<
5235  "in evaluation of exception specification for %q0 needed here">;
5236
5237def note_default_arg_instantiation_here : Note<
5238  "in instantiation of default argument for '%0' required here">;
5239def note_default_function_arg_instantiation_here : Note<
5240  "in instantiation of default function argument expression "
5241  "for '%0' required here">;
5242def note_explicit_template_arg_substitution_here : Note<
5243  "while substituting explicitly-specified template arguments into function "
5244  "template %0 %1">;
5245def note_function_template_deduction_instantiation_here : Note<
5246  "while substituting deduced template arguments into function template %0 "
5247  "%1">;
5248def note_deduced_template_arg_substitution_here : Note<
5249  "during template argument deduction for %select{class|variable}0 template "
5250  "%select{partial specialization |}1%2 %3">;
5251def note_prior_template_arg_substitution : Note<
5252  "while substituting prior template arguments into %select{non-type|template}0"
5253  " template parameter%1 %2">;
5254def note_template_default_arg_checking : Note<
5255  "while checking a default template argument used here">;
5256def note_concept_specialization_here : Note<
5257  "while checking the satisfaction of concept '%0' requested here">;
5258def note_nested_requirement_here : Note<
5259  "while checking the satisfaction of nested requirement requested here">;
5260def note_checking_constraints_for_template_id_here : Note<
5261  "while checking constraint satisfaction for template '%0' required here">;
5262def note_checking_constraints_for_var_spec_id_here : Note<
5263  "while checking constraint satisfaction for variable template "
5264  "partial specialization '%0' required here">;
5265def note_checking_constraints_for_class_spec_id_here : Note<
5266  "while checking constraint satisfaction for class template partial "
5267  "specialization '%0' required here">;
5268def note_checking_constraints_for_function_here : Note<
5269  "while checking constraint satisfaction for function '%0' required here">;
5270def note_constraint_substitution_here : Note<
5271  "while substituting template arguments into constraint expression here">;
5272def note_constraint_normalization_here : Note<
5273  "while calculating associated constraint of template '%0' here">;
5274def note_parameter_mapping_substitution_here : Note<
5275  "while substituting into concept arguments here; substitution failures not "
5276  "allowed in concept arguments">;
5277def note_instantiation_contexts_suppressed : Note<
5278  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
5279  "see all)">;
5280
5281def err_field_instantiates_to_function : Error<
5282  "data member instantiated with function type %0">;
5283def err_variable_instantiates_to_function : Error<
5284  "%select{variable|static data member}0 instantiated with function type %1">;
5285def err_nested_name_spec_non_tag : Error<
5286  "type %0 cannot be used prior to '::' because it has no members">;
5287
5288def err_using_pack_expansion_empty : Error<
5289  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
5290
5291// C++ Explicit Instantiation
5292def err_explicit_instantiation_duplicate : Error<
5293    "duplicate explicit instantiation of %0">;
5294def ext_explicit_instantiation_duplicate : ExtWarn<
5295    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
5296    InGroup<MicrosoftTemplate>;
5297def note_previous_explicit_instantiation : Note<
5298    "previous explicit instantiation is here">;
5299def warn_explicit_instantiation_after_specialization : Warning<
5300  "explicit instantiation of %0 that occurs after an explicit "
5301  "specialization has no effect">,
5302  InGroup<DiagGroup<"instantiation-after-specialization">>;
5303def note_previous_template_specialization : Note<
5304    "previous template specialization is here">;
5305def err_explicit_instantiation_nontemplate_type : Error<
5306    "explicit instantiation of non-templated type %0">;
5307def note_nontemplate_decl_here : Note<
5308    "non-templated declaration is here">;
5309def err_explicit_instantiation_in_class : Error<
5310  "explicit instantiation of %0 in class scope">;
5311def err_explicit_instantiation_out_of_scope : Error<
5312  "explicit instantiation of %0 not in a namespace enclosing %1">;
5313def err_explicit_instantiation_must_be_global : Error<
5314  "explicit instantiation of %0 must occur at global scope">;
5315def warn_explicit_instantiation_out_of_scope_0x : Warning<
5316  "explicit instantiation of %0 not in a namespace enclosing %1">,
5317  InGroup<CXX11Compat>, DefaultIgnore;
5318def warn_explicit_instantiation_must_be_global_0x : Warning<
5319  "explicit instantiation of %0 must occur at global scope">,
5320  InGroup<CXX11Compat>, DefaultIgnore;
5321
5322def err_explicit_instantiation_requires_name : Error<
5323  "explicit instantiation declaration requires a name">;
5324def err_explicit_instantiation_of_typedef : Error<
5325  "explicit instantiation of typedef %0">;
5326def err_explicit_instantiation_storage_class : Error<
5327  "explicit instantiation cannot have a storage class">;
5328def err_explicit_instantiation_internal_linkage : Error<
5329  "explicit instantiation declaration of %0 with internal linkage">;
5330def err_explicit_instantiation_not_known : Error<
5331  "explicit instantiation of %0 does not refer to a function template, "
5332  "variable template, member function, member class, or static data member">;
5333def note_explicit_instantiation_here : Note<
5334  "explicit instantiation refers here">;
5335def err_explicit_instantiation_data_member_not_instantiated : Error<
5336  "explicit instantiation refers to static data member %q0 that is not an "
5337  "instantiation">;
5338def err_explicit_instantiation_member_function_not_instantiated : Error<
5339  "explicit instantiation refers to member function %q0 that is not an "
5340  "instantiation">;
5341def err_explicit_instantiation_ambiguous : Error<
5342  "partial ordering for explicit instantiation of %0 is ambiguous">;
5343def note_explicit_instantiation_candidate : Note<
5344  "explicit instantiation candidate function %q0 template here %1">;
5345def err_explicit_instantiation_inline : Error<
5346  "explicit instantiation cannot be 'inline'">;
5347def warn_explicit_instantiation_inline_0x : Warning<
5348  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5349  DefaultIgnore;
5350def err_explicit_instantiation_constexpr : Error<
5351  "explicit instantiation cannot be 'constexpr'">;
5352def ext_explicit_instantiation_without_qualified_id : Extension<
5353  "qualifier in explicit instantiation of %q0 requires a template-id "
5354  "(a typedef is not permitted)">;
5355def err_explicit_instantiation_without_template_id : Error<
5356  "explicit instantiation of %q0 must specify a template argument list">;
5357def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5358  "explicit instantiation of %q0 must occur in namespace %1">;
5359def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5360  "explicit instantiation of %q0 must occur in namespace %1">,
5361  InGroup<CXX11Compat>, DefaultIgnore;
5362def err_explicit_instantiation_undefined_member : Error<
5363  "explicit instantiation of undefined %select{member class|member function|"
5364  "static data member}0 %1 of class template %2">;
5365def err_explicit_instantiation_undefined_func_template : Error<
5366  "explicit instantiation of undefined function template %0">;
5367def err_explicit_instantiation_undefined_var_template : Error<
5368  "explicit instantiation of undefined variable template %q0">;
5369def err_explicit_instantiation_declaration_after_definition : Error<
5370  "explicit instantiation declaration (with 'extern') follows explicit "
5371  "instantiation definition (without 'extern')">;
5372def note_explicit_instantiation_definition_here : Note<
5373  "explicit instantiation definition is here">;
5374def err_invalid_var_template_spec_type : Error<"type %2 "
5375  "of %select{explicit instantiation|explicit specialization|"
5376  "partial specialization|redeclaration}0 of %1 does not match"
5377  " expected type %3">;
5378def err_mismatched_exception_spec_explicit_instantiation : Error<
5379  "exception specification in explicit instantiation does not match "
5380  "instantiated one">;
5381def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5382  err_mismatched_exception_spec_explicit_instantiation.Text>,
5383  InGroup<MicrosoftExceptionSpec>;
5384def err_explicit_instantiation_dependent : Error<
5385  "explicit instantiation has dependent template arguments">;
5386
5387// C++ typename-specifiers
5388def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5389def err_typename_nested_not_found_enable_if : Error<
5390  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5391  "this declaration">;
5392def err_typename_nested_not_found_requirement : Error<
5393  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5394  "declaration">;
5395def err_typename_nested_not_type : Error<
5396    "typename specifier refers to non-type member %0 in %1">;
5397def err_typename_not_type : Error<
5398    "typename specifier refers to non-type %0">;
5399def note_typename_member_refers_here : Note<
5400    "referenced member %0 is declared here">;
5401def note_typename_refers_here : Note<
5402    "referenced %0 is declared here">;
5403def err_typename_missing : Error<
5404  "missing 'typename' prior to dependent type name '%0%1'">;
5405def err_typename_missing_template : Error<
5406  "missing 'typename' prior to dependent type template name '%0%1'">;
5407def ext_typename_missing : ExtWarn<
5408  "missing 'typename' prior to dependent type name '%0%1'">,
5409  InGroup<DiagGroup<"typename-missing">>;
5410def ext_typename_outside_of_template : ExtWarn<
5411  "'typename' occurs outside of a template">, InGroup<CXX11>;
5412def warn_cxx98_compat_typename_outside_of_template : Warning<
5413  "use of 'typename' outside of a template is incompatible with C++98">,
5414  InGroup<CXX98Compat>, DefaultIgnore;
5415def err_typename_refers_to_using_value_decl : Error<
5416  "typename specifier refers to a dependent using declaration for a value "
5417  "%0 in %1">;
5418def note_using_value_decl_missing_typename : Note<
5419  "add 'typename' to treat this using declaration as a type">;
5420
5421def err_template_kw_refers_to_non_template : Error<
5422  "%0%select{| following the 'template' keyword}1 "
5423  "does not refer to a template">;
5424def note_template_kw_refers_to_non_template : Note<
5425  "declared as a non-template here">;
5426def err_template_kw_refers_to_dependent_non_template : Error<
5427  "%0%select{| following the 'template' keyword}1 "
5428  "cannot refer to a dependent template">;
5429def err_template_kw_refers_to_class_template : Error<
5430  "'%0%1' instantiated to a class template, not a function template">;
5431def note_referenced_class_template : Note<
5432  "class template declared here">;
5433def err_template_kw_missing : Error<
5434  "missing 'template' keyword prior to dependent template name '%0%1'">;
5435def ext_template_outside_of_template : ExtWarn<
5436  "'template' keyword outside of a template">, InGroup<CXX11>;
5437def warn_cxx98_compat_template_outside_of_template : Warning<
5438  "use of 'template' keyword outside of a template is incompatible with C++98">,
5439  InGroup<CXX98Compat>, DefaultIgnore;
5440
5441def err_non_type_template_in_nested_name_specifier : Error<
5442  "qualified name refers into a specialization of %select{function|variable}0 "
5443  "template %1">;
5444def err_template_id_not_a_type : Error<
5445  "template name refers to non-type template %0">;
5446def note_template_declared_here : Note<
5447  "%select{function template|class template|variable template"
5448  "|type alias template|template template parameter}0 "
5449  "%1 declared here">;
5450def err_template_expansion_into_fixed_list : Error<
5451  "pack expansion used as argument for non-pack parameter of %select{alias "
5452  "template|concept}0">;
5453def note_parameter_type : Note<
5454  "parameter of type %0 is declared here">;
5455
5456// C++11 Variadic Templates
5457def err_template_param_pack_default_arg : Error<
5458  "template parameter pack cannot have a default argument">;
5459def err_template_param_pack_must_be_last_template_parameter : Error<
5460  "template parameter pack must be the last template parameter">;
5461
5462def err_template_parameter_pack_non_pack : Error<
5463  "%select{template type|non-type template|template template}0 parameter"
5464  "%select{| pack}1 conflicts with previous %select{template type|"
5465  "non-type template|template template}0 parameter%select{ pack|}1">;
5466def note_template_parameter_pack_non_pack : Note<
5467  "%select{template type|non-type template|template template}0 parameter"
5468  "%select{| pack}1 does not match %select{template type|non-type template"
5469  "|template template}0 parameter%select{ pack|}1 in template argument">;
5470def note_template_parameter_pack_here : Note<
5471  "previous %select{template type|non-type template|template template}0 "
5472  "parameter%select{| pack}1 declared here">;
5473
5474def err_unexpanded_parameter_pack : Error<
5475  "%select{expression|base type|declaration type|data member type|bit-field "
5476  "size|static assertion|fixed underlying type|enumerator value|"
5477  "using declaration|friend declaration|qualifier|initializer|default argument|"
5478  "non-type template parameter type|exception type|partial specialization|"
5479  "__if_exists name|__if_not_exists name|lambda|block|type constraint|"
5480  "requirement|requires clause}0 "
5481  "contains%plural{0: an|:}1 unexpanded parameter pack"
5482  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5483
5484def err_pack_expansion_without_parameter_packs : Error<
5485  "pack expansion does not contain any unexpanded parameter packs">;
5486def err_pack_expansion_length_conflict : Error<
5487  "pack expansion contains parameter packs %0 and %1 that have different "
5488  "lengths (%2 vs. %3)">;
5489def err_pack_expansion_length_conflict_multilevel : Error<
5490  "pack expansion contains parameter pack %0 that has a different "
5491  "length (%1 vs. %2) from outer parameter packs">;
5492def err_pack_expansion_length_conflict_partial : Error<
5493  "pack expansion contains parameter pack %0 that has a different "
5494  "length (at least %1 vs. %2) from outer parameter packs">;
5495def err_pack_expansion_member_init : Error<
5496  "pack expansion for initialization of member %0">;
5497
5498def err_function_parameter_pack_without_parameter_packs : Error<
5499  "type %0 of function parameter pack does not contain any unexpanded "
5500  "parameter packs">;
5501def err_ellipsis_in_declarator_not_parameter : Error<
5502  "only function and template parameters can be parameter packs">;
5503
5504def err_sizeof_pack_no_pack_name : Error<
5505  "%0 does not refer to the name of a parameter pack">;
5506
5507def err_fold_expression_packs_both_sides : Error<
5508  "binary fold expression has unexpanded parameter packs in both operands">;
5509def err_fold_expression_empty : Error<
5510  "unary fold expression has empty expansion for operator '%0' "
5511  "with no fallback value">;
5512def err_fold_expression_bad_operand : Error<
5513  "expression not permitted as operand of fold expression">;
5514def err_fold_expression_limit_exceeded: Error<
5515  "instantiating fold expression with %0 arguments exceeded expression nesting "
5516  "limit of %1">, DefaultFatal, NoSFINAE;
5517
5518def err_unexpected_typedef : Error<
5519  "unexpected type name %0: expected expression">;
5520def err_unexpected_namespace : Error<
5521  "unexpected namespace name %0: expected expression">;
5522def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5523def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5524  "use of undeclared identifier %0; "
5525  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5526  InGroup<MicrosoftTemplate>;
5527def err_found_in_dependent_base : Error<
5528  "explicit qualification required to use member %0 from dependent base class">;
5529def ext_found_in_dependent_base : ExtWarn<"use of member %0 "
5530  "found via unqualified lookup into dependent bases of class templates is a "
5531  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5532def err_found_later_in_class : Error<"member %0 used before its declaration">;
5533def ext_found_later_in_class : ExtWarn<
5534  "use of member %0 before its declaration is a Microsoft extension">,
5535  InGroup<MicrosoftTemplate>;
5536def ext_unqualified_base_class : ExtWarn<
5537  "unqualified base initializer of class templates is a Microsoft extension">,
5538  InGroup<MicrosoftTemplate>;
5539def note_dependent_member_use : Note<
5540  "must qualify identifier to find this declaration in dependent base class">;
5541def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5542    "visible in the template definition nor found by argument-dependent lookup">;
5543def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5544    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5545def err_undeclared_use : Error<"use of undeclared %0">;
5546def warn_deprecated : Warning<"%0 is deprecated">,
5547    InGroup<DeprecatedDeclarations>;
5548def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5549def warn_property_method_deprecated :
5550    Warning<"property access is using %0 method which is deprecated">,
5551    InGroup<DeprecatedDeclarations>;
5552def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5553    InGroup<DeprecatedDeclarations>;
5554def warn_deprecated_anonymous_namespace : Warning<
5555  "'deprecated' attribute on anonymous namespace ignored">,
5556  InGroup<IgnoredAttributes>;
5557def warn_deprecated_fwdclass_message : Warning<
5558    "%0 may be deprecated because the receiver type is unknown">,
5559    InGroup<DeprecatedDeclarations>;
5560def warn_deprecated_def : Warning<
5561  "implementing deprecated %select{method|class|category}0">,
5562  InGroup<DeprecatedImplementations>, DefaultIgnore;
5563def warn_unavailable_def : Warning<
5564  "implementing unavailable method">,
5565  InGroup<DeprecatedImplementations>, DefaultIgnore;
5566def warn_deprecated_builtin : Warning<
5567  "builtin %0 is deprecated; use %1 instead">,
5568  InGroup<DeprecatedBuiltins>;
5569def err_unavailable : Error<"%0 is unavailable">;
5570def err_property_method_unavailable :
5571    Error<"property access is using %0 method which is unavailable">;
5572def err_unavailable_message : Error<"%0 is unavailable: %1">;
5573def warn_unavailable_fwdclass_message : Warning<
5574    "%0 may be unavailable because the receiver type is unknown">,
5575    InGroup<UnavailableDeclarations>;
5576def note_availability_specified_here : Note<
5577  "%0 has been explicitly marked "
5578  "%select{unavailable|deleted|deprecated}1 here">;
5579def note_partial_availability_specified_here : Note<
5580  "%0 has been marked as being introduced in %1 %2 here, "
5581  "but the deployment target is %1 %3">;
5582def note_implicitly_deleted : Note<
5583  "explicitly defaulted function was implicitly deleted here">;
5584def warn_not_enough_argument : Warning<
5585  "not enough variable arguments in %0 declaration to fit a sentinel">,
5586  InGroup<Sentinel>;
5587def warn_missing_sentinel : Warning <
5588  "missing sentinel in %select{function call|method dispatch|block call}0">,
5589  InGroup<Sentinel>;
5590def note_sentinel_here : Note<
5591  "%select{function|method|block}0 has been explicitly marked sentinel here">;
5592def warn_strict_uses_without_prototype : Warning<
5593  "passing arguments to %select{a function|%1}0 without a prototype is "
5594  "deprecated in all versions of C and is not supported in C2x">,
5595  InGroup<DeprecatedNonPrototype>;
5596def warn_missing_prototype : Warning<
5597  "no previous prototype for function %0">,
5598  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5599def note_declaration_not_a_prototype : Note<
5600  "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5601  "to make it %select{a prototype for a zero-parameter function|one}0">;
5602// This is not actually an extension, but we only want it to be enabled in
5603// -pedantic mode and this is the most direct way of accomplishing that.
5604def warn_strict_prototypes : Extension<
5605  "a %select{function|block}0 declaration without a prototype is deprecated "
5606  "%select{in all versions of C|}0">, InGroup<StrictPrototypes>;
5607def warn_non_prototype_changes_behavior : Warning<
5608  "a function %select{declaration|definition}0 without a prototype is "
5609  "deprecated in all versions of C %select{and is not supported in C2x|and is "
5610  "treated as a zero-parameter prototype in C2x, conflicting with a "
5611  "%select{previous|subsequent}2 %select{declaration|definition}3}1">,
5612  InGroup<DeprecatedNonPrototype>;
5613def note_conflicting_prototype : Note<"conflicting prototype is here">;
5614def warn_missing_variable_declarations : Warning<
5615  "no previous extern declaration for non-static variable %0">,
5616  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5617def note_static_for_internal_linkage : Note<
5618  "declare 'static' if the %select{variable|function}0 is not intended to be "
5619  "used outside of this translation unit">;
5620def err_static_data_member_reinitialization :
5621  Error<"static data member %0 already has an initializer">;
5622def err_redefinition : Error<"redefinition of %0">;
5623def err_alias_after_tentative :
5624  Error<"alias definition of %0 after tentative definition">;
5625def err_alias_is_definition :
5626  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5627def err_definition_of_implicitly_declared_member : Error<
5628  "definition of implicitly declared %select{default constructor|copy "
5629  "constructor|move constructor|copy assignment operator|move assignment "
5630  "operator|destructor|function}1">;
5631def err_definition_of_explicitly_defaulted_member : Error<
5632  "definition of explicitly defaulted %select{default constructor|copy "
5633  "constructor|move constructor|copy assignment operator|move assignment "
5634  "operator|destructor|function}0">;
5635def err_redefinition_extern_inline : Error<
5636  "redefinition of a 'extern inline' function %0 is not supported in "
5637  "%select{C99 mode|C++}1">;
5638def warn_attr_abi_tag_namespace : Warning<
5639  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5640  InGroup<IgnoredAttributes>;
5641def err_abi_tag_on_redeclaration : Error<
5642  "cannot add 'abi_tag' attribute in a redeclaration">;
5643def err_new_abi_tag_on_redeclaration : Error<
5644  "'abi_tag' %0 missing in original declaration">;
5645def note_use_ifdef_guards : Note<
5646  "unguarded header; consider using #ifdef guards or #pragma once">;
5647
5648def note_deleted_dtor_no_operator_delete : Note<
5649  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5650def note_deleted_special_member_class_subobject : Note<
5651  "%select{default constructor of|copy constructor of|move constructor of|"
5652  "copy assignment operator of|move assignment operator of|destructor of|"
5653  "constructor inherited by}0 "
5654  "%1 is implicitly deleted because "
5655  "%select{base class %3|%select{||||variant }4field %3}2 "
5656  "%select{has "
5657  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5658  "%select{%select{default constructor|copy constructor|move constructor|copy "
5659  "assignment operator|move assignment operator|destructor|"
5660  "%select{default|corresponding|default|default|default}4 constructor}0|"
5661  "destructor}5"
5662  "%select{||s||}4"
5663  "|is an ObjC pointer}6">;
5664def note_deleted_default_ctor_uninit_field : Note<
5665  "%select{default constructor of|constructor inherited by}0 "
5666  "%1 is implicitly deleted because field %2 of "
5667  "%select{reference|const-qualified}4 type %3 would not be initialized">;
5668def note_deleted_default_ctor_all_const : Note<
5669  "%select{default constructor of|constructor inherited by}0 "
5670  "%1 is implicitly deleted because all "
5671  "%select{data members|data members of an anonymous union member}2"
5672  " are const-qualified">;
5673def note_deleted_copy_ctor_rvalue_reference : Note<
5674  "copy constructor of %0 is implicitly deleted because field %1 is of "
5675  "rvalue reference type %2">;
5676def note_deleted_copy_user_declared_move : Note<
5677  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5678  " %1 has a user-declared move %select{constructor|assignment operator}2">;
5679def note_deleted_assign_field : Note<
5680  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5681  "because field %2 is of %select{reference|const-qualified}4 type %3">;
5682
5683// These should be errors.
5684def warn_undefined_internal : Warning<
5685  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5686  InGroup<DiagGroup<"undefined-internal">>;
5687def err_undefined_internal_type : Error<
5688  "%select{function|variable}0 %q1 is used but not defined in this "
5689  "translation unit, and cannot be defined in any other translation unit "
5690  "because its type does not have linkage">;
5691def ext_undefined_internal_type : Extension<
5692  "ISO C++ requires a definition in this translation unit for "
5693  "%select{function|variable}0 %q1 because its type does not have linkage">,
5694  InGroup<DiagGroup<"undefined-internal-type">>;
5695def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5696  InGroup<DiagGroup<"undefined-inline">>;
5697def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5698def note_used_here : Note<"used here">;
5699
5700def err_attribute_missing_on_first_decl : Error<
5701  "%0 attribute does not appear on the first declaration">;
5702def warn_internal_linkage_local_storage : Warning<
5703  "'internal_linkage' attribute on a non-static local variable is ignored">,
5704  InGroup<IgnoredAttributes>;
5705
5706def ext_internal_in_extern_inline : ExtWarn<
5707  "static %select{function|variable}0 %1 is used in an inline function with "
5708  "external linkage">, InGroup<StaticInInline>;
5709def ext_internal_in_extern_inline_quiet : Extension<
5710  "static %select{function|variable}0 %1 is used in an inline function with "
5711  "external linkage">, InGroup<StaticInInline>;
5712def warn_static_local_in_extern_inline : Warning<
5713  "non-constant static local variable in inline function may be different "
5714  "in different files">, InGroup<StaticLocalInInline>;
5715def note_convert_inline_to_static : Note<
5716  "use 'static' to give inline function %0 internal linkage">;
5717
5718def ext_redefinition_of_typedef : ExtWarn<
5719  "redefinition of typedef %0 is a C11 feature">,
5720  InGroup<DiagGroup<"typedef-redefinition"> >;
5721def err_redefinition_variably_modified_typedef : Error<
5722  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5723
5724def err_inline_decl_follows_def : Error<
5725  "inline declaration of %0 follows non-inline definition">;
5726def err_inline_declaration_block_scope : Error<
5727  "inline declaration of %0 not allowed in block scope">;
5728def err_static_non_static : Error<
5729  "static declaration of %0 follows non-static declaration">;
5730def err_different_language_linkage : Error<
5731  "declaration of %0 has a different language linkage">;
5732def ext_retained_language_linkage : Extension<
5733  "friend function %0 retaining previous language linkage is an extension">,
5734  InGroup<DiagGroup<"retained-language-linkage">>;
5735def err_extern_c_global_conflict : Error<
5736  "declaration of %1 %select{with C language linkage|in global scope}0 "
5737  "conflicts with declaration %select{in global scope|with C language linkage}0">;
5738def note_extern_c_global_conflict : Note<
5739  "declared %select{in global scope|with C language linkage}0 here">;
5740def note_extern_c_begins_here : Note<
5741  "extern \"C\" language linkage specification begins here">;
5742def warn_weak_import : Warning <
5743  "an already-declared variable is made a weak_import declaration %0">;
5744def ext_static_non_static : Extension<
5745  "redeclaring non-static %0 as static is a Microsoft extension">,
5746  InGroup<MicrosoftRedeclareStatic>;
5747def err_non_static_static : Error<
5748  "non-static declaration of %0 follows static declaration">;
5749def err_extern_non_extern : Error<
5750  "extern declaration of %0 follows non-extern declaration">;
5751def err_non_extern_extern : Error<
5752  "non-extern declaration of %0 follows extern declaration">;
5753def err_non_thread_thread : Error<
5754  "non-thread-local declaration of %0 follows thread-local declaration">;
5755def err_thread_non_thread : Error<
5756  "thread-local declaration of %0 follows non-thread-local declaration">;
5757def err_thread_thread_different_kind : Error<
5758  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5759  "follows declaration with %select{dynamic|static}1 initialization">;
5760def err_mismatched_owning_module : Error<
5761  "declaration of %0 in %select{the global module|module %2}1 follows "
5762  "declaration in %select{the global module|module %4}3">;
5763def err_redefinition_different_type : Error<
5764  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5765def err_redefinition_different_kind : Error<
5766  "redefinition of %0 as different kind of symbol">;
5767def err_redefinition_different_namespace_alias : Error<
5768  "redefinition of %0 as an alias for a different namespace">;
5769def note_previous_namespace_alias : Note<
5770  "previously defined as an alias for %0">;
5771def warn_forward_class_redefinition : Warning<
5772  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5773  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5774def err_redefinition_different_typedef : Error<
5775  "%select{typedef|type alias|type alias template}0 "
5776  "redefinition with different types%diff{ ($ vs $)|}1,2">;
5777def err_redefinition_different_concept : Error<
5778  "redefinition of concept %0 with different template parameters or requirements">;
5779def err_tag_reference_non_tag : Error<
5780  "%select{non-struct type|non-class type|non-union type|non-enum "
5781  "type|typedef|type alias|template|type alias template|template "
5782  "template argument}1 %0 cannot be referenced with a "
5783  "%select{struct|interface|union|class|enum}2 specifier">;
5784def err_tag_reference_conflict : Error<
5785  "implicit declaration introduced by elaborated type conflicts with a "
5786  "%select{non-struct type|non-class type|non-union type|non-enum "
5787  "type|typedef|type alias|template|type alias template|template "
5788  "template argument}0 of the same name">;
5789def err_dependent_tag_decl : Error<
5790  "%select{declaration|definition}0 of "
5791  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5792def err_tag_definition_of_typedef : Error<
5793  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
5794def err_conflicting_types : Error<"conflicting types for %0">;
5795def err_different_pass_object_size_params : Error<
5796  "conflicting pass_object_size attributes on parameters">;
5797def err_late_asm_label_name : Error<
5798  "cannot apply asm label to %select{variable|function}0 after its first use">;
5799def err_different_asm_label : Error<"conflicting asm label">;
5800def err_nested_redefinition : Error<"nested redefinition of %0">;
5801def err_use_with_wrong_tag : Error<
5802  "use of %0 with tag type that does not match previous declaration">;
5803def warn_struct_class_tag_mismatch : Warning<
5804  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
5805  "declared as a %select{struct|interface|class}3%select{| template}1; "
5806  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5807  InGroup<MismatchedTags>, DefaultIgnore;
5808def warn_struct_class_previous_tag_mismatch : Warning<
5809  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
5810  "here but previously declared as "
5811  "%select{a struct|an interface|a class}3%select{| template}1; "
5812  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5813  InGroup<MismatchedTags>, DefaultIgnore;
5814def note_struct_class_suggestion : Note<
5815  "did you mean %select{struct|interface|class}0 here?">;
5816def ext_forward_ref_enum : Extension<
5817  "ISO C forbids forward references to 'enum' types">;
5818def err_forward_ref_enum : Error<
5819  "ISO C++ forbids forward references to 'enum' types">;
5820def ext_ms_forward_ref_enum : ExtWarn<
5821  "forward references to 'enum' types are a Microsoft extension">,
5822  InGroup<MicrosoftEnumForwardReference>;
5823def ext_forward_ref_enum_def : Extension<
5824  "redeclaration of already-defined enum %0 is a GNU extension">,
5825  InGroup<GNURedeclaredEnum>;
5826
5827def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
5828def err_duplicate_member : Error<"duplicate member %0">;
5829def err_misplaced_ivar : Error<
5830  "instance variables may not be placed in %select{categories|class extension}0">;
5831def warn_ivars_in_interface : Warning<
5832  "declaration of instance variables in the interface is deprecated">,
5833  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
5834def ext_enum_value_not_int : Extension<
5835  "ISO C restricts enumerator values to range of 'int' (%0 is too "
5836  "%select{small|large}1)">;
5837def ext_enum_too_large : ExtWarn<
5838  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
5839def ext_enumerator_increment_too_large : ExtWarn<
5840  "incremented enumerator value %0 is not representable in the "
5841  "largest integer type">, InGroup<EnumTooLarge>;
5842def warn_flag_enum_constant_out_of_range : Warning<
5843  "enumeration value %0 is out of range of flags in enumeration type %1">,
5844  InGroup<FlagEnum>;
5845
5846def err_vm_decl_in_file_scope : Error<
5847  "variably modified type declaration not allowed at file scope">;
5848def err_vm_decl_has_extern_linkage : Error<
5849  "variably modified type declaration cannot have 'extern' linkage">;
5850def err_typecheck_field_variable_size : Error<
5851  "fields must have a constant size: 'variable length array in structure' "
5852  "extension will never be supported">;
5853def err_vm_func_decl : Error<
5854  "function declaration cannot have variably modified type">;
5855def err_array_too_large : Error<
5856  "array is too large (%0 elements)">;
5857
5858def err_typecheck_negative_array_size : Error<"array size is negative">;
5859def warn_typecheck_function_qualifiers_ignored : Warning<
5860  "'%0' qualifier on function type %1 has no effect">,
5861  InGroup<IgnoredQualifiers>;
5862def warn_typecheck_function_qualifiers_unspecified : Warning<
5863  "'%0' qualifier on function type %1 has unspecified behavior">;
5864def warn_typecheck_reference_qualifiers : Warning<
5865  "'%0' qualifier on reference type %1 has no effect">,
5866  InGroup<IgnoredReferenceQualifiers>;
5867def err_typecheck_invalid_restrict_not_pointer : Error<
5868  "restrict requires a pointer or reference (%0 is invalid)">;
5869def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
5870  "restrict requires a pointer or reference">;
5871def err_typecheck_invalid_restrict_invalid_pointee : Error<
5872  "pointer to function type %0 may not be 'restrict' qualified">;
5873def ext_typecheck_zero_array_size : Extension<
5874  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
5875def err_typecheck_zero_array_size : Error<
5876  "zero-length arrays are not permitted in %select{C++|SYCL device code}0">;
5877def err_array_size_non_int : Error<"size of array has non-integer type %0">;
5878def err_init_element_not_constant : Error<
5879  "initializer element is not a compile-time constant">;
5880def ext_aggregate_init_not_constant : Extension<
5881  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
5882def err_local_cant_init : Error<
5883  "'__local' variable cannot have an initializer">;
5884def err_loader_uninitialized_cant_init
5885    : Error<"variable with 'loader_uninitialized' attribute cannot have an "
5886            "initializer">;
5887def err_loader_uninitialized_trivial_ctor
5888    : Error<"variable with 'loader_uninitialized' attribute must have a "
5889            "trivial default constructor">;
5890def err_loader_uninitialized_redeclaration
5891    : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
5892def err_loader_uninitialized_extern_decl
5893    : Error<"variable %0 cannot be declared both 'extern' and with the "
5894            "'loader_uninitialized' attribute">;
5895def err_block_extern_cant_init : Error<
5896  "'extern' variable cannot have an initializer">;
5897def warn_extern_init : Warning<"'extern' variable has an initializer">,
5898  InGroup<DiagGroup<"extern-initializer">>;
5899def err_variable_object_no_init : Error<
5900  "variable-sized object may not be initialized">;
5901def err_excess_initializers : Error<
5902  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
5903def ext_excess_initializers : ExtWarn<
5904  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
5905  InGroup<ExcessInitializers>;
5906def err_excess_initializers_for_sizeless_type : Error<
5907  "excess elements in initializer for indivisible sizeless type %0">;
5908def ext_excess_initializers_for_sizeless_type : ExtWarn<
5909  "excess elements in initializer for indivisible sizeless type %0">,
5910  InGroup<ExcessInitializers>;
5911def err_excess_initializers_in_char_array_initializer : Error<
5912  "excess elements in char array initializer">;
5913def ext_excess_initializers_in_char_array_initializer : ExtWarn<
5914  "excess elements in char array initializer">,
5915  InGroup<ExcessInitializers>;
5916def err_initializer_string_for_char_array_too_long : Error<
5917  "initializer-string for char array is too long">;
5918def ext_initializer_string_for_char_array_too_long : ExtWarn<
5919  "initializer-string for char array is too long">,
5920  InGroup<ExcessInitializers>;
5921def warn_missing_field_initializers : Warning<
5922  "missing field %0 initializer">,
5923  InGroup<MissingFieldInitializers>, DefaultIgnore;
5924def warn_braces_around_init : Warning<
5925  "braces around %select{scalar |}0initializer">,
5926  InGroup<DiagGroup<"braced-scalar-init">>;
5927def ext_many_braces_around_init : ExtWarn<
5928  "too many braces around %select{scalar |}0initializer">,
5929  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
5930def ext_complex_component_init : Extension<
5931  "complex initialization specifying real and imaginary components "
5932  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
5933def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
5934def err_empty_sizeless_initializer : Error<
5935  "initializer for sizeless type %0 cannot be empty">;
5936def warn_cxx98_compat_empty_scalar_initializer : Warning<
5937  "scalar initialized from empty initializer list is incompatible with C++98">,
5938  InGroup<CXX98Compat>, DefaultIgnore;
5939def warn_cxx98_compat_empty_sizeless_initializer : Warning<
5940  "initializing %0 from an empty initializer list is incompatible with C++98">,
5941  InGroup<CXX98Compat>, DefaultIgnore;
5942def warn_cxx98_compat_reference_list_init : Warning<
5943  "reference initialized from initializer list is incompatible with C++98">,
5944  InGroup<CXX98Compat>, DefaultIgnore;
5945def warn_cxx98_compat_initializer_list_init : Warning<
5946  "initialization of initializer_list object is incompatible with C++98">,
5947  InGroup<CXX98Compat>, DefaultIgnore;
5948def warn_cxx98_compat_ctor_list_init : Warning<
5949  "constructor call from initializer list is incompatible with C++98">,
5950  InGroup<CXX98Compat>, DefaultIgnore;
5951def err_illegal_initializer : Error<
5952  "illegal initializer (only variables can be initialized)">;
5953def err_illegal_initializer_type : Error<"illegal initializer type %0">;
5954def ext_init_list_type_narrowing : ExtWarn<
5955  "type %0 cannot be narrowed to %1 in initializer list">,
5956  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5957def ext_init_list_variable_narrowing : ExtWarn<
5958  "non-constant-expression cannot be narrowed from type %0 to %1 in "
5959  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5960def ext_init_list_constant_narrowing : ExtWarn<
5961  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
5962  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5963def warn_init_list_type_narrowing : Warning<
5964  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
5965  InGroup<CXX11Narrowing>, DefaultIgnore;
5966def warn_init_list_variable_narrowing : Warning<
5967  "non-constant-expression cannot be narrowed from type %0 to %1 in "
5968  "initializer list in C++11">,
5969  InGroup<CXX11Narrowing>, DefaultIgnore;
5970def warn_init_list_constant_narrowing : Warning<
5971  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
5972  "C++11">,
5973  InGroup<CXX11Narrowing>, DefaultIgnore;
5974def note_init_list_narrowing_silence : Note<
5975  "insert an explicit cast to silence this issue">;
5976def err_init_objc_class : Error<
5977  "cannot initialize Objective-C class type %0">;
5978def err_implicit_empty_initializer : Error<
5979  "initializer for aggregate with no elements requires explicit braces">;
5980def err_bitfield_has_negative_width : Error<
5981  "bit-field %0 has negative width (%1)">;
5982def err_anon_bitfield_has_negative_width : Error<
5983  "anonymous bit-field has negative width (%0)">;
5984def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
5985def err_bitfield_width_exceeds_type_width : Error<
5986  "width of%select{ anonymous|}0 bit-field%select{| %1}0 (%2 bits) exceeds the "
5987  "%select{width|size}3 of its type (%4 bit%s4)">;
5988def err_incorrect_number_of_vector_initializers : Error<
5989  "number of elements must be either one or match the size of the vector">;
5990
5991// Used by C++ which allows bit-fields that are wider than the type.
5992def warn_bitfield_width_exceeds_type_width: Warning<
5993  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
5994  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
5995def err_bitfield_too_wide : Error<
5996  "%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
5997def warn_bitfield_too_small_for_enum : Warning<
5998  "bit-field %0 is not wide enough to store all enumerators of %1">,
5999  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6000def note_widen_bitfield : Note<
6001  "widen this field to %0 bits to store all values of %1">;
6002def warn_unsigned_bitfield_assigned_signed_enum : Warning<
6003  "assigning value of signed enum type %1 to unsigned bit-field %0; "
6004  "negative enumerators of enum %1 will be converted to positive values">,
6005  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6006def warn_signed_bitfield_enum_conversion : Warning<
6007  "signed bit-field %0 needs an extra bit to represent the largest positive "
6008  "enumerators of %1">,
6009  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6010def note_change_bitfield_sign : Note<
6011  "consider making the bitfield type %select{unsigned|signed}0">;
6012
6013def warn_missing_braces : Warning<
6014  "suggest braces around initialization of subobject">,
6015  InGroup<MissingBraces>, DefaultIgnore;
6016
6017def err_redefinition_of_label : Error<"redefinition of label %0">;
6018def err_undeclared_label_use : Error<"use of undeclared label %0">;
6019def err_goto_ms_asm_label : Error<
6020  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
6021def note_goto_ms_asm_label : Note<
6022  "inline assembly label %0 declared here">;
6023def warn_unused_label : Warning<"unused label %0">,
6024  InGroup<UnusedLabel>, DefaultIgnore;
6025
6026def err_continue_from_cond_var_init : Error<
6027  "cannot jump from this continue statement to the loop increment; "
6028  "jump bypasses initialization of loop condition variable">;
6029def err_goto_into_protected_scope : Error<
6030  "cannot jump from this goto statement to its label">;
6031def ext_goto_into_protected_scope : ExtWarn<
6032  "jump from this goto statement to its label is a Microsoft extension">,
6033  InGroup<MicrosoftGoto>;
6034def warn_cxx98_compat_goto_into_protected_scope : Warning<
6035  "jump from this goto statement to its label is incompatible with C++98">,
6036  InGroup<CXX98Compat>, DefaultIgnore;
6037def err_switch_into_protected_scope : Error<
6038  "cannot jump from switch statement to this case label">;
6039def warn_cxx98_compat_switch_into_protected_scope : Warning<
6040  "jump from switch statement to this case label is incompatible with C++98">,
6041  InGroup<CXX98Compat>, DefaultIgnore;
6042def err_indirect_goto_without_addrlabel : Error<
6043  "indirect goto in function with no address-of-label expressions">;
6044def err_indirect_goto_in_protected_scope : Error<
6045  "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
6046def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
6047  "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
6048  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6049def note_indirect_goto_target : Note<
6050  "possible target of %select{indirect|asm}0 goto statement">;
6051def note_protected_by_variable_init : Note<
6052  "jump bypasses variable initialization">;
6053def note_protected_by_variable_nontriv_destructor : Note<
6054  "jump bypasses variable with a non-trivial destructor">;
6055def note_protected_by_variable_non_pod : Note<
6056  "jump bypasses initialization of non-POD variable">;
6057def note_protected_by_cleanup : Note<
6058  "jump bypasses initialization of variable with __attribute__((cleanup))">;
6059def note_protected_by_vla_typedef : Note<
6060  "jump bypasses initialization of VLA typedef">;
6061def note_protected_by_vla_type_alias : Note<
6062  "jump bypasses initialization of VLA type alias">;
6063def note_protected_by_constexpr_if : Note<
6064  "jump enters controlled statement of constexpr if">;
6065def note_protected_by_consteval_if : Note<
6066  "jump enters controlled statement of consteval if">;
6067def note_protected_by_if_available : Note<
6068  "jump enters controlled statement of if available">;
6069def note_protected_by_vla : Note<
6070  "jump bypasses initialization of variable length array">;
6071def note_protected_by_objc_fast_enumeration : Note<
6072  "jump enters Objective-C fast enumeration loop">;
6073def note_protected_by_objc_try : Note<
6074  "jump bypasses initialization of @try block">;
6075def note_protected_by_objc_catch : Note<
6076  "jump bypasses initialization of @catch block">;
6077def note_protected_by_objc_finally : Note<
6078  "jump bypasses initialization of @finally block">;
6079def note_protected_by_objc_synchronized : Note<
6080  "jump bypasses initialization of @synchronized block">;
6081def note_protected_by_objc_autoreleasepool : Note<
6082  "jump bypasses auto release push of @autoreleasepool block">;
6083def note_protected_by_cxx_try : Note<
6084  "jump bypasses initialization of try block">;
6085def note_protected_by_cxx_catch : Note<
6086  "jump bypasses initialization of catch block">;
6087def note_protected_by_seh_try : Note<
6088  "jump bypasses initialization of __try block">;
6089def note_protected_by_seh_except : Note<
6090  "jump bypasses initialization of __except block">;
6091def note_protected_by_seh_finally : Note<
6092  "jump bypasses initialization of __finally block">;
6093def note_protected_by___block : Note<
6094  "jump bypasses setup of __block variable">;
6095def note_protected_by_objc_strong_init : Note<
6096  "jump bypasses initialization of __strong variable">;
6097def note_protected_by_objc_weak_init : Note<
6098  "jump bypasses initialization of __weak variable">;
6099def note_protected_by_non_trivial_c_struct_init : Note<
6100  "jump bypasses initialization of variable of non-trivial C struct type">;
6101def note_enters_block_captures_cxx_obj : Note<
6102  "jump enters lifetime of block which captures a destructible C++ object">;
6103def note_enters_block_captures_strong : Note<
6104  "jump enters lifetime of block which strongly captures a variable">;
6105def note_enters_block_captures_weak : Note<
6106  "jump enters lifetime of block which weakly captures a variable">;
6107def note_enters_block_captures_non_trivial_c_struct : Note<
6108  "jump enters lifetime of block which captures a C struct that is non-trivial "
6109  "to destroy">;
6110def note_enters_compound_literal_scope : Note<
6111  "jump enters lifetime of a compound literal that is non-trivial to destruct">;
6112
6113def note_exits_cleanup : Note<
6114  "jump exits scope of variable with __attribute__((cleanup))">;
6115def note_exits_dtor : Note<
6116  "jump exits scope of variable with non-trivial destructor">;
6117def note_exits_temporary_dtor : Note<
6118  "jump exits scope of lifetime-extended temporary with non-trivial "
6119  "destructor">;
6120def note_exits___block : Note<
6121  "jump exits scope of __block variable">;
6122def note_exits_objc_try : Note<
6123  "jump exits @try block">;
6124def note_exits_objc_catch : Note<
6125  "jump exits @catch block">;
6126def note_exits_objc_finally : Note<
6127  "jump exits @finally block">;
6128def note_exits_objc_synchronized : Note<
6129  "jump exits @synchronized block">;
6130def note_exits_cxx_try : Note<
6131  "jump exits try block">;
6132def note_exits_cxx_catch : Note<
6133  "jump exits catch block">;
6134def note_exits_seh_try : Note<
6135  "jump exits __try block">;
6136def note_exits_seh_except : Note<
6137  "jump exits __except block">;
6138def note_exits_seh_finally : Note<
6139  "jump exits __finally block">;
6140def note_exits_objc_autoreleasepool : Note<
6141  "jump exits autoreleasepool block">;
6142def note_exits_objc_strong : Note<
6143  "jump exits scope of __strong variable">;
6144def note_exits_objc_weak : Note<
6145  "jump exits scope of __weak variable">;
6146def note_exits_block_captures_cxx_obj : Note<
6147  "jump exits lifetime of block which captures a destructible C++ object">;
6148def note_exits_block_captures_strong : Note<
6149  "jump exits lifetime of block which strongly captures a variable">;
6150def note_exits_block_captures_weak : Note<
6151  "jump exits lifetime of block which weakly captures a variable">;
6152def note_exits_block_captures_non_trivial_c_struct : Note<
6153  "jump exits lifetime of block which captures a C struct that is non-trivial "
6154  "to destroy">;
6155def note_exits_compound_literal_scope : Note<
6156  "jump exits lifetime of a compound literal that is non-trivial to destruct">;
6157
6158def err_func_returning_qualified_void : ExtWarn<
6159  "function cannot return qualified void type %0">,
6160  InGroup<DiagGroup<"qualified-void-return-type">>;
6161def err_func_returning_array_function : Error<
6162  "function cannot return %select{array|function}0 type %1">;
6163def err_field_declared_as_function : Error<"field %0 declared as a function">;
6164def err_field_incomplete_or_sizeless : Error<
6165  "field has %select{incomplete|sizeless}0 type %1">;
6166def ext_variable_sized_type_in_struct : ExtWarn<
6167  "field %0 with variable sized type %1 not at the end of a struct or class is"
6168  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
6169
6170def ext_c99_flexible_array_member : Extension<
6171  "flexible array members are a C99 feature">, InGroup<C99>;
6172def err_flexible_array_virtual_base : Error<
6173  "flexible array member %0 not allowed in "
6174  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
6175def err_flexible_array_empty_aggregate : Error<
6176  "flexible array member %0 not allowed in otherwise empty "
6177  "%select{struct|interface|union|class|enum}1">;
6178def err_flexible_array_has_nontrivial_dtor : Error<
6179  "flexible array member %0 of type %1 with non-trivial destruction">;
6180def ext_flexible_array_in_struct : Extension<
6181  "%0 may not be nested in a struct due to flexible array member">,
6182  InGroup<FlexibleArrayExtensions>;
6183def ext_flexible_array_in_array : Extension<
6184  "%0 may not be used as an array element due to flexible array member">,
6185  InGroup<FlexibleArrayExtensions>;
6186def err_flexible_array_init : Error<
6187  "initialization of flexible array member is not allowed">;
6188def ext_flexible_array_empty_aggregate_ms : Extension<
6189  "flexible array member %0 in otherwise empty "
6190  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
6191  InGroup<MicrosoftFlexibleArray>;
6192def err_flexible_array_union : Error<
6193  "flexible array member %0 in a union is not allowed">;
6194def ext_flexible_array_union_ms : Extension<
6195  "flexible array member %0 in a union is a Microsoft extension">,
6196  InGroup<MicrosoftFlexibleArray>;
6197def ext_flexible_array_empty_aggregate_gnu : Extension<
6198  "flexible array member %0 in otherwise empty "
6199  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
6200  InGroup<GNUEmptyStruct>;
6201def ext_flexible_array_union_gnu : Extension<
6202  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
6203
6204def err_flexible_array_not_at_end : Error<
6205  "flexible array member %0 with type %1 is not at the end of"
6206  " %select{struct|interface|union|class|enum}2">;
6207def err_objc_variable_sized_type_not_at_end : Error<
6208  "field %0 with variable sized type %1 is not at the end of class">;
6209def note_next_field_declaration : Note<
6210  "next field declaration is here">;
6211def note_next_ivar_declaration : Note<
6212  "next %select{instance variable declaration|synthesized instance variable}0"
6213  " is here">;
6214def err_synthesize_variable_sized_ivar : Error<
6215  "synthesized property with variable size type %0"
6216  " requires an existing instance variable">;
6217def err_flexible_array_arc_retainable : Error<
6218  "ARC forbids flexible array members with retainable object type">;
6219def warn_variable_sized_ivar_visibility : Warning<
6220  "field %0 with variable sized type %1 is not visible to subclasses and"
6221  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
6222def warn_superclass_variable_sized_type_not_at_end : Warning<
6223  "field %0 can overwrite instance variable %1 with variable sized type %2"
6224  " in superclass %3">, InGroup<ObjCFlexibleArray>;
6225
6226let CategoryName = "ARC Semantic Issue" in {
6227
6228// ARC-mode diagnostics.
6229
6230let CategoryName = "ARC Weak References" in {
6231
6232def err_arc_weak_no_runtime : Error<
6233  "cannot create __weak reference because the current deployment target "
6234  "does not support weak references">;
6235def err_arc_weak_disabled : Error<
6236  "cannot create __weak reference in file using manual reference counting">;
6237def err_synthesizing_arc_weak_property_disabled : Error<
6238  "cannot synthesize weak property in file using manual reference counting">;
6239def err_synthesizing_arc_weak_property_no_runtime : Error<
6240  "cannot synthesize weak property because the current deployment target "
6241  "does not support weak references">;
6242def err_arc_unsupported_weak_class : Error<
6243  "class is incompatible with __weak references">;
6244def err_arc_weak_unavailable_assign : Error<
6245  "assignment of a weak-unavailable object to a __weak object">;
6246def err_arc_weak_unavailable_property : Error<
6247  "synthesizing __weak instance variable of type %0, which does not "
6248  "support weak references">;
6249def note_implemented_by_class : Note<
6250  "when implemented by class %0">;
6251def err_arc_convesion_of_weak_unavailable : Error<
6252  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
6253  " a __weak object of type %2">;
6254
6255} // end "ARC Weak References" category
6256
6257let CategoryName = "ARC Restrictions" in {
6258
6259def err_unavailable_in_arc : Error<
6260  "%0 is unavailable in ARC">;
6261def note_arc_forbidden_type : Note<
6262  "declaration uses type that is ill-formed in ARC">;
6263def note_performs_forbidden_arc_conversion : Note<
6264  "inline function performs a conversion which is forbidden in ARC">;
6265def note_arc_init_returns_unrelated : Note<
6266  "init method must return a type related to its receiver type">;
6267def note_arc_weak_disabled : Note<
6268  "declaration uses __weak, but ARC is disabled">;
6269def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
6270  "the current deployment target does not support">;
6271def note_arc_field_with_ownership : Note<
6272  "field has non-trivial ownership qualification">;
6273
6274def err_arc_illegal_explicit_message : Error<
6275  "ARC forbids explicit message send of %0">;
6276def err_arc_unused_init_message : Error<
6277  "the result of a delegate init call must be immediately returned "
6278  "or assigned to 'self'">;
6279def err_arc_mismatched_cast : Error<
6280  "%select{implicit conversion|cast}0 of "
6281  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
6282  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
6283  " to %3 is disallowed with ARC">;
6284def err_arc_nolifetime_behavior : Error<
6285  "explicit ownership qualifier on cast result has no effect">;
6286def err_arc_objc_property_default_assign_on_object : Error<
6287  "ARC forbids synthesizing a property of an Objective-C object "
6288  "with unspecified ownership or storage attribute">;
6289def err_arc_illegal_selector : Error<
6290  "ARC forbids use of %0 in a @selector">;
6291def err_arc_illegal_method_def : Error<
6292  "ARC forbids %select{implementation|synthesis}0 of %1">;
6293def warn_arc_strong_pointer_objc_pointer : Warning<
6294  "method parameter of type %0 with no explicit ownership">,
6295  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
6296
6297} // end "ARC Restrictions" category
6298
6299def err_arc_lost_method_convention : Error<
6300  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
6301  "method, but its implementation doesn't match because %select{"
6302  "its result type is not an object pointer|"
6303  "its result type is unrelated to its receiver type}1">;
6304def note_arc_lost_method_convention : Note<"declaration in interface">;
6305def err_arc_gained_method_convention : Error<
6306  "method implementation does not match its declaration">;
6307def note_arc_gained_method_convention : Note<
6308  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
6309  "family because %select{its result type is not an object pointer|"
6310  "its result type is unrelated to its receiver type}1">;
6311def err_typecheck_arc_assign_self : Error<
6312  "cannot assign to 'self' outside of a method in the init family">;
6313def err_typecheck_arc_assign_self_class_method : Error<
6314  "cannot assign to 'self' in a class method">;
6315def err_typecheck_arr_assign_enumeration : Error<
6316  "fast enumeration variables cannot be modified in ARC by default; "
6317  "declare the variable __strong to allow this">;
6318def err_typecheck_arc_assign_externally_retained : Error<
6319  "variable declared with 'objc_externally_retained' "
6320  "cannot be modified in ARC">;
6321def warn_arc_retained_assign : Warning<
6322  "assigning retained object to %select{weak|unsafe_unretained}0 "
6323  "%select{property|variable}1"
6324  "; object will be released after assignment">,
6325  InGroup<ARCUnsafeRetainedAssign>;
6326def warn_arc_retained_property_assign : Warning<
6327  "assigning retained object to unsafe property"
6328  "; object will be released after assignment">,
6329  InGroup<ARCUnsafeRetainedAssign>;
6330def warn_arc_literal_assign : Warning<
6331  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
6332  " to a weak %select{property|variable}1"
6333  "; object will be released after assignment">,
6334  InGroup<ARCUnsafeRetainedAssign>;
6335def err_arc_new_array_without_ownership : Error<
6336  "'new' cannot allocate an array of %0 with no explicit ownership">;
6337def err_arc_autoreleasing_var : Error<
6338  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
6339  "__autoreleasing ownership">;
6340def err_arc_autoreleasing_capture : Error<
6341  "cannot capture __autoreleasing variable in a "
6342  "%select{block|lambda by copy}0">;
6343def err_arc_thread_ownership : Error<
6344  "thread-local variable has non-trivial ownership: type is %0">;
6345def err_arc_indirect_no_ownership : Error<
6346  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6347def err_arc_array_param_no_ownership : Error<
6348  "must explicitly describe intended ownership of an object array parameter">;
6349def err_arc_pseudo_dtor_inconstant_quals : Error<
6350  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6351  "type %1">;
6352def err_arc_init_method_unrelated_result_type : Error<
6353  "init methods must return a type related to the receiver type">;
6354def err_arc_nonlocal_writeback : Error<
6355  "passing address of %select{non-local|non-scalar}0 object to "
6356  "__autoreleasing parameter for write-back">;
6357def err_arc_method_not_found : Error<
6358  "no known %select{instance|class}1 method for selector %0">;
6359def err_arc_receiver_forward_class : Error<
6360  "receiver %0 for class message is a forward declaration">;
6361def err_arc_may_not_respond : Error<
6362  "no visible @interface for %0 declares the selector %1">;
6363def err_arc_receiver_forward_instance : Error<
6364  "receiver type %0 for instance message is a forward declaration">;
6365def warn_receiver_forward_instance : Warning<
6366  "receiver type %0 for instance message is a forward declaration">,
6367  InGroup<ForwardClassReceiver>, DefaultIgnore;
6368def err_arc_collection_forward : Error<
6369  "collection expression type %0 is a forward declaration">;
6370def err_arc_multiple_method_decl : Error<
6371  "multiple methods named %0 found with mismatched result, "
6372  "parameter type or attributes">;
6373def warn_arc_lifetime_result_type : Warning<
6374  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6375  "lifetime qualifier on return type is ignored">,
6376  InGroup<IgnoredQualifiers>;
6377
6378let CategoryName = "ARC Retain Cycle" in {
6379
6380def warn_arc_retain_cycle : Warning<
6381  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6382  InGroup<ARCRetainCycles>;
6383def note_arc_retain_cycle_owner : Note<
6384  "block will be retained by %select{the captured object|an object strongly "
6385  "retained by the captured object}0">;
6386
6387} // end "ARC Retain Cycle" category
6388
6389def warn_arc_object_memaccess : Warning<
6390  "%select{destination for|source of}0 this %1 call is a pointer to "
6391  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6392
6393let CategoryName = "ARC and @properties" in {
6394
6395def err_arc_strong_property_ownership : Error<
6396  "existing instance variable %1 for strong property %0 may not be "
6397  "%select{|__unsafe_unretained||__weak}2">;
6398def err_arc_assign_property_ownership : Error<
6399  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6400  "attribute must be __unsafe_unretained">;
6401def err_arc_inconsistent_property_ownership : Error<
6402  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6403  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6404
6405} // end "ARC and @properties" category
6406
6407def warn_block_capture_autoreleasing : Warning<
6408  "block captures an autoreleasing out-parameter, which may result in "
6409  "use-after-free bugs">,
6410  InGroup<BlockCaptureAutoReleasing>;
6411def note_declare_parameter_strong : Note<
6412  "declare the parameter __strong or capture a __block __strong variable to "
6413  "keep values alive across autorelease pools">;
6414
6415def err_arc_atomic_ownership : Error<
6416  "cannot perform atomic operation on a pointer to type %0: type has "
6417  "non-trivial ownership">;
6418
6419let CategoryName = "ARC Casting Rules" in {
6420
6421def err_arc_bridge_cast_incompatible : Error<
6422  "incompatible types casting %0 to %1 with a %select{__bridge|"
6423  "__bridge_transfer|__bridge_retained}2 cast">;
6424def err_arc_bridge_cast_wrong_kind : Error<
6425  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6426  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6427  "__bridge_transfer|__bridge_retained}4">;
6428def err_arc_cast_requires_bridge : Error<
6429  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6430  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6431  "requires a bridged cast">;
6432def note_arc_bridge : Note<
6433  "use __bridge to convert directly (no change in ownership)">;
6434def note_arc_cstyle_bridge : Note<
6435  "use __bridge with C-style cast to convert directly (no change in ownership)">;
6436def note_arc_bridge_transfer : Note<
6437  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6438  "ownership of a +1 %0 into ARC">;
6439def note_arc_cstyle_bridge_transfer : Note<
6440  "use __bridge_transfer with C-style cast to transfer "
6441  "ownership of a +1 %0 into ARC">;
6442def note_arc_bridge_retained : Note<
6443  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6444  "ARC object available as a +1 %0">;
6445def note_arc_cstyle_bridge_retained : Note<
6446  "use __bridge_retained with C-style cast to make an "
6447  "ARC object available as a +1 %0">;
6448
6449} // ARC Casting category
6450
6451} // ARC category name
6452
6453def err_flexible_array_init_needs_braces : Error<
6454  "flexible array requires brace-enclosed initializer">;
6455def err_illegal_decl_array_of_functions : Error<
6456  "'%0' declared as array of functions of type %1">;
6457def err_array_incomplete_or_sizeless_type : Error<
6458  "array has %select{incomplete|sizeless}0 element type %1">;
6459def err_illegal_message_expr_incomplete_type : Error<
6460  "Objective-C message has incomplete result type %0">;
6461def err_illegal_decl_array_of_references : Error<
6462  "'%0' declared as array of references of type %1">;
6463def err_decl_negative_array_size : Error<
6464  "'%0' declared as an array with a negative size">;
6465def err_array_static_outside_prototype : Error<
6466  "%0 used in array declarator outside of function prototype">;
6467def err_array_static_not_outermost : Error<
6468  "%0 used in non-outermost array type derivation">;
6469def err_array_star_outside_prototype : Error<
6470  "star modifier used outside of function prototype">;
6471def err_illegal_decl_pointer_to_reference : Error<
6472  "'%0' declared as a pointer to a reference of type %1">;
6473def err_illegal_decl_mempointer_to_reference : Error<
6474  "'%0' declared as a member pointer to a reference of type %1">;
6475def err_illegal_decl_mempointer_to_void : Error<
6476  "'%0' declared as a member pointer to void">;
6477def err_illegal_decl_mempointer_in_nonclass : Error<
6478  "'%0' does not point into a class">;
6479def err_mempointer_in_nonclass_type : Error<
6480  "member pointer refers into non-class type %0">;
6481def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6482def err_nonfunction_block_type : Error<
6483  "block pointer to non-function type is invalid">;
6484def err_return_block_has_expr : Error<"void block should not return a value">;
6485def err_block_return_missing_expr : Error<
6486  "non-void block should return a value">;
6487def err_func_def_incomplete_result : Error<
6488  "incomplete result type %0 in function definition">;
6489def err_atomic_specifier_bad_type
6490    : Error<"_Atomic cannot be applied to "
6491            "%select{incomplete |array |function |reference |atomic |qualified "
6492            "|sizeless ||integer }0type "
6493            "%1 %select{|||||||which is not trivially copyable|}0">;
6494def warn_atomic_member_access : Warning<
6495  "accessing a member of an atomic structure or union is undefined behavior">,
6496  InGroup<DiagGroup<"atomic-access">>, DefaultError;
6497
6498// Expressions.
6499def ext_sizeof_alignof_function_type : Extension<
6500  "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6501def ext_sizeof_alignof_void_type : Extension<
6502  "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6503def err_opencl_sizeof_alignof_type : Error<
6504  "invalid application of '%0' to a void type">;
6505def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6506  "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6507def err_sizeof_alignof_function_type : Error<
6508  "invalid application of '%0' to a function type">;
6509def err_openmp_default_simd_align_expr : Error<
6510  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6511def err_sizeof_alignof_typeof_bitfield : Error<
6512  "invalid application of '%select{sizeof|alignof|typeof}0' to bit-field">;
6513def err_alignof_member_of_incomplete_type : Error<
6514  "invalid application of 'alignof' to a field of a class still being defined">;
6515def err_vecstep_non_scalar_vector_type : Error<
6516  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6517def err_offsetof_incomplete_type : Error<
6518  "offsetof of incomplete type %0">;
6519def err_offsetof_record_type : Error<
6520  "offsetof requires struct, union, or class type, %0 invalid">;
6521def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6522def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6523  InGroup<InvalidOffsetof>;
6524def ext_offsetof_non_standardlayout_type : ExtWarn<
6525  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6526def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6527def err_offsetof_field_of_virtual_base : Error<
6528  "invalid application of 'offsetof' to a field of a virtual base">;
6529def warn_sub_ptr_zero_size_types : Warning<
6530  "subtraction of pointers to type %0 of zero size has undefined behavior">,
6531  InGroup<PointerArith>;
6532def warn_pointer_arith_null_ptr : Warning<
6533  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6534  InGroup<NullPointerArithmetic>, DefaultIgnore;
6535def warn_gnu_null_ptr_arith : Extension<
6536  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6537  InGroup<GNUNullPointerArithmetic>;
6538def warn_pointer_sub_null_ptr : Warning<
6539  "performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior">,
6540  InGroup<NullPointerSubtraction>, DefaultIgnore;
6541
6542def warn_floatingpoint_eq : Warning<
6543  "comparing floating point with == or != is unsafe">,
6544  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6545
6546def err_setting_eval_method_used_in_unsafe_context : Error <
6547  "%select{'#pragma clang fp eval_method'|option 'ffp-eval-method'}0 cannot be used with "
6548  "%select{option 'fapprox-func'|option 'mreassociate'|option 'freciprocal'|option 'ffp-eval-method'|'#pragma clang fp reassociate'}1">;
6549
6550def warn_remainder_division_by_zero : Warning<
6551  "%select{remainder|division}0 by zero is undefined">,
6552  InGroup<DivZero>;
6553def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6554  InGroup<DiagGroup<"shift-negative-value">>;
6555def warn_shift_negative : Warning<"shift count is negative">,
6556  InGroup<DiagGroup<"shift-count-negative">>;
6557def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6558  InGroup<DiagGroup<"shift-count-overflow">>;
6559def warn_shift_result_gt_typewidth : Warning<
6560  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6561  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6562def warn_shift_result_sets_sign_bit : Warning<
6563  "signed shift result (%0) sets the sign bit of the shift expression's "
6564  "type (%1) and becomes negative">,
6565  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6566
6567def warn_precedence_bitwise_rel : Warning<
6568  "%0 has lower precedence than %1; %1 will be evaluated first">,
6569  InGroup<Parentheses>;
6570def note_precedence_bitwise_first : Note<
6571  "place parentheses around the %0 expression to evaluate it first">;
6572def note_precedence_silence : Note<
6573  "place parentheses around the '%0' expression to silence this warning">;
6574
6575def warn_precedence_conditional : Warning<
6576  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6577  InGroup<Parentheses>;
6578def warn_precedence_bitwise_conditional : Warning<
6579  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6580  InGroup<BitwiseConditionalParentheses>;
6581def note_precedence_conditional_first : Note<
6582  "place parentheses around the '?:' expression to evaluate it first">;
6583
6584def warn_enum_constant_in_bool_context : Warning<
6585  "converting the enum constant to a boolean">,
6586  InGroup<IntInBoolContext>, DefaultIgnore;
6587def warn_left_shift_in_bool_context : Warning<
6588  "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6589  InGroup<IntInBoolContext>, DefaultIgnore;
6590def warn_logical_instead_of_bitwise : Warning<
6591  "use of logical '%0' with constant operand">,
6592  InGroup<DiagGroup<"constant-logical-operand">>;
6593def note_logical_instead_of_bitwise_change_operator : Note<
6594  "use '%0' for a bitwise operation">;
6595def note_logical_instead_of_bitwise_remove_constant : Note<
6596  "remove constant to silence this warning">;
6597
6598def warn_bitwise_op_in_bitwise_op : Warning<
6599  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6600
6601def warn_logical_and_in_logical_or : Warning<
6602  "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6603
6604def warn_overloaded_shift_in_comparison :Warning<
6605  "overloaded operator %select{>>|<<}0 has higher precedence than "
6606  "comparison operator">,
6607  InGroup<OverloadedShiftOpParentheses>;
6608def note_evaluate_comparison_first :Note<
6609  "place parentheses around comparison expression to evaluate it first">;
6610
6611def note_concatenated_string_literal_silence :Note<
6612  "place parentheses around the string literal to silence warning">;
6613
6614def warn_addition_in_bitshift : Warning<
6615  "operator '%0' has lower precedence than '%1'; "
6616  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6617
6618def warn_self_assignment_builtin : Warning<
6619  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6620  "you mean to assign to member %2?}1">,
6621  InGroup<SelfAssignment>, DefaultIgnore;
6622def warn_self_assignment_overloaded : Warning<
6623  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6624  "you mean to assign to member %2?}1">,
6625  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6626def warn_self_move : Warning<
6627  "explicitly moving variable of type %0 to itself%select{|; did you mean to "
6628  "move to member %2?}1">,
6629  InGroup<SelfMove>, DefaultIgnore;
6630
6631def err_builtin_move_forward_unsupported : Error<
6632  "unsupported signature for %q0">;
6633def err_use_of_unaddressable_function : Error<
6634  "taking address of non-addressable standard library function">;
6635// FIXME: This should also be in -Wc++23-compat once we have it.
6636def warn_cxx20_compat_use_of_unaddressable_function : Warning<
6637  "taking address of non-addressable standard library function "
6638  "is incompatible with C++20">, InGroup<CXX20Compat>;
6639
6640def warn_redundant_move_on_return : Warning<
6641  "redundant move in return statement">,
6642  InGroup<RedundantMove>, DefaultIgnore;
6643def warn_pessimizing_move_on_return : Warning<
6644  "moving a local object in a return statement prevents copy elision">,
6645  InGroup<PessimizingMove>, DefaultIgnore;
6646def warn_pessimizing_move_on_initialization : Warning<
6647  "moving a temporary object prevents copy elision">,
6648  InGroup<PessimizingMove>, DefaultIgnore;
6649def note_remove_move : Note<"remove std::move call here">;
6650
6651def warn_string_plus_int : Warning<
6652  "adding %0 to a string does not append to the string">,
6653  InGroup<StringPlusInt>;
6654def warn_string_plus_char : Warning<
6655  "adding %0 to a string pointer does not append to the string">,
6656  InGroup<StringPlusChar>;
6657def note_string_plus_scalar_silence : Note<
6658  "use array indexing to silence this warning">;
6659
6660def warn_sizeof_array_param : Warning<
6661  "sizeof on array function parameter will return size of %0 instead of %1">,
6662  InGroup<SizeofArrayArgument>;
6663
6664def warn_sizeof_array_decay : Warning<
6665  "sizeof on pointer operation will return size of %0 instead of %1">,
6666  InGroup<SizeofArrayDecay>;
6667
6668def err_sizeof_nonfragile_interface : Error<
6669  "application of '%select{alignof|sizeof}1' to interface %0 is "
6670  "not supported on this architecture and platform">;
6671def err_atdef_nonfragile_interface : Error<
6672  "use of @defs is not supported on this architecture and platform">;
6673def err_subscript_nonfragile_interface : Error<
6674  "subscript requires size of interface %0, which is not constant for "
6675  "this architecture and platform">;
6676
6677def err_arithmetic_nonfragile_interface : Error<
6678  "arithmetic on pointer to interface %0, which is not a constant size for "
6679  "this architecture and platform">;
6680
6681def warn_deprecated_comma_subscript : Warning<
6682  "top-level comma expression in array subscript is deprecated "
6683  "in C++20 and unsupported in C++2b">,
6684  InGroup<DeprecatedCommaSubscript>;
6685
6686def ext_subscript_non_lvalue : Extension<
6687  "ISO C90 does not allow subscripting non-lvalue array">;
6688def err_typecheck_subscript_value : Error<
6689  "subscripted value is not an array, pointer, or vector">;
6690def err_typecheck_subscript_not_integer : Error<
6691  "array subscript is not an integer">;
6692def err_subscript_function_type : Error<
6693  "subscript of pointer to function type %0">;
6694def err_subscript_incomplete_or_sizeless_type : Error<
6695  "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6696def err_subscript_svbool_t : Error<
6697  "subscript of svbool_t is not allowed">;
6698def err_dereference_incomplete_type : Error<
6699  "dereference of pointer to incomplete type %0">;
6700def ext_gnu_subscript_void_type : Extension<
6701  "subscript of a pointer to void is a GNU extension">,
6702  InGroup<GNUPointerArith>;
6703def err_typecheck_member_reference_struct_union : Error<
6704  "member reference base type %0 is not a structure or union">;
6705def err_typecheck_member_reference_ivar : Error<
6706  "%0 does not have a member named %1">;
6707def err_arc_weak_ivar_access : Error<
6708  "dereferencing a __weak pointer is not allowed due to possible "
6709  "null value caused by race condition, assign it to strong variable first">;
6710def err_typecheck_member_reference_arrow : Error<
6711  "member reference type %0 is not a pointer">;
6712def err_typecheck_member_reference_suggestion : Error<
6713  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6714def note_typecheck_member_reference_suggestion : Note<
6715  "did you mean to use '.' instead?">;
6716def note_member_reference_arrow_from_operator_arrow : Note<
6717  "'->' applied to return value of the operator->() declared here">;
6718def err_typecheck_member_reference_type : Error<
6719  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6720def err_typecheck_member_reference_unknown : Error<
6721  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6722def err_member_reference_needs_call : Error<
6723  "base of member reference is a function; perhaps you meant to call "
6724  "it%select{| with no arguments}0?">;
6725def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6726  InGroup<CharSubscript>, DefaultIgnore;
6727
6728def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6729def err_no_member : Error<"no member named %0 in %1">;
6730def err_no_member_overloaded_arrow : Error<
6731  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6732
6733def err_member_not_yet_instantiated : Error<
6734  "no member %0 in %1; it has not yet been instantiated">;
6735def note_non_instantiated_member_here : Note<
6736  "not-yet-instantiated member is declared here">;
6737
6738def err_enumerator_does_not_exist : Error<
6739  "enumerator %0 does not exist in instantiation of %1">;
6740def note_enum_specialized_here : Note<
6741  "enum %0 was explicitly specialized here">;
6742
6743def err_specialization_not_primary_template : Error<
6744  "cannot reference member of primary template because deduced class "
6745  "template specialization %0 is %select{instantiated from a partial|"
6746  "an explicit}1 specialization">;
6747
6748def err_member_redeclared : Error<"class member cannot be redeclared">;
6749def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6750  InGroup<RedeclaredClassMember>;
6751def err_member_redeclared_in_instantiation : Error<
6752  "multiple overloads of %0 instantiate to the same signature %1">;
6753def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6754def err_member_def_undefined_record : Error<
6755  "out-of-line definition of %0 from class %1 without definition">;
6756def err_member_decl_does_not_match : Error<
6757  "out-of-line %select{declaration|definition}2 of %0 "
6758  "does not match any declaration in %1">;
6759def err_friend_decl_with_def_arg_must_be_def : Error<
6760  "friend declaration specifying a default argument must be a definition">;
6761def err_friend_decl_with_def_arg_redeclared : Error<
6762  "friend declaration specifying a default argument must be the only declaration">;
6763def err_friend_decl_does_not_match : Error<
6764  "friend declaration of %0 does not match any declaration in %1">;
6765def err_member_decl_does_not_match_suggest : Error<
6766  "out-of-line %select{declaration|definition}2 of %0 "
6767  "does not match any declaration in %1; did you mean %3?">;
6768def err_member_def_does_not_match_ret_type : Error<
6769  "return type of out-of-line definition of %q0 differs from "
6770  "that in the declaration">;
6771def err_nonstatic_member_out_of_line : Error<
6772  "non-static data member defined out-of-line">;
6773def err_qualified_typedef_declarator : Error<
6774  "typedef declarator cannot be qualified">;
6775def err_qualified_param_declarator : Error<
6776  "parameter declarator cannot be qualified">;
6777def ext_out_of_line_declaration : ExtWarn<
6778  "out-of-line declaration of a member must be a definition">,
6779  InGroup<OutOfLineDeclaration>, DefaultError;
6780def err_member_extra_qualification : Error<
6781  "extra qualification on member %0">;
6782def warn_member_extra_qualification : Warning<
6783  err_member_extra_qualification.Text>, InGroup<MicrosoftExtraQualification>;
6784def warn_namespace_member_extra_qualification : Warning<
6785  "extra qualification on member %0">,
6786  InGroup<DiagGroup<"extra-qualification">>;
6787def err_member_qualification : Error<
6788  "non-friend class member %0 cannot have a qualified name">;
6789def note_member_def_close_match : Note<"member declaration nearly matches">;
6790def note_member_def_close_const_match : Note<
6791  "member declaration does not match because "
6792  "it %select{is|is not}0 const qualified">;
6793def note_member_def_close_param_match : Note<
6794  "type of %ordinal0 parameter of member declaration does not match definition"
6795  "%diff{ ($ vs $)|}1,2">;
6796def note_local_decl_close_match : Note<"local declaration nearly matches">;
6797def note_local_decl_close_param_match : Note<
6798  "type of %ordinal0 parameter of local declaration does not match definition"
6799  "%diff{ ($ vs $)|}1,2">;
6800def err_typecheck_ivar_variable_size : Error<
6801  "instance variables must have a constant size">;
6802def err_ivar_reference_type : Error<
6803  "instance variables cannot be of reference type">;
6804def err_typecheck_illegal_increment_decrement : Error<
6805  "cannot %select{decrement|increment}1 value of type %0">;
6806def err_typecheck_expect_int : Error<
6807  "used type %0 where integer is required">;
6808def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
6809  "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
6810def err_typecheck_pointer_arith_function_type : Error<
6811  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
6812  "function type%select{|s}2 %1%select{| and %3}2">;
6813def err_typecheck_pointer_arith_void_type : Error<
6814  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
6815def err_typecheck_decl_incomplete_type : Error<
6816  "variable has incomplete type %0">;
6817def ext_typecheck_decl_incomplete_type : ExtWarn<
6818  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
6819  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
6820def err_tentative_def_incomplete_type : Error<
6821  "tentative definition has type %0 that is never completed">;
6822def warn_tentative_incomplete_array : Warning<
6823  "tentative array definition assumed to have one element">;
6824def err_typecheck_incomplete_array_needs_initializer : Error<
6825  "definition of variable with array type needs an explicit size "
6826  "or an initializer">;
6827def err_array_init_not_init_list : Error<
6828  "array initializer must be an initializer "
6829  "list%select{| or string literal| or wide string literal}0">;
6830def err_array_init_narrow_string_into_wchar : Error<
6831  "initializing wide char array with non-wide string literal">;
6832def err_array_init_wide_string_into_char : Error<
6833  "initializing char array with wide string literal">;
6834def err_array_init_incompat_wide_string_into_wchar : Error<
6835  "initializing wide char array with incompatible wide string literal">;
6836def err_array_init_plain_string_into_char8_t : Error<
6837  "initializing 'char8_t' array with plain string literal">;
6838def note_array_init_plain_string_into_char8_t : Note<
6839  "add 'u8' prefix to form a 'char8_t' string literal">;
6840def err_array_init_utf8_string_into_char : Error<
6841  "%select{|ISO C++20 does not permit }0initialization of char array with "
6842  "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">;
6843def warn_cxx20_compat_utf8_string : Warning<
6844  "type of UTF-8 string literal will change from array of const char to "
6845  "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
6846def note_cxx20_compat_utf8_string_remove_u8 : Note<
6847  "remove 'u8' prefix to avoid a change of behavior; "
6848  "Clang encodes unprefixed narrow string literals as UTF-8">;
6849def err_array_init_different_type : Error<
6850  "cannot initialize array %diff{of type $ with array of type $|"
6851  "with different type of array}0,1">;
6852def err_array_init_non_constant_array : Error<
6853  "cannot initialize array %diff{of type $ with non-constant array of type $|"
6854  "with different type of array}0,1">;
6855def ext_array_init_copy : Extension<
6856  "initialization of an array "
6857  "%diff{of type $ from a compound literal of type $|"
6858  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
6859// This is intentionally not disabled by -Wno-gnu.
6860def ext_array_init_parens : ExtWarn<
6861  "parenthesized initialization of a member array is a GNU extension">,
6862  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
6863def warn_deprecated_string_literal_conversion : Warning<
6864  "conversion from string literal to %0 is deprecated">,
6865  InGroup<CXX11CompatDeprecatedWritableStr>;
6866def ext_deprecated_string_literal_conversion : ExtWarn<
6867  "ISO C++11 does not allow conversion from string literal to %0">,
6868  InGroup<WritableStrings>, SFINAEFailure;
6869def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
6870def err_typecheck_sclass_fscope : Error<
6871  "illegal storage class on file-scoped variable">;
6872def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
6873  InGroup<MissingDeclarations>;
6874def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
6875  "of a type">, InGroup<MissingDeclarations>;
6876def err_standalone_class_nested_name_specifier : Error<
6877  "forward declaration of %select{class|struct|interface|union|enum}0 cannot "
6878  "have a nested name specifier">;
6879def err_typecheck_sclass_func : Error<"illegal storage class on function">;
6880def err_static_block_func : Error<
6881  "function declared in block scope cannot have 'static' storage class">;
6882def err_typecheck_address_of : Error<"address of %select{bit-field"
6883  "|vector element|property expression|register variable|matrix element}0 requested">;
6884def ext_typecheck_addrof_void : Extension<
6885  "ISO C forbids taking the address of an expression of type 'void'">;
6886def err_unqualified_pointer_member_function : Error<
6887  "must explicitly qualify name of member function when taking its address">;
6888def err_invalid_form_pointer_member_function : Error<
6889  "cannot create a non-constant pointer to member function">;
6890def err_address_of_function_with_pass_object_size_params: Error<
6891  "cannot take address of function %0 because parameter %1 has "
6892  "pass_object_size attribute">;
6893def err_parens_pointer_member_function : Error<
6894  "cannot parenthesize the name of a method when forming a member pointer">;
6895def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
6896  "extra '&' taking address of overloaded function">;
6897def err_typecheck_invalid_lvalue_addrof : Error<
6898  "cannot take the address of an rvalue of type %0">;
6899def ext_typecheck_addrof_temporary : ExtWarn<
6900  "taking the address of a temporary object of type %0">,
6901  InGroup<AddressOfTemporary>, DefaultError;
6902def err_typecheck_addrof_temporary : Error<
6903  "taking the address of a temporary object of type %0">;
6904def err_typecheck_addrof_dtor : Error<
6905  "taking the address of a destructor">;
6906def err_typecheck_unary_expr : Error<
6907  "invalid argument type %0 to unary expression">;
6908def err_typecheck_indirection_requires_pointer : Error<
6909  "indirection requires pointer operand (%0 invalid)">;
6910def ext_typecheck_indirection_through_void_pointer : ExtWarn<
6911  "ISO C++ does not allow indirection on operand of type %0">,
6912  InGroup<DiagGroup<"void-ptr-dereference">>;
6913def warn_indirection_through_null : Warning<
6914  "indirection of non-volatile null pointer will be deleted, not trap">,
6915  InGroup<NullDereference>;
6916def warn_binding_null_to_reference : Warning<
6917  "binding dereferenced null pointer to reference has undefined behavior">,
6918  InGroup<NullDereference>;
6919def note_indirection_through_null : Note<
6920  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
6921def warn_pointer_indirection_from_incompatible_type : Warning<
6922  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
6923  "behavior">,
6924  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6925def warn_taking_address_of_packed_member : Warning<
6926  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
6927  InGroup<DiagGroup<"address-of-packed-member">>;
6928def warn_param_mismatched_alignment : Warning<
6929  "passing %0-byte aligned argument to %1-byte aligned parameter %2%select{| of %4}3 may result in an unaligned pointer access">,
6930  InGroup<DiagGroup<"align-mismatch">>;
6931
6932def err_objc_object_assignment : Error<
6933  "cannot assign to class object (%0 invalid)">;
6934def err_typecheck_invalid_operands : Error<
6935  "invalid operands to binary expression (%0 and %1)">, Deferrable;
6936def note_typecheck_invalid_operands_converted : Note<
6937  "%select{first|second}0 operand was implicitly converted to type %1">;
6938def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
6939  "logical expression with vector %select{type %1 and non-vector type %2|types"
6940  " %1 and %2}0 is only supported in C++">;
6941def err_typecheck_sub_ptr_compatible : Error<
6942  "%diff{$ and $ are not pointers to compatible types|"
6943  "pointers to incompatible types}0,1">;
6944def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
6945  "ordered comparison between pointer and integer (%0 and %1)">;
6946def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
6947  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
6948def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
6949  "ordered comparison between pointer and zero (%0 and %1)">;
6950def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
6951  "three-way comparison between pointer and zero">;
6952def ext_typecheck_compare_complete_incomplete_pointers : Extension<
6953  "pointer comparisons before C11 "
6954  "need to be between two complete or two incomplete types; "
6955  "%0 is %select{|in}2complete and "
6956  "%1 is %select{|in}3complete">,
6957  InGroup<C11>;
6958def warn_typecheck_ordered_comparison_of_function_pointers : Warning<
6959  "ordered comparison of function pointers (%0 and %1)">,
6960  InGroup<OrderedCompareFunctionPointers>;
6961def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
6962  "ordered comparison of function pointers (%0 and %1)">,
6963  InGroup<OrderedCompareFunctionPointers>;
6964def err_typecheck_ordered_comparison_of_function_pointers : Error<
6965  "ordered comparison of function pointers (%0 and %1)">;
6966def ext_typecheck_comparison_of_fptr_to_void : Extension<
6967  "equality comparison between function pointer and void pointer (%0 and %1)">;
6968def err_typecheck_comparison_of_fptr_to_void : Error<
6969  "equality comparison between function pointer and void pointer (%0 and %1)">;
6970def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
6971  "comparison between pointer and integer (%0 and %1)">,
6972  InGroup<DiagGroup<"pointer-integer-compare">>;
6973def err_typecheck_comparison_of_pointer_integer : Error<
6974  "comparison between pointer and integer (%0 and %1)">;
6975def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
6976  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
6977  InGroup<CompareDistinctPointerType>;
6978def ext_typecheck_cond_incompatible_operands : ExtWarn<
6979  "incompatible operand types (%0 and %1)">;
6980def err_cond_voidptr_arc : Error <
6981  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
6982  "in ARC mode">;
6983def err_typecheck_comparison_of_distinct_pointers : Error<
6984  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
6985def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
6986  "%select{comparison between %diff{ ($ and $)|}0,1"
6987  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
6988  "|conditional operator with the second and third operands of type "
6989  "%diff{ ($ and $)|}0,1}2"
6990  " which are pointers to non-overlapping address spaces">;
6991
6992def select_arith_conv_kind : TextSubstitution<
6993  "%select{arithmetic between|bitwise operation between|comparison of|"
6994  "conditional expression between|compound assignment of}0">;
6995def warn_arith_conv_enum_float : Warning<
6996  "%sub{select_arith_conv_kind}0 "
6997  "%select{floating-point|enumeration}1 type %2 "
6998  "%plural{2:with|4:from|:and}0 "
6999  "%select{enumeration|floating-point}1 type %3">,
7000  InGroup<EnumFloatConversion>, DefaultIgnore;
7001def warn_arith_conv_enum_float_cxx20 : Warning<
7002  "%sub{select_arith_conv_kind}0 "
7003  "%select{floating-point|enumeration}1 type %2 "
7004  "%plural{2:with|4:from|:and}0 "
7005  "%select{enumeration|floating-point}1 type %3 is deprecated">,
7006  InGroup<DeprecatedEnumFloatConversion>;
7007def warn_arith_conv_mixed_enum_types : Warning<
7008  "%sub{select_arith_conv_kind}0 "
7009  "different enumeration types%diff{ ($ and $)|}1,2">,
7010  InGroup<EnumEnumConversion>, DefaultIgnore;
7011def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
7012  "%sub{select_arith_conv_kind}0 "
7013  "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
7014  InGroup<DeprecatedEnumEnumConversion>;
7015def warn_arith_conv_mixed_anon_enum_types : Warning<
7016  warn_arith_conv_mixed_enum_types.Text>,
7017  InGroup<AnonEnumEnumConversion>, DefaultIgnore;
7018def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
7019  warn_arith_conv_mixed_enum_types_cxx20.Text>,
7020  InGroup<DeprecatedAnonEnumEnumConversion>;
7021def warn_conditional_mixed_enum_types : Warning<
7022  warn_arith_conv_mixed_enum_types.Text>,
7023  InGroup<EnumCompareConditional>, DefaultIgnore;
7024def warn_conditional_mixed_enum_types_cxx20 : Warning<
7025  warn_arith_conv_mixed_enum_types_cxx20.Text>,
7026  InGroup<DeprecatedEnumCompareConditional>;
7027def warn_comparison_mixed_enum_types : Warning<
7028  warn_arith_conv_mixed_enum_types.Text>,
7029  InGroup<EnumCompare>;
7030def warn_comparison_mixed_enum_types_cxx20 : Warning<
7031  warn_arith_conv_mixed_enum_types_cxx20.Text>,
7032  InGroup<DeprecatedEnumCompare>;
7033def warn_comparison_of_mixed_enum_types_switch : Warning<
7034  "comparison of different enumeration types in switch statement"
7035  "%diff{ ($ and $)|}0,1">,
7036  InGroup<EnumCompareSwitch>;
7037
7038def err_typecheck_assign_const : Error<
7039  "%select{"
7040  "cannot assign to return value because function %1 returns a const value|"
7041  "cannot assign to variable %1 with const-qualified type %2|"
7042  "cannot assign to %select{non-|}1static data member %2 "
7043  "with const-qualified type %3|"
7044  "cannot assign to non-static data member within const member function %1|"
7045  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
7046  "with %select{|nested }3const-qualified data member %4|"
7047  "read-only variable is not assignable}0">;
7048
7049def note_typecheck_assign_const : Note<
7050  "%select{"
7051  "function %1 which returns const-qualified type %2 declared here|"
7052  "variable %1 declared const here|"
7053  "%select{non-|}1static data member %2 declared const here|"
7054  "member function %q1 is declared const here|"
7055  "%select{|nested }1data member %2 declared const here}0">;
7056
7057def warn_unsigned_always_true_comparison : Warning<
7058  "result of comparison of %select{%3|unsigned expression}0 %2 "
7059  "%select{unsigned expression|%3}0 is always %4">,
7060  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
7061def warn_unsigned_char_always_true_comparison : Warning<
7062  "result of comparison of %select{%3|char expression}0 %2 "
7063  "%select{char expression|%3}0 is always %4, since char is interpreted as "
7064  "unsigned">, InGroup<TautologicalUnsignedCharZeroCompare>, DefaultIgnore;
7065def warn_unsigned_enum_always_true_comparison : Warning<
7066  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
7067  "%select{unsigned enum expression|%3}0 is always %4">,
7068  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
7069def warn_tautological_constant_compare : Warning<
7070  "result of comparison %select{%3|%1}0 %2 "
7071  "%select{%1|%3}0 is always %4">,
7072  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
7073def warn_tautological_compare_objc_bool : Warning<
7074  "result of comparison of constant %0 with expression of type 'BOOL'"
7075  " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
7076  InGroup<TautologicalObjCBoolCompare>;
7077def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
7078def warn_tautological_compare_value_range : Warning<
7079  "result of comparison of "
7080  "%select{%4|%sub{subst_int_range}1,2}0 %3 "
7081  "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
7082  InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
7083
7084def warn_mixed_sign_comparison : Warning<
7085  "comparison of integers of different signs: %0 and %1">,
7086  InGroup<SignCompare>, DefaultIgnore;
7087def warn_out_of_range_compare : Warning<
7088  "result of comparison of %select{constant %0|true|false}1 with "
7089  "%select{expression of type %2|boolean expression}3 is always %4">,
7090  InGroup<TautologicalOutOfRangeCompare>;
7091def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
7092  InGroup<TautologicalConstantCompare>;
7093def warn_integer_constants_in_conditional_always_true : Warning<
7094  "converting the result of '?:' with integer constants to a boolean always "
7095  "evaluates to 'true'">,
7096  InGroup<TautologicalConstantCompare>;
7097def warn_left_shift_always : Warning<
7098  "converting the result of '<<' to a boolean always evaluates "
7099  "to %select{false|true}0">,
7100  InGroup<TautologicalConstantCompare>;
7101def warn_null_in_arithmetic_operation : Warning<
7102  "use of NULL in arithmetic operation">,
7103  InGroup<NullArithmetic>;
7104def warn_null_in_comparison_operation : Warning<
7105  "comparison between NULL and non-pointer "
7106  "%select{(%1 and NULL)|(NULL and %1)}0">,
7107  InGroup<NullArithmetic>;
7108def err_shift_rhs_only_vector : Error<
7109  "requested shift is a vector of type %0 but the first operand is not a "
7110  "vector (%1)">;
7111
7112def warn_logical_not_on_lhs_of_check : Warning<
7113  "logical not is only applied to the left hand side of this "
7114  "%select{comparison|bitwise operator}0">,
7115  InGroup<LogicalNotParentheses>;
7116def note_logical_not_fix : Note<
7117  "add parentheses after the '!' to evaluate the "
7118  "%select{comparison|bitwise operator}0 first">;
7119def note_logical_not_silence_with_parens : Note<
7120  "add parentheses around left hand side expression to silence this warning">;
7121
7122def err_invalid_this_use : Error<
7123  "invalid use of 'this' outside of a non-static member function">;
7124def err_this_static_member_func : Error<
7125  "'this' cannot be%select{| implicitly}0 used in a static member function "
7126  "declaration">;
7127def err_invalid_member_use_in_static_method : Error<
7128  "invalid use of member %0 in static member function">;
7129def err_invalid_qualified_function_type : Error<
7130  "%select{non-member function|static member function|deduction guide}0 "
7131  "%select{of type %2 |}1cannot have '%3' qualifier">;
7132def err_compound_qualified_function_type : Error<
7133  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
7134  "cannot have '%3' qualifier">;
7135def err_qualified_function_typeid : Error<
7136  "type operand %0 of 'typeid' cannot have '%1' qualifier">;
7137
7138def err_ref_qualifier_overload : Error<
7139  "cannot overload a member function %select{without a ref-qualifier|with "
7140  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
7141  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
7142
7143def err_invalid_non_static_member_use : Error<
7144  "invalid use of non-static data member %0">;
7145def err_nested_non_static_member_use : Error<
7146  "%select{call to non-static member function|use of non-static data member}0 "
7147  "%2 of %1 from nested type %3">;
7148def warn_cxx98_compat_non_static_member_use : Warning<
7149  "use of non-static data member %0 in an unevaluated context is "
7150  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
7151def err_invalid_incomplete_type_use : Error<
7152  "invalid use of incomplete type %0">;
7153def err_builtin_func_cast_more_than_one_arg : Error<
7154  "function-style cast to a builtin type can only take one argument">;
7155def err_value_init_for_array_type : Error<
7156  "array types cannot be value-initialized">;
7157def err_init_for_function_type : Error<
7158  "cannot create object of function type %0">;
7159def warn_format_nonliteral_noargs : Warning<
7160  "format string is not a string literal (potentially insecure)">,
7161  InGroup<FormatSecurity>;
7162def warn_format_nonliteral : Warning<
7163  "format string is not a string literal">,
7164  InGroup<FormatNonLiteral>, DefaultIgnore;
7165
7166def err_unexpected_interface : Error<
7167  "unexpected interface name %0: expected expression">;
7168def err_ref_non_value : Error<"%0 does not refer to a value">;
7169def err_ref_vm_type : Error<
7170  "cannot refer to declaration with a variably modified type inside block">;
7171def err_ref_flexarray_type : Error<
7172  "cannot refer to declaration of structure variable with flexible array member "
7173  "inside block">;
7174def err_ref_array_type : Error<
7175  "cannot refer to declaration with an array type inside block">;
7176def err_property_not_found : Error<
7177  "property %0 not found on object of type %1">;
7178def err_invalid_property_name : Error<
7179  "%0 is not a valid property name (accessing an object of type %1)">;
7180def err_getter_not_found : Error<
7181  "no getter method for read from property">;
7182def err_objc_subscript_method_not_found : Error<
7183  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
7184  "found on object of type %0">;
7185def err_objc_subscript_index_type : Error<
7186  "method index parameter type %0 is not integral type">;
7187def err_objc_subscript_key_type : Error<
7188  "method key parameter type %0 is not object type">;
7189def err_objc_subscript_dic_object_type : Error<
7190  "method object parameter type %0 is not object type">;
7191def err_objc_subscript_object_type : Error<
7192  "cannot assign to this %select{dictionary|array}1 because assigning method's "
7193  "2nd parameter of type %0 is not an Objective-C pointer type">;
7194def err_objc_subscript_base_type : Error<
7195  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
7196def err_objc_multiple_subscript_type_conversion : Error<
7197  "indexing expression is invalid because subscript type %0 has "
7198  "multiple type conversion functions">;
7199def err_objc_subscript_type_conversion : Error<
7200  "indexing expression is invalid because subscript type %0 is not an integral"
7201  " or Objective-C pointer type">;
7202def err_objc_subscript_pointer : Error<
7203  "indexing expression is invalid because subscript type %0 is not an"
7204  " Objective-C pointer">;
7205def err_objc_indexing_method_result_type : Error<
7206  "method for accessing %select{dictionary|array}1 element must have Objective-C"
7207  " object return type instead of %0">;
7208def err_objc_index_incomplete_class_type : Error<
7209  "Objective-C index expression has incomplete class type %0">;
7210def err_illegal_container_subscripting_op : Error<
7211  "illegal operation on Objective-C container subscripting">;
7212def err_property_not_found_forward_class : Error<
7213  "property %0 cannot be found in forward class object %1">;
7214def err_property_not_as_forward_class : Error<
7215  "property %0 refers to an incomplete Objective-C class %1 "
7216  "(with no @interface available)">;
7217def note_forward_class : Note<
7218  "forward declaration of class here">;
7219def err_duplicate_property : Error<
7220  "property has a previous declaration">;
7221def ext_gnu_void_ptr : Extension<
7222  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
7223  InGroup<GNUPointerArith>;
7224def ext_gnu_ptr_func_arith : Extension<
7225  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
7226  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
7227  InGroup<GNUPointerArith>;
7228def err_readonly_message_assignment : Error<
7229  "assigning to 'readonly' return result of an Objective-C message not allowed">;
7230def ext_integer_increment_complex : Extension<
7231  "ISO C does not support '++'/'--' on complex integer type %0">;
7232def ext_integer_complement_complex : Extension<
7233  "ISO C does not support '~' for complex conjugation of %0">;
7234def err_nosetter_property_assignment : Error<
7235  "%select{assignment to readonly property|"
7236  "no setter method %1 for assignment to property}0">;
7237def err_nosetter_property_incdec : Error<
7238  "%select{%select{increment|decrement}1 of readonly property|"
7239  "no setter method %2 for %select{increment|decrement}1 of property}0">;
7240def err_nogetter_property_compound_assignment : Error<
7241  "a getter method is needed to perform a compound assignment on a property">;
7242def err_nogetter_property_incdec : Error<
7243  "no getter method %1 for %select{increment|decrement}0 of property">;
7244def err_no_subobject_property_setting : Error<
7245  "expression is not assignable">;
7246def err_qualified_objc_access : Error<
7247  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
7248
7249def ext_freestanding_complex : Extension<
7250  "complex numbers are an extension in a freestanding C99 implementation">;
7251
7252// FIXME: Remove when we support imaginary.
7253def err_imaginary_not_supported : Error<"imaginary types are not supported">;
7254
7255// Obj-c expressions
7256def warn_root_inst_method_not_found : Warning<
7257  "instance method %0 is being used on 'Class' which is not in the root class">,
7258  InGroup<MethodAccess>;
7259def warn_class_method_not_found : Warning<
7260  "class method %objcclass0 not found (return type defaults to 'id')">,
7261  InGroup<MethodAccess>;
7262def warn_instance_method_on_class_found : Warning<
7263  "instance method %0 found instead of class method %1">,
7264  InGroup<MethodAccess>;
7265def warn_inst_method_not_found : Warning<
7266  "instance method %objcinstance0 not found (return type defaults to 'id')">,
7267  InGroup<MethodAccess>;
7268def warn_instance_method_not_found_with_typo : Warning<
7269  "instance method %objcinstance0 not found (return type defaults to 'id')"
7270  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
7271def warn_class_method_not_found_with_typo : Warning<
7272  "class method %objcclass0 not found (return type defaults to 'id')"
7273  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
7274def err_method_not_found_with_typo : Error<
7275  "%select{instance|class}1 method %0 not found "
7276  "; did you mean %2?">;
7277def err_no_super_class_message : Error<
7278  "no @interface declaration found in class messaging of %0">;
7279def err_root_class_cannot_use_super : Error<
7280  "%0 cannot use 'super' because it is a root class">;
7281def err_invalid_receiver_to_message_super : Error<
7282  "'super' is only valid in a method body">;
7283def err_invalid_receiver_class_message : Error<
7284  "receiver type %0 is not an Objective-C class">;
7285def err_missing_open_square_message_send : Error<
7286  "missing '[' at start of message send expression">;
7287def warn_bad_receiver_type : Warning<
7288  "receiver type %0 is not 'id' or interface pointer, consider "
7289  "casting it to 'id'">,InGroup<ObjCReceiver>;
7290def err_bad_receiver_type : Error<"bad receiver type %0">;
7291def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
7292def err_unknown_receiver_suggest : Error<
7293  "unknown receiver %0; did you mean %1?">;
7294def err_objc_throw_expects_object : Error<
7295  "@throw requires an Objective-C object type (%0 invalid)">;
7296def err_objc_synchronized_expects_object : Error<
7297  "@synchronized requires an Objective-C object type (%0 invalid)">;
7298def err_rethrow_used_outside_catch : Error<
7299  "@throw (rethrow) used outside of a @catch block">;
7300def err_attribute_multiple_objc_gc : Error<
7301  "multiple garbage collection attributes specified for type">;
7302def err_catch_param_not_objc_type : Error<
7303  "@catch parameter is not a pointer to an interface type">;
7304def err_illegal_qualifiers_on_catch_parm : Error<
7305  "illegal qualifiers on @catch parameter">;
7306def err_storage_spec_on_catch_parm : Error<
7307  "@catch parameter cannot have storage specifier '%0'">;
7308def warn_register_objc_catch_parm : Warning<
7309  "'register' storage specifier on @catch parameter will be ignored">;
7310def err_qualified_objc_catch_parm : Error<
7311  "@catch parameter declarator cannot be qualified">;
7312def warn_objc_pointer_cxx_catch_fragile : Warning<
7313  "cannot catch an exception thrown with @throw in C++ in the non-unified "
7314  "exception model">, InGroup<ObjCNonUnifiedException>;
7315def err_objc_object_catch : Error<
7316  "cannot catch an Objective-C object by value">;
7317def err_incomplete_type_objc_at_encode : Error<
7318  "'@encode' of incomplete type %0">;
7319def warn_objc_circular_container : Warning<
7320  "adding %0 to %1 might cause circular dependency in container">,
7321  InGroup<DiagGroup<"objc-circular-container">>;
7322def note_objc_circular_container_declared_here : Note<"%0 declared here">;
7323def warn_objc_unsafe_perform_selector : Warning<
7324  "%0 is incompatible with selectors that return a "
7325  "%select{struct|union|vector}1 type">,
7326  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
7327def note_objc_unsafe_perform_selector_method_declared_here :  Note<
7328  "method %0 that returns %1 declared here">;
7329def err_attribute_arm_builtin_alias : Error<
7330  "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
7331def err_attribute_arm_mve_polymorphism : Error<
7332  "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
7333
7334def warn_setter_getter_impl_required : Warning<
7335  "property %0 requires method %1 to be defined - "
7336  "use @synthesize, @dynamic or provide a method implementation "
7337  "in this class implementation">,
7338  InGroup<ObjCPropertyImpl>;
7339def warn_setter_getter_impl_required_in_category : Warning<
7340  "property %0 requires method %1 to be defined - "
7341  "use @dynamic or provide a method implementation in this category">,
7342  InGroup<ObjCPropertyImpl>;
7343def note_parameter_named_here : Note<
7344  "passing argument to parameter %0 here">;
7345def note_parameter_here : Note<
7346  "passing argument to parameter here">;
7347def note_method_return_type_change : Note<
7348  "compiler has implicitly changed method %0 return type">;
7349
7350def warn_impl_required_for_class_property : Warning<
7351  "class property %0 requires method %1 to be defined - "
7352  "use @dynamic or provide a method implementation "
7353  "in this class implementation">,
7354  InGroup<ObjCPropertyImpl>;
7355def warn_impl_required_in_category_for_class_property : Warning<
7356  "class property %0 requires method %1 to be defined - "
7357  "use @dynamic or provide a method implementation in this category">,
7358  InGroup<ObjCPropertyImpl>;
7359
7360// C++ casts
7361// These messages adhere to the TryCast pattern: %0 is an int specifying the
7362// cast type, %1 is the source type, %2 is the destination type.
7363def err_bad_reinterpret_cast_overload : Error<
7364  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
7365
7366def warn_reinterpret_different_from_static : Warning<
7367  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
7368  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
7369  "'static_cast'">, InGroup<ReinterpretBaseClass>;
7370def note_reinterpret_updowncast_use_static: Note<
7371  "use 'static_cast' to adjust the pointer correctly while "
7372  "%select{upcasting|downcasting}0">;
7373
7374def err_bad_static_cast_overload : Error<
7375  "address of overloaded function %0 cannot be static_cast to type %1">;
7376
7377def err_bad_cstyle_cast_overload : Error<
7378  "address of overloaded function %0 cannot be cast to type %1">;
7379
7380
7381def err_bad_cxx_cast_generic : Error<
7382  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7383  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7384def err_bad_cxx_cast_unrelated_class : Error<
7385  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7386  "functional-style cast|}0 from %1 to %2, which are not related by "
7387  "inheritance, is not allowed">;
7388def note_type_incomplete : Note<"%0 is incomplete">;
7389def err_bad_cxx_cast_rvalue : Error<
7390  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7391  "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7392def err_bad_cxx_cast_bitfield : Error<
7393  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7394  "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7395def err_bad_cxx_cast_qualifiers_away : Error<
7396  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7397  "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7398def err_bad_cxx_cast_addr_space_mismatch : Error<
7399  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7400  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7401  " spaces">;
7402def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7403  "ISO C++ does not allow "
7404  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7405  "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
7406  "even though the source and destination types are unrelated">,
7407  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
7408def err_bad_const_cast_dest : Error<
7409  "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
7410  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
7411def ext_cast_fn_obj : Extension<
7412  "cast between pointer-to-function and pointer-to-object is an extension">;
7413def ext_ms_cast_fn_obj : ExtWarn<
7414  "static_cast between pointer-to-function and pointer-to-object is a "
7415  "Microsoft extension">, InGroup<MicrosoftCast>;
7416def warn_cxx98_compat_cast_fn_obj : Warning<
7417  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
7418  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7419def err_bad_reinterpret_cast_small_int : Error<
7420  "cast from pointer to smaller type %2 loses information">;
7421def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
7422  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7423  "to scalar %2 of different size">;
7424def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
7425  "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
7426  "to vector %2 of different size">;
7427def err_bad_cxx_cast_vector_to_vector_different_size : Error<
7428  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7429  "to vector %2 of different size">;
7430def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
7431  "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
7432  "changes address space of nested pointers">,
7433  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7434def err_bad_lvalue_to_rvalue_cast : Error<
7435  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
7436  "not compatible">;
7437def err_bad_rvalue_to_rvalue_cast : Error<
7438  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
7439  "not compatible">;
7440def err_bad_static_cast_pointer_nonpointer : Error<
7441  "cannot cast from type %1 to pointer type %2">;
7442def err_bad_static_cast_member_pointer_nonmp : Error<
7443  "cannot cast from type %1 to member pointer type %2">;
7444def err_bad_cxx_cast_member_pointer_size : Error<
7445  "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
7446  "type %1 to member pointer type %2 of different size">;
7447def err_bad_reinterpret_cast_reference : Error<
7448  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
7449def warn_undefined_reinterpret_cast : Warning<
7450  "reinterpret_cast from %0 to %1 has undefined behavior">,
7451  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7452
7453// These messages don't adhere to the pattern.
7454// FIXME: Display the path somehow better.
7455def err_ambiguous_base_to_derived_cast : Error<
7456  "ambiguous cast from base %0 to derived %1:%2">;
7457def err_static_downcast_via_virtual : Error<
7458  "cannot cast %0 to %1 via virtual base %2">;
7459def err_downcast_from_inaccessible_base : Error<
7460  "cannot cast %select{private|protected}2 base class %1 to %0">;
7461def err_upcast_to_inaccessible_base : Error<
7462  "cannot cast %0 to its %select{private|protected}2 base class %1">;
7463def err_bad_dynamic_cast_not_ref_or_ptr : Error<
7464  "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
7465def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
7466def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
7467def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
7468def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
7469
7470// Other C++ expressions
7471def err_need_header_before_typeid : Error<
7472  "you need to include <typeinfo> before using the 'typeid' operator">;
7473def err_need_header_before_placement_new : Error<
7474  "no matching %0 function for non-allocating placement new expression; "
7475  "include <new>">;
7476def err_ms___leave_not_in___try : Error<
7477  "'__leave' statement not in __try block">;
7478def err_uuidof_without_guid : Error<
7479  "cannot call operator __uuidof on a type with no GUID">;
7480def err_uuidof_with_multiple_guids : Error<
7481  "cannot call operator __uuidof on a type with multiple GUIDs">;
7482def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
7483def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
7484def err_static_illegal_in_new : Error<
7485  "the 'static' modifier for the array size is not legal in new expressions">;
7486def err_array_new_needs_size : Error<
7487  "array size must be specified in new expression with no initializer">;
7488def err_bad_new_type : Error<
7489  "cannot allocate %select{function|reference}1 type %0 with new">;
7490def err_new_incomplete_or_sizeless_type : Error<
7491  "allocation of %select{incomplete|sizeless}0 type %1">;
7492def err_new_array_nonconst : Error<
7493  "only the first dimension of an allocated array may have dynamic size">;
7494def err_new_array_size_unknown_from_init : Error<
7495  "cannot determine allocated array size from initializer">;
7496def err_new_array_init_args : Error<
7497  "array 'new' cannot have initialization arguments">;
7498def ext_new_paren_array_nonconst : ExtWarn<
7499  "when type is in parentheses, array cannot have dynamic size">;
7500def err_placement_new_non_placement_delete : Error<
7501  "'new' expression with placement arguments refers to non-placement "
7502  "'operator delete'">;
7503def err_array_size_not_integral : Error<
7504  "array size expression must have integral or %select{|unscoped }0"
7505  "enumeration type, not %1">;
7506def err_array_size_incomplete_type : Error<
7507  "array size expression has incomplete class type %0">;
7508def err_array_size_explicit_conversion : Error<
7509  "array size expression of type %0 requires explicit conversion to type %1">;
7510def note_array_size_conversion : Note<
7511  "conversion to %select{integral|enumeration}0 type %1 declared here">;
7512def err_array_size_ambiguous_conversion : Error<
7513  "ambiguous conversion of array size expression of type %0 to an integral or "
7514  "enumeration type">;
7515def ext_array_size_conversion : Extension<
7516  "implicit conversion from array size expression of type %0 to "
7517  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7518  InGroup<CXX11>;
7519def warn_cxx98_compat_array_size_conversion : Warning<
7520  "implicit conversion from array size expression of type %0 to "
7521  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7522  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7523def err_address_space_qualified_new : Error<
7524  "'new' cannot allocate objects of type %0 in address space '%1'">;
7525def err_address_space_qualified_delete : Error<
7526  "'delete' cannot delete objects of type %0 in address space '%1'">;
7527
7528def err_default_init_const : Error<
7529  "default initialization of an object of const type %0"
7530  "%select{| without a user-provided default constructor}1">;
7531def ext_default_init_const : ExtWarn<
7532  "default initialization of an object of const type %0"
7533  "%select{| without a user-provided default constructor}1 "
7534  "is a Microsoft extension">,
7535  InGroup<MicrosoftConstInit>;
7536def err_delete_operand : Error<"cannot delete expression of type %0">;
7537def ext_delete_void_ptr_operand : ExtWarn<
7538  "cannot delete expression with pointer-to-'void' type %0">,
7539  InGroup<DeleteIncomplete>;
7540def err_ambiguous_delete_operand : Error<
7541  "ambiguous conversion of delete expression of type %0 to a pointer">;
7542def warn_delete_incomplete : Warning<
7543  "deleting pointer to incomplete type %0 may cause undefined behavior">,
7544  InGroup<DeleteIncomplete>;
7545def err_delete_incomplete_class_type : Error<
7546  "deleting incomplete class type %0; no conversions to pointer type">;
7547def err_delete_explicit_conversion : Error<
7548  "converting delete expression from type %0 to type %1 invokes an explicit "
7549  "conversion function">;
7550def note_delete_conversion : Note<"conversion to pointer type %0">;
7551def warn_delete_array_type : Warning<
7552  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7553def warn_mismatched_delete_new : Warning<
7554  "'delete%select{|[]}0' applied to a pointer that was allocated with "
7555  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7556  InGroup<DiagGroup<"mismatched-new-delete">>;
7557def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7558def err_no_suitable_delete_member_function_found : Error<
7559  "no suitable member %0 in %1">;
7560def err_ambiguous_suitable_delete_member_function_found : Error<
7561  "multiple suitable %0 functions in %1">;
7562def warn_ambiguous_suitable_delete_function_found : Warning<
7563  "multiple suitable %0 functions for %1; no 'operator delete' function "
7564  "will be invoked if initialization throws an exception">,
7565  InGroup<DiagGroup<"ambiguous-delete">>;
7566def note_member_declared_here : Note<
7567  "member %0 declared here">;
7568def note_member_first_declared_here : Note<
7569  "member %0 first declared here">;
7570def warn_bitwise_instead_of_logical : Warning<
7571  "use of bitwise '%0' with boolean operands">,
7572  InGroup<BitwiseInsteadOfLogical>, DefaultIgnore;
7573def warn_bitwise_negation_bool : Warning<
7574  "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7575  "did you mean logical negation?">,
7576  InGroup<BoolOperation>, DefaultIgnore;
7577def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7578def warn_increment_bool : Warning<
7579  "incrementing expression of type bool is deprecated and "
7580  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7581def ext_increment_bool : ExtWarn<
7582  "ISO C++17 does not allow incrementing expression of type bool">,
7583  DefaultError, InGroup<IncrementBool>;
7584def err_increment_decrement_enum : Error<
7585  "cannot %select{decrement|increment}0 expression of enum type %1">;
7586
7587def warn_deprecated_increment_decrement_volatile : Warning<
7588  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7589  "is deprecated">, InGroup<DeprecatedVolatile>;
7590def warn_deprecated_simple_assign_volatile : Warning<
7591  "use of result of assignment to object of volatile-qualified type %0 "
7592  "is deprecated">, InGroup<DeprecatedVolatile>;
7593def warn_deprecated_compound_assign_volatile : Warning<
7594  "compound assignment to object of volatile-qualified type %0 is deprecated">,
7595  InGroup<DeprecatedVolatile>;
7596def warn_deprecated_volatile_return : Warning<
7597  "volatile-qualified return type %0 is deprecated">,
7598  InGroup<DeprecatedVolatile>;
7599def warn_deprecated_volatile_param : Warning<
7600  "volatile-qualified parameter type %0 is deprecated">,
7601  InGroup<DeprecatedVolatile>;
7602def warn_deprecated_volatile_structured_binding : Warning<
7603  "volatile qualifier in structured binding declaration is deprecated">,
7604  InGroup<DeprecatedVolatile>;
7605
7606def warn_deprecated_altivec_src_compat : Warning<
7607  "Current handling of vector bool and vector pixel types in this context are "
7608  "deprecated. The default behaviour will soon change to that implied by the "
7609  "'-altivec-compat=xl' option">,
7610  InGroup<DiagGroup<"deprecated-altivec-src-compat">>;
7611
7612def warn_deprecated_lax_vec_conv_all : Warning<
7613  "Implicit conversion between vector types ('%0' and '%1') is deprecated. "
7614  "In the future, the behavior implied by '-fno-lax-vector-conversions' "
7615  "will be the default.">,
7616  InGroup<DiagGroup<"deprecate-lax-vec-conv-all">>;
7617
7618def err_catch_incomplete_ptr : Error<
7619  "cannot catch pointer to incomplete type %0">;
7620def err_catch_incomplete_ref : Error<
7621  "cannot catch reference to incomplete type %0">;
7622def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7623def err_catch_sizeless : Error<
7624  "cannot catch %select{|reference to }0sizeless type %1">;
7625def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7626def err_catch_variably_modified : Error<
7627  "cannot catch variably modified type %0">;
7628def err_qualified_catch_declarator : Error<
7629  "exception declarator cannot be qualified">;
7630def err_early_catch_all : Error<"catch-all handler must come last">;
7631def err_bad_memptr_rhs : Error<
7632  "right hand operand to %0 has non-pointer-to-member type %1">;
7633def err_bad_memptr_lhs : Error<
7634  "left hand operand to %0 must be a %select{|pointer to }1class "
7635  "compatible with the right hand operand, but is %2">;
7636def err_memptr_incomplete : Error<
7637  "member pointer has incomplete base type %0">;
7638def warn_exception_caught_by_earlier_handler : Warning<
7639  "exception of type %0 will be caught by earlier handler">,
7640  InGroup<Exceptions>;
7641def note_previous_exception_handler : Note<"for type %0">;
7642def err_exceptions_disabled : Error<
7643  "cannot use '%0' with exceptions disabled">;
7644def err_objc_exceptions_disabled : Error<
7645  "cannot use '%0' with Objective-C exceptions disabled">;
7646def warn_throw_in_noexcept_func : Warning<
7647  "%0 has a non-throwing exception specification but can still throw">,
7648  InGroup<Exceptions>;
7649def note_throw_in_dtor : Note<
7650  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7651  "non-throwing}1 exception specification">;
7652def note_throw_in_function : Note<"function declared non-throwing here">;
7653def err_seh_try_outside_functions : Error<
7654  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7655def err_mixing_cxx_try_seh_try : Error<
7656  "cannot use %select{C++ 'try'|Objective-C '@try'}0 "
7657  "in the same function as SEH '__try'">;
7658def err_seh_try_unsupported : Error<
7659  "SEH '__try' is not supported on this target">;
7660def note_conflicting_try_here : Note<
7661  "conflicting %0 here">;
7662def warn_jump_out_of_seh_finally : Warning<
7663  "jump out of __finally block has undefined behavior">,
7664  InGroup<DiagGroup<"jump-seh-finally">>;
7665def warn_non_virtual_dtor : Warning<
7666  "%0 has virtual functions but non-virtual destructor">,
7667  InGroup<NonVirtualDtor>, DefaultIgnore;
7668def warn_delete_non_virtual_dtor : Warning<
7669  "%select{delete|destructor}0 called on non-final %1 that has "
7670  "virtual functions but non-virtual destructor">,
7671  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7672def note_delete_non_virtual : Note<
7673  "qualify call to silence this warning">;
7674def warn_delete_abstract_non_virtual_dtor : Warning<
7675  "%select{delete|destructor}0 called on %1 that is abstract but has "
7676  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7677def warn_overloaded_virtual : Warning<
7678  "%q0 hides overloaded virtual %select{function|functions}1">,
7679  InGroup<OverloadedVirtual>, DefaultIgnore;
7680def note_hidden_overloaded_virtual_declared_here : Note<
7681  "hidden overloaded virtual function %q0 declared here"
7682  "%select{|: different classes%diff{ ($ vs $)|}2,3"
7683  "|: different number of parameters (%2 vs %3)"
7684  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7685  "|: different return type%diff{ ($ vs $)|}2,3"
7686  "|: different qualifiers (%2 vs %3)"
7687  "|: different exception specifications}1">;
7688def warn_using_directive_in_header : Warning<
7689  "using namespace directive in global context in header">,
7690  InGroup<HeaderHygiene>, DefaultIgnore;
7691def warn_overaligned_type : Warning<
7692  "type %0 requires %1 bytes of alignment and the default allocator only "
7693  "guarantees %2 bytes">,
7694  InGroup<OveralignedType>, DefaultIgnore;
7695def err_aligned_allocation_unavailable : Error<
7696  "aligned %select{allocation|deallocation}0 function of type '%1' is "
7697  "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
7698def note_silence_aligned_allocation_unavailable : Note<
7699  "if you supply your own aligned allocation functions, use "
7700  "-faligned-allocation to silence this diagnostic">;
7701
7702def err_conditional_void_nonvoid : Error<
7703  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7704  "is of type %0">;
7705def err_conditional_ambiguous : Error<
7706  "conditional expression is ambiguous; "
7707  "%diff{$ can be converted to $ and vice versa|"
7708  "types can be convert to each other}0,1">;
7709def err_conditional_ambiguous_ovl : Error<
7710  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7711  "can be converted to several common types">;
7712def err_conditional_vector_size : Error<
7713  "vector condition type %0 and result type %1 do not have the same number "
7714  "of elements">;
7715def err_conditional_vector_element_size : Error<
7716  "vector condition type %0 and result type %1 do not have elements of the "
7717  "same size">;
7718def err_conditional_vector_has_void : Error<
7719  "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7720def err_conditional_vector_operand_type
7721    : Error<"enumeration type %0 is not allowed in a vector conditional">;
7722def err_conditional_vector_cond_result_mismatch
7723    : Error<"cannot mix vectors and extended vectors in a vector conditional">;
7724def err_conditional_vector_mismatched
7725    : Error<"vector operands to the vector conditional must be the same type "
7726            "%diff{($ and $)|}0,1}">;
7727
7728def err_throw_incomplete : Error<
7729  "cannot throw object of incomplete type %0">;
7730def err_throw_incomplete_ptr : Error<
7731  "cannot throw pointer to object of incomplete type %0">;
7732def err_throw_sizeless : Error<
7733  "cannot throw object of sizeless type %0">;
7734def warn_throw_underaligned_obj : Warning<
7735  "underaligned exception object thrown">,
7736  InGroup<UnderalignedExceptionObject>;
7737def note_throw_underaligned_obj : Note<
7738  "required alignment of type %0 (%1 bytes) is larger than the supported "
7739  "alignment of C++ exception objects on this target (%2 bytes)">;
7740def err_return_in_constructor_handler : Error<
7741  "return in the catch of a function try block of a constructor is illegal">;
7742def warn_cdtor_function_try_handler_mem_expr : Warning<
7743  "cannot refer to a non-static member from the handler of a "
7744  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
7745
7746let CategoryName = "Lambda Issue" in {
7747  def err_capture_more_than_once : Error<
7748    "%0 can appear only once in a capture list">;
7749  def err_reference_capture_with_reference_default : Error<
7750    "'&' cannot precede a capture when the capture default is '&'">;
7751  def err_copy_capture_with_copy_default : Error<
7752    "'&' must precede a capture when the capture default is '='">;
7753  def err_capture_does_not_name_variable : Error<
7754    "%0 in capture list does not name a variable">;
7755  def err_capture_non_automatic_variable : Error<
7756    "%0 cannot be captured because it does not have automatic storage "
7757    "duration">;
7758  def err_this_capture : Error<
7759    "'this' cannot be %select{implicitly |}0captured in this context">;
7760  def note_lambda_this_capture_fixit : Note<
7761    "explicitly capture 'this'">;
7762  def err_lambda_capture_anonymous_var : Error<
7763    "unnamed variable cannot be implicitly captured in a lambda expression">;
7764  def err_lambda_capture_flexarray_type : Error<
7765    "variable %0 with flexible array member cannot be captured in "
7766    "a lambda expression">;
7767  def err_lambda_impcap : Error<
7768    "variable %0 cannot be implicitly captured in a lambda with no "
7769    "capture-default specified">;
7770  def note_lambda_variable_capture_fixit : Note<
7771    "capture %0 by %select{value|reference}1">;
7772  def note_lambda_default_capture_fixit : Note<
7773    "default capture by %select{value|reference}0">;
7774  def note_lambda_decl : Note<"lambda expression begins here">;
7775  def err_lambda_unevaluated_operand : Error<
7776    "lambda expression in an unevaluated operand">;
7777  def err_lambda_in_constant_expression : Error<
7778    "a lambda expression may not appear inside of a constant expression">;
7779  def err_lambda_in_invalid_context : Error<
7780    "a lambda expression cannot appear in this context">;
7781  def err_lambda_return_init_list : Error<
7782    "cannot deduce lambda return type from initializer list">;
7783  def err_lambda_capture_default_arg : Error<
7784    "lambda expression in default argument cannot capture any entity">;
7785  def err_lambda_incomplete_result : Error<
7786    "incomplete result type %0 in lambda expression">;
7787  def err_noreturn_lambda_has_return_expr : Error<
7788    "lambda declared 'noreturn' should not return">;
7789  def warn_maybe_falloff_nonvoid_lambda : Warning<
7790    "non-void lambda does not return a value in all control paths">,
7791    InGroup<ReturnType>;
7792  def warn_falloff_nonvoid_lambda : Warning<
7793    "non-void lambda does not return a value">,
7794    InGroup<ReturnType>;
7795  def err_access_lambda_capture : Error<
7796    // The ERRORs represent other special members that aren't constructors, in
7797    // hopes that someone will bother noticing and reporting if they appear
7798    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
7799    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
7800    AccessControl;
7801  def note_lambda_to_block_conv : Note<
7802    "implicit capture of lambda object due to conversion to block pointer "
7803    "here">;
7804  def note_var_explicitly_captured_here : Note<"variable %0 is"
7805    "%select{| explicitly}1 captured here">;
7806
7807  // C++14 lambda init-captures.
7808  def warn_cxx11_compat_init_capture : Warning<
7809    "initialized lambda captures are incompatible with C++ standards "
7810    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
7811  def ext_init_capture : ExtWarn<
7812    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
7813  def err_init_capture_no_expression : Error<
7814    "initializer missing for lambda capture %0">;
7815  def err_init_capture_multiple_expressions : Error<
7816    "initializer for lambda capture %0 contains multiple expressions">;
7817  def err_init_capture_paren_braces : Error<
7818    "cannot deduce type for lambda capture %1 from "
7819    "%select{parenthesized|nested}0 initializer list">;
7820  def err_init_capture_deduction_failure : Error<
7821    "cannot deduce type for lambda capture %0 from initializer of type %2">;
7822  def err_init_capture_deduction_failure_from_init_list : Error<
7823    "cannot deduce type for lambda capture %0 from initializer list">;
7824  def warn_cxx17_compat_init_capture_pack : Warning<
7825    "initialized lambda capture packs are incompatible with C++ standards "
7826    "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7827  def ext_init_capture_pack : ExtWarn<
7828    "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
7829
7830  // C++14 generic lambdas.
7831  def warn_cxx11_compat_generic_lambda : Warning<
7832    "generic lambdas are incompatible with C++11">,
7833    InGroup<CXXPre14Compat>, DefaultIgnore;
7834
7835  // C++17 '*this' captures.
7836  def warn_cxx14_compat_star_this_lambda_capture : Warning<
7837    "by value capture of '*this' is incompatible with C++ standards before C++17">,
7838     InGroup<CXXPre17Compat>, DefaultIgnore;
7839  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
7840    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
7841
7842  // C++17 parameter shadows capture
7843  def err_parameter_shadow_capture : Error<
7844    "a lambda parameter cannot shadow an explicitly captured entity">;
7845
7846  // C++20 [=, this] captures.
7847  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
7848    "explicit capture of 'this' with a capture default of '=' is incompatible "
7849    "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7850  def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
7851    "explicit capture of 'this' with a capture default of '=' "
7852    "is a C++20 extension">, InGroup<CXX20>;
7853  def warn_deprecated_this_capture : Warning<
7854    "implicit capture of 'this' with a capture default of '=' is deprecated">,
7855    InGroup<DeprecatedThisCapture>, DefaultIgnore;
7856  def note_deprecated_this_capture : Note<
7857    "add an explicit capture of 'this' to capture '*this' by reference">;
7858
7859  // C++20 default constructible / assignable lambdas.
7860  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
7861    "%select{default construction|assignment}0 of lambda is incompatible with "
7862    "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7863}
7864
7865def err_return_in_captured_stmt : Error<
7866  "cannot return from %0">;
7867def err_capture_block_variable : Error<
7868  "__block variable %0 cannot be captured in a "
7869  "%select{lambda expression|captured statement}1">;
7870
7871def err_operator_arrow_circular : Error<
7872  "circular pointer delegation detected">;
7873def err_operator_arrow_depth_exceeded : Error<
7874  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
7875  "'operator->' calls">;
7876def note_operator_arrow_here : Note<
7877  "'operator->' declared here produces an object of type %0">;
7878def note_operator_arrows_suppressed : Note<
7879  "(skipping %0 'operator->'%s0 in backtrace)">;
7880def note_operator_arrow_depth : Note<
7881  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
7882
7883def err_pseudo_dtor_base_not_scalar : Error<
7884  "object expression of non-scalar type %0 cannot be used in a "
7885  "pseudo-destructor expression">;
7886def ext_pseudo_dtor_on_void : ExtWarn<
7887  "pseudo-destructors on type void are a Microsoft extension">,
7888  InGroup<MicrosoftVoidPseudoDtor>;
7889def err_pseudo_dtor_type_mismatch : Error<
7890  "the type of object expression "
7891  "%diff{($) does not match the type being destroyed ($)|"
7892  "does not match the type being destroyed}0,1 "
7893  "in pseudo-destructor expression">;
7894def err_pseudo_dtor_call_with_args : Error<
7895  "call to pseudo-destructor cannot have any arguments">;
7896def err_dtor_expr_without_call : Error<
7897  "reference to %select{destructor|pseudo-destructor}0 must be called"
7898  "%select{|; did you mean to call it with no arguments?}1">;
7899def err_pseudo_dtor_destructor_non_type : Error<
7900  "%0 does not refer to a type name in pseudo-destructor expression; expected "
7901  "the name of type %1">;
7902def err_invalid_use_of_function_type : Error<
7903  "a function type is not allowed here">;
7904def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
7905def err_typecheck_bool_condition : Error<
7906  "value of type %0 is not contextually convertible to 'bool'">;
7907def err_typecheck_ambiguous_condition : Error<
7908  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
7909def err_typecheck_nonviable_condition : Error<
7910  "no viable conversion%select{%diff{ from $ to $|}1,2|"
7911  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
7912def err_typecheck_nonviable_condition_incomplete : Error<
7913  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
7914def err_typecheck_deleted_function : Error<
7915  "conversion function %diff{from $ to $|between types}0,1 "
7916  "invokes a deleted function">;
7917
7918def err_expected_class_or_namespace : Error<"%0 is not a class"
7919  "%select{ or namespace|, namespace, or enumeration}1">;
7920def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
7921  "because namespace %1 does not enclose namespace %2">;
7922def err_export_non_namespace_scope_name : Error<
7923  "cannot export %0 as it is not at namespace scope">;
7924def err_redeclaration_non_exported : Error <
7925  "cannot export redeclaration %0 here since the previous declaration "
7926  "%select{is not exported|has internal linkage|has module linkage}1">;
7927def err_invalid_declarator_global_scope : Error<
7928  "definition or redeclaration of %0 cannot name the global scope">;
7929def err_invalid_declarator_in_function : Error<
7930  "definition or redeclaration of %0 not allowed inside a function">;
7931def err_invalid_declarator_in_block : Error<
7932  "definition or redeclaration of %0 not allowed inside a block">;
7933def err_not_tag_in_scope : Error<
7934  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
7935
7936def err_no_typeid_with_fno_rtti : Error<
7937  "use of typeid requires -frtti">;
7938def err_no_dynamic_cast_with_fno_rtti : Error<
7939  "use of dynamic_cast requires -frtti">;
7940def warn_no_dynamic_cast_with_rtti_disabled: Warning<
7941  "dynamic_cast will not work since RTTI data is disabled by "
7942  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7943def warn_no_typeid_with_rtti_disabled: Warning<
7944  "typeid will not work since RTTI data is disabled by "
7945  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7946
7947def err_cannot_form_pointer_to_member_of_reference_type : Error<
7948  "cannot form a pointer-to-member to member %0 of reference type %1">;
7949def err_incomplete_object_call : Error<
7950  "incomplete type in call to object of type %0">;
7951
7952def warn_condition_is_assignment : Warning<"using the result of an "
7953  "assignment as a condition without parentheses">,
7954  InGroup<Parentheses>;
7955def warn_free_nonheap_object
7956  : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
7957    InGroup<FreeNonHeapObject>;
7958
7959// Completely identical except off by default.
7960def warn_condition_is_idiomatic_assignment : Warning<"using the result "
7961  "of an assignment as a condition without parentheses">,
7962  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
7963def note_condition_assign_to_comparison : Note<
7964  "use '==' to turn this assignment into an equality comparison">;
7965def note_condition_or_assign_to_comparison : Note<
7966  "use '!=' to turn this compound assignment into an inequality comparison">;
7967def note_condition_assign_silence : Note<
7968  "place parentheses around the assignment to silence this warning">;
7969
7970def warn_equality_with_extra_parens : Warning<"equality comparison with "
7971  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
7972def note_equality_comparison_to_assign : Note<
7973  "use '=' to turn this equality comparison into an assignment">;
7974def note_equality_comparison_silence : Note<
7975  "remove extraneous parentheses around the comparison to silence this warning">;
7976
7977// assignment related diagnostics (also for argument passing, returning, etc).
7978// In most of these diagnostics the %2 is a value from the
7979// Sema::AssignmentAction enumeration
7980def err_typecheck_convert_incompatible : Error<
7981  "%select{%diff{assigning to $ from incompatible type $|"
7982  "assigning to type from incompatible type}0,1"
7983  "|%diff{passing $ to parameter of incompatible type $|"
7984  "passing type to parameter of incompatible type}0,1"
7985  "|%diff{returning $ from a function with incompatible result type $|"
7986  "returning type from a function with incompatible result type}0,1"
7987  "|%diff{converting $ to incompatible type $|"
7988  "converting type to incompatible type}0,1"
7989  "|%diff{initializing $ with an expression of incompatible type $|"
7990  "initializing type with an expression of incompatible type}0,1"
7991  "|%diff{sending $ to parameter of incompatible type $|"
7992  "sending type to parameter of incompatible type}0,1"
7993  "|%diff{casting $ to incompatible type $|"
7994  "casting type to incompatible type}0,1}2"
7995  "%select{|; dereference with *|"
7996  "; take the address with &|"
7997  "; remove *|"
7998  "; remove &}3"
7999  "%select{|: different classes%diff{ ($ vs $)|}5,6"
8000  "|: different number of parameters (%5 vs %6)"
8001  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
8002  "|: different return type%diff{ ($ vs $)|}5,6"
8003  "|: different qualifiers (%5 vs %6)"
8004  "|: different exception specifications}4">;
8005def err_typecheck_missing_return_type_incompatible : Error<
8006  "%diff{return type $ must match previous return type $|"
8007  "return type must match previous return type}0,1 when %select{block "
8008  "literal|lambda expression}2 has unspecified explicit return type">;
8009
8010def note_incomplete_class_and_qualified_id : Note<
8011  "conformance of forward class %0 to protocol %1 can not be confirmed">;
8012def warn_incompatible_qualified_id : Warning<
8013  "%select{%diff{assigning to $ from incompatible type $|"
8014  "assigning to type from incompatible type}0,1"
8015  "|%diff{passing $ to parameter of incompatible type $|"
8016  "passing type to parameter of incompatible type}0,1"
8017  "|%diff{returning $ from a function with incompatible result type $|"
8018  "returning type from a function with incompatible result type}0,1"
8019  "|%diff{converting $ to incompatible type $|"
8020  "converting type to incompatible type}0,1"
8021  "|%diff{initializing $ with an expression of incompatible type $|"
8022  "initializing type with an expression of incompatible type}0,1"
8023  "|%diff{sending $ to parameter of incompatible type $|"
8024  "sending type to parameter of incompatible type}0,1"
8025  "|%diff{casting $ to incompatible type $|"
8026  "casting type to incompatible type}0,1}2">;
8027def err_incompatible_qualified_id : Error<
8028  "%select{%diff{assigning to $ from incompatible type $|"
8029  "assigning to type from incompatible type}0,1"
8030  "|%diff{passing $ to parameter of incompatible type $|"
8031  "passing type to parameter of incompatible type}0,1"
8032  "|%diff{returning $ from a function with incompatible result type $|"
8033  "returning type from a function with incompatible result type}0,1"
8034  "|%diff{converting $ to incompatible type $|"
8035  "converting type to incompatible type}0,1"
8036  "|%diff{initializing $ with an expression of incompatible type $|"
8037  "initializing type with an expression of incompatible type}0,1"
8038  "|%diff{sending $ to parameter of incompatible type $|"
8039  "sending type to parameter of incompatible type}0,1"
8040  "|%diff{casting $ to incompatible type $|"
8041  "casting type to incompatible type}0,1}2">;
8042def err_typecheck_convert_pointer_int : Error<
8043  "incompatible pointer to integer conversion "
8044  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8045  "|%diff{passing $ to parameter of type $|"
8046  "passing to parameter of different type}0,1"
8047  "|%diff{returning $ from a function with result type $|"
8048  "returning from function with different return type}0,1"
8049  "|%diff{converting $ to type $|converting between types}0,1"
8050  "|%diff{initializing $ with an expression of type $|"
8051  "initializing with expression of different type}0,1"
8052  "|%diff{sending $ to parameter of type $|"
8053  "sending to parameter of different type}0,1"
8054  "|%diff{casting $ to type $|casting between types}0,1}2"
8055  "%select{|; dereference with *|"
8056  "; take the address with &|"
8057  "; remove *|"
8058  "; remove &}3">;
8059def ext_typecheck_convert_pointer_int : ExtWarn<
8060  err_typecheck_convert_pointer_int.Text>,
8061  InGroup<IntConversion>, DefaultError;
8062def err_typecheck_convert_int_pointer : Error<
8063  "incompatible integer to pointer conversion "
8064  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8065  "|%diff{passing $ to parameter of type $|"
8066  "passing to parameter of different type}0,1"
8067  "|%diff{returning $ from a function with result type $|"
8068  "returning from function with different return type}0,1"
8069  "|%diff{converting $ to type $|converting between types}0,1"
8070  "|%diff{initializing $ with an expression of type $|"
8071  "initializing with expression of different type}0,1"
8072  "|%diff{sending $ to parameter of type $|"
8073  "sending to parameter of different type}0,1"
8074  "|%diff{casting $ to type $|casting between types}0,1}2"
8075  "%select{|; dereference with *|"
8076  "; take the address with &|"
8077  "; remove *|"
8078  "; remove &}3">;
8079def ext_typecheck_convert_int_pointer : ExtWarn<
8080  err_typecheck_convert_int_pointer.Text>,
8081  InGroup<IntConversion>, DefaultError;
8082def ext_typecheck_convert_pointer_void_func : Extension<
8083  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8084  "|%diff{passing $ to parameter of type $|"
8085  "passing to parameter of different type}0,1"
8086  "|%diff{returning $ from a function with result type $|"
8087  "returning from function with different return type}0,1"
8088  "|%diff{converting $ to type $|converting between types}0,1"
8089  "|%diff{initializing $ with an expression of type $|"
8090  "initializing with expression of different type}0,1"
8091  "|%diff{sending $ to parameter of type $|"
8092  "sending to parameter of different type}0,1"
8093  "|%diff{casting $ to type $|casting between types}0,1}2"
8094  " converts between void pointer and function pointer">;
8095def err_typecheck_convert_pointer_void_func : Error<
8096  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8097  "|%diff{passing $ to parameter of type $|"
8098  "passing to parameter of different type}0,1"
8099  "|%diff{returning $ from a function with result type $|"
8100  "returning from function with different return type}0,1"
8101  "|%diff{converting $ to type $|converting between types}0,1"
8102  "|%diff{initializing $ with an expression of type $|"
8103  "initializing with expression of different type}0,1"
8104  "|%diff{sending $ to parameter of type $|"
8105  "sending to parameter of different type}0,1"
8106  "|%diff{casting $ to type $|casting between types}0,1}2"
8107  " converts between void pointer and function pointer">;
8108def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
8109  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8110  "|%diff{passing $ to parameter of type $|"
8111  "passing to parameter of different type}0,1"
8112  "|%diff{returning $ from a function with result type $|"
8113  "returning from function with different return type}0,1"
8114  "|%diff{converting $ to type $|converting between types}0,1"
8115  "|%diff{initializing $ with an expression of type $|"
8116  "initializing with expression of different type}0,1"
8117  "|%diff{sending $ to parameter of type $|"
8118  "sending to parameter of different type}0,1"
8119  "|%diff{casting $ to type $|casting between types}0,1}2"
8120  " converts between pointers to integer types %select{with different sign|"
8121  "where one is of the unique plain 'char' type and the other is not}3">,
8122  InGroup<DiagGroup<"pointer-sign">>;
8123def err_typecheck_convert_incompatible_pointer_sign :
8124  Error<ext_typecheck_convert_incompatible_pointer_sign.Text>;
8125def ext_typecheck_convert_incompatible_pointer : ExtWarn<
8126  "incompatible pointer types "
8127  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8128  "|%diff{passing $ to parameter of type $|"
8129  "passing to parameter of different type}0,1"
8130  "|%diff{returning $ from a function with result type $|"
8131  "returning from function with different return type}0,1"
8132  "|%diff{converting $ to type $|converting between types}0,1"
8133  "|%diff{initializing $ with an expression of type $|"
8134  "initializing with expression of different type}0,1"
8135  "|%diff{sending $ to parameter of type $|"
8136  "sending to parameter of different type}0,1"
8137  "|%diff{casting $ to type $|casting between types}0,1}2"
8138  "%select{|; dereference with *|"
8139  "; take the address with &|"
8140  "; remove *|"
8141  "; remove &}3">,
8142  InGroup<IncompatiblePointerTypes>;
8143def err_typecheck_convert_incompatible_pointer : Error<
8144  "incompatible pointer types "
8145  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8146  "|%diff{passing $ to parameter of type $|"
8147  "passing to parameter of different type}0,1"
8148  "|%diff{returning $ from a function with result type $|"
8149  "returning from function with different return type}0,1"
8150  "|%diff{converting $ to type $|converting between types}0,1"
8151  "|%diff{initializing $ with an expression of type $|"
8152  "initializing with expression of different type}0,1"
8153  "|%diff{sending $ to parameter of type $|"
8154  "sending to parameter of different type}0,1"
8155  "|%diff{casting $ to type $|casting between types}0,1}2"
8156  "%select{|; dereference with *|"
8157  "; take the address with &|"
8158  "; remove *|"
8159  "; remove &}3">;
8160def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
8161  "incompatible function pointer types "
8162  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8163  "|%diff{passing $ to parameter of type $|"
8164  "passing to parameter of different type}0,1"
8165  "|%diff{returning $ from a function with result type $|"
8166  "returning from function with different return type}0,1"
8167  "|%diff{converting $ to type $|converting between types}0,1"
8168  "|%diff{initializing $ with an expression of type $|"
8169  "initializing with expression of different type}0,1"
8170  "|%diff{sending $ to parameter of type $|"
8171  "sending to parameter of different type}0,1"
8172  "|%diff{casting $ to type $|casting between types}0,1}2"
8173  "%select{|; dereference with *|"
8174  "; take the address with &|"
8175  "; remove *|"
8176  "; remove &}3">,
8177  InGroup<IncompatibleFunctionPointerTypes>;
8178def err_typecheck_convert_incompatible_function_pointer : Error<
8179  "incompatible function pointer types "
8180  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8181  "|%diff{passing $ to parameter of type $|"
8182  "passing to parameter of different type}0,1"
8183  "|%diff{returning $ from a function with result type $|"
8184  "returning from function with different return type}0,1"
8185  "|%diff{converting $ to type $|converting between types}0,1"
8186  "|%diff{initializing $ with an expression of type $|"
8187  "initializing with expression of different type}0,1"
8188  "|%diff{sending $ to parameter of type $|"
8189  "sending to parameter of different type}0,1"
8190  "|%diff{casting $ to type $|casting between types}0,1}2"
8191  "%select{|; dereference with *|"
8192  "; take the address with &|"
8193  "; remove *|"
8194  "; remove &}3">;
8195def ext_typecheck_convert_discards_qualifiers : ExtWarn<
8196  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8197  "|%diff{passing $ to parameter of type $|"
8198  "passing to parameter of different type}0,1"
8199  "|%diff{returning $ from a function with result type $|"
8200  "returning from function with different return type}0,1"
8201  "|%diff{converting $ to type $|converting between types}0,1"
8202  "|%diff{initializing $ with an expression of type $|"
8203  "initializing with expression of different type}0,1"
8204  "|%diff{sending $ to parameter of type $|"
8205  "sending to parameter of different type}0,1"
8206  "|%diff{casting $ to type $|casting between types}0,1}2"
8207  " discards qualifiers">,
8208  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8209def err_typecheck_convert_discards_qualifiers : Error<
8210  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8211  "|%diff{passing $ to parameter of type $|"
8212  "passing to parameter of different type}0,1"
8213  "|%diff{returning $ from a function with result type $|"
8214  "returning from function with different return type}0,1"
8215  "|%diff{converting $ to type $|converting between types}0,1"
8216  "|%diff{initializing $ with an expression of type $|"
8217  "initializing with expression of different type}0,1"
8218  "|%diff{sending $ to parameter of type $|"
8219  "sending to parameter of different type}0,1"
8220  "|%diff{casting $ to type $|casting between types}0,1}2"
8221  " discards qualifiers">;
8222def ext_nested_pointer_qualifier_mismatch : ExtWarn<
8223  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8224  "|%diff{passing $ to parameter of type $|"
8225  "passing to parameter of different type}0,1"
8226  "|%diff{returning $ from a function with result type $|"
8227  "returning from function with different return type}0,1"
8228  "|%diff{converting $ to type $|converting between types}0,1"
8229  "|%diff{initializing $ with an expression of type $|"
8230  "initializing with expression of different type}0,1"
8231  "|%diff{sending $ to parameter of type $|"
8232  "sending to parameter of different type}0,1"
8233  "|%diff{casting $ to type $|casting between types}0,1}2"
8234  " discards qualifiers in nested pointer types">,
8235  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8236def err_nested_pointer_qualifier_mismatch : Error<
8237  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8238  "|%diff{passing $ to parameter of type $|"
8239  "passing to parameter of different type}0,1"
8240  "|%diff{returning $ from a function with result type $|"
8241  "returning from function with different return type}0,1"
8242  "|%diff{converting $ to type $|converting between types}0,1"
8243  "|%diff{initializing $ with an expression of type $|"
8244  "initializing with expression of different type}0,1"
8245  "|%diff{sending $ to parameter of type $|"
8246  "sending to parameter of different type}0,1"
8247  "|%diff{casting $ to type $|casting between types}0,1}2"
8248  " discards qualifiers in nested pointer types">;
8249def warn_incompatible_vectors : Warning<
8250  "incompatible vector types "
8251  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8252  "|%diff{passing $ to parameter of type $|"
8253  "passing to parameter of different type}0,1"
8254  "|%diff{returning $ from a function with result type $|"
8255  "returning from function with different return type}0,1"
8256  "|%diff{converting $ to type $|converting between types}0,1"
8257  "|%diff{initializing $ with an expression of type $|"
8258  "initializing with expression of different type}0,1"
8259  "|%diff{sending $ to parameter of type $|"
8260  "sending to parameter of different type}0,1"
8261  "|%diff{casting $ to type $|casting between types}0,1}2">,
8262  InGroup<VectorConversion>, DefaultIgnore;
8263def err_incompatible_vectors : Error<
8264  "incompatible vector types "
8265  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8266  "|%diff{passing $ to parameter of type $|"
8267  "passing to parameter of different type}0,1"
8268  "|%diff{returning $ from a function with result type $|"
8269  "returning from function with different return type}0,1"
8270  "|%diff{converting $ to type $|converting between types}0,1"
8271  "|%diff{initializing $ with an expression of type $|"
8272  "initializing with expression of different type}0,1"
8273  "|%diff{sending $ to parameter of type $|"
8274  "sending to parameter of different type}0,1"
8275  "|%diff{casting $ to type $|casting between types}0,1}2">;
8276def err_int_to_block_pointer : Error<
8277  "invalid block pointer conversion "
8278  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8279  "|%diff{passing $ to parameter of type $|"
8280  "passing to parameter of different type}0,1"
8281  "|%diff{returning $ from a function with result type $|"
8282  "returning from function with different return type}0,1"
8283  "|%diff{converting $ to type $|converting between types}0,1"
8284  "|%diff{initializing $ with an expression of type $|"
8285  "initializing with expression of different type}0,1"
8286  "|%diff{sending $ to parameter of type $|"
8287  "sending to parameter of different type}0,1"
8288  "|%diff{casting $ to type $|casting between types}0,1}2">;
8289def err_typecheck_convert_incompatible_block_pointer : Error<
8290  "incompatible block pointer types "
8291  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8292  "|%diff{passing $ to parameter of type $|"
8293  "passing to parameter of different type}0,1"
8294  "|%diff{returning $ from a function with result type $|"
8295  "returning from function with different return type}0,1"
8296  "|%diff{converting $ to type $|converting between types}0,1"
8297  "|%diff{initializing $ with an expression of type $|"
8298  "initializing with expression of different type}0,1"
8299  "|%diff{sending $ to parameter of type $|"
8300  "sending to parameter of different type}0,1"
8301  "|%diff{casting $ to type $|casting between types}0,1}2">;
8302def err_typecheck_incompatible_address_space : Error<
8303  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8304  "|%diff{passing $ to parameter of type $|"
8305  "passing to parameter of different type}0,1"
8306  "|%diff{returning $ from a function with result type $|"
8307  "returning from function with different return type}0,1"
8308  "|%diff{converting $ to type $|converting between types}0,1"
8309  "|%diff{initializing $ with an expression of type $|"
8310  "initializing with expression of different type}0,1"
8311  "|%diff{sending $ to parameter of type $|"
8312  "sending to parameter of different type}0,1"
8313  "|%diff{casting $ to type $|casting between types}0,1}2"
8314  " changes address space of pointer">;
8315def err_typecheck_incompatible_nested_address_space : Error<
8316  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8317  "|%diff{passing $ to parameter of type $|"
8318  "passing to parameter of different type}0,1"
8319  "|%diff{returning $ from a function with result type $|"
8320  "returning from function with different return type}0,1"
8321  "|%diff{converting $ to type $|converting between types}0,1"
8322  "|%diff{initializing $ with an expression of type $|"
8323  "initializing with expression of different type}0,1"
8324  "|%diff{sending $ to parameter of type $|"
8325  "sending to parameter of different type}0,1"
8326  "|%diff{casting $ to type $|casting between types}0,1}2"
8327  " changes address space of nested pointer">;
8328def err_typecheck_incompatible_ownership : Error<
8329  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8330  "|%diff{passing $ to parameter of type $|"
8331  "passing to parameter of different type}0,1"
8332  "|%diff{returning $ from a function with result type $|"
8333  "returning from function with different return type}0,1"
8334  "|%diff{converting $ to type $|converting between types}0,1"
8335  "|%diff{initializing $ with an expression of type $|"
8336  "initializing with expression of different type}0,1"
8337  "|%diff{sending $ to parameter of type $|"
8338  "sending to parameter of different type}0,1"
8339  "|%diff{casting $ to type $|casting between types}0,1}2"
8340  " changes retain/release properties of pointer">;
8341def err_typecheck_comparison_of_distinct_blocks : Error<
8342  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
8343
8344def err_typecheck_array_not_modifiable_lvalue : Error<
8345  "array type %0 is not assignable">;
8346def err_typecheck_non_object_not_modifiable_lvalue : Error<
8347  "non-object type %0 is not assignable">;
8348def err_typecheck_expression_not_modifiable_lvalue : Error<
8349  "expression is not assignable">;
8350def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
8351  "incomplete type %0 is not assignable">;
8352def err_typecheck_lvalue_casts_not_supported : Error<
8353  "assignment to cast is illegal, lvalue casts are not supported">;
8354
8355def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
8356  "vector is not assignable (contains duplicate components)">;
8357def err_block_decl_ref_not_modifiable_lvalue : Error<
8358  "variable is not assignable (missing __block type specifier)">;
8359def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8360  "cannot assign to a variable captured by copy in a non-mutable lambda">;
8361def err_typecheck_call_not_function : Error<
8362  "called object type %0 is not a function or function pointer">;
8363def err_call_incomplete_return : Error<
8364  "calling function with incomplete return type %0">;
8365def err_call_function_incomplete_return : Error<
8366  "calling %0 with incomplete return type %1">;
8367def err_call_incomplete_argument : Error<
8368  "argument type %0 is incomplete">;
8369def err_typecheck_call_too_few_args : Error<
8370  "too few %select{|||execution configuration }0arguments to "
8371  "%select{function|block|method|kernel function}0 call, "
8372  "expected %1, have %2">;
8373def err_typecheck_call_too_few_args_one : Error<
8374  "too few %select{|||execution configuration }0arguments to "
8375  "%select{function|block|method|kernel function}0 call, "
8376  "single argument %1 was not specified">;
8377def err_typecheck_call_too_few_args_at_least : Error<
8378  "too few %select{|||execution configuration }0arguments to "
8379  "%select{function|block|method|kernel function}0 call, "
8380  "expected at least %1, have %2">;
8381def err_typecheck_call_too_few_args_at_least_one : Error<
8382  "too few %select{|||execution configuration }0arguments to "
8383  "%select{function|block|method|kernel function}0 call, "
8384  "at least argument %1 must be specified">;
8385def err_typecheck_call_too_few_args_suggest : Error<
8386  "too few %select{|||execution configuration }0arguments to "
8387  "%select{function|block|method|kernel function}0 call, "
8388  "expected %1, have %2; did you mean %3?">;
8389def err_typecheck_call_too_few_args_at_least_suggest : Error<
8390  "too few %select{|||execution configuration }0arguments to "
8391  "%select{function|block|method|kernel function}0 call, "
8392  "expected at least %1, have %2; did you mean %3?">;
8393def err_typecheck_call_too_many_args : Error<
8394  "too many %select{|||execution configuration }0arguments to "
8395  "%select{function|block|method|kernel function}0 call, "
8396  "expected %1, have %2">;
8397def err_typecheck_call_too_many_args_one : Error<
8398  "too many %select{|||execution configuration }0arguments to "
8399  "%select{function|block|method|kernel function}0 call, "
8400  "expected single argument %1, have %2 arguments">;
8401def err_typecheck_call_too_many_args_at_most : Error<
8402  "too many %select{|||execution configuration }0arguments to "
8403  "%select{function|block|method|kernel function}0 call, "
8404  "expected at most %1, have %2">;
8405def err_typecheck_call_too_many_args_at_most_one : Error<
8406  "too many %select{|||execution configuration }0arguments to "
8407  "%select{function|block|method|kernel function}0 call, "
8408  "expected at most single argument %1, have %2 arguments">;
8409def err_typecheck_call_too_many_args_suggest : Error<
8410  "too many %select{|||execution configuration }0arguments to "
8411  "%select{function|block|method|kernel function}0 call, "
8412  "expected %1, have %2; did you mean %3?">;
8413def err_typecheck_call_too_many_args_at_most_suggest : Error<
8414  "too many %select{|||execution configuration }0arguments to "
8415  "%select{function|block|method|kernel function}0 call, "
8416  "expected at most %1, have %2; did you mean %3?">;
8417
8418def err_arc_typecheck_convert_incompatible_pointer : Error<
8419  "incompatible pointer types passing retainable parameter of type %0"
8420  "to a CF function expecting %1 type">;
8421
8422def err_builtin_fn_use : Error<"builtin functions must be directly called">;
8423
8424def warn_call_wrong_number_of_arguments : Warning<
8425  "too %select{few|many}0 arguments in call to %1">;
8426def err_atomic_builtin_must_be_pointer : Error<
8427  "address argument to atomic builtin must be a pointer (%0 invalid)">;
8428def err_atomic_builtin_must_be_pointer_intptr : Error<
8429  "address argument to atomic builtin must be a pointer to integer or pointer"
8430  " (%0 invalid)">;
8431def err_atomic_builtin_cannot_be_const : Error<
8432  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
8433def err_atomic_builtin_must_be_pointer_intfltptr : Error<
8434  "address argument to atomic builtin must be a pointer to integer,"
8435  " floating-point or pointer (%0 invalid)">;
8436def err_atomic_builtin_pointer_size : Error<
8437  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
8438  "type (%0 invalid)">;
8439def err_atomic_exclusive_builtin_pointer_size : Error<
8440  "address argument to load or store exclusive builtin must be a pointer to"
8441  " 1,2,4 or 8 byte type (%0 invalid)">;
8442def err_atomic_builtin_ext_int_size : Error<
8443  "Atomic memory operand must have a power-of-two size">;
8444def err_atomic_builtin_bit_int_prohibit : Error<
8445  "argument to atomic builtin of type '_BitInt' is not supported">;
8446def err_atomic_op_needs_atomic : Error<
8447  "address argument to atomic operation must be a pointer to _Atomic "
8448  "type (%0 invalid)">;
8449def err_atomic_op_needs_non_const_atomic : Error<
8450  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
8451  "type (%1 invalid)">;
8452def err_atomic_op_needs_non_const_pointer : Error<
8453  "address argument to atomic operation must be a pointer to non-const "
8454  "type (%0 invalid)">;
8455def err_atomic_op_needs_trivial_copy : Error<
8456  "address argument to atomic operation must be a pointer to a "
8457  "trivially-copyable type (%0 invalid)">;
8458def err_atomic_op_needs_atomic_int_ptr_or_fp : Error<
8459  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8460  "integer, pointer or supported floating point type (%1 invalid)">;
8461def err_atomic_op_needs_atomic_int_or_ptr : Error<
8462  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8463  "integer or pointer (%1 invalid)">;
8464def err_atomic_op_needs_atomic_int : Error<
8465  "address argument to atomic operation must be a pointer to "
8466  "%select{|atomic }0integer (%1 invalid)">;
8467def warn_atomic_op_has_invalid_memory_order : Warning<
8468  "memory order argument to atomic operation is invalid">,
8469  InGroup<DiagGroup<"atomic-memory-ordering">>;
8470def err_atomic_op_has_invalid_synch_scope : Error<
8471  "synchronization scope argument to atomic operation is invalid">;
8472def warn_atomic_implicit_seq_cst : Warning<
8473  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
8474  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
8475
8476def err_overflow_builtin_must_be_int : Error<
8477  "operand argument to overflow builtin must be an integer (%0 invalid)">;
8478def err_overflow_builtin_must_be_ptr_int : Error<
8479  "result argument to overflow builtin must be a pointer "
8480  "to a non-const integer (%0 invalid)">;
8481def err_overflow_builtin_bit_int_max_size : Error<
8482  "__builtin_mul_overflow does not support 'signed _BitInt' operands of more "
8483  "than %0 bits">;
8484def err_expected_struct_pointer_argument : Error<
8485  "expected pointer to struct as %ordinal0 argument to %1, found %2">;
8486def err_expected_callable_argument : Error<
8487  "expected a callable expression as %ordinal0 argument to %1, found %2">;
8488def note_building_builtin_dump_struct_call : Note<
8489  "in call to printing function with arguments '(%0)' while dumping struct">;
8490
8491def err_atomic_load_store_uses_lib : Error<
8492  "atomic %select{load|store}0 requires runtime support that is not "
8493  "available for this target">;
8494
8495def err_nontemporal_builtin_must_be_pointer : Error<
8496  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
8497def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
8498  "address argument to nontemporal builtin must be a pointer to integer, float, "
8499  "pointer, or a vector of such types (%0 invalid)">;
8500
8501def err_deleted_function_use : Error<"attempt to use a deleted function">;
8502def err_deleted_inherited_ctor_use : Error<
8503  "constructor inherited by %0 from base class %1 is implicitly deleted">;
8504
8505def note_called_by : Note<"called by %0">;
8506def err_kern_type_not_void_return : Error<
8507  "kernel function type %0 must have void return type">;
8508def err_kern_is_nonstatic_method : Error<
8509  "kernel function %0 must be a free function or static member function">;
8510def err_config_scalar_return : Error<
8511  "CUDA special function '%0' must have scalar return type">;
8512def err_kern_call_not_global_function : Error<
8513  "kernel call to non-global function %0">;
8514def err_global_call_not_config : Error<
8515  "call to global function %0 not configured">;
8516def err_ref_bad_target : Error<
8517  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8518  "%select{function|variable}1 %2 in %select{__device__|__global__|__host__|__host__ __device__}3 function">;
8519def note_cuda_const_var_unpromoted : Note<
8520  "const variable cannot be emitted on device side due to dynamic initialization">;
8521def note_cuda_host_var : Note<
8522  "host variable declared here">;
8523def err_ref_bad_target_global_initializer : Error<
8524  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8525  "function %1 in global initializer">;
8526def err_capture_bad_target : Error<
8527  "capture host variable %0 by reference in device or host device lambda function">;
8528def warn_maybe_capture_bad_target_this_ptr : Warning<
8529  "capture host side class data member by this pointer in device or host device lambda function "
8530  "may result in invalid memory access if this pointer is not accessible on device side">,
8531  InGroup<DiagGroup<"gpu-maybe-wrong-side">>;
8532def warn_kern_is_method : Extension<
8533  "kernel function %0 is a member function; this may not be accepted by nvcc">,
8534  InGroup<CudaCompat>;
8535def warn_kern_is_inline : Warning<
8536  "ignored 'inline' attribute on kernel function %0">,
8537  InGroup<CudaCompat>;
8538def err_variadic_device_fn : Error<
8539  "CUDA device code does not support variadic functions">;
8540def err_va_arg_in_device : Error<
8541  "CUDA device code does not support va_arg">;
8542def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
8543def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8544  "constexpr function %0 without __host__ or __device__ attributes cannot "
8545  "overload __device__ function with same signature.  Add a __host__ "
8546  "attribute, or build with -fno-cuda-host-device-constexpr.">;
8547def note_cuda_conflicting_device_function_declared_here : Note<
8548  "conflicting __device__ function declared here">;
8549def err_cuda_device_exceptions : Error<
8550  "cannot use '%0' in "
8551  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8552def err_dynamic_var_init : Error<
8553    "dynamic initialization is not supported for "
8554    "__device__, __constant__, __shared__, and __managed__ variables.">;
8555def err_shared_var_init : Error<
8556    "initialization is not supported for __shared__ variables.">;
8557def err_cuda_vla : Error<
8558    "cannot use variable-length arrays in "
8559    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8560def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8561def err_cuda_host_shared : Error<
8562    "__shared__ local variables not allowed in "
8563    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8564def err_cuda_nonstatic_constdev: Error<"__constant__, __device__, and "
8565    "__managed__ are not allowed on non-static local variables">;
8566def err_cuda_ovl_target : Error<
8567  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8568  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8569def note_cuda_ovl_candidate_target_mismatch : Note<
8570    "candidate template ignored: target attributes do not match">;
8571
8572def err_cuda_device_builtin_surftex_cls_template : Error<
8573    "illegal device builtin %select{surface|texture}0 reference "
8574    "class template %1 declared here">;
8575def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8576    "%0 needs to have exactly %1 template parameters">;
8577def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8578    "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8579    "%select{a type|an integer or enum value}2">;
8580
8581def err_cuda_device_builtin_surftex_ref_decl : Error<
8582    "illegal device builtin %select{surface|texture}0 reference "
8583    "type %1 declared here">;
8584def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8585    "%0 needs to be instantiated from a class template with proper "
8586    "template arguments">;
8587
8588def err_hip_invalid_args_builtin_mangled_name : Error<
8589    "invalid argument: symbol must be a device-side function or global variable">;
8590
8591def warn_non_pod_vararg_with_format_string : Warning<
8592  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8593  "%select{function|block|method|constructor}2; expected type from format "
8594  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8595// The arguments to this diagnostic should match the warning above.
8596def err_cannot_pass_objc_interface_to_vararg_format : Error<
8597  "cannot pass object with interface type %1 by value to variadic "
8598  "%select{function|block|method|constructor}2; expected type from format "
8599  "string was %3">;
8600def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8601  "cannot pass non-trivial C object of type %0 by value to variadic "
8602  "%select{function|block|method|constructor}1">;
8603
8604
8605def err_cannot_pass_objc_interface_to_vararg : Error<
8606  "cannot pass object with interface type %0 by value through variadic "
8607  "%select{function|block|method|constructor}1">;
8608def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8609  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8610  " %select{function|block|method|constructor}2; call will abort at runtime">,
8611  InGroup<NonPODVarargs>, DefaultError;
8612def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8613  "passing object of trivial but non-POD type %0 through variadic"
8614  " %select{function|block|method|constructor}1 is incompatible with C++98">,
8615  InGroup<CXX98Compat>, DefaultIgnore;
8616def warn_pass_class_arg_to_vararg : Warning<
8617  "passing object of class type %0 through variadic "
8618  "%select{function|block|method|constructor}1"
8619  "%select{|; did you mean to call '%3'?}2">,
8620  InGroup<ClassVarargs>, DefaultIgnore;
8621def err_cannot_pass_to_vararg : Error<
8622  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8623  "%select{function|block|method|constructor}2">;
8624def err_cannot_pass_to_vararg_format : Error<
8625  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8626  "%select{function|block|method|constructor}2; expected type from format "
8627  "string was %3">;
8628
8629def err_typecheck_call_invalid_ordered_compare : Error<
8630  "ordered compare requires two args of floating point type"
8631  "%diff{ ($ and $)|}0,1">;
8632def err_typecheck_call_invalid_unary_fp : Error<
8633  "floating point classification requires argument of floating point type "
8634  "(passed in %0)">;
8635def err_typecheck_cond_expect_int_float : Error<
8636  "used type %0 where integer or floating point type is required">;
8637def err_typecheck_cond_expect_scalar : Error<
8638  "used type %0 where arithmetic or pointer type is required">;
8639def err_typecheck_cond_expect_nonfloat : Error<
8640  "used type %0 where floating point type is not allowed">;
8641def ext_typecheck_cond_one_void : Extension<
8642  "C99 forbids conditional expressions with only one void side">;
8643def err_typecheck_cast_to_incomplete : Error<
8644  "cast to incomplete type %0">;
8645def ext_typecheck_cast_nonscalar : Extension<
8646  "C99 forbids casting nonscalar type %0 to the same type">;
8647def ext_typecheck_cast_to_union : Extension<
8648  "cast to union type is a GNU extension">,
8649  InGroup<GNUUnionCast>;
8650def err_typecheck_cast_to_union_no_type : Error<
8651  "cast to union type from type %0 not present in union">;
8652def err_cast_pointer_from_non_pointer_int : Error<
8653  "operand of type %0 cannot be cast to a pointer type">;
8654def warn_cast_pointer_from_sel : Warning<
8655  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8656  InGroup<SelTypeCast>;
8657def warn_function_def_in_objc_container : Warning<
8658  "function definition inside an Objective-C container is deprecated">,
8659  InGroup<FunctionDefInObjCContainer>;
8660def err_typecheck_call_requires_real_fp : Error<
8661  "argument type %0 is not a real floating point type">;
8662def err_typecheck_call_different_arg_types : Error<
8663  "arguments are of different types%diff{ ($ vs $)|}0,1">;
8664
8665def warn_cast_calling_conv : Warning<
8666  "cast between incompatible calling conventions '%0' and '%1'; "
8667  "calls through this pointer may abort at runtime">,
8668  InGroup<DiagGroup<"cast-calling-convention">>;
8669def note_change_calling_conv_fixit : Note<
8670  "consider defining %0 with the '%1' calling convention">;
8671def warn_bad_function_cast : Warning<
8672  "cast from function call of type %0 to non-matching type %1">,
8673  InGroup<BadFunctionCast>, DefaultIgnore;
8674def warn_cast_function_type : Warning<
8675  "cast %diff{from $ to $ |}0,1converts to incompatible function type">,
8676  InGroup<CastFunctionType>, DefaultIgnore;
8677def err_cast_pointer_to_non_pointer_int : Error<
8678  "pointer cannot be cast to type %0">;
8679def err_cast_to_bfloat16 : Error<"cannot type-cast to __bf16">;
8680def err_cast_from_bfloat16 : Error<"cannot type-cast from __bf16">;
8681def err_typecheck_expect_scalar_operand : Error<
8682  "operand of type %0 where arithmetic or pointer type is required">;
8683def err_typecheck_cond_incompatible_operands : Error<
8684  "incompatible operand types%diff{ ($ and $)|}0,1">;
8685def err_typecheck_expect_flt_or_vector : Error<
8686  "invalid operand of type %0 where floating, complex or "
8687  "a vector of such types is required">;
8688def err_cast_selector_expr : Error<
8689  "cannot type cast @selector expression">;
8690def ext_typecheck_cond_incompatible_pointers : ExtWarn<
8691  "pointer type mismatch%diff{ ($ and $)|}0,1">,
8692  InGroup<DiagGroup<"pointer-type-mismatch">>;
8693def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
8694  "pointer/integer type mismatch in conditional expression"
8695  "%diff{ ($ and $)|}0,1">,
8696  InGroup<DiagGroup<"conditional-type-mismatch">>;
8697def err_typecheck_choose_expr_requires_constant : Error<
8698  "'__builtin_choose_expr' requires a constant expression">;
8699def warn_unused_expr : Warning<"expression result unused">,
8700  InGroup<UnusedValue>;
8701def warn_unused_comma_left_operand : Warning<
8702  "left operand of comma operator has no effect">,
8703  InGroup<UnusedValue>;
8704def warn_unused_voidptr : Warning<
8705  "expression result unused; should this cast be to 'void'?">,
8706  InGroup<UnusedValue>;
8707def warn_unused_property_expr : Warning<
8708 "property access result unused - getters should not be used for side effects">,
8709  InGroup<UnusedGetterReturnValue>;
8710def warn_unused_container_subscript_expr : Warning<
8711 "container access result unused - container access should not be used for side effects">,
8712  InGroup<UnusedValue>;
8713def warn_unused_call : Warning<
8714  "ignoring return value of function declared with %0 attribute">,
8715  InGroup<UnusedValue>;
8716def warn_unused_constructor : Warning<
8717  "ignoring temporary created by a constructor declared with %0 attribute">,
8718  InGroup<UnusedValue>;
8719def warn_unused_constructor_msg : Warning<
8720  "ignoring temporary created by a constructor declared with %0 attribute: %1">,
8721  InGroup<UnusedValue>;
8722def warn_side_effects_unevaluated_context : Warning<
8723  "expression with side effects has no effect in an unevaluated context">,
8724  InGroup<UnevaluatedExpression>;
8725def warn_side_effects_typeid : Warning<
8726  "expression with side effects will be evaluated despite being used as an "
8727  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
8728def warn_unused_result : Warning<
8729  "ignoring return value of function declared with %0 attribute">,
8730  InGroup<UnusedResult>;
8731def warn_unused_result_msg : Warning<
8732  "ignoring return value of function declared with %0 attribute: %1">,
8733  InGroup<UnusedResult>;
8734def warn_unused_result_typedef_unsupported_spelling : Warning<
8735  "'[[%select{nodiscard|gnu::warn_unused_result}0]]' attribute ignored when "
8736  "applied to a typedef; consider using '__attribute__((warn_unused_result))' "
8737  "or '[[clang::warn_unused_result]]' instead">, InGroup<IgnoredAttributes>;
8738def warn_unused_volatile : Warning<
8739  "expression result unused; assign into a variable to force a volatile load">,
8740  InGroup<DiagGroup<"unused-volatile-lvalue">>;
8741
8742def ext_cxx14_attr : Extension<
8743  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14Attrs>;
8744def ext_cxx17_attr : Extension<
8745  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17Attrs>;
8746def ext_cxx20_attr : Extension<
8747  "use of the %0 attribute is a C++20 extension">, InGroup<CXX20Attrs>;
8748
8749def warn_unused_comparison : Warning<
8750  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
8751  InGroup<UnusedComparison>;
8752def note_inequality_comparison_to_or_assign : Note<
8753  "use '|=' to turn this inequality comparison into an or-assignment">;
8754
8755def err_incomplete_type_used_in_type_trait_expr : Error<
8756  "incomplete type %0 used in type trait expression">;
8757
8758// C++20 constinit and require_constant_initialization attribute
8759def warn_cxx20_compat_constinit : Warning<
8760  "'constinit' specifier is incompatible with C++ standards before C++20">,
8761  InGroup<CXX20Compat>, DefaultIgnore;
8762def err_constinit_local_variable : Error<
8763  "local variable cannot be declared 'constinit'">;
8764def err_require_constant_init_failed : Error<
8765  "variable does not have a constant initializer">;
8766def note_declared_required_constant_init_here : Note<
8767  "required by %select{'require_constant_initialization' attribute|"
8768  "'constinit' specifier}0 here">;
8769def ext_constinit_missing : ExtWarn<
8770  "'constinit' specifier missing on initializing declaration of %0">,
8771  InGroup<DiagGroup<"missing-constinit">>;
8772def note_constinit_specified_here : Note<"variable declared constinit here">;
8773def err_constinit_added_too_late : Error<
8774  "'constinit' specifier added after initialization of variable">;
8775def warn_require_const_init_added_too_late : Warning<
8776  "'require_constant_initialization' attribute added after initialization "
8777  "of variable">, InGroup<IgnoredAttributes>;
8778def note_constinit_missing_here : Note<
8779  "add the "
8780  "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
8781  "to the initializing declaration here">;
8782
8783def err_dimension_expr_not_constant_integer : Error<
8784  "dimension expression does not evaluate to a constant unsigned int">;
8785
8786def err_typecheck_cond_incompatible_operands_null : Error<
8787  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
8788def ext_empty_struct_union : Extension<
8789  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
8790def ext_no_named_members_in_struct_union : Extension<
8791  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
8792def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
8793  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8794  InGroup<CXXCompat>, DefaultIgnore;
8795def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
8796  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8797  InGroup<ExternCCompat>;
8798def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
8799  "volatile qualifiers|const qualifier|volatile qualifier}2">,
8800  InGroup<CastQual>, DefaultIgnore;
8801def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
8802  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
8803def warn_redefine_extname_not_applied : Warning<
8804  "#pragma redefine_extname is applicable to external C declarations only; "
8805  "not applied to %select{function|variable}0 %1">,
8806  InGroup<Pragmas>;
8807} // End of general sema category.
8808
8809// inline asm.
8810let CategoryName = "Inline Assembly Issue" in {
8811  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
8812  def err_asm_invalid_output_constraint : Error<
8813    "invalid output constraint '%0' in asm">;
8814  def err_asm_invalid_lvalue_in_input : Error<
8815    "invalid lvalue in asm input for constraint '%0'">;
8816  def err_asm_invalid_input_constraint : Error<
8817    "invalid input constraint '%0' in asm">;
8818  def err_asm_tying_incompatible_types : Error<
8819    "unsupported inline asm: input with type "
8820    "%diff{$ matching output with type $|}0,1">;
8821  def err_asm_unexpected_constraint_alternatives : Error<
8822    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
8823  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
8824  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
8825  def err_asm_unwind_and_goto : Error<"unwind clobber can't be used with asm goto">;
8826  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
8827    "global register variables on this target">;
8828  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
8829    "match variable size">;
8830  def err_asm_bad_register_type : Error<"bad type for named register variable">;
8831  def err_asm_invalid_input_size : Error<
8832    "invalid input size for constraint '%0'">;
8833  def err_asm_invalid_output_size : Error<
8834    "invalid output size for constraint '%0'">;
8835  def err_invalid_asm_cast_lvalue : Error<
8836    "invalid use of a cast in a inline asm context requiring an lvalue: "
8837    "remove the cast or build with -fheinous-gnu-extensions">;
8838  def err_invalid_asm_value_for_constraint
8839      : Error <"value '%0' out of range for constraint '%1'">;
8840  def err_asm_non_addr_value_in_memory_constraint : Error <
8841    "reference to a %select{bit-field|vector element|global register variable}0"
8842    " in asm %select{input|output}1 with a memory constraint '%2'">;
8843  def err_asm_input_duplicate_match : Error<
8844    "more than one input constraint matches the same output '%0'">;
8845  def err_store_value_to_reg : Error<
8846    "impossible constraint in asm: can't store value into a register">;
8847
8848  def warn_asm_label_on_auto_decl : Warning<
8849    "ignored asm label '%0' on automatic variable">;
8850  def warn_invalid_asm_cast_lvalue : Warning<
8851    "invalid use of a cast in an inline asm context requiring an lvalue: "
8852    "accepted due to -fheinous-gnu-extensions, but clang may remove support "
8853    "for this in the future">;
8854  def warn_asm_mismatched_size_modifier : Warning<
8855    "value size does not match register size specified by the constraint "
8856    "and modifier">,
8857    InGroup<ASMOperandWidths>;
8858
8859  def note_asm_missing_constraint_modifier : Note<
8860    "use constraint modifier \"%0\"">;
8861  def note_asm_input_duplicate_first : Note<
8862    "constraint '%0' is already present here">;
8863 def error_duplicate_asm_operand_name : Error<
8864    "duplicate use of asm operand name \"%0\"">;
8865 def note_duplicate_asm_operand_name : Note<
8866    "asm operand name \"%0\" first referenced here">;
8867}
8868
8869  def error_inoutput_conflict_with_clobber : Error<
8870    "asm-specifier for input or output variable conflicts with asm"
8871    " clobber list">;
8872
8873let CategoryName = "Semantic Issue" in {
8874
8875def err_invalid_conversion_between_matrixes : Error<
8876  "conversion between matrix types%diff{ $ and $|}0,1 of different size is not allowed">;
8877
8878def err_invalid_conversion_between_matrix_and_type : Error<
8879  "conversion between matrix type %0 and incompatible type %1 is not allowed">;
8880
8881def err_invalid_conversion_between_vectors : Error<
8882  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
8883  "size">;
8884def err_invalid_conversion_between_vector_and_integer : Error<
8885  "invalid conversion between vector type %0 and integer type %1 "
8886  "of different size">;
8887
8888def err_opencl_function_pointer : Error<
8889  "%select{pointers|references}0 to functions are not allowed">;
8890
8891def err_opencl_taking_address_capture : Error<
8892  "taking address of a capture is not allowed">;
8893
8894def err_invalid_conversion_between_vector_and_scalar : Error<
8895  "invalid conversion between vector type %0 and scalar type %1">;
8896
8897// C++ member initializers.
8898def err_only_constructors_take_base_inits : Error<
8899  "only constructors take base initializers">;
8900
8901def err_multiple_mem_initialization : Error <
8902  "multiple initializations given for non-static member %0">;
8903def err_multiple_mem_union_initialization : Error <
8904  "initializing multiple members of union">;
8905def err_multiple_base_initialization : Error <
8906  "multiple initializations given for base %0">;
8907
8908def err_mem_init_not_member_or_class : Error<
8909  "member initializer %0 does not name a non-static data member or base "
8910  "class">;
8911
8912def warn_initializer_out_of_order : Warning<
8913  "%select{field|base class}0 %1 will be initialized after "
8914  "%select{field|base}2 %3">,
8915  InGroup<ReorderCtor>, DefaultIgnore;
8916
8917def warn_some_initializers_out_of_order : Warning<
8918  "initializer order does not match the declaration order">,
8919  InGroup<ReorderCtor>, DefaultIgnore;
8920
8921def note_initializer_out_of_order : Note<
8922  "%select{field|base class}0 %1 will be initialized after "
8923  "%select{field|base}2 %3">;
8924
8925def warn_abstract_vbase_init_ignored : Warning<
8926  "initializer for virtual base class %0 of abstract class %1 "
8927  "will never be used">,
8928  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
8929
8930def err_base_init_does_not_name_class : Error<
8931  "constructor initializer %0 does not name a class">;
8932def err_base_init_direct_and_virtual : Error<
8933  "base class initializer %0 names both a direct base class and an "
8934  "inherited virtual base class">;
8935def err_not_direct_base_or_virtual : Error<
8936  "type %0 is not a direct or virtual base of %1">;
8937
8938def err_in_class_initializer_non_const : Error<
8939  "non-const static data member must be initialized out of line">;
8940def err_in_class_initializer_volatile : Error<
8941  "static const volatile data member must be initialized out of line">;
8942def err_in_class_initializer_bad_type : Error<
8943  "static data member of type %0 must be initialized out of line">;
8944def ext_in_class_initializer_float_type : ExtWarn<
8945  "in-class initializer for static data member of type %0 is a GNU extension">,
8946  InGroup<GNUStaticFloatInit>;
8947def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
8948  "in-class initializer for static data member of type %0 requires "
8949  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
8950def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
8951def err_in_class_initializer_literal_type : Error<
8952  "in-class initializer for static data member of type %0 requires "
8953  "'constexpr' specifier">;
8954def err_in_class_initializer_non_constant : Error<
8955  "in-class initializer for static data member is not a constant expression">;
8956def err_default_member_initializer_not_yet_parsed : Error<
8957  "default member initializer for %1 needed within definition of enclosing "
8958  "class %0 outside of member functions">;
8959def note_default_member_initializer_not_yet_parsed : Note<
8960  "default member initializer declared here">;
8961def err_default_member_initializer_cycle
8962    : Error<"default member initializer for %0 uses itself">;
8963
8964def ext_in_class_initializer_non_constant : Extension<
8965  "in-class initializer for static data member is not a constant expression; "
8966  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
8967
8968def err_thread_dynamic_init : Error<
8969  "initializer for thread-local variable must be a constant expression">;
8970def err_thread_nontrivial_dtor : Error<
8971  "type of thread-local variable has non-trivial destruction">;
8972def note_use_thread_local : Note<
8973  "use 'thread_local' to allow this">;
8974
8975// C++ anonymous unions and GNU anonymous structs/unions
8976def ext_anonymous_union : Extension<
8977  "anonymous unions are a C11 extension">, InGroup<C11>;
8978def ext_gnu_anonymous_struct : Extension<
8979  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
8980def ext_c11_anonymous_struct : Extension<
8981  "anonymous structs are a C11 extension">, InGroup<C11>;
8982def err_anonymous_union_not_static : Error<
8983  "anonymous unions at namespace or global scope must be declared 'static'">;
8984def err_anonymous_union_with_storage_spec : Error<
8985  "anonymous union at class scope must not have a storage specifier">;
8986def err_anonymous_struct_not_member : Error<
8987  "anonymous %select{structs|structs and classes}0 must be "
8988  "%select{struct or union|class}0 members">;
8989def err_anonymous_record_member_redecl : Error<
8990  "member of anonymous %select{struct|union}0 redeclares %1">;
8991def err_anonymous_record_with_type : Error<
8992  "types cannot be declared in an anonymous %select{struct|union}0">;
8993def ext_anonymous_record_with_type : Extension<
8994  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
8995  "extension">, InGroup<MicrosoftAnonTag>;
8996def ext_anonymous_record_with_anonymous_type : Extension<
8997  "anonymous types declared in an anonymous %select{struct|union}0 "
8998  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
8999def err_anonymous_record_with_function : Error<
9000  "functions cannot be declared in an anonymous %select{struct|union}0">;
9001def err_anonymous_record_with_static : Error<
9002  "static members cannot be declared in an anonymous %select{struct|union}0">;
9003def err_anonymous_record_bad_member : Error<
9004  "anonymous %select{struct|union}0 can only contain non-static data members">;
9005def err_anonymous_record_nonpublic_member : Error<
9006  "anonymous %select{struct|union}0 cannot contain a "
9007  "%select{private|protected}1 data member">;
9008def ext_ms_anonymous_record : ExtWarn<
9009  "anonymous %select{structs|unions}0 are a Microsoft extension">,
9010  InGroup<MicrosoftAnonTag>;
9011
9012// C++ local classes
9013def err_reference_to_local_in_enclosing_context : Error<
9014  "reference to local %select{variable|binding}1 %0 declared in enclosing "
9015  "%select{%3|block literal|lambda expression|context}2">;
9016
9017def err_static_data_member_not_allowed_in_local_class : Error<
9018  "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
9019
9020// C++ derived classes
9021def err_base_clause_on_union : Error<"unions cannot have base classes">;
9022def err_base_must_be_class : Error<"base specifier must name a class">;
9023def err_union_as_base_class : Error<"unions cannot be base classes">;
9024def err_circular_inheritance : Error<
9025  "circular inheritance between %0 and %1">;
9026def err_base_class_has_flexible_array_member : Error<
9027  "base class %0 has a flexible array member">;
9028def err_incomplete_base_class : Error<"base class has incomplete type">;
9029def err_duplicate_base_class : Error<
9030  "base class %0 specified more than once as a direct base class">;
9031def warn_inaccessible_base_class : Warning<
9032  "direct base %0 is inaccessible due to ambiguity:%1">,
9033  InGroup<DiagGroup<"inaccessible-base">>;
9034// FIXME: better way to display derivation?  Pass entire thing into diagclient?
9035def err_ambiguous_derived_to_base_conv : Error<
9036  "ambiguous conversion from derived class %0 to base class %1:%2">;
9037def err_ambiguous_memptr_conv : Error<
9038  "ambiguous conversion from pointer to member of %select{base|derived}0 "
9039  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
9040def ext_ms_ambiguous_direct_base : ExtWarn<
9041  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
9042  InGroup<MicrosoftInaccessibleBase>;
9043
9044def err_memptr_conv_via_virtual : Error<
9045  "conversion from pointer to member of class %0 to pointer to member "
9046  "of class %1 via virtual base %2 is not allowed">;
9047
9048// C++ member name lookup
9049def err_ambiguous_member_multiple_subobjects : Error<
9050  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
9051def err_ambiguous_member_multiple_subobject_types : Error<
9052  "member %0 found in multiple base classes of different types">;
9053def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
9054def note_ambiguous_member_type_found : Note<
9055  "member type %0 found by ambiguous name lookup">;
9056def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
9057def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
9058def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
9059  "declaration in a different namespace">;
9060def note_hidden_tag : Note<"type declaration hidden">;
9061def note_hiding_object : Note<"declaration hides type">;
9062
9063// C++ operator overloading
9064def err_operator_overload_needs_class_or_enum : Error<
9065  "overloaded %0 must have at least one parameter of class "
9066  "or enumeration type">;
9067
9068def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
9069def err_operator_overload_static : Error<
9070  "overloaded %0 cannot be a static member function">;
9071def err_operator_overload_default_arg : Error<
9072  "parameter of overloaded %0 cannot have a default argument">;
9073
9074def ext_subscript_overload : ExtWarn<
9075  "overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension">, InGroup<CXXPre2bCompat>, DefaultIgnore;
9076def error_subscript_overload : Error<
9077  "overloaded %0 cannot have %select{no|a defaulted|more than one}1 parameter before C++2b">;
9078
9079def err_operator_overload_must_be : Error<
9080  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
9081  "(has %1 parameter%s1)">;
9082
9083def err_operator_overload_must_be_member : Error<
9084  "overloaded %0 must be a non-static member function">;
9085def err_operator_overload_post_incdec_must_be_int : Error<
9086  "parameter of overloaded post-%select{increment|decrement}1 operator must "
9087  "have type 'int' (not %0)">;
9088
9089// C++ allocation and deallocation functions.
9090def err_operator_new_delete_declared_in_namespace : Error<
9091  "%0 cannot be declared inside a namespace">;
9092def err_operator_new_delete_declared_static : Error<
9093  "%0 cannot be declared static in global scope">;
9094def ext_operator_new_delete_declared_inline : ExtWarn<
9095  "replacement function %0 cannot be declared 'inline'">,
9096  InGroup<DiagGroup<"inline-new-delete">>;
9097def err_operator_new_delete_invalid_result_type : Error<
9098  "%0 must return type %1">;
9099def err_operator_new_delete_dependent_result_type : Error<
9100  "%0 cannot have a dependent return type; use %1 instead">;
9101def err_operator_new_delete_too_few_parameters : Error<
9102  "%0 must have at least one parameter">;
9103def err_operator_new_delete_template_too_few_parameters : Error<
9104  "%0 template must have at least two parameters">;
9105def warn_operator_new_returns_null : Warning<
9106  "%0 should not return a null pointer unless it is declared 'throw()'"
9107  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
9108
9109def err_operator_new_dependent_param_type : Error<
9110  "%0 cannot take a dependent type as first parameter; "
9111  "use size_t (%1) instead">;
9112def err_operator_new_param_type : Error<
9113  "%0 takes type size_t (%1) as first parameter">;
9114def err_operator_new_default_arg: Error<
9115  "parameter of %0 cannot have a default argument">;
9116def err_operator_delete_dependent_param_type : Error<
9117  "%0 cannot take a dependent type as first parameter; use %1 instead">;
9118def err_operator_delete_param_type : Error<
9119  "first parameter of %0 must have type %1">;
9120def err_destroying_operator_delete_not_usual : Error<
9121  "destroying operator delete can have only an optional size and optional "
9122  "alignment parameter">;
9123def note_implicit_delete_this_in_destructor_here : Note<
9124  "while checking implicit 'delete this' for virtual destructor">;
9125def err_builtin_operator_new_delete_not_usual : Error<
9126  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
9127  "selects non-usual %select{allocation|deallocation}0 function">;
9128def note_non_usual_function_declared_here : Note<
9129  "non-usual %0 declared here">;
9130
9131// C++ literal operators
9132def err_literal_operator_outside_namespace : Error<
9133  "literal operator %0 must be in a namespace or global scope">;
9134def err_literal_operator_id_outside_namespace : Error<
9135  "non-namespace scope '%0' cannot have a literal operator member">;
9136def err_literal_operator_default_argument : Error<
9137  "literal operator cannot have a default argument">;
9138def err_literal_operator_bad_param_count : Error<
9139  "non-template literal operator must have one or two parameters">;
9140def err_literal_operator_invalid_param : Error<
9141  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
9142def err_literal_operator_param : Error<
9143  "invalid literal operator parameter type %0, did you mean %1?">;
9144def err_literal_operator_template_with_params : Error<
9145  "literal operator template cannot have any parameters">;
9146def err_literal_operator_template : Error<
9147  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
9148def err_literal_operator_extern_c : Error<
9149  "literal operator must have C++ linkage">;
9150def ext_string_literal_operator_template : ExtWarn<
9151  "string literal operator templates are a GNU extension">,
9152  InGroup<GNUStringLiteralOperatorTemplate>;
9153def warn_user_literal_reserved : Warning<
9154  "user-defined literal suffixes not starting with '_' are reserved"
9155  "%select{; no literal will invoke this operator|}0">,
9156  InGroup<UserDefinedLiterals>;
9157
9158// C++ conversion functions
9159def err_conv_function_not_member : Error<
9160  "conversion function must be a non-static member function">;
9161def err_conv_function_return_type : Error<
9162  "conversion function cannot have a return type">;
9163def err_conv_function_with_params : Error<
9164  "conversion function cannot have any parameters">;
9165def err_conv_function_variadic : Error<
9166  "conversion function cannot be variadic">;
9167def err_conv_function_to_array : Error<
9168  "conversion function cannot convert to an array type">;
9169def err_conv_function_to_function : Error<
9170  "conversion function cannot convert to a function type">;
9171def err_conv_function_with_complex_decl : Error<
9172  "cannot specify any part of a return type in the "
9173  "declaration of a conversion function"
9174  "%select{"
9175  "; put the complete type after 'operator'|"
9176  "; use a typedef to declare a conversion to %1|"
9177  "; use an alias template to declare a conversion to %1|"
9178  "}0">;
9179def err_conv_function_redeclared : Error<
9180  "conversion function cannot be redeclared">;
9181def warn_conv_to_self_not_used : Warning<
9182  "conversion function converting %0 to itself will never be used">,
9183  InGroup<ClassConversion>;
9184def warn_conv_to_base_not_used : Warning<
9185  "conversion function converting %0 to its base class %1 will never be used">,
9186  InGroup<ClassConversion>;
9187def warn_conv_to_void_not_used : Warning<
9188  "conversion function converting %0 to %1 will never be used">,
9189  InGroup<ClassConversion>;
9190
9191def warn_not_compound_assign : Warning<
9192  "use of unary operator that may be intended as compound assignment (%0=)">;
9193
9194// C++11 explicit conversion operators
9195def ext_explicit_conversion_functions : ExtWarn<
9196  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
9197def warn_cxx98_compat_explicit_conversion_functions : Warning<
9198  "explicit conversion functions are incompatible with C++98">,
9199  InGroup<CXX98Compat>, DefaultIgnore;
9200
9201// C++11 defaulted functions
9202def err_defaulted_special_member_params : Error<
9203  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
9204  "have default arguments">;
9205def err_defaulted_special_member_variadic : Error<
9206  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
9207  "be variadic">;
9208def err_defaulted_special_member_return_type : Error<
9209  "explicitly-defaulted %select{copy|move}0 assignment operator must "
9210  "return %1">;
9211def err_defaulted_special_member_quals : Error<
9212  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
9213  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
9214def err_defaulted_special_member_volatile_param : Error<
9215  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
9216  "may not be volatile">;
9217def err_defaulted_special_member_move_const_param : Error<
9218  "the parameter for an explicitly-defaulted move "
9219  "%select{constructor|assignment operator}0 may not be const">;
9220def err_defaulted_special_member_copy_const_param : Error<
9221  "the parameter for this explicitly-defaulted copy "
9222  "%select{constructor|assignment operator}0 is const, but a member or base "
9223  "requires it to be non-const">;
9224def err_defaulted_copy_assign_not_ref : Error<
9225  "the parameter for an explicitly-defaulted copy assignment operator must be an "
9226  "lvalue reference type">;
9227def err_incorrect_defaulted_constexpr : Error<
9228  "defaulted definition of %sub{select_special_member_kind}0 "
9229  "is not constexpr">;
9230def err_incorrect_defaulted_consteval : Error<
9231  "defaulted declaration of %sub{select_special_member_kind}0 "
9232  "cannot be consteval because implicit definition is not constexpr">;
9233def warn_defaulted_method_deleted : Warning<
9234  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
9235  "deleted">, InGroup<DefaultedFunctionDeleted>;
9236def err_out_of_line_default_deletes : Error<
9237  "defaulting this %sub{select_special_member_kind}0 "
9238  "would delete it after its first declaration">;
9239def note_deleted_type_mismatch : Note<
9240  "function is implicitly deleted because its declared type does not match "
9241  "the type of an implicit %sub{select_special_member_kind}0">;
9242def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
9243  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
9244  "different from the implicit type is incompatible with C++ standards before "
9245  "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9246def warn_vbase_moved_multiple_times : Warning<
9247  "defaulted move assignment operator of %0 will move assign virtual base "
9248  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
9249def note_vbase_moved_here : Note<
9250  "%select{%1 is a virtual base class of base class %2 declared here|"
9251  "virtual base class %1 declared here}0">;
9252
9253// C++20 defaulted comparisons
9254// This corresponds to values of Sema::DefaultedComparisonKind.
9255def select_defaulted_comparison_kind : TextSubstitution<
9256  "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
9257  "operator">;
9258def ext_defaulted_comparison : ExtWarn<
9259  "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
9260def warn_cxx17_compat_defaulted_comparison : Warning<
9261  "defaulted comparison operators are incompatible with C++ standards "
9262  "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9263def err_defaulted_comparison_template : Error<
9264  "comparison operator template cannot be defaulted">;
9265def err_defaulted_comparison_num_args : Error<
9266  "%select{non-member|member}0 %sub{select_defaulted_comparison_kind}1"
9267  " comparison operator must have %select{2|1}0 parameters">;
9268def err_defaulted_comparison_param : Error<
9269  "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
9270  "; found %1, expected %2%select{| or %4}3">;
9271def err_defaulted_comparison_param_unknown : Error<
9272  "invalid parameter type for non-member defaulted"
9273  " %sub{select_defaulted_comparison_kind}0"
9274  "; found %1, expected class or reference to a constant class">;
9275def err_defaulted_comparison_param_mismatch : Error<
9276  "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
9277  "must have the same type%diff{ (found $ vs $)|}1,2">;
9278def err_defaulted_comparison_not_friend : Error<
9279  "%sub{select_defaulted_comparison_kind}0 is not a friend of"
9280  " %select{|incomplete class }1%2">;
9281def err_defaulted_comparison_non_const : Error<
9282  "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
9283  "const-qualified">;
9284def err_defaulted_comparison_return_type_not_bool : Error<
9285  "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9286  "must be 'bool', not %1">;
9287def err_defaulted_comparison_deduced_return_type_not_auto : Error<
9288  "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9289  "must be 'auto', not %1">;
9290def warn_defaulted_comparison_deleted : Warning<
9291  "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
9292  "deleted">, InGroup<DefaultedFunctionDeleted>;
9293def err_non_first_default_compare_deletes : Error<
9294  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
9295  "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
9296  "would delete it after its first declaration">;
9297def note_defaulted_comparison_union : Note<
9298  "defaulted %0 is implicitly deleted because "
9299  "%2 is a %select{union-like class|union}1 with variant members">;
9300def note_defaulted_comparison_reference_member : Note<
9301  "defaulted %0 is implicitly deleted because "
9302  "class %1 has a reference member">;
9303def note_defaulted_comparison_ambiguous : Note<
9304  "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
9305  "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
9306def note_defaulted_comparison_inaccessible : Note<
9307  "defaulted %0 is implicitly deleted because it would invoke a "
9308  "%select{private|protected}3 %4%select{ member of %6|"
9309  " member of %6 to compare member %2| to compare base class %2}1">;
9310def note_defaulted_comparison_calls_deleted : Note<
9311  "defaulted %0 is implicitly deleted because it would invoke a deleted "
9312  "comparison function%select{| for member %2| for base class %2}1">;
9313def note_defaulted_comparison_no_viable_function : Note<
9314  "defaulted %0 is implicitly deleted because there is no viable "
9315  "%select{three-way comparison function|'operator=='}1 for "
9316  "%select{|member |base class }2%3">;
9317def note_defaulted_comparison_no_viable_function_synthesized : Note<
9318  "three-way comparison cannot be synthesized because there is no viable "
9319  "function for %select{'=='|'<'}0 comparison">;
9320def note_defaulted_comparison_not_rewritten_callee : Note<
9321  "defaulted %0 is implicitly deleted because this non-rewritten comparison "
9322  "function would be the best match for the comparison">;
9323def note_defaulted_comparison_not_rewritten_conversion : Note<
9324  "defaulted %0 is implicitly deleted because a builtin comparison function "
9325  "using this conversion would be the best match for the comparison">;
9326def note_defaulted_comparison_cannot_deduce : Note<
9327  "return type of defaulted 'operator<=>' cannot be deduced because "
9328  "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
9329  "is not a standard comparison category type">;
9330def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
9331  "return type of defaulted 'operator<=>' cannot be deduced because "
9332  "three-way comparison for %select{|member|base class}0 %1 "
9333  "has a deduced return type and is not yet defined">;
9334def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
9335  "%select{|member|base class}0 %1 declared here">;
9336def note_defaulted_comparison_cannot_deduce_callee : Note<
9337  "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
9338def err_incorrect_defaulted_comparison_constexpr : Error<
9339  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9340  "three-way comparison operator}0 "
9341  "cannot be declared %select{constexpr|consteval}2 because "
9342  "%select{it|the corresponding implicit 'operator=='}0 "
9343  "invokes a non-constexpr comparison function">;
9344def note_defaulted_comparison_not_constexpr : Note<
9345  "non-constexpr comparison function would be used to compare "
9346  "%select{|member %1|base class %1}0">;
9347def note_defaulted_comparison_not_constexpr_here : Note<
9348  "non-constexpr comparison function declared here">;
9349def note_in_declaration_of_implicit_equality_comparison : Note<
9350  "while declaring the corresponding implicit 'operator==' "
9351  "for this defaulted 'operator<=>'">;
9352
9353def ext_implicit_exception_spec_mismatch : ExtWarn<
9354  "function previously declared with an %select{explicit|implicit}0 exception "
9355  "specification redeclared with an %select{implicit|explicit}0 exception "
9356  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
9357
9358def warn_ptr_arith_precedes_bounds : Warning<
9359  "the pointer decremented by %0 refers before the beginning of the array">,
9360  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9361def warn_ptr_arith_exceeds_bounds : Warning<
9362  "the pointer incremented by %0 refers past the end of the array (that "
9363  "contains %1 element%s2)">,
9364  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9365def warn_array_index_precedes_bounds : Warning<
9366  "array index %0 is before the beginning of the array">,
9367  InGroup<ArrayBounds>;
9368def warn_array_index_exceeds_bounds : Warning<
9369  "array index %0 is past the end of the array (which contains %1 "
9370  "element%s2)">, InGroup<ArrayBounds>;
9371def warn_ptr_arith_exceeds_max_addressable_bounds : Warning<
9372  "the pointer incremented by %0 refers past the last possible element for an array in %1-bit "
9373  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9374  InGroup<ArrayBounds>;
9375def warn_array_index_exceeds_max_addressable_bounds : Warning<
9376  "array index %0 refers past the last possible element for an array in %1-bit "
9377  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9378  InGroup<ArrayBounds>;
9379def note_array_declared_here : Note<
9380  "array %0 declared here">;
9381
9382def warn_inconsistent_array_form : Warning<
9383  "argument %0 of type %1 with mismatched bound">,
9384  InGroup<ArrayParameter>, DefaultIgnore;
9385def note_previous_declaration_as : Note<
9386  "previously declared as %0 here">;
9387
9388def warn_printf_insufficient_data_args : Warning<
9389  "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
9390def warn_printf_data_arg_not_used : Warning<
9391  "data argument not used by format string">, InGroup<FormatExtraArgs>;
9392def warn_format_invalid_conversion : Warning<
9393  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
9394def warn_printf_incomplete_specifier : Warning<
9395  "incomplete format specifier">, InGroup<Format>;
9396def warn_missing_format_string : Warning<
9397  "format string missing">, InGroup<Format>;
9398def warn_scanf_nonzero_width : Warning<
9399  "zero field width in scanf format string is unused">,
9400  InGroup<Format>;
9401def warn_format_conversion_argument_type_mismatch : Warning<
9402  "format specifies type %0 but the argument has "
9403  "%select{type|underlying type}2 %1">,
9404  InGroup<Format>;
9405def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
9406  warn_format_conversion_argument_type_mismatch.Text>,
9407  InGroup<FormatPedantic>;
9408def warn_format_conversion_argument_type_mismatch_confusion : Warning<
9409  warn_format_conversion_argument_type_mismatch.Text>,
9410  InGroup<FormatTypeConfusion>, DefaultIgnore;
9411def warn_format_argument_needs_cast : Warning<
9412  "%select{values of type|enum values with underlying type}2 '%0' should not "
9413  "be used as format arguments; add an explicit cast to %1 instead">,
9414  InGroup<Format>;
9415def warn_format_argument_needs_cast_pedantic : Warning<
9416  warn_format_argument_needs_cast.Text>,
9417  InGroup<FormatPedantic>, DefaultIgnore;
9418def warn_printf_positional_arg_exceeds_data_args : Warning <
9419  "data argument position '%0' exceeds the number of data arguments (%1)">,
9420  InGroup<Format>;
9421def warn_format_zero_positional_specifier : Warning<
9422  "position arguments in format strings start counting at 1 (not 0)">,
9423  InGroup<Format>;
9424def warn_format_invalid_positional_specifier : Warning<
9425  "invalid position specified for %select{field width|field precision}0">,
9426  InGroup<Format>;
9427def warn_format_mix_positional_nonpositional_args : Warning<
9428  "cannot mix positional and non-positional arguments in format string">,
9429  InGroup<Format>;
9430def warn_static_array_too_small : Warning<
9431  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
9432  " callee requires at least %1">,
9433  InGroup<ArrayBounds>;
9434def note_callee_static_array : Note<
9435  "callee declares array parameter as static here">;
9436def warn_empty_format_string : Warning<
9437  "format string is empty">, InGroup<FormatZeroLength>;
9438def warn_format_string_is_wide_literal : Warning<
9439  "format string should not be a wide string">, InGroup<Format>;
9440def warn_printf_format_string_contains_null_char : Warning<
9441  "format string contains '\\0' within the string body">, InGroup<Format>;
9442def warn_printf_format_string_not_null_terminated : Warning<
9443  "format string is not null-terminated">, InGroup<Format>;
9444def warn_printf_asterisk_missing_arg : Warning<
9445  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
9446  InGroup<Format>;
9447def warn_printf_asterisk_wrong_type : Warning<
9448  "field %select{width|precision}0 should have type %1, but argument has type %2">,
9449  InGroup<Format>;
9450def warn_printf_nonsensical_optional_amount: Warning<
9451  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
9452  InGroup<Format>;
9453def warn_printf_nonsensical_flag: Warning<
9454  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
9455  InGroup<Format>;
9456def warn_format_nonsensical_length: Warning<
9457  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
9458  InGroup<Format>;
9459def warn_format_non_standard_positional_arg: Warning<
9460  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
9461def warn_format_non_standard: Warning<
9462  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
9463  InGroup<FormatNonStandard>, DefaultIgnore;
9464def warn_format_non_standard_conversion_spec: Warning<
9465  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
9466  InGroup<FormatNonStandard>, DefaultIgnore;
9467def err_invalid_mask_type_size : Error<
9468  "mask type size must be between 1-byte and 8-bytes">;
9469def warn_format_invalid_annotation : Warning<
9470  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
9471  InGroup<Format>;
9472def warn_format_P_no_precision : Warning<
9473  "using '%%P' format specifier without precision">,
9474  InGroup<Format>;
9475def warn_printf_ignored_flag: Warning<
9476  "flag '%0' is ignored when flag '%1' is present">,
9477  InGroup<Format>;
9478def warn_printf_empty_objc_flag: Warning<
9479  "missing object format flag">,
9480  InGroup<Format>;
9481def warn_printf_ObjCflags_without_ObjCConversion: Warning<
9482  "object format flags cannot be used with '%0' conversion specifier">,
9483  InGroup<Format>;
9484def warn_printf_invalid_objc_flag: Warning<
9485    "'%0' is not a valid object format flag">,
9486    InGroup<Format>;
9487def warn_printf_narg_not_supported : Warning<
9488    "'%%n' specifier not supported on this platform">,
9489    InGroup<Format>;
9490def warn_scanf_scanlist_incomplete : Warning<
9491  "no closing ']' for '%%[' in scanf format string">,
9492  InGroup<Format>;
9493def warn_format_bool_as_character : Warning<
9494  "using '%0' format specifier, but argument has boolean value">,
9495  InGroup<Format>;
9496def note_format_string_defined : Note<"format string is defined here">;
9497def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
9498def note_printf_c_str: Note<"did you mean to call the %0 method?">;
9499def note_format_security_fixit: Note<
9500  "treat the string as an argument to avoid this">;
9501
9502def warn_null_arg : Warning<
9503  "null passed to a callee that requires a non-null argument">,
9504  InGroup<NonNull>;
9505def warn_null_ret : Warning<
9506  "null returned from %select{function|method}0 that requires a non-null return value">,
9507  InGroup<NonNull>;
9508
9509def err_lifetimebound_no_object_param : Error<
9510  "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
9511  "function has no implicit object parameter">;
9512def err_lifetimebound_ctor_dtor : Error<
9513  "'lifetimebound' attribute cannot be applied to a "
9514  "%select{constructor|destructor}0">;
9515
9516// CHECK: returning address/reference of stack memory
9517def warn_ret_stack_addr_ref : Warning<
9518  "%select{address of|reference to}0 stack memory associated with "
9519  "%select{local variable|parameter}2 %1 returned">,
9520  InGroup<ReturnStackAddress>;
9521def warn_ret_local_temp_addr_ref : Warning<
9522  "returning %select{address of|reference to}0 local temporary object">,
9523  InGroup<ReturnStackAddress>;
9524def warn_ret_addr_label : Warning<
9525  "returning address of label, which is local">,
9526  InGroup<ReturnStackAddress>;
9527def err_ret_local_block : Error<
9528  "returning block that lives on the local stack">;
9529def note_local_var_initializer : Note<
9530  "%select{via initialization of|binding reference}0 variable "
9531  "%select{%2 |}1here">;
9532def note_lambda_capture_initializer : Note<
9533  "%select{implicitly |}2captured%select{| by reference}3"
9534  "%select{%select{ due to use|}2 here|"
9535  " via initialization of lambda capture %0}1">;
9536def note_init_with_default_member_initalizer : Note<
9537  "initializing field %0 with default member initializer">;
9538
9539// Check for initializing a member variable with the address or a reference to
9540// a constructor parameter.
9541def warn_bind_ref_member_to_parameter : Warning<
9542  "binding reference member %0 to stack allocated "
9543  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9544def warn_init_ptr_member_to_parameter_addr : Warning<
9545  "initializing pointer member %0 with the stack address of "
9546  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9547def note_ref_or_ptr_member_declared_here : Note<
9548  "%select{reference|pointer}0 member declared here">;
9549
9550def err_dangling_member : Error<
9551  "%select{reference|backing array for 'std::initializer_list'}2 "
9552  "%select{|subobject of }1member %0 "
9553  "%select{binds to|is}2 a temporary object "
9554  "whose lifetime would be shorter than the lifetime of "
9555  "the constructed object">;
9556def warn_dangling_member : Warning<
9557  "%select{reference|backing array for 'std::initializer_list'}2 "
9558  "%select{|subobject of }1member %0 "
9559  "%select{binds to|is}2 a temporary object "
9560  "whose lifetime is shorter than the lifetime of the constructed object">,
9561  InGroup<DanglingField>;
9562def warn_dangling_lifetime_pointer_member : Warning<
9563  "initializing pointer member %0 to point to a temporary object "
9564  "whose lifetime is shorter than the lifetime of the constructed object">,
9565  InGroup<DanglingGsl>;
9566def note_lifetime_extending_member_declared_here : Note<
9567  "%select{%select{reference|'std::initializer_list'}0 member|"
9568  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
9569  "declared here">;
9570def warn_dangling_variable : Warning<
9571  "%select{temporary %select{whose address is used as value of|"
9572  "%select{|implicitly }2bound to}4 "
9573  "%select{%select{|reference }4member of local variable|"
9574  "local %select{variable|reference}4}1|"
9575  "array backing "
9576  "%select{initializer list subobject of local variable|"
9577  "local initializer list}1}0 "
9578  "%select{%3 |}2will be destroyed at the end of the full-expression">,
9579  InGroup<Dangling>;
9580def warn_new_dangling_reference : Warning<
9581  "temporary bound to reference member of allocated object "
9582  "will be destroyed at the end of the full-expression">,
9583  InGroup<DanglingField>;
9584def warn_dangling_lifetime_pointer : Warning<
9585  "object backing the pointer "
9586  "will be destroyed at the end of the full-expression">,
9587  InGroup<DanglingGsl>;
9588def warn_new_dangling_initializer_list : Warning<
9589  "array backing "
9590  "%select{initializer list subobject of the allocated object|"
9591  "the allocated initializer list}0 "
9592  "will be destroyed at the end of the full-expression">,
9593  InGroup<DanglingInitializerList>;
9594def warn_unsupported_lifetime_extension : Warning<
9595  "sorry, lifetime extension of "
9596  "%select{temporary|backing array of initializer list}0 created "
9597  "by aggregate initialization using default member initializer "
9598  "is not supported; lifetime of %select{temporary|backing array}0 "
9599  "will end at the end of the full-expression">, InGroup<Dangling>;
9600
9601// For non-floating point, expressions of the form x == x or x != x
9602// should result in a warning, since these always evaluate to a constant.
9603// Array comparisons have similar warnings
9604def warn_comparison_always : Warning<
9605  "%select{self-|array }0comparison always evaluates to "
9606  "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9607  InGroup<TautologicalCompare>;
9608def warn_comparison_bitwise_always : Warning<
9609  "bitwise comparison always evaluates to %select{false|true}0">,
9610  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9611def warn_comparison_bitwise_or : Warning<
9612  "bitwise or with non-zero value always evaluates to true">,
9613  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9614def warn_tautological_overlap_comparison : Warning<
9615  "overlapping comparisons always evaluate to %select{false|true}0">,
9616  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9617def warn_depr_array_comparison : Warning<
9618  "comparison between two arrays is deprecated; "
9619  "to compare array addresses, use unary '+' to decay operands to pointers">,
9620  InGroup<DeprecatedArrayCompare>;
9621
9622def warn_stringcompare : Warning<
9623  "result of comparison against %select{a string literal|@encode}0 is "
9624  "unspecified (use an explicit string comparison function instead)">,
9625  InGroup<StringCompare>;
9626
9627def warn_identity_field_assign : Warning<
9628  "assigning %select{field|instance variable}0 to itself">,
9629  InGroup<SelfAssignmentField>;
9630
9631// Type safety attributes
9632def err_type_tag_for_datatype_not_ice : Error<
9633  "'type_tag_for_datatype' attribute requires the initializer to be "
9634  "an %select{integer|integral}0 constant expression">;
9635def err_type_tag_for_datatype_too_large : Error<
9636  "'type_tag_for_datatype' attribute requires the initializer to be "
9637  "an %select{integer|integral}0 constant expression "
9638  "that can be represented by a 64 bit integer">;
9639def err_tag_index_out_of_range : Error<
9640  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
9641def warn_type_tag_for_datatype_wrong_kind : Warning<
9642  "this type tag was not designed to be used with this function">,
9643  InGroup<TypeSafety>;
9644def warn_type_safety_type_mismatch : Warning<
9645  "argument type %0 doesn't match specified %1 type tag "
9646  "%select{that requires %3|}2">, InGroup<TypeSafety>;
9647def warn_type_safety_null_pointer_required : Warning<
9648  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
9649
9650// Generic selections.
9651def err_assoc_type_incomplete : Error<
9652  "type %0 in generic association incomplete">;
9653def err_assoc_type_nonobject : Error<
9654  "type %0 in generic association not an object type">;
9655def err_assoc_type_variably_modified : Error<
9656  "type %0 in generic association is a variably modified type">;
9657def err_assoc_compatible_types : Error<
9658  "type %0 in generic association compatible with previously specified type %1">;
9659def note_compat_assoc : Note<
9660  "compatible type %0 specified here">;
9661def err_generic_sel_no_match : Error<
9662  "controlling expression type %0 not compatible with any generic association type">;
9663def err_generic_sel_multi_match : Error<
9664  "controlling expression type %0 compatible with %1 generic association types">;
9665
9666
9667// Blocks
9668def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
9669  " or %select{pick a deployment target that supports them|for OpenCL C 2.0"
9670  " or OpenCL C 3.0 with __opencl_c_device_enqueue feature}0">;
9671def err_block_returning_array_function : Error<
9672  "block cannot return %select{array|function}0 type %1">;
9673
9674// Builtin annotation
9675def err_builtin_annotation_first_arg : Error<
9676  "first argument to __builtin_annotation must be an integer">;
9677def err_builtin_annotation_second_arg : Error<
9678  "second argument to __builtin_annotation must be a non-wide string constant">;
9679def err_msvc_annotation_wide_str : Error<
9680  "arguments to __annotation must be wide string constants">;
9681
9682// CFString checking
9683def err_cfstring_literal_not_string_constant : Error<
9684  "CFString literal is not a string constant">;
9685def warn_cfstring_truncated : Warning<
9686  "input conversion stopped due to an input byte that does not "
9687  "belong to the input codeset UTF-8">,
9688  InGroup<DiagGroup<"CFString-literal">>;
9689
9690// os_log checking
9691// TODO: separate diagnostic for os_trace()
9692def err_os_log_format_not_string_constant : Error<
9693  "os_log() format argument is not a string constant">;
9694def err_os_log_argument_too_big : Error<
9695  "os_log() argument %0 is too big (%1 bytes, max %2)">;
9696def warn_os_log_format_narg : Error<
9697 "os_log() '%%n' format specifier is not allowed">, DefaultError;
9698
9699// Statements.
9700def err_continue_not_in_loop : Error<
9701  "'continue' statement not in loop statement">;
9702def err_break_not_in_loop_or_switch : Error<
9703  "'break' statement not in loop or switch statement">;
9704def warn_loop_ctrl_binds_to_inner : Warning<
9705  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
9706  InGroup<GccCompat>;
9707def warn_break_binds_to_switch : Warning<
9708  "'break' is bound to loop, GCC binds it to switch">,
9709  InGroup<GccCompat>;
9710def err_default_not_in_switch : Error<
9711  "'default' statement not in switch statement">;
9712def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
9713def warn_bool_switch_condition : Warning<
9714  "switch condition has boolean value">, InGroup<SwitchBool>;
9715def warn_case_value_overflow : Warning<
9716  "overflow converting case value to switch condition type (%0 to %1)">,
9717  InGroup<Switch>;
9718def err_duplicate_case : Error<"duplicate case value '%0'">;
9719def err_duplicate_case_differing_expr : Error<
9720  "duplicate case value: '%0' and '%1' both equal '%2'">;
9721def warn_case_empty_range : Warning<"empty case range specified">;
9722def warn_missing_case_for_condition :
9723  Warning<"no case matching constant switch condition '%0'">;
9724
9725def warn_def_missing_case : Warning<"%plural{"
9726  "1:enumeration value %1 not explicitly handled in switch|"
9727  "2:enumeration values %1 and %2 not explicitly handled in switch|"
9728  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
9729  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
9730  InGroup<SwitchEnum>, DefaultIgnore;
9731
9732def warn_missing_case : Warning<"%plural{"
9733  "1:enumeration value %1 not handled in switch|"
9734  "2:enumeration values %1 and %2 not handled in switch|"
9735  "3:enumeration values %1, %2, and %3 not handled in switch|"
9736  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
9737  InGroup<Switch>;
9738
9739def warn_unannotated_fallthrough : Warning<
9740  "unannotated fall-through between switch labels">,
9741  InGroup<ImplicitFallthrough>, DefaultIgnore;
9742def warn_unannotated_fallthrough_per_function : Warning<
9743  "unannotated fall-through between switch labels in partly-annotated "
9744  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
9745def note_insert_fallthrough_fixit : Note<
9746  "insert '%0;' to silence this warning">;
9747def note_insert_break_fixit : Note<
9748  "insert 'break;' to avoid fall-through">;
9749def err_fallthrough_attr_wrong_target : Error<
9750  "%0 attribute is only allowed on empty statements">;
9751def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
9752def err_fallthrough_attr_outside_switch : Error<
9753  "fallthrough annotation is outside switch statement">;
9754def err_fallthrough_attr_invalid_placement : Error<
9755  "fallthrough annotation does not directly precede switch label">;
9756
9757def warn_unreachable_default : Warning<
9758  "default label in switch which covers all enumeration values">,
9759  InGroup<CoveredSwitchDefault>, DefaultIgnore;
9760def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
9761  InGroup<Switch>;
9762def warn_not_in_enum_assignment : Warning<"integer constant not in range "
9763  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
9764def err_typecheck_statement_requires_scalar : Error<
9765  "statement requires expression of scalar type (%0 invalid)">;
9766def err_typecheck_statement_requires_integer : Error<
9767  "statement requires expression of integer type (%0 invalid)">;
9768def err_multiple_default_labels_defined : Error<
9769  "multiple default labels in one switch">;
9770def err_switch_multiple_conversions : Error<
9771  "multiple conversions from switch condition type %0 to an integral or "
9772  "enumeration type">;
9773def note_switch_conversion : Note<
9774  "conversion to %select{integral|enumeration}0 type %1">;
9775def err_switch_explicit_conversion : Error<
9776  "switch condition type %0 requires explicit conversion to %1">;
9777def err_switch_incomplete_class_type : Error<
9778  "switch condition has incomplete class type %0">;
9779
9780def warn_empty_if_body : Warning<
9781  "if statement has empty body">, InGroup<EmptyBody>;
9782def warn_empty_for_body : Warning<
9783  "for loop has empty body">, InGroup<EmptyBody>;
9784def warn_empty_range_based_for_body : Warning<
9785  "range-based for loop has empty body">, InGroup<EmptyBody>;
9786def warn_empty_while_body : Warning<
9787  "while loop has empty body">, InGroup<EmptyBody>;
9788def warn_empty_switch_body : Warning<
9789  "switch statement has empty body">, InGroup<EmptyBody>;
9790def note_empty_body_on_separate_line : Note<
9791  "put the semicolon on a separate line to silence this warning">;
9792
9793def err_va_start_captured_stmt : Error<
9794  "'va_start' cannot be used in a captured statement">;
9795def err_va_start_outside_function : Error<
9796  "'va_start' cannot be used outside a function">;
9797def err_va_start_fixed_function : Error<
9798  "'va_start' used in function with fixed args">;
9799def err_va_start_used_in_wrong_abi_function : Error<
9800  "'va_start' used in %select{System V|Win64}0 ABI function">;
9801def err_ms_va_start_used_in_sysv_function : Error<
9802  "'__builtin_ms_va_start' used in System V ABI function">;
9803def warn_second_arg_of_va_start_not_last_named_param : Warning<
9804  "second argument to 'va_start' is not the last named parameter">,
9805  InGroup<Varargs>;
9806def warn_va_start_type_is_undefined : Warning<
9807  "passing %select{an object that undergoes default argument promotion|"
9808  "an object of reference type|a parameter declared with the 'register' "
9809  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
9810def err_first_argument_to_va_arg_not_of_type_va_list : Error<
9811  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
9812def err_second_parameter_to_va_arg_incomplete: Error<
9813  "second argument to 'va_arg' is of incomplete type %0">;
9814def err_second_parameter_to_va_arg_abstract: Error<
9815  "second argument to 'va_arg' is of abstract type %0">;
9816def warn_second_parameter_to_va_arg_not_pod : Warning<
9817  "second argument to 'va_arg' is of non-POD type %0">,
9818  InGroup<NonPODVarargs>, DefaultError;
9819def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
9820  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
9821  InGroup<NonPODVarargs>, DefaultError;
9822def warn_second_parameter_to_va_arg_never_compatible : Warning<
9823  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
9824  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
9825
9826def warn_return_missing_expr : Warning<
9827  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9828  InGroup<ReturnType>;
9829def ext_return_missing_expr : ExtWarn<
9830  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9831  InGroup<ReturnType>;
9832def ext_return_has_expr : ExtWarn<
9833  "%select{void function|void method|constructor|destructor}1 %0 "
9834  "should not return a value">,
9835  DefaultError, InGroup<ReturnType>;
9836def ext_return_has_void_expr : Extension<
9837  "void %select{function|method|block}1 %0 should not return void expression">;
9838def err_return_init_list : Error<
9839  "%select{void function|void method|constructor|destructor}1 %0 "
9840  "must not return a value">;
9841def err_ctor_dtor_returns_void : Error<
9842  "%select{constructor|destructor}1 %0 must not return void expression">;
9843def warn_noreturn_function_has_return_expr : Warning<
9844  "function %0 declared 'noreturn' should not return">,
9845  InGroup<InvalidNoreturn>;
9846def warn_falloff_noreturn_function : Warning<
9847  "function declared 'noreturn' should not return">,
9848  InGroup<InvalidNoreturn>;
9849def err_noreturn_block_has_return_expr : Error<
9850  "block declared 'noreturn' should not return">;
9851def err_carries_dependency_missing_on_first_decl : Error<
9852  "%select{function|parameter}0 declared '[[carries_dependency]]' "
9853  "after its first declaration">;
9854def note_carries_dependency_missing_first_decl : Note<
9855  "declaration missing '[[carries_dependency]]' attribute is here">;
9856def err_carries_dependency_param_not_function_decl : Error<
9857  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
9858  "declaration or lambda">;
9859def err_block_on_nonlocal : Error<
9860  "__block attribute not allowed, only allowed on local variables">;
9861def err_block_on_vm : Error<
9862  "__block attribute not allowed on declaration with a variably modified type">;
9863def err_sizeless_nonlocal : Error<
9864  "non-local variable with sizeless type %0">;
9865
9866def err_vec_builtin_non_vector : Error<
9867 "first two arguments to %0 must be vectors">;
9868def err_vec_builtin_incompatible_vector : Error<
9869  "first two arguments to %0 must have the same type">;
9870def err_vsx_builtin_nonconstant_argument : Error<
9871  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
9872
9873def err_shufflevector_nonconstant_argument : Error<
9874  "index for __builtin_shufflevector must be a constant integer">;
9875def err_shufflevector_argument_too_large : Error<
9876  "index for __builtin_shufflevector must be less than the total number "
9877  "of vector elements">;
9878
9879def err_convertvector_non_vector : Error<
9880  "first argument to __builtin_convertvector must be a vector">;
9881def err_convertvector_non_vector_type : Error<
9882  "second argument to __builtin_convertvector must be a vector type">;
9883def err_convertvector_incompatible_vector : Error<
9884  "first two arguments to __builtin_convertvector must have the same number of elements">;
9885
9886def err_first_argument_to_cwsc_not_call : Error<
9887  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
9888def err_first_argument_to_cwsc_block_call : Error<
9889  "first argument to __builtin_call_with_static_chain must not be a block call">;
9890def err_first_argument_to_cwsc_builtin_call : Error<
9891  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
9892def err_first_argument_to_cwsc_pdtor_call : Error<
9893  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
9894def err_second_argument_to_cwsc_not_pointer : Error<
9895  "second argument to __builtin_call_with_static_chain must be of pointer type">;
9896
9897def err_vector_incorrect_num_initializers : Error<
9898  "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
9899def err_altivec_empty_initializer : Error<"expected initializer">;
9900
9901def err_invalid_neon_type_code : Error<
9902  "incompatible constant for this __builtin_neon function">;
9903def err_argument_invalid_range : Error<
9904  "argument value %0 is outside the valid range [%1, %2]">;
9905def warn_argument_invalid_range : Warning<
9906  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
9907  InGroup<DiagGroup<"argument-outside-range">>;
9908def warn_argument_undefined_behaviour : Warning<
9909  "argument value %0 will result in undefined behaviour">,
9910  InGroup<DiagGroup<"argument-undefined-behaviour">>;
9911def err_argument_not_multiple : Error<
9912  "argument should be a multiple of %0">;
9913def err_argument_not_power_of_2 : Error<
9914  "argument should be a power of 2">;
9915def err_argument_not_shifted_byte : Error<
9916  "argument should be an 8-bit value shifted by a multiple of 8 bits">;
9917def err_argument_not_shifted_byte_or_xxff : Error<
9918  "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
9919def err_argument_not_contiguous_bit_field : Error<
9920  "argument %0 value should represent a contiguous bit field">;
9921def err_rotation_argument_to_cadd
9922    : Error<"argument should be the value 90 or 270">;
9923def err_rotation_argument_to_cmla
9924    : Error<"argument should be the value 0, 90, 180 or 270">;
9925def warn_neon_vector_initializer_non_portable : Warning<
9926  "vector initializers are not compatible with NEON intrinsics in big endian "
9927  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
9928def note_neon_vector_initializer_non_portable : Note<
9929  "consider using vld1_%0%1() to initialize a vector from memory, or "
9930  "vcreate_%0%1() to initialize from an integer constant">;
9931def note_neon_vector_initializer_non_portable_q : Note<
9932  "consider using vld1q_%0%1() to initialize a vector from memory, or "
9933  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
9934  "constants">;
9935def err_systemz_invalid_tabort_code : Error<
9936  "invalid transaction abort code">;
9937def err_64_bit_builtin_32_bit_tgt : Error<
9938  "this builtin is only available on 64-bit targets">;
9939def err_32_bit_builtin_64_bit_tgt : Error<
9940  "this builtin is only available on 32-bit targets">;
9941def err_builtin_x64_aarch64_only : Error<
9942  "this builtin is only available on x86-64 and aarch64 targets">;
9943def err_mips_builtin_requires_dsp : Error<
9944  "this builtin requires 'dsp' ASE, please use -mdsp">;
9945def err_mips_builtin_requires_dspr2 : Error<
9946  "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
9947def err_mips_builtin_requires_msa : Error<
9948  "this builtin requires 'msa' ASE, please use -mmsa">;
9949def err_ppc_builtin_only_on_arch : Error<
9950  "this builtin is only valid on POWER%0 or later CPUs">;
9951def err_ppc_builtin_requires_vsx : Error<
9952  "this builtin requires VSX to be enabled">;
9953def err_ppc_builtin_requires_htm : Error<
9954  "this builtin requires HTM to be enabled">;
9955def err_ppc_builtin_requires_abi : Error<
9956  "this builtin requires ABI -mabi=%0">;
9957def err_ppc_invalid_use_mma_type : Error<
9958  "invalid use of PPC MMA type">;
9959def err_ppc_invalid_test_data_class_type : Error<
9960  "expected a 'float' or 'double' for the first argument">;
9961def err_x86_builtin_invalid_rounding : Error<
9962  "invalid rounding argument">;
9963def err_x86_builtin_invalid_scale : Error<
9964  "scale argument must be 1, 2, 4, or 8">;
9965def err_x86_builtin_tile_arg_duplicate : Error<
9966  "tile arguments must refer to different tiles">;
9967
9968def err_builtin_target_unsupported : Error<
9969  "builtin is not supported on this target">;
9970def err_builtin_longjmp_unsupported : Error<
9971  "__builtin_longjmp is not supported for the current target">;
9972def err_builtin_setjmp_unsupported : Error<
9973  "__builtin_setjmp is not supported for the current target">;
9974
9975def err_builtin_longjmp_invalid_val : Error<
9976  "argument to __builtin_longjmp must be a constant 1">;
9977def err_builtin_requires_language : Error<"'%0' is only available in %1">;
9978
9979def err_constant_integer_arg_type : Error<
9980  "argument to %0 must be a constant integer">;
9981
9982def ext_mixed_decls_code : Extension<
9983  "mixing declarations and code is a C99 extension">,
9984  InGroup<DeclarationAfterStatement>;
9985def warn_mixed_decls_code : Warning<
9986  "mixing declarations and code is incompatible with standards before C99">,
9987  InGroup<DeclarationAfterStatement>, DefaultIgnore;
9988
9989def err_non_local_variable_decl_in_for : Error<
9990  "declaration of non-local variable in 'for' loop">;
9991def err_non_variable_decl_in_for : Error<
9992  "non-variable declaration in 'for' loop">;
9993def err_toomany_element_decls : Error<
9994  "only one element declaration is allowed">;
9995def err_selector_element_not_lvalue : Error<
9996  "selector element is not a valid lvalue">;
9997def err_selector_element_type : Error<
9998  "selector element type %0 is not a valid object">;
9999def err_selector_element_const_type : Error<
10000  "selector element of type %0 cannot be a constant lvalue expression">;
10001def err_collection_expr_type : Error<
10002  "the type %0 is not a pointer to a fast-enumerable object">;
10003def warn_collection_expr_type : Warning<
10004  "collection expression type %0 may not respond to %1">;
10005
10006def err_invalid_conversion_between_ext_vectors : Error<
10007  "invalid conversion between ext-vector type %0 and %1">;
10008
10009def warn_duplicate_attribute_exact : Warning<
10010  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
10011
10012def warn_duplicate_attribute : Warning<
10013  "attribute %0 is already applied with different arguments">,
10014  InGroup<IgnoredAttributes>;
10015def err_disallowed_duplicate_attribute : Error<
10016  "attribute %0 cannot appear more than once on a declaration">;
10017
10018def warn_sync_fetch_and_nand_semantics_change : Warning<
10019  "the semantics of this intrinsic changed with GCC "
10020  "version 4.4 - the newer semantics are provided here">,
10021  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
10022
10023// Type
10024def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
10025  InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
10026def warn_receiver_forward_class : Warning<
10027  "receiver %0 is a forward class and corresponding @interface may not exist">,
10028  InGroup<ForwardClassReceiver>;
10029def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
10030def ext_missing_type_specifier : ExtWarn<
10031  "type specifier missing, defaults to 'int'; ISO C99 and later do not support "
10032  "implicit int">, InGroup<ImplicitInt>;
10033def err_missing_type_specifier : Error<
10034  "a type specifier is required for all declarations">;
10035def err_decimal_unsupported : Error<
10036  "GNU decimal type extension not supported">;
10037def err_objc_array_of_interfaces : Error<
10038  "array of interface %0 is invalid (probably should be an array of pointers)">;
10039def ext_c99_array_usage : Extension<
10040  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10041  "feature">, InGroup<C99>;
10042def err_c99_array_usage_cxx : Error<
10043  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10044  "feature, not permitted in C++">;
10045def err_type_unsupported : Error<
10046  "%0 is not supported on this target">;
10047def err_nsconsumed_attribute_mismatch : Error<
10048  "overriding method has mismatched ns_consumed attribute on its"
10049  " parameter">;
10050def err_nsreturns_retained_attribute_mismatch : Error<
10051  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
10052  " attributes">;
10053def err_nserrordomain_invalid_decl : Error<
10054  "domain argument %select{|%1 }0does not refer to global constant">;
10055def err_nserrordomain_wrong_type : Error<
10056  "domain argument %0 does not point to an NSString or CFString constant">;
10057
10058def warn_nsconsumed_attribute_mismatch : Warning<
10059  err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
10060def warn_nsreturns_retained_attribute_mismatch : Warning<
10061  err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
10062
10063def note_getter_unavailable : Note<
10064  "or because setter is declared here, but no getter method %0 is found">;
10065def err_invalid_protocol_qualifiers : Error<
10066  "invalid protocol qualifiers on non-ObjC type">;
10067def warn_ivar_use_hidden : Warning<
10068  "local declaration of %0 hides instance variable">,
10069   InGroup<ShadowIvar>;
10070def warn_direct_initialize_call : Warning<
10071  "explicit call to +initialize results in duplicate call to +initialize">,
10072   InGroup<ExplicitInitializeCall>;
10073def warn_direct_super_initialize_call : Warning<
10074  "explicit call to [super initialize] should only be in implementation "
10075  "of +initialize">,
10076   InGroup<ExplicitInitializeCall>;
10077def err_ivar_use_in_class_method : Error<
10078  "instance variable %0 accessed in class method">;
10079def err_private_ivar_access : Error<"instance variable %0 is private">,
10080  AccessControl;
10081def err_protected_ivar_access : Error<"instance variable %0 is protected">,
10082  AccessControl;
10083def warn_maynot_respond : Warning<"%0 may not respond to %1">;
10084def ext_typecheck_base_super : Warning<
10085  "method parameter type "
10086  "%diff{$ does not match super class method parameter type $|"
10087  "does not match super class method parameter type}0,1">,
10088   InGroup<SuperSubClassMismatch>, DefaultIgnore;
10089def warn_missing_method_return_type : Warning<
10090  "method has no return type specified; defaults to 'id'">,
10091  InGroup<MissingMethodReturnType>, DefaultIgnore;
10092def warn_direct_ivar_access : Warning<"instance variable %0 is being "
10093  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
10094
10095// Spell-checking diagnostics
10096def err_unknown_typename : Error<
10097  "unknown type name %0">;
10098def err_unknown_type_or_class_name_suggest : Error<
10099  "unknown %select{type|class}1 name %0; did you mean %2?">;
10100def err_unknown_typename_suggest : Error<
10101  "unknown type name %0; did you mean %1?">;
10102def err_unknown_nested_typename_suggest : Error<
10103  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
10104def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
10105def err_undeclared_use_suggest : Error<
10106  "use of undeclared %0; did you mean %1?">;
10107def err_undeclared_var_use_suggest : Error<
10108  "use of undeclared identifier %0; did you mean %1?">;
10109def err_no_template : Error<"no template named %0">;
10110def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
10111def err_no_member_template : Error<"no template named %0 in %1">;
10112def err_no_member_template_suggest : Error<
10113  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
10114def err_non_template_in_template_id : Error<
10115  "%0 does not name a template but is followed by template arguments">;
10116def err_non_template_in_template_id_suggest : Error<
10117  "%0 does not name a template but is followed by template arguments; "
10118  "did you mean %1?">;
10119def err_non_template_in_member_template_id_suggest : Error<
10120  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
10121def note_non_template_in_template_id_found : Note<
10122  "non-template declaration found by name lookup">;
10123def err_mem_init_not_member_or_class_suggest : Error<
10124  "initializer %0 does not name a non-static data member or base "
10125  "class; did you mean the %select{base class|member}1 %2?">;
10126def err_field_designator_unknown_suggest : Error<
10127  "field designator %0 does not refer to any field in type %1; did you mean "
10128  "%2?">;
10129def err_typecheck_member_reference_ivar_suggest : Error<
10130  "%0 does not have a member named %1; did you mean %2?">;
10131def err_property_not_found_suggest : Error<
10132  "property %0 not found on object of type %1; did you mean %2?">;
10133def err_class_property_found : Error<
10134  "property %0 is a class property; did you mean to access it with class '%1'?">;
10135def err_ivar_access_using_property_syntax_suggest : Error<
10136  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
10137def warn_property_access_suggest : Warning<
10138"property %0 not found on object of type %1; did you mean to access property %2?">,
10139InGroup<PropertyAccessDotSyntax>;
10140def err_property_found_suggest : Error<
10141  "property %0 found on object of type %1; did you mean to access "
10142  "it with the \".\" operator?">;
10143def err_undef_interface_suggest : Error<
10144  "cannot find interface declaration for %0; did you mean %1?">;
10145def warn_undef_interface_suggest : Warning<
10146  "cannot find interface declaration for %0; did you mean %1?">;
10147def err_undef_superclass_suggest : Error<
10148  "cannot find interface declaration for %0, superclass of %1; did you mean "
10149  "%2?">;
10150def err_undeclared_protocol_suggest : Error<
10151  "cannot find protocol declaration for %0; did you mean %1?">;
10152def note_base_class_specified_here : Note<
10153  "base class %0 specified here">;
10154def err_using_directive_suggest : Error<
10155  "no namespace named %0; did you mean %1?">;
10156def err_using_directive_member_suggest : Error<
10157  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
10158def note_namespace_defined_here : Note<"namespace %0 defined here">;
10159def err_sizeof_pack_no_pack_name_suggest : Error<
10160  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
10161def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
10162
10163def err_uncasted_use_of_unknown_any : Error<
10164  "%0 has unknown type; cast it to its declared type to use it">;
10165def err_uncasted_call_of_unknown_any : Error<
10166  "%0 has unknown return type; cast the call to its declared return type">;
10167def err_uncasted_send_to_unknown_any_method : Error<
10168  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
10169  "message send to the method's return type">;
10170def err_unsupported_unknown_any_decl : Error<
10171  "%0 has unknown type, which is not supported for this kind of declaration">;
10172def err_unsupported_unknown_any_expr : Error<
10173  "unsupported expression with unknown type">;
10174def err_unsupported_unknown_any_call : Error<
10175  "call to unsupported expression with unknown type">;
10176def err_unknown_any_addrof : Error<
10177  "the address of a declaration with unknown type "
10178  "can only be cast to a pointer type">;
10179def err_unknown_any_addrof_call : Error<
10180  "address-of operator cannot be applied to a call to a function with "
10181  "unknown return type">;
10182def err_unknown_any_var_function_type : Error<
10183  "variable %0 with unknown type cannot be given a function type">;
10184def err_unknown_any_function : Error<
10185  "function %0 with unknown type must be given a function type">;
10186
10187def err_filter_expression_integral : Error<
10188  "filter expression has non-integral type %0">;
10189
10190def err_non_asm_stmt_in_naked_function : Error<
10191  "non-ASM statement in naked function is not supported">;
10192def err_asm_naked_this_ref : Error<
10193  "'this' pointer references not allowed in naked functions">;
10194def err_asm_naked_parm_ref : Error<
10195  "parameter references not allowed in naked functions">;
10196
10197// OpenCL warnings and errors.
10198def err_invalid_astype_of_different_size : Error<
10199  "invalid reinterpretation: sizes of %0 and %1 must match">;
10200def err_static_kernel : Error<
10201  "kernel functions cannot be declared static">;
10202def err_method_kernel : Error<
10203  "kernel functions cannot be class members">;
10204def err_template_kernel : Error<
10205  "kernel functions cannot be used in a template declaration, instantiation or specialization">;
10206def err_opencl_ptrptr_kernel_param : Error<
10207  "kernel parameter cannot be declared as a pointer to a pointer">;
10208def err_kernel_arg_address_space : Error<
10209  "pointer arguments to kernel functions must reside in '__global', "
10210  "'__constant' or '__local' address space">;
10211def err_opencl_ext_vector_component_invalid_length : Error<
10212  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
10213def err_opencl_function_variable : Error<
10214  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
10215def err_opencl_addrspace_scope : Error<
10216  "variables in the %0 address space can only be declared in the outermost "
10217  "scope of a kernel function">;
10218def err_static_function_scope : Error<
10219  "variables in function scope cannot be declared static">;
10220def err_opencl_bitfields : Error<
10221  "bit-fields are not supported in OpenCL">;
10222def err_opencl_vla : Error<
10223  "variable length arrays are not supported in OpenCL">;
10224def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
10225    "scalar operand type has greater rank than the type of the vector "
10226    "element. (%0 and %1)">;
10227def err_bad_kernel_param_type : Error<
10228  "%0 cannot be used as the type of a kernel parameter">;
10229def err_record_with_pointers_kernel_param : Error<
10230  "%select{struct|union}0 kernel parameters may not contain pointers">;
10231def note_within_field_of_type : Note<
10232  "within field of type %0 declared here">;
10233def note_illegal_field_declared_here : Note<
10234  "field of illegal %select{type|pointer type}0 %1 declared here">;
10235def err_opencl_type_struct_or_union_field : Error<
10236  "the %0 type cannot be used to declare a structure or union field">;
10237def err_event_t_addr_space_qual : Error<
10238  "the event_t type can only be used with __private address space qualifier">;
10239def err_expected_kernel_void_return_type : Error<
10240  "kernel must have void return type">;
10241def err_sampler_initializer_not_integer : Error<
10242  "sampler_t initialization requires 32-bit integer, not %0">;
10243def warn_sampler_initializer_invalid_bits : Warning<
10244  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
10245def err_sampler_argument_required : Error<
10246  "sampler_t variable required - got %0">;
10247def err_wrong_sampler_addressspace: Error<
10248  "sampler type cannot be used with the __local and __global address space qualifiers">;
10249def err_opencl_nonconst_global_sampler : Error<
10250  "global sampler requires a const or constant address space qualifier">;
10251def err_opencl_cast_non_zero_to_event_t : Error<
10252  "cannot cast non-zero value '%0' to 'event_t'">;
10253def err_opencl_global_invalid_addr_space : Error<
10254  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
10255def err_missing_actual_pipe_type : Error<
10256  "missing actual type specifier for pipe">;
10257def err_reference_pipe_type : Error <
10258  "pipes packet types cannot be of reference type">;
10259def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
10260def err_opencl_kernel_attr :
10261  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
10262def err_opencl_return_value_with_address_space : Error<
10263  "return value cannot be qualified with address space">;
10264def err_opencl_constant_no_init : Error<
10265  "variable in constant address space must be initialized">;
10266def err_opencl_atomic_init: Error<
10267  "atomic variable can be %select{assigned|initialized}0 to a variable only "
10268  "in global address space">;
10269def err_opencl_implicit_vector_conversion : Error<
10270  "implicit conversions between vector types (%0 and %1) are not permitted">;
10271def err_opencl_invalid_type_array : Error<
10272  "array of %0 type is invalid in OpenCL">;
10273def err_opencl_ternary_with_block : Error<
10274  "block type cannot be used as expression in ternary expression in OpenCL">;
10275def err_opencl_pointer_to_type : Error<
10276  "pointer to type %0 is invalid in OpenCL">;
10277def err_opencl_type_can_only_be_used_as_function_parameter : Error <
10278  "type %0 can only be used as a function parameter in OpenCL">;
10279def err_opencl_type_not_found : Error<
10280  "%0 type %1 not found; include the base header with -finclude-default-header">;
10281def warn_opencl_attr_deprecated_ignored : Warning <
10282  "%0 attribute is deprecated and ignored in %1">, InGroup<IgnoredAttributes>;
10283def err_opencl_variadic_function : Error<
10284  "invalid prototype, variadic arguments are not allowed in OpenCL">;
10285def err_opencl_requires_extension : Error<
10286  "use of %select{type|declaration}0 %1 requires %2 support">;
10287def ext_opencl_double_without_pragma : Extension<
10288  "Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is"
10289  " supported">;
10290def warn_opencl_generic_address_space_arg : Warning<
10291  "passing non-generic address space pointer to %0"
10292  " may cause dynamic conversion affecting performance">,
10293  InGroup<Conversion>, DefaultIgnore;
10294
10295// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
10296def err_opencl_builtin_pipe_first_arg : Error<
10297  "first argument to %0 must be a pipe type">;
10298def err_opencl_builtin_pipe_arg_num : Error<
10299  "invalid number of arguments to function: %0">;
10300def err_opencl_builtin_pipe_invalid_arg : Error<
10301  "invalid argument type to function %0 (expecting %1 having %2)">;
10302def err_opencl_builtin_pipe_invalid_access_modifier : Error<
10303  "invalid pipe access modifier (expecting %0)">;
10304
10305// OpenCL access qualifier
10306def err_opencl_invalid_access_qualifier : Error<
10307  "access qualifier can only be used for pipe and image type">;
10308def err_opencl_invalid_read_write : Error<
10309  "access qualifier %0 can not be used for %1 %select{|prior to OpenCL C version 2.0 or in version 3.0 "
10310  "and without __opencl_c_read_write_images feature}2">;
10311def err_opencl_multiple_access_qualifiers : Error<
10312  "multiple access qualifiers">;
10313def note_opencl_typedef_access_qualifier : Note<
10314  "previously declared '%0' here">;
10315
10316// OpenCL v2.0 s6.12.5 Blocks restrictions
10317def err_opencl_block_storage_type : Error<
10318  "the __block storage type is not permitted">;
10319def err_opencl_invalid_block_declaration : Error<
10320  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
10321def err_opencl_extern_block_declaration : Error<
10322  "invalid block variable declaration - using 'extern' storage class is disallowed">;
10323def err_opencl_block_ref_block : Error<
10324  "cannot refer to a block inside block">;
10325
10326// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
10327def err_opencl_builtin_to_addr_invalid_arg : Error<
10328  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
10329
10330// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
10331def err_opencl_enqueue_kernel_incorrect_args : Error<
10332  "illegal call to enqueue_kernel, incorrect argument types">;
10333def err_opencl_enqueue_kernel_local_size_args : Error<
10334  "mismatch in number of block parameters and local size arguments passed">;
10335def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
10336  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
10337def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
10338  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
10339def err_opencl_enqueue_kernel_blocks_no_args : Error<
10340  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
10341
10342def err_opencl_builtin_expected_type : Error<
10343  "illegal call to %0, expected %1 argument type">;
10344
10345// OpenCL v3.0 s6.3.7 - Vector Components
10346def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
10347  "vector component name '%0' is a feature from OpenCL version 3.0 onwards">,
10348  InGroup<OpenCLUnsupportedRGBA>;
10349
10350def err_openclcxx_placement_new : Error<
10351  "use of placement new requires explicit declaration">;
10352
10353// MIG routine annotations.
10354def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
10355  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
10356  InGroup<IgnoredAttributes>;
10357
10358def warn_imp_cast_drops_unaligned : Warning<
10359  "implicit cast from type %0 to type %1 drops __unaligned qualifier">,
10360  InGroup<DiagGroup<"unaligned-qualifier-implicit-cast">>;
10361
10362} // end of sema category
10363
10364let CategoryName = "OpenMP Issue" in {
10365// OpenMP support.
10366def err_omp_expected_var_arg : Error<
10367  "%0 is not a global variable, static local variable or static data member">;
10368def err_omp_expected_var_arg_suggest : Error<
10369  "%0 is not a global variable, static local variable or static data member; "
10370  "did you mean %1">;
10371def err_omp_global_var_arg : Error<
10372  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
10373def err_omp_ref_type_arg : Error<
10374  "arguments of '#pragma omp %0' cannot be of reference type %1">;
10375def err_omp_region_not_file_context : Error<
10376  "directive must be at file or namespace scope">;
10377def err_omp_var_scope : Error<
10378  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
10379def err_omp_var_used : Error<
10380  "'#pragma omp %0' must precede all references to variable %q1">;
10381def err_omp_var_thread_local : Error<
10382  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
10383def err_omp_private_incomplete_type : Error<
10384  "a private variable with incomplete type %0">;
10385def err_omp_firstprivate_incomplete_type : Error<
10386  "a firstprivate variable with incomplete type %0">;
10387def err_omp_lastprivate_incomplete_type : Error<
10388  "a lastprivate variable with incomplete type %0">;
10389def err_omp_reduction_incomplete_type : Error<
10390  "a reduction list item with incomplete type %0">;
10391def err_omp_unexpected_clause_value : Error<
10392  "expected %0 in OpenMP clause '%1'">;
10393def err_omp_expected_var_name_member_expr : Error<
10394  "expected variable name%select{| or data member of current class}0">;
10395def err_omp_expected_var_name_member_expr_or_array_item : Error<
10396  "expected variable name%select{|, data member of current class}0, array element or array section">;
10397def err_omp_expected_addressable_lvalue_or_array_item : Error<
10398  "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">;
10399def err_omp_expected_named_var_member_or_array_expression: Error<
10400  "expected expression containing only member accesses and/or array sections based on named variables">;
10401def err_omp_bit_fields_forbidden_in_clause : Error<
10402  "bit fields cannot be used to specify storage in a '%0' clause">;
10403def err_array_section_does_not_specify_contiguous_storage : Error<
10404  "array section does not specify contiguous storage">;
10405def err_array_section_does_not_specify_length : Error<
10406  "array section does not specify length for outermost dimension">;
10407def err_omp_union_type_not_allowed : Error<
10408  "mapping of union members is not allowed">;
10409def err_omp_expected_access_to_data_field : Error<
10410  "expected access to data field">;
10411def err_omp_multiple_array_items_in_map_clause : Error<
10412  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
10413def err_omp_duplicate_map_type_modifier : Error<
10414  "same map type modifier has been specified more than once">;
10415def err_omp_duplicate_motion_modifier : Error<
10416  "same motion modifier has been specified more than once">;
10417def err_omp_pointer_mapped_along_with_derived_section : Error<
10418  "pointer cannot be mapped along with a section derived from itself">;
10419def err_omp_original_storage_is_shared_and_does_not_contain : Error<
10420  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
10421def err_omp_same_pointer_dereferenced : Error<
10422  "same pointer dereferenced in multiple different ways in map clause expressions">;
10423def note_omp_task_predetermined_firstprivate_here : Note<
10424  "predetermined as a firstprivate in a task construct here">;
10425def err_omp_threadprivate_incomplete_type : Error<
10426  "threadprivate variable with incomplete type %0">;
10427def err_omp_no_dsa_for_variable : Error<
10428  "variable %0 must have explicitly specified data sharing attributes">;
10429def err_omp_defaultmap_no_attr_for_variable : Error<
10430  "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
10431def note_omp_default_dsa_none : Note<
10432  "explicit data sharing attribute requested here">;
10433def note_omp_defaultmap_attr_none : Note<
10434  "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
10435def err_omp_wrong_dsa : Error<
10436  "%0 variable cannot be %1">;
10437def err_omp_variably_modified_type_not_supported : Error<
10438  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
10439def note_omp_explicit_dsa : Note<
10440  "defined as %0">;
10441def note_omp_predetermined_dsa : Note<
10442  "%select{static data member is predetermined as shared|"
10443  "variable with static storage duration is predetermined as shared|"
10444  "loop iteration variable is predetermined as private|"
10445  "loop iteration variable is predetermined as linear|"
10446  "loop iteration variable is predetermined as lastprivate|"
10447  "constant variable is predetermined as shared|"
10448  "global variable is predetermined as shared|"
10449  "non-shared variable in a task construct is predetermined as firstprivate|"
10450  "variable with automatic storage duration is predetermined as private}0"
10451  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
10452def note_omp_implicit_dsa : Note<
10453  "implicitly determined as %0">;
10454def err_omp_loop_var_dsa : Error<
10455  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
10456def err_omp_not_for : Error<
10457  "%select{statement after '#pragma omp %1' must be a for loop|"
10458  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
10459def note_omp_collapse_ordered_expr : Note<
10460  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
10461def err_omp_negative_expression_in_clause : Error<
10462  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
10463def err_omp_not_integral : Error<
10464  "expression must have integral or unscoped enumeration "
10465  "type, not %0">;
10466def err_omp_threadprivate_in_target : Error<
10467  "threadprivate variables cannot be used in target constructs">;
10468def err_omp_incomplete_type : Error<
10469  "expression has incomplete class type %0">;
10470def err_omp_explicit_conversion : Error<
10471  "expression requires explicit conversion from %0 to %1">;
10472def note_omp_conversion_here : Note<
10473  "conversion to %select{integral|enumeration}0 type %1 declared here">;
10474def err_omp_ambiguous_conversion : Error<
10475  "ambiguous conversion from type %0 to an integral or unscoped "
10476  "enumeration type">;
10477def err_omp_iterator_not_integral_or_pointer : Error<
10478  "expected integral or pointer type as the iterator-type, not %0">;
10479def err_omp_iterator_step_not_integral : Error<
10480  "iterator step expression %0 is not the integral expression">;
10481def err_omp_iterator_step_constant_zero : Error<
10482  "iterator step expression %0 evaluates to 0">;
10483def err_omp_required_access : Error<
10484  "%0 variable must be %1">;
10485def err_omp_const_variable : Error<
10486  "const-qualified variable cannot be %0">;
10487def err_omp_const_not_mutable_variable : Error<
10488  "const-qualified variable without mutable fields cannot be %0">;
10489def err_omp_const_list_item : Error<
10490  "const-qualified list item cannot be %0">;
10491def err_omp_linear_incomplete_type : Error<
10492  "a linear variable with incomplete type %0">;
10493def err_omp_linear_expected_int_or_ptr : Error<
10494  "argument of a linear clause should be of integral or pointer "
10495  "type, not %0">;
10496def warn_omp_linear_step_zero : Warning<
10497  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
10498  InGroup<OpenMPClauses>;
10499def warn_omp_alignment_not_power_of_two : Warning<
10500  "aligned clause will be ignored because the requested alignment is not a power of 2">,
10501  InGroup<OpenMPClauses>;
10502def err_omp_invalid_target_decl : Error<
10503  "%0 used in declare target directive is not a variable or a function name">;
10504def err_omp_declare_target_to_and_link : Error<
10505  "%0 must not appear in both clauses 'to' and 'link'">;
10506def warn_omp_not_in_target_context : Warning<
10507  "declaration is not declared in any declare target region">,
10508  InGroup<OpenMPTarget>;
10509def err_omp_function_in_link_clause : Error<
10510  "function name is not allowed in 'link' clause">;
10511def err_omp_aligned_expected_array_or_ptr : Error<
10512  "argument of aligned clause should be array"
10513  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
10514  ", not %0">;
10515def err_omp_used_in_clause_twice : Error<
10516  "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
10517def err_omp_local_var_in_threadprivate_init : Error<
10518  "variable with local storage in initial value of threadprivate variable">;
10519def err_omp_loop_not_canonical_init : Error<
10520  "initialization clause of OpenMP for loop is not in canonical form "
10521  "('var = init' or 'T var = init')">;
10522def ext_omp_loop_not_canonical_init : ExtWarn<
10523  "initialization clause of OpenMP for loop is not in canonical form "
10524  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
10525def err_omp_loop_not_canonical_cond : Error<
10526  "condition of OpenMP for loop must be a relational comparison "
10527  "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
10528def err_omp_loop_not_canonical_incr : Error<
10529  "increment clause of OpenMP for loop must perform simple addition "
10530  "or subtraction on loop variable %0">;
10531def err_omp_loop_variable_type : Error<
10532  "variable must be of integer or %select{pointer|random access iterator}0 type">;
10533def err_omp_loop_incr_not_compatible : Error<
10534  "increment expression must cause %0 to %select{decrease|increase}1 "
10535  "on each iteration of OpenMP for loop">;
10536def note_omp_loop_cond_requres_compatible_incr : Note<
10537  "loop step is expected to be %select{negative|positive}0 due to this condition">;
10538def err_omp_loop_diff_cxx : Error<
10539  "could not calculate number of iterations calling 'operator-' with "
10540  "upper and lower loop bounds">;
10541def err_omp_loop_cannot_use_stmt : Error<
10542  "'%0' statement cannot be used in OpenMP for loop">;
10543def err_omp_simd_region_cannot_use_stmt : Error<
10544  "'%0' statement cannot be used in OpenMP simd region">;
10545def warn_omp_loop_64_bit_var : Warning<
10546  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
10547  InGroup<OpenMPLoopForm>;
10548def err_omp_unknown_reduction_identifier : Error<
10549  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
10550  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10551def err_omp_not_resolved_reduction_identifier : Error<
10552  "unable to resolve declare reduction construct for type %0">;
10553def err_omp_reduction_ref_type_arg : Error<
10554  "argument of OpenMP clause '%0' must reference the same object in all threads">;
10555def err_omp_clause_not_arithmetic_type_arg : Error<
10556  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
10557def err_omp_clause_floating_type_arg : Error<
10558  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
10559def err_omp_once_referenced : Error<
10560  "variable can appear only once in OpenMP '%0' clause">;
10561def err_omp_once_referenced_in_target_update : Error<
10562  "variable can appear only once in OpenMP 'target update' construct">;
10563def note_omp_referenced : Note<
10564  "previously referenced here">;
10565def err_omp_reduction_in_task : Error<
10566  "reduction variables may not be accessed in an explicit task">;
10567def err_omp_reduction_id_not_compatible : Error<
10568  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
10569def err_omp_reduction_identifier_mismatch : Error<
10570  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
10571def note_omp_previous_reduction_identifier : Note<
10572  "previously marked as task_reduction with different reduction operation">;
10573def err_omp_prohibited_region : Error<
10574  "region cannot be%select{| closely}0 nested inside '%1' region"
10575  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
10576  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
10577  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
10578  "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
10579  "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
10580def err_omp_prohibited_region_simd : Error<
10581  "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
10582def err_omp_prohibited_region_atomic : Error<
10583  "OpenMP constructs may not be nested inside an atomic region">;
10584def err_omp_prohibited_region_critical_same_name : Error<
10585  "cannot nest 'critical' regions having the same name %0">;
10586def note_omp_previous_critical_region : Note<
10587  "previous 'critical' region starts here">;
10588def err_omp_several_directives_in_region : Error<
10589  "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
10590def note_omp_previous_directive : Note<
10591  "previous '%0' directive used here">;
10592def err_omp_sections_not_compound_stmt : Error<
10593  "the statement for '#pragma omp sections' must be a compound statement">;
10594def err_omp_parallel_sections_not_compound_stmt : Error<
10595  "the statement for '#pragma omp parallel sections' must be a compound statement">;
10596def err_omp_orphaned_section_directive : Error<
10597  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
10598  " must be closely nested to a sections region%select{|, not a %1 region}0">;
10599def err_omp_sections_substmt_not_section : Error<
10600  "statement in 'omp sections' directive must be enclosed into a section region">;
10601def err_omp_parallel_sections_substmt_not_section : Error<
10602  "statement in 'omp parallel sections' directive must be enclosed into a section region">;
10603def err_omp_parallel_reduction_in_task_firstprivate : Error<
10604  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
10605def err_omp_atomic_read_not_expression_statement : Error<
10606  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
10607  " where v and x are both lvalue expressions with scalar type">;
10608def note_omp_atomic_read_write: Note<
10609  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
10610def err_omp_atomic_write_not_expression_statement : Error<
10611  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
10612  " where x is a lvalue expression with scalar type">;
10613def err_omp_atomic_update_not_expression_statement : Error<
10614  "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',"
10615  " where x is an lvalue expression with scalar type">;
10616def err_omp_atomic_not_expression_statement : Error<
10617  "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',"
10618  " where x is an lvalue expression with scalar type">;
10619def note_omp_atomic_update: Note<
10620  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
10621  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
10622  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
10623def err_omp_atomic_capture_not_expression_statement : Error<
10624  "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',"
10625  " where x and v are both lvalue expressions with scalar type">;
10626def err_omp_atomic_capture_not_compound_statement : Error<
10627  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
10628  " '{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;}',"
10629  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
10630  " where x is an lvalue expression with scalar type">;
10631def note_omp_atomic_capture: Note<
10632  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
10633def err_omp_atomic_compare : Error<
10634  "the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}',"
10635  " '{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;}',"
10636  " 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type,"
10637  " and 'ordop' is one of '<' or '>'.">;
10638def err_omp_atomic_compare_capture : Error<
10639  "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;}}',"
10640  " '{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;}',"
10641  " '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,"
10642  " and 'ordop' is one of '<' or '>'.">;
10643def note_omp_atomic_compare: Note<
10644  "%select{expected compound statement|expected exactly one expression statement|expected assignment statement|expected conditional operator|expect result value to be at false expression|"
10645  "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'|"
10646  "expect lvalue for result value|expect scalar value|expect integer value|unexpected 'else' statement|expect '==' operator|expect an assignment statement 'v = x'|"
10647  "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">;
10648def err_omp_atomic_several_clauses : Error<
10649  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
10650def err_omp_several_mem_order_clauses : Error<
10651  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
10652def err_omp_atomic_incompatible_mem_order_clause : Error<
10653  "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
10654def note_omp_previous_mem_order_clause : Note<
10655  "'%0' clause used here">;
10656def err_omp_target_contains_not_only_teams : Error<
10657  "target construct with nested teams region contains statements outside of the teams construct">;
10658def note_omp_nested_teams_construct_here : Note<
10659  "nested teams construct here">;
10660def note_omp_nested_statement_here : Note<
10661  "%select{statement|directive}0 outside teams construct here">;
10662def err_omp_single_copyprivate_with_nowait : Error<
10663  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
10664def note_omp_nowait_clause_here : Note<
10665  "'nowait' clause is here">;
10666def err_omp_single_decl_in_declare_simd_variant : Error<
10667  "single declaration is expected after 'declare %select{simd|variant}0' directive">;
10668def err_omp_function_expected : Error<
10669  "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
10670def err_omp_wrong_cancel_region : Error<
10671  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
10672def err_omp_parent_cancel_region_nowait : Error<
10673  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
10674def err_omp_parent_cancel_region_ordered : Error<
10675  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
10676def 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">;
10677def 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">;
10678def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
10679def err_omp_mapper_wrong_type : Error<
10680  "mapper type must be of struct, union or class type">;
10681def err_omp_declare_mapper_wrong_var : Error<
10682  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
10683def err_omp_declare_mapper_redefinition : Error<
10684  "redefinition of user-defined mapper for type %0 with name %1">;
10685def err_omp_invalid_mapper: Error<
10686  "cannot find a valid user-defined mapper for type %0 with name %1">;
10687def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
10688def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
10689def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
10690def err_omp_typecheck_section_value : Error<
10691  "subscripted value is not an array or pointer">;
10692def err_omp_typecheck_section_not_integer : Error<
10693  "array section %select{lower bound|length}0 is not an integer">;
10694def err_omp_typecheck_shaping_not_integer : Error<
10695  "array shaping operation dimension is not an integer">;
10696def err_omp_shaping_dimension_not_positive : Error<
10697  "array shaping dimension is evaluated to a non-positive value %0">;
10698def err_omp_section_function_type : Error<
10699  "section of pointer to function type %0">;
10700def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
10701  InGroup<CharSubscript>, DefaultIgnore;
10702def err_omp_section_incomplete_type : Error<
10703  "section of pointer to incomplete type %0">;
10704def err_omp_section_not_subset_of_array : Error<
10705  "array section must be a subset of the original array">;
10706def err_omp_section_length_negative : Error<
10707  "section length is evaluated to a negative value %0">;
10708def err_omp_section_stride_non_positive : Error<
10709  "section stride is evaluated to a non-positive value %0">;
10710def err_omp_section_length_undefined : Error<
10711  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
10712def err_omp_wrong_linear_modifier : Error<
10713  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
10714def err_omp_wrong_linear_modifier_non_reference : Error<
10715  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
10716def err_omp_wrong_simdlen_safelen_values : Error<
10717  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
10718def err_omp_wrong_if_directive_name_modifier : Error<
10719  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
10720def err_omp_no_more_if_clause : Error<
10721  "no more 'if' clause is allowed">;
10722def err_omp_unnamed_if_clause : Error<
10723  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
10724def note_omp_previous_named_if_clause : Note<
10725  "previous clause with directive name modifier specified here">;
10726def err_omp_ordered_directive_with_param : Error<
10727  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
10728def err_omp_ordered_directive_without_param : Error<
10729  "'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter">;
10730def note_omp_ordered_param : Note<
10731  "'ordered' clause%select{| with specified parameter}0">;
10732def err_omp_expected_base_var_name : Error<
10733  "expected variable name as a base of the array %select{subscript|section}0">;
10734def err_omp_map_shared_storage : Error<
10735  "variable already marked as mapped in current construct">;
10736def err_omp_invalid_map_type_for_directive : Error<
10737  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
10738def err_omp_invalid_map_type_modifier_for_directive : Error<
10739  "map type modifier '%0' is not allowed for '#pragma omp %1'">;
10740def err_omp_no_clause_for_directive : Error<
10741  "expected at least one %0 clause for '#pragma omp %1'">;
10742def err_omp_threadprivate_in_clause : Error<
10743  "threadprivate variables are not allowed in '%0' clause">;
10744def err_omp_wrong_ordered_loop_count : Error<
10745  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
10746def note_collapse_loop_count : Note<
10747  "parameter of the 'collapse' clause">;
10748def err_omp_clauses_mutually_exclusive : Error<
10749  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
10750def note_omp_previous_clause : Note<
10751  "'%0' clause is specified here">;
10752def err_omp_hint_clause_no_name : Error<
10753  "the name of the construct must be specified in presence of 'hint' clause">;
10754def err_omp_critical_with_hint : Error<
10755  "constructs with the same name must have a 'hint' clause with the same value">;
10756def note_omp_critical_hint_here : Note<
10757  "%select{|previous }0'hint' clause with value '%1'">;
10758def note_omp_critical_no_hint : Note<
10759  "%select{|previous }0directive with no 'hint' clause specified">;
10760def err_omp_depend_clause_thread_simd : Error<
10761  "'depend' clauses cannot be mixed with '%0' clause">;
10762def err_omp_depend_sink_expected_loop_iteration : Error<
10763  "expected%select{| %1}0 loop iteration variable">;
10764def err_omp_depend_sink_unexpected_expr : Error<
10765  "unexpected expression: number of expressions is larger than the number of associated loops">;
10766def err_omp_depend_sink_expected_plus_minus : Error<
10767  "expected '+' or '-' operation">;
10768def err_omp_taskwait_depend_mutexinoutset_not_allowed : Error<
10769  "'mutexinoutset' modifier not allowed in 'depend' clause on 'taskwait' directive">;
10770def err_omp_depend_sink_source_not_allowed : Error<
10771  "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
10772def err_omp_depend_zero_length_array_section_not_allowed : Error<
10773  "zero-length array section is not allowed in 'depend' clause">;
10774def err_omp_depend_sink_source_with_modifier : Error<
10775  "depend modifier cannot be used with 'sink' or 'source' depend type">;
10776def err_omp_depend_modifier_not_iterator : Error<
10777  "expected iterator specification as depend modifier">;
10778def err_omp_linear_ordered : Error<
10779  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
10780def err_omp_unexpected_schedule_modifier : Error<
10781  "modifier '%0' cannot be used along with modifier '%1'">;
10782def err_omp_schedule_nonmonotonic_static : Error<
10783  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
10784def err_omp_simple_clause_incompatible_with_ordered : Error<
10785  "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
10786def err_omp_ordered_simd : Error<
10787  "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
10788def err_omp_variable_in_given_clause_and_dsa : Error<
10789  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
10790def err_omp_param_or_this_in_clause : Error<
10791  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
10792def err_omp_expected_uniform_param : Error<
10793  "expected a reference to a parameter specified in a 'uniform' clause">;
10794def err_omp_expected_int_param : Error<
10795  "expected a reference to an integer-typed parameter">;
10796def err_omp_at_least_one_motion_clause_required : Error<
10797  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
10798def err_omp_cannot_update_with_internal_linkage : Error<
10799  "the host cannot update a declare target variable that is not externally visible.">;
10800def err_omp_usedeviceptr_not_a_pointer : Error<
10801  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
10802def err_omp_argument_type_isdeviceptr : Error <
10803  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
10804def warn_omp_nesting_simd : Warning<
10805  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
10806  InGroup<SourceUsesOpenMP>;
10807def err_omp_orphaned_device_directive : Error<
10808  "orphaned 'omp %0' directives are prohibited"
10809  "; perhaps you forget to enclose the directive into a "
10810  "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
10811def err_omp_reduction_non_addressable_expression : Error<
10812  "expected addressable reduction item for the task-based directives">;
10813def err_omp_reduction_with_nogroup : Error<
10814  "'reduction' clause cannot be used with 'nogroup' clause">;
10815def err_omp_reduction_vla_unsupported : Error<
10816  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
10817def err_omp_linear_distribute_var_non_loop_iteration : Error<
10818  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
10819def warn_omp_non_trivial_type_mapped : Warning<
10820  "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
10821  InGroup<OpenMPMapping>;
10822def err_omp_requires_clause_redeclaration : Error <
10823  "Only one %0 clause can appear on a requires directive in a single translation unit">;
10824def note_omp_requires_previous_clause : Note <
10825  "%0 clause previously used here">;
10826def err_omp_directive_before_requires : Error <
10827  "'%0' region encountered before requires directive with '%1' clause">;
10828def note_omp_requires_encountered_directive : Note <
10829  "'%0' previously encountered here">;
10830def err_omp_device_ancestor_without_requires_reverse_offload : Error <
10831  "Device clause with ancestor device-modifier used without specifying 'requires reverse_offload'">;
10832def err_omp_invalid_scope : Error <
10833  "'#pragma omp %0' directive must appear only in file scope">;
10834def note_omp_invalid_length_on_this_ptr_mapping : Note <
10835  "expected length on mapping of 'this' array section expression to be '1'">;
10836def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
10837  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
10838def note_omp_invalid_subscript_on_this_ptr_map : Note <
10839  "expected 'this' subscript expression on map clause to be 'this[0]'">;
10840def err_omp_invalid_map_this_expr : Error <
10841  "invalid 'this' expression on 'map' clause">;
10842def err_omp_implied_type_not_found : Error<
10843  "'%0' type not found; include <omp.h>">;
10844def err_omp_expected_omp_depend_t_lvalue : Error<
10845  "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
10846def err_omp_depobj_expected : Error<
10847  "expected depobj expression">;
10848def err_omp_depobj_single_clause_expected : Error<
10849  "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
10850def err_omp_scan_single_clause_expected : Error<
10851  "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
10852def err_omp_inclusive_exclusive_not_reduction : Error<
10853  "the list item must appear in 'reduction' clause with the 'inscan' modifier "
10854  "of the parent directive">;
10855def err_omp_reduction_not_inclusive_exclusive : Error<
10856  "the inscan reduction list item must appear as a list item in an 'inclusive' or"
10857  " 'exclusive' clause on an inner 'omp scan' directive">;
10858def err_omp_wrong_inscan_reduction : Error<
10859  "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
10860  " 'omp parallel for', or 'omp parallel for simd' directive">;
10861def err_omp_inscan_reduction_expected : Error<
10862  "expected 'reduction' clause with the 'inscan' modifier">;
10863def note_omp_previous_inscan_reduction : Note<
10864  "'reduction' clause with 'inscan' modifier is used here">;
10865def err_omp_expected_predefined_allocator : Error<
10866  "expected one of the predefined allocators for the variables with the static "
10867  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
10868  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
10869  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
10870def warn_omp_used_different_allocator : Warning<
10871  "allocate directive specifies %select{default|'%1'}0 allocator while "
10872  "previously used %select{default|'%3'}2">,
10873  InGroup<OpenMPClauses>;
10874def note_omp_previous_allocator : Note<
10875  "previous allocator is specified here">;
10876def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
10877  "inside of the target region; provide an 'allocator' clause or use 'requires'"
10878  " directive with the 'dynamic_allocators' clause">;
10879def err_expected_allocator_expression : Error<"expected an allocator expression "
10880  "inside of the target region; provide an allocator expression or use 'requires'"
10881  " directive with the 'dynamic_allocators' clause">;
10882def warn_omp_allocate_thread_on_task_target_directive : Warning<
10883  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
10884  InGroup<OpenMPClauses>;
10885def err_omp_expected_private_copy_for_allocate : Error<
10886  "the referenced item is not found in any private clause on the same directive">;
10887def err_omp_stmt_depends_on_loop_counter : Error<
10888  "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
10889def err_omp_invariant_dependency : Error<
10890  "expected loop invariant expression">;
10891def err_omp_invariant_or_linear_dependency : Error<
10892  "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
10893def err_omp_wrong_dependency_iterator_type : Error<
10894  "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
10895def err_target_unsupported_type
10896    : Error<"%0 requires %select{|%2 bit size}1 %3 %select{|return }4type support,"
10897            " but target '%5' does not support it">;
10898def err_omp_lambda_capture_in_declare_target_not_to : Error<
10899  "variable captured in declare target region must appear in a to clause">;
10900def err_omp_device_type_mismatch : Error<
10901  "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
10902def err_omp_wrong_device_function_call : Error<
10903  "function with 'device_type(%0)' is not available on %select{device|host}1">;
10904def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
10905def warn_omp_declare_target_after_first_use : Warning<
10906  "declaration marked as declare target after first use, it may lead to incorrect results">,
10907  InGroup<OpenMPTarget>;
10908def err_omp_declare_variant_incompat_attributes : Error<
10909  "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
10910def warn_omp_declare_variant_score_not_constant
10911    : Warning<"score expressions in the OpenMP context selector need to be "
10912              "constant; %0 is not and will be ignored">,
10913      InGroup<SourceUsesOpenMP>;
10914def err_omp_declare_variant_user_condition_not_constant
10915    : Error<"the user condition in the OpenMP context selector needs to be "
10916            "constant; %0 is not">;
10917def warn_omp_declare_variant_after_used : Warning<
10918  "'#pragma omp declare variant' cannot be applied for function after first "
10919  "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
10920def warn_omp_declare_variant_after_emitted : Warning<
10921  "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
10922  " the original function might be used">, InGroup<SourceUsesOpenMP>;
10923def err_omp_declare_variant_doesnt_support : Error<
10924  "'#pragma omp declare variant' does not "
10925  "support %select{function templates|virtual functions|"
10926  "deduced return types|constructors|destructors|deleted functions|"
10927  "defaulted functions|constexpr functions|consteval function}0">;
10928def err_omp_declare_variant_diff : Error<
10929  "function with '#pragma omp declare variant' has a different %select{calling convention"
10930  "|return type|constexpr specification|inline specification|storage class|"
10931  "linkage}0">;
10932def err_omp_declare_variant_prototype_required : Error<
10933  "function with '#pragma omp declare variant' must have a prototype when "
10934  "'append_args' is used">;
10935def err_omp_interop_type_not_found : Error<
10936  "'omp_interop_t' must be defined when 'append_args' clause is used; include <omp.h>">;
10937def err_omp_declare_variant_incompat_types : Error<
10938  "variant in '#pragma omp declare variant' with type %0 is incompatible with"
10939  " type %1%select{| with appended arguments}2">;
10940def err_omp_declare_variant_same_base_function : Error<
10941  "variant in '#pragma omp declare variant' is the same as the base function">;
10942def warn_omp_declare_variant_marked_as_declare_variant : Warning<
10943  "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
10944  >, InGroup<SourceUsesOpenMP>;
10945def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
10946def err_omp_one_defaultmap_each_category: Error<
10947  "at most one defaultmap clause for each variable-category can appear on the directive">;
10948def err_omp_lastprivate_conditional_non_scalar : Error<
10949  "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
10950  >;
10951def err_omp_flush_order_clause_and_list : Error<
10952  "'flush' directive with memory order clause '%0' cannot have the list">;
10953def note_omp_flush_order_clause_here : Note<
10954  "memory order clause '%0' is specified here">;
10955def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
10956  "expected addressable lvalue in '%0' clause">;
10957def err_omp_var_expected : Error<
10958  "expected variable of the '%0' type%select{|, not %2}1">;
10959def err_omp_non_pointer_type_array_shaping_base : Error<
10960  "expected expression with a pointer to a complete type as a base of an array "
10961  "shaping operation">;
10962def err_omp_reduction_task_not_parallel_or_worksharing : Error<
10963  "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
10964  " worksharing constructs">;
10965def err_omp_expected_array_alloctraits : Error<
10966  "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
10967def err_omp_predefined_allocator_with_traits : Error<
10968  "predefined allocator cannot have traits specified">;
10969def note_omp_predefined_allocator : Note<
10970  "predefined trait '%0' used here">;
10971def err_omp_nonpredefined_allocator_without_traits : Error<
10972  "non-predefined allocator must have traits specified">;
10973def err_omp_allocator_used_in_clauses : Error<
10974  "allocators used in 'uses_allocators' clause cannot appear in other "
10975  "data-sharing or data-mapping attribute clauses">;
10976def err_omp_allocator_not_in_uses_allocators : Error<
10977  "allocator must be specified in the 'uses_allocators' clause">;
10978def note_omp_protected_structured_block
10979    : Note<"jump bypasses OpenMP structured block">;
10980def note_omp_exits_structured_block
10981    : Note<"jump exits scope of OpenMP structured block">;
10982def err_omp_lastprivate_loop_var_non_loop_iteration : Error<
10983  "only loop iteration variables are allowed in 'lastprivate' clause in "
10984  "'omp %0' directives">;
10985def err_omp_interop_variable_expected : Error<
10986  "expected%select{| non-const}0 variable of type 'omp_interop_t'">;
10987def err_omp_interop_variable_wrong_type : Error<
10988  "interop variable must be of type 'omp_interop_t'">;
10989def err_omp_interop_prefer_type : Error<
10990  "prefer_list item must be a string literal or constant integral "
10991  "expression">;
10992def err_omp_interop_bad_depend_clause : Error<
10993  "'depend' clause requires the 'targetsync' interop type">;
10994def err_omp_interop_var_multiple_actions : Error<
10995  "interop variable %0 used in multiple action clauses">;
10996def err_omp_dispatch_statement_call
10997    : Error<"statement after '#pragma omp dispatch' must be a direct call"
10998            " to a target function or an assignment to one">;
10999def err_omp_unroll_full_variable_trip_count : Error<
11000  "loop to be fully unrolled must have a constant trip count">;
11001def note_omp_directive_here : Note<"'%0' directive found here">;
11002def err_omp_instantiation_not_supported
11003    : Error<"instantiation of '%0' not supported yet">;
11004def err_omp_adjust_arg_multiple_clauses : Error<
11005  "'adjust_arg' argument %0 used in multiple clauses">;
11006def err_omp_clause_requires_dispatch_construct : Error<
11007  "'%0' clause requires 'dispatch' context selector">;
11008def err_omp_append_args_with_varargs : Error<
11009  "'append_args' is not allowed with varargs functions">;
11010def err_openmp_vla_in_task_untied : Error<
11011  "variable length arrays are not supported in OpenMP tasking regions with 'untied' clause">;
11012def warn_omp_unterminated_declare_target : Warning<
11013  "expected '#pragma omp end declare target' at end of file to match '#pragma omp %0'">,
11014  InGroup<SourceUsesOpenMP>;
11015} // end of OpenMP category
11016
11017let CategoryName = "Related Result Type Issue" in {
11018// Objective-C related result type compatibility
11019def warn_related_result_type_compatibility_class : Warning<
11020  "method is expected to return an instance of its class type "
11021  "%diff{$, but is declared to return $|"
11022  ", but is declared to return different type}0,1">;
11023def warn_related_result_type_compatibility_protocol : Warning<
11024  "protocol method is expected to return an instance of the implementing "
11025  "class, but is declared to return %0">;
11026def note_related_result_type_family : Note<
11027  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
11028  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
11029  "self}1' method family%select{| and is expected to return an instance of its "
11030  "class type}0">;
11031def note_related_result_type_overridden : Note<
11032  "overridden method returns an instance of its class type">;
11033def note_related_result_type_inferred : Note<
11034  "%select{class|instance}0 method %1 is assumed to return an instance of "
11035  "its receiver type (%2)">;
11036def note_related_result_type_explicit : Note<
11037  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
11038  "%select{| and is expected to return an instance of its class type}0">;
11039def err_invalid_type_for_program_scope_var : Error<
11040  "the %0 type cannot be used to declare a program scope variable">;
11041
11042}
11043
11044let CategoryName = "Modules Issue" in {
11045def err_module_decl_in_module_map_module : Error<
11046  "'module' declaration found while building module from module map">;
11047def err_module_decl_in_header_module : Error<
11048  "'module' declaration found while building header unit">;
11049def err_module_interface_implementation_mismatch : Error<
11050  "missing 'export' specifier in module declaration while "
11051  "building module interface">;
11052def err_current_module_name_mismatch : Error<
11053  "module name '%0' specified on command line does not match name of module">;
11054def err_module_redefinition : Error<
11055  "redefinition of module '%0'">;
11056def note_prev_module_definition : Note<"previously defined here">;
11057def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
11058def err_module_not_defined : Error<
11059  "definition of module '%0' is not available; use -fmodule-file= to specify "
11060  "path to precompiled module interface">;
11061def err_module_redeclaration : Error<
11062  "translation unit contains multiple module declarations">;
11063def note_prev_module_declaration : Note<"previous module declaration is here">;
11064def err_module_declaration_missing : Error<
11065  "missing 'export module' declaration in module interface unit">;
11066def err_module_declaration_missing_after_global_module_introducer : Error<
11067  "missing 'module' declaration at end of global module fragment "
11068  "introduced here">;
11069def err_module_private_specialization : Error<
11070  "%select{template|partial|member}0 specialization cannot be "
11071  "declared __module_private__">;
11072def err_module_private_local : Error<
11073  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
11074  "__module_private__">;
11075def err_module_private_local_class : Error<
11076  "local %select{struct|interface|union|class|enum}0 cannot be declared "
11077  "__module_private__">;
11078def err_module_unimported_use : Error<
11079  "%select{declaration|definition|default argument|"
11080  "explicit specialization|partial specialization}0 of %1 must be imported "
11081  "from module '%2' before it is required">;
11082def err_module_unimported_use_header : Error<
11083  "%select{missing '#include'|missing '#include %3'}2; "
11084  "%select{||default argument of |explicit specialization of |"
11085  "partial specialization of }0%1 must be "
11086  "%select{declared|defined|defined|declared|declared}0 "
11087  "before it is used">;
11088def err_module_unimported_use_multiple : Error<
11089  "%select{declaration|definition|default argument|"
11090  "explicit specialization|partial specialization}0 of %1 must be imported "
11091  "from one of the following modules before it is required:%2">;
11092def note_unreachable_entity : Note<
11093  "%select{declaration|definition|default argument declared|"
11094  "explicit specialization declared|partial specialization declared}0 here "
11095  "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
11096def ext_module_import_in_extern_c : ExtWarn<
11097  "import of C++ module '%0' appears within extern \"C\" language linkage "
11098  "specification">, DefaultError,
11099  InGroup<DiagGroup<"module-import-in-extern-c">>;
11100def err_module_import_not_at_top_level_fatal : Error<
11101  "import of module '%0' appears within %1">, DefaultFatal;
11102def ext_module_import_not_at_top_level_noop : ExtWarn<
11103  "redundant #include of module '%0' appears within %1">, DefaultError,
11104  InGroup<DiagGroup<"modules-import-nested-redundant">>;
11105def note_module_import_not_at_top_level : Note<"%0 begins here">;
11106def err_module_self_import : Error<
11107  "import of module '%0' appears within same top-level module '%1'">;
11108def err_module_self_import_cxx20 : Error<
11109  "import of module '%0' appears within its own %select{interface|implementation}1">;
11110def err_module_import_in_implementation : Error<
11111  "@import of module '%0' in implementation of '%1'; use #import">;
11112
11113// C++ Modules
11114def err_module_decl_not_at_start : Error<
11115  "module declaration must occur at the start of the translation unit">;
11116def note_global_module_introducer_missing : Note<
11117  "add 'module;' to the start of the file to introduce a "
11118  "global module fragment">;
11119def err_export_within_anonymous_namespace : Error<
11120  "export declaration appears within anonymous namespace">;
11121def note_anonymous_namespace : Note<"anonymous namespace begins here">;
11122def ext_export_no_name_block : ExtWarn<
11123  "ISO C++20 does not permit %select{an empty|a static_assert}0 declaration "
11124  "to appear in an export block">, InGroup<ExportUnnamed>;
11125def ext_export_no_names : ExtWarn<
11126  "ISO C++20 does not permit a declaration that does not introduce any names "
11127  "to be exported">, InGroup<ExportUnnamed>;
11128def introduces_no_names : Error<
11129  "declaration does not introduce any names to be exported">;
11130def note_export : Note<"export block begins here">;
11131def err_export_no_name : Error<
11132  "%select{empty|static_assert|asm}0 declaration cannot be exported">;
11133def ext_export_using_directive : ExtWarn<
11134  "ISO C++20 does not permit using directive to be exported">,
11135  InGroup<DiagGroup<"export-using-directive">>;
11136def err_export_within_export : Error<
11137  "export declaration appears within another export declaration">;
11138def err_export_internal : Error<
11139  "declaration of %0 with internal linkage cannot be exported">;
11140def err_export_using_internal : Error<
11141  "using declaration referring to %1 with %select{internal|module|unknown}0 "
11142  "linkage cannot be exported">;
11143def err_export_not_in_module_interface : Error<
11144  "export declaration can only be used within a module interface unit"
11145  "%select{ after the module declaration|}0">;
11146def err_export_partition_impl : Error<
11147  "module partition implementations cannot be exported">;
11148def err_export_in_private_module_fragment : Error<
11149  "export declaration cannot be used in a private module fragment">;
11150def note_private_module_fragment : Note<
11151  "private module fragment begins here">;
11152def err_private_module_fragment_not_module : Error<
11153  "private module fragment declaration with no preceding module declaration">;
11154def err_private_module_fragment_redefined : Error<
11155  "private module fragment redefined">;
11156def err_private_module_fragment_not_module_interface : Error<
11157  "private module fragment in module implementation unit">;
11158def note_not_module_interface_add_export : Note<
11159  "add 'export' here if this is intended to be a module interface unit">;
11160
11161def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
11162  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
11163  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
11164def note_equivalent_internal_linkage_decl : Note<
11165  "declared here%select{ in module '%1'|}0">;
11166
11167def note_redefinition_modules_same_file : Note<
11168  "'%0' included multiple times, additional include site in header from module '%1'">;
11169def note_redefinition_include_same_file : Note<
11170  "'%0' included multiple times, additional include site here">;
11171}
11172
11173let CategoryName = "Coroutines Issue" in {
11174def err_return_in_coroutine : Error<
11175  "return statement not allowed in coroutine; did you mean 'co_return'?">;
11176def note_declared_coroutine_here : Note<
11177  "function is a coroutine due to use of '%0' here">;
11178def err_coroutine_objc_method : Error<
11179  "Objective-C methods as coroutines are not yet supported">;
11180def err_coroutine_unevaluated_context : Error<
11181  "'%0' cannot be used in an unevaluated context">;
11182def err_coroutine_within_handler : Error<
11183  "'%0' cannot be used in the handler of a try block">;
11184def err_coroutine_outside_function : Error<
11185  "'%0' cannot be used outside a function">;
11186def err_coroutine_invalid_func_context : Error<
11187  "'%1' cannot be used in %select{a constructor|a destructor"
11188  "|the 'main' function|a constexpr function"
11189  "|a function with a deduced return type|a varargs function"
11190  "|a consteval function}0">;
11191def err_implied_coroutine_type_not_found : Error<
11192  "%0 type was not found; include <coroutine> before defining "
11193  "a coroutine; include <experimental/coroutine> if your version "
11194  "of libcxx is less than 14.0">;
11195def warn_deprecated_coroutine_namespace : Warning<
11196  "support for std::experimental::%0 will be removed in LLVM 15; "
11197  "use std::%0 instead">,
11198  InGroup<DeprecatedExperimentalCoroutine>;
11199def err_mixed_use_std_and_experimental_namespace_for_coroutine : Error<
11200  "conflicting mixed use of std and std::experimental namespaces for "
11201  "coroutine components">;
11202def err_implicit_coroutine_std_nothrow_type_not_found : Error<
11203  "std::nothrow was not found; include <new> before defining a coroutine which "
11204  "uses get_return_object_on_allocation_failure()">;
11205def err_malformed_std_nothrow : Error<
11206  "std::nothrow must be a valid variable declaration">;
11207def err_malformed_std_coroutine_handle : Error<
11208  "std::coroutine_handle isn't a class template">;
11209def err_coroutine_handle_missing_member : Error<
11210  "std::coroutine_handle must have a member named '%0'">;
11211def err_malformed_std_coroutine_traits : Error<
11212  "std::coroutine_traits isn't a class template">;
11213def err_implied_std_coroutine_traits_promise_type_not_found : Error<
11214  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
11215def err_implied_std_coroutine_traits_promise_type_not_class : Error<
11216  "this function cannot be a coroutine: %0 is not a class">;
11217def err_coroutine_promise_type_incomplete : Error<
11218  "this function cannot be a coroutine: %0 is an incomplete type">;
11219def err_coroutine_type_missing_specialization : Error<
11220  "this function cannot be a coroutine: missing definition of "
11221  "specialization %0">;
11222def err_coroutine_promise_incompatible_return_functions : Error<
11223  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
11224def note_coroutine_promise_implicit_await_transform_required_here : Note<
11225  "call to 'await_transform' implicitly required by 'co_await' here">;
11226def note_coroutine_promise_suspend_implicitly_required : Note<
11227  "call to '%select{initial_suspend|final_suspend}0' implicitly "
11228  "required by the %select{initial suspend point|final suspend point}0">;
11229def err_coroutine_promise_unhandled_exception_required : Error<
11230  "%0 is required to declare the member 'unhandled_exception()'">;
11231def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
11232  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
11233  InGroup<CoroutineMissingUnhandledException>;
11234def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
11235  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
11236def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
11237  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
11238def err_coroutine_promise_new_requires_nothrow : Error<
11239  "%0 is required to have a non-throwing noexcept specification when the promise "
11240   "type declares 'get_return_object_on_allocation_failure()'">;
11241def note_coroutine_promise_call_implicitly_required : Note<
11242  "call to %0 implicitly required by coroutine function here">;
11243def err_await_suspend_invalid_return_type : Error<
11244  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
11245>;
11246def note_await_ready_no_bool_conversion : Note<
11247  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
11248>;
11249def warn_coroutine_handle_address_invalid_return_type : Warning <
11250  "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">,
11251  InGroup<Coroutine>;
11252def err_coroutine_promise_final_suspend_requires_nothrow : Error<
11253  "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
11254>;
11255def note_coroutine_function_declare_noexcept : Note<
11256  "must be declared with 'noexcept'"
11257>;
11258def warn_always_inline_coroutine : Warning<
11259  "this coroutine may be split into pieces; not every piece is guaranteed to be inlined"
11260  >,
11261  InGroup<AlwaysInlineCoroutine>;
11262def err_coroutine_unusable_new : Error<
11263  "'operator new' provided by %0 is not usable with the function signature of %1"
11264>;
11265} // end of coroutines issue category
11266
11267let CategoryName = "Documentation Issue" in {
11268def warn_not_a_doxygen_trailing_member_comment : Warning<
11269  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
11270} // end of documentation issue category
11271
11272let CategoryName = "Nullability Issue" in {
11273
11274def warn_mismatched_nullability_attr : Warning<
11275  "nullability specifier %0 conflicts with existing specifier %1">,
11276  InGroup<Nullability>;
11277
11278def warn_nullability_declspec : Warning<
11279  "nullability specifier %0 cannot be applied "
11280  "to non-pointer type %1; did you mean to apply the specifier to the "
11281  "%select{pointer|block pointer|member pointer|function pointer|"
11282  "member function pointer}2?">,
11283  InGroup<NullabilityDeclSpec>,
11284  DefaultError;
11285
11286def note_nullability_here : Note<"%0 specified here">;
11287
11288def err_nullability_nonpointer : Error<
11289  "nullability specifier %0 cannot be applied to non-pointer type %1">;
11290
11291def warn_nullability_lost : Warning<
11292  "implicit conversion from nullable pointer %0 to non-nullable pointer "
11293  "type %1">,
11294  InGroup<NullableToNonNullConversion>, DefaultIgnore;
11295def warn_zero_as_null_pointer_constant : Warning<
11296  "zero as null pointer constant">,
11297  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
11298
11299def err_nullability_cs_multilevel : Error<
11300  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
11301def note_nullability_type_specifier : Note<
11302  "use nullability type specifier %0 to affect the innermost "
11303  "pointer type of %1">;
11304
11305def warn_null_resettable_setter : Warning<
11306  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
11307  InGroup<Nullability>;
11308
11309def warn_nullability_missing : Warning<
11310  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
11311  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
11312  InGroup<NullabilityCompleteness>;
11313def warn_nullability_missing_array : Warning<
11314  "array parameter is missing a nullability type specifier (_Nonnull, "
11315  "_Nullable, or _Null_unspecified)">,
11316  InGroup<NullabilityCompletenessOnArrays>;
11317def note_nullability_fix_it : Note<
11318  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
11319  "%select{pointer|block pointer|member pointer|array parameter}1 "
11320  "%select{should never be null|may be null|should not declare nullability}0">;
11321
11322def warn_nullability_inferred_on_nested_type : Warning<
11323  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
11324  "deprecated">,
11325  InGroup<NullabilityInferredOnNestedType>;
11326
11327def err_objc_type_arg_explicit_nullability : Error<
11328  "type argument %0 cannot explicitly specify nullability">;
11329
11330def err_objc_type_param_bound_explicit_nullability : Error<
11331  "type parameter %0 bound %1 cannot explicitly specify nullability">;
11332
11333}
11334
11335let CategoryName = "Generics Issue" in {
11336
11337def err_objc_type_param_bound_nonobject : Error<
11338  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
11339
11340def err_objc_type_param_bound_missing_pointer : Error<
11341  "missing '*' in type bound %0 for type parameter %1">;
11342def err_objc_type_param_bound_qualified : Error<
11343  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
11344
11345def err_objc_type_param_redecl : Error<
11346  "redeclaration of type parameter %0">;
11347
11348def err_objc_type_param_arity_mismatch : Error<
11349  "%select{forward class declaration|class definition|category|extension}0 has "
11350  "too %select{few|many}1 type parameters (expected %2, have %3)">;
11351
11352def err_objc_type_param_bound_conflict : Error<
11353  "type bound %0 for type parameter %1 conflicts with "
11354  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
11355
11356def err_objc_type_param_variance_conflict : Error<
11357  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
11358  "%select{in|co|contra}2variant type parameter %3">;
11359
11360def note_objc_type_param_here : Note<"type parameter %0 declared here">;
11361
11362def err_objc_type_param_bound_missing : Error<
11363  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
11364
11365def err_objc_parameterized_category_nonclass : Error<
11366  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
11367  "parameters">;
11368
11369def err_objc_parameterized_forward_class : Error<
11370  "forward declaration of non-parameterized class %0 cannot have type "
11371  "parameters">;
11372
11373def err_objc_parameterized_forward_class_first : Error<
11374  "class %0 previously declared with type parameters">;
11375
11376def err_objc_type_arg_missing_star : Error<
11377  "type argument %0 must be a pointer (requires a '*')">;
11378def err_objc_type_arg_qualified : Error<
11379  "type argument %0 cannot be qualified with '%1'">;
11380
11381def err_objc_type_arg_missing : Error<
11382  "no type or protocol named %0">;
11383
11384def err_objc_type_args_and_protocols : Error<
11385  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
11386  "%select{protocol|type}0 (%2)">;
11387
11388def err_objc_type_args_non_class : Error<
11389  "type arguments cannot be applied to non-class type %0">;
11390
11391def err_objc_type_args_non_parameterized_class : Error<
11392  "type arguments cannot be applied to non-parameterized class %0">;
11393
11394def err_objc_type_args_specialized_class : Error<
11395  "type arguments cannot be applied to already-specialized class type %0">;
11396
11397def err_objc_type_args_wrong_arity : Error<
11398  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
11399}
11400
11401def err_objc_type_arg_not_id_compatible : Error<
11402  "type argument %0 is neither an Objective-C object nor a block type">;
11403
11404def err_objc_type_arg_does_not_match_bound : Error<
11405  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
11406
11407def warn_objc_redundant_qualified_class_type : Warning<
11408  "parameterized class %0 already conforms to the protocols listed; did you "
11409  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
11410
11411def warn_block_literal_attributes_on_omitted_return_type : Warning<
11412  "attribute %0 ignored, because it cannot be applied to omitted return type">,
11413  InGroup<IgnoredAttributes>;
11414
11415def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
11416  "'%0' qualifier on omitted return type %1 has no effect">,
11417  InGroup<IgnoredQualifiers>;
11418
11419def warn_shadow_field : Warning<
11420  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
11421  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
11422def note_shadow_field : Note<"declared here">;
11423
11424def err_multiversion_required_in_redecl : Error<
11425  "function declaration is missing %select{'target'|'cpu_specific' or "
11426  "'cpu_dispatch'}0 attribute in a multiversioned function">;
11427def note_multiversioning_caused_here : Note<
11428  "function multiversioning caused by this declaration">;
11429def err_multiversion_after_used : Error<
11430  "function declaration cannot become a multiversioned function after first "
11431  "usage">;
11432def err_bad_multiversion_option : Error<
11433  "function multiversioning doesn't support %select{feature|architecture}0 "
11434  "'%1'">;
11435def err_multiversion_duplicate : Error<
11436  "multiversioned function redeclarations require identical target attributes">;
11437def err_multiversion_noproto : Error<
11438  "multiversioned function must have a prototype">;
11439def err_multiversion_disallowed_other_attr
11440    : Error<"attribute "
11441            "'%select{|target|cpu_specific|cpu_dispatch|target_clones}0' "
11442            "multiversioning cannot be combined"
11443            " with attribute %1">;
11444def err_multiversion_diff : Error<
11445  "multiversioned function declaration has a different %select{calling convention"
11446  "|return type|constexpr specification|inline specification|linkage|"
11447  "language linkage}0">;
11448def err_multiversion_doesnt_support
11449    : Error<"attribute "
11450            "'%select{|target|cpu_specific|cpu_dispatch|target_clones}0' "
11451            "multiversioned functions do not "
11452            "yet support %select{function templates|virtual functions|"
11453            "deduced return types|constructors|destructors|deleted functions|"
11454            "defaulted functions|constexpr functions|consteval "
11455            "function|lambdas}1">;
11456def err_multiversion_not_allowed_on_main : Error<
11457  "'main' cannot be a multiversioned function">;
11458def err_multiversion_not_supported : Error<
11459 "function multiversioning is not supported on the current target">;
11460def err_multiversion_types_mixed : Error<
11461  "multiversioning attributes cannot be combined">;
11462def err_cpu_dispatch_mismatch : Error<
11463 "'cpu_dispatch' function redeclared with different CPUs">;
11464def err_cpu_specific_multiple_defs : Error<
11465 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
11466def warn_multiversion_duplicate_entries : Warning<
11467 "CPU list contains duplicate entries; attribute ignored">,
11468  InGroup<FunctionMultiVersioning>;
11469def warn_dispatch_body_ignored : Warning<
11470  "body of cpu_dispatch function will be ignored">,
11471  InGroup<FunctionMultiVersioning>;
11472def err_target_clone_must_have_default
11473    : Error<"'target_clones' multiversioning requires a default target">;
11474def err_target_clone_doesnt_match
11475    : Error<"'target_clones' attribute does not match previous declaration">;
11476def warn_target_clone_mixed_values
11477    : ExtWarn<
11478          "mixing 'target_clones' specifier mechanisms is permitted for GCC "
11479          "compatibility; use a comma separated sequence of string literals, "
11480          "or a string literal containing a comma-separated list of versions">,
11481      InGroup<TargetClonesMixedSpecifiers>;
11482def warn_target_clone_duplicate_options
11483    : Warning<"version list contains duplicate entries">,
11484      InGroup<FunctionMultiVersioning>;
11485
11486// three-way comparison operator diagnostics
11487def err_implied_comparison_category_type_not_found : Error<
11488  "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
11489  "because type '%0' was not found; include <compare>">;
11490def err_spaceship_argument_narrowing : Error<
11491  "argument to 'operator<=>' "
11492  "%select{cannot be narrowed from type %1 to %2|"
11493  "evaluates to %1, which cannot be narrowed to type %2}0">;
11494def err_std_compare_type_not_supported : Error<
11495  "standard library implementation of %0 is not supported; "
11496   "%select{member '%2' does not have expected form|"
11497   "member '%2' is missing|"
11498   "the type is not trivially copyable|"
11499   "the type does not have the expected form}1">;
11500def note_rewriting_operator_as_spaceship : Note<
11501  "while rewriting comparison as call to 'operator<=>' declared here">;
11502def err_three_way_vector_comparison : Error<
11503  "three-way comparison between vectors is not supported">;
11504
11505// Memory Tagging Extensions (MTE) diagnostics
11506def err_memtag_arg_null_or_pointer : Error<
11507  "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
11508def err_memtag_any2arg_pointer : Error<
11509  "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
11510def err_memtag_arg_must_be_pointer : Error<
11511  "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
11512def err_memtag_arg_must_be_integer : Error<
11513  "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
11514
11515def warn_dereference_of_noderef_type : Warning<
11516  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
11517def warn_dereference_of_noderef_type_no_decl : Warning<
11518  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
11519def warn_noderef_on_non_pointer_or_array : Warning<
11520  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
11521def warn_noderef_to_dereferenceable_pointer : Warning<
11522  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
11523
11524def err_builtin_launder_invalid_arg : Error<
11525  "%select{non-pointer|function pointer|void pointer}0 argument to "
11526  "'__builtin_launder' is not allowed">;
11527
11528def err_builtin_invalid_arg_type: Error <
11529  "%ordinal0 argument must be a "
11530  "%select{vector, integer or floating point type|matrix|"
11531  "pointer to a valid matrix element type|"
11532  "signed integer or floating point type|vector type|"
11533  "floating point type|"
11534  "vector of integers}1 (was %2)">;
11535
11536def err_builtin_matrix_disabled: Error<
11537  "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
11538def err_matrix_index_not_integer: Error<
11539  "matrix %select{row|column}0 index is not an integer">;
11540def err_matrix_index_outside_range: Error<
11541  "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
11542def err_matrix_incomplete_index: Error<
11543  "single subscript expressions are not allowed for matrix values">;
11544def err_matrix_separate_incomplete_index: Error<
11545  "matrix row and column subscripts cannot be separated by any expression">;
11546def err_matrix_subscript_comma: Error<
11547  "comma expressions are not allowed as indices in matrix subscript expressions">;
11548def err_builtin_matrix_scalar_unsigned_arg: Error<
11549  "%0 argument must be a constant unsigned integer expression">;
11550def err_builtin_matrix_pointer_arg_mismatch: Error<
11551  "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
11552def err_builtin_matrix_store_to_const: Error<
11553  "cannot store matrix to read-only pointer">;
11554def err_builtin_matrix_stride_too_small: Error<
11555  "stride must be greater or equal to the number of rows">;
11556def err_builtin_matrix_invalid_dimension: Error<
11557  "%0 dimension is outside the allowed range [1, %1]">;
11558
11559def warn_mismatched_import : Warning<
11560  "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
11561  "previous declaration">,
11562  InGroup<IgnoredAttributes>;
11563def warn_import_on_definition : Warning<
11564  "import %select{module|name}0 cannot be applied to a function with a definition">,
11565  InGroup<IgnoredAttributes>;
11566
11567def err_preserve_field_info_not_field : Error<
11568  "__builtin_preserve_field_info argument %0 not a field access">;
11569def err_preserve_field_info_not_const: Error<
11570  "__builtin_preserve_field_info argument %0 not a constant">;
11571def err_btf_type_id_not_const: Error<
11572  "__builtin_btf_type_id argument %0 not a constant">;
11573def err_preserve_type_info_invalid : Error<
11574  "__builtin_preserve_type_info argument %0 invalid">;
11575def err_preserve_type_info_not_const: Error<
11576  "__builtin_preserve_type_info argument %0 not a constant">;
11577def err_preserve_enum_value_invalid : Error<
11578  "__builtin_preserve_enum_value argument %0 invalid">;
11579def err_preserve_enum_value_not_const: Error<
11580  "__builtin_preserve_enum_value argument %0 not a constant">;
11581
11582def err_bit_cast_non_trivially_copyable : Error<
11583  "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
11584def err_bit_cast_type_size_mismatch : Error<
11585  "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
11586
11587// SYCL-specific diagnostics
11588def warn_sycl_kernel_num_of_template_params : Warning<
11589  "'sycl_kernel' attribute only applies to a function template with at least"
11590  " two template parameters">, InGroup<IgnoredAttributes>;
11591def warn_sycl_kernel_invalid_template_param_type : Warning<
11592  "template parameter of a function template with the 'sycl_kernel' attribute"
11593  " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
11594def warn_sycl_kernel_num_of_function_params : Warning<
11595  "function template with 'sycl_kernel' attribute must have a single parameter">,
11596  InGroup<IgnoredAttributes>;
11597def warn_sycl_kernel_return_type : Warning<
11598  "function template with 'sycl_kernel' attribute must have a 'void' return type">,
11599  InGroup<IgnoredAttributes>;
11600def err_sycl_special_type_num_init_method : Error<
11601  "types with 'sycl_special_class' attribute must have one and only one '__init' "
11602  "method defined">;
11603
11604def err_bit_int_bad_size : Error<"%select{signed|unsigned}0 _BitInt must "
11605                                 "have a bit size of at least %select{2|1}0">;
11606def err_bit_int_max_size : Error<"%select{signed|unsigned}0 _BitInt of bit "
11607                                 "sizes greater than %1 not supported">;
11608
11609// errors of expect.with.probability
11610def err_probability_not_constant_float : Error<
11611   "probability argument to __builtin_expect_with_probability must be constant "
11612   "floating-point expression">;
11613def err_probability_out_of_range : Error<
11614   "probability argument to __builtin_expect_with_probability is outside the "
11615   "range [0.0, 1.0]">;
11616
11617// TCB warnings
11618def err_tcb_conflicting_attributes : Error<
11619  "attributes '%0(\"%2\")' and '%1(\"%2\")' are mutually exclusive">;
11620def warn_tcb_enforcement_violation : Warning<
11621  "calling %0 is a violation of trusted computing base '%1'">,
11622  InGroup<DiagGroup<"tcb-enforcement">>;
11623
11624// RISC-V builtin required extension warning
11625def err_riscv_builtin_requires_extension : Error<
11626  "builtin requires at least one of the following extensions support to be enabled : %0">;
11627def err_riscv_builtin_invalid_lmul : Error<
11628  "LMUL argument must be in the range [0,3] or [5,7]">;
11629
11630def err_std_source_location_impl_not_found : Error<
11631  "'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called">;
11632def err_std_source_location_impl_malformed : Error<
11633  "'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'">;
11634
11635// HLSL Diagnostics
11636def err_hlsl_attr_unsupported_in_stage : Error<"attribute %0 is unsupported in %select{Pixel|Vertex|Geometry|Hull|Domain|Compute|Library|RayGeneration|Intersection|AnyHit|ClosestHit|Miss|Callable|Mesh|Amplification|Invalid}1 shaders, requires %2">;
11637
11638def err_hlsl_numthreads_argument_oor : Error<"argument '%select{X|Y|Z}0' to numthreads attribute cannot exceed %1">;
11639def err_hlsl_numthreads_invalid : Error<"total number of threads cannot exceed %0">;
11640def err_hlsl_attribute_param_mismatch : Error<"%0 attribute parameters do not match the previous declaration">;
11641
11642def err_hlsl_pointers_unsupported : Error<
11643  "%select{pointers|references}0 are unsupported in HLSL">;
11644
11645def err_hlsl_operator_unsupported : Error<
11646  "the '%select{&|*|->}0' operator is unsupported in HLSL">;
11647
11648// Layout randomization diagnostics.
11649def err_non_designated_init_used : Error<
11650  "a randomized struct can only be initialized with a designated initializer">;
11651def err_cast_from_randomized_struct : Error<
11652  "casting from randomized structure pointer type %0 to %1">;
11653} // end of sema component.
11654