xref: /freebsd/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td (revision 02e9120893770924227138ba49df1edb3896112a)
1//==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Semantic Analysis
11//===----------------------------------------------------------------------===//
12
13let Component = "Sema" in {
14let CategoryName = "Semantic Issue" in {
15def note_previous_decl : Note<"%0 declared here">;
16def note_entity_declared_at : Note<"%0 declared here">;
17def note_callee_decl : Note<"%0 declared here">;
18def note_defined_here : Note<"%0 defined here">;
19
20// For loop analysis
21def warn_variables_not_in_loop_body : Warning<
22  "variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 "
23  "used in loop condition not modified in loop body">,
24  InGroup<ForLoopAnalysis>, DefaultIgnore;
25def warn_redundant_loop_iteration : Warning<
26  "variable %0 is %select{decremented|incremented}1 both in the loop header "
27  "and in the loop body">,
28  InGroup<ForLoopAnalysis>, DefaultIgnore;
29def note_loop_iteration_here : Note<"%select{decremented|incremented}0 here">;
30
31def warn_duplicate_enum_values : Warning<
32  "element %0 has been implicitly assigned %1 which another element has "
33  "been assigned">, InGroup<DiagGroup<"duplicate-enum">>, DefaultIgnore;
34def note_duplicate_element : Note<"element %0 also has value %1">;
35
36// Absolute value functions
37def warn_unsigned_abs : Warning<
38  "taking the absolute value of unsigned type %0 has no effect">,
39  InGroup<AbsoluteValue>;
40def note_remove_abs : Note<
41  "remove the call to '%0' since unsigned values cannot be negative">;
42def warn_abs_too_small : Warning<
43  "absolute value function %0 given an argument of type %1 but has parameter "
44  "of type %2 which may cause truncation of value">, InGroup<AbsoluteValue>;
45def warn_wrong_absolute_value_type : Warning<
46  "using %select{integer|floating point|complex}1 absolute value function %0 "
47  "when argument is of %select{integer|floating point|complex}2 type">,
48  InGroup<AbsoluteValue>;
49def note_replace_abs_function : Note<"use function '%0' instead">;
50def warn_pointer_abs : Warning<
51  "taking the absolute value of %select{pointer|function|array}0 type %1 is suspicious">,
52  InGroup<AbsoluteValue>;
53
54def warn_max_unsigned_zero : Warning<
55  "taking the max of "
56  "%select{a value and unsigned zero|unsigned zero and a value}0 "
57  "is always equal to the other value">,
58  InGroup<MaxUnsignedZero>;
59def note_remove_max_call : Note<
60  "remove call to max function and unsigned zero argument">;
61
62def warn_infinite_recursive_function : Warning<
63  "all paths through this function will call itself">,
64  InGroup<InfiniteRecursion>, DefaultIgnore;
65
66def warn_comma_operator : Warning<"possible misuse of comma operator here">,
67  InGroup<DiagGroup<"comma">>, DefaultIgnore;
68def note_cast_to_void : Note<"cast expression to void to silence warning">;
69def note_cast_operand_to_int : Note<"cast one or both operands to int to silence this warning">;
70
71// Constant expressions
72def err_expr_not_ice : Error<
73  "expression is not an %select{integer|integral}0 constant expression">;
74def ext_expr_not_ice : Extension<
75  "expression is not an %select{integer|integral}0 constant expression; "
76  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
77def err_typecheck_converted_constant_expression : Error<
78  "value of type %0 is not implicitly convertible to %1">;
79def err_typecheck_converted_constant_expression_disallowed : Error<
80  "conversion from %0 to %1 is not allowed in a converted constant expression">;
81def err_typecheck_converted_constant_expression_indirect : Error<
82  "conversion from %0 to %1 in converted constant expression would "
83  "bind reference to a temporary">;
84def err_expr_not_cce : Error<
85  "%select{case value|enumerator value|non-type template argument|"
86  "array size|explicit specifier argument|noexcept specifier argument|"
87  "call to 'size()'|call to 'data()'}0 is not a constant expression">;
88def ext_cce_narrowing : ExtWarn<
89  "%select{case value|enumerator value|non-type template argument|"
90  "array size|explicit specifier argument|noexcept specifier argument}0 "
91  "%select{cannot be narrowed from type %2 to %3|"
92  "evaluates to %2, which cannot be narrowed to type %3}1">,
93  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
94def err_ice_not_integral : Error<
95  "%select{integer|integral}1 constant expression must have "
96  "%select{integer|integral or unscoped enumeration}1 type, not %0">;
97def err_ice_incomplete_type : Error<
98  "integral constant expression has incomplete class type %0">;
99def err_ice_explicit_conversion : Error<
100  "integral constant expression requires explicit conversion from %0 to %1">;
101def note_ice_conversion_here : Note<
102  "conversion to %select{integral|enumeration}0 type %1 declared here">;
103def err_ice_ambiguous_conversion : Error<
104  "ambiguous conversion from type %0 to an integral or unscoped "
105  "enumeration type">;
106def err_ice_too_large : Error<
107  "integer constant expression evaluates to value %0 that cannot be "
108  "represented in a %1-bit %select{signed|unsigned}2 integer type">;
109def err_expr_not_string_literal : Error<"expression is not a string literal">;
110
111// Semantic analysis of constant literals.
112def ext_predef_outside_function : Warning<
113  "predefined identifier is only valid inside function">,
114  InGroup<DiagGroup<"predefined-identifier-outside-function">>;
115def ext_init_from_predefined : ExtWarn<
116  "initializing an array from a '%0' predefined identifier is a Microsoft extension">,
117  InGroup<MicrosoftInitFromPredefined>;
118def warn_float_overflow : Warning<
119  "magnitude of floating-point constant too large for type %0; maximum is %1">,
120   InGroup<LiteralRange>;
121def warn_float_underflow : Warning<
122  "magnitude of floating-point constant too small for type %0; minimum is %1">,
123  InGroup<LiteralRange>;
124def warn_float_compare_literal : Warning<
125  "floating-point comparison is always %select{true|false}0; "
126  "constant cannot be represented exactly in type %1">,
127  InGroup<LiteralRange>;
128def warn_double_const_requires_fp64 : Warning<
129  "double precision constant requires %select{cl_khr_fp64|cl_khr_fp64 and __opencl_c_fp64}0, "
130  "casting to single precision">;
131def err_half_const_requires_fp16 : Error<
132  "half precision constant requires cl_khr_fp16">;
133
134// C99 variable-length arrays
135def ext_vla : Extension<"variable length arrays are a C99 feature">,
136  InGroup<VLAExtension>;
137def warn_vla_used : Warning<"variable length array used">,
138  InGroup<VLA>, DefaultIgnore;
139def err_vla_in_sfinae : Error<
140  "variable length array cannot be formed during template argument deduction">;
141def err_array_star_in_function_definition : Error<
142  "variable length array must be bound in function definition">;
143def err_vla_decl_in_file_scope : Error<
144  "variable length array declaration not allowed at file scope">;
145def err_vla_decl_has_static_storage : Error<
146  "variable length array declaration cannot have 'static' storage duration">;
147def err_vla_decl_has_extern_linkage : Error<
148  "variable length array declaration cannot have 'extern' linkage">;
149def ext_vla_folded_to_constant : ExtWarn<
150  "variable length array folded to constant array as an extension">,
151  InGroup<GNUFoldingConstant>;
152def err_vla_unsupported : Error<
153  "variable length arrays are not supported for %select{the current target|'%1'}0">;
154def note_vla_unsupported : Note<
155  "variable length arrays are not supported for the current target">;
156
157// C99 variably modified types
158def err_variably_modified_template_arg : Error<
159  "variably modified type %0 cannot be used as a template argument">;
160def err_variably_modified_nontype_template_param : Error<
161  "non-type template parameter of variably modified type %0">;
162def err_variably_modified_new_type : Error<
163  "'new' cannot allocate object of variably modified type %0">;
164
165// C99 Designated Initializers
166def ext_designated_init : Extension<
167  "designated initializers are a C99 feature">, InGroup<C99Designator>;
168def err_array_designator_negative : Error<
169  "array designator value '%0' is negative">;
170def err_array_designator_empty_range : Error<
171  "array designator range [%0, %1] is empty">;
172def err_array_designator_non_array : Error<
173  "array designator cannot initialize non-array type %0">;
174def err_array_designator_too_large : Error<
175  "array designator index (%0) exceeds array bounds (%1)">;
176def err_field_designator_non_aggr : Error<
177  "field designator cannot initialize a "
178  "%select{non-struct, non-union|non-class}0 type %1">;
179def err_field_designator_unknown : Error<
180  "field designator %0 does not refer to any field in type %1">;
181def err_field_designator_nonfield : Error<
182  "field designator %0 does not refer to a non-static data member">;
183def note_field_designator_found : Note<"field designator refers here">;
184def err_designator_for_scalar_or_sizeless_init : Error<
185  "designator in initializer for %select{scalar|indivisible sizeless}0 "
186  "type %1">;
187def warn_initializer_overrides : Warning<
188  "initializer %select{partially |}0overrides prior initialization of "
189  "this subobject">, InGroup<InitializerOverrides>;
190def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Summary>,
191  InGroup<InitializerOverrides>, SFINAEFailure;
192def ext_initializer_union_overrides : ExtWarn<warn_initializer_overrides.Summary>,
193  InGroup<InitializerOverrides>, DefaultError, SFINAEFailure;
194def err_initializer_overrides_destructed : Error<
195  "initializer would partially override prior initialization of object of "
196  "type %1 with non-trivial destruction">;
197def note_previous_initializer : Note<
198  "previous initialization %select{|with side effects }0is here"
199  "%select{| (side effects will not occur at run time)}0">;
200def err_designator_into_flexible_array_member : Error<
201  "designator into flexible array member subobject">;
202def note_flexible_array_member : Note<
203  "initialized flexible array member %0 is here">;
204def ext_flexible_array_init : Extension<
205  "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
206
207// C++20 designated initializers
208def ext_cxx_designated_init : Extension<
209  "designated initializers are a C++20 extension">, InGroup<CXX20Designator>,
210  SuppressInSystemMacro;
211def warn_cxx17_compat_designated_init : Warning<
212  "designated initializers are incompatible with C++ standards before C++20">,
213  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
214def ext_designated_init_mixed : ExtWarn<
215  "mixture of designated and non-designated initializers in the same "
216  "initializer list is a C99 extension">, InGroup<C99Designator>;
217def note_designated_init_mixed : Note<
218  "first non-designated initializer is here">;
219def ext_designated_init_array : ExtWarn<
220  "array designators are a C99 extension">, InGroup<C99Designator>;
221def ext_designated_init_nested : ExtWarn<
222  "nested designators are a C99 extension">, InGroup<C99Designator>;
223def ext_designated_init_reordered : ExtWarn<
224  "ISO C++ requires field designators to be specified in declaration order; "
225  "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
226  SFINAEFailure;
227def note_previous_field_init : Note<
228  "previous initialization for field %0 is here">;
229def ext_designated_init_brace_elision : ExtWarn<
230  "brace elision for designated initializer is a C99 extension">,
231  InGroup<C99Designator>, SFINAEFailure;
232
233// Declarations.
234def ext_plain_complex : ExtWarn<
235  "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
236def ext_imaginary_constant : Extension<
237  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
238def ext_integer_complex : Extension<
239  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
240
241def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
242  "'_Fract' or '_Accum', not '%0'">;
243def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
244def err_invalid_width_spec : Error<
245  "'%select{|short|long|long long}0 %1' is invalid">;
246def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
247
248def ext_auto_type_specifier : ExtWarn<
249  "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
250def warn_auto_storage_class : Warning<
251  "'auto' storage class specifier is redundant and incompatible with C++11">,
252  InGroup<CXX11Compat>, DefaultIgnore;
253
254def warn_deprecated_register : Warning<
255  "'register' storage class specifier is deprecated "
256  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
257def ext_register_storage_class : ExtWarn<
258  "ISO C++17 does not allow 'register' storage class specifier">,
259  DefaultError, InGroup<Register>;
260
261def err_invalid_decl_spec_combination : Error<
262  "cannot combine with previous '%0' declaration specifier">;
263def err_invalid_vector_decl_spec_combination : Error<
264  "cannot combine with previous '%0' declaration specifier. "
265  "'__vector' must be first">;
266def err_invalid_pixel_decl_spec_combination : Error<
267  "'__pixel' must be preceded by '__vector'.  "
268  "'%0' declaration specifier not allowed here">;
269def err_invalid_vector_bool_decl_spec : Error<
270  "cannot use '%0' with '__vector bool'">;
271def err_invalid_vector_long_decl_spec : Error<
272  "cannot use 'long' with '__vector'">;
273def err_invalid_vector_float_decl_spec : Error<
274  "cannot use 'float' with '__vector'">;
275def err_invalid_vector_double_decl_spec : Error <
276  "use of 'double' with '__vector' requires VSX support to be enabled "
277  "(available on POWER7 or later)">;
278def err_invalid_vector_bool_int128_decl_spec : Error <
279  "use of '__int128' with '__vector bool' requires VSX support enabled (on "
280  "POWER10 or later)">;
281def err_invalid_vector_int128_decl_spec : Error<
282  "use of '__int128' with '__vector' requires extended Altivec support"
283  " (available on POWER8 or later)">;
284def err_invalid_vector_long_long_decl_spec : Error <
285  "use of 'long long' with '__vector' requires VSX support (available on "
286  "POWER7 or later) to be enabled">;
287def err_invalid_vector_long_double_decl_spec : Error<
288  "cannot use 'long double' with '__vector'">;
289def warn_vector_long_decl_spec_combination : Warning<
290  "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
291
292def err_redeclaration_different_type : Error<
293  "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
294def err_bad_variable_name : Error<
295  "%0 cannot be the name of a variable or data member">;
296def err_bad_parameter_name : Error<
297  "%0 cannot be the name of a parameter">;
298def err_bad_parameter_name_template_id : Error<
299  "parameter name cannot have template arguments">;
300def ext_parameter_name_omitted_c2x : ExtWarn<
301  "omitting the parameter name in a function definition is a C2x extension">,
302  InGroup<C2x>;
303def err_anyx86_interrupt_attribute : Error<
304  "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
305  "have %select{a 'void' return type|"
306  "only a pointer parameter optionally followed by an integer parameter|"
307  "a pointer as the first parameter|a %2 type as the second parameter}1">;
308def err_anyx86_interrupt_called : Error<
309  "interrupt service routine cannot be called directly">;
310def warn_anyx86_interrupt_regsave : Warning<
311  "interrupt service routine should only call a function"
312  " with attribute 'no_caller_saved_registers'">,
313  InGroup<DiagGroup<"interrupt-service-routine">>;
314def warn_arm_interrupt_calling_convention : Warning<
315   "call to function without interrupt attribute could clobber interruptee's VFP registers">,
316   InGroup<Extra>;
317def warn_interrupt_attribute_invalid : Warning<
318   "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
319   "functions that have %select{no parameters|a 'void' return type}1">,
320   InGroup<IgnoredAttributes>;
321def warn_riscv_repeated_interrupt_attribute : Warning<
322  "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
323def note_riscv_repeated_interrupt_attribute : Note<
324  "repeated RISC-V 'interrupt' attribute is here">;
325def warn_unused_parameter : Warning<"unused parameter %0">,
326  InGroup<UnusedParameter>, DefaultIgnore;
327def warn_unused_but_set_parameter : Warning<"parameter %0 set but not used">,
328  InGroup<UnusedButSetParameter>, DefaultIgnore;
329def warn_unused_variable : Warning<"unused variable %0">,
330  InGroup<UnusedVariable>, DefaultIgnore;
331def warn_unused_but_set_variable : Warning<"variable %0 set but not used">,
332  InGroup<UnusedButSetVariable>, DefaultIgnore;
333def warn_unused_local_typedef : Warning<
334  "unused %select{typedef|type alias}0 %1">,
335  InGroup<UnusedLocalTypedef>, DefaultIgnore;
336def warn_unused_property_backing_ivar :
337  Warning<"ivar %0 which backs the property is not "
338  "referenced in this property's accessor">,
339  InGroup<UnusedPropertyIvar>, DefaultIgnore;
340def warn_unused_const_variable : Warning<"unused variable %0">,
341  InGroup<UnusedConstVariable>, DefaultIgnore;
342def warn_unused_exception_param : Warning<"unused exception parameter %0">,
343  InGroup<UnusedExceptionParameter>, DefaultIgnore;
344def warn_decl_in_param_list : Warning<
345  "declaration of %0 will not be visible outside of this function">,
346  InGroup<Visibility>;
347def warn_redefinition_in_param_list : Warning<
348  "redefinition of %0 will not be visible outside of this function">,
349  InGroup<Visibility>;
350def warn_empty_parens_are_function_decl : Warning<
351  "empty parentheses interpreted as a function declaration">,
352  InGroup<VexingParse>;
353def warn_parens_disambiguated_as_function_declaration : Warning<
354  "parentheses were disambiguated as a function declaration">,
355  InGroup<VexingParse>;
356def warn_parens_disambiguated_as_variable_declaration : Warning<
357  "parentheses were disambiguated as redundant parentheses around declaration "
358  "of variable named %0">, InGroup<VexingParse>;
359def warn_redundant_parens_around_declarator : Warning<
360  "redundant parentheses surrounding declarator">,
361  InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
362def note_additional_parens_for_variable_declaration : Note<
363  "add a pair of parentheses to declare a variable">;
364def note_raii_guard_add_name : Note<
365  "add a variable name to declare a %0 initialized with %1">;
366def note_function_style_cast_add_parentheses : Note<
367  "add enclosing parentheses to perform a function-style cast">;
368def note_remove_parens_for_variable_declaration : Note<
369  "remove parentheses to silence this warning">;
370def note_empty_parens_function_call : Note<
371  "change this ',' to a ';' to call %0">;
372def note_empty_parens_default_ctor : Note<
373  "remove parentheses to declare a variable">;
374def note_empty_parens_zero_initialize : Note<
375  "replace parentheses with an initializer to declare a variable">;
376def warn_unused_function : Warning<"unused function %0">,
377  InGroup<UnusedFunction>, DefaultIgnore;
378def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
379  InGroup<UnusedTemplate>, DefaultIgnore;
380def warn_unused_member_function : Warning<"unused member function %0">,
381  InGroup<UnusedMemberFunction>, DefaultIgnore;
382def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
383  InGroup<UsedButMarkedUnused>, DefaultIgnore;
384def warn_unneeded_internal_decl : Warning<
385  "%select{function|variable}0 %1 is not needed and will not be emitted">,
386  InGroup<UnneededInternalDecl>, DefaultIgnore;
387def warn_unneeded_static_internal_decl : Warning<
388  "'static' function %0 declared in header file "
389  "should be declared 'static inline'">,
390  InGroup<UnneededInternalDecl>, DefaultIgnore;
391def warn_unneeded_member_function : Warning<
392  "member function %0 is not needed and will not be emitted">,
393  InGroup<UnneededMemberFunction>, DefaultIgnore;
394def warn_unused_private_field: Warning<"private field %0 is not used">,
395  InGroup<UnusedPrivateField>, DefaultIgnore;
396def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
397  "%select{used|required to be captured for this use}1">,
398  InGroup<UnusedLambdaCapture>, DefaultIgnore;
399
400def warn_reserved_extern_symbol: Warning<
401  "identifier %0 is reserved because %select{"
402  "<ERROR>|" // ReservedIdentifierStatus::NotReserved
403  "it starts with '_' at global scope|"
404  "it starts with '_' and has C language linkage|"
405  "it starts with '__'|"
406  "it starts with '_' followed by a capital letter|"
407  "it contains '__'}1">,
408  InGroup<ReservedIdentifier>, DefaultIgnore;
409def warn_deprecated_literal_operator_id: Warning<
410  "identifier %0 preceded by whitespace in a literal operator declaration "
411  "is deprecated">, InGroup<DeprecatedLiteralOperator>, DefaultIgnore;
412def warn_reserved_module_name : Warning<
413  "%0 is a reserved name for a module">, InGroup<ReservedModuleIdentifier>;
414
415def warn_parameter_size: Warning<
416  "%0 is a large (%1 bytes) pass-by-value argument; "
417  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
418def warn_return_value_size: Warning<
419  "return value of %0 is a large (%1 bytes) pass-by-value object; "
420  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
421def warn_return_value_udt: Warning<
422  "%0 has C-linkage specified, but returns user-defined type %1 which is "
423  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
424def warn_return_value_udt_incomplete: Warning<
425  "%0 has C-linkage specified, but returns incomplete type %1 which could be "
426  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
427def warn_implicit_function_decl : Warning<
428  "implicit declaration of function %0">,
429  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
430def ext_implicit_function_decl_c99 : ExtWarn<
431  "call to undeclared function %0; ISO C99 and later do not support implicit "
432  "function declarations">, InGroup<ImplicitFunctionDeclare>;
433def note_function_suggestion : Note<"did you mean %0?">;
434
435def err_ellipsis_first_param : Error<
436  "ISO C requires a named parameter before '...'">;
437def err_declarator_need_ident : Error<"declarator requires an identifier">;
438def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
439def ext_use_out_of_scope_declaration : ExtWarn<
440  "use of out-of-scope declaration of %0%select{| whose type is not "
441  "compatible with that of an implicit declaration}1">,
442  InGroup<DiagGroup<"out-of-scope-function">>;
443def err_inline_non_function : Error<
444  "'inline' can only appear on functions%select{| and non-local variables}0">;
445def err_noreturn_non_function : Error<
446  "'_Noreturn' can only appear on functions">;
447def warn_qual_return_type : Warning<
448  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
449  InGroup<IgnoredQualifiers>, DefaultIgnore;
450def warn_deprecated_redundant_constexpr_static_def : Warning<
451  "out-of-line definition of constexpr static data member is redundant "
452  "in C++17 and is deprecated">,
453  InGroup<DeprecatedRedundantConstexprStaticDef>, DefaultIgnore;
454
455def warn_decl_shadow :
456  Warning<"declaration shadows a %select{"
457          "local variable|"
458          "variable in %2|"
459          "static data member of %2|"
460          "field of %2|"
461          "typedef in %2|"
462          "type alias in %2|"
463          "structured binding}1">,
464  InGroup<Shadow>, DefaultIgnore, SuppressInSystemMacro;
465def warn_decl_shadow_uncaptured_local :
466  Warning<warn_decl_shadow.Summary>,
467  InGroup<ShadowUncapturedLocal>, DefaultIgnore;
468def warn_ctor_parm_shadows_field:
469  Warning<"constructor parameter %0 shadows the field %1 of %2">,
470  InGroup<ShadowFieldInConstructor>, DefaultIgnore;
471def warn_modifying_shadowing_decl :
472  Warning<"modifying constructor parameter %0 that shadows a "
473          "field of %1">,
474  InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
475
476// C++ decomposition declarations
477def err_decomp_decl_context : Error<
478  "decomposition declaration not permitted in this context">;
479def warn_cxx14_compat_decomp_decl : Warning<
480  "decomposition declarations are incompatible with "
481  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
482def ext_decomp_decl : ExtWarn<
483  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
484def ext_decomp_decl_cond : ExtWarn<
485  "ISO C++17 does not permit structured binding declaration in a condition">,
486  InGroup<DiagGroup<"binding-in-condition">>;
487def err_decomp_decl_spec : Error<
488  "decomposition declaration cannot be declared "
489  "%plural{1:'%1'|:with '%1' specifiers}0">;
490def ext_decomp_decl_spec : ExtWarn<
491  "decomposition declaration declared "
492  "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
493  InGroup<CXX20>;
494def warn_cxx17_compat_decomp_decl_spec : Warning<
495  "decomposition declaration declared "
496  "%plural{1:'%1'|:with '%1' specifiers}0 "
497  "is incompatible with C++ standards before C++20">,
498  InGroup<CXXPre20Compat>, DefaultIgnore;
499def err_decomp_decl_type : Error<
500  "decomposition declaration cannot be declared with type %0; "
501  "declared type must be 'auto' or reference to 'auto'">;
502def err_decomp_decl_constraint : Error<
503  "decomposition declaration cannot be declared with constrained 'auto'">;
504def err_decomp_decl_parens : Error<
505  "decomposition declaration cannot be declared with parentheses">;
506def err_decomp_decl_template : Error<
507  "decomposition declaration template not supported">;
508def err_decomp_decl_not_alone : Error<
509  "decomposition declaration must be the only declaration in its group">;
510def err_decomp_decl_requires_init : Error<
511  "decomposition declaration %0 requires an initializer">;
512def err_decomp_decl_wrong_number_bindings : Error<
513  "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
514  "%select{%plural{0:no|:only %1}1|%1}4 "
515  "%plural{1:name was|:names were}1 provided">;
516def err_decomp_decl_unbindable_type : Error<
517  "cannot decompose %select{union|non-class, non-array}1 type %2">;
518def err_decomp_decl_multiple_bases_with_members : Error<
519  "cannot decompose class type %1: "
520  "%select{its base classes %2 and|both it and its base class}0 %3 "
521  "have non-static data members">;
522def err_decomp_decl_ambiguous_base : Error<
523  "cannot decompose members of ambiguous base class %1 of %0:%2">;
524def err_decomp_decl_inaccessible_base : Error<
525  "cannot decompose members of inaccessible base class %1 of %0">,
526  AccessControl;
527def err_decomp_decl_inaccessible_field : Error<
528  "cannot decompose %select{private|protected}0 member %1 of %3">,
529  AccessControl;
530def err_decomp_decl_lambda : Error<
531  "cannot decompose lambda closure type">;
532def err_decomp_decl_anon_union_member : Error<
533  "cannot decompose class type %0 because it has an anonymous "
534  "%select{struct|union}1 member">;
535def err_decomp_decl_std_tuple_element_not_specialized : Error<
536  "cannot decompose this type; 'std::tuple_element<%0>::type' "
537  "does not name a type">;
538def err_decomp_decl_std_tuple_size_not_constant : Error<
539  "cannot decompose this type; 'std::tuple_size<%0>::value' "
540  "is not a valid integral constant expression">;
541def note_in_binding_decl_init : Note<
542  "in implicit initialization of binding declaration %0">;
543
544def err_std_type_trait_not_class_template : Error<
545  "unsupported standard library implementation: "
546  "'std::%0' is not a class template">;
547
548// C++ using declarations
549def err_using_requires_qualname : Error<
550  "using declaration requires a qualified name">;
551def err_using_typename_non_type : Error<
552  "'typename' keyword used on a non-type">;
553def err_using_dependent_value_is_type : Error<
554  "dependent using declaration resolved to type without 'typename'">;
555def err_using_decl_nested_name_specifier_is_not_class : Error<
556  "using declaration in class refers into '%0', which is not a class">;
557def warn_cxx17_compat_using_decl_non_member_enumerator : Warning<
558  "member using declaration naming non-class '%0' enumerator is "
559  "incompatible with C++ standards before C++20">, InGroup<CXXPre20Compat>,
560  DefaultIgnore;
561def err_using_decl_nested_name_specifier_is_current_class : Error<
562  "using declaration refers to its own class">;
563def err_using_decl_nested_name_specifier_is_not_base_class : Error<
564  "using declaration refers into '%0', which is not a base class of %1">;
565def err_using_decl_constructor_not_in_direct_base : Error<
566  "%0 is not a direct base of %1, cannot inherit constructors">;
567def err_using_decl_can_not_refer_to_class_member : Error<
568  "using declaration cannot refer to class member">;
569def warn_cxx17_compat_using_decl_class_member_enumerator : Warning<
570  "member using declaration naming a non-member enumerator is incompatible "
571  "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
572def err_using_enum_is_dependent : Error<
573  "using-enum cannot name a dependent type">;
574def err_using_enum_not_enum : Error<
575  "%0 is not an enumerated type">;
576def err_ambiguous_inherited_constructor : Error<
577  "constructor of %0 inherited from multiple base class subobjects">;
578def note_ambiguous_inherited_constructor_using : Note<
579  "inherited from base class %0 here">;
580def note_using_decl_class_member_workaround : Note<
581  "use %select{an alias declaration|a typedef declaration|a reference|"
582  "a const variable|a constexpr variable}0 instead">;
583def err_using_decl_can_not_refer_to_namespace : Error<
584  "using declaration cannot refer to a namespace">;
585def warn_cxx17_compat_using_decl_scoped_enumerator: Warning<
586  "using declaration naming a scoped enumerator is incompatible with "
587  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
588def ext_using_decl_scoped_enumerator : ExtWarn<
589  "using declaration naming a scoped enumerator is a C++20 extension">,
590  InGroup<CXX20>;
591def err_using_decl_constructor : Error<
592  "using declaration cannot refer to a constructor">;
593def warn_cxx98_compat_using_decl_constructor : Warning<
594  "inheriting constructors are incompatible with C++98">,
595  InGroup<CXX98Compat>, DefaultIgnore;
596def err_using_decl_destructor : Error<
597  "using declaration cannot refer to a destructor">;
598def err_using_decl_template_id : Error<
599  "using declaration cannot refer to a template specialization">;
600def note_using_decl_target : Note<"target of using declaration">;
601def note_using_decl_conflict : Note<"conflicting declaration">;
602def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
603def err_using_decl_conflict : Error<
604  "target of using declaration conflicts with declaration already in scope">;
605def err_using_decl_conflict_reverse : Error<
606  "declaration conflicts with target of using declaration already in scope">;
607def note_using_decl : Note<"%select{|previous }0using declaration">;
608def err_using_decl_redeclaration_expansion : Error<
609  "using declaration pack expansion at block scope produces multiple values">;
610def err_use_of_empty_using_if_exists : Error<
611  "reference to unresolved using declaration">;
612def note_empty_using_if_exists_here : Note<
613  "using declaration annotated with 'using_if_exists' here">;
614def err_using_if_exists_on_ctor : Error<
615  "'using_if_exists' attribute cannot be applied to an inheriting constructor">;
616def err_using_enum_decl_redeclaration : Error<
617  "redeclaration of using-enum declaration">;
618def note_using_enum_decl : Note<"%select{|previous }0using-enum declaration">;
619
620def warn_access_decl_deprecated : Warning<
621  "access declarations are deprecated; use using declarations instead">,
622  InGroup<Deprecated>;
623def err_access_decl : Error<
624  "ISO C++11 does not allow access declarations; "
625  "use using declarations instead">;
626def warn_deprecated_copy : Warning<
627  "definition of implicit copy %select{constructor|assignment operator}1 "
628  "for %0 is deprecated because it has a user-declared copy "
629  "%select{assignment operator|constructor}1">,
630  InGroup<DeprecatedCopy>, DefaultIgnore;
631def warn_deprecated_copy_with_dtor : Warning<
632  "definition of implicit copy %select{constructor|assignment operator}1 "
633  "for %0 is deprecated because it has a user-declared destructor">,
634  InGroup<DeprecatedCopyWithDtor>, DefaultIgnore;
635def warn_deprecated_copy_with_user_provided_copy: Warning<
636  "definition of implicit copy %select{constructor|assignment operator}1 "
637  "for %0 is deprecated because it has a user-provided copy "
638  "%select{assignment operator|constructor}1">,
639  InGroup<DeprecatedCopyWithUserProvidedCopy>, DefaultIgnore;
640def warn_deprecated_copy_with_user_provided_dtor : Warning<
641  "definition of implicit copy %select{constructor|assignment operator}1 "
642  "for %0 is deprecated because it has a user-provided destructor">,
643  InGroup<DeprecatedCopyWithUserProvidedDtor>, DefaultIgnore;
644def warn_cxx17_compat_exception_spec_in_signature : Warning<
645  "mangled name of %0 will change in C++17 due to non-throwing exception "
646  "specification in function signature">, InGroup<CXX17CompatMangling>;
647
648def warn_global_constructor : Warning<
649  "declaration requires a global constructor">,
650  InGroup<GlobalConstructors>, DefaultIgnore;
651def warn_global_destructor : Warning<
652  "declaration requires a global destructor">,
653   InGroup<GlobalConstructors>, DefaultIgnore;
654def warn_exit_time_destructor : Warning<
655  "declaration requires an exit-time destructor">,
656  InGroup<ExitTimeDestructors>, DefaultIgnore;
657
658def err_invalid_thread : Error<
659  "'%0' is only allowed on variable declarations">;
660def err_thread_non_global : Error<
661  "'%0' variables must have global storage">;
662def err_thread_unsupported : Error<
663  "thread-local storage is not supported for the current target">;
664
665// FIXME: Combine fallout warnings to just one warning.
666def warn_maybe_falloff_nonvoid_function : Warning<
667  "non-void function does not return a value in all control paths">,
668  InGroup<ReturnType>;
669def warn_falloff_nonvoid_function : Warning<
670  "non-void function does not return a value">,
671  InGroup<ReturnType>;
672def err_maybe_falloff_nonvoid_block : Error<
673  "non-void block does not return a value in all control paths">;
674def err_falloff_nonvoid_block : Error<
675  "non-void block does not return a value">;
676def warn_maybe_falloff_nonvoid_coroutine : Warning<
677  "non-void coroutine does not return a value in all control paths">,
678  InGroup<ReturnType>;
679def warn_falloff_nonvoid_coroutine : Warning<
680  "non-void coroutine does not return a value">,
681  InGroup<ReturnType>;
682def warn_suggest_noreturn_function : Warning<
683  "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
684  InGroup<MissingNoreturn>, DefaultIgnore;
685def warn_suggest_noreturn_block : Warning<
686  "block could be declared with attribute 'noreturn'">,
687  InGroup<MissingNoreturn>, DefaultIgnore;
688
689// Unreachable code.
690def warn_unreachable : Warning<
691  "code will never be executed">,
692  InGroup<UnreachableCode>, DefaultIgnore;
693def warn_unreachable_break : Warning<
694  "'break' will never be executed">,
695  InGroup<UnreachableCodeBreak>, DefaultIgnore;
696def warn_unreachable_return : Warning<
697  "'return' will never be executed">,
698  InGroup<UnreachableCodeReturn>, DefaultIgnore;
699def warn_unreachable_loop_increment : Warning<
700  "loop will run at most once (loop increment never executed)">,
701  InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
702def warn_unreachable_fallthrough_attr : Warning<
703  "fallthrough annotation in unreachable code">,
704  InGroup<UnreachableCodeFallthrough>, DefaultIgnore;
705def note_unreachable_silence : Note<
706  "silence by adding parentheses to mark code as explicitly dead">;
707def warn_unreachable_association : Warning<
708  "due to lvalue conversion of the controlling expression, association of type "
709  "%0 will never be selected because it is %select{of array type|qualified}1">,
710  InGroup<UnreachableCodeGenericAssoc>;
711
712/// Built-in functions.
713def ext_implicit_lib_function_decl : ExtWarn<
714  "implicitly declaring library function '%0' with type %1">,
715  InGroup<ImplicitFunctionDeclare>;
716def ext_implicit_lib_function_decl_c99 : ExtWarn<
717  "call to undeclared library function '%0' with type %1; ISO C99 and later "
718  "do not support implicit function declarations">,
719  InGroup<ImplicitFunctionDeclare>;
720def note_include_header_or_declare : Note<
721  "include the header <%0> or explicitly provide a declaration for '%1'">;
722def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
723def warn_implicit_decl_no_jmp_buf
724    : Warning<"declaration of built-in function '%0' requires the declaration"
725    " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
726      InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
727def warn_implicit_decl_requires_sysheader : Warning<
728  "declaration of built-in function '%1' requires inclusion of the header <%0>">,
729  InGroup<BuiltinRequiresHeader>;
730def warn_redecl_library_builtin : Warning<
731  "incompatible redeclaration of library function %0">,
732  InGroup<DiagGroup<"incompatible-library-redeclaration">>;
733def err_builtin_definition : Error<"definition of builtin function %0">;
734def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
735def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
736def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
737  "%select{GCP|CDE}1">;
738def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
739def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
740def err_invalid_cpu_specific_dispatch_value : Error<
741"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
742def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
743  InGroup<ImplicitFunctionDeclare>, DefaultError;
744def warn_cstruct_memaccess : Warning<
745  "%select{destination for|source of|first operand of|second operand of}0 this "
746  "%1 call is a pointer to record %2 that is not trivial to "
747  "%select{primitive-default-initialize|primitive-copy}3">,
748  InGroup<NonTrivialMemaccess>;
749def note_nontrivial_field : Note<
750  "field is non-trivial to %select{copy|default-initialize}0">;
751def err_non_trivial_c_union_in_invalid_context : Error<
752  "cannot %select{"
753  "use type %1 for a function/method parameter|"
754  "use type %1 for function/method return|"
755  "default-initialize an object of type %1|"
756  "declare an automatic variable of type %1|"
757  "copy-initialize an object of type %1|"
758  "assign to a variable of type %1|"
759  "construct an automatic compound literal of type %1|"
760  "capture a variable of type %1|"
761  "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
762  "}3 "
763  "since it %select{contains|is}2 a union that is non-trivial to "
764  "%select{default-initialize|destruct|copy}0">;
765def note_non_trivial_c_union : Note<
766  "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
767  "non-trivial to %select{default-initialize|destruct|copy}1">;
768def warn_dyn_class_memaccess : Warning<
769  "%select{destination for|source of|first operand of|second operand of}0 this "
770  "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
771  "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
772  InGroup<DynamicClassMemaccess>;
773def note_bad_memaccess_silence : Note<
774  "explicitly cast the pointer to silence this warning">;
775def warn_sizeof_pointer_expr_memaccess : Warning<
776  "'%0' call operates on objects of type %1 while the size is based on a "
777  "different type %2">,
778  InGroup<SizeofPointerMemaccess>;
779def warn_sizeof_pointer_expr_memaccess_note : Note<
780  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
781  "it by the number of elements)|remove the addressof in the argument to "
782  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
783  "length}0?">;
784def warn_sizeof_pointer_type_memaccess : Warning<
785  "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
786  "%select{destination|source}2; expected %3 or an explicit length">,
787  InGroup<SizeofPointerMemaccess>;
788def warn_strlcpycat_wrong_size : Warning<
789  "size argument in %0 call appears to be size of the source; "
790  "expected the size of the destination">,
791  InGroup<DiagGroup<"strlcpy-strlcat-size">>;
792def note_strlcpycat_wrong_size : Note<
793  "change size argument to be the size of the destination">;
794def warn_memsize_comparison : Warning<
795  "size argument in %0 call is a comparison">,
796  InGroup<DiagGroup<"memsize-comparison">>;
797def note_memsize_comparison_paren : Note<
798  "did you mean to compare the result of %0 instead?">;
799def note_memsize_comparison_cast_silence : Note<
800  "explicitly cast the argument to size_t to silence this warning">;
801def warn_suspicious_sizeof_memset : Warning<
802  "%select{'size' argument to memset is '0'|"
803  "setting buffer to a 'sizeof' expression}0"
804  "; did you mean to transpose the last two arguments?">,
805  InGroup<MemsetTransposedArgs>;
806def note_suspicious_sizeof_memset_silence : Note<
807  "%select{parenthesize the third argument|"
808  "cast the second argument to 'int'}0 to silence">;
809def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
810  InGroup<SuspiciousBzero>;
811def note_suspicious_bzero_size_silence : Note<
812  "parenthesize the second argument to silence">;
813
814def warn_strncat_large_size : Warning<
815  "the value of the size argument in 'strncat' is too large, might lead to a "
816  "buffer overflow">, InGroup<StrncatSize>;
817def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
818  "to be size of the source">, InGroup<StrncatSize>;
819def warn_strncat_wrong_size : Warning<
820  "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
821def note_strncat_wrong_size : Note<
822  "change the argument to be the free space in the destination buffer minus "
823  "the terminating null byte">;
824
825def warn_assume_side_effects : Warning<
826  "the argument to %0 has side effects that will be discarded">,
827  InGroup<DiagGroup<"assume">>;
828def warn_assume_attribute_string_unknown : Warning<
829  "unknown assumption string '%0'; attribute is potentially ignored">,
830  InGroup<UnknownAssumption>;
831def warn_assume_attribute_string_unknown_suggested : Warning<
832  "unknown assumption string '%0' may be misspelled; attribute is potentially "
833  "ignored, did you mean '%1'?">,
834  InGroup<MisspelledAssumption>;
835
836def warn_builtin_chk_overflow : Warning<
837  "'%0' will always overflow; destination buffer has size %1,"
838  " but size argument is %2">,
839  InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
840
841def warn_fortify_source_overflow
842  : Warning<warn_builtin_chk_overflow.Summary>, InGroup<FortifySource>;
843def warn_fortify_source_size_mismatch : Warning<
844  "'%0' size argument is too large; destination buffer has size %1,"
845  " but size argument is %2">, InGroup<FortifySource>;
846
847def warn_fortify_strlen_overflow: Warning<
848  "'%0' will always overflow; destination buffer has size %1,"
849  " but the source string has length %2 (including NUL byte)">,
850  InGroup<FortifySource>;
851
852def warn_fortify_source_format_overflow : Warning<
853  "'%0' will always overflow; destination buffer has size %1,"
854  " but format string expands to at least %2">,
855  InGroup<FortifySource>;
856
857def warn_fortify_scanf_overflow : Warning<
858  "'%0' may overflow; destination buffer in argument %1 has size "
859  "%2, but the corresponding specifier may require size %3">,
860  InGroup<FortifySource>;
861
862def err_function_start_invalid_type: Error<
863  "argument must be a function">;
864
865/// main()
866// static main() is not an error in C, just in C++.
867def warn_static_main : Warning<"'main' should not be declared static">,
868    InGroup<Main>;
869def err_static_main : Error<"'main' is not allowed to be declared static">;
870def err_inline_main : Error<"'main' is not allowed to be declared inline">;
871def ext_variadic_main : ExtWarn<
872  "'main' is not allowed to be declared variadic">, InGroup<Main>;
873def ext_noreturn_main : ExtWarn<
874  "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
875def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
876def err_constexpr_main : Error<
877  "'main' is not allowed to be declared %select{constexpr|consteval}0">;
878def err_deleted_main : Error<"'main' is not allowed to be deleted">;
879def err_mainlike_template_decl : Error<"%0 cannot be a template">;
880def err_main_returns_nonint : Error<"'main' must return 'int'">;
881def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
882    InGroup<MainReturnType>;
883def note_main_change_return_type : Note<"change return type to 'int'">;
884def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
885    "must be 0, 2, or 3">;
886def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
887    InGroup<Main>;
888def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
889    "parameter of 'main' (%select{argument count|argument array|environment|"
890    "platform-specific data}0) must be of type %1">;
891def warn_main_returns_bool_literal : Warning<"bool literal returned from "
892    "'main'">, InGroup<Main>;
893def err_main_global_variable :
894    Error<"main cannot be declared as global variable">;
895def warn_main_redefined : Warning<"variable named 'main' with external linkage "
896    "has undefined behavior">, InGroup<Main>;
897def ext_main_used : Extension<
898  "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
899
900/// parser diagnostics
901def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
902  InGroup<MissingDeclarations>;
903def err_no_declarators : Error<"declaration does not declare anything">;
904def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
905  InGroup<MissingDeclarations>;
906def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
907
908def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
909  "anonymous non-C-compatible type given name for linkage purposes "
910  "by %select{typedef|alias}0 declaration; "
911  "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
912def err_non_c_like_anon_struct_in_typedef : Error<
913  "anonymous non-C-compatible type given name for linkage purposes "
914  "by %select{typedef|alias}0 declaration after its linkage was computed; "
915  "add a tag name here to establish linkage prior to definition">;
916def err_typedef_changes_linkage : Error<
917  "unsupported: anonymous type given name for linkage purposes "
918  "by %select{typedef|alias}0 declaration after its linkage was computed; "
919  "add a tag name here to establish linkage prior to definition">;
920def note_non_c_like_anon_struct : Note<
921  "type is not C-compatible due to this "
922  "%select{base class|default member initializer|lambda expression|"
923  "friend declaration|member declaration}0">;
924def note_typedef_for_linkage_here : Note<
925  "type is given name %0 for linkage purposes by this "
926  "%select{typedef|alias}1 declaration">;
927
928def err_statically_allocated_object : Error<
929  "interface type cannot be statically allocated">;
930def err_object_cannot_be_passed_returned_by_value : Error<
931  "interface type %1 cannot be %select{returned|passed}0 by value"
932  "; did you forget * in %1?">;
933def err_parameters_retval_cannot_have_fp16_type : Error<
934  "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
935def err_opencl_half_load_store : Error<
936  "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
937  "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
938def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
939def err_opencl_half_declaration : Error<
940  "declaring variable of type %0 is not allowed">;
941def err_opencl_invalid_param : Error<
942  "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
943def err_opencl_invalid_return : Error<
944  "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
945def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
946def warn_pragma_options_align_reset_failed : Warning<
947  "#pragma options align=reset failed: %0">,
948  InGroup<IgnoredPragmas>;
949def err_pragma_options_align_mac68k_target_unsupported : Error<
950  "mac68k alignment pragma is not supported on this target">;
951def warn_pragma_align_not_xl_compatible : Warning<
952  "#pragma align(packed) may not be compatible with objects generated with AIX XL C/C++">,
953  InGroup<AIXCompat>;
954def warn_pragma_pack_invalid_alignment : Warning<
955  "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
956  InGroup<IgnoredPragmas>;
957def err_pragma_pack_invalid_alignment : Error<
958  warn_pragma_pack_invalid_alignment.Summary>;
959def warn_pragma_pack_non_default_at_include : Warning<
960  "non-default #pragma pack value changes the alignment of struct or union "
961  "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
962  DefaultIgnore;
963def warn_pragma_pack_modified_after_include : Warning<
964  "the current #pragma pack alignment value is modified in the included "
965  "file">, InGroup<PragmaPack>;
966def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
967  "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
968def note_pragma_pack_here : Note<
969  "previous '#pragma pack' directive that modifies alignment is here">;
970def note_pragma_pack_pop_instead_reset : Note<
971  "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
972// Follow the Microsoft implementation.
973def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
974def warn_pragma_pack_pop_identifier_and_alignment : Warning<
975  "specifying both a name and alignment to 'pop' is undefined">;
976def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
977  InGroup<IgnoredPragmas>;
978def err_pragma_fc_pp_scope : Error<
979  "'#pragma float_control push/pop' can only appear at file or namespace scope "
980  "or within a language linkage specification">;
981def err_pragma_fc_noprecise_requires_nofenv : Error<
982  "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
983def err_pragma_fc_except_requires_precise : Error<
984  "'#pragma float_control(except, on)' is illegal when precise is disabled">;
985def err_pragma_fc_noprecise_requires_noexcept : Error<
986  "'#pragma float_control(precise, off)' is illegal when except is enabled">;
987def err_pragma_fenv_requires_precise : Error<
988  "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
989def warn_cxx_ms_struct :
990  Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
991          "with base classes or virtual functions">,
992  DefaultError, InGroup<IncompatibleMSStruct>;
993def err_pragma_pack_identifer_not_supported : Error<
994  "specifying an identifier within `#pragma pack` is not supported on this target">;
995def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
996def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
997def err_invalid_super_scope : Error<"invalid use of '__super', "
998  "this keyword can only be used inside class or member function scope">;
999def err_super_in_lambda_unsupported : Error<
1000  "use of '__super' inside a lambda is unsupported">;
1001
1002def err_pragma_expected_file_scope : Error<
1003  "'#pragma %0' can only appear at file scope">;
1004def err_pragma_alloc_text_c_linkage: Error<
1005  "'#pragma alloc_text' is applicable only to functions with C linkage">;
1006def err_pragma_alloc_text_not_function: Error<
1007  "'#pragma alloc_text' is applicable only to functions">;
1008
1009def warn_pragma_unused_undeclared_var : Warning<
1010  "undeclared variable %0 used as an argument for '#pragma unused'">,
1011  InGroup<IgnoredPragmas>;
1012def warn_atl_uuid_deprecated : Warning<
1013  "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
1014  InGroup<DeprecatedDeclarations>;
1015def warn_pragma_unused_expected_var_arg : Warning<
1016  "only variables can be arguments to '#pragma unused'">,
1017  InGroup<IgnoredPragmas>;
1018def err_pragma_push_visibility_mismatch : Error<
1019  "#pragma visibility push with no matching #pragma visibility pop">;
1020def note_surrounding_namespace_ends_here : Note<
1021  "surrounding namespace with visibility attribute ends here">;
1022def err_pragma_pop_visibility_mismatch : Error<
1023  "#pragma visibility pop with no matching #pragma visibility push">;
1024def note_surrounding_namespace_starts_here : Note<
1025  "surrounding namespace with visibility attribute starts here">;
1026def err_pragma_loop_invalid_argument_type : Error<
1027  "invalid argument of type %0; expected an integer type">;
1028def err_pragma_loop_invalid_argument_value : Error<
1029  "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
1030def err_pragma_loop_compatibility : Error<
1031  "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
1032def err_pragma_loop_precedes_nonloop : Error<
1033  "expected a for, while, or do-while loop to follow '%0'">;
1034
1035def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
1036  "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
1037  "those declarations">;
1038def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
1039  "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
1040def err_pragma_attribute_invalid_matchers : Error<
1041  "attribute %0 can't be applied to %1">;
1042def err_pragma_attribute_stack_mismatch : Error<
1043  "'#pragma clang attribute %select{%1.|}0pop' with no matching"
1044  " '#pragma clang attribute %select{%1.|}0push'">;
1045def warn_pragma_attribute_unused : Warning<
1046  "unused attribute %0 in '#pragma clang attribute push' region">,
1047  InGroup<PragmaClangAttribute>;
1048def note_pragma_attribute_region_ends_here : Note<
1049  "'#pragma clang attribute push' regions ends here">;
1050def err_pragma_attribute_no_pop_eof : Error<"unterminated "
1051  "'#pragma clang attribute push' at end of file">;
1052def note_pragma_attribute_applied_decl_here : Note<
1053  "when applied to this declaration">;
1054def err_pragma_attr_attr_no_push : Error<
1055  "'#pragma clang attribute' attribute with no matching "
1056  "'#pragma clang attribute push'">;
1057
1058/// Objective-C parser diagnostics
1059def err_duplicate_class_def : Error<
1060  "duplicate interface definition for class %0">;
1061def err_undef_superclass : Error<
1062  "cannot find interface declaration for %0, superclass of %1">;
1063def err_forward_superclass : Error<
1064  "attempting to use the forward class %0 as superclass of %1">;
1065def err_no_nsconstant_string_class : Error<
1066  "cannot find interface declaration for %0">;
1067def err_recursive_superclass : Error<
1068  "trying to recursively use %0 as superclass of %1">;
1069def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
1070def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
1071def warn_duplicate_protocol_def : Warning<
1072  "duplicate protocol definition of %0 is ignored">,
1073  InGroup<DiagGroup<"duplicate-protocol">>;
1074def err_protocol_has_circular_dependency : Error<
1075  "protocol has circular dependency">;
1076def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
1077def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
1078def err_atprotocol_protocol : Error<
1079  "@protocol is using a forward protocol declaration of %0">;
1080def warn_readonly_property : Warning<
1081  "attribute 'readonly' of property %0 restricts attribute "
1082  "'readwrite' of property inherited from %1">,
1083  InGroup<PropertyAttr>;
1084
1085def warn_property_attribute : Warning<
1086  "'%1' attribute on property %0 does not match the property inherited from %2">,
1087  InGroup<PropertyAttr>;
1088def warn_property_types_are_incompatible : Warning<
1089  "property type %0 is incompatible with type %1 inherited from %2">,
1090  InGroup<DiagGroup<"incompatible-property-type">>;
1091def warn_protocol_property_mismatch : Warning<
1092  "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
1093  "getter %1|with setter %1}0 was selected for synthesis">,
1094  InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
1095def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Summary>;
1096def err_undef_interface : Error<"cannot find interface declaration for %0">;
1097def err_category_forward_interface : Error<
1098  "cannot define %select{category|class extension}0 for undefined class %1">;
1099def err_class_extension_after_impl : Error<
1100  "cannot declare class extension for %0 after class implementation">;
1101def note_implementation_declared : Note<
1102  "class implementation is declared here">;
1103def note_while_in_implementation : Note<
1104  "detected while default synthesizing properties in class implementation">;
1105def note_class_declared : Note<
1106  "class is declared here">;
1107def note_receiver_class_declared : Note<
1108  "receiver is instance of class declared here">;
1109def note_receiver_expr_here : Note<
1110  "receiver expression is here">;
1111def note_receiver_is_id : Note<
1112  "receiver is treated with 'id' type for purpose of method lookup">;
1113def note_suppressed_class_declare : Note<
1114  "class with specified objc_requires_property_definitions attribute is declared here">;
1115def err_objc_root_class_subclass : Error<
1116  "objc_root_class attribute may only be specified on a root class declaration">;
1117def err_restricted_superclass_mismatch : Error<
1118  "cannot subclass a class that was declared with the "
1119  "'objc_subclassing_restricted' attribute">;
1120def err_class_stub_subclassing_mismatch : Error<
1121  "'objc_class_stub' attribute cannot be specified on a class that does not "
1122  "have the 'objc_subclassing_restricted' attribute">;
1123def err_implementation_of_class_stub : Error<
1124  "cannot declare implementation of a class declared with the "
1125  "'objc_class_stub' attribute">;
1126def warn_objc_root_class_missing : Warning<
1127  "class %0 defined without specifying a base class">,
1128  InGroup<ObjCRootClass>;
1129def err_objc_runtime_visible_category : Error<
1130  "cannot implement a category for class %0 that is only visible via the "
1131  "Objective-C runtime">;
1132def err_objc_runtime_visible_subclass : Error<
1133  "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1134  "Objective-C runtime">;
1135def note_objc_needs_superclass : Note<
1136  "add a super class to fix this problem">;
1137def err_conflicting_super_class : Error<"conflicting super class name %0">;
1138def err_dup_implementation_class : Error<"reimplementation of class %0">;
1139def err_dup_implementation_category : Error<
1140  "reimplementation of category %1 for class %0">;
1141def err_conflicting_ivar_type : Error<
1142  "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1143def err_duplicate_ivar_declaration : Error<
1144  "instance variable is already declared">;
1145def warn_on_superclass_use : Warning<
1146  "class implementation may not have super class">;
1147def err_conflicting_ivar_bitwidth : Error<
1148  "instance variable %0 has conflicting bit-field width">;
1149def err_conflicting_ivar_name : Error<
1150  "conflicting instance variable names: %0 vs %1">;
1151def err_inconsistent_ivar_count : Error<
1152  "inconsistent number of instance variables specified">;
1153def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1154  InGroup<DiagGroup<"incomplete-implementation">>;
1155def warn_objc_boxing_invalid_utf8_string : Warning<
1156  "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1157  InGroup<ObjCBoxing>;
1158
1159def err_objc_non_runtime_protocol_in_protocol_expr : Error<
1160  "cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression">;
1161def err_objc_direct_on_protocol : Error<
1162  "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1163  "declared in an Objective-C protocol">;
1164def err_objc_direct_duplicate_decl : Error<
1165  "%select{|direct }0%select{method|property}1 declaration conflicts "
1166  "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1167def err_objc_direct_impl_decl_mismatch : Error<
1168  "direct method was declared in %select{the primary interface|an extension|a category}0 "
1169  "but is implemented in %select{the primary interface|a category|a different category}1">;
1170def err_objc_direct_missing_on_decl : Error<
1171  "direct method implementation was previously declared not direct">;
1172def err_objc_direct_on_override : Error<
1173  "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1174def err_objc_override_direct_method : Error<
1175  "cannot override a method that is declared direct by a superclass">;
1176def warn_objc_direct_ignored : Warning<
1177  "%0 attribute isn't implemented by this Objective-C runtime">,
1178  InGroup<IgnoredAttributes>;
1179def warn_objc_direct_property_ignored : Warning<
1180  "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1181  InGroup<IgnoredAttributes>;
1182def err_objc_direct_dynamic_property : Error<
1183  "direct property cannot be @dynamic">;
1184def err_objc_direct_protocol_conformance : Error<
1185  "%select{category %1|class extension}0 cannot conform to protocol %2 because "
1186  "of direct members declared in interface %3">;
1187def note_direct_member_here : Note<"direct member declared here">;
1188
1189def warn_conflicting_overriding_ret_types : Warning<
1190  "conflicting return type in "
1191  "declaration of %0%diff{: $ vs $|}1,2">,
1192  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1193
1194def warn_conflicting_ret_types : Warning<
1195  "conflicting return type in "
1196  "implementation of %0%diff{: $ vs $|}1,2">,
1197  InGroup<MismatchedReturnTypes>;
1198
1199def warn_conflicting_overriding_ret_type_modifiers : Warning<
1200  "conflicting distributed object modifiers on return type "
1201  "in declaration of %0">,
1202  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1203
1204def warn_conflicting_ret_type_modifiers : Warning<
1205  "conflicting distributed object modifiers on return type "
1206  "in implementation of %0">,
1207  InGroup<DistributedObjectModifiers>;
1208
1209def warn_non_covariant_overriding_ret_types : Warning<
1210  "conflicting return type in "
1211  "declaration of %0: %1 vs %2">,
1212  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1213
1214def warn_non_covariant_ret_types : Warning<
1215  "conflicting return type in "
1216  "implementation of %0: %1 vs %2">,
1217  InGroup<MethodSignatures>, DefaultIgnore;
1218
1219def warn_conflicting_overriding_param_types : Warning<
1220  "conflicting parameter types in "
1221  "declaration of %0%diff{: $ vs $|}1,2">,
1222  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1223
1224def warn_conflicting_param_types : Warning<
1225  "conflicting parameter types in "
1226  "implementation of %0%diff{: $ vs $|}1,2">,
1227  InGroup<MismatchedParameterTypes>;
1228
1229def warn_conflicting_param_modifiers : Warning<
1230  "conflicting distributed object modifiers on parameter type "
1231  "in implementation of %0">,
1232  InGroup<DistributedObjectModifiers>;
1233
1234def warn_conflicting_overriding_param_modifiers : Warning<
1235  "conflicting distributed object modifiers on parameter type "
1236  "in declaration of %0">,
1237  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1238
1239def warn_non_contravariant_overriding_param_types : Warning<
1240  "conflicting parameter types in "
1241  "declaration of %0: %1 vs %2">,
1242  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1243
1244def warn_non_contravariant_param_types : Warning<
1245  "conflicting parameter types in "
1246  "implementation of %0: %1 vs %2">,
1247  InGroup<MethodSignatures>, DefaultIgnore;
1248
1249def warn_conflicting_overriding_variadic :Warning<
1250  "conflicting variadic declaration of method and its "
1251  "implementation">,
1252  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1253
1254def warn_conflicting_variadic :Warning<
1255  "conflicting variadic declaration of method and its "
1256  "implementation">;
1257
1258def warn_category_method_impl_match:Warning<
1259  "category is implementing a method which will also be implemented"
1260  " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1261
1262def warn_implements_nscopying : Warning<
1263"default assign attribute on property %0 which implements "
1264"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1265
1266def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1267  InGroup<ObjCMultipleMethodNames>;
1268def warn_strict_multiple_method_decl : Warning<
1269  "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1270def warn_accessor_property_type_mismatch : Warning<
1271  "type of property %0 does not match type of accessor %1">;
1272def note_conv_function_declared_at : Note<"type conversion function declared here">;
1273def note_method_declared_at : Note<"method %0 declared here">;
1274def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1275def note_property_attribute : Note<"property %0 is declared "
1276  "%select{deprecated|unavailable|partial}1 here">;
1277def err_setter_type_void : Error<"type of setter must be void">;
1278def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1279def warn_duplicate_method_decl :
1280  Warning<"multiple declarations of method %0 found and ignored">,
1281  InGroup<MethodDuplicate>, DefaultIgnore;
1282def warn_objc_cdirective_format_string :
1283  Warning<"using %0 directive in %select{NSString|CFString}1 "
1284          "which is being passed as a formatting argument to the formatting "
1285          "%select{method|CFfunction}2">,
1286  InGroup<ObjCCStringFormat>, DefaultIgnore;
1287def err_objc_var_decl_inclass :
1288    Error<"cannot declare variable inside @interface or @protocol">;
1289def err_missing_method_context : Error<
1290  "missing context for method declaration">;
1291def err_objc_property_attr_mutually_exclusive : Error<
1292  "property attributes '%0' and '%1' are mutually exclusive">;
1293def err_objc_property_requires_object : Error<
1294  "property with '%0' attribute must be of object type">;
1295def warn_objc_property_assign_on_object : Warning<
1296  "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1297  InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1298def warn_objc_property_no_assignment_attribute : Warning<
1299  "no 'assign', 'retain', or 'copy' attribute is specified - "
1300  "'assign' is assumed">,
1301  InGroup<ObjCPropertyNoAttribute>;
1302def warn_objc_isa_use : Warning<
1303  "direct access to Objective-C's isa is deprecated in favor of "
1304  "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1305def warn_objc_isa_assign : Warning<
1306  "assignment to Objective-C's isa is deprecated in favor of "
1307  "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1308def warn_objc_pointer_masking : Warning<
1309  "bitmasking for introspection of Objective-C object pointers is strongly "
1310  "discouraged">,
1311  InGroup<ObjCPointerIntrospect>;
1312def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Summary>,
1313  InGroup<ObjCPointerIntrospectPerformSelector>;
1314def warn_objc_property_default_assign_on_object : Warning<
1315  "default property attribute 'assign' not appropriate for object">,
1316  InGroup<ObjCPropertyNoAttribute>;
1317def warn_property_attr_mismatch : Warning<
1318  "property attribute in class extension does not match the primary class">,
1319  InGroup<PropertyAttr>;
1320def warn_property_implicitly_mismatched : Warning <
1321  "primary property declaration is implicitly strong while redeclaration "
1322  "in class extension is weak">,
1323  InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1324def warn_objc_property_copy_missing_on_block : Warning<
1325    "'copy' attribute must be specified for the block property "
1326    "when -fobjc-gc-only is specified">;
1327def warn_objc_property_retain_of_block : Warning<
1328    "retain'ed block property does not copy the block "
1329    "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1330def warn_objc_readonly_property_has_setter : Warning<
1331    "setter cannot be specified for a readonly property">,
1332    InGroup<ObjCReadonlyPropertyHasSetter>;
1333def warn_atomic_property_rule : Warning<
1334  "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1335  "with a user defined %select{getter|setter}2">,
1336  InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1337def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1338  "synthesized, or both be user defined, or the property must be nonatomic">;
1339def err_atomic_property_nontrivial_assign_op : Error<
1340  "atomic property of reference type %0 cannot have non-trivial assignment"
1341  " operator">;
1342def warn_cocoa_naming_owned_rule : Warning<
1343  "property follows Cocoa naming"
1344  " convention for returning 'owned' objects">,
1345  InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1346def err_cocoa_naming_owned_rule : Error<
1347  "property follows Cocoa naming"
1348  " convention for returning 'owned' objects">;
1349def note_cocoa_naming_declare_family : Note<
1350  "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1351  "object">;
1352def warn_auto_synthesizing_protocol_property :Warning<
1353  "auto property synthesis will not synthesize property %0"
1354  " declared in protocol %1">,
1355  InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1356def note_add_synthesize_directive : Note<
1357  "add a '@synthesize' directive">;
1358def warn_no_autosynthesis_shared_ivar_property : Warning <
1359  "auto property synthesis will not synthesize property "
1360  "%0 because it cannot share an ivar with another synthesized property">,
1361  InGroup<ObjCNoPropertyAutoSynthesis>;
1362def warn_no_autosynthesis_property : Warning<
1363  "auto property synthesis will not synthesize property "
1364  "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1365  "via another property">,
1366  InGroup<ObjCNoPropertyAutoSynthesis>;
1367def warn_autosynthesis_property_in_superclass : Warning<
1368  "auto property synthesis will not synthesize property "
1369  "%0; it will be implemented by its superclass, use @dynamic to "
1370  "acknowledge intention">,
1371  InGroup<ObjCNoPropertyAutoSynthesis>;
1372def warn_autosynthesis_property_ivar_match :Warning<
1373  "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1374  "%2, not existing instance variable %3">,
1375  InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1376def warn_missing_explicit_synthesis : Warning <
1377  "auto property synthesis is synthesizing property not explicitly synthesized">,
1378  InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1379def warn_property_getter_owning_mismatch : Warning<
1380  "property declared as returning non-retained objects"
1381  "; getter returning retained objects">;
1382def warn_property_redecl_getter_mismatch : Warning<
1383  "getter name mismatch between property redeclaration (%1) and its original "
1384  "declaration (%0)">, InGroup<PropertyAttr>;
1385def err_property_setter_ambiguous_use : Error<
1386  "synthesized properties %0 and %1 both claim setter %2 -"
1387  " use of this setter will cause unexpected behavior">;
1388def warn_default_atomic_custom_getter_setter : Warning<
1389  "atomic by default property %0 has a user defined %select{getter|setter}1 "
1390  "(property should be marked 'atomic' if this is intended)">,
1391  InGroup<CustomAtomic>, DefaultIgnore;
1392def err_use_continuation_class : Error<
1393  "illegal redeclaration of property in class extension %0"
1394  " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1395def err_type_mismatch_continuation_class : Error<
1396  "type of property %0 in class extension does not match "
1397  "property type in primary class">;
1398def err_use_continuation_class_redeclaration_readwrite : Error<
1399  "illegal redeclaration of 'readwrite' property in class extension %0"
1400  " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1401  "'readonly' public property?)">;
1402def err_continuation_class : Error<"class extension has no primary class">;
1403def err_property_type : Error<"property cannot have array or function type %0">;
1404def err_missing_property_context : Error<
1405  "missing context for property implementation declaration">;
1406def err_bad_property_decl : Error<
1407  "property implementation must have its declaration in interface %0 or one of "
1408  "its extensions">;
1409def err_category_property : Error<
1410  "property declared in category %0 cannot be implemented in "
1411  "class implementation">;
1412def note_property_declare : Note<
1413  "property declared here">;
1414def note_protocol_property_declare : Note<
1415  "it could also be property "
1416  "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1417  "%1|with setter %1}0 declared here">;
1418def note_property_synthesize : Note<
1419  "property synthesized here">;
1420def err_synthesize_category_decl : Error<
1421  "@synthesize not allowed in a category's implementation">;
1422def err_synthesize_on_class_property : Error<
1423  "@synthesize not allowed on a class property %0">;
1424def err_missing_property_interface : Error<
1425  "property implementation in a category with no category declaration">;
1426def err_bad_category_property_decl : Error<
1427  "property implementation must have its declaration in the category %0">;
1428def err_bad_property_context : Error<
1429  "property implementation must be in a class or category implementation">;
1430def err_missing_property_ivar_decl : Error<
1431  "synthesized property %0 must either be named the same as a compatible"
1432  " instance variable or must explicitly name an instance variable">;
1433def err_arc_perform_selector_retains : Error<
1434  "performSelector names a selector which retains the object">;
1435def warn_arc_perform_selector_leaks : Warning<
1436  "performSelector may cause a leak because its selector is unknown">,
1437  InGroup<DiagGroup<"arc-performSelector-leaks">>;
1438def warn_dealloc_in_category : Warning<
1439"-dealloc is being overridden in a category">,
1440InGroup<DeallocInCategory>;
1441def err_gc_weak_property_strong_type : Error<
1442  "weak attribute declared on a __strong type property in GC mode">;
1443def warn_arc_repeated_use_of_weak : Warning <
1444  "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1445  "accessed multiple times in this %select{function|method|block|lambda}2 "
1446  "but may be unpredictably set to nil; assign to a strong variable to keep "
1447  "the object alive">,
1448  InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1449def warn_implicitly_retains_self : Warning <
1450  "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1451  "this is intended behavior">,
1452  InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1453def warn_arc_possible_repeated_use_of_weak : Warning <
1454  "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1455  "be accessed multiple times in this %select{function|method|block|lambda}2 "
1456  "and may be unpredictably set to nil; assign to a strong variable to keep "
1457  "the object alive">,
1458  InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1459def note_arc_weak_also_accessed_here : Note<
1460  "also accessed here">;
1461def err_incomplete_synthesized_property : Error<
1462  "cannot synthesize property %0 with incomplete type %1">;
1463
1464def err_property_ivar_type : Error<
1465  "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1466def err_property_accessor_type : Error<
1467  "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1468def err_ivar_in_superclass_use : Error<
1469  "property %0 attempting to use instance variable %1 declared in super class %2">;
1470def err_weak_property : Error<
1471  "existing instance variable %1 for __weak property %0 must be __weak">;
1472def err_strong_property : Error<
1473  "existing instance variable %1 for strong property %0 may not be __weak">;
1474def err_dynamic_property_ivar_decl : Error<
1475  "dynamic property cannot have instance variable specification">;
1476def err_duplicate_ivar_use : Error<
1477  "synthesized properties %0 and %1 both claim instance variable %2">;
1478def err_property_implemented : Error<"property %0 is already implemented">;
1479def warn_objc_missing_super_call : Warning<
1480  "method possibly missing a [super %0] call">,
1481  InGroup<ObjCMissingSuperCalls>;
1482def err_dealloc_bad_result_type : Error<
1483  "dealloc return type must be correctly specified as 'void' under ARC, "
1484  "instead of %0">;
1485def warn_undeclared_selector : Warning<
1486  "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1487def warn_undeclared_selector_with_typo : Warning<
1488  "undeclared selector %0; did you mean %1?">,
1489  InGroup<UndeclaredSelector>, DefaultIgnore;
1490def warn_implicit_atomic_property : Warning<
1491  "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1492def note_auto_readonly_iboutlet_fixup_suggest : Note<
1493  "property should be changed to be readwrite">;
1494def warn_auto_readonly_iboutlet_property : Warning<
1495  "readonly IBOutlet property %0 when auto-synthesized may "
1496  "not work correctly with 'nib' loader">,
1497  InGroup<DiagGroup<"readonly-iboutlet-property">>;
1498def warn_auto_implicit_atomic_property : Warning<
1499  "property is assumed atomic when auto-synthesizing the property">,
1500  InGroup<ImplicitAtomic>, DefaultIgnore;
1501def warn_unimplemented_selector:  Warning<
1502  "no method with selector %0 is implemented in this translation unit">,
1503  InGroup<Selector>, DefaultIgnore;
1504def warn_unimplemented_protocol_method : Warning<
1505  "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1506def warn_multiple_selectors: Warning<
1507  "several methods with selector %0 of mismatched types are found "
1508  "for the @selector expression">,
1509  InGroup<SelectorTypeMismatch>, DefaultIgnore;
1510def err_direct_selector_expression : Error<
1511  "@selector expression formed with direct selector %0">;
1512def warn_potentially_direct_selector_expression : Warning<
1513  "@selector expression formed with potentially direct selector %0">,
1514  InGroup<ObjCPotentiallyDirectSelector>;
1515def warn_strict_potentially_direct_selector_expression : Warning<
1516  warn_potentially_direct_selector_expression.Summary>,
1517  InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1518
1519def err_objc_kindof_nonobject : Error<
1520  "'__kindof' specifier cannot be applied to non-object type %0">;
1521def err_objc_kindof_wrong_position : Error<
1522  "'__kindof' type specifier must precede the declarator">;
1523
1524def err_objc_method_unsupported_param_ret_type : Error<
1525  "%0 %select{parameter|return}1 type is unsupported; "
1526  "support for vector types for this target is introduced in %2">;
1527
1528def warn_messaging_unqualified_id : Warning<
1529  "messaging unqualified id">, DefaultIgnore,
1530  InGroup<DiagGroup<"objc-messaging-id">>;
1531def err_messaging_unqualified_id_with_direct_method : Error<
1532  "messaging unqualified id with a method that is possibly direct">;
1533def err_messaging_super_with_direct_method : Error<
1534  "messaging super with a direct method">;
1535def err_messaging_class_with_direct_method : Error<
1536  "messaging a Class with a method that is possibly direct">;
1537
1538// C++ declarations
1539def err_static_assert_expression_is_not_constant : Error<
1540  "static assertion expression is not an integral constant expression">;
1541def err_constexpr_if_condition_expression_is_not_constant : Error<
1542  "constexpr if condition is not a constant expression">;
1543def err_static_assert_failed : Error<"static assertion failed%select{: %1|}0">;
1544def err_static_assert_requirement_failed : Error<
1545  "static assertion failed due to requirement '%0'%select{: %2|}1">;
1546def note_expr_evaluates_to : Note<
1547  "expression evaluates to '%0 %1 %2'">;
1548def err_static_assert_invalid_message : Error<
1549  "the message in a static assertion must be a string literal or an "
1550  "object with 'data()' and 'size()' member functions">;
1551def err_static_assert_missing_member_function : Error<
1552  "the message object in this static assertion is missing %select{"
1553  "a 'size()' member function|"
1554  "a 'data()' member function|"
1555  "'data()' and 'size()' member functions}0">;
1556def err_static_assert_invalid_mem_fn_ret_ty : Error<
1557  "the message in a static assertion must have a '%select{size|data}0()' member "
1558  "function returning an object convertible to '%select{std::size_t|const char *}0'">;
1559def warn_static_assert_message_constexpr : Warning<
1560  "the message in this static assertion is not a "
1561  "constant expression">,
1562  DefaultError, InGroup<DiagGroup<"invalid-static-assert-message">>;
1563def err_static_assert_message_constexpr : Error<
1564  "the message in a static assertion must be produced by a "
1565  "constant expression">;
1566
1567def warn_consteval_if_always_true : Warning<
1568  "consteval if is always true in an %select{unevaluated|immediate}0 context">,
1569  InGroup<DiagGroup<"redundant-consteval-if">>;
1570
1571def ext_inline_variable : ExtWarn<
1572  "inline variables are a C++17 extension">, InGroup<CXX17>;
1573def warn_cxx14_compat_inline_variable : Warning<
1574  "inline variables are incompatible with C++ standards before C++17">,
1575  DefaultIgnore, InGroup<CXXPre17Compat>;
1576
1577def warn_inline_namespace_reopened_noninline : Warning<
1578  "inline namespace reopened as a non-inline namespace">,
1579  InGroup<InlineNamespaceReopenedNoninline>;
1580def err_inline_namespace_mismatch : Error<
1581  "non-inline namespace cannot be reopened as inline">;
1582def err_inline_namespace_std : Error<
1583  "cannot declare the namespace 'std' to be inline">;
1584
1585def err_unexpected_friend : Error<
1586  "friends can only be classes or functions">;
1587def ext_enum_friend : ExtWarn<
1588  "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1589def warn_cxx98_compat_enum_friend : Warning<
1590  "befriending enumeration type %0 is incompatible with C++98">,
1591  InGroup<CXX98Compat>, DefaultIgnore;
1592def ext_nonclass_type_friend : ExtWarn<
1593  "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1594def warn_cxx98_compat_nonclass_type_friend : Warning<
1595  "non-class friend type %0 is incompatible with C++98">,
1596  InGroup<CXX98Compat>, DefaultIgnore;
1597def err_friend_is_member : Error<
1598  "friends cannot be members of the declaring class">;
1599def warn_cxx98_compat_friend_is_member : Warning<
1600  "friend declaration naming a member of the declaring class is incompatible "
1601  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1602def ext_unelaborated_friend_type : ExtWarn<
1603  "unelaborated friend declaration is a C++11 extension; specify "
1604  "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1605  InGroup<CXX11>;
1606def warn_cxx98_compat_unelaborated_friend_type : Warning<
1607  "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1608  "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1609def err_qualified_friend_no_match : Error<
1610  "friend declaration of %0 does not match any declaration in %1">;
1611def err_introducing_special_friend : Error<
1612  "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1613  " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1614  "as a friend">;
1615def err_tagless_friend_type_template : Error<
1616  "friend type templates must use an elaborated type">;
1617def err_no_matching_local_friend : Error<
1618  "no matching function found in local scope">;
1619def err_no_matching_local_friend_suggest : Error<
1620  "no matching function %0 found in local scope; did you mean %3?">;
1621def err_partial_specialization_friend : Error<
1622  "partial specialization cannot be declared as a friend">;
1623def err_qualified_friend_def : Error<
1624  "friend function definition cannot be qualified with '%0'">;
1625def err_friend_def_in_local_class : Error<
1626  "friend function cannot be defined in a local class">;
1627def err_friend_not_first_in_declaration : Error<
1628  "'friend' must appear first in a non-function declaration">;
1629def err_using_decl_friend : Error<
1630  "cannot befriend target of using declaration">;
1631def warn_template_qualified_friend_unsupported : Warning<
1632  "dependent nested name specifier '%0' for friend class declaration is "
1633  "not supported; turning off access control for %1">,
1634  InGroup<UnsupportedFriend>;
1635def warn_template_qualified_friend_ignored : Warning<
1636  "dependent nested name specifier '%0' for friend template declaration is "
1637  "not supported; ignoring this friend declaration">,
1638  InGroup<UnsupportedFriend>;
1639def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1640  "unqualified friend declaration referring to type outside of the nearest "
1641  "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1642  InGroup<MicrosoftUnqualifiedFriend>;
1643def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1644
1645def err_invalid_base_in_interface : Error<
1646  "interface type cannot inherit from "
1647  "%select{struct|non-public interface|class}0 %1">;
1648
1649def err_abstract_type_in_decl : Error<
1650  "%select{return|parameter|variable|field|instance variable|"
1651  "synthesized instance variable}0 type %1 is an abstract class">;
1652def err_allocation_of_abstract_type : Error<
1653  "allocating an object of abstract class type %0">;
1654def err_throw_abstract_type : Error<
1655  "cannot throw an object of abstract type %0">;
1656def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1657def err_capture_of_abstract_type : Error<
1658  "by-copy capture of value of abstract type %0">;
1659def err_capture_of_incomplete_or_sizeless_type : Error<
1660  "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1661def err_capture_default_non_local : Error<
1662  "non-local lambda expression cannot have a capture-default">;
1663
1664def err_multiple_final_overriders : Error<
1665  "virtual function %q0 has more than one final overrider in %1">;
1666def note_final_overrider : Note<"final overrider of %q0 in %1">;
1667
1668def err_type_defined_in_type_specifier : Error<
1669  "%0 cannot be defined in a type specifier">;
1670def err_type_defined_in_result_type : Error<
1671  "%0 cannot be defined in the result type of a function">;
1672def err_type_defined_in_param_type : Error<
1673  "%0 cannot be defined in a parameter type">;
1674def err_type_defined_in_alias_template : Error<
1675  "%0 cannot be defined in a type alias template">;
1676def err_type_defined_in_condition : Error<
1677  "%0 cannot be defined in a condition">;
1678def err_type_defined_in_enum : Error<
1679  "%0 cannot be defined in an enumeration">;
1680def ext_type_defined_in_offsetof : Extension<
1681  "defining a type within '%select{__builtin_offsetof|offsetof}0' is a Clang "
1682  "extension">, InGroup<GNUOffsetofExtensions>;
1683
1684def note_pure_virtual_function : Note<
1685  "unimplemented pure virtual method %0 in %1">;
1686
1687def note_pure_qualified_call_kext : Note<
1688  "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1689
1690def err_deleted_decl_not_first : Error<
1691  "deleted definition must be first declaration">;
1692
1693def err_deleted_override : Error<
1694  "deleted function %0 cannot override a non-deleted function">;
1695def err_non_deleted_override : Error<
1696  "non-deleted function %0 cannot override a deleted function">;
1697def err_consteval_override : Error<
1698  "consteval function %0 cannot override a non-consteval function">;
1699def err_non_consteval_override : Error<
1700  "non-consteval function %0 cannot override a consteval function">;
1701
1702def warn_weak_vtable : Warning<
1703  "%0 has no out-of-line virtual method definitions; its vtable will be "
1704  "emitted in every translation unit">,
1705  InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1706def warn_weak_template_vtable : Warning<
1707  "this warning is no longer in use and will be removed in the next release">,
1708  InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1709
1710def ext_using_undefined_std : ExtWarn<
1711  "using directive refers to implicitly-defined namespace 'std'">;
1712
1713// C++ exception specifications
1714def err_exception_spec_in_typedef : Error<
1715  "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1716def err_distant_exception_spec : Error<
1717  "exception specifications are not allowed beyond a single level "
1718  "of indirection">;
1719def err_incomplete_in_exception_spec : Error<
1720  "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1721  "in exception specification">;
1722def err_sizeless_in_exception_spec : Error<
1723  "%select{|reference to }0sizeless type %1 is not allowed "
1724  "in exception specification">;
1725def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Summary>,
1726  InGroup<MicrosoftExceptionSpec>;
1727def err_rref_in_exception_spec : Error<
1728  "rvalue reference type %0 is not allowed in exception specification">;
1729def err_mismatched_exception_spec : Error<
1730  "exception specification in declaration does not match previous declaration">;
1731def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Summary>,
1732  InGroup<MicrosoftExceptionSpec>;
1733def err_override_exception_spec : Error<
1734  "exception specification of overriding function is more lax than "
1735  "base version">;
1736def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Summary>,
1737  InGroup<MicrosoftExceptionSpec>;
1738def err_incompatible_exception_specs : Error<
1739  "target exception specification is not superset of source">;
1740def warn_incompatible_exception_specs : Warning<
1741  err_incompatible_exception_specs.Summary>, InGroup<IncompatibleExceptionSpec>;
1742def err_deep_exception_specs_differ : Error<
1743  "exception specifications of %select{return|argument}0 types differ">;
1744def warn_deep_exception_specs_differ : Warning<
1745  err_deep_exception_specs_differ.Summary>, InGroup<IncompatibleExceptionSpec>;
1746def err_missing_exception_specification : Error<
1747  "%0 is missing exception specification '%1'">;
1748def ext_missing_exception_specification : ExtWarn<
1749  err_missing_exception_specification.Summary>,
1750  InGroup<DiagGroup<"missing-exception-spec">>;
1751def err_exception_spec_not_parsed : Error<
1752  "exception specification is not available until end of class definition">;
1753def err_exception_spec_cycle : Error<
1754  "exception specification of %0 uses itself">;
1755def err_exception_spec_incomplete_type : Error<
1756  "exception specification needed for member of incomplete class %0">;
1757def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1758  "dynamic exception specifications with types are currently ignored in wasm">,
1759  InGroup<WebAssemblyExceptionSpec>;
1760
1761// C++ access checking
1762def err_class_redeclared_with_different_access : Error<
1763  "%0 redeclared with '%1' access">;
1764def err_access : Error<
1765  "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1766def ext_ms_using_declaration_inaccessible : ExtWarn<
1767  "using declaration referring to inaccessible member '%0' (which refers "
1768  "to accessible member '%1') is a Microsoft compatibility extension">,
1769    AccessControl, InGroup<MicrosoftUsingDecl>;
1770def err_access_ctor : Error<
1771  "calling a %select{private|protected}0 constructor of class %2">,
1772  AccessControl;
1773def ext_rvalue_to_reference_access_ctor : Extension<
1774  "C++98 requires an accessible copy constructor for class %2 when binding "
1775  "a reference to a temporary; was %select{private|protected}0">,
1776  AccessControl, InGroup<BindToTemporaryCopy>;
1777def err_access_base_ctor : Error<
1778  // The ERRORs represent other special members that aren't constructors, in
1779  // hopes that someone will bother noticing and reporting if they appear
1780  "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1781  "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1782  "|*ERROR*|}2constructor">, AccessControl;
1783def err_access_field_ctor : Error<
1784  // The ERRORs represent other special members that aren't constructors, in
1785  // hopes that someone will bother noticing and reporting if they appear
1786  "field of type %0 has %select{private|protected}2 "
1787  "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1788  AccessControl;
1789def err_access_friend_function : Error<
1790  "friend function %1 is a %select{private|protected}0 member of %3">,
1791  AccessControl;
1792
1793def err_access_dtor : Error<
1794  "calling a %select{private|protected}1 destructor of class %0">,
1795  AccessControl;
1796def err_access_dtor_base :
1797    Error<"base class %0 has %select{private|protected}1 destructor">,
1798    AccessControl;
1799def err_access_dtor_vbase :
1800    Error<"inherited virtual base class %1 has "
1801    "%select{private|protected}2 destructor">,
1802    AccessControl;
1803def err_access_dtor_temp :
1804    Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1805    AccessControl;
1806def err_access_dtor_exception :
1807    Error<"exception object of type %0 has %select{private|protected}1 "
1808          "destructor">, AccessControl;
1809def err_access_dtor_field :
1810    Error<"field of type %1 has %select{private|protected}2 destructor">,
1811    AccessControl;
1812def err_access_dtor_var :
1813    Error<"variable of type %1 has %select{private|protected}2 destructor">,
1814    AccessControl;
1815def err_access_dtor_ivar :
1816    Error<"instance variable of type %0 has %select{private|protected}1 "
1817          "destructor">,
1818    AccessControl;
1819def note_previous_access_declaration : Note<
1820  "previously declared '%1' here">;
1821def note_access_natural : Note<
1822  "%select{|implicitly }1declared %select{private|protected}0 here">;
1823def note_access_constrained_by_path : Note<
1824  "constrained by %select{|implicitly }1%select{private|protected}0"
1825  " inheritance here">;
1826def note_access_protected_restricted_noobject : Note<
1827  "must name member using the type of the current context %0">;
1828def note_access_protected_restricted_ctordtor : Note<
1829  "protected %select{constructor|destructor}0 can only be used to "
1830  "%select{construct|destroy}0 a base class subobject">;
1831def note_access_protected_restricted_object : Note<
1832  "can only access this member on an object of type %0">;
1833def warn_cxx98_compat_sfinae_access_control : Warning<
1834  "substitution failure due to access control is incompatible with C++98">,
1835  InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1836
1837// C++ name lookup
1838def err_incomplete_nested_name_spec : Error<
1839  "incomplete type %0 named in nested name specifier">;
1840def err_incomplete_enum : Error<
1841  "enumeration %0 is incomplete">;
1842def err_dependent_nested_name_spec : Error<
1843  "nested name specifier for a declaration cannot depend on a template "
1844  "parameter">;
1845def err_nested_name_member_ref_lookup_ambiguous : Error<
1846  "lookup of %0 in member access expression is ambiguous">;
1847def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1848  "lookup of %0 in member access expression is ambiguous; using member of %1">,
1849  InGroup<AmbigMemberTemplate>;
1850def note_ambig_member_ref_object_type : Note<
1851  "lookup in the object type %0 refers here">;
1852def note_ambig_member_ref_scope : Note<
1853  "lookup from the current scope refers here">;
1854def err_qualified_member_nonclass : Error<
1855  "qualified member access refers to a member in %0">;
1856def err_incomplete_member_access : Error<
1857  "member access into incomplete type %0">;
1858def err_incomplete_type : Error<
1859  "incomplete type %0 where a complete type is required">;
1860def warn_cxx98_compat_enum_nested_name_spec : Warning<
1861  "enumeration type in nested name specifier is incompatible with C++98">,
1862  InGroup<CXX98Compat>, DefaultIgnore;
1863def err_nested_name_spec_is_not_class : Error<
1864  "%0 cannot appear before '::' because it is not a class"
1865  "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1866def ext_nested_name_spec_is_enum : ExtWarn<
1867  "use of enumeration in a nested name specifier is a C++11 extension">,
1868  InGroup<CXX11>;
1869def err_out_of_line_qualified_id_type_names_constructor : Error<
1870  "qualified reference to %0 is a constructor name rather than a "
1871  "%select{template name|type}1 in this context">;
1872def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1873  "ISO C++ specifies that "
1874  "qualified reference to %0 is a constructor name rather than a "
1875  "%select{template name|type}1 in this context, despite preceding "
1876  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1877  InGroup<DiagGroup<"injected-class-name">>;
1878
1879// C++ class members
1880def err_storageclass_invalid_for_member : Error<
1881  "storage class specified for a member declaration">;
1882def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1883def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1884def ext_mutable_reference : ExtWarn<
1885  "'mutable' on a reference type is a Microsoft extension">,
1886  InGroup<MicrosoftMutableReference>;
1887def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1888def err_mutable_nonmember : Error<
1889  "'mutable' can only be applied to member variables">;
1890def err_virtual_in_union : Error<
1891  "unions cannot have virtual functions">;
1892def err_virtual_non_function : Error<
1893  "'virtual' can only appear on non-static member functions">;
1894def err_virtual_out_of_class : Error<
1895  "'virtual' can only be specified inside the class definition">;
1896def err_virtual_member_function_template : Error<
1897  "'virtual' cannot be specified on member function templates">;
1898def err_static_overrides_virtual : Error<
1899  "'static' member function %0 overrides a virtual function in a base class">;
1900def err_explicit_non_function : Error<
1901  "'explicit' can only appear on non-static member functions">;
1902def err_explicit_out_of_class : Error<
1903  "'explicit' can only be specified inside the class definition">;
1904def err_explicit_non_ctor_or_conv_function : Error<
1905  "'explicit' can only be applied to a constructor or conversion function">;
1906def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1907def err_static_out_of_line : Error<
1908  "'static' can only be specified inside the class definition">;
1909def ext_static_out_of_line : ExtWarn<
1910  err_static_out_of_line.Summary>,
1911  InGroup<MicrosoftTemplate>;
1912def err_storage_class_for_static_member : Error<
1913  "static data member definition cannot specify a storage class">;
1914def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1915def err_not_integral_type_bitfield : Error<
1916  "bit-field %0 has non-integral type %1">;
1917def err_not_integral_type_anon_bitfield : Error<
1918  "anonymous bit-field has non-integral type %0">;
1919def err_anon_bitfield_qualifiers : Error<
1920  "anonymous bit-field cannot have qualifiers">;
1921def err_member_function_initialization : Error<
1922  "initializer on function does not look like a pure-specifier">;
1923def err_non_virtual_pure : Error<
1924  "%0 is not virtual and cannot be declared pure">;
1925def ext_pure_function_definition : ExtWarn<
1926  "function definition with pure-specifier is a Microsoft extension">,
1927  InGroup<MicrosoftPureDefinition>;
1928def err_qualified_member_of_unrelated : Error<
1929  "%q0 is not a member of class %1">;
1930
1931def err_member_function_call_bad_cvr : Error<
1932  "'this' argument to member function %0 has type %1, but function is not marked "
1933  "%select{const|restrict|const or restrict|volatile|const or volatile|"
1934  "volatile or restrict|const, volatile, or restrict}2">;
1935def err_member_function_call_bad_ref : Error<
1936  "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1937  "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1938def err_member_function_call_bad_type : Error<
1939  "cannot initialize object parameter of type %0 with an expression "
1940  "of type %1">;
1941
1942def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1943  "call to pure virtual member function %0 has undefined behavior; "
1944  "overrides of %0 in subclasses are not available in the "
1945  "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1946
1947def select_special_member_kind : TextSubstitution<
1948  "%select{default constructor|copy constructor|move constructor|"
1949  "copy assignment operator|move assignment operator|destructor}0">;
1950
1951def note_member_declared_at : Note<"member is declared here">;
1952def note_ivar_decl : Note<"instance variable is declared here">;
1953def note_bitfield_decl : Note<"bit-field is declared here">;
1954def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1955def note_member_synthesized_at : Note<
1956  "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
1957  "first required here">;
1958def note_comparison_synthesized_at : Note<
1959  "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
1960  "first required here">;
1961def err_missing_default_ctor : Error<
1962  "%select{constructor for %1 must explicitly initialize the|"
1963  "implicit default constructor for %1 must explicitly initialize the|"
1964  "cannot use constructor inherited from base class %4;}0 "
1965  "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1966  "does not have a default constructor">;
1967def note_due_to_dllexported_class : Note<
1968  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1969
1970def err_illegal_union_or_anon_struct_member : Error<
1971  "%select{anonymous struct|union}0 member %1 has a non-trivial "
1972  "%sub{select_special_member_kind}2">;
1973
1974def warn_frame_address : Warning<
1975  "calling '%0' with a nonzero argument is unsafe">,
1976  InGroup<FrameAddress>, DefaultIgnore;
1977
1978def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1979  "%select{anonymous struct|union}0 member %1 with a non-trivial "
1980  "%sub{select_special_member_kind}2 is incompatible with C++98">,
1981  InGroup<CXX98Compat>, DefaultIgnore;
1982
1983def note_nontrivial_virtual_dtor : Note<
1984  "destructor for %0 is not trivial because it is virtual">;
1985def note_nontrivial_has_virtual : Note<
1986  "because type %0 has a virtual %select{member function|base class}1">;
1987def note_nontrivial_no_def_ctor : Note<
1988  "because %select{base class of |field of |}0type %1 has no "
1989  "default constructor">;
1990def note_user_declared_ctor : Note<
1991  "implicit default constructor suppressed by user-declared constructor">;
1992def note_nontrivial_no_copy : Note<
1993  "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1994  "assignment operator|<<ERROR>>}2 can be used to "
1995  "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1996  "%select{base class|field|an object}0 of type %3">;
1997def note_nontrivial_user_provided : Note<
1998  "because %select{base class of |field of |}0type %1 has a user-provided "
1999  "%sub{select_special_member_kind}2">;
2000def note_nontrivial_default_member_init : Note<
2001  "because field %0 has an initializer">;
2002def note_nontrivial_param_type : Note<
2003  "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
2004def note_nontrivial_default_arg : Note<"because it has a default argument">;
2005def note_nontrivial_variadic : Note<"because it is a variadic function">;
2006def note_nontrivial_subobject : Note<
2007  "because the function selected to %select{construct|copy|move|copy|move|"
2008  "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
2009def note_nontrivial_objc_ownership : Note<
2010  "because type %0 has a member with %select{no|no|__strong|__weak|"
2011  "__autoreleasing}1 ownership">;
2012
2013/// Selector for a TagTypeKind value.
2014def select_tag_type_kind : TextSubstitution<
2015  "%select{struct|interface|union|class|enum}0">;
2016
2017def err_static_data_member_not_allowed_in_anon_struct : Error<
2018  "static data member %0 not allowed in anonymous "
2019  "%sub{select_tag_type_kind}1">;
2020def ext_static_data_member_in_union : ExtWarn<
2021  "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
2022def warn_cxx98_compat_static_data_member_in_union : Warning<
2023  "static data member %0 in union is incompatible with C++98">,
2024  InGroup<CXX98Compat>, DefaultIgnore;
2025def ext_union_member_of_reference_type : ExtWarn<
2026  "union member %0 has reference type %1, which is a Microsoft extension">,
2027  InGroup<MicrosoftUnionMemberReference>;
2028def err_union_member_of_reference_type : Error<
2029  "union member %0 has reference type %1">;
2030def ext_anonymous_struct_union_qualified : Extension<
2031  "anonymous %select{struct|union}0 cannot be '%1'">;
2032def err_different_return_type_for_overriding_virtual_function : Error<
2033  "virtual function %0 has a different return type "
2034  "%diff{($) than the function it overrides (which has return type $)|"
2035  "than the function it overrides}1,2">;
2036def note_overridden_virtual_function : Note<
2037  "overridden virtual function is here">;
2038def err_conflicting_overriding_cc_attributes : Error<
2039  "virtual function %0 has different calling convention attributes "
2040  "%diff{($) than the function it overrides (which has calling convention $)|"
2041  "than the function it overrides}1,2">;
2042def warn_overriding_method_missing_noescape : Warning<
2043  "parameter of overriding method should be annotated with "
2044  "__attribute__((noescape))">, InGroup<MissingNoEscape>;
2045def note_overridden_marked_noescape : Note<
2046  "parameter of overridden method is annotated with __attribute__((noescape))">;
2047def note_cat_conform_to_noescape_prot : Note<
2048  "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
2049
2050def err_covariant_return_inaccessible_base : Error<
2051  "invalid covariant return for virtual function: %1 is a "
2052  "%select{private|protected}2 base class of %0">, AccessControl;
2053def err_covariant_return_ambiguous_derived_to_base_conv : Error<
2054  "return type of virtual function %3 is not covariant with the return type of "
2055  "the function it overrides (ambiguous conversion from derived class "
2056  "%0 to base class %1:%2)">;
2057def err_covariant_return_not_derived : Error<
2058  "return type of virtual function %0 is not covariant with the return type of "
2059  "the function it overrides (%1 is not derived from %2)">;
2060def err_covariant_return_incomplete : Error<
2061  "return type of virtual function %0 is not covariant with the return type of "
2062  "the function it overrides (%1 is incomplete)">;
2063def err_covariant_return_type_different_qualifications : Error<
2064  "return type of virtual function %0 is not covariant with the return type of "
2065  "the function it overrides (%1 has different qualifiers than %2)">;
2066def err_covariant_return_type_class_type_more_qualified : Error<
2067  "return type of virtual function %0 is not covariant with the return type of "
2068  "the function it overrides (class type %1 is more qualified than class "
2069  "type %2">;
2070
2071// C++ implicit special member functions
2072def note_in_declaration_of_implicit_special_member : Note<
2073  "while declaring the implicit %sub{select_special_member_kind}1"
2074  " for %0">;
2075
2076// C++ constructors
2077def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
2078def err_invalid_qualified_constructor : Error<
2079  "'%0' qualifier is not allowed on a constructor">;
2080def err_ref_qualifier_constructor : Error<
2081  "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
2082
2083def err_constructor_return_type : Error<
2084  "constructor cannot have a return type">;
2085def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
2086def err_constructor_byvalue_arg : Error<
2087  "copy constructor must pass its first argument by reference">;
2088def warn_no_constructor_for_refconst : Warning<
2089  "%select{struct|interface|union|class|enum}0 %1 does not declare any "
2090  "constructor to initialize its non-modifiable members">;
2091def note_refconst_member_not_initialized : Note<
2092  "%select{const|reference}0 member %1 will never be initialized">;
2093def ext_ms_explicit_constructor_call : ExtWarn<
2094  "explicit constructor calls are a Microsoft extension">,
2095  InGroup<MicrosoftExplicitConstructorCall>;
2096
2097// C++ destructors
2098def err_destructor_not_member : Error<
2099  "destructor must be a non-static member function">;
2100def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
2101def err_invalid_qualified_destructor : Error<
2102  "'%0' qualifier is not allowed on a destructor">;
2103def err_ref_qualifier_destructor : Error<
2104  "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
2105def err_destructor_return_type : Error<"destructor cannot have a return type">;
2106def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
2107def err_destructor_with_params : Error<"destructor cannot have any parameters">;
2108def err_destructor_variadic : Error<"destructor cannot be variadic">;
2109def ext_destructor_typedef_name : ExtWarn<
2110  "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
2111  "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
2112def err_undeclared_destructor_name : Error<
2113  "undeclared identifier %0 in destructor name">;
2114def err_destructor_name : Error<
2115  "expected the class name after '~' to name the enclosing class">;
2116def err_destructor_name_nontype : Error<
2117  "identifier %0 after '~' in destructor name does not name a type">;
2118def err_destructor_expr_mismatch : Error<
2119  "identifier %0 in object destruction expression does not name the type "
2120  "%1 of the object being destroyed">;
2121def err_destructor_expr_nontype : Error<
2122  "identifier %0 in object destruction expression does not name a type">;
2123def err_destructor_expr_type_mismatch : Error<
2124  "destructor type %0 in object destruction expression does not match the "
2125  "type %1 of the object being destroyed">;
2126def note_destructor_type_here : Note<
2127  "type %0 found by destructor name lookup">;
2128def note_destructor_nontype_here : Note<
2129  "non-type declaration found by destructor name lookup">;
2130def ext_dtor_named_in_wrong_scope : Extension<
2131  "ISO C++ requires the name after '::~' to be found in the same scope as "
2132  "the name before '::~'">, InGroup<DtorName>;
2133def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
2134  "qualified destructor name only found in lexical scope; omit the qualifier "
2135  "to find this type name by unqualified lookup">, InGroup<DtorName>;
2136def ext_dtor_name_ambiguous : Extension<
2137  "ISO C++ considers this destructor name lookup to be ambiguous">,
2138  InGroup<DtorName>;
2139
2140def err_destroy_attr_on_non_static_var : Error<
2141  "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
2142  " variable with static or thread storage duration">;
2143
2144def err_destructor_template : Error<
2145  "destructor cannot be declared as a template">;
2146
2147// C++ initialization
2148def err_init_conversion_failed : Error<
2149  "cannot initialize %select{a variable|a parameter|template parameter|"
2150  "return object|statement expression result|an "
2151  "exception object|a member subobject|an array element|a new value|a value|a "
2152  "base class|a constructor delegation|a vector element|a block element|a "
2153  "block element|a complex element|a lambda capture|a compound literal "
2154  "initializer|a related result|a parameter of CF audited function|a "
2155  "structured binding|a member subobject}0 "
2156  "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2157  "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2158  "%select{|: different classes%diff{ ($ vs $)|}5,6"
2159  "|: different number of parameters (%5 vs %6)"
2160  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2161  "|: different return type%diff{ ($ vs $)|}5,6"
2162  "|: different qualifiers (%5 vs %6)"
2163  "|: different exception specifications}4">;
2164def note_forward_class_conversion : Note<"%0 is not defined, but forward "
2165  "declared here; conversion would be valid if it was derived from %1">;
2166
2167def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2168  "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2169def err_lvalue_reference_bind_to_initlist : Error<
2170  "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2171  "initializer list temporary">;
2172def err_lvalue_reference_bind_to_temporary : Error<
2173  "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2174  "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2175def err_lvalue_reference_bind_to_unrelated : Error<
2176  "%select{non-const|volatile}0 lvalue reference "
2177  "%diff{to type $ cannot bind to a value of unrelated type $|"
2178  "cannot bind to a value of unrelated type}1,2">;
2179def err_reference_bind_drops_quals : Error<
2180  "binding reference %diff{of type $ to value of type $|to value}0,1 "
2181  "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2182  "not permitted due to incompatible qualifiers}2">;
2183def err_reference_bind_failed : Error<
2184  "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2185  "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2186  "incompatible type}0,3">;
2187def err_reference_bind_temporary_addrspace : Error<
2188  "reference of type %0 cannot bind to a temporary object because of "
2189  "address space mismatch">;
2190def err_reference_bind_init_list : Error<
2191  "reference to type %0 cannot bind to an initializer list">;
2192def err_init_list_bad_dest_type : Error<
2193  "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2194  "list">;
2195def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2196  "aggregate initialization of type %0 with user-declared constructors "
2197  "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2198def warn_cxx17_compat_aggregate_init_paren_list : Warning<
2199  "aggregate initialization of type %0 from a parenthesized list of values "
2200  "is a C++20 extension">, DefaultIgnore, InGroup<CXX20>;
2201
2202def err_reference_bind_to_bitfield : Error<
2203  "%select{non-const|volatile}0 reference cannot bind to "
2204  "bit-field%select{| %1}2">;
2205def err_reference_bind_to_vector_element : Error<
2206  "%select{non-const|volatile}0 reference cannot bind to vector element">;
2207def err_reference_bind_to_matrix_element : Error<
2208  "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2209def err_reference_var_requires_init : Error<
2210  "declaration of reference variable %0 requires an initializer">;
2211def err_reference_without_init : Error<
2212  "reference to type %0 requires an initializer">;
2213def note_value_initialization_here : Note<
2214  "in value-initialization of type %0 here">;
2215def err_reference_has_multiple_inits : Error<
2216  "reference cannot be initialized with multiple values">;
2217def err_init_non_aggr_init_list : Error<
2218  "initialization of non-aggregate type %0 with an initializer list">;
2219def err_designated_init_for_non_aggregate : Error<
2220  "initialization of non-aggregate type %0 with a designated initializer list">;
2221def err_init_reference_member_uninitialized : Error<
2222  "reference member of type %0 uninitialized">;
2223def note_uninit_reference_member : Note<
2224  "uninitialized reference member is here">;
2225def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2226  InGroup<Uninitialized>;
2227def warn_base_class_is_uninit : Warning<
2228  "base class %0 is uninitialized when used here to access %q1">,
2229  InGroup<Uninitialized>;
2230def warn_reference_field_is_uninit : Warning<
2231  "reference %0 is not yet bound to a value when used here">,
2232  InGroup<Uninitialized>;
2233def note_uninit_in_this_constructor : Note<
2234  "during field initialization in %select{this|the implicit default}0 "
2235  "constructor">;
2236def warn_static_self_reference_in_init : Warning<
2237  "static variable %0 is suspiciously used within its own initialization">,
2238  InGroup<UninitializedStaticSelfInit>;
2239def warn_uninit_self_reference_in_init : Warning<
2240  "variable %0 is uninitialized when used within its own initialization">,
2241  InGroup<Uninitialized>;
2242def warn_uninit_self_reference_in_reference_init : Warning<
2243  "reference %0 is not yet bound to a value when used within its own"
2244  " initialization">,
2245  InGroup<Uninitialized>;
2246def warn_uninit_var : Warning<
2247  "variable %0 is uninitialized when %select{used here|captured by block}1">,
2248  InGroup<Uninitialized>, DefaultIgnore;
2249def warn_sometimes_uninit_var : Warning<
2250  "variable %0 is %select{used|captured}1 uninitialized whenever "
2251  "%select{'%3' condition is %select{true|false}4|"
2252  "'%3' loop %select{is entered|exits because its condition is false}4|"
2253  "'%3' loop %select{condition is true|exits because its condition is false}4|"
2254  "switch %3 is taken|"
2255  "its declaration is reached|"
2256  "%3 is called}2">,
2257  InGroup<UninitializedSometimes>, DefaultIgnore;
2258def warn_maybe_uninit_var : Warning<
2259  "variable %0 may be uninitialized when "
2260  "%select{used here|captured by block}1">,
2261  InGroup<UninitializedMaybe>, DefaultIgnore;
2262def note_var_declared_here : Note<"variable %0 is declared here">;
2263def note_uninit_var_use : Note<
2264  "%select{uninitialized use occurs|variable is captured by block}0 here">;
2265def warn_uninit_byref_blockvar_captured_by_block : Warning<
2266  "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2267  "block">, InGroup<Uninitialized>, DefaultIgnore;
2268def note_block_var_fixit_add_initialization : Note<
2269  "did you mean to use __block %0?">;
2270def note_in_omitted_aggregate_initializer : Note<
2271  "in implicit initialization of %select{"
2272  "array element %1 with omitted initializer|"
2273  "field %1 with omitted initializer|"
2274  "trailing array elements in runtime-sized array new}0">;
2275def note_in_reference_temporary_list_initializer : Note<
2276  "in initialization of temporary of type %0 created to "
2277  "list-initialize this reference">;
2278def note_var_fixit_add_initialization : Note<
2279  "initialize the variable %0 to silence this warning">;
2280def note_uninit_fixit_remove_cond : Note<
2281  "remove the %select{'%1' if its condition|condition if it}0 "
2282  "is always %select{false|true}2">;
2283def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2284def err_list_init_in_parens : Error<
2285  "cannot initialize %select{non-class|reference}0 type %1 with a "
2286  "parenthesized initializer list">;
2287
2288def warn_uninit_const_reference : Warning<
2289  "variable %0 is uninitialized when passed as a const reference argument "
2290  "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2291
2292def warn_unsequenced_mod_mod : Warning<
2293  "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2294def warn_unsequenced_mod_use : Warning<
2295  "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2296
2297def select_initialized_entity_kind : TextSubstitution<
2298  "%select{copying variable|copying parameter|initializing template parameter|"
2299  "returning object|initializing statement expression result|"
2300  "throwing object|copying member subobject|copying array element|"
2301  "allocating object|copying temporary|initializing base subobject|"
2302  "initializing vector element|capturing value}0">;
2303
2304def err_temp_copy_no_viable : Error<
2305  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2306def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2307  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2308  "C++98 requires a copy constructor when binding a reference to a temporary">,
2309  InGroup<BindToTemporaryCopy>;
2310def err_temp_copy_ambiguous : Error<
2311  "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2312  "of type %1">;
2313def err_temp_copy_deleted : Error<
2314  "%sub{select_initialized_entity_kind}0 of type %1 "
2315  "invokes deleted constructor">;
2316def err_temp_copy_incomplete : Error<
2317  "copying a temporary object of incomplete type %0">;
2318def warn_cxx98_compat_temp_copy : Warning<
2319  "%sub{select_initialized_entity_kind}1 "
2320  "of type %2 when binding a reference to a temporary would %select{invoke "
2321  "an inaccessible constructor|find no viable constructor|find ambiguous "
2322  "constructors|invoke a deleted constructor}0 in C++98">,
2323  InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2324def err_selected_explicit_constructor : Error<
2325  "chosen constructor is explicit in copy-initialization">;
2326def note_explicit_ctor_deduction_guide_here : Note<
2327  "explicit %select{constructor|deduction guide}0 declared here">;
2328
2329// C++11 decltype
2330def err_decltype_in_declarator : Error<
2331    "'decltype' cannot be used to name a declaration">;
2332
2333// C++11 auto
2334def warn_cxx98_compat_auto_type_specifier : Warning<
2335  "'auto' type specifier is incompatible with C++98">,
2336  InGroup<CXX98Compat>, DefaultIgnore;
2337def err_auto_variable_cannot_appear_in_own_initializer : Error<
2338  "variable %0 declared with deduced type %1 "
2339  "cannot appear in its own initializer">;
2340def err_binding_cannot_appear_in_own_initializer : Error<
2341  "binding %0 cannot appear in the initializer of its own "
2342  "decomposition declaration">;
2343def err_new_array_of_auto : Error<
2344  "cannot allocate array of 'auto'">;
2345def err_auto_not_allowed : Error<
2346  "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2347  "use of "
2348  "%select{class template|function template|variable template|alias template|"
2349  "template template parameter|concept|template}2 %3 requires template "
2350  "arguments; argument deduction}0 not allowed "
2351  "%select{in function prototype"
2352  "|in non-static struct member|in struct member"
2353  "|in non-static union member|in union member"
2354  "|in non-static class member|in interface member"
2355  "|in exception declaration|in template parameter until C++17|in block literal"
2356  "|in template argument|in typedef|in type alias|in function return type"
2357  "|in conversion function type|here|in lambda parameter"
2358  "|in type allocated by 'new'|in K&R-style function parameter"
2359  "|in template parameter|in friend declaration|in function prototype that is "
2360  "not a function declaration|in requires expression parameter}1">;
2361def err_dependent_deduced_tst : Error<
2362  "typename specifier refers to "
2363  "%select{class template|function template|variable template|alias template|"
2364  "template template parameter|template}0 member in %1; "
2365  "argument deduction not allowed here">;
2366def err_deduced_tst : Error<
2367  "typename specifier refers to "
2368  "%select{class template|function template|variable template|alias template|"
2369  "template template parameter|template}0; argument deduction not allowed "
2370  "here">;
2371def err_auto_not_allowed_var_inst : Error<
2372  "'auto' variable template instantiation is not allowed">;
2373def err_auto_var_requires_init : Error<
2374  "declaration of variable %0 with deduced type %1 requires an initializer">;
2375def err_auto_new_requires_ctor_arg : Error<
2376  "new expression for type %0 requires a constructor argument">;
2377def ext_auto_new_list_init : Extension<
2378  "ISO C++ standards before C++17 do not allow new expression for "
2379  "type %0 to use list-initialization">, InGroup<CXX17>;
2380def err_auto_var_init_no_expression : Error<
2381  "initializer for variable %0 with type %1 is empty">;
2382def err_auto_expr_init_no_expression : Error<
2383  "initializer for functional-style cast to %0 is empty">;
2384def err_auto_var_init_multiple_expressions : Error<
2385  "initializer for variable %0 with type %1 contains multiple expressions">;
2386def err_auto_expr_init_multiple_expressions : Error<
2387  "initializer for functional-style cast to %0 contains multiple expressions">;
2388def err_auto_var_init_paren_braces : Error<
2389  "cannot deduce type for variable %1 with type %2 from "
2390  "%select{parenthesized|nested}0 initializer list">;
2391def err_auto_new_ctor_multiple_expressions : Error<
2392  "new expression for type %0 contains multiple constructor arguments">;
2393def err_auto_expr_init_paren_braces : Error<
2394  "cannot deduce actual type for %1 from "
2395  "%select{parenthesized|nested}0 initializer list">;
2396def warn_cxx20_compat_auto_expr : Warning<
2397  "'auto' as a functional-style cast is incompatible with C++ standards "
2398  "before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
2399def err_auto_missing_trailing_return : Error<
2400  "'auto' return without trailing return type; deduced return types are a "
2401  "C++14 extension">;
2402def err_deduced_return_type : Error<
2403  "deduced return types are a C++14 extension">;
2404def err_trailing_return_without_auto : Error<
2405  "function with trailing return type must specify return type 'auto', not %0">;
2406def err_trailing_return_in_parens : Error<
2407  "trailing return type may not be nested within parentheses">;
2408def err_auto_var_deduction_failure : Error<
2409  "variable %0 with type %1 has incompatible initializer of type %2">;
2410def err_auto_var_deduction_failure_from_init_list : Error<
2411  "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2412def err_auto_expr_deduction_failure : Error<
2413  "functional-style cast to %0 has incompatible initializer of type %1">;
2414def err_auto_new_deduction_failure : Error<
2415  "new expression for type %0 has incompatible constructor argument of type %1">;
2416def err_auto_inconsistent_deduction : Error<
2417  "deduced conflicting types %diff{($ vs $) |}0,1"
2418  "for initializer list element type">;
2419def err_auto_different_deductions : Error<
2420  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2421  "deduced as %1 in declaration of %2 and "
2422  "deduced as %3 in declaration of %4">;
2423def err_auto_non_deduced_not_alone : Error<
2424  "%select{function with deduced return type|"
2425  "declaration with trailing return type}0 "
2426  "must be the only declaration in its group">;
2427def err_implied_std_initializer_list_not_found : Error<
2428  "cannot deduce type of initializer list because std::initializer_list was "
2429  "not found; include <initializer_list>">;
2430def err_malformed_std_initializer_list : Error<
2431  "std::initializer_list must be a class template with a single type parameter">;
2432def err_auto_init_list_from_c : Error<
2433  "cannot use __auto_type with initializer list in C">;
2434def err_auto_bitfield : Error<
2435  "cannot pass bit-field as __auto_type initializer in C">;
2436
2437// C++1y decltype(auto) type
2438def err_decltype_auto_invalid : Error<
2439  "'decltype(auto)' not allowed here">;
2440def err_decltype_auto_cannot_be_combined : Error<
2441  "'decltype(auto)' cannot be combined with other type specifiers">;
2442def err_decltype_auto_function_declarator_not_declaration : Error<
2443  "'decltype(auto)' can only be used as a return type "
2444  "in a function declaration">;
2445def err_decltype_auto_compound_type : Error<
2446  "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2447def err_decltype_auto_initializer_list : Error<
2448  "cannot deduce 'decltype(auto)' from initializer list">;
2449
2450// C++17 deduced class template specialization types
2451def err_deduced_class_template_compound_type : Error<
2452  "cannot %select{form pointer to|form reference to|form array of|"
2453  "form function returning|use parentheses when declaring variable with}0 "
2454  "deduced class template specialization type">;
2455def err_deduced_non_class_template_specialization_type : Error<
2456  "%select{<error>|function template|variable template|alias template|"
2457  "template template parameter|concept|template}0 %1 requires template "
2458  "arguments; argument deduction only allowed for class templates">;
2459def err_deduced_class_template_ctor_ambiguous : Error<
2460  "ambiguous deduction for template arguments of %0">;
2461def err_deduced_class_template_ctor_no_viable : Error<
2462  "no viable constructor or deduction guide for deduction of "
2463  "template arguments of %0">;
2464def err_deduced_class_template_incomplete : Error<
2465  "template %0 has no definition and no %select{|viable }1deduction guides "
2466  "for deduction of template arguments">;
2467def err_deduced_class_template_deleted : Error<
2468  "class template argument deduction for %0 selected a deleted constructor">;
2469def err_deduced_class_template_explicit : Error<
2470  "class template argument deduction for %0 selected an explicit "
2471  "%select{constructor|deduction guide}1 for copy-list-initialization">;
2472def err_deduction_guide_no_trailing_return_type : Error<
2473  "deduction guide declaration without trailing return type">;
2474def err_deduction_guide_bad_trailing_return_type : Error<
2475  "deduced type %1 of deduction guide is not %select{|written as }2"
2476  "a specialization of template %0">;
2477def err_deduction_guide_with_complex_decl : Error<
2478  "cannot specify any part of a return type in the "
2479  "declaration of a deduction guide">;
2480def err_deduction_guide_invalid_specifier : Error<
2481  "deduction guide cannot be declared '%0'">;
2482def err_deduction_guide_name_not_class_template : Error<
2483  "cannot specify deduction guide for "
2484  "%select{<error>|function template|variable template|alias template|"
2485  "template template parameter|concept|dependent template name}0 %1">;
2486def err_deduction_guide_wrong_scope : Error<
2487  "deduction guide must be declared in the same scope as template %q0">;
2488def err_deduction_guide_defines_function : Error<
2489  "deduction guide cannot have a function definition">;
2490def err_deduction_guide_redeclared : Error<
2491  "redeclaration of deduction guide">;
2492def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2493  "%select{explicitly instantiated|explicitly specialized}0">;
2494def err_deduction_guide_template_not_deducible : Error<
2495  "deduction guide template contains "
2496  "%select{a template parameter|template parameters}0 that cannot be "
2497  "deduced">;
2498def err_deduction_guide_wrong_access : Error<
2499  "deduction guide has different access from the corresponding "
2500  "member template">;
2501def note_deduction_guide_template_access : Note<
2502  "member template declared %0 here">;
2503def note_deduction_guide_access : Note<
2504  "deduction guide declared %0 by intervening access specifier">;
2505def warn_cxx14_compat_class_template_argument_deduction : Warning<
2506  "class template argument deduction is incompatible with C++ standards "
2507  "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2508  InGroup<CXXPre17Compat>, DefaultIgnore;
2509def warn_ctad_maybe_unsupported : Warning<
2510  "%0 may not intend to support class template argument deduction">,
2511  InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2512def note_suppress_ctad_maybe_unsupported : Note<
2513  "add a deduction guide to suppress this warning">;
2514
2515
2516// C++14 deduced return types
2517def err_auto_fn_deduction_failure : Error<
2518  "cannot deduce return type %0 from returned value of type %1">;
2519def err_auto_fn_different_deductions : Error<
2520  "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2521  "deduced as %2 in earlier return statement">;
2522def err_auto_fn_used_before_defined : Error<
2523  "function %0 with deduced return type cannot be used before it is defined">;
2524def err_auto_fn_no_return_but_not_auto : Error<
2525  "cannot deduce return type %0 for function with no return statements">;
2526def err_auto_fn_return_void_but_not_auto : Error<
2527  "cannot deduce return type %0 from omitted return expression">;
2528def err_auto_fn_return_init_list : Error<
2529  "cannot deduce return type from initializer list">;
2530def err_auto_fn_virtual : Error<
2531  "function with deduced return type cannot be virtual">;
2532def warn_cxx11_compat_deduced_return_type : Warning<
2533  "return type deduction is incompatible with C++ standards before C++14">,
2534  InGroup<CXXPre14Compat>, DefaultIgnore;
2535
2536// C++11 override control
2537def override_keyword_only_allowed_on_virtual_member_functions : Error<
2538  "only virtual member functions can be marked '%0'">;
2539def override_keyword_hides_virtual_member_function : Error<
2540  "non-virtual member function marked '%0' hides virtual member "
2541  "%select{function|functions}1">;
2542def err_function_marked_override_not_overriding : Error<
2543  "%0 marked 'override' but does not override any member functions">;
2544def warn_destructor_marked_not_override_overriding : TextSubstitution <
2545  "%0 overrides a destructor but is not marked 'override'">;
2546def warn_function_marked_not_override_overriding : TextSubstitution <
2547  "%0 overrides a member function but is not marked 'override'">;
2548def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2549  "%sub{warn_destructor_marked_not_override_overriding}0">,
2550  InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2551def warn_inconsistent_function_marked_not_override_overriding : Warning <
2552  "%sub{warn_function_marked_not_override_overriding}0">,
2553  InGroup<CXX11WarnInconsistentOverrideMethod>;
2554def warn_suggest_destructor_marked_not_override_overriding : Warning <
2555  "%sub{warn_destructor_marked_not_override_overriding}0">,
2556  InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2557def warn_suggest_function_marked_not_override_overriding : Warning <
2558  "%sub{warn_function_marked_not_override_overriding}0">,
2559  InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2560def err_class_marked_final_used_as_base : Error<
2561  "base %0 is marked '%select{final|sealed}1'">;
2562def warn_abstract_final_class : Warning<
2563  "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2564def warn_final_dtor_non_final_class : Warning<
2565  "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2566  InGroup<FinalDtorNonFinalClass>;
2567def note_final_dtor_non_final_class_silence : Note<
2568  "mark %0 as '%select{final|sealed}1' to silence this warning">;
2569
2570// C++11 attributes
2571def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2572
2573// C++11 final
2574def err_final_function_overridden : Error<
2575  "declaration of %0 overrides a '%select{final|sealed}1' function">;
2576
2577// C++11 scoped enumerations
2578def err_enum_invalid_underlying : Error<
2579  "non-integral type %0 is an invalid underlying type">;
2580def err_enumerator_too_large : Error<
2581  "enumerator value is not representable in the underlying type %0">;
2582def ext_enumerator_too_large : Extension<
2583  "enumerator value is not representable in the underlying type %0">,
2584  InGroup<MicrosoftEnumValue>;
2585def err_enumerator_wrapped : Error<
2586  "enumerator value %0 is not representable in the underlying type %1">;
2587def err_enum_redeclare_type_mismatch : Error<
2588  "enumeration redeclared with different underlying type %0 (was %1)">;
2589def err_enum_redeclare_fixed_mismatch : Error<
2590  "enumeration previously declared with %select{non|}0fixed underlying type">;
2591def err_enum_redeclare_scoped_mismatch : Error<
2592  "enumeration previously declared as %select{un|}0scoped">;
2593def err_only_enums_have_underlying_types : Error<
2594  "only enumeration types have underlying types">;
2595def err_underlying_type_of_incomplete_enum : Error<
2596  "cannot determine underlying type of incomplete enumeration type %0">;
2597
2598// C++11 delegating constructors
2599def err_delegating_ctor : Error<
2600  "delegating constructors are permitted only in C++11">;
2601def warn_cxx98_compat_delegating_ctor : Warning<
2602  "delegating constructors are incompatible with C++98">,
2603  InGroup<CXX98Compat>, DefaultIgnore;
2604def err_delegating_initializer_alone : Error<
2605  "an initializer for a delegating constructor must appear alone">;
2606def warn_delegating_ctor_cycle : Warning<
2607  "constructor for %0 creates a delegation cycle">, DefaultError,
2608  InGroup<DelegatingCtorCycles>;
2609def note_it_delegates_to : Note<"it delegates to">;
2610def note_which_delegates_to : Note<"which delegates to">;
2611
2612// C++11 range-based for loop
2613def err_for_range_decl_must_be_var : Error<
2614  "for range declaration must declare a variable">;
2615def err_for_range_storage_class : Error<
2616  "loop variable %0 may not be declared %select{'extern'|'static'|"
2617  "'__private_extern__'|'auto'|'register'|'constexpr'|'thread_local'}1">;
2618def err_type_defined_in_for_range : Error<
2619  "types may not be defined in a for range declaration">;
2620def err_for_range_deduction_failure : Error<
2621  "cannot use type %0 as a range">;
2622def err_for_range_incomplete_type : Error<
2623  "cannot use incomplete type %0 as a range">;
2624def err_for_range_iter_deduction_failure : Error<
2625  "cannot use type %0 as an iterator">;
2626def ext_for_range_begin_end_types_differ : ExtWarn<
2627  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2628  InGroup<CXX17>;
2629def warn_for_range_begin_end_types_differ : Warning<
2630  "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2631  "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2632def note_in_for_range: Note<
2633  "when looking up '%select{begin|end}0' function for range expression "
2634  "of type %1">;
2635def err_for_range_invalid: Error<
2636  "invalid range expression of type %0; no viable '%select{begin|end}1' "
2637  "function available">;
2638def note_for_range_member_begin_end_ignored : Note<
2639  "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2640def err_range_on_array_parameter : Error<
2641  "cannot build range expression with array function parameter %0 since "
2642  "parameter with array type %1 is treated as pointer type %2">;
2643def err_for_range_dereference : Error<
2644  "invalid range expression of type %0; did you mean to dereference it "
2645  "with '*'?">;
2646def note_for_range_invalid_iterator : Note <
2647  "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2648def note_for_range_begin_end : Note<
2649  "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2650def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2651  "loop variable %0 "
2652  "%diff{of type $ binds to a temporary constructed from type $"
2653  "|binds to a temporary constructed from a different type}1,2">,
2654  InGroup<RangeLoopConstruct>, DefaultIgnore;
2655def note_use_type_or_non_reference : Note<
2656  "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2657def warn_for_range_ref_binds_ret_temp : Warning<
2658  "loop variable %0 binds to a temporary value produced by a range of type %1">,
2659  InGroup<RangeLoopBindReference>, DefaultIgnore;
2660def note_use_non_reference_type : Note<"use non-reference type %0">;
2661def warn_for_range_copy : Warning<
2662  "loop variable %0 creates a copy from type %1">,
2663  InGroup<RangeLoopConstruct>, DefaultIgnore;
2664def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2665def err_objc_for_range_init_stmt : Error<
2666  "initialization statement is not supported when iterating over Objective-C "
2667  "collection">;
2668
2669// C++11 constexpr
2670def warn_cxx98_compat_constexpr : Warning<
2671  "'constexpr' specifier is incompatible with C++98">,
2672  InGroup<CXX98Compat>, DefaultIgnore;
2673// FIXME: Maybe this should also go in -Wc++14-compat?
2674def warn_cxx14_compat_constexpr_not_const : Warning<
2675  "'constexpr' non-static member function will not be implicitly 'const' "
2676  "in C++14; add 'const' to avoid a change in behavior">,
2677  InGroup<DiagGroup<"constexpr-not-const">>;
2678def err_invalid_consteval_take_address : Error<
2679  "cannot take address of %select{immediate|consteval}2 "
2680  "%select{function|call operator of}1 %0 outside"
2681  " of an immediate invocation">;
2682def err_invalid_consteval_call : Error<
2683  "call to %select{immediate|consteval}1 function "
2684  "%q0 is not a constant expression">;
2685
2686def err_immediate_function_used_before_definition : Error<
2687  "immediate function %0 used before it is defined">;
2688
2689def note_immediate_function_reason : Note<
2690  "%0 is an immediate %select{function|constructor}5 because "
2691  "%select{its body|the%select{| default}7 initializer of %8}6 "
2692  "%select{evaluates the address of %select{an immediate|a consteval}2 "
2693  "function %1|contains a call to %select{an immediate|a consteval}2 "
2694  "%select{function|constructor}4 %1 and that call is not a constant "
2695  "expression}3">;
2696
2697def note_invalid_consteval_initializer : Note<
2698  "in the default initializer of %0">;
2699def note_invalid_consteval_initializer_here : Note<
2700  "initialized here %0">;
2701def err_invalid_consteval_decl_kind : Error<
2702  "%0 cannot be declared consteval">;
2703def err_invalid_constexpr : Error<
2704  "%select{function parameter|typedef}0 "
2705  "cannot be %sub{select_constexpr_spec_kind}1">;
2706def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2707  "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2708def err_constexpr_tag : Error<
2709  "%select{class|struct|interface|union|enum|enum class|enum struct}0 "
2710  "cannot be marked %sub{select_constexpr_spec_kind}1">;
2711def err_constexpr_dtor : Error<
2712  "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2713def err_constexpr_dtor_subobject : Error<
2714  "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2715  "%select{data member %2|base class %3}1 does not have a "
2716  "constexpr destructor">;
2717def note_constexpr_dtor_subobject : Note<
2718  "%select{data member %1|base class %2}0 declared here">;
2719def err_constexpr_wrong_decl_kind : Error<
2720  "%sub{select_constexpr_spec_kind}0 can only be used "
2721  "in %select{|variable and function|function|variable}0 declarations">;
2722def err_invalid_constexpr_var_decl : Error<
2723  "constexpr variable declaration must be a definition">;
2724def err_constexpr_static_mem_var_requires_init : Error<
2725  "declaration of constexpr static data member %0 requires an initializer">;
2726def err_constexpr_var_non_literal : Error<
2727  "constexpr variable cannot have non-literal type %0">;
2728def err_constexpr_var_requires_const_init : Error<
2729  "constexpr variable %0 must be initialized by a constant expression">;
2730def err_constexpr_var_requires_const_destruction : Error<
2731  "constexpr variable %0 must have constant destruction">;
2732def err_constexpr_redecl_mismatch : Error<
2733  "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2734  " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2735def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2736def warn_cxx17_compat_constexpr_virtual : Warning<
2737  "virtual constexpr functions are incompatible with "
2738  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2739def err_constexpr_virtual_base : Error<
2740  "constexpr %select{member function|constructor}0 not allowed in "
2741  "%select{struct|interface|class}1 with virtual base "
2742  "%plural{1:class|:classes}2">;
2743def note_non_literal_incomplete : Note<
2744  "incomplete type %0 is not a literal type">;
2745def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2746  "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2747def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2748def err_constexpr_non_literal_return : Error<
2749  "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2750def err_constexpr_non_literal_param : Error<
2751  "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2752  "not a literal type">;
2753def err_constexpr_body_invalid_stmt : Error<
2754  "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2755def ext_constexpr_body_invalid_stmt : ExtWarn<
2756  "use of this statement in a constexpr %select{function|constructor}0 "
2757  "is a C++14 extension">, InGroup<CXX14>;
2758def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2759  "use of this statement in a constexpr %select{function|constructor}0 "
2760  "is incompatible with C++ standards before C++14">,
2761  InGroup<CXXPre14Compat>, DefaultIgnore;
2762def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2763  "use of this statement in a constexpr %select{function|constructor}0 "
2764  "is a C++20 extension">, InGroup<CXX20>;
2765def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2766  "use of this statement in a constexpr %select{function|constructor}0 "
2767  "is incompatible with C++ standards before C++20">,
2768  InGroup<CXXPre20Compat>, DefaultIgnore;
2769def ext_constexpr_body_invalid_stmt_cxx23 : ExtWarn<
2770  "use of this statement in a constexpr %select{function|constructor}0 "
2771  "is a C++23 extension">, InGroup<CXX23>;
2772def warn_cxx20_compat_constexpr_body_invalid_stmt : Warning<
2773  "use of this statement in a constexpr %select{function|constructor}0 "
2774  "is incompatible with C++ standards before C++23">,
2775  InGroup<CXXPre23Compat>, DefaultIgnore;
2776def ext_constexpr_type_definition : ExtWarn<
2777  "type definition in a constexpr %select{function|constructor}0 "
2778  "is a C++14 extension">, InGroup<CXX14>;
2779def warn_cxx11_compat_constexpr_type_definition : Warning<
2780  "type definition in a constexpr %select{function|constructor}0 "
2781  "is incompatible with C++ standards before C++14">,
2782  InGroup<CXXPre14Compat>, DefaultIgnore;
2783def err_constexpr_vla : Error<
2784  "variably-modified type %0 cannot be used in a constexpr "
2785  "%select{function|constructor}1">;
2786def ext_constexpr_local_var : ExtWarn<
2787  "variable declaration in a constexpr %select{function|constructor}0 "
2788  "is a C++14 extension">, InGroup<CXX14>;
2789def warn_cxx11_compat_constexpr_local_var : Warning<
2790  "variable declaration in a constexpr %select{function|constructor}0 "
2791  "is incompatible with C++ standards before C++14">,
2792  InGroup<CXXPre14Compat>, DefaultIgnore;
2793def ext_constexpr_static_var : ExtWarn<
2794  "definition of a %select{static|thread_local}1 variable "
2795  "in a constexpr %select{function|constructor}0 "
2796  "is a C++23 extension">, InGroup<CXX23>;
2797def warn_cxx20_compat_constexpr_var : Warning<
2798  "definition of a %select{static variable|thread_local variable|variable "
2799  "of non-literal type}1 in a constexpr %select{function|constructor}0 "
2800  "is incompatible with C++ standards before C++23">,
2801  InGroup<CXXPre23Compat>, DefaultIgnore;
2802def err_constexpr_local_var_non_literal_type : Error<
2803  "variable of non-literal type %1 cannot be defined in a constexpr "
2804  "%select{function|constructor}0 before C++23">;
2805def ext_constexpr_local_var_no_init : ExtWarn<
2806  "uninitialized variable in a constexpr %select{function|constructor}0 "
2807  "is a C++20 extension">, InGroup<CXX20>;
2808def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2809  "uninitialized variable in a constexpr %select{function|constructor}0 "
2810  "is incompatible with C++ standards before C++20">,
2811  InGroup<CXXPre20Compat>, DefaultIgnore;
2812def ext_constexpr_function_never_constant_expr : ExtWarn<
2813  "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2814  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2815def err_attr_cond_never_constant_expr : Error<
2816  "%0 attribute expression never produces a constant expression">;
2817def err_diagnose_if_invalid_diagnostic_type : Error<
2818  "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2819  "instead">;
2820def err_constexpr_body_no_return : Error<
2821  "no return statement in %select{constexpr|consteval}0 function">;
2822def err_constexpr_return_missing_expr : Error<
2823  "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2824def warn_cxx11_compat_constexpr_body_no_return : Warning<
2825  "constexpr function with no return statements is incompatible with C++ "
2826  "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2827def ext_constexpr_body_multiple_return : ExtWarn<
2828  "multiple return statements in constexpr function is a C++14 extension">,
2829  InGroup<CXX14>;
2830def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2831  "multiple return statements in constexpr function "
2832  "is incompatible with C++ standards before C++14">,
2833  InGroup<CXXPre14Compat>, DefaultIgnore;
2834def note_constexpr_body_previous_return : Note<
2835  "previous return statement is here">;
2836
2837// C++20 function try blocks in constexpr
2838def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2839  "function try block in constexpr %select{function|constructor}0 is "
2840  "a C++20 extension">, InGroup<CXX20>;
2841def warn_cxx17_compat_constexpr_function_try_block : Warning<
2842  "function try block in constexpr %select{function|constructor}0 is "
2843  "incompatible with C++ standards before C++20">,
2844  InGroup<CXXPre20Compat>, DefaultIgnore;
2845
2846def ext_constexpr_union_ctor_no_init : ExtWarn<
2847  "constexpr union constructor that does not initialize any member "
2848  "is a C++20 extension">, InGroup<CXX20>;
2849def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2850  "constexpr union constructor that does not initialize any member "
2851  "is incompatible with C++ standards before C++20">,
2852  InGroup<CXXPre20Compat>, DefaultIgnore;
2853def ext_constexpr_ctor_missing_init : ExtWarn<
2854  "constexpr constructor that does not initialize all members "
2855  "is a C++20 extension">, InGroup<CXX20>;
2856def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2857  "constexpr constructor that does not initialize all members "
2858  "is incompatible with C++ standards before C++20">,
2859  InGroup<CXXPre20Compat>, DefaultIgnore;
2860def note_constexpr_ctor_missing_init : Note<
2861  "member not initialized by constructor">;
2862def note_non_literal_no_constexpr_ctors : Note<
2863  "%0 is not literal because it is not an aggregate and has no constexpr "
2864  "constructors other than copy or move constructors">;
2865def note_non_literal_base_class : Note<
2866  "%0 is not literal because it has base class %1 of non-literal type">;
2867def note_non_literal_field : Note<
2868  "%0 is not literal because it has data member %1 of "
2869  "%select{non-literal|volatile}3 type %2">;
2870def note_non_literal_user_provided_dtor : Note<
2871  "%0 is not literal because it has a user-provided destructor">;
2872def note_non_literal_nontrivial_dtor : Note<
2873  "%0 is not literal because it has a non-trivial destructor">;
2874def note_non_literal_non_constexpr_dtor : Note<
2875  "%0 is not literal because its destructor is not constexpr">;
2876def note_non_literal_lambda : Note<
2877  "lambda closure types are non-literal types before C++17">;
2878def warn_private_extern : Warning<
2879  "use of __private_extern__ on a declaration may not produce external symbol "
2880  "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2881def note_private_extern : Note<
2882  "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2883
2884// C++ Concepts
2885def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2886  "concept declarations may only appear in global or namespace scope">;
2887def err_concept_no_parameters : Error<
2888  "concept template parameter list must have at least one parameter; explicit "
2889  "specialization of concepts is not allowed">;
2890def err_concept_extra_headers : Error<
2891  "extraneous template parameter list in concept definition">;
2892def err_concept_no_associated_constraints : Error<
2893  "concept cannot have associated constraints">;
2894def err_non_constant_constraint_expression : Error<
2895  "substitution into constraint expression resulted in a non-constant "
2896  "expression">;
2897def err_non_bool_atomic_constraint : Error<
2898  "atomic constraint must be of type 'bool' (found %0)">;
2899def err_template_arg_list_constraints_not_satisfied : Error<
2900  "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2901  "template template parameter|template}0 %1%2">;
2902def note_substituted_constraint_expr_is_ill_formed : Note<
2903  "because substituted constraint expression is ill-formed%0">;
2904def note_constraint_references_error
2905    : Note<"constraint depends on a previously diagnosed expression">;
2906def note_atomic_constraint_evaluated_to_false : Note<
2907  "%select{and|because}0 '%1' evaluated to false">;
2908def note_concept_specialization_constraint_evaluated_to_false : Note<
2909  "%select{and|because}0 '%1' evaluated to false">;
2910def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2911  "%select{and|because}0 %1 does not satisfy %2">;
2912def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2913  "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2914def err_constrained_virtual_method : Error<
2915  "virtual function cannot have a requires clause">;
2916def err_trailing_requires_clause_on_deduction_guide : Error<
2917  "deduction guide cannot have a requires clause">;
2918def err_constrained_non_templated_function
2919    : Error<"non-templated function cannot have a requires clause">;
2920def err_reference_to_function_with_unsatisfied_constraints : Error<
2921  "invalid reference to function %0: constraints not satisfied">;
2922def err_requires_expr_local_parameter_default_argument : Error<
2923  "default arguments not allowed for parameters of a requires expression">;
2924def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2925  "constraint variable %0 cannot be used in an evaluated context">;
2926def note_expr_requirement_expr_substitution_error : Note<
2927  "%select{and|because}0 '%1' would be invalid: %2">;
2928def note_expr_requirement_expr_unknown_substitution_error : Note<
2929  "%select{and|because}0 '%1' would be invalid">;
2930def note_expr_requirement_noexcept_not_met : Note<
2931  "%select{and|because}0 '%1' may throw an exception">;
2932def note_expr_requirement_type_requirement_substitution_error : Note<
2933  "%select{and|because}0 '%1' would be invalid: %2">;
2934def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
2935  "%select{and|because}0 '%1' would be invalid">;
2936def note_expr_requirement_constraints_not_satisfied : Note<
2937  "%select{and|because}0 type constraint '%1' was not satisfied:">;
2938def note_expr_requirement_constraints_not_satisfied_simple : Note<
2939  "%select{and|because}0 %1 does not satisfy %2:">;
2940def note_type_requirement_substitution_error : Note<
2941  "%select{and|because}0 '%1' would be invalid: %2">;
2942def note_type_requirement_unknown_substitution_error : Note<
2943  "%select{and|because}0 '%1' would be invalid">;
2944def note_nested_requirement_substitution_error : Note<
2945  "%select{and|because}0 '%1' would be invalid%2">;
2946def note_nested_requirement_unknown_substitution_error : Note<
2947  "%select{and|because}0 '%1' would be invalid">;
2948def note_ambiguous_atomic_constraints : Note<
2949  "similar constraint expressions not considered equivalent; constraint "
2950  "expressions cannot be considered equivalent unless they originate from the "
2951  "same concept">;
2952def note_ambiguous_atomic_constraints_similar_expression : Note<
2953  "similar constraint expression here">;
2954def err_unsupported_placeholder_constraint : Error<
2955  "constrained placeholder types other than simple 'auto' on non-type template "
2956  "parameters not supported yet">;
2957
2958def err_template_different_requires_clause : Error<
2959  "requires clause differs in template redeclaration">;
2960def err_template_different_type_constraint : Error<
2961  "type constraint differs in template redeclaration">;
2962def err_template_template_parameter_not_at_least_as_constrained : Error<
2963  "template template argument %0 is more constrained than template template "
2964  "parameter %1">;
2965
2966def err_type_constraint_non_type_concept : Error<
2967  "concept named in type constraint is not a type concept">;
2968def err_type_constraint_missing_arguments : Error<
2969  "%0 requires more than 1 template argument; provide the remaining arguments "
2970  "explicitly to use it here">;
2971def err_placeholder_constraints_not_satisfied : Error<
2972  "deduced type %0 does not satisfy %1">;
2973
2974// C++11 char16_t/char32_t
2975def warn_cxx98_compat_unicode_type : Warning<
2976  "'%0' type specifier is incompatible with C++98">,
2977  InGroup<CXX98Compat>, DefaultIgnore;
2978def warn_cxx17_compat_unicode_type : Warning<
2979  "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2980  InGroup<CXXPre20Compat>, DefaultIgnore;
2981
2982// __make_integer_seq
2983def err_integer_sequence_negative_length : Error<
2984  "integer sequences must have non-negative sequence length">;
2985def err_integer_sequence_integral_element_type : Error<
2986  "integer sequences must have integral element type">;
2987
2988// __type_pack_element
2989def err_type_pack_element_out_of_bounds : Error<
2990  "a parameter pack may not be accessed at an out of bounds index">;
2991
2992// Objective-C++
2993def err_objc_decls_may_only_appear_in_global_scope : Error<
2994  "Objective-C declarations may only appear in global scope">;
2995def warn_auto_var_is_id : Warning<
2996  "'auto' deduced as 'id' in declaration of %0">,
2997  InGroup<DiagGroup<"auto-var-id">>;
2998
2999// Attributes
3000def warn_attribute_ignored_no_calls_in_stmt: Warning<
3001  "%0 attribute is ignored because there exists no call expression inside the "
3002  "statement">,
3003  InGroup<IgnoredAttributes>;
3004
3005def warn_attribute_ignored_non_function_pointer: Warning<
3006  "%0 attribute is ignored because %1 is not a function pointer">,
3007  InGroup<IgnoredAttributes>;
3008
3009def warn_function_attribute_ignored_in_stmt : Warning<
3010  "attribute is ignored on this statement as it only applies to functions; "
3011  "use '%0' on statements">,
3012  InGroup<IgnoredAttributes>;
3013
3014def err_musttail_needs_trivial_args : Error<
3015  "tail call requires that the return value, all parameters, and any "
3016  "temporaries created by the expression are trivially destructible">;
3017def err_musttail_needs_call : Error<
3018  "%0 attribute requires that the return value is the result of a function call"
3019  >;
3020def err_musttail_needs_prototype : Error<
3021  "%0 attribute requires that both caller and callee functions have a "
3022  "prototype">;
3023def note_musttail_fix_non_prototype : Note<
3024  "add 'void' to the parameter list to turn an old-style K&R function "
3025  "declaration into a prototype">;
3026def err_musttail_structors_forbidden : Error<"cannot perform a tail call "
3027  "%select{from|to}0 a %select{constructor|destructor}1">;
3028def note_musttail_structors_forbidden : Note<"target "
3029  "%select{constructor|destructor}0 is declared here">;
3030def err_musttail_forbidden_from_this_context : Error<
3031  "%0 attribute cannot be used from "
3032  "%select{a block|an Objective-C function|this context}1">;
3033def err_musttail_member_mismatch : Error<
3034  "%select{non-member|static member|non-static member}0 "
3035  "function cannot perform a tail call to "
3036  "%select{non-member|static member|non-static member|pointer-to-member}1 "
3037  "function%select{| %3}2">;
3038def note_musttail_callee_defined_here : Note<"%0 declared here">;
3039def note_tail_call_required : Note<"tail call required by %0 attribute here">;
3040def err_musttail_mismatch : Error<
3041  "cannot perform a tail call to function%select{| %1}0 because its signature "
3042  "is incompatible with the calling function">;
3043def note_musttail_mismatch : Note<
3044    "target function "
3045    "%select{is a member of different class%diff{ (expected $ but has $)|}1,2"
3046    "|has different number of parameters (expected %1 but has %2)"
3047    "|has type mismatch at %ordinal3 parameter"
3048    "%diff{ (expected $ but has $)|}1,2"
3049    "|has different return type%diff{ ($ expected but has $)|}1,2}0">;
3050def err_musttail_callconv_mismatch : Error<
3051  "cannot perform a tail call to function%select{| %1}0 because it uses an "
3052  "incompatible calling convention">;
3053def note_musttail_callconv_mismatch : Note<
3054  "target function has calling convention %1 (expected %0)">;
3055def err_musttail_scope : Error<
3056  "cannot perform a tail call from this return statement">;
3057def err_musttail_no_variadic : Error<
3058  "%0 attribute may not be used with variadic functions">;
3059
3060def err_nsobject_attribute : Error<
3061  "'NSObject' attribute is for pointer types only">;
3062def err_attributes_are_not_compatible : Error<
3063  "%0 and %1%select{ attributes|}2 are not compatible">;
3064def err_attribute_invalid_argument : Error<
3065  "%select{a reference type|an array type|a non-vector or "
3066  "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
3067def err_attribute_wrong_number_arguments : Error<
3068  "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
3069  ":requires exactly %1 arguments}1">;
3070def err_attribute_wrong_number_arguments_for : Error <
3071  "%0 attribute references function %1, which %plural{0:takes no arguments|1:takes one argument|"
3072  ":takes exactly %2 arguments}2">;
3073def err_attribute_bounds_for_function : Error<
3074  "%0 attribute references parameter %1, but the function %2 has only %3 parameters">;
3075def err_attribute_no_member_function : Error<
3076  "%0 attribute cannot be applied to non-static member functions">;
3077def err_attribute_parameter_types : Error<
3078  "%0 attribute parameter types do not match: parameter %1 of function %2 has type %3, "
3079  "but parameter %4 of function %5 has type %6">;
3080
3081def err_attribute_too_many_arguments : Error<
3082  "%0 attribute takes no more than %1 argument%s1">;
3083def err_attribute_too_few_arguments : Error<
3084  "%0 attribute takes at least %1 argument%s1">;
3085def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
3086def err_attribute_invalid_bitint_vector_type : Error<
3087  "'_BitInt' vector element width must be %select{a power of 2|"
3088  "at least as wide as 'CHAR_BIT'}0">;
3089def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
3090def err_attribute_bad_neon_vector_size : Error<
3091  "Neon vector size must be 64 or 128 bits">;
3092def err_attribute_invalid_sve_type : Error<
3093  "%0 attribute applied to non-SVE type %1">;
3094def err_attribute_bad_sve_vector_size : Error<
3095  "invalid SVE vector size '%0', must match value set by "
3096  "'-msve-vector-bits' ('%1')">;
3097def err_attribute_arm_feature_sve_bits_unsupported : Error<
3098  "%0 is only supported when '-msve-vector-bits=<bits>' is specified with a "
3099  "value of 128, 256, 512, 1024 or 2048.">;
3100def err_sve_vector_in_non_sve_target : Error<
3101  "SVE vector type %0 cannot be used in a target without sve">;
3102def err_attribute_riscv_rvv_bits_unsupported : Error<
3103  "%0 is only supported when '-mrvv-vector-bits=<bits>' is specified with a "
3104  "value of \"zvl\" or a power 2 in the range [64,65536]">;
3105def err_attribute_bad_rvv_vector_size : Error<
3106  "invalid RVV vector size '%0', expected size is '%1' based on LMUL of type "
3107  "and '-mrvv-vector-bits'">;
3108def err_attribute_invalid_rvv_type : Error<
3109  "%0 attribute applied to non-RVV type %1">;
3110def err_attribute_requires_positive_integer : Error<
3111  "%0 attribute requires a %select{positive|non-negative}1 "
3112  "integral compile time constant expression">;
3113def err_attribute_requires_opencl_version : Error<
3114  "attribute %0 is supported in the OpenCL version %1%select{| onwards}2">;
3115def err_invalid_branch_protection_spec : Error<
3116  "invalid or misplaced branch protection specification '%0'">;
3117def warn_unsupported_branch_protection_spec : Warning<
3118  "unsupported branch protection specification '%0'">, InGroup<BranchProtection>;
3119
3120def warn_unsupported_target_attribute
3121    : Warning<"%select{unsupported|duplicate|unknown}0%select{| CPU|"
3122              " tune CPU}1 '%2' in the '%select{target|target_clones|target_version}3' "
3123              "attribute string; '%select{target|target_clones|target_version}3' "
3124              "attribute ignored">,
3125      InGroup<IgnoredAttributes>;
3126def err_attribute_unsupported
3127    : Error<"%0 attribute is not supported on targets missing %1;"
3128            " specify an appropriate -march= or -mcpu=">;
3129// The err_*_attribute_argument_not_int are separate because they're used by
3130// VerifyIntegerConstantExpression.
3131def err_aligned_attribute_argument_not_int : Error<
3132  "'aligned' attribute requires integer constant">;
3133def err_align_value_attribute_argument_not_int : Error<
3134  "'align_value' attribute requires integer constant">;
3135def err_alignas_attribute_wrong_decl_type : Error<
3136  "%0 attribute cannot be applied to %select{a function parameter|"
3137  "a variable with 'register' storage class|a 'catch' variable|a bit-field|"
3138  "an enumeration}1">;
3139def err_alignas_missing_on_definition : Error<
3140  "%0 must be specified on definition if it is specified on any declaration">;
3141def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
3142def err_alignas_mismatch : Error<
3143  "redeclaration has different alignment requirement (%1 vs %0)">;
3144def err_alignas_underaligned : Error<
3145  "requested alignment is less than minimum alignment of %1 for type %0">;
3146def warn_aligned_attr_underaligned : Warning<err_alignas_underaligned.Summary>,
3147  InGroup<IgnoredAttributes>;
3148def err_attribute_sizeless_type : Error<
3149  "%0 attribute cannot be applied to sizeless type %1">;
3150def err_attribute_argument_n_type : Error<
3151  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
3152  "constant|a string|an identifier|a constant expression|a builtin function}2">;
3153def err_attribute_argument_type : Error<
3154  "%0 attribute requires %select{int or bool|an integer "
3155  "constant|a string|an identifier}1">;
3156def err_attribute_argument_out_of_range : Error<
3157  "%0 attribute requires integer constant between %1 and %2 inclusive">;
3158def err_init_priority_object_attr : Error<
3159  "can only use 'init_priority' attribute on file-scope definitions "
3160  "of objects of class type">;
3161def err_attribute_argument_out_of_bounds : Error<
3162  "%0 attribute parameter %1 is out of bounds">;
3163def err_attribute_only_once_per_parameter : Error<
3164  "%0 attribute can only be applied once per parameter">;
3165def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
3166def note_previous_uuid : Note<"previous uuid specified here">;
3167def warn_attribute_pointers_only : Warning<
3168  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
3169  InGroup<IgnoredAttributes>;
3170def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Summary>;
3171def err_attribute_integers_only : Error<
3172  "%0 attribute argument may only refer to a function parameter of integer "
3173  "type">;
3174def warn_attribute_return_pointers_only : Warning<
3175  "%0 attribute only applies to return values that are pointers">,
3176  InGroup<IgnoredAttributes>;
3177def warn_attribute_return_pointers_refs_only : Warning<
3178  "%0 attribute only applies to return values that are pointers or references">,
3179  InGroup<IgnoredAttributes>;
3180def warn_attribute_pointer_or_reference_only : Warning<
3181  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
3182  InGroup<IgnoredAttributes>;
3183def err_attribute_no_member_pointers : Error<
3184  "%0 attribute cannot be used with pointers to members">;
3185def err_attribute_invalid_implicit_this_argument : Error<
3186  "%0 attribute is invalid for the implicit this argument">;
3187def err_ownership_type : Error<
3188  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
3189def err_ownership_returns_index_mismatch : Error<
3190  "'ownership_returns' attribute index does not match; here it is %0">;
3191def note_ownership_returns_index_mismatch : Note<
3192  "declared with index %0 here">;
3193def err_format_strftime_third_parameter : Error<
3194  "strftime format attribute requires 3rd parameter to be 0">;
3195def err_format_attribute_not : Error<"format argument not a string type">;
3196def err_format_attribute_result_not : Error<"function does not return %0">;
3197def err_format_attribute_implicit_this_format_string : Error<
3198  "format attribute cannot specify the implicit this argument as the format "
3199  "string">;
3200def err_callback_attribute_no_callee : Error<
3201  "'callback' attribute specifies no callback callee">;
3202def err_callback_attribute_invalid_callee : Error<
3203  "'callback' attribute specifies invalid callback callee">;
3204def err_callback_attribute_multiple : Error<
3205  "multiple 'callback' attributes specified">;
3206def err_callback_attribute_argument_unknown : Error<
3207  "'callback' attribute argument %0 is not a known function parameter">;
3208def err_callback_callee_no_function_type : Error<
3209  "'callback' attribute callee does not have function type">;
3210def err_callback_callee_is_variadic : Error<
3211  "'callback' attribute callee may not be variadic">;
3212def err_callback_implicit_this_not_available : Error<
3213  "'callback' argument at position %0 references unavailable implicit 'this'">;
3214def err_init_method_bad_return_type : Error<
3215  "init methods must return an object pointer type, not %0">;
3216def err_attribute_invalid_size : Error<
3217  "vector size not an integral multiple of component size">;
3218def err_attribute_zero_size : Error<"zero %0 size">;
3219def err_attribute_size_too_large : Error<"%0 size too large">;
3220def err_typecheck_sve_rvv_ambiguous : Error<
3221  "cannot combine fixed-length and sizeless %select{SVE|RVV}0 vectors "
3222  "in expression, result is ambiguous (%1 and %2)">;
3223def err_typecheck_sve_rvv_gnu_ambiguous : Error<
3224  "cannot combine GNU and %select{SVE|RVV}0 vectors in expression, result is ambiguous (%1 and %2)">;
3225def err_typecheck_vector_not_convertable_implict_truncation : Error<
3226   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
3227   " %2 as implicit conversion would cause truncation">;
3228def err_typecheck_vector_not_convertable : Error<
3229  "cannot convert between vector values of different size (%0 and %1)">;
3230def err_typecheck_vector_not_convertable_non_scalar : Error<
3231  "cannot convert between vector and non-scalar values (%0 and %1)">;
3232def err_typecheck_vector_lengths_not_equal : Error<
3233  "vector operands do not have the same number of elements (%0 and %1)">;
3234def warn_typecheck_vector_element_sizes_not_equal : Warning<
3235  "vector operands do not have the same elements sizes (%0 and %1)">,
3236  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
3237def err_ext_vector_component_exceeds_length : Error<
3238  "vector component access exceeds type %0">;
3239def err_ext_vector_component_name_illegal : Error<
3240  "illegal vector component name '%0'">;
3241def err_attribute_address_space_negative : Error<
3242  "address space is negative">;
3243def err_attribute_address_space_too_high : Error<
3244  "address space is larger than the maximum supported (%0)">;
3245def err_attribute_address_multiple_qualifiers : Error<
3246  "multiple address spaces specified for type">;
3247def warn_attribute_address_multiple_identical_qualifiers : Warning<
3248  "multiple identical address spaces specified for type">,
3249  InGroup<DuplicateDeclSpecifier>;
3250def err_attribute_not_clinkage : Error<
3251  "function type with %0 attribute must have C linkage">;
3252def err_function_decl_cmse_ns_call : Error<
3253  "functions may not be declared with 'cmse_nonsecure_call' attribute">;
3254def err_attribute_address_function_type : Error<
3255  "function type may not be qualified with an address space">;
3256def err_as_qualified_auto_decl : Error<
3257  "automatic variable qualified with an%select{| invalid}0 address space">;
3258def err_arg_with_address_space : Error<
3259  "parameter may not be qualified with an address space">;
3260def err_field_with_address_space : Error<
3261  "field may not be qualified with an address space">;
3262def err_compound_literal_with_address_space : Error<
3263  "compound literal in function scope may not be qualified with an address space">;
3264def err_address_space_mismatch_templ_inst : Error<
3265  "conflicting address space qualifiers are provided between types %0 and %1">;
3266def err_attr_objc_ownership_redundant : Error<
3267  "the type %0 is already explicitly ownership-qualified">;
3268def err_invalid_nsnumber_type : Error<
3269  "%0 is not a valid literal type for NSNumber">;
3270def err_objc_illegal_boxed_expression_type : Error<
3271  "illegal type %0 used in a boxed expression">;
3272def err_objc_non_trivially_copyable_boxed_expression_type : Error<
3273  "non-trivially copyable type %0 cannot be used in a boxed expression">;
3274def err_objc_incomplete_boxed_expression_type : Error<
3275  "incomplete type %0 used in a boxed expression">;
3276def err_undeclared_objc_literal_class : Error<
3277  "definition of class %0 must be available to use Objective-C "
3278  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
3279  "string literals}1">;
3280def err_undeclared_boxing_method : Error<
3281  "declaration of %0 is missing in %1 class">;
3282def err_objc_literal_method_sig : Error<
3283  "literal construction method %0 has incompatible signature">;
3284def note_objc_literal_method_param : Note<
3285  "%select{first|second|third}0 parameter has unexpected type %1 "
3286  "(should be %2)">;
3287def note_objc_literal_method_return : Note<
3288  "method returns unexpected type %0 (should be an object type)">;
3289def err_invalid_collection_element : Error<
3290  "collection element of type %0 is not an Objective-C object">;
3291def err_box_literal_collection : Error<
3292  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3293  "in a collection">;
3294def warn_objc_literal_comparison : Warning<
3295  "direct comparison of %select{an array literal|a dictionary literal|"
3296  "a numeric literal|a boxed expression|}0 has undefined behavior">,
3297  InGroup<ObjCLiteralComparison>;
3298def err_missing_atsign_prefix : Error<
3299  "%select{string|numeric}0 literal must be prefixed by '@'">;
3300def warn_objc_string_literal_comparison : Warning<
3301  "direct comparison of a string literal has undefined behavior">,
3302  InGroup<ObjCStringComparison>;
3303def warn_concatenated_literal_array_init : Warning<
3304  "suspicious concatenation of string literals in an array initialization; "
3305  "did you mean to separate the elements with a comma?">,
3306  InGroup<StringConcatation>, DefaultIgnore;
3307def warn_concatenated_nsarray_literal : Warning<
3308  "concatenated NSString literal for an NSArray expression - "
3309  "possibly missing a comma">,
3310  InGroup<ObjCStringConcatenation>;
3311def note_objc_literal_comparison_isequal : Note<
3312  "use 'isEqual:' instead">;
3313def warn_objc_collection_literal_element : Warning<
3314  "object of type %0 is not compatible with "
3315  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3316  InGroup<ObjCLiteralConversion>;
3317def warn_nsdictionary_duplicate_key : Warning<
3318  "duplicate key in dictionary literal">,
3319  InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3320def note_nsdictionary_duplicate_key_here : Note<
3321  "previous equal key is here">;
3322def err_swift_param_attr_not_swiftcall : Error<
3323  "'%0' parameter can only be used with swiftcall%select{ or swiftasynccall|}1 "
3324  "calling convention%select{|s}1">;
3325def err_swift_indirect_result_not_first : Error<
3326  "'swift_indirect_result' parameters must be first parameters of function">;
3327def err_swift_error_result_not_after_swift_context : Error<
3328  "'swift_error_result' parameter must follow 'swift_context' parameter">;
3329def err_swift_abi_parameter_wrong_type : Error<
3330  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3331  "type here is %2">;
3332
3333def err_attribute_argument_invalid : Error<
3334  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3335  "min must not be greater than max}1">;
3336def err_attribute_argument_is_zero : Error<
3337  "%0 attribute must be greater than 0">;
3338def warn_attribute_argument_n_negative : Warning<
3339  "%0 attribute parameter %1 is negative and will be ignored">,
3340  InGroup<CudaCompat>;
3341def err_property_function_in_objc_container : Error<
3342  "use of Objective-C property in function nested in Objective-C "
3343  "container not supported, move function outside its container">;
3344
3345let CategoryName = "Cocoa API Issue" in {
3346def warn_objc_redundant_literal_use : Warning<
3347  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3348}
3349
3350def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3351  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3352
3353def err_aix_attr_unsupported_tls_model : Error<"TLS model '%0' is not yet supported on AIX">;
3354
3355def err_tls_var_aligned_over_maximum : Error<
3356  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3357  "alignment (%2) for a thread-local variable on this target">;
3358
3359def err_only_annotate_after_access_spec : Error<
3360  "access specifier can only have annotation attributes">;
3361
3362def err_attribute_section_invalid_for_target : Error<
3363  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3364def err_pragma_section_invalid_for_target : Error<
3365  "argument to #pragma section is not valid for this target: %0">;
3366def warn_attribute_section_drectve : Warning<
3367  "#pragma %0(\".drectve\") has undefined behavior, "
3368  "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3369def warn_mismatched_section : Warning<
3370  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3371def warn_attribute_section_on_redeclaration : Warning<
3372  "section attribute is specified on redeclared variable">, InGroup<Section>;
3373def err_mismatched_code_seg_base : Error<
3374  "derived class must specify the same code segment as its base classes">;
3375def err_mismatched_code_seg_override : Error<
3376  "overriding virtual function must specify the same code segment as its overridden function">;
3377def err_conflicting_codeseg_attribute : Error<
3378  "conflicting code segment specifiers">;
3379def warn_duplicate_codeseg_attribute : Warning<
3380  "duplicate code segment specifiers">, InGroup<Section>;
3381
3382def err_anonymous_property: Error<
3383  "anonymous property is not supported">;
3384def err_property_is_variably_modified : Error<
3385  "property %0 has a variably modified type">;
3386def err_no_accessor_for_property : Error<
3387  "no %select{getter|setter}0 defined for property %1">;
3388def err_cannot_find_suitable_accessor : Error<
3389  "cannot find suitable %select{getter|setter}0 for property %1">;
3390
3391def warn_alloca : Warning<
3392  "use of function %0 is discouraged; there is no way to check for failure but "
3393  "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3394  InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3395
3396def warn_alloca_align_alignof : Warning<
3397  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3398  InGroup<DiagGroup<"alloca-with-align-alignof">>;
3399
3400def err_alignment_too_small : Error<
3401  "requested alignment must be %0 or greater">;
3402def err_alignment_too_big : Error<
3403  "requested alignment must be %0 or smaller">;
3404def err_alignment_not_power_of_two : Error<
3405  "requested alignment is not a power of 2">;
3406def warn_alignment_not_power_of_two : Warning<
3407  err_alignment_not_power_of_two.Summary>,
3408  InGroup<DiagGroup<"non-power-of-two-alignment">>;
3409def err_alignment_dependent_typedef_name : Error<
3410  "requested alignment is dependent but declaration is not dependent">;
3411
3412def warn_alignment_builtin_useless : Warning<
3413  "%select{aligning a value|the result of checking whether a value is aligned}0"
3414  " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3415def err_attribute_aligned_too_great : Error<
3416  "requested alignment must be %0 bytes or smaller">;
3417def warn_assume_aligned_too_great
3418    : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3419              "alignment assumed">,
3420      InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3421def warn_not_xl_compatible
3422    : Warning<"alignment of 16 bytes for a struct member is not binary "
3423              "compatible with IBM XL C/C++ for AIX 16.1.0 or older">,
3424      InGroup<AIXCompat>;
3425def note_misaligned_member_used_here : Note<
3426    "passing byval argument %0 with potentially incompatible alignment here">;
3427def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3428  "%q0 redeclared without %1 attribute: previous %1 ignored">,
3429  InGroup<MicrosoftInconsistentDllImport>;
3430def warn_redeclaration_without_import_attribute : Warning<
3431  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3432  InGroup<MicrosoftInconsistentDllImport>;
3433def warn_dllimport_dropped_from_inline_function : Warning<
3434  "%q0 redeclared inline; %1 attribute ignored">,
3435  InGroup<IgnoredAttributes>;
3436def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3437  " exception specification; attribute ignored">,
3438  InGroup<IgnoredAttributes>;
3439def warn_attribute_ignored_on_non_definition :
3440  Warning<"%0 attribute ignored on a non-definition declaration">,
3441  InGroup<IgnoredAttributes>;
3442def warn_attribute_ignored_on_inline :
3443  Warning<"%0 attribute ignored on inline function">,
3444  InGroup<IgnoredAttributes>;
3445def warn_nocf_check_attribute_ignored :
3446  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3447  InGroup<IgnoredAttributes>;
3448def warn_attribute_after_definition_ignored : Warning<
3449  "attribute %0 after definition is ignored">,
3450   InGroup<IgnoredAttributes>;
3451def warn_attributes_likelihood_ifstmt_conflict
3452    : Warning<"conflicting attributes %0 are ignored">,
3453      InGroup<IgnoredAttributes>;
3454def warn_cxx11_gnu_attribute_on_type : Warning<
3455  "attribute %0 ignored, because it cannot be applied to a type">,
3456  InGroup<IgnoredAttributes>;
3457def warn_unhandled_ms_attribute_ignored : Warning<
3458  "__declspec attribute %0 is not supported">,
3459  InGroup<IgnoredAttributes>;
3460def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3461  "attribute %0 has no effect when annotating an infinite loop">,
3462   InGroup<IgnoredAttributes>;
3463def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3464  "annotating the infinite loop here">;
3465def warn_attribute_has_no_effect_on_compile_time_if : Warning<
3466  "attribute %0 has no effect when annotating an 'if %select{constexpr|consteval}1' statement">,
3467   InGroup<IgnoredAttributes>;
3468def note_attribute_has_no_effect_on_compile_time_if_here : Note<
3469  "annotating the 'if %select{constexpr|consteval}0' statement here">;
3470def err_decl_attribute_invalid_on_stmt : Error<
3471  "%0%select{ attribute|}1 cannot be applied to a statement">;
3472def err_attribute_invalid_on_decl : Error<
3473  "%0%select{ attribute|}1 cannot be applied to a declaration">;
3474def warn_type_attribute_deprecated_on_decl : Warning<
3475  "applying attribute %0 to a declaration is deprecated; apply it to the type instead">,
3476  InGroup<DeprecatedAttributes>;
3477def warn_declspec_attribute_ignored : Warning<
3478  "attribute %0 is ignored, place it after "
3479  "\"%select{class|struct|interface|union|enum|enum class|enum struct}1\" to apply attribute to "
3480  "type declaration">, InGroup<IgnoredAttributes>;
3481def err_declspec_keyword_has_no_effect : Error<
3482  "%0 cannot appear here, place it after "
3483  "\"%select{class|struct|interface|union|enum}1\" to apply it to the "
3484  "type declaration">;
3485def warn_attribute_precede_definition : Warning<
3486  "attribute declaration must precede definition">,
3487  InGroup<IgnoredAttributes>;
3488def warn_attribute_void_function_method : Warning<
3489  "attribute %0 cannot be applied to "
3490  "%select{functions|Objective-C method}1 without return value">,
3491  InGroup<IgnoredAttributes>;
3492def warn_attribute_weak_on_field : Warning<
3493  "__weak attribute cannot be specified on a field declaration">,
3494  InGroup<IgnoredAttributes>;
3495def warn_gc_attribute_weak_on_local : Warning<
3496  "Objective-C GC does not allow weak variables on the stack">,
3497  InGroup<IgnoredAttributes>;
3498def warn_nsobject_attribute : Warning<
3499  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3500  InGroup<NSobjectAttribute>;
3501def warn_independentclass_attribute : Warning<
3502  "'objc_independent_class' attribute may be put on a typedef only; "
3503  "attribute is ignored">,
3504  InGroup<IndependentClassAttribute>;
3505def warn_ptr_independentclass_attribute : Warning<
3506  "'objc_independent_class' attribute may be put on Objective-C object "
3507  "pointer type only; attribute is ignored">,
3508  InGroup<IndependentClassAttribute>;
3509def warn_attribute_weak_on_local : Warning<
3510  "__weak attribute cannot be specified on an automatic variable when ARC "
3511  "is not enabled">,
3512  InGroup<IgnoredAttributes>;
3513def warn_weak_identifier_undeclared : Warning<
3514  "weak identifier %0 never declared">;
3515def warn_attribute_cmse_entry_static : Warning<
3516  "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3517  InGroup<IgnoredAttributes>;
3518def warn_cmse_nonsecure_union : Warning<
3519  "passing union across security boundary via %select{parameter %1|return value}0 "
3520  "may leak information">,
3521  InGroup<DiagGroup<"cmse-union-leak">>;
3522def err_attribute_weak_static : Error<
3523  "weak declaration cannot have internal linkage">;
3524def err_attribute_selectany_non_extern_data : Error<
3525  "'selectany' can only be applied to data items with external linkage">;
3526def err_declspec_thread_on_thread_variable : Error<
3527  "'__declspec(thread)' applied to variable that already has a "
3528  "thread-local storage specifier">;
3529def err_attribute_dll_not_extern : Error<
3530  "%q0 must have external linkage when declared %q1">;
3531def err_attribute_dll_thread_local : Error<
3532  "%q0 cannot be thread local when declared %q1">;
3533def err_attribute_dll_lambda : Error<
3534  "lambda cannot be declared %0">;
3535def warn_attribute_invalid_on_definition : Warning<
3536  "'%0' attribute cannot be specified on a definition">,
3537  InGroup<IgnoredAttributes>;
3538def err_attribute_dll_redeclaration : Error<
3539  "redeclaration of %q0 cannot add %q1 attribute">;
3540def warn_attribute_dll_redeclaration : Warning<
3541  "redeclaration of %q0 should not add %q1 attribute">,
3542  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3543def err_attribute_dllimport_function_definition : Error<
3544  "dllimport cannot be applied to non-inline function definition">;
3545def err_attribute_dllimport_function_specialization_definition : Error<
3546  "cannot define non-inline dllimport template specialization">;
3547def err_attribute_dll_deleted : Error<
3548  "attribute %q0 cannot be applied to a deleted function">;
3549def err_attribute_dllimport_data_definition : Error<
3550  "definition of dllimport data">;
3551def err_attribute_dllimport_static_field_definition : Error<
3552  "definition of dllimport static field not allowed">;
3553def warn_attribute_dllimport_static_field_definition : Warning<
3554  "definition of dllimport static field">,
3555  InGroup<DiagGroup<"dllimport-static-field-def">>;
3556def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3557  "explicit instantiation declaration should not be 'dllexport'">,
3558  InGroup<DllexportExplicitInstantiationDecl>;
3559def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3560  "'dllexport' attribute ignored on explicit instantiation definition">,
3561  InGroup<IgnoredAttributes>;
3562def warn_invalid_initializer_from_system_header : Warning<
3563  "invalid constructor from class in system header, should not be explicit">,
3564  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3565def note_used_in_initialization_here : Note<"used in initialization here">;
3566def err_attribute_dll_member_of_dll_class : Error<
3567  "attribute %q0 cannot be applied to member of %q1 class">;
3568def warn_attribute_dll_instantiated_base_class : Warning<
3569  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3570  "base class template without dll attribute is not supported">,
3571  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3572def err_attribute_dll_ambiguous_default_ctor : Error<
3573  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3574def err_attribute_weakref_not_static : Error<
3575  "weakref declaration must have internal linkage">;
3576def err_attribute_weakref_not_global_context : Error<
3577  "weakref declaration of %0 must be in a global context">;
3578def err_attribute_weakref_without_alias : Error<
3579  "weakref declaration of %0 must also have an alias attribute">;
3580def err_alias_not_supported_on_darwin : Error <
3581  "aliases are not supported on darwin">;
3582def warn_attribute_wrong_decl_type_str : Warning<
3583  "%0%select{ attribute|}1 only applies to %2">, InGroup<IgnoredAttributes>;
3584def err_attribute_wrong_decl_type_str : Error<
3585  warn_attribute_wrong_decl_type_str.Summary>;
3586def warn_attribute_wrong_decl_type : Warning<
3587  "%0%select{ attribute|}1 only applies to %select{"
3588  "functions"
3589  "|unions"
3590  "|variables and functions"
3591  "|functions and methods"
3592  "|functions, methods and blocks"
3593  "|functions, methods, and parameters"
3594  "|variables"
3595  "|variables and fields"
3596  "|variables, data members and tag types"
3597  "|types and namespaces"
3598  "|variables, functions and classes"
3599  "|kernel functions"
3600  "|non-K&R-style functions}2">,
3601  InGroup<IgnoredAttributes>;
3602def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Summary>;
3603def warn_type_attribute_wrong_type : Warning<
3604  "'%0' only applies to %select{function|pointer|"
3605  "Objective-C object or block pointer}1 types; type here is %2">,
3606  InGroup<IgnoredAttributes>;
3607def err_type_attribute_wrong_type : Error<
3608  warn_type_attribute_wrong_type.Summary>;
3609def warn_incomplete_encoded_type : Warning<
3610  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3611  InGroup<DiagGroup<"encode-type">>;
3612def warn_gnu_inline_attribute_requires_inline : Warning<
3613  "'gnu_inline' attribute requires function to be marked 'inline',"
3614  " attribute ignored">,
3615  InGroup<IgnoredAttributes>;
3616def warn_gnu_inline_cplusplus_without_extern : Warning<
3617  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3618  " available, this changed in Clang 10">,
3619  InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3620def err_attribute_vecreturn_only_vector_member : Error<
3621  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3622def err_attribute_vecreturn_only_pod_record : Error<
3623  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3624def err_cconv_change : Error<
3625  "function declared '%0' here was previously declared "
3626  "%select{'%2'|without calling convention}1">;
3627def warn_cconv_unsupported : Warning<
3628  "%0 calling convention is not supported %select{"
3629  // Use CallingConventionIgnoredReason Enum to specify these.
3630  "for this target"
3631  "|on variadic function"
3632  "|on constructor/destructor"
3633  "|on builtin function"
3634  "}1">,
3635  InGroup<IgnoredAttributes>;
3636def error_cconv_unsupported : Error<warn_cconv_unsupported.Summary>;
3637def err_cconv_knr : Error<
3638  "function with no prototype cannot use the %0 calling convention">;
3639def warn_cconv_knr : Warning<
3640  err_cconv_knr.Summary>,
3641  InGroup<DiagGroup<"missing-prototype-for-cc">>;
3642def err_cconv_varargs : Error<
3643  "variadic function cannot use %0 calling convention">;
3644def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3645  "attribute was previously declared "
3646  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3647def err_function_attribute_mismatch : Error<
3648  "function declared with %0 attribute "
3649  "was previously declared without the %0 attribute">;
3650def err_objc_precise_lifetime_bad_type : Error<
3651  "objc_precise_lifetime only applies to retainable types; type here is %0">;
3652def warn_objc_precise_lifetime_meaningless : Error<
3653  "objc_precise_lifetime is not meaningful for "
3654  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3655def err_invalid_pcs : Error<"invalid PCS type">;
3656def warn_attribute_not_on_decl : Warning<
3657  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3658def err_base_specifier_attribute : Error<
3659  "%0%select{ attribute|}1 cannot be applied to a base specifier">;
3660def warn_declspec_allocator_nonpointer : Warning<
3661  "ignoring __declspec(allocator) because the function return type %0 is not "
3662  "a pointer or reference type">, InGroup<IgnoredAttributes>;
3663def err_cconv_incomplete_param_type : Error<
3664  "parameter %0 must have a complete type to use function %1 with the %2 "
3665  "calling convention">;
3666def err_attribute_output_parameter : Error<
3667  "attribute only applies to output parameters">;
3668
3669def ext_cannot_use_trivial_abi : ExtWarn<
3670  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3671def note_cannot_use_trivial_abi_reason : Note<
3672  "'trivial_abi' is disallowed on %0 because %select{"
3673  "its copy constructors and move constructors are all deleted|"
3674  "it is polymorphic|"
3675  "it has a base of a non-trivial class type|it has a virtual base|"
3676  "it has a __weak field|it has a field of a non-trivial class type}1">;
3677
3678// Availability attribute
3679def warn_availability_unknown_platform : Warning<
3680  "unknown platform %0 in availability macro">, InGroup<Availability>;
3681def warn_availability_version_ordering : Warning<
3682  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3683  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3684  "attribute ignored">, InGroup<Availability>;
3685def warn_mismatched_availability: Warning<
3686  "availability does not match previous declaration">, InGroup<Availability>;
3687def warn_mismatched_availability_override : Warning<
3688  "%select{|overriding }4method %select{introduced after|"
3689  "deprecated before|obsoleted before}0 "
3690  "%select{the protocol method it implements|overridden method}4 "
3691  "on %1 (%2 vs. %3)">, InGroup<Availability>;
3692def warn_mismatched_availability_override_unavail : Warning<
3693  "%select{|overriding }1method cannot be unavailable on %0 when "
3694  "%select{the protocol method it implements|its overridden method}1 is "
3695  "available">,
3696  InGroup<Availability>;
3697def warn_availability_on_static_initializer : Warning<
3698  "ignoring availability attribute %select{on '+load' method|"
3699  "with constructor attribute|with destructor attribute}0">,
3700  InGroup<Availability>;
3701def note_overridden_method : Note<
3702  "overridden method is here">;
3703def warn_availability_swift_unavailable_deprecated_only : Warning<
3704  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3705  InGroup<Availability>;
3706def note_protocol_method : Note<
3707  "protocol method is here">;
3708def warn_availability_fuchsia_unavailable_minor : Warning<
3709  "Fuchsia API Level prohibits specifying a minor or sub-minor version">,
3710  InGroup<Availability>;
3711
3712def warn_unguarded_availability :
3713  Warning<"%0 is only available on %1 %2 or newer">,
3714  InGroup<UnguardedAvailability>, DefaultIgnore;
3715def warn_unguarded_availability_new :
3716  Warning<warn_unguarded_availability.Summary>,
3717  InGroup<UnguardedAvailabilityNew>;
3718def note_decl_unguarded_availability_silence : Note<
3719  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3720def note_unguarded_available_silence : Note<
3721  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3722  " this warning">;
3723def warn_at_available_unchecked_use : Warning<
3724  "%select{@available|__builtin_available}0 does not guard availability here; "
3725  "use if (%select{@available|__builtin_available}0) instead">,
3726  InGroup<DiagGroup<"unsupported-availability-guard">>;
3727
3728def warn_missing_sdksettings_for_availability_checking : Warning<
3729  "%0 availability is ignored without a valid 'SDKSettings.json' in the SDK">,
3730  InGroup<DiagGroup<"ignored-availability-without-sdk-settings">>;
3731
3732// Thread Safety Attributes
3733def warn_thread_attribute_ignored : Warning<
3734  "ignoring %0 attribute because its argument is invalid">,
3735  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3736def warn_thread_attribute_not_on_non_static_member : Warning<
3737  "%0 attribute without capability arguments can only be applied to non-static "
3738  "methods of a class">,
3739  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3740def warn_thread_attribute_not_on_capability_member : Warning<
3741  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3742  "annotated with 'capability' or 'scoped_lockable' attribute">,
3743  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3744def warn_thread_attribute_argument_not_lockable : Warning<
3745  "%0 attribute requires arguments whose type is annotated "
3746  "with 'capability' attribute; type here is %1">,
3747  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3748def warn_thread_attribute_decl_not_lockable : Warning<
3749  "%0 attribute can only be applied in a context annotated "
3750  "with 'capability' attribute">,
3751  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3752def warn_thread_attribute_decl_not_pointer : Warning<
3753  "%0 only applies to pointer types; type here is %1">,
3754  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3755def err_attribute_argument_out_of_bounds_extra_info : Error<
3756  "%0 attribute parameter %1 is out of bounds: "
3757  "%plural{0:no parameters to index into|"
3758  "1:can only be 1, since there is one parameter|"
3759  ":must be between 1 and %2}2">;
3760
3761// Thread Safety Analysis
3762def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3763  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3764def warn_unlock_kind_mismatch : Warning<
3765  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3766  "%select{shared|exclusive}3 access">,
3767  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3768def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3769  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3770def warn_no_unlock : Warning<
3771  "%0 '%1' is still held at the end of function">,
3772  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3773def warn_expecting_locked : Warning<
3774  "expecting %0 '%1' to be held at the end of function">,
3775  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3776// FIXME: improve the error message about locks not in scope
3777def warn_lock_some_predecessors : Warning<
3778  "%0 '%1' is not held on every path through here">,
3779  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3780def warn_expecting_lock_held_on_loop : Warning<
3781  "expecting %0 '%1' to be held at start of each loop">,
3782  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3783def note_locked_here : Note<"%0 acquired here">;
3784def note_unlocked_here : Note<"%0 released here">;
3785def warn_lock_exclusive_and_shared : Warning<
3786  "%0 '%1' is acquired exclusively and shared in the same scope">,
3787  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3788def note_lock_exclusive_and_shared : Note<
3789  "the other acquisition of %0 '%1' is here">;
3790def warn_variable_requires_any_lock : Warning<
3791  "%select{reading|writing}1 variable %0 requires holding "
3792  "%select{any mutex|any mutex exclusively}1">,
3793  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3794def warn_var_deref_requires_any_lock : Warning<
3795  "%select{reading|writing}1 the value pointed to by %0 requires holding "
3796  "%select{any mutex|any mutex exclusively}1">,
3797  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3798def warn_fun_excludes_mutex : Warning<
3799  "cannot call function '%1' while %0 '%2' is held">,
3800  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3801def warn_cannot_resolve_lock : Warning<
3802  "cannot resolve lock expression">,
3803  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3804def warn_acquired_before : Warning<
3805  "%0 '%1' must be acquired before '%2'">,
3806  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3807def warn_acquired_before_after_cycle : Warning<
3808  "Cycle in acquired_before/after dependencies, starting with '%0'">,
3809  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3810
3811
3812// Thread safety warnings negative capabilities
3813def warn_acquire_requires_negative_cap : Warning<
3814  "acquiring %0 '%1' requires negative capability '%2'">,
3815  InGroup<ThreadSafetyNegative>, DefaultIgnore;
3816def warn_fun_requires_negative_cap : Warning<
3817  "calling function %0 requires negative capability '%1'">,
3818  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3819
3820// Thread safety warnings on pass by reference
3821def warn_guarded_pass_by_reference : Warning<
3822  "passing variable %1 by reference requires holding %0 "
3823  "%select{'%2'|'%2' exclusively}3">,
3824  InGroup<ThreadSafetyReference>, DefaultIgnore;
3825def warn_pt_guarded_pass_by_reference : Warning<
3826  "passing the value that %1 points to by reference requires holding %0 "
3827  "%select{'%2'|'%2' exclusively}3">,
3828  InGroup<ThreadSafetyReference>, DefaultIgnore;
3829
3830// Imprecise thread safety warnings
3831def warn_variable_requires_lock : Warning<
3832  "%select{reading|writing}3 variable %1 requires holding %0 "
3833  "%select{'%2'|'%2' exclusively}3">,
3834  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3835def warn_var_deref_requires_lock : Warning<
3836  "%select{reading|writing}3 the value pointed to by %1 requires "
3837  "holding %0 %select{'%2'|'%2' exclusively}3">,
3838  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3839def warn_fun_requires_lock : Warning<
3840  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3841  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3842
3843// Precise thread safety warnings
3844def warn_variable_requires_lock_precise :
3845  Warning<warn_variable_requires_lock.Summary>,
3846  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3847def warn_var_deref_requires_lock_precise :
3848  Warning<warn_var_deref_requires_lock.Summary>,
3849  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3850def warn_fun_requires_lock_precise :
3851  Warning<warn_fun_requires_lock.Summary>,
3852  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3853def note_found_mutex_near_match : Note<"found near match '%0'">;
3854
3855// Verbose thread safety warnings
3856def warn_thread_safety_verbose : Warning<"thread safety verbose warning">,
3857  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3858def note_thread_warning_in_fun : Note<"thread warning in function %0">;
3859def note_guarded_by_declared_here : Note<"guarded_by declared here">;
3860
3861// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3862def warn_thread_safety_beta : Warning<"thread safety beta warning">,
3863  InGroup<ThreadSafetyBeta>, DefaultIgnore;
3864
3865// Consumed warnings
3866def warn_use_in_invalid_state : Warning<
3867  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3868  "state">, InGroup<Consumed>, DefaultIgnore;
3869def warn_use_of_temp_in_invalid_state : Warning<
3870  "invalid invocation of method '%0' on a temporary object while it is in the "
3871  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3872def warn_attr_on_unconsumable_class : Warning<
3873  "consumed analysis attribute is attached to member of class %0 which isn't "
3874  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3875def warn_return_typestate_for_unconsumable_type : Warning<
3876  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3877  DefaultIgnore;
3878def warn_return_typestate_mismatch : Warning<
3879  "return value not in expected state; expected '%0', observed '%1'">,
3880  InGroup<Consumed>, DefaultIgnore;
3881def warn_loop_state_mismatch : Warning<
3882  "state of variable '%0' must match at the entry and exit of loop">,
3883  InGroup<Consumed>, DefaultIgnore;
3884def warn_param_return_typestate_mismatch : Warning<
3885  "parameter '%0' not in expected state when the function returns: expected "
3886  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3887def warn_param_typestate_mismatch : Warning<
3888  "argument not in expected state; expected '%0', observed '%1'">,
3889  InGroup<Consumed>, DefaultIgnore;
3890
3891// no_sanitize attribute
3892def warn_unknown_sanitizer_ignored : Warning<
3893  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3894
3895def warn_impcast_vector_scalar : Warning<
3896  "implicit conversion turns vector to scalar: %0 to %1">,
3897  InGroup<Conversion>, DefaultIgnore;
3898def warn_impcast_complex_scalar : Warning<
3899  "implicit conversion discards imaginary component: %0 to %1">,
3900  InGroup<Conversion>, DefaultIgnore;
3901def err_impcast_complex_scalar : Error<
3902  "implicit conversion from %0 to %1 is not permitted in C++">;
3903def warn_impcast_float_precision : Warning<
3904  "implicit conversion loses floating-point precision: %0 to %1">,
3905  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3906def warn_impcast_float_result_precision : Warning<
3907  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3908  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3909def warn_impcast_double_promotion : Warning<
3910  "implicit conversion increases floating-point precision: %0 to %1">,
3911  InGroup<DoublePromotion>, DefaultIgnore;
3912def warn_impcast_integer_sign : Warning<
3913  "implicit conversion changes signedness: %0 to %1">,
3914  InGroup<SignConversion>, DefaultIgnore;
3915def warn_impcast_integer_sign_conditional : Warning<
3916  "operand of ? changes signedness: %0 to %1">,
3917  InGroup<SignConversion>, DefaultIgnore;
3918def warn_impcast_integer_precision : Warning<
3919  "implicit conversion loses integer precision: %0 to %1">,
3920  InGroup<ImplicitIntConversion>, DefaultIgnore;
3921def warn_impcast_high_order_zero_bits : Warning<
3922  "higher order bits are zeroes after implicit conversion">,
3923  InGroup<ImplicitIntConversion>, DefaultIgnore;
3924def warn_impcast_nonnegative_result : Warning<
3925  "the resulting value is always non-negative after implicit conversion">,
3926  InGroup<SignConversion>, DefaultIgnore;
3927def warn_impcast_integer_64_32 : Warning<
3928  "implicit conversion loses integer precision: %0 to %1">,
3929  InGroup<Shorten64To32>, DefaultIgnore;
3930def warn_impcast_integer_precision_constant : Warning<
3931  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3932  InGroup<ConstantConversion>;
3933def warn_impcast_single_bit_bitield_precision_constant : Warning<
3934  "implicit truncation from %2 to a one-bit wide bit-field changes value from "
3935  "%0 to %1">, InGroup<SingleBitBitFieldConstantConversion>;
3936def warn_impcast_bitfield_precision_constant : Warning<
3937  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3938  InGroup<BitFieldConstantConversion>;
3939def warn_impcast_constant_value_to_objc_bool : Warning<
3940  "implicit conversion from constant value %0 to 'BOOL'; "
3941  "the only well defined values for 'BOOL' are YES and NO">,
3942  InGroup<ObjCBoolConstantConversion>;
3943
3944def warn_impcast_fixed_point_range : Warning<
3945  "implicit conversion from %0 cannot fit within the range of values for %1">,
3946  InGroup<ImplicitFixedPointConversion>;
3947
3948def warn_impcast_literal_float_to_integer : Warning<
3949  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3950  InGroup<LiteralConversion>;
3951def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3952  "implicit conversion of out of range value from %0 to %1 is undefined">,
3953  InGroup<LiteralConversion>;
3954def warn_impcast_float_integer : Warning<
3955  "implicit conversion turns floating-point number into integer: %0 to %1">,
3956  InGroup<FloatConversion>, DefaultIgnore;
3957def warn_impcast_float_to_objc_signed_char_bool : Warning<
3958  "implicit conversion from floating-point type %0 to 'BOOL'">,
3959  InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
3960def warn_impcast_int_to_objc_signed_char_bool : Warning<
3961  "implicit conversion from integral type %0 to 'BOOL'">,
3962  InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
3963
3964// Implicit int -> float conversion precision loss warnings.
3965def warn_impcast_integer_float_precision : Warning<
3966  "implicit conversion from %0 to %1 may lose precision">,
3967  InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
3968def warn_impcast_integer_float_precision_constant : Warning<
3969  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3970  InGroup<ImplicitConstIntFloatConversion>;
3971
3972def warn_impcast_float_to_integer : Warning<
3973  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3974  InGroup<FloatOverflowConversion>, DefaultIgnore;
3975def warn_impcast_float_to_integer_out_of_range : Warning<
3976  "implicit conversion of out of range value from %0 to %1 is undefined">,
3977  InGroup<FloatOverflowConversion>, DefaultIgnore;
3978def warn_impcast_float_to_integer_zero : Warning<
3979  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3980  InGroup<FloatZeroConversion>, DefaultIgnore;
3981
3982def warn_impcast_string_literal_to_bool : Warning<
3983  "implicit conversion turns string literal into bool: %0 to %1">,
3984  InGroup<StringConversion>, DefaultIgnore;
3985def warn_impcast_different_enum_types : Warning<
3986  "implicit conversion from enumeration type %0 to different enumeration type "
3987  "%1">, InGroup<EnumConversion>;
3988def warn_impcast_bool_to_null_pointer : Warning<
3989    "initialization of pointer of type %0 to null from a constant boolean "
3990    "expression">, InGroup<BoolConversion>;
3991def warn_non_literal_null_pointer : Warning<
3992    "expression which evaluates to zero treated as a null pointer constant of "
3993    "type %0">, InGroup<NonLiteralNullConversion>;
3994def warn_pointer_compare : Warning<
3995    "comparing a pointer to a null character constant; did you mean "
3996    "to compare to %select{NULL|(void *)0}0?">,
3997    InGroup<DiagGroup<"pointer-compare">>;
3998def warn_impcast_null_pointer_to_integer : Warning<
3999    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
4000    InGroup<NullConversion>;
4001def warn_impcast_floating_point_to_bool : Warning<
4002    "implicit conversion turns floating-point number into bool: %0 to %1">,
4003    InGroup<ImplicitConversionFloatingPointToBool>;
4004def ext_ms_impcast_fn_obj : ExtWarn<
4005  "implicit conversion between pointer-to-function and pointer-to-object is a "
4006  "Microsoft extension">, InGroup<MicrosoftCast>;
4007
4008def warn_impcast_pointer_to_bool : Warning<
4009    "address of%select{| function| array}0 '%1' will always evaluate to "
4010    "'true'">,
4011    InGroup<PointerBoolConversion>;
4012def warn_cast_nonnull_to_bool : Warning<
4013    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
4014    "'true' on first encounter">,
4015    InGroup<PointerBoolConversion>;
4016def warn_this_bool_conversion : Warning<
4017  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
4018  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
4019def warn_address_of_reference_bool_conversion : Warning<
4020  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4021  "code; pointer may be assumed to always convert to true">,
4022  InGroup<UndefinedBoolConversion>;
4023
4024def warn_xor_used_as_pow : Warning<
4025  "result of '%0' is %1; did you mean exponentiation?">,
4026  InGroup<XorUsedAsPow>;
4027def warn_xor_used_as_pow_base_extra : Warning<
4028  "result of '%0' is %1; did you mean '%2' (%3)?">,
4029  InGroup<XorUsedAsPow>;
4030def warn_xor_used_as_pow_base : Warning<
4031  "result of '%0' is %1; did you mean '%2'?">,
4032  InGroup<XorUsedAsPow>;
4033def note_xor_used_as_pow_silence : Note<
4034  "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
4035
4036def warn_null_pointer_compare : Warning<
4037    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
4038    "equal to a null pointer is always %select{true|false}2">,
4039    InGroup<TautologicalPointerCompare>;
4040def warn_nonnull_expr_compare : Warning<
4041    "comparison of nonnull %select{function call|parameter}0 '%1' "
4042    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
4043    "encounter">,
4044    InGroup<TautologicalPointerCompare>;
4045def warn_this_null_compare : Warning<
4046  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
4047  "assumed to always evaluate to %select{true|false}0">,
4048  InGroup<TautologicalUndefinedCompare>;
4049def warn_address_of_reference_null_compare : Warning<
4050  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
4051  "code; comparison may be assumed to always evaluate to "
4052  "%select{true|false}0">,
4053  InGroup<TautologicalUndefinedCompare>;
4054def note_reference_is_return_value : Note<"%0 returns a reference">;
4055
4056def note_pointer_declared_here : Note<
4057  "pointer %0 declared here">;
4058def warn_division_sizeof_ptr : Warning<
4059  "'%0' will return the size of the pointer, not the array itself">,
4060  InGroup<DiagGroup<"sizeof-pointer-div">>;
4061def warn_division_sizeof_array : Warning<
4062  "expression does not compute the number of elements in this array; element "
4063  "type is %0, not %1">,
4064  InGroup<DiagGroup<"sizeof-array-div">>;
4065
4066def note_function_warning_silence : Note<
4067    "prefix with the address-of operator to silence this warning">;
4068def note_function_to_function_call : Note<
4069    "suffix with parentheses to turn this into a function call">;
4070def warn_impcast_objective_c_literal_to_bool : Warning<
4071    "implicit boolean conversion of Objective-C object literal always "
4072    "evaluates to true">,
4073    InGroup<ObjCLiteralConversion>;
4074
4075def warn_cast_align : Warning<
4076  "cast from %0 to %1 increases required alignment from %2 to %3">,
4077  InGroup<CastAlign>, DefaultIgnore;
4078def warn_old_style_cast : Warning<
4079  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore,
4080  SuppressInSystemMacro;
4081
4082// Separate between casts to void* and non-void* pointers.
4083// Some APIs use (abuse) void* for something like a user context,
4084// and often that value is an integer even if it isn't a pointer itself.
4085// Having a separate warning flag allows users to control the warning
4086// for their workflow.
4087def warn_int_to_pointer_cast : Warning<
4088  "cast to %1 from smaller integer type %0">,
4089  InGroup<IntToPointerCast>;
4090def warn_int_to_void_pointer_cast : Warning<
4091  "cast to %1 from smaller integer type %0">,
4092  InGroup<IntToVoidPointerCast>;
4093def warn_pointer_to_int_cast : Warning<
4094  "cast to smaller integer type %1 from %0">,
4095  InGroup<PointerToIntCast>;
4096def warn_pointer_to_enum_cast : Warning<
4097  warn_pointer_to_int_cast.Summary>,
4098  InGroup<PointerToEnumCast>;
4099def warn_void_pointer_to_int_cast : Warning<
4100  "cast to smaller integer type %1 from %0">,
4101  InGroup<VoidPointerToIntCast>;
4102def warn_void_pointer_to_enum_cast : Warning<
4103  warn_void_pointer_to_int_cast.Summary>,
4104  InGroup<VoidPointerToEnumCast>;
4105
4106def warn_attribute_ignored_for_field_of_type : Warning<
4107  "%0 attribute ignored for field of type %1">,
4108  InGroup<IgnoredAttributes>;
4109def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
4110  "enums in the Microsoft ABI are signed integers by default; consider giving "
4111  "the enum %0 an unsigned underlying type to make this code portable">,
4112  InGroup<SignedEnumBitfield>, DefaultIgnore;
4113def warn_attribute_packed_for_bitfield : Warning<
4114  "'packed' attribute was ignored on bit-fields with single-byte alignment "
4115  "in older versions of GCC and Clang">,
4116  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
4117def warn_transparent_union_attribute_field_size_align : Warning<
4118  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
4119  "%select{alignment|size}0 of the first field in transparent union; "
4120  "transparent_union attribute ignored">,
4121  InGroup<IgnoredAttributes>;
4122def note_transparent_union_first_field_size_align : Note<
4123  "%select{alignment|size}0 of first field is %1 bits">;
4124def warn_transparent_union_attribute_not_definition : Warning<
4125  "transparent_union attribute can only be applied to a union definition; "
4126  "attribute ignored">,
4127  InGroup<IgnoredAttributes>;
4128def warn_transparent_union_attribute_floating : Warning<
4129  "first field of a transparent union cannot have %select{floating point|"
4130  "vector}0 type %1; transparent_union attribute ignored">,
4131  InGroup<IgnoredAttributes>;
4132def warn_transparent_union_attribute_zero_fields : Warning<
4133  "transparent union definition must contain at least one field; "
4134  "transparent_union attribute ignored">,
4135  InGroup<IgnoredAttributes>;
4136def warn_attribute_type_not_supported : Warning<
4137  "%0 attribute argument not supported: %1">,
4138  InGroup<IgnoredAttributes>;
4139def warn_attribute_type_not_supported_global : Warning<
4140  "%0 attribute argument '%1' not supported on a global variable">,
4141  InGroup<IgnoredAttributes>;
4142def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
4143  InGroup<IgnoredAttributes>;
4144def warn_attribute_protected_visibility :
4145  Warning<"target does not support 'protected' visibility; using 'default'">,
4146  InGroup<DiagGroup<"unsupported-visibility">>;
4147def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
4148def note_previous_attribute : Note<"previous attribute is here">;
4149def note_conflicting_attribute : Note<"conflicting attribute is here">;
4150def note_attribute : Note<"attribute is here">;
4151def err_mismatched_ms_inheritance : Error<
4152  "inheritance model does not match %select{definition|previous declaration}0">;
4153def warn_ignored_ms_inheritance : Warning<
4154  "inheritance model ignored on %select{primary template|partial specialization}0">,
4155  InGroup<IgnoredAttributes>;
4156def note_previous_ms_inheritance : Note<
4157  "previous inheritance model specified here">;
4158def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
4159def err_mode_not_primitive : Error<
4160  "mode attribute only supported for integer and floating-point types">;
4161def err_mode_wrong_type : Error<
4162  "type of machine mode does not match type of base type">;
4163def warn_vector_mode_deprecated : Warning<
4164  "specifying vector types with the 'mode' attribute is deprecated; "
4165  "use the 'vector_size' attribute instead">,
4166  InGroup<DeprecatedAttributes>;
4167def warn_deprecated_noreturn_spelling : Warning<
4168  "the '[[_Noreturn]]' attribute spelling is deprecated in C2x; use "
4169  "'[[noreturn]]' instead">, InGroup<DeprecatedAttributes>;
4170def err_complex_mode_vector_type : Error<
4171  "type of machine mode does not support base vector types">;
4172def err_enum_mode_vector_type : Error<
4173  "mode %0 is not supported for enumeration types">;
4174def warn_attribute_nonnull_no_pointers : Warning<
4175  "'nonnull' attribute applied to function with no pointer arguments">,
4176  InGroup<IgnoredAttributes>;
4177def warn_attribute_nonnull_parm_no_args : Warning<
4178  "'nonnull' attribute when used on parameters takes no arguments">,
4179  InGroup<IgnoredAttributes>;
4180def warn_function_stmt_attribute_precedence : Warning<
4181  "statement attribute %0 has higher precedence than function attribute "
4182  "'%select{always_inline|flatten|noinline}1'">,
4183  InGroup<IgnoredAttributes>;
4184def note_declared_nonnull : Note<
4185  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
4186def warn_attribute_sentinel_named_arguments : Warning<
4187  "'sentinel' attribute requires named arguments">,
4188  InGroup<IgnoredAttributes>;
4189def warn_attribute_sentinel_not_variadic : Warning<
4190  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
4191  InGroup<IgnoredAttributes>;
4192def warn_deprecated_ignored_on_using : Warning<
4193  "%0 currently has no effect on a using declaration">,
4194  InGroup<IgnoredAttributes>;
4195def err_attribute_sentinel_less_than_zero : Error<
4196  "'sentinel' parameter 1 less than zero">;
4197def err_attribute_sentinel_not_zero_or_one : Error<
4198  "'sentinel' parameter 2 not 0 or 1">;
4199def warn_cleanup_ext : Warning<
4200  "GCC does not allow the 'cleanup' attribute argument to be anything other "
4201  "than a simple identifier">,
4202  InGroup<GccCompat>;
4203def err_attribute_cleanup_arg_not_function : Error<
4204  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
4205def err_attribute_cleanup_func_must_take_one_arg : Error<
4206  "'cleanup' function %0 must take 1 parameter">;
4207def err_attribute_cleanup_func_arg_incompatible_type : Error<
4208  "'cleanup' function %0 parameter has "
4209  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
4210def err_attribute_regparm_wrong_platform : Error<
4211  "'regparm' is not valid on this platform">;
4212def err_attribute_regparm_invalid_number : Error<
4213  "'regparm' parameter must be between 0 and %0 inclusive">;
4214def err_attribute_not_supported_in_lang : Error<
4215  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
4216def err_attribute_not_supported_on_arch
4217    : Error<"%0 attribute is not supported on '%1'">;
4218def warn_gcc_ignores_type_attr : Warning<
4219  "GCC does not allow the %0 attribute to be written on a type">,
4220  InGroup<GccCompat>;
4221def warn_gcc_requires_variadic_function : Warning<
4222  "GCC requires a function with the %0 attribute to be variadic">,
4223  InGroup<GccCompat>;
4224
4225// Clang-Specific Attributes
4226def warn_attribute_iboutlet : Warning<
4227  "%0 attribute can only be applied to instance variables or properties">,
4228  InGroup<IgnoredAttributes>;
4229def err_iboutletcollection_type : Error<
4230  "invalid type %0 as argument of iboutletcollection attribute">;
4231def err_iboutletcollection_builtintype : Error<
4232  "type argument of iboutletcollection attribute cannot be a builtin type">;
4233def warn_iboutlet_object_type : Warning<
4234  "%select{instance variable|property}2 with %0 attribute must "
4235  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
4236def warn_iboutletcollection_property_assign : Warning<
4237  "IBOutletCollection properties should be copy/strong and not assign">,
4238  InGroup<ObjCInvalidIBOutletProperty>;
4239
4240def err_attribute_overloadable_mismatch : Error<
4241  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
4242def note_attribute_overloadable_prev_overload : Note<
4243  "previous %select{unmarked |}0overload of function is here">;
4244def err_attribute_overloadable_no_prototype : Error<
4245  "'overloadable' function %0 must have a prototype">;
4246def err_attribute_overloadable_multiple_unmarked_overloads : Error<
4247  "at most one overload for a given name may lack the 'overloadable' "
4248  "attribute">;
4249def warn_attribute_no_builtin_invalid_builtin_name : Warning<
4250  "'%0' is not a valid builtin name for %1">,
4251  InGroup<DiagGroup<"invalid-no-builtin-names">>;
4252def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
4253  "empty %0 cannot be composed with named ones">;
4254def err_attribute_no_builtin_on_non_definition : Error<
4255  "%0 attribute is permitted on definitions only">;
4256def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
4257  "%0 attribute has no effect on defaulted or deleted functions">;
4258def warn_ns_attribute_wrong_return_type : Warning<
4259  "%0 attribute only applies to %select{functions|methods|properties}1 that "
4260  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
4261  InGroup<IgnoredAttributes>;
4262def err_ns_attribute_wrong_parameter_type : Error<
4263  "%0 attribute only applies to "
4264  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
4265def warn_ns_attribute_wrong_parameter_type : Warning<
4266  "%0 attribute only applies to "
4267  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
4268  InGroup<IgnoredAttributes>;
4269def warn_objc_requires_super_protocol : Warning<
4270  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
4271  InGroup<DiagGroup<"requires-super-attribute">>;
4272def note_protocol_decl : Note<
4273  "protocol is declared here">;
4274def note_protocol_decl_undefined : Note<
4275  "protocol %0 has no definition">;
4276def err_attribute_preferred_name_arg_invalid : Error<
4277  "argument %0 to 'preferred_name' attribute is not a typedef for "
4278  "a specialization of %1">;
4279def err_attribute_builtin_alias : Error<
4280  "%0 attribute can only be applied to a ARM, HLSL or RISC-V builtin">;
4281
4282// called-once attribute diagnostics.
4283def err_called_once_attribute_wrong_type : Error<
4284  "'called_once' attribute only applies to function-like parameters">;
4285
4286def warn_completion_handler_never_called : Warning<
4287  "%select{|captured }1completion handler is never called">,
4288  InGroup<CompletionHandler>, DefaultIgnore;
4289def warn_called_once_never_called : Warning<
4290  "%select{|captured }1%0 parameter marked 'called_once' is never called">,
4291  InGroup<CalledOnceParameter>;
4292
4293def warn_completion_handler_never_called_when : Warning<
4294  "completion handler is never %select{used|called}1 when "
4295  "%select{taking true branch|taking false branch|"
4296  "handling this case|none of the cases applies|"
4297  "entering the loop|skipping the loop|taking one of the branches}2">,
4298  InGroup<CompletionHandler>, DefaultIgnore;
4299def warn_called_once_never_called_when : Warning<
4300  "%0 parameter marked 'called_once' is never %select{used|called}1 when "
4301  "%select{taking true branch|taking false branch|"
4302  "handling this case|none of the cases applies|"
4303  "entering the loop|skipping the loop|taking one of the branches}2">,
4304  InGroup<CalledOnceParameter>;
4305
4306def warn_completion_handler_called_twice : Warning<
4307  "completion handler is called twice">,
4308  InGroup<CompletionHandler>, DefaultIgnore;
4309def warn_called_once_gets_called_twice : Warning<
4310  "%0 parameter marked 'called_once' is called twice">,
4311  InGroup<CalledOnceParameter>;
4312def note_called_once_gets_called_twice : Note<
4313  "previous call is here%select{; set to nil to indicate "
4314  "it cannot be called afterwards|}0">;
4315
4316// objc_designated_initializer attribute diagnostics.
4317def warn_objc_designated_init_missing_super_call : Warning<
4318  "designated initializer missing a 'super' call to a designated initializer of the super class">,
4319  InGroup<ObjCDesignatedInit>;
4320def note_objc_designated_init_marked_here : Note<
4321  "method marked as designated initializer of the class here">;
4322def warn_objc_designated_init_non_super_designated_init_call : Warning<
4323  "designated initializer should only invoke a designated initializer on 'super'">,
4324  InGroup<ObjCDesignatedInit>;
4325def warn_objc_designated_init_non_designated_init_call : Warning<
4326  "designated initializer invoked a non-designated initializer">,
4327  InGroup<ObjCDesignatedInit>;
4328def warn_objc_secondary_init_super_init_call : Warning<
4329  "convenience initializer should not invoke an initializer on 'super'">,
4330  InGroup<ObjCDesignatedInit>;
4331def warn_objc_secondary_init_missing_init_call : Warning<
4332  "convenience initializer missing a 'self' call to another initializer">,
4333  InGroup<ObjCDesignatedInit>;
4334def warn_objc_implementation_missing_designated_init_override : Warning<
4335  "method override for the designated initializer of the superclass %objcinstance0 not found">,
4336  InGroup<ObjCDesignatedInit>;
4337def err_designated_init_attr_non_init : Error<
4338  "'objc_designated_initializer' attribute only applies to init methods "
4339  "of interface or class extension declarations">;
4340
4341// objc_bridge attribute diagnostics.
4342def err_objc_attr_not_id : Error<
4343  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
4344def err_objc_attr_typedef_not_id : Error<
4345  "parameter of %0 attribute must be 'id' when used on a typedef">;
4346def err_objc_attr_typedef_not_void_pointer : Error<
4347  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
4348def err_objc_cf_bridged_not_interface : Error<
4349  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
4350def err_objc_ns_bridged_invalid_cfobject : Error<
4351  "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
4352def warn_objc_invalid_bridge : Warning<
4353  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
4354def warn_objc_invalid_bridge_to_cf : Warning<
4355  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
4356
4357// objc_bridge_related attribute diagnostics.
4358def err_objc_bridged_related_invalid_class : Error<
4359  "could not find Objective-C class %0 to convert %1 to %2">;
4360def err_objc_bridged_related_invalid_class_name : Error<
4361  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
4362def err_objc_bridged_related_known_method : Error<
4363 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
4364 "method for this conversion">;
4365
4366def err_objc_attr_protocol_requires_definition : Error<
4367  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
4368
4369// Swift attributes.
4370def warn_attr_swift_name_function
4371  : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
4372    InGroup<SwiftNameAttribute>;
4373def warn_attr_swift_name_invalid_identifier
4374  : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4375    InGroup<SwiftNameAttribute>;
4376def warn_attr_swift_name_decl_kind
4377  : Warning<"%0 attribute cannot be applied to this declaration">,
4378    InGroup<SwiftNameAttribute>;
4379def warn_attr_swift_name_subscript_invalid_parameter
4380  : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4381        "have at least one parameter|"
4382        "have a 'self:' parameter}1">,
4383    InGroup<SwiftNameAttribute>;
4384def warn_attr_swift_name_missing_parameters
4385  : Warning<"%0 attribute is missing parameter label clause">,
4386    InGroup<SwiftNameAttribute>;
4387def warn_attr_swift_name_setter_parameters
4388  : Warning<"%0 attribute for setter must have one parameter for new value">,
4389    InGroup<SwiftNameAttribute>;
4390def warn_attr_swift_name_multiple_selfs
4391  : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4392    InGroup<SwiftNameAttribute>;
4393def warn_attr_swift_name_getter_parameters
4394  : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4395    InGroup<SwiftNameAttribute>;
4396def warn_attr_swift_name_subscript_setter_no_newValue
4397  : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4398    InGroup<SwiftNameAttribute>;
4399def warn_attr_swift_name_subscript_setter_multiple_newValues
4400  : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4401    InGroup<SwiftNameAttribute>;
4402def warn_attr_swift_name_subscript_getter_newValue
4403  : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4404    InGroup<SwiftNameAttribute>;
4405def warn_attr_swift_name_num_params
4406  : Warning<"too %select{few|many}0 parameters in the signature specified by "
4407            "the %1 attribute (expected %2; got %3)">,
4408    InGroup<SwiftNameAttribute>;
4409def warn_attr_swift_name_decl_missing_params
4410  : Warning<"%0 attribute cannot be applied to a %select{function|method}1 "
4411            "with no parameters">,
4412    InGroup<SwiftNameAttribute>;
4413
4414def err_attr_swift_error_no_error_parameter : Error<
4415  "%0 attribute can only be applied to a %select{function|method}1 with an "
4416  "error parameter">;
4417def err_attr_swift_error_return_type : Error<
4418  "%0 attribute with '%1' convention can only be applied to a "
4419  "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4420
4421def err_swift_async_no_access : Error<
4422  "first argument to 'swift_async' must be either 'none', 'swift_private', or "
4423  "'not_swift_private'">;
4424def err_swift_async_bad_block_type : Error<
4425  "'swift_async' completion handler parameter must have block type returning"
4426  " 'void', type here is %0">;
4427
4428def err_swift_async_error_without_swift_async : Error<
4429  "%0 attribute must be applied to a %select{function|method}1 annotated "
4430  "with non-'none' attribute 'swift_async'">;
4431def err_swift_async_error_no_error_parameter : Error<
4432  "%0 attribute with 'nonnull_error' convention can only be applied to a "
4433  "%select{function|method}1 with a completion handler with an error "
4434  "parameter">;
4435def err_swift_async_error_non_integral : Error<
4436  "%0 attribute with '%1' convention must have an integral-typed parameter "
4437  "in completion handler at index %2, type here is %3">;
4438
4439def warn_ignored_objc_externally_retained : Warning<
4440  "'objc_externally_retained' can only be applied to local variables "
4441  "%select{of retainable type|with strong ownership}0">,
4442  InGroup<IgnoredAttributes>;
4443
4444// Function Parameter Semantic Analysis.
4445def err_param_with_void_type : Error<"argument may not have 'void' type">;
4446def err_void_only_param : Error<
4447  "'void' must be the first and only parameter if specified">;
4448def err_void_param_qualified : Error<
4449  "'void' as parameter must not have type qualifiers">;
4450def err_ident_list_in_fn_declaration : Error<
4451  "a parameter list without types is only allowed in a function definition">;
4452def ext_param_not_declared : ExtWarn<
4453  "parameter %0 was not declared, defaults to 'int'; ISO C99 and later do not "
4454  "support implicit int">, InGroup<ImplicitInt>;
4455def err_param_default_argument : Error<
4456  "C does not support default arguments">;
4457def err_param_default_argument_redefinition : Error<
4458  "redefinition of default argument">;
4459def ext_param_default_argument_redefinition : ExtWarn<
4460  err_param_default_argument_redefinition.Summary>,
4461  InGroup<MicrosoftDefaultArgRedefinition>;
4462def err_param_default_argument_missing : Error<
4463  "missing default argument on parameter">;
4464def err_param_default_argument_missing_name : Error<
4465  "missing default argument on parameter %0">;
4466def err_param_default_argument_references_param : Error<
4467  "default argument references parameter %0">;
4468def err_param_default_argument_references_local : Error<
4469  "default argument references local variable %0 of enclosing function">;
4470def err_param_default_argument_references_this : Error<
4471  "default argument references 'this'">;
4472def err_param_default_argument_nonfunc : Error<
4473  "default arguments can only be specified for parameters in a function "
4474  "declaration">;
4475def err_param_default_argument_template_redecl : Error<
4476  "default arguments cannot be added to a function template that has already "
4477  "been declared">;
4478def err_param_default_argument_member_template_redecl : Error<
4479  "default arguments cannot be added to an out-of-line definition of a member "
4480  "of a %select{class template|class template partial specialization|nested "
4481  "class in a template}0">;
4482def err_param_default_argument_on_parameter_pack : Error<
4483  "parameter pack cannot have a default argument">;
4484def err_uninitialized_member_for_assign : Error<
4485  "cannot define the implicit copy assignment operator for %0, because "
4486  "non-static %select{reference|const}1 member %2 cannot use copy "
4487  "assignment operator">;
4488def err_uninitialized_member_in_ctor : Error<
4489  "%select{constructor for %1|"
4490  "implicit default constructor for %1|"
4491  "cannot use constructor inherited from %1:}0 must explicitly "
4492  "initialize the %select{reference|const}2 member %3">;
4493def err_default_arg_makes_ctor_special : Error<
4494  "addition of default argument on redeclaration makes this constructor a "
4495  "%select{default|copy|move}0 constructor">;
4496def err_stmt_expr_in_default_arg : Error<
4497  "default %select{argument|non-type template argument}0 may not use a GNU "
4498  "statement expression">;
4499
4500def err_use_of_default_argument_to_function_declared_later : Error<
4501  "use of default argument to function %0 that is declared later in class %1">;
4502def note_default_argument_declared_here : Note<
4503  "default argument declared here">;
4504def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4505def note_recursive_default_argument_used_here : Note<
4506  "default argument used here">;
4507
4508def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4509  "%diff{promoted type $ of K&R function parameter is not compatible with the "
4510  "parameter type $|promoted type of K&R function parameter is not compatible "
4511  "with parameter type}0,1 declared in a previous prototype">,
4512  InGroup<KNRPromotedParameter>;
4513
4514
4515// C++ Overloading Semantic Analysis.
4516def err_ovl_diff_return_type : Error<
4517  "functions that differ only in their return type cannot be overloaded">;
4518def err_ovl_static_nonstatic_member : Error<
4519  "static and non-static member functions with the same parameter types "
4520  "cannot be overloaded">;
4521
4522let Deferrable = 1 in {
4523
4524def err_ovl_no_viable_function_in_call : Error<
4525  "no matching function for call to %0">;
4526def err_ovl_no_viable_member_function_in_call : Error<
4527  "no matching member function for call to %0">;
4528def err_ovl_ambiguous_call : Error<
4529  "call to %0 is ambiguous">;
4530def err_ovl_deleted_call : Error<"call to deleted function %0">;
4531def err_ovl_ambiguous_member_call : Error<
4532  "call to member function %0 is ambiguous">;
4533def err_ovl_deleted_member_call : Error<
4534  "call to deleted member function %0">;
4535def note_ovl_too_many_candidates : Note<
4536    "remaining %0 candidate%s0 omitted; "
4537    "pass -fshow-overloads=all to show them">;
4538
4539def select_ovl_candidate_kind : TextSubstitution<
4540  "%select{function|function|function (with reversed parameter order)|"
4541    "constructor|"
4542    "constructor (the implicit default constructor)|"
4543    "constructor (the implicit copy constructor)|"
4544    "constructor (the implicit move constructor)|"
4545    "function (the implicit copy assignment operator)|"
4546    "function (the implicit move assignment operator)|"
4547    "function (the implicit 'operator==' for this 'operator<=>)'|"
4548    "inherited constructor}0%select{| template| %2}1">;
4549
4550def note_ovl_candidate : Note<
4551    "candidate %sub{select_ovl_candidate_kind}0,1,3"
4552    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4553    "| has different number of parameters (expected %5 but has %6)"
4554    "| has type mismatch at %ordinal5 parameter"
4555    "%diff{ (expected $ but has $)|}6,7"
4556    "| has different return type%diff{ ($ expected but has $)|}5,6"
4557    "| has different qualifiers (expected %5 but found %6)"
4558    "| has different exception specification}4">;
4559
4560def note_ovl_candidate_explicit : Note<
4561    "explicit %select{constructor|conversion function|deduction guide}0 "
4562    "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4563def note_ovl_candidate_inherited_constructor : Note<
4564    "constructor from base class %0 inherited here">;
4565def note_ovl_candidate_inherited_constructor_slice : Note<
4566    "candidate %select{constructor|template}0 ignored: "
4567    "inherited constructor cannot be used to %select{copy|move}1 object">;
4568def note_ovl_candidate_illegal_constructor : Note<
4569    "candidate %select{constructor|template}0 ignored: "
4570    "instantiation %select{takes|would take}0 its own class type by value">;
4571def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4572    "candidate constructor ignored: cannot be used to construct an object "
4573    "in address space %0">;
4574def note_ovl_candidate_bad_deduction : Note<
4575    "candidate template ignored: failed template argument deduction">;
4576def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4577    "couldn't infer template argument %0">;
4578def note_ovl_candidate_incomplete_deduction_pack : Note<
4579    "candidate template ignored: "
4580    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4581    "expanded parameter in deduced argument pack %2">;
4582def note_ovl_candidate_inconsistent_deduction : Note<
4583    "candidate template ignored: deduced %select{conflicting types|"
4584    "conflicting values|conflicting templates|packs of different lengths}0 "
4585    "for parameter %1%diff{ ($ vs. $)|}2,3">;
4586def note_ovl_candidate_inconsistent_deduction_types : Note<
4587    "candidate template ignored: deduced values %diff{"
4588    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4589    "%1 and %3 of conflicting types for parameter %0}2,4">;
4590def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4591    "candidate template ignored: invalid explicitly-specified argument "
4592    "for template parameter %0">;
4593def note_ovl_candidate_unsatisfied_constraints : Note<
4594    "candidate template ignored: constraints not satisfied%0">;
4595def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4596    "candidate template ignored: invalid explicitly-specified argument "
4597    "for %ordinal0 template parameter">;
4598def note_ovl_candidate_instantiation_depth : Note<
4599    "candidate template ignored: substitution exceeded maximum template "
4600    "instantiation depth">;
4601def note_ovl_candidate_underqualified : Note<
4602    "candidate template ignored: cannot deduce a type for %0 that would "
4603    "make %2 equal %1">;
4604def note_ovl_candidate_substitution_failure : Note<
4605    "candidate template ignored: substitution failure%0%1">;
4606def note_ovl_candidate_disabled_by_enable_if : Note<
4607    "candidate template ignored: disabled by %0%1">;
4608def note_ovl_candidate_disabled_by_requirement : Note<
4609    "candidate template ignored: requirement '%0' was not satisfied%1">;
4610def note_ovl_candidate_has_pass_object_size_params: Note<
4611    "candidate address cannot be taken because parameter %0 has "
4612    "pass_object_size attribute">;
4613def err_diagnose_if_succeeded : Error<"%0">;
4614def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4615    ShowInSystemHeader;
4616def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4617    "candidate disabled: %0">;
4618def err_addrof_function_disabled_by_enable_if_attr : Error<
4619    "cannot take address of function %0 because it has one or more "
4620    "non-tautological enable_if conditions">;
4621def err_addrof_function_constraints_not_satisfied : Error<
4622    "cannot take address of function %0 because its constraints are not "
4623    "satisfied">;
4624def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4625    "candidate function made ineligible by enable_if">;
4626def note_ovl_candidate_deduced_mismatch : Note<
4627    "candidate template ignored: deduced type "
4628    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4629    "adjusted type $ of %select{|element of }4argument"
4630    "|of %select{|element of }4%ordinal0 parameter does not match "
4631    "adjusted type of %select{|element of }4argument}1,2%3">;
4632def note_ovl_candidate_non_deduced_mismatch : Note<
4633    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4634// This note is needed because the above note would sometimes print two
4635// different types with the same name.  Remove this note when the above note
4636// can handle that case properly.
4637def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4638    "candidate template ignored: could not match %q0 against %q1">;
4639
4640// Note that we don't treat templates differently for this diagnostic.
4641def note_ovl_candidate_arity : Note<"candidate "
4642    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4643    "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
4644    "%plural{1:was|:were}5 provided">;
4645
4646def note_ovl_candidate_arity_one : Note<"candidate "
4647    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4648    "%select{requires at least|allows at most single|requires single}3 "
4649    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4650
4651def note_ovl_candidate_deleted : Note<
4652    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4653    "%select{explicitly made unavailable|explicitly deleted|"
4654    "implicitly deleted}3">;
4655
4656// Giving the index of the bad argument really clutters this message, and
4657// it's relatively unimportant because 1) it's generally obvious which
4658// argument(s) are of the given object type and 2) the fix is usually
4659// to complete the type, which doesn't involve changes to the call line
4660// anyway.  If people complain, we can change it.
4661def note_ovl_candidate_bad_conv_incomplete : Note<
4662    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4663    "cannot convert argument of incomplete type "
4664    "%diff{$ to $|to parameter type}3,4 for "
4665    "%select{%ordinal6 argument|object argument}5"
4666    "%select{|; dereference the argument with *|"
4667    "; take the address of the argument with &|"
4668    "; remove *|"
4669    "; remove &}7">;
4670def note_ovl_candidate_bad_list_argument : Note<
4671    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4672    "%select{cannot convert initializer list|too few initializers in list"
4673    "|too many initializers in list}7 argument to %4">;
4674def note_ovl_candidate_bad_overload : Note<
4675    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4676    "no overload of %4 matching %3 for %ordinal5 argument">;
4677def note_ovl_candidate_bad_conv : Note<
4678    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4679    "no known conversion "
4680    "%diff{from $ to $|from argument type to parameter type}3,4 for "
4681    "%select{%ordinal6 argument|object argument}5"
4682    "%select{|; dereference the argument with *|"
4683    "; take the address of the argument with &|"
4684    "; remove *|"
4685    "; remove &}7">;
4686def note_ovl_candidate_bad_arc_conv : Note<
4687    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4688    "cannot implicitly convert argument "
4689    "%diff{of type $ to $|type to parameter type}3,4 for "
4690    "%select{%ordinal6 argument|object argument}5 under ARC">;
4691def note_ovl_candidate_bad_value_category : Note<
4692    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4693    "expects an %select{lvalue|rvalue}5 for "
4694    "%select{%ordinal4 argument|object argument}3">;
4695def note_ovl_candidate_bad_addrspace : Note<
4696    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4697    "cannot %select{pass pointer to|bind reference in}5 %3 "
4698    "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4699    "argument">;
4700def note_ovl_candidate_bad_addrspace_this : Note<
4701    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4702    "'this' object is in %3, but method expects object in %4">;
4703def note_ovl_candidate_bad_gc : Note<
4704    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4705    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4706    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4707def note_ovl_candidate_bad_ownership : Note<
4708    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4709    "%select{%ordinal7|'this'}6 argument (%3) has "
4710    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4711    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4712    "__autoreleasing}5 ownership">;
4713def note_ovl_candidate_bad_cvr_this : Note<
4714    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4715    "'this' argument has type %3, but method is not marked "
4716    "%select{const|restrict|const or restrict|volatile|const or volatile|"
4717    "volatile or restrict|const, volatile, or restrict}4">;
4718def note_ovl_candidate_bad_cvr : Note<
4719    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4720    "%ordinal5 argument (%3) would lose "
4721    "%select{const|restrict|const and restrict|volatile|const and volatile|"
4722    "volatile and restrict|const, volatile, and restrict}4 qualifier"
4723    "%select{||s||s|s|s}4">;
4724def note_ovl_candidate_bad_base_to_derived_conv : Note<
4725    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4726    "cannot %select{convert from|convert from|bind}3 "
4727    "%select{base class pointer|superclass|base class object of type}3 %4 to "
4728    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4729    "%ordinal6 argument">;
4730def note_ovl_candidate_bad_target : Note<
4731    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4732    "call to "
4733    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4734    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4735def note_ovl_candidate_constraints_not_satisfied : Note<
4736    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4737    "not satisfied">;
4738def note_ovl_surrogate_constraints_not_satisfied : Note<
4739    "conversion candidate %0 not viable: constraints not satisfied">;
4740def note_implicit_member_target_infer_collision : Note<
4741    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4742    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4743    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4744
4745def note_ambiguous_type_conversion: Note<
4746    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4747def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4748def err_ovl_no_viable_function_in_init : Error<
4749  "no matching constructor for initialization of %0">;
4750def err_ovl_no_conversion_in_cast : Error<
4751  "cannot convert %1 to %2 without a conversion operator">;
4752def err_ovl_no_viable_conversion_in_cast : Error<
4753  "no matching conversion for %select{|static_cast|reinterpret_cast|"
4754  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4755def err_ovl_ambiguous_conversion_in_cast : Error<
4756  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4757  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4758def err_ovl_deleted_conversion_in_cast : Error<
4759  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4760  "functional-style cast|}0 from %1 to %2 uses deleted function">;
4761def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4762def err_ref_init_ambiguous : Error<
4763  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4764def err_ovl_deleted_init : Error<
4765  "call to deleted constructor of %0">;
4766def err_ovl_deleted_special_init : Error<
4767  "call to implicitly-deleted %select{default constructor|copy constructor|"
4768  "move constructor|copy assignment operator|move assignment operator|"
4769  "destructor|function}0 of %1">;
4770def err_ovl_ambiguous_oper_unary : Error<
4771  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4772def err_ovl_ambiguous_oper_binary : Error<
4773  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4774def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4775  "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4776  "and %2) to be ambiguous despite there being a unique best viable function"
4777  "%select{ with non-reversed arguments|}3">,
4778  InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4779def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4780  "ambiguity is between a regular call to this operator and a call with the "
4781  "argument order reversed">;
4782def note_ovl_ambiguous_eqeq_reversed_self_non_const : Note<
4783  "mark 'operator==' as const or add a matching 'operator!=' to resolve the ambiguity">;
4784def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4785  "candidate function with non-reversed arguments">;
4786def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4787  "ambiguous candidate function with reversed arguments">;
4788def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4789def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4790def err_ovl_deleted_oper : Error<
4791  "overload resolution selected deleted operator '%0'">;
4792def err_ovl_deleted_special_oper : Error<
4793  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4794  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4795  "implicitly deleted">;
4796def err_ovl_deleted_comparison : Error<
4797  "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4798def err_ovl_rewrite_equalequal_not_bool : Error<
4799  "return type %0 of selected 'operator==' function for rewritten "
4800  "'%1' comparison is not 'bool'">;
4801def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4802  "ISO C++20 requires return type of selected 'operator==' function for "
4803  "rewritten '%1' comparison to be 'bool', not %0">,
4804  InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4805def err_ovl_no_viable_subscript :
4806    Error<"no viable overloaded operator[] for type %0">;
4807def err_ovl_no_oper :
4808    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4809def err_ovl_unresolvable : Error<
4810  "reference to %select{overloaded|multiversioned}1 function could not be "
4811  "resolved; did you mean to call it%select{| with no arguments}0?">;
4812def err_bound_member_function : Error<
4813  "reference to non-static member function must be called"
4814  "%select{|; did you mean to call it with no arguments?}0">;
4815def note_possible_target_of_call : Note<"possible target for call">;
4816def err_no_viable_destructor : Error<
4817  "no viable destructor found for class %0">;
4818def err_ambiguous_destructor : Error<
4819  "destructor of class %0 is ambiguous">;
4820
4821def err_ovl_no_viable_object_call : Error<
4822  "no matching function for call to object of type %0">;
4823def err_ovl_ambiguous_object_call : Error<
4824  "call to object of type %0 is ambiguous">;
4825def err_ovl_ambiguous_subscript_call : Error<
4826  "call to subscript operator of type %0 is ambiguous">;
4827def err_ovl_deleted_object_call : Error<
4828  "call to deleted function call operator in type %0">;
4829def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4830def err_member_call_without_object : Error<
4831  "call to non-static member function without an object argument">;
4832
4833// C++ Address of Overloaded Function
4834def err_addr_ovl_no_viable : Error<
4835  "address of overloaded function %0 does not match required type %1">;
4836def err_addr_ovl_ambiguous : Error<
4837  "address of overloaded function %0 is ambiguous">;
4838def err_addr_ovl_not_func_ptrref : Error<
4839  "address of overloaded function %0 cannot be converted to type %1">;
4840def err_addr_ovl_no_qualifier : Error<
4841  "cannot form member pointer of type %0 without '&' and class name">;
4842
4843} // let Deferrable
4844
4845// C++11 Literal Operators
4846def err_ovl_no_viable_literal_operator : Error<
4847  "no matching literal operator for call to %0"
4848  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4849  "%select{| or 'const char *'}4"
4850  "%select{|, and no matching literal operator template}5">;
4851
4852// C++ Template Declarations
4853def err_template_param_shadow : Error<
4854  "declaration of %0 shadows template parameter">;
4855def ext_template_param_shadow : ExtWarn<
4856  err_template_param_shadow.Summary>, InGroup<MicrosoftTemplateShadow>;
4857def note_template_param_here : Note<"template parameter is declared here">;
4858def warn_template_export_unsupported : Warning<
4859  "exported templates are unsupported">;
4860def err_template_outside_namespace_or_class_scope : Error<
4861  "templates can only be declared in namespace or class scope">;
4862def err_template_inside_local_class : Error<
4863  "templates cannot be declared inside of a local class">;
4864def err_template_linkage : Error<"templates must have C++ linkage">;
4865def err_template_typedef : Error<"a typedef cannot be a template">;
4866def err_template_unnamed_class : Error<
4867  "cannot declare a class template with no name">;
4868def err_template_param_list_different_arity : Error<
4869  "%select{too few|too many}0 template parameters in template "
4870  "%select{|template parameter }1redeclaration">;
4871def note_template_param_list_different_arity : Note<
4872  "%select{too few|too many}0 template parameters in template template "
4873  "argument">;
4874def note_template_prev_declaration : Note<
4875  "previous template %select{declaration|template parameter}0 is here">;
4876def err_template_param_different_kind : Error<
4877  "template parameter has a different kind in template "
4878  "%select{|template parameter }0redeclaration">;
4879def note_template_param_different_kind : Note<
4880  "template parameter has a different kind in template argument">;
4881
4882def err_invalid_decl_specifier_in_nontype_parm : Error<
4883  "invalid declaration specifier in template non-type parameter">;
4884
4885def err_template_nontype_parm_different_type : Error<
4886  "template non-type parameter has a different type %0 in template "
4887  "%select{|template parameter }1redeclaration">;
4888
4889def note_template_nontype_parm_different_type : Note<
4890  "template non-type parameter has a different type %0 in template argument">;
4891def note_template_nontype_parm_prev_declaration : Note<
4892  "previous non-type template parameter with type %0 is here">;
4893def err_template_nontype_parm_bad_type : Error<
4894  "a non-type template parameter cannot have type %0">;
4895def err_template_nontype_parm_bad_structural_type : Error<
4896  "a non-type template parameter cannot have type %0 before C++20">;
4897def err_template_nontype_parm_incomplete : Error<
4898  "non-type template parameter has incomplete type %0">;
4899def err_template_nontype_parm_not_literal : Error<
4900  "non-type template parameter has non-literal type %0">;
4901def err_template_nontype_parm_rvalue_ref : Error<
4902  "non-type template parameter has rvalue reference type %0">;
4903def err_template_nontype_parm_not_structural : Error<
4904  "type %0 of non-type template parameter is not a structural type">;
4905def note_not_structural_non_public : Note<
4906  "%0 is not a structural type because it has a "
4907  "%select{non-static data member|base class}1 that is not public">;
4908def note_not_structural_mutable_field : Note<
4909  "%0 is not a structural type because it has a mutable "
4910  "non-static data member">;
4911def note_not_structural_rvalue_ref_field : Note<
4912  "%0 is not a structural type because it has a non-static data member "
4913  "of rvalue reference type">;
4914def note_not_structural_subobject : Note<
4915  "%0 is not a structural type because it has a "
4916  "%select{non-static data member|base class}1 of non-structural type %2">;
4917def warn_cxx17_compat_template_nontype_parm_type : Warning<
4918  "non-type template parameter of type %0 is incompatible with "
4919  "C++ standards before C++20">,
4920  DefaultIgnore, InGroup<CXXPre20Compat>;
4921def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
4922  "non-type template parameters declared with %0 are incompatible with C++ "
4923  "standards before C++17">,
4924  DefaultIgnore, InGroup<CXXPre17Compat>;
4925def err_template_param_default_arg_redefinition : Error<
4926  "template parameter redefines default argument">;
4927def err_template_param_default_arg_inconsistent_redefinition : Error<
4928  "template parameter default argument is inconsistent with previous definition">;
4929def note_template_param_prev_default_arg : Note<
4930  "previous default template argument defined here">;
4931def note_template_param_prev_default_arg_in_other_module : Note<
4932  "previous default template argument defined in module %0">;
4933def err_template_param_default_arg_missing : Error<
4934  "template parameter missing a default argument">;
4935def ext_template_parameter_default_in_function_template : ExtWarn<
4936  "default template arguments for a function template are a C++11 extension">,
4937  InGroup<CXX11>;
4938def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
4939  "default template arguments for a function template are incompatible with C++98">,
4940  InGroup<CXX98Compat>, DefaultIgnore;
4941def err_template_parameter_default_template_member : Error<
4942  "cannot add a default template argument to the definition of a member of a "
4943  "class template">;
4944def err_template_parameter_default_friend_template : Error<
4945  "default template argument not permitted on a friend template">;
4946def err_template_template_parm_no_parms : Error<
4947  "template template parameter must have its own template parameters">;
4948
4949def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
4950  InGroup<CXX14>;
4951def warn_cxx11_compat_variable_template : Warning<
4952  "variable templates are incompatible with C++ standards before C++14">,
4953  InGroup<CXXPre14Compat>, DefaultIgnore;
4954def err_template_variable_noparams : Error<
4955  "extraneous 'template<>' in declaration of variable %0">;
4956def err_template_member : Error<"member %0 declared as a template">;
4957def err_member_with_template_arguments : Error<"member %0 cannot have template arguments">;
4958def err_template_member_noparams : Error<
4959  "extraneous 'template<>' in declaration of member %0">;
4960def err_template_tag_noparams : Error<
4961  "extraneous 'template<>' in declaration of %0 %1">;
4962
4963def warn_cxx17_compat_adl_only_template_id : Warning<
4964  "use of function template name with no prior function template "
4965  "declaration in function call with explicit template arguments "
4966  "is incompatible with C++ standards before C++20">,
4967  InGroup<CXXPre20Compat>, DefaultIgnore;
4968def ext_adl_only_template_id : ExtWarn<
4969  "use of function template name with no prior declaration in function call "
4970  "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
4971
4972def warn_unqualified_call_to_std_cast_function : Warning<
4973  "unqualified call to '%0'">, InGroup<DiagGroup<"unqualified-std-cast-call">>;
4974
4975// C++ Template Argument Lists
4976def err_template_missing_args : Error<
4977  "use of "
4978  "%select{class template|function template|variable template|alias template|"
4979  "template template parameter|concept|template}0 %1 requires template "
4980  "arguments">;
4981def err_template_arg_list_different_arity : Error<
4982  "%select{too few|too many}0 template arguments for "
4983  "%select{class template|function template|variable template|alias template|"
4984  "template template parameter|concept|template}1 %2">;
4985def note_template_decl_here : Note<"template is declared here">;
4986def err_template_arg_must_be_type : Error<
4987  "template argument for template type parameter must be a type">;
4988def err_template_arg_must_be_type_suggest : Error<
4989  "template argument for template type parameter must be a type; "
4990  "did you forget 'typename'?">;
4991def ext_ms_template_type_arg_missing_typename : ExtWarn<
4992  "template argument for template type parameter must be a type; "
4993  "omitted 'typename' is a Microsoft extension">,
4994  InGroup<MicrosoftTemplate>;
4995def err_template_arg_must_be_expr : Error<
4996  "template argument for non-type template parameter must be an expression">;
4997def err_template_arg_nontype_ambig : Error<
4998  "template argument for non-type template parameter is treated as function type %0">;
4999def err_template_arg_must_be_template : Error<
5000  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
5001def ext_template_arg_local_type : ExtWarn<
5002  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
5003def ext_template_arg_unnamed_type : ExtWarn<
5004  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
5005def warn_cxx98_compat_template_arg_local_type : Warning<
5006  "local type %0 as template argument is incompatible with C++98">,
5007  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
5008def warn_cxx98_compat_template_arg_unnamed_type : Warning<
5009  "unnamed type as template argument is incompatible with C++98">,
5010  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
5011def note_template_unnamed_type_here : Note<
5012  "unnamed type used in template argument was declared here">;
5013def err_template_arg_overload_type : Error<
5014  "template argument is the type of an unresolved overloaded function">;
5015def err_template_arg_not_valid_template : Error<
5016  "template argument does not refer to a class or alias template, or template "
5017  "template parameter">;
5018def note_template_arg_refers_here_func : Note<
5019  "template argument refers to function template %0, here">;
5020def err_template_arg_template_params_mismatch : Error<
5021  "template template argument has different template parameters than its "
5022  "corresponding template template parameter">;
5023def err_template_arg_not_integral_or_enumeral : Error<
5024  "non-type template argument of type %0 must have an integral or enumeration"
5025  " type">;
5026def err_template_arg_not_ice : Error<
5027  "non-type template argument of type %0 is not an integral constant "
5028  "expression">;
5029def err_template_arg_not_address_constant : Error<
5030  "non-type template argument of type %0 is not a constant expression">;
5031def warn_cxx98_compat_template_arg_null : Warning<
5032  "use of null pointer as non-type template argument is incompatible with "
5033  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5034def err_template_arg_untyped_null_constant : Error<
5035  "null non-type template argument must be cast to template parameter type %0">;
5036def err_template_arg_wrongtype_null_constant : Error<
5037  "null non-type template argument of type %0 does not match template parameter "
5038  "of type %1">;
5039def err_non_type_template_parm_type_deduction_failure : Error<
5040  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
5041def err_deduced_non_type_template_arg_type_mismatch : Error<
5042  "deduced non-type template argument does not have the same type as the "
5043  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
5044def err_non_type_template_arg_subobject : Error<
5045  "non-type template argument refers to subobject '%0'">;
5046def err_non_type_template_arg_addr_label_diff : Error<
5047  "template argument / label address difference / what did you expect?">;
5048def err_non_type_template_arg_unsupported : Error<
5049  "sorry, non-type template argument of type %0 is not yet supported">;
5050def err_template_arg_not_convertible : Error<
5051  "non-type template argument of type %0 cannot be converted to a value "
5052  "of type %1">;
5053def warn_template_arg_negative : Warning<
5054  "non-type template argument with value '%0' converted to '%1' for unsigned "
5055  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5056def warn_template_arg_too_large : Warning<
5057  "non-type template argument value '%0' truncated to '%1' for "
5058  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
5059def err_template_arg_no_ref_bind : Error<
5060  "non-type template parameter of reference type "
5061  "%diff{$ cannot bind to template argument of type $"
5062  "|cannot bind to template of incompatible argument type}0,1">;
5063def err_template_arg_ref_bind_ignores_quals : Error<
5064  "reference binding of non-type template parameter "
5065  "%diff{of type $ to template argument of type $|to template argument}0,1 "
5066  "ignores qualifiers">;
5067def err_template_arg_not_decl_ref : Error<
5068  "non-type template argument does not refer to any declaration">;
5069def err_template_arg_not_address_of : Error<
5070  "non-type template argument for template parameter of pointer type %0 must "
5071  "have its address taken">;
5072def err_template_arg_address_of_non_pointer : Error<
5073  "address taken in non-type template argument for template parameter of "
5074  "reference type %0">;
5075def err_template_arg_reference_var : Error<
5076  "non-type template argument of reference type %0 is not an object">;
5077def err_template_arg_field : Error<
5078  "non-type template argument refers to non-static data member %0">;
5079def err_template_arg_method : Error<
5080  "non-type template argument refers to non-static member function %0">;
5081def err_template_arg_object_no_linkage : Error<
5082  "non-type template argument refers to %select{function|object}0 %1 that "
5083  "does not have linkage">;
5084def warn_cxx98_compat_template_arg_object_internal : Warning<
5085  "non-type template argument referring to %select{function|object}0 %1 with "
5086  "internal linkage is incompatible with C++98">,
5087  InGroup<CXX98Compat>, DefaultIgnore;
5088def ext_template_arg_object_internal : ExtWarn<
5089  "non-type template argument referring to %select{function|object}0 %1 with "
5090  "internal linkage is a C++11 extension">, InGroup<CXX11>;
5091def err_template_arg_thread_local : Error<
5092  "non-type template argument refers to thread-local object">;
5093def note_template_arg_internal_object : Note<
5094  "non-type template argument refers to %select{function|object}0 here">;
5095def note_template_arg_refers_here : Note<
5096  "non-type template argument refers here">;
5097def err_template_arg_not_object_or_func : Error<
5098  "non-type template argument does not refer to an object or function">;
5099def err_template_arg_not_pointer_to_member_form : Error<
5100  "non-type template argument is not a pointer to member constant">;
5101def err_template_arg_member_ptr_base_derived_not_supported : Error<
5102  "sorry, non-type template argument of pointer-to-member type %1 that refers "
5103  "to member %q0 of a different class is not supported yet">;
5104def err_template_arg_invalid : Error<
5105  "non-type template argument '%0' is invalid">;
5106def ext_template_arg_extra_parens : ExtWarn<
5107  "address non-type template argument cannot be surrounded by parentheses">;
5108def warn_cxx98_compat_template_arg_extra_parens : Warning<
5109  "redundant parentheses surrounding address non-type template argument are "
5110  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5111def err_pointer_to_member_type : Error<
5112  "invalid use of pointer to member type after %select{.*|->*}0">;
5113def err_pointer_to_member_call_drops_quals : Error<
5114  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
5115def err_pointer_to_member_oper_value_classify: Error<
5116  "pointer-to-member function type %0 can only be called on an "
5117  "%select{rvalue|lvalue}1">;
5118def ext_pointer_to_const_ref_member_on_rvalue : Extension<
5119  "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
5120  InGroup<CXX20>, SFINAEFailure;
5121def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
5122  "invoking a pointer to a 'const &' member function on an rvalue is "
5123  "incompatible with C++ standards before C++20">,
5124  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
5125def ext_ms_deref_template_argument: ExtWarn<
5126  "non-type template argument containing a dereference operation is a "
5127  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5128def ext_ms_delayed_template_argument: ExtWarn<
5129  "using the undeclared type %0 as a default template argument is a "
5130  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5131def err_template_arg_deduced_incomplete_pack : Error<
5132  "deduced incomplete pack %0 for template parameter %1">;
5133
5134// C++ template specialization
5135def err_template_spec_unknown_kind : Error<
5136  "can only provide an explicit specialization for a class template, function "
5137  "template, variable template, or a member function, static data member, "
5138  "%select{or member class|member class, or member enumeration}0 of a "
5139  "class template">;
5140def note_specialized_entity : Note<
5141  "explicitly specialized declaration is here">;
5142def err_template_spec_decl_function_scope : Error<
5143  "explicit specialization of %0 in function scope">;
5144def err_template_spec_decl_friend : Error<
5145  "cannot declare an explicit specialization in a friend">;
5146def err_template_spec_redecl_out_of_scope : Error<
5147  "%select{class template|class template partial|variable template|"
5148  "variable template partial|function template|member "
5149  "function|static data member|member class|member enumeration}0 "
5150  "specialization of %1 not in %select{a namespace enclosing %2|"
5151  "class %2 or an enclosing namespace}3">;
5152def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
5153  "%select{class template|class template partial|variable template|"
5154  "variable template partial|function template|member "
5155  "function|static data member|member class|member enumeration}0 "
5156  "specialization of %1 not in %select{a namespace enclosing %2|"
5157  "class %2 or an enclosing namespace}3 "
5158  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
5159def err_template_spec_redecl_global_scope : Error<
5160  "%select{class template|class template partial|variable template|"
5161  "variable template partial|function template|member "
5162  "function|static data member|member class|member enumeration}0 "
5163  "specialization of %1 must occur at global scope">;
5164def err_spec_member_not_instantiated : Error<
5165  "specialization of member %q0 does not specialize an instantiated member">;
5166def note_specialized_decl : Note<"attempt to specialize declaration here">;
5167def err_specialization_after_instantiation : Error<
5168  "explicit specialization of %0 after instantiation">;
5169def note_instantiation_required_here : Note<
5170  "%select{implicit|explicit}0 instantiation first required here">;
5171def err_template_spec_friend : Error<
5172  "template specialization declaration cannot be a friend">;
5173def err_template_spec_default_arg : Error<
5174  "default argument not permitted on an explicit "
5175  "%select{instantiation|specialization}0 of function %1">;
5176def err_not_class_template_specialization : Error<
5177  "cannot specialize a %select{dependent template|template template "
5178  "parameter}0">;
5179def ext_explicit_specialization_storage_class : ExtWarn<
5180  "explicit specialization cannot have a storage class">;
5181def err_explicit_specialization_inconsistent_storage_class : Error<
5182  "explicit specialization has extraneous, inconsistent storage class "
5183  "'%select{none|extern|static|__private_extern__|auto|register}0'">;
5184def err_dependent_function_template_spec_no_match : Error<
5185  "no candidate function template was found for dependent"
5186  " friend function template specialization">;
5187def note_dependent_function_template_spec_discard_reason : Note<
5188  "candidate ignored: %select{not a function template"
5189  "|not a member of the enclosing namespace;"
5190  " did you mean to explicitly qualify the specialization?}0">;
5191
5192// C++ class template specializations and out-of-line definitions
5193def err_template_spec_needs_header : Error<
5194  "template specialization requires 'template<>'">;
5195def err_template_spec_needs_template_parameters : Error<
5196  "template specialization or definition requires a template parameter list "
5197  "corresponding to the nested type %0">;
5198def err_template_param_list_matches_nontemplate : Error<
5199  "template parameter list matching the non-templated nested type %0 should "
5200  "be empty ('template<>')">;
5201def err_alias_template_extra_headers : Error<
5202  "extraneous template parameter list in alias template declaration">;
5203def err_template_spec_extra_headers : Error<
5204  "extraneous template parameter list in template specialization or "
5205  "out-of-line template definition">;
5206def warn_template_spec_extra_headers : Warning<
5207  "extraneous template parameter list in template specialization">;
5208def note_explicit_template_spec_does_not_need_header : Note<
5209  "'template<>' header not required for explicitly-specialized class %0 "
5210  "declared here">;
5211def err_template_qualified_declarator_no_match : Error<
5212  "nested name specifier '%0' for declaration does not refer into a class, "
5213  "class template or class template partial specialization">;
5214def err_specialize_member_of_template : Error<
5215  "cannot specialize %select{|(with 'template<>') }0a member of an "
5216  "unspecialized template">;
5217
5218// C++ Class Template Partial Specialization
5219def err_default_arg_in_partial_spec : Error<
5220    "default template argument in a class template partial specialization">;
5221def err_dependent_non_type_arg_in_partial_spec : Error<
5222    "type of specialized non-type template argument depends on a template "
5223    "parameter of the partial specialization">;
5224def note_dependent_non_type_default_arg_in_partial_spec : Note<
5225    "template parameter is used in default argument declared here">;
5226def err_dependent_typed_non_type_arg_in_partial_spec : Error<
5227    "non-type template argument specializes a template parameter with "
5228    "dependent type %0">;
5229def err_partial_spec_args_match_primary_template : Error<
5230    "%select{class|variable}0 template partial specialization does not "
5231    "specialize any template argument; to %select{declare|define}1 the "
5232    "primary template, remove the template argument list">;
5233def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
5234    "%select{class|variable}0 template partial specialization is not "
5235    "more specialized than the primary template">, DefaultError,
5236    InGroup<DiagGroup<"invalid-partial-specialization">>;
5237def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
5238def ext_partial_specs_not_deducible : ExtWarn<
5239    "%select{class|variable}0 template partial specialization contains "
5240    "%select{a template parameter|template parameters}1 that cannot be "
5241    "deduced; this partial specialization will never be used">,
5242    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
5243def note_non_deducible_parameter : Note<
5244    "non-deducible template parameter %0">;
5245def err_partial_spec_ordering_ambiguous : Error<
5246    "ambiguous partial specializations of %0">;
5247def note_partial_spec_match : Note<"partial specialization matches %0">;
5248def err_partial_spec_redeclared : Error<
5249  "class template partial specialization %0 cannot be redeclared">;
5250def note_prev_partial_spec_here : Note<
5251  "previous declaration of class template partial specialization %0 is here">;
5252def err_partial_spec_fully_specialized : Error<
5253  "partial specialization of %0 does not use any of its template parameters">;
5254
5255// C++ Variable Template Partial Specialization
5256def err_var_partial_spec_redeclared : Error<
5257  "variable template partial specialization %0 cannot be redefined">;
5258def note_var_prev_partial_spec_here : Note<
5259  "previous declaration of variable template partial specialization is here">;
5260def err_var_spec_no_template : Error<
5261  "no variable template matches%select{| partial}0 specialization">;
5262def err_var_spec_no_template_but_method : Error<
5263  "no variable template matches specialization; "
5264  "did you mean to use %0 as function template instead?">;
5265
5266// C++ Function template specializations
5267def err_function_template_spec_no_match : Error<
5268    "no function template matches function template specialization %0">;
5269def err_function_template_spec_ambiguous : Error<
5270    "function template specialization %0 ambiguously refers to more than one "
5271    "function template; explicitly specify%select{| additional}1 template "
5272    "arguments to identify a particular function template">;
5273def note_function_template_spec_matched : Note<
5274    "function template %q0 matches specialization %1">;
5275def err_function_template_partial_spec : Error<
5276    "function template partial specialization is not allowed">;
5277
5278// C++ Template Instantiation
5279def err_template_recursion_depth_exceeded : Error<
5280  "recursive template instantiation exceeded maximum depth of %0">,
5281  DefaultFatal, NoSFINAE;
5282def err_constraint_depends_on_self : Error<
5283  "satisfaction of constraint '%0' depends on itself">, NoSFINAE;
5284def note_template_recursion_depth : Note<
5285  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
5286
5287def err_template_instantiate_within_definition : Error<
5288  "%select{implicit|explicit}0 instantiation of template %1 within its"
5289  " own definition">;
5290def err_template_instantiate_undefined : Error<
5291  "%select{implicit|explicit}0 instantiation of undefined template %1">;
5292def err_implicit_instantiate_member_undefined : Error<
5293  "implicit instantiation of undefined member %0">;
5294def note_template_class_instantiation_was_here : Note<
5295  "class template %0 was instantiated here">;
5296def note_template_class_explicit_specialization_was_here : Note<
5297  "class template %0 was explicitly specialized here">;
5298def note_template_class_instantiation_here : Note<
5299  "in instantiation of template class %q0 requested here">;
5300def note_template_member_class_here : Note<
5301  "in instantiation of member class %q0 requested here">;
5302def note_template_member_function_here : Note<
5303  "in instantiation of member function %q0 requested here">;
5304def note_function_template_spec_here : Note<
5305  "in instantiation of function template specialization %q0 requested here">;
5306def note_template_static_data_member_def_here : Note<
5307  "in instantiation of static data member %q0 requested here">;
5308def note_template_variable_def_here : Note<
5309  "in instantiation of variable template specialization %q0 requested here">;
5310def note_template_enum_def_here : Note<
5311  "in instantiation of enumeration %q0 requested here">;
5312def note_template_nsdmi_here : Note<
5313  "in instantiation of default member initializer %q0 requested here">;
5314def note_template_type_alias_instantiation_here : Note<
5315  "in instantiation of template type alias %0 requested here">;
5316def note_template_exception_spec_instantiation_here : Note<
5317  "in instantiation of exception specification for %0 requested here">;
5318def note_template_requirement_instantiation_here : Note<
5319  "in instantiation of requirement here">;
5320def note_template_requirement_params_instantiation_here : Note<
5321  "in instantiation of requirement parameters here">;
5322def warn_var_template_missing : Warning<"instantiation of variable %q0 "
5323  "required here, but no definition is available">,
5324  InGroup<UndefinedVarTemplate>;
5325def warn_func_template_missing : Warning<"instantiation of function %q0 "
5326  "required here, but no definition is available">,
5327  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
5328def note_forward_template_decl : Note<
5329  "forward declaration of template entity is here">;
5330def note_inst_declaration_hint : Note<"add an explicit instantiation "
5331  "declaration to suppress this warning if %q0 is explicitly instantiated in "
5332  "another translation unit">;
5333def note_evaluating_exception_spec_here : Note<
5334  "in evaluation of exception specification for %q0 needed here">;
5335
5336def note_default_arg_instantiation_here : Note<
5337  "in instantiation of default argument for '%0' required here">;
5338def note_default_function_arg_instantiation_here : Note<
5339  "in instantiation of default function argument expression "
5340  "for '%0' required here">;
5341def note_explicit_template_arg_substitution_here : Note<
5342  "while substituting explicitly-specified template arguments into function "
5343  "template %0 %1">;
5344def note_function_template_deduction_instantiation_here : Note<
5345  "while substituting deduced template arguments into function template %0 "
5346  "%1">;
5347def note_deduced_template_arg_substitution_here : Note<
5348  "during template argument deduction for %select{class|variable}0 template "
5349  "%select{partial specialization |}1%2 %3">;
5350def note_prior_template_arg_substitution : Note<
5351  "while substituting prior template arguments into %select{non-type|template}0"
5352  " template parameter%1 %2">;
5353def note_template_default_arg_checking : Note<
5354  "while checking a default template argument used here">;
5355def note_concept_specialization_here : Note<
5356  "while checking the satisfaction of concept '%0' requested here">;
5357def note_nested_requirement_here : Note<
5358  "while checking the satisfaction of nested requirement requested here">;
5359def note_checking_constraints_for_template_id_here : Note<
5360  "while checking constraint satisfaction for template '%0' required here">;
5361def note_checking_constraints_for_var_spec_id_here : Note<
5362  "while checking constraint satisfaction for variable template "
5363  "partial specialization '%0' required here">;
5364def note_checking_constraints_for_class_spec_id_here : Note<
5365  "while checking constraint satisfaction for class template partial "
5366  "specialization '%0' required here">;
5367def note_checking_constraints_for_function_here : Note<
5368  "while checking constraint satisfaction for function '%0' required here">;
5369def note_constraint_substitution_here : Note<
5370  "while substituting template arguments into constraint expression here">;
5371def note_constraint_normalization_here : Note<
5372  "while calculating associated constraint of template '%0' here">;
5373def note_parameter_mapping_substitution_here : Note<
5374  "while substituting into concept arguments here; substitution failures not "
5375  "allowed in concept arguments">;
5376def note_lambda_substitution_here : Note<
5377  "while substituting into a lambda expression here">;
5378def note_instantiation_contexts_suppressed : Note<
5379  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
5380  "see all)">;
5381
5382def err_field_instantiates_to_function : Error<
5383  "data member instantiated with function type %0">;
5384def err_variable_instantiates_to_function : Error<
5385  "%select{variable|static data member}0 instantiated with function type %1">;
5386def err_nested_name_spec_non_tag : Error<
5387  "type %0 cannot be used prior to '::' because it has no members">;
5388
5389def err_using_pack_expansion_empty : Error<
5390  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
5391
5392// C++ Explicit Instantiation
5393def err_explicit_instantiation_duplicate : Error<
5394    "duplicate explicit instantiation of %0">;
5395def ext_explicit_instantiation_duplicate : ExtWarn<
5396    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
5397    InGroup<MicrosoftTemplate>;
5398def note_previous_explicit_instantiation : Note<
5399    "previous explicit instantiation is here">;
5400def warn_explicit_instantiation_after_specialization : Warning<
5401  "explicit instantiation of %0 that occurs after an explicit "
5402  "specialization has no effect">,
5403  InGroup<DiagGroup<"instantiation-after-specialization">>;
5404def note_previous_template_specialization : Note<
5405    "previous template specialization is here">;
5406def err_explicit_instantiation_nontemplate_type : Error<
5407    "explicit instantiation of non-templated type %0">;
5408def note_nontemplate_decl_here : Note<
5409    "non-templated declaration is here">;
5410def err_explicit_instantiation_in_class : Error<
5411  "explicit instantiation of %0 in class scope">;
5412def err_explicit_instantiation_out_of_scope : Error<
5413  "explicit instantiation of %0 not in a namespace enclosing %1">;
5414def err_explicit_instantiation_must_be_global : Error<
5415  "explicit instantiation of %0 must occur at global scope">;
5416def warn_explicit_instantiation_out_of_scope_0x : Warning<
5417  "explicit instantiation of %0 not in a namespace enclosing %1">,
5418  InGroup<CXX11Compat>, DefaultIgnore;
5419def warn_explicit_instantiation_must_be_global_0x : Warning<
5420  "explicit instantiation of %0 must occur at global scope">,
5421  InGroup<CXX11Compat>, DefaultIgnore;
5422
5423def err_explicit_instantiation_requires_name : Error<
5424  "explicit instantiation declaration requires a name">;
5425def err_explicit_instantiation_of_typedef : Error<
5426  "explicit instantiation of typedef %0">;
5427def err_explicit_instantiation_storage_class : Error<
5428  "explicit instantiation cannot have a storage class">;
5429def err_explicit_instantiation_internal_linkage : Error<
5430  "explicit instantiation declaration of %0 with internal linkage">;
5431def err_explicit_instantiation_not_known : Error<
5432  "explicit instantiation of %0 does not refer to a function template, "
5433  "variable template, member function, member class, or static data member">;
5434def note_explicit_instantiation_here : Note<
5435  "explicit instantiation refers here">;
5436def err_explicit_instantiation_data_member_not_instantiated : Error<
5437  "explicit instantiation refers to static data member %q0 that is not an "
5438  "instantiation">;
5439def err_explicit_instantiation_member_function_not_instantiated : Error<
5440  "explicit instantiation refers to member function %q0 that is not an "
5441  "instantiation">;
5442def err_explicit_instantiation_ambiguous : Error<
5443  "partial ordering for explicit instantiation of %0 is ambiguous">;
5444def note_explicit_instantiation_candidate : Note<
5445  "explicit instantiation candidate function %q0 template here %1">;
5446def err_explicit_instantiation_inline : Error<
5447  "explicit instantiation cannot be 'inline'">;
5448def warn_explicit_instantiation_inline_0x : Warning<
5449  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5450  DefaultIgnore;
5451def err_explicit_instantiation_constexpr : Error<
5452  "explicit instantiation cannot be 'constexpr'">;
5453def ext_explicit_instantiation_without_qualified_id : Extension<
5454  "qualifier in explicit instantiation of %q0 requires a template-id "
5455  "(a typedef is not permitted)">;
5456def err_explicit_instantiation_without_template_id : Error<
5457  "explicit instantiation of %q0 must specify a template argument list">;
5458def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5459  "explicit instantiation of %q0 must occur in namespace %1">;
5460def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5461  "explicit instantiation of %q0 must occur in namespace %1">,
5462  InGroup<CXX11Compat>, DefaultIgnore;
5463def err_explicit_instantiation_undefined_member : Error<
5464  "explicit instantiation of undefined %select{member class|member function|"
5465  "static data member}0 %1 of class template %2">;
5466def err_explicit_instantiation_undefined_func_template : Error<
5467  "explicit instantiation of undefined function template %0">;
5468def err_explicit_instantiation_undefined_var_template : Error<
5469  "explicit instantiation of undefined variable template %q0">;
5470def err_explicit_instantiation_declaration_after_definition : Error<
5471  "explicit instantiation declaration (with 'extern') follows explicit "
5472  "instantiation definition (without 'extern')">;
5473def note_explicit_instantiation_definition_here : Note<
5474  "explicit instantiation definition is here">;
5475def err_invalid_var_template_spec_type : Error<"type %2 "
5476  "of %select{explicit instantiation|explicit specialization|"
5477  "partial specialization|redeclaration}0 of %1 does not match"
5478  " expected type %3">;
5479def err_mismatched_exception_spec_explicit_instantiation : Error<
5480  "exception specification in explicit instantiation does not match "
5481  "instantiated one">;
5482def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5483  err_mismatched_exception_spec_explicit_instantiation.Summary>,
5484  InGroup<MicrosoftExceptionSpec>;
5485def err_explicit_instantiation_dependent : Error<
5486  "explicit instantiation has dependent template arguments">;
5487
5488// C++ typename-specifiers
5489def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5490def err_typename_nested_not_found_enable_if : Error<
5491  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5492  "this declaration">;
5493def err_typename_nested_not_found_requirement : Error<
5494  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5495  "declaration">;
5496def err_typename_nested_not_type : Error<
5497    "typename specifier refers to non-type member %0 in %1">;
5498def err_typename_not_type : Error<
5499    "typename specifier refers to non-type %0">;
5500def note_typename_member_refers_here : Note<
5501    "referenced member %0 is declared here">;
5502def note_typename_refers_here : Note<
5503    "referenced %0 is declared here">;
5504def err_typename_missing : Error<
5505  "missing 'typename' prior to dependent type name '%0%1'">;
5506def err_typename_missing_template : Error<
5507  "missing 'typename' prior to dependent type template name '%0%1'">;
5508def ext_typename_missing : ExtWarn<
5509  "missing 'typename' prior to dependent type name '%0%1'">,
5510  InGroup<DiagGroup<"typename-missing">>;
5511def ext_typename_outside_of_template : ExtWarn<
5512  "'typename' occurs outside of a template">, InGroup<CXX11>;
5513def warn_cxx98_compat_typename_outside_of_template : Warning<
5514  "use of 'typename' outside of a template is incompatible with C++98">,
5515  InGroup<CXX98Compat>, DefaultIgnore;
5516def err_typename_refers_to_using_value_decl : Error<
5517  "typename specifier refers to a dependent using declaration for a value "
5518  "%0 in %1">;
5519def note_using_value_decl_missing_typename : Note<
5520  "add 'typename' to treat this using declaration as a type">;
5521def warn_cxx17_compat_implicit_typename : Warning<"use of implicit 'typename' is "
5522  "incompatible with C++ standards before C++20">, InGroup<CXX20Compat>,
5523  DefaultIgnore;
5524def ext_implicit_typename : ExtWarn<"missing 'typename' prior to dependent "
5525  "type name %0%1; implicit 'typename' is a C++20 extension">,
5526  InGroup<CXX20>;
5527
5528def err_template_kw_refers_to_non_template : Error<
5529  "%0%select{| following the 'template' keyword}1 "
5530  "does not refer to a template">;
5531def note_template_kw_refers_to_non_template : Note<
5532  "declared as a non-template here">;
5533def err_template_kw_refers_to_dependent_non_template : Error<
5534  "%0%select{| following the 'template' keyword}1 "
5535  "cannot refer to a dependent template">;
5536def err_template_kw_refers_to_type_template : Error<
5537  "'%0%1' is expected to be a non-type template, but instantiated to a %select{class|type alias}2 template">;
5538def note_referenced_type_template : Note<
5539  "%select{class|type alias}0 template declared here">;
5540def err_template_kw_missing : Error<
5541  "missing 'template' keyword prior to dependent template name '%0%1'">;
5542def ext_template_outside_of_template : ExtWarn<
5543  "'template' keyword outside of a template">, InGroup<CXX11>;
5544def warn_cxx98_compat_template_outside_of_template : Warning<
5545  "use of 'template' keyword outside of a template is incompatible with C++98">,
5546  InGroup<CXX98Compat>, DefaultIgnore;
5547
5548def err_non_type_template_in_nested_name_specifier : Error<
5549  "qualified name refers into a specialization of %select{function|variable}0 "
5550  "template %1">;
5551def err_template_id_not_a_type : Error<
5552  "template name refers to non-type template %0">;
5553def note_template_declared_here : Note<
5554  "%select{function template|class template|variable template"
5555  "|type alias template|template template parameter}0 "
5556  "%1 declared here">;
5557def err_template_expansion_into_fixed_list : Error<
5558  "pack expansion used as argument for non-pack parameter of %select{alias "
5559  "template|concept}0">;
5560def note_parameter_type : Note<
5561  "parameter of type %0 is declared here">;
5562
5563// C++11 Variadic Templates
5564def err_template_param_pack_default_arg : Error<
5565  "template parameter pack cannot have a default argument">;
5566def err_template_param_pack_must_be_last_template_parameter : Error<
5567  "template parameter pack must be the last template parameter">;
5568
5569def err_template_parameter_pack_non_pack : Error<
5570  "%select{template type|non-type template|template template}0 parameter"
5571  "%select{| pack}1 conflicts with previous %select{template type|"
5572  "non-type template|template template}0 parameter%select{ pack|}1">;
5573def note_template_parameter_pack_non_pack : Note<
5574  "%select{template type|non-type template|template template}0 parameter"
5575  "%select{| pack}1 does not match %select{template type|non-type template"
5576  "|template template}0 parameter%select{ pack|}1 in template argument">;
5577def note_template_parameter_pack_here : Note<
5578  "previous %select{template type|non-type template|template template}0 "
5579  "parameter%select{| pack}1 declared here">;
5580
5581def err_unexpanded_parameter_pack : Error<
5582  "%select{expression|base type|declaration type|data member type|bit-field "
5583  "size|static assertion|fixed underlying type|enumerator value|"
5584  "using declaration|friend declaration|qualifier|initializer|default argument|"
5585  "non-type template parameter type|exception type|partial specialization|"
5586  "__if_exists name|__if_not_exists name|lambda|block|type constraint|"
5587  "requirement|requires clause}0 "
5588  "contains%plural{0: an|:}1 unexpanded parameter pack"
5589  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5590
5591def err_pack_expansion_without_parameter_packs : Error<
5592  "pack expansion does not contain any unexpanded parameter packs">;
5593def err_pack_expansion_length_conflict : Error<
5594  "pack expansion contains parameter packs %0 and %1 that have different "
5595  "lengths (%2 vs. %3)">;
5596def err_pack_expansion_length_conflict_multilevel : Error<
5597  "pack expansion contains parameter pack %0 that has a different "
5598  "length (%1 vs. %2) from outer parameter packs">;
5599def err_pack_expansion_length_conflict_partial : Error<
5600  "pack expansion contains parameter pack %0 that has a different "
5601  "length (at least %1 vs. %2) from outer parameter packs">;
5602def err_pack_expansion_member_init : Error<
5603  "pack expansion for initialization of member %0">;
5604
5605def err_function_parameter_pack_without_parameter_packs : Error<
5606  "type %0 of function parameter pack does not contain any unexpanded "
5607  "parameter packs">;
5608def err_ellipsis_in_declarator_not_parameter : Error<
5609  "only function and template parameters can be parameter packs">;
5610
5611def err_sizeof_pack_no_pack_name : Error<
5612  "%0 does not refer to the name of a parameter pack">;
5613
5614def err_fold_expression_packs_both_sides : Error<
5615  "binary fold expression has unexpanded parameter packs in both operands">;
5616def err_fold_expression_empty : Error<
5617  "unary fold expression has empty expansion for operator '%0' "
5618  "with no fallback value">;
5619def err_fold_expression_bad_operand : Error<
5620  "expression not permitted as operand of fold expression">;
5621def err_fold_expression_limit_exceeded: Error<
5622  "instantiating fold expression with %0 arguments exceeded expression nesting "
5623  "limit of %1">, DefaultFatal, NoSFINAE;
5624
5625def err_unexpected_typedef : Error<
5626  "unexpected type name %0: expected expression">;
5627def err_unexpected_namespace : Error<
5628  "unexpected namespace name %0: expected expression">;
5629def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5630def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5631  "use of undeclared identifier %0; "
5632  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5633  InGroup<MicrosoftTemplate>;
5634def err_found_in_dependent_base : Error<
5635  "explicit qualification required to use member %0 from dependent base class">;
5636def ext_found_in_dependent_base : ExtWarn<"use of member %0 "
5637  "found via unqualified lookup into dependent bases of class templates is a "
5638  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5639def err_found_later_in_class : Error<"member %0 used before its declaration">;
5640def ext_found_later_in_class : ExtWarn<
5641  "use of member %0 before its declaration is a Microsoft extension">,
5642  InGroup<MicrosoftTemplate>;
5643def ext_unqualified_base_class : ExtWarn<
5644  "unqualified base initializer of class templates is a Microsoft extension">,
5645  InGroup<MicrosoftTemplate>;
5646def note_dependent_member_use : Note<
5647  "must qualify identifier to find this declaration in dependent base class">;
5648def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5649    "visible in the template definition nor found by argument-dependent lookup">;
5650def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5651    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5652def err_undeclared_use : Error<"use of undeclared %0">;
5653def warn_deprecated : Warning<"%0 is deprecated">,
5654    InGroup<DeprecatedDeclarations>;
5655def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5656def warn_property_method_deprecated :
5657    Warning<"property access is using %0 method which is deprecated">,
5658    InGroup<DeprecatedDeclarations>;
5659def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5660    InGroup<DeprecatedDeclarations>;
5661def warn_deprecated_anonymous_namespace : Warning<
5662  "'deprecated' attribute on anonymous namespace ignored">,
5663  InGroup<IgnoredAttributes>;
5664def warn_deprecated_fwdclass_message : Warning<
5665    "%0 may be deprecated because the receiver type is unknown">,
5666    InGroup<DeprecatedDeclarations>;
5667def warn_deprecated_def : Warning<
5668  "implementing deprecated %select{method|class|category}0">,
5669  InGroup<DeprecatedImplementations>, DefaultIgnore;
5670def warn_unavailable_def : Warning<
5671  "implementing unavailable method">,
5672  InGroup<DeprecatedImplementations>, DefaultIgnore;
5673def warn_deprecated_builtin : Warning<
5674  "builtin %0 is deprecated; use %1 instead">,
5675  InGroup<DeprecatedBuiltins>;
5676def err_unavailable : Error<"%0 is unavailable">;
5677def err_property_method_unavailable :
5678    Error<"property access is using %0 method which is unavailable">;
5679def err_unavailable_message : Error<"%0 is unavailable: %1">;
5680def warn_unavailable_fwdclass_message : Warning<
5681    "%0 may be unavailable because the receiver type is unknown">,
5682    InGroup<UnavailableDeclarations>;
5683def note_availability_specified_here : Note<
5684  "%0 has been explicitly marked "
5685  "%select{unavailable|deleted|deprecated}1 here">;
5686def note_partial_availability_specified_here : Note<
5687  "%0 has been marked as being introduced in %1 %2 here, "
5688  "but the deployment target is %1 %3">;
5689def note_implicitly_deleted : Note<
5690  "explicitly defaulted function was implicitly deleted here">;
5691def warn_not_enough_argument : Warning<
5692  "not enough variable arguments in %0 declaration to fit a sentinel">,
5693  InGroup<Sentinel>;
5694def warn_missing_sentinel : Warning <
5695  "missing sentinel in %select{function call|method dispatch|block call}0">,
5696  InGroup<Sentinel>;
5697def note_sentinel_here : Note<
5698  "%select{function|method|block}0 has been explicitly marked sentinel here">;
5699def warn_strict_uses_without_prototype : Warning<
5700  "passing arguments to %select{a function|%1}0 without a prototype is "
5701  "deprecated in all versions of C and is not supported in C2x">,
5702  InGroup<DeprecatedNonPrototype>;
5703def warn_missing_prototype : Warning<
5704  "no previous prototype for function %0">,
5705  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5706def note_declaration_not_a_prototype : Note<
5707  "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5708  "to make it %select{a prototype for a zero-parameter function|one}0">;
5709// This is not actually an extension, but we only want it to be enabled in
5710// -pedantic mode and this is the most direct way of accomplishing that.
5711def warn_strict_prototypes : Extension<
5712  "a %select{function|block}0 declaration without a prototype is deprecated "
5713  "%select{in all versions of C|}0">, InGroup<StrictPrototypes>;
5714def warn_non_prototype_changes_behavior : Warning<
5715  "a function %select{declaration|definition}0 without a prototype is "
5716  "deprecated in all versions of C %select{and is not supported in C2x|and is "
5717  "treated as a zero-parameter prototype in C2x, conflicting with a "
5718  "%select{previous|subsequent}2 %select{declaration|definition}3}1">,
5719  InGroup<DeprecatedNonPrototype>;
5720def note_conflicting_prototype : Note<"conflicting prototype is here">;
5721def warn_missing_variable_declarations : Warning<
5722  "no previous extern declaration for non-static variable %0">,
5723  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5724def note_static_for_internal_linkage : Note<
5725  "declare 'static' if the %select{variable|function}0 is not intended to be "
5726  "used outside of this translation unit">;
5727def err_static_data_member_reinitialization :
5728  Error<"static data member %0 already has an initializer">;
5729def err_redefinition : Error<"redefinition of %0">;
5730def err_alias_after_tentative :
5731  Error<"alias definition of %0 after tentative definition">;
5732def err_alias_is_definition :
5733  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5734def err_definition_of_implicitly_declared_member : Error<
5735  "definition of implicitly declared %select{default constructor|copy "
5736  "constructor|move constructor|copy assignment operator|move assignment "
5737  "operator|destructor|function}1">;
5738def err_definition_of_explicitly_defaulted_member : Error<
5739  "definition of explicitly defaulted %select{default constructor|copy "
5740  "constructor|move constructor|copy assignment operator|move assignment "
5741  "operator|destructor|function}0">;
5742def err_redefinition_extern_inline : Error<
5743  "redefinition of a 'extern inline' function %0 is not supported in "
5744  "%select{C99 mode|C++}1">;
5745def warn_attr_abi_tag_namespace : Warning<
5746  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5747  InGroup<IgnoredAttributes>;
5748def err_abi_tag_on_redeclaration : Error<
5749  "cannot add 'abi_tag' attribute in a redeclaration">;
5750def err_new_abi_tag_on_redeclaration : Error<
5751  "'abi_tag' %0 missing in original declaration">;
5752def note_use_ifdef_guards : Note<
5753  "unguarded header; consider using #ifdef guards or #pragma once">;
5754
5755def warn_var_decl_not_read_only : Warning<
5756  "object of type %0 cannot be placed in read-only memory">,
5757  InGroup<ReadOnlyPlacementChecks>;
5758def note_enforce_read_only_placement : Note<"type was declared read-only here">;
5759
5760
5761def note_deleted_dtor_no_operator_delete : Note<
5762  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5763def note_deleted_special_member_class_subobject : Note<
5764  "%select{default constructor of|copy constructor of|move constructor of|"
5765  "copy assignment operator of|move assignment operator of|destructor of|"
5766  "constructor inherited by}0 "
5767  "%1 is implicitly deleted because "
5768  "%select{base class %3|%select{||||variant }4field %3}2 "
5769  "%select{has "
5770  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5771  "%select{%select{default constructor|copy constructor|move constructor|copy "
5772  "assignment operator|move assignment operator|destructor|"
5773  "%select{default|corresponding|default|default|default}4 constructor}0|"
5774  "destructor}5"
5775  "%select{||s||}4"
5776  "|is an ObjC pointer}6">;
5777def note_deleted_default_ctor_uninit_field : Note<
5778  "%select{default constructor of|constructor inherited by}0 "
5779  "%1 is implicitly deleted because field %2 of "
5780  "%select{reference|const-qualified}4 type %3 would not be initialized">;
5781def note_deleted_default_ctor_all_const : Note<
5782  "%select{default constructor of|constructor inherited by}0 "
5783  "%1 is implicitly deleted because all "
5784  "%select{data members|data members of an anonymous union member}2"
5785  " are const-qualified">;
5786def note_deleted_copy_ctor_rvalue_reference : Note<
5787  "copy constructor of %0 is implicitly deleted because field %1 is of "
5788  "rvalue reference type %2">;
5789def note_deleted_copy_user_declared_move : Note<
5790  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5791  " %1 has a user-declared move %select{constructor|assignment operator}2">;
5792def note_deleted_assign_field : Note<
5793  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5794  "because field %2 is of %select{reference|const-qualified}4 type %3">;
5795
5796// These should be errors.
5797def warn_undefined_internal : Warning<
5798  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5799  InGroup<DiagGroup<"undefined-internal">>;
5800def err_undefined_internal_type : Error<
5801  "%select{function|variable}0 %q1 is used but not defined in this "
5802  "translation unit, and cannot be defined in any other translation unit "
5803  "because its type does not have linkage">;
5804def ext_undefined_internal_type : Extension<
5805  "ISO C++ requires a definition in this translation unit for "
5806  "%select{function|variable}0 %q1 because its type does not have linkage">,
5807  InGroup<DiagGroup<"undefined-internal-type">>;
5808def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5809  InGroup<DiagGroup<"undefined-inline">>;
5810def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5811def note_used_here : Note<"used here">;
5812
5813def err_attribute_missing_on_first_decl : Error<
5814  "%0 attribute does not appear on the first declaration">;
5815def warn_internal_linkage_local_storage : Warning<
5816  "'internal_linkage' attribute on a non-static local variable is ignored">,
5817  InGroup<IgnoredAttributes>;
5818
5819def ext_internal_in_extern_inline : ExtWarn<
5820  "static %select{function|variable}0 %1 is used in an inline function with "
5821  "external linkage">, InGroup<StaticInInline>;
5822def ext_internal_in_extern_inline_quiet : Extension<
5823  "static %select{function|variable}0 %1 is used in an inline function with "
5824  "external linkage">, InGroup<StaticInInline>;
5825def warn_static_local_in_extern_inline : Warning<
5826  "non-constant static local variable in inline function may be different "
5827  "in different files">, InGroup<StaticLocalInInline>;
5828def note_convert_inline_to_static : Note<
5829  "use 'static' to give inline function %0 internal linkage">;
5830
5831def ext_redefinition_of_typedef : ExtWarn<
5832  "redefinition of typedef %0 is a C11 feature">,
5833  InGroup<DiagGroup<"typedef-redefinition"> >;
5834def err_redefinition_variably_modified_typedef : Error<
5835  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5836
5837def err_inline_decl_follows_def : Error<
5838  "inline declaration of %0 follows non-inline definition">;
5839def err_inline_declaration_block_scope : Error<
5840  "inline declaration of %0 not allowed in block scope">;
5841def err_static_non_static : Error<
5842  "static declaration of %0 follows non-static declaration">;
5843def err_different_language_linkage : Error<
5844  "declaration of %0 has a different language linkage">;
5845def ext_retained_language_linkage : Extension<
5846  "friend function %0 retaining previous language linkage is an extension">,
5847  InGroup<DiagGroup<"retained-language-linkage">>;
5848def err_extern_c_global_conflict : Error<
5849  "declaration of %1 %select{with C language linkage|in global scope}0 "
5850  "conflicts with declaration %select{in global scope|with C language linkage}0">;
5851def note_extern_c_global_conflict : Note<
5852  "declared %select{in global scope|with C language linkage}0 here">;
5853def note_extern_c_begins_here : Note<
5854  "extern \"C\" language linkage specification begins here">;
5855def warn_weak_import : Warning <
5856  "an already-declared variable is made a weak_import declaration %0">;
5857def ext_static_non_static : Extension<
5858  "redeclaring non-static %0 as static is a Microsoft extension">,
5859  InGroup<MicrosoftRedeclareStatic>;
5860def err_non_static_static : Error<
5861  "non-static declaration of %0 follows static declaration">;
5862def err_extern_non_extern : Error<
5863  "extern declaration of %0 follows non-extern declaration">;
5864def err_non_extern_extern : Error<
5865  "non-extern declaration of %0 follows extern declaration">;
5866def err_non_thread_thread : Error<
5867  "non-thread-local declaration of %0 follows thread-local declaration">;
5868def err_thread_non_thread : Error<
5869  "thread-local declaration of %0 follows non-thread-local declaration">;
5870def err_thread_thread_different_kind : Error<
5871  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5872  "follows declaration with %select{dynamic|static}1 initialization">;
5873def err_mismatched_owning_module : Error<
5874  "declaration of %0 in %select{the global module|module %2}1 follows "
5875  "declaration in %select{the global module|module %4}3">;
5876def err_redefinition_different_type : Error<
5877  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5878def err_redefinition_different_kind : Error<
5879  "redefinition of %0 as different kind of symbol">;
5880def err_redefinition_different_namespace_alias : Error<
5881  "redefinition of %0 as an alias for a different namespace">;
5882def note_previous_namespace_alias : Note<
5883  "previously defined as an alias for %0">;
5884def warn_forward_class_redefinition : Warning<
5885  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5886  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5887def err_redefinition_different_typedef : Error<
5888  "%select{typedef|type alias|type alias template}0 "
5889  "redefinition with different types%diff{ ($ vs $)|}1,2">;
5890def err_redefinition_different_concept : Error<
5891  "redefinition of concept %0 with different template parameters or requirements">;
5892def err_tag_reference_non_tag : Error<
5893  "%select{non-struct type|non-class type|non-union type|non-enum "
5894  "type|typedef|type alias|template|type alias template|template "
5895  "template argument}1 %0 cannot be referenced with a "
5896  "%select{struct|interface|union|class|enum}2 specifier">;
5897def err_tag_reference_conflict : Error<
5898  "implicit declaration introduced by elaborated type conflicts with a "
5899  "%select{non-struct type|non-class type|non-union type|non-enum "
5900  "type|typedef|type alias|template|type alias template|template "
5901  "template argument}0 of the same name">;
5902def err_dependent_tag_decl : Error<
5903  "%select{declaration|definition}0 of "
5904  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5905def err_tag_definition_of_typedef : Error<
5906  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
5907def err_conflicting_types : Error<"conflicting types for %0">;
5908def err_different_pass_object_size_params : Error<
5909  "conflicting pass_object_size attributes on parameters">;
5910def err_late_asm_label_name : Error<
5911  "cannot apply asm label to %select{variable|function}0 after its first use">;
5912def err_different_asm_label : Error<"conflicting asm label">;
5913def err_nested_redefinition : Error<"nested redefinition of %0">;
5914def err_use_with_wrong_tag : Error<
5915  "use of %0 with tag type that does not match previous declaration">;
5916def warn_struct_class_tag_mismatch : Warning<
5917  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
5918  "declared as a %select{struct|interface|class}3%select{| template}1; "
5919  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5920  InGroup<MismatchedTags>, DefaultIgnore;
5921def warn_struct_class_previous_tag_mismatch : Warning<
5922  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
5923  "here but previously declared as "
5924  "%select{a struct|an interface|a class}3%select{| template}1; "
5925  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5926  InGroup<MismatchedTags>, DefaultIgnore;
5927def note_struct_class_suggestion : Note<
5928  "did you mean %select{struct|interface|class}0 here?">;
5929def ext_forward_ref_enum : Extension<
5930  "ISO C forbids forward references to 'enum' types">;
5931def err_forward_ref_enum : Error<
5932  "ISO C++ forbids forward references to 'enum' types">;
5933def ext_ms_forward_ref_enum : ExtWarn<
5934  "forward references to 'enum' types are a Microsoft extension">,
5935  InGroup<MicrosoftEnumForwardReference>;
5936def ext_forward_ref_enum_def : Extension<
5937  "redeclaration of already-defined enum %0 is a GNU extension">,
5938  InGroup<GNURedeclaredEnum>;
5939
5940def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
5941def err_duplicate_member : Error<"duplicate member %0">;
5942def err_misplaced_ivar : Error<
5943  "instance variables may not be placed in %select{categories|class extension}0">;
5944def warn_ivars_in_interface : Warning<
5945  "declaration of instance variables in the interface is deprecated">,
5946  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
5947def ext_enum_value_not_int : Extension<
5948  "ISO C restricts enumerator values to range of 'int' (%0 is too "
5949  "%select{small|large}1)">;
5950def ext_enum_too_large : ExtWarn<
5951  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
5952def ext_enumerator_increment_too_large : ExtWarn<
5953  "incremented enumerator value %0 is not representable in the "
5954  "largest integer type">, InGroup<EnumTooLarge>;
5955def warn_flag_enum_constant_out_of_range : Warning<
5956  "enumeration value %0 is out of range of flags in enumeration type %1">,
5957  InGroup<FlagEnum>;
5958
5959def err_vm_decl_in_file_scope : Error<
5960  "variably modified type declaration not allowed at file scope">;
5961def err_vm_decl_has_extern_linkage : Error<
5962  "variably modified type declaration cannot have 'extern' linkage">;
5963def err_typecheck_field_variable_size : Error<
5964  "fields must have a constant size: 'variable length array in structure' "
5965  "extension will never be supported">;
5966def err_vm_func_decl : Error<
5967  "function declaration cannot have variably modified type">;
5968def err_array_too_large : Error<
5969  "array is too large (%0 elements)">;
5970
5971def err_typecheck_negative_array_size : Error<"array size is negative">;
5972def warn_typecheck_function_qualifiers_ignored : Warning<
5973  "'%0' qualifier on function type %1 has no effect">,
5974  InGroup<IgnoredQualifiers>;
5975def warn_typecheck_function_qualifiers_unspecified : Warning<
5976  "'%0' qualifier on function type %1 has unspecified behavior">;
5977def warn_typecheck_reference_qualifiers : Warning<
5978  "'%0' qualifier on reference type %1 has no effect">,
5979  InGroup<IgnoredReferenceQualifiers>;
5980def err_typecheck_invalid_restrict_not_pointer : Error<
5981  "restrict requires a pointer or reference (%0 is invalid)">;
5982def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
5983  "restrict requires a pointer or reference">;
5984def err_typecheck_invalid_restrict_invalid_pointee : Error<
5985  "pointer to function type %0 may not be 'restrict' qualified">;
5986def ext_typecheck_zero_array_size : Extension<
5987  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
5988def err_typecheck_zero_array_size : Error<
5989  "zero-length arrays are not permitted in %select{C++|SYCL device code}0">;
5990def err_array_size_non_int : Error<"size of array has non-integer type %0">;
5991def err_init_element_not_constant : Error<
5992  "initializer element is not a compile-time constant">;
5993def ext_aggregate_init_not_constant : Extension<
5994  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
5995def err_local_cant_init : Error<
5996  "'__local' variable cannot have an initializer">;
5997def err_loader_uninitialized_cant_init
5998    : Error<"variable with 'loader_uninitialized' attribute cannot have an "
5999            "initializer">;
6000def err_loader_uninitialized_trivial_ctor
6001    : Error<"variable with 'loader_uninitialized' attribute must have a "
6002            "trivial default constructor">;
6003def err_loader_uninitialized_redeclaration
6004    : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
6005def err_loader_uninitialized_extern_decl
6006    : Error<"variable %0 cannot be declared both 'extern' and with the "
6007            "'loader_uninitialized' attribute">;
6008def err_block_extern_cant_init : Error<
6009  "declaration of block scope identifier with linkage cannot have an initializer">;
6010def warn_extern_init : Warning<"'extern' variable has an initializer">,
6011  InGroup<DiagGroup<"extern-initializer">>;
6012def err_variable_object_no_init : Error<
6013  "variable-sized object may not be initialized">;
6014def err_excess_initializers : Error<
6015  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
6016def ext_excess_initializers : ExtWarn<
6017  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
6018  InGroup<ExcessInitializers>;
6019def err_excess_initializers_for_sizeless_type : Error<
6020  "excess elements in initializer for indivisible sizeless type %0">;
6021def ext_excess_initializers_for_sizeless_type : ExtWarn<
6022  "excess elements in initializer for indivisible sizeless type %0">,
6023  InGroup<ExcessInitializers>;
6024def err_excess_initializers_in_char_array_initializer : Error<
6025  "excess elements in char array initializer">;
6026def ext_excess_initializers_in_char_array_initializer : ExtWarn<
6027  "excess elements in char array initializer">,
6028  InGroup<ExcessInitializers>;
6029def err_initializer_string_for_char_array_too_long : Error<
6030  "initializer-string for char array is too long, array size is %0 but initializer has size %1 (including the null terminating character)">;
6031def ext_initializer_string_for_char_array_too_long : ExtWarn<
6032  "initializer-string for char array is too long">,
6033  InGroup<ExcessInitializers>;
6034def warn_missing_field_initializers : Warning<
6035  "missing field %0 initializer">,
6036  InGroup<MissingFieldInitializers>, DefaultIgnore;
6037def warn_braces_around_init : Warning<
6038  "braces around %select{scalar |}0initializer">,
6039  InGroup<DiagGroup<"braced-scalar-init">>;
6040def ext_many_braces_around_init : ExtWarn<
6041  "too many braces around %select{scalar |}0initializer">,
6042  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
6043def ext_complex_component_init : Extension<
6044  "complex initialization specifying real and imaginary components "
6045  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
6046def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
6047def err_empty_sizeless_initializer : Error<
6048  "initializer for sizeless type %0 cannot be empty">;
6049def warn_cxx98_compat_empty_scalar_initializer : Warning<
6050  "scalar initialized from empty initializer list is incompatible with C++98">,
6051  InGroup<CXX98Compat>, DefaultIgnore;
6052def warn_cxx98_compat_empty_sizeless_initializer : Warning<
6053  "initializing %0 from an empty initializer list is incompatible with C++98">,
6054  InGroup<CXX98Compat>, DefaultIgnore;
6055def warn_cxx98_compat_reference_list_init : Warning<
6056  "reference initialized from initializer list is incompatible with C++98">,
6057  InGroup<CXX98Compat>, DefaultIgnore;
6058def warn_cxx98_compat_initializer_list_init : Warning<
6059  "initialization of initializer_list object is incompatible with C++98">,
6060  InGroup<CXX98Compat>, DefaultIgnore;
6061def warn_cxx98_compat_ctor_list_init : Warning<
6062  "constructor call from initializer list is incompatible with C++98">,
6063  InGroup<CXX98Compat>, DefaultIgnore;
6064def err_illegal_initializer : Error<
6065  "illegal initializer (only variables can be initialized)">;
6066def err_illegal_initializer_type : Error<"illegal initializer type %0">;
6067def ext_init_list_type_narrowing : ExtWarn<
6068  "type %0 cannot be narrowed to %1 in initializer list">,
6069  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6070def ext_init_list_variable_narrowing : ExtWarn<
6071  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6072  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6073def ext_init_list_constant_narrowing : ExtWarn<
6074  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
6075  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
6076def warn_init_list_type_narrowing : Warning<
6077  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
6078  InGroup<CXX11Narrowing>, DefaultIgnore;
6079def warn_init_list_variable_narrowing : Warning<
6080  "non-constant-expression cannot be narrowed from type %0 to %1 in "
6081  "initializer list in C++11">,
6082  InGroup<CXX11Narrowing>, DefaultIgnore;
6083def warn_init_list_constant_narrowing : Warning<
6084  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
6085  "C++11">,
6086  InGroup<CXX11Narrowing>, DefaultIgnore;
6087def note_init_list_narrowing_silence : Note<
6088  "insert an explicit cast to silence this issue">;
6089def err_init_objc_class : Error<
6090  "cannot initialize Objective-C class type %0">;
6091def err_implicit_empty_initializer : Error<
6092  "initializer for aggregate with no elements requires explicit braces">;
6093def err_bitfield_has_negative_width : Error<
6094  "bit-field %0 has negative width (%1)">;
6095def err_anon_bitfield_has_negative_width : Error<
6096  "anonymous bit-field has negative width (%0)">;
6097def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
6098def err_bitfield_width_exceeds_type_width : Error<
6099  "width of%select{ anonymous|}0 bit-field%select{| %1}0 (%2 bits) exceeds the "
6100  "%select{width|size}3 of its type (%4 bit%s4)">;
6101def err_incorrect_number_of_vector_initializers : Error<
6102  "number of elements must be either one or match the size of the vector">;
6103
6104// Used by C++ which allows bit-fields that are wider than the type.
6105def warn_bitfield_width_exceeds_type_width: Warning<
6106  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
6107  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
6108def err_bitfield_too_wide : Error<
6109  "%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
6110def warn_bitfield_too_small_for_enum : Warning<
6111  "bit-field %0 is not wide enough to store all enumerators of %1">,
6112  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6113def note_widen_bitfield : Note<
6114  "widen this field to %0 bits to store all values of %1">;
6115def warn_unsigned_bitfield_assigned_signed_enum : Warning<
6116  "assigning value of signed enum type %1 to unsigned bit-field %0; "
6117  "negative enumerators of enum %1 will be converted to positive values">,
6118  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6119def warn_signed_bitfield_enum_conversion : Warning<
6120  "signed bit-field %0 needs an extra bit to represent the largest positive "
6121  "enumerators of %1">,
6122  InGroup<BitFieldEnumConversion>, DefaultIgnore;
6123def note_change_bitfield_sign : Note<
6124  "consider making the bitfield type %select{unsigned|signed}0">;
6125
6126def warn_missing_braces : Warning<
6127  "suggest braces around initialization of subobject">,
6128  InGroup<MissingBraces>, DefaultIgnore;
6129
6130def err_redefinition_of_label : Error<"redefinition of label %0">;
6131def err_undeclared_label_use : Error<"use of undeclared label %0">;
6132def err_goto_ms_asm_label : Error<
6133  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
6134def note_goto_ms_asm_label : Note<
6135  "inline assembly label %0 declared here">;
6136def warn_unused_label : Warning<"unused label %0">,
6137  InGroup<UnusedLabel>, DefaultIgnore;
6138
6139def err_continue_from_cond_var_init : Error<
6140  "cannot jump from this continue statement to the loop increment; "
6141  "jump bypasses initialization of loop condition variable">;
6142def err_goto_into_protected_scope : Error<
6143  "cannot jump from this goto statement to its label">;
6144def ext_goto_into_protected_scope : ExtWarn<
6145  "jump from this goto statement to its label is a Microsoft extension">,
6146  InGroup<MicrosoftGoto>;
6147def warn_cxx98_compat_goto_into_protected_scope : Warning<
6148  "jump from this goto statement to its label is incompatible with C++98">,
6149  InGroup<CXX98Compat>, DefaultIgnore;
6150def err_switch_into_protected_scope : Error<
6151  "cannot jump from switch statement to this case label">;
6152def warn_cxx98_compat_switch_into_protected_scope : Warning<
6153  "jump from switch statement to this case label is incompatible with C++98">,
6154  InGroup<CXX98Compat>, DefaultIgnore;
6155def err_indirect_goto_without_addrlabel : Error<
6156  "indirect goto in function with no address-of-label expressions">;
6157def err_indirect_goto_in_protected_scope : Error<
6158  "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
6159def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
6160  "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
6161  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6162def note_indirect_goto_target : Note<
6163  "possible target of %select{indirect|asm}0 goto statement">;
6164def note_protected_by_variable_init : Note<
6165  "jump bypasses variable initialization">;
6166def note_protected_by_variable_nontriv_destructor : Note<
6167  "jump bypasses variable with a non-trivial destructor">;
6168def note_protected_by_variable_non_pod : Note<
6169  "jump bypasses initialization of non-POD variable">;
6170def note_protected_by_cleanup : Note<
6171  "jump bypasses initialization of variable with __attribute__((cleanup))">;
6172def note_protected_by_vla_typedef : Note<
6173  "jump bypasses initialization of VLA typedef">;
6174def note_protected_by_vla_type_alias : Note<
6175  "jump bypasses initialization of VLA type alias">;
6176def note_protected_by_constexpr_if : Note<
6177  "jump enters controlled statement of constexpr if">;
6178def note_protected_by_consteval_if : Note<
6179  "jump enters controlled statement of consteval if">;
6180def note_protected_by_if_available : Note<
6181  "jump enters controlled statement of if available">;
6182def note_protected_by_vla : Note<
6183  "jump bypasses initialization of variable length array">;
6184def note_protected_by_objc_fast_enumeration : Note<
6185  "jump enters Objective-C fast enumeration loop">;
6186def note_protected_by_objc_try : Note<
6187  "jump bypasses initialization of @try block">;
6188def note_protected_by_objc_catch : Note<
6189  "jump bypasses initialization of @catch block">;
6190def note_protected_by_objc_finally : Note<
6191  "jump bypasses initialization of @finally block">;
6192def note_protected_by_objc_synchronized : Note<
6193  "jump bypasses initialization of @synchronized block">;
6194def note_protected_by_objc_autoreleasepool : Note<
6195  "jump bypasses auto release push of @autoreleasepool block">;
6196def note_protected_by_cxx_try : Note<
6197  "jump bypasses initialization of try block">;
6198def note_protected_by_cxx_catch : Note<
6199  "jump bypasses initialization of catch block">;
6200def note_protected_by_seh_try : Note<
6201  "jump bypasses initialization of __try block">;
6202def note_protected_by_seh_except : Note<
6203  "jump bypasses initialization of __except block">;
6204def note_protected_by_seh_finally : Note<
6205  "jump bypasses initialization of __finally block">;
6206def note_protected_by___block : Note<
6207  "jump bypasses setup of __block variable">;
6208def note_protected_by_objc_strong_init : Note<
6209  "jump bypasses initialization of __strong variable">;
6210def note_protected_by_objc_weak_init : Note<
6211  "jump bypasses initialization of __weak variable">;
6212def note_protected_by_non_trivial_c_struct_init : Note<
6213  "jump bypasses initialization of variable of non-trivial C struct type">;
6214def note_enters_block_captures_cxx_obj : Note<
6215  "jump enters lifetime of block which captures a destructible C++ object">;
6216def note_enters_block_captures_strong : Note<
6217  "jump enters lifetime of block which strongly captures a variable">;
6218def note_enters_block_captures_weak : Note<
6219  "jump enters lifetime of block which weakly captures a variable">;
6220def note_enters_block_captures_non_trivial_c_struct : Note<
6221  "jump enters lifetime of block which captures a C struct that is non-trivial "
6222  "to destroy">;
6223def note_enters_compound_literal_scope : Note<
6224  "jump enters lifetime of a compound literal that is non-trivial to destruct">;
6225def note_enters_statement_expression : Note<
6226  "jump enters a statement expression">;
6227
6228def note_exits_cleanup : Note<
6229  "jump exits scope of variable with __attribute__((cleanup))">;
6230def note_exits_dtor : Note<
6231  "jump exits scope of variable with non-trivial destructor">;
6232def note_exits_temporary_dtor : Note<
6233  "jump exits scope of lifetime-extended temporary with non-trivial "
6234  "destructor">;
6235def note_exits___block : Note<
6236  "jump exits scope of __block variable">;
6237def note_exits_objc_try : Note<
6238  "jump exits @try block">;
6239def note_exits_objc_catch : Note<
6240  "jump exits @catch block">;
6241def note_exits_objc_finally : Note<
6242  "jump exits @finally block">;
6243def note_exits_objc_synchronized : Note<
6244  "jump exits @synchronized block">;
6245def note_exits_cxx_try : Note<
6246  "jump exits try block">;
6247def note_exits_cxx_catch : Note<
6248  "jump exits catch block">;
6249def note_exits_seh_try : Note<
6250  "jump exits __try block">;
6251def note_exits_seh_except : Note<
6252  "jump exits __except block">;
6253def note_exits_seh_finally : Note<
6254  "jump exits __finally block">;
6255def note_exits_objc_autoreleasepool : Note<
6256  "jump exits autoreleasepool block">;
6257def note_exits_objc_strong : Note<
6258  "jump exits scope of __strong variable">;
6259def note_exits_objc_weak : Note<
6260  "jump exits scope of __weak variable">;
6261def note_exits_block_captures_cxx_obj : Note<
6262  "jump exits lifetime of block which captures a destructible C++ object">;
6263def note_exits_block_captures_strong : Note<
6264  "jump exits lifetime of block which strongly captures a variable">;
6265def note_exits_block_captures_weak : Note<
6266  "jump exits lifetime of block which weakly captures a variable">;
6267def note_exits_block_captures_non_trivial_c_struct : Note<
6268  "jump exits lifetime of block which captures a C struct that is non-trivial "
6269  "to destroy">;
6270def note_exits_compound_literal_scope : Note<
6271  "jump exits lifetime of a compound literal that is non-trivial to destruct">;
6272
6273def err_func_returning_qualified_void : ExtWarn<
6274  "function cannot return qualified void type %0">,
6275  InGroup<DiagGroup<"qualified-void-return-type">>;
6276def err_func_returning_array_function : Error<
6277  "function cannot return %select{array|function}0 type %1">;
6278def err_field_declared_as_function : Error<"field %0 declared as a function">;
6279def err_field_incomplete_or_sizeless : Error<
6280  "field has %select{incomplete|sizeless}0 type %1">;
6281def ext_variable_sized_type_in_struct : ExtWarn<
6282  "field %0 with variable sized type %1 not at the end of a struct or class is"
6283  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
6284
6285def ext_c99_flexible_array_member : Extension<
6286  "flexible array members are a C99 feature">, InGroup<C99>;
6287def err_flexible_array_virtual_base : Error<
6288  "flexible array member %0 not allowed in "
6289  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
6290def err_flexible_array_empty_aggregate : Error<
6291  "flexible array member %0 not allowed in otherwise empty "
6292  "%select{struct|interface|union|class|enum}1">;
6293def err_flexible_array_has_nontrivial_dtor : Error<
6294  "flexible array member %0 of type %1 with non-trivial destruction">;
6295def ext_flexible_array_in_struct : Extension<
6296  "%0 may not be nested in a struct due to flexible array member">,
6297  InGroup<FlexibleArrayExtensions>;
6298def ext_flexible_array_in_array : Extension<
6299  "%0 may not be used as an array element due to flexible array member">,
6300  InGroup<FlexibleArrayExtensions>;
6301def err_flexible_array_init : Error<
6302  "initialization of flexible array member is not allowed">;
6303def ext_flexible_array_empty_aggregate_ms : Extension<
6304  "flexible array member %0 in otherwise empty "
6305  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
6306  InGroup<MicrosoftFlexibleArray>;
6307def err_flexible_array_union : Error<
6308  "flexible array member %0 in a union is not allowed">;
6309def ext_flexible_array_union_ms : Extension<
6310  "flexible array member %0 in a union is a Microsoft extension">,
6311  InGroup<MicrosoftFlexibleArray>;
6312def ext_flexible_array_empty_aggregate_gnu : Extension<
6313  "flexible array member %0 in otherwise empty "
6314  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
6315  InGroup<GNUEmptyStruct>;
6316def ext_flexible_array_union_gnu : Extension<
6317  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
6318
6319def err_flexible_array_not_at_end : Error<
6320  "flexible array member %0 with type %1 is not at the end of"
6321  " %select{struct|interface|union|class|enum}2">;
6322def err_objc_variable_sized_type_not_at_end : Error<
6323  "field %0 with variable sized type %1 is not at the end of class">;
6324def note_next_field_declaration : Note<
6325  "next field declaration is here">;
6326def note_next_ivar_declaration : Note<
6327  "next %select{instance variable declaration|synthesized instance variable}0"
6328  " is here">;
6329def err_synthesize_variable_sized_ivar : Error<
6330  "synthesized property with variable size type %0"
6331  " requires an existing instance variable">;
6332def err_flexible_array_arc_retainable : Error<
6333  "ARC forbids flexible array members with retainable object type">;
6334def warn_variable_sized_ivar_visibility : Warning<
6335  "field %0 with variable sized type %1 is not visible to subclasses and"
6336  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
6337def warn_superclass_variable_sized_type_not_at_end : Warning<
6338  "field %0 can overwrite instance variable %1 with variable sized type %2"
6339  " in superclass %3">, InGroup<ObjCFlexibleArray>;
6340
6341let CategoryName = "ARC Semantic Issue" in {
6342
6343// ARC-mode diagnostics.
6344
6345let CategoryName = "ARC Weak References" in {
6346
6347def err_arc_weak_no_runtime : Error<
6348  "cannot create __weak reference because the current deployment target "
6349  "does not support weak references">;
6350def err_arc_weak_disabled : Error<
6351  "cannot create __weak reference in file using manual reference counting">;
6352def err_synthesizing_arc_weak_property_disabled : Error<
6353  "cannot synthesize weak property in file using manual reference counting">;
6354def err_synthesizing_arc_weak_property_no_runtime : Error<
6355  "cannot synthesize weak property because the current deployment target "
6356  "does not support weak references">;
6357def err_arc_unsupported_weak_class : Error<
6358  "class is incompatible with __weak references">;
6359def err_arc_weak_unavailable_assign : Error<
6360  "assignment of a weak-unavailable object to a __weak object">;
6361def err_arc_weak_unavailable_property : Error<
6362  "synthesizing __weak instance variable of type %0, which does not "
6363  "support weak references">;
6364def note_implemented_by_class : Note<
6365  "when implemented by class %0">;
6366def err_arc_convesion_of_weak_unavailable : Error<
6367  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
6368  " a __weak object of type %2">;
6369
6370} // end "ARC Weak References" category
6371
6372let CategoryName = "ARC Restrictions" in {
6373
6374def err_unavailable_in_arc : Error<
6375  "%0 is unavailable in ARC">;
6376def note_arc_forbidden_type : Note<
6377  "declaration uses type that is ill-formed in ARC">;
6378def note_performs_forbidden_arc_conversion : Note<
6379  "inline function performs a conversion which is forbidden in ARC">;
6380def note_arc_init_returns_unrelated : Note<
6381  "init method must return a type related to its receiver type">;
6382def note_arc_weak_disabled : Note<
6383  "declaration uses __weak, but ARC is disabled">;
6384def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
6385  "the current deployment target does not support">;
6386def note_arc_field_with_ownership : Note<
6387  "field has non-trivial ownership qualification">;
6388
6389def err_arc_illegal_explicit_message : Error<
6390  "ARC forbids explicit message send of %0">;
6391def err_arc_unused_init_message : Error<
6392  "the result of a delegate init call must be immediately returned "
6393  "or assigned to 'self'">;
6394def err_arc_mismatched_cast : Error<
6395  "%select{implicit conversion|cast}0 of "
6396  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
6397  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
6398  " to %3 is disallowed with ARC">;
6399def err_arc_nolifetime_behavior : Error<
6400  "explicit ownership qualifier on cast result has no effect">;
6401def err_arc_objc_property_default_assign_on_object : Error<
6402  "ARC forbids synthesizing a property of an Objective-C object "
6403  "with unspecified ownership or storage attribute">;
6404def err_arc_illegal_selector : Error<
6405  "ARC forbids use of %0 in a @selector">;
6406def err_arc_illegal_method_def : Error<
6407  "ARC forbids %select{implementation|synthesis}0 of %1">;
6408def warn_arc_strong_pointer_objc_pointer : Warning<
6409  "method parameter of type %0 with no explicit ownership">,
6410  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
6411
6412} // end "ARC Restrictions" category
6413
6414def err_arc_lost_method_convention : Error<
6415  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
6416  "method, but its implementation doesn't match because %select{"
6417  "its result type is not an object pointer|"
6418  "its result type is unrelated to its receiver type}1">;
6419def note_arc_lost_method_convention : Note<"declaration in interface">;
6420def err_arc_gained_method_convention : Error<
6421  "method implementation does not match its declaration">;
6422def note_arc_gained_method_convention : Note<
6423  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
6424  "family because %select{its result type is not an object pointer|"
6425  "its result type is unrelated to its receiver type}1">;
6426def err_typecheck_arc_assign_self : Error<
6427  "cannot assign to 'self' outside of a method in the init family">;
6428def err_typecheck_arc_assign_self_class_method : Error<
6429  "cannot assign to 'self' in a class method">;
6430def err_typecheck_arr_assign_enumeration : Error<
6431  "fast enumeration variables cannot be modified in ARC by default; "
6432  "declare the variable __strong to allow this">;
6433def err_typecheck_arc_assign_externally_retained : Error<
6434  "variable declared with 'objc_externally_retained' "
6435  "cannot be modified in ARC">;
6436def warn_arc_retained_assign : Warning<
6437  "assigning retained object to %select{weak|unsafe_unretained}0 "
6438  "%select{property|variable}1"
6439  "; object will be released after assignment">,
6440  InGroup<ARCUnsafeRetainedAssign>;
6441def warn_arc_retained_property_assign : Warning<
6442  "assigning retained object to unsafe property"
6443  "; object will be released after assignment">,
6444  InGroup<ARCUnsafeRetainedAssign>;
6445def warn_arc_literal_assign : Warning<
6446  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
6447  " to a weak %select{property|variable}1"
6448  "; object will be released after assignment">,
6449  InGroup<ARCUnsafeRetainedAssign>;
6450def err_arc_new_array_without_ownership : Error<
6451  "'new' cannot allocate an array of %0 with no explicit ownership">;
6452def err_arc_autoreleasing_var : Error<
6453  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
6454  "__autoreleasing ownership">;
6455def err_arc_autoreleasing_capture : Error<
6456  "cannot capture __autoreleasing variable in a "
6457  "%select{block|lambda by copy}0">;
6458def err_arc_thread_ownership : Error<
6459  "thread-local variable has non-trivial ownership: type is %0">;
6460def err_arc_indirect_no_ownership : Error<
6461  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6462def err_arc_array_param_no_ownership : Error<
6463  "must explicitly describe intended ownership of an object array parameter">;
6464def err_arc_pseudo_dtor_inconstant_quals : Error<
6465  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6466  "type %1">;
6467def err_arc_init_method_unrelated_result_type : Error<
6468  "init methods must return a type related to the receiver type">;
6469def err_arc_nonlocal_writeback : Error<
6470  "passing address of %select{non-local|non-scalar}0 object to "
6471  "__autoreleasing parameter for write-back">;
6472def err_arc_method_not_found : Error<
6473  "no known %select{instance|class}1 method for selector %0">;
6474def err_arc_receiver_forward_class : Error<
6475  "receiver %0 for class message is a forward declaration">;
6476def err_arc_may_not_respond : Error<
6477  "no visible @interface for %0 declares the selector %1">;
6478def err_arc_receiver_forward_instance : Error<
6479  "receiver type %0 for instance message is a forward declaration">;
6480def warn_receiver_forward_instance : Warning<
6481  "receiver type %0 for instance message is a forward declaration">,
6482  InGroup<ForwardClassReceiver>, DefaultIgnore;
6483def err_arc_collection_forward : Error<
6484  "collection expression type %0 is a forward declaration">;
6485def err_arc_multiple_method_decl : Error<
6486  "multiple methods named %0 found with mismatched result, "
6487  "parameter type or attributes">;
6488def warn_arc_lifetime_result_type : Warning<
6489  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6490  "lifetime qualifier on return type is ignored">,
6491  InGroup<IgnoredQualifiers>;
6492
6493let CategoryName = "ARC Retain Cycle" in {
6494
6495def warn_arc_retain_cycle : Warning<
6496  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6497  InGroup<ARCRetainCycles>;
6498def note_arc_retain_cycle_owner : Note<
6499  "block will be retained by %select{the captured object|an object strongly "
6500  "retained by the captured object}0">;
6501
6502} // end "ARC Retain Cycle" category
6503
6504def warn_arc_object_memaccess : Warning<
6505  "%select{destination for|source of}0 this %1 call is a pointer to "
6506  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6507
6508let CategoryName = "ARC and @properties" in {
6509
6510def err_arc_strong_property_ownership : Error<
6511  "existing instance variable %1 for strong property %0 may not be "
6512  "%select{|__unsafe_unretained||__weak}2">;
6513def err_arc_assign_property_ownership : Error<
6514  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6515  "attribute must be __unsafe_unretained">;
6516def err_arc_inconsistent_property_ownership : Error<
6517  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6518  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6519
6520} // end "ARC and @properties" category
6521
6522def warn_block_capture_autoreleasing : Warning<
6523  "block captures an autoreleasing out-parameter, which may result in "
6524  "use-after-free bugs">,
6525  InGroup<BlockCaptureAutoReleasing>;
6526def note_declare_parameter_strong : Note<
6527  "declare the parameter __strong or capture a __block __strong variable to "
6528  "keep values alive across autorelease pools">;
6529
6530def err_arc_atomic_ownership : Error<
6531  "cannot perform atomic operation on a pointer to type %0: type has "
6532  "non-trivial ownership">;
6533
6534let CategoryName = "ARC Casting Rules" in {
6535
6536def err_arc_bridge_cast_incompatible : Error<
6537  "incompatible types casting %0 to %1 with a %select{__bridge|"
6538  "__bridge_transfer|__bridge_retained}2 cast">;
6539def err_arc_bridge_cast_wrong_kind : Error<
6540  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6541  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6542  "__bridge_transfer|__bridge_retained}4">;
6543def err_arc_cast_requires_bridge : Error<
6544  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6545  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6546  "requires a bridged cast">;
6547def note_arc_bridge : Note<
6548  "use __bridge to convert directly (no change in ownership)">;
6549def note_arc_cstyle_bridge : Note<
6550  "use __bridge with C-style cast to convert directly (no change in ownership)">;
6551def note_arc_bridge_transfer : Note<
6552  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6553  "ownership of a +1 %0 into ARC">;
6554def note_arc_cstyle_bridge_transfer : Note<
6555  "use __bridge_transfer with C-style cast to transfer "
6556  "ownership of a +1 %0 into ARC">;
6557def note_arc_bridge_retained : Note<
6558  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6559  "ARC object available as a +1 %0">;
6560def note_arc_cstyle_bridge_retained : Note<
6561  "use __bridge_retained with C-style cast to make an "
6562  "ARC object available as a +1 %0">;
6563
6564} // ARC Casting category
6565
6566} // ARC category name
6567
6568def err_flexible_array_init_needs_braces : Error<
6569  "flexible array requires brace-enclosed initializer">;
6570def err_illegal_decl_array_of_functions : Error<
6571  "'%0' declared as array of functions of type %1">;
6572def err_array_incomplete_or_sizeless_type : Error<
6573  "array has %select{incomplete|sizeless}0 element type %1">;
6574def err_illegal_message_expr_incomplete_type : Error<
6575  "Objective-C message has incomplete result type %0">;
6576def err_illegal_decl_array_of_references : Error<
6577  "'%0' declared as array of references of type %1">;
6578def err_decl_negative_array_size : Error<
6579  "'%0' declared as an array with a negative size">;
6580def err_array_static_outside_prototype : Error<
6581  "%0 used in array declarator outside of function prototype">;
6582def err_array_static_not_outermost : Error<
6583  "%0 used in non-outermost array type derivation">;
6584def err_array_star_outside_prototype : Error<
6585  "star modifier used outside of function prototype">;
6586def err_illegal_decl_pointer_to_reference : Error<
6587  "'%0' declared as a pointer to a reference of type %1">;
6588def err_illegal_decl_mempointer_to_reference : Error<
6589  "'%0' declared as a member pointer to a reference of type %1">;
6590def err_illegal_decl_mempointer_to_void : Error<
6591  "'%0' declared as a member pointer to void">;
6592def err_illegal_decl_mempointer_in_nonclass : Error<
6593  "'%0' does not point into a class">;
6594def err_mempointer_in_nonclass_type : Error<
6595  "member pointer refers into non-class type %0">;
6596def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6597def err_nonfunction_block_type : Error<
6598  "block pointer to non-function type is invalid">;
6599def err_return_block_has_expr : Error<"void block should not return a value">;
6600def err_block_return_missing_expr : Error<
6601  "non-void block should return a value">;
6602def err_func_def_incomplete_result : Error<
6603  "incomplete result type %0 in function definition">;
6604def err_atomic_specifier_bad_type
6605    : Error<"_Atomic cannot be applied to "
6606            "%select{incomplete |array |function |reference |atomic |qualified "
6607            "|sizeless ||integer }0type "
6608            "%1 %select{|||||||which is not trivially copyable|}0">;
6609def warn_atomic_member_access : Warning<
6610  "accessing a member of an atomic structure or union is undefined behavior">,
6611  InGroup<DiagGroup<"atomic-access">>, DefaultError;
6612
6613// Expressions.
6614def ext_sizeof_alignof_function_type : Extension<
6615  "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6616def ext_sizeof_alignof_void_type : Extension<
6617  "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6618def err_opencl_sizeof_alignof_type : Error<
6619  "invalid application of '%0' to a void type">;
6620def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6621  "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6622def err_sizeof_alignof_function_type : Error<
6623  "invalid application of '%0' to a function type">;
6624def err_openmp_default_simd_align_expr : Error<
6625  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6626def err_sizeof_alignof_typeof_bitfield : Error<
6627  "invalid application of '%select{sizeof|alignof|typeof|typeof_unqual}0' to "
6628  "bit-field">;
6629def err_alignof_member_of_incomplete_type : Error<
6630  "invalid application of 'alignof' to a field of a class still being defined">;
6631def err_vecstep_non_scalar_vector_type : Error<
6632  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6633def err_offsetof_incomplete_type : Error<
6634  "offsetof of incomplete type %0">;
6635def err_offsetof_record_type : Error<
6636  "offsetof requires struct, union, or class type, %0 invalid">;
6637def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6638def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6639  InGroup<InvalidOffsetof>;
6640def ext_offsetof_non_standardlayout_type : ExtWarn<
6641  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6642def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6643def err_offsetof_field_of_virtual_base : Error<
6644  "invalid application of 'offsetof' to a field of a virtual base">;
6645def warn_sub_ptr_zero_size_types : Warning<
6646  "subtraction of pointers to type %0 of zero size has undefined behavior">,
6647  InGroup<PointerArith>;
6648def warn_pointer_arith_null_ptr : Warning<
6649  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6650  InGroup<NullPointerArithmetic>, DefaultIgnore;
6651def warn_gnu_null_ptr_arith : Extension<
6652  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6653  InGroup<GNUNullPointerArithmetic>;
6654def warn_pointer_sub_null_ptr : Warning<
6655  "performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior">,
6656  InGroup<NullPointerSubtraction>, DefaultIgnore;
6657
6658def warn_floatingpoint_eq : Warning<
6659  "comparing floating point with == or != is unsafe">,
6660  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6661
6662def err_setting_eval_method_used_in_unsafe_context : Error <
6663  "%select{'#pragma clang fp eval_method'|option 'ffp-eval-method'}0 cannot be used with "
6664  "%select{option 'fapprox-func'|option 'mreassociate'|option 'freciprocal'|option 'ffp-eval-method'|'#pragma clang fp reassociate'}1">;
6665
6666def warn_remainder_division_by_zero : Warning<
6667  "%select{remainder|division}0 by zero is undefined">,
6668  InGroup<DivZero>;
6669def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6670  InGroup<DiagGroup<"shift-negative-value">>;
6671def warn_shift_negative : Warning<"shift count is negative">,
6672  InGroup<DiagGroup<"shift-count-negative">>;
6673def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6674  InGroup<DiagGroup<"shift-count-overflow">>;
6675def warn_shift_result_gt_typewidth : Warning<
6676  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6677  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6678def warn_shift_result_sets_sign_bit : Warning<
6679  "signed shift result (%0) sets the sign bit of the shift expression's "
6680  "type (%1) and becomes negative">,
6681  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6682
6683def warn_precedence_bitwise_rel : Warning<
6684  "%0 has lower precedence than %1; %1 will be evaluated first">,
6685  InGroup<Parentheses>;
6686def note_precedence_bitwise_first : Note<
6687  "place parentheses around the %0 expression to evaluate it first">;
6688def note_precedence_silence : Note<
6689  "place parentheses around the '%0' expression to silence this warning">;
6690
6691def warn_precedence_conditional : Warning<
6692  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6693  InGroup<Parentheses>;
6694def warn_precedence_bitwise_conditional : Warning<
6695  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6696  InGroup<BitwiseConditionalParentheses>;
6697def note_precedence_conditional_first : Note<
6698  "place parentheses around the '?:' expression to evaluate it first">;
6699
6700def warn_enum_constant_in_bool_context : Warning<
6701  "converting the enum constant to a boolean">,
6702  InGroup<IntInBoolContext>, DefaultIgnore;
6703def warn_left_shift_in_bool_context : Warning<
6704  "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6705  InGroup<IntInBoolContext>, DefaultIgnore;
6706def warn_logical_instead_of_bitwise : Warning<
6707  "use of logical '%0' with constant operand">,
6708  InGroup<DiagGroup<"constant-logical-operand">>;
6709def note_logical_instead_of_bitwise_change_operator : Note<
6710  "use '%0' for a bitwise operation">;
6711def note_logical_instead_of_bitwise_remove_constant : Note<
6712  "remove constant to silence this warning">;
6713
6714def warn_bitwise_op_in_bitwise_op : Warning<
6715  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6716
6717def warn_logical_and_in_logical_or : Warning<
6718  "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6719
6720def warn_overloaded_shift_in_comparison :Warning<
6721  "overloaded operator %select{>>|<<}0 has higher precedence than "
6722  "comparison operator">,
6723  InGroup<OverloadedShiftOpParentheses>;
6724def note_evaluate_comparison_first :Note<
6725  "place parentheses around comparison expression to evaluate it first">;
6726
6727def note_concatenated_string_literal_silence :Note<
6728  "place parentheses around the string literal to silence warning">;
6729
6730def warn_addition_in_bitshift : Warning<
6731  "operator '%0' has lower precedence than '%1'; "
6732  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6733
6734def warn_self_assignment_builtin : Warning<
6735  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6736  "you mean to assign to member %2?}1">,
6737  InGroup<SelfAssignment>, DefaultIgnore;
6738def warn_self_assignment_overloaded : Warning<
6739  "explicitly assigning value of variable of type %0 to itself%select{|; did "
6740  "you mean to assign to member %2?}1">,
6741  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6742def warn_self_move : Warning<
6743  "explicitly moving variable of type %0 to itself%select{|; did you mean to "
6744  "move to member %2?}1">,
6745  InGroup<SelfMove>, DefaultIgnore;
6746
6747def err_builtin_move_forward_unsupported : Error<
6748  "unsupported signature for %q0">;
6749def err_use_of_unaddressable_function : Error<
6750  "taking address of non-addressable standard library function">;
6751// FIXME: This should also be in -Wc++23-compat once we have it.
6752def warn_cxx20_compat_use_of_unaddressable_function : Warning<
6753  "taking address of non-addressable standard library function "
6754  "is incompatible with C++20">, InGroup<CXX20Compat>;
6755
6756def warn_redundant_move_on_return : Warning<
6757  "redundant move in return statement">,
6758  InGroup<RedundantMove>, DefaultIgnore;
6759def warn_pessimizing_move_on_return : Warning<
6760  "moving a local object in a return statement prevents copy elision">,
6761  InGroup<PessimizingMove>, DefaultIgnore;
6762def warn_pessimizing_move_on_initialization : Warning<
6763  "moving a temporary object prevents copy elision">,
6764  InGroup<PessimizingMove>, DefaultIgnore;
6765def note_remove_move : Note<"remove std::move call here">;
6766
6767def warn_string_plus_int : Warning<
6768  "adding %0 to a string does not append to the string">,
6769  InGroup<StringPlusInt>;
6770def warn_string_plus_char : Warning<
6771  "adding %0 to a string pointer does not append to the string">,
6772  InGroup<StringPlusChar>;
6773def note_string_plus_scalar_silence : Note<
6774  "use array indexing to silence this warning">;
6775
6776def warn_sizeof_array_param : Warning<
6777  "sizeof on array function parameter will return size of %0 instead of %1">,
6778  InGroup<SizeofArrayArgument>;
6779
6780def warn_sizeof_array_decay : Warning<
6781  "sizeof on pointer operation will return size of %0 instead of %1">,
6782  InGroup<SizeofArrayDecay>;
6783
6784def err_sizeof_nonfragile_interface : Error<
6785  "application of '%select{alignof|sizeof}1' to interface %0 is "
6786  "not supported on this architecture and platform">;
6787def err_atdef_nonfragile_interface : Error<
6788  "use of @defs is not supported on this architecture and platform">;
6789def err_subscript_nonfragile_interface : Error<
6790  "subscript requires size of interface %0, which is not constant for "
6791  "this architecture and platform">;
6792
6793def err_arithmetic_nonfragile_interface : Error<
6794  "arithmetic on pointer to interface %0, which is not a constant size for "
6795  "this architecture and platform">;
6796
6797def warn_deprecated_comma_subscript : Warning<
6798  "top-level comma expression in array subscript is deprecated "
6799  "in C++20 and unsupported in C++23">,
6800  InGroup<DeprecatedCommaSubscript>;
6801
6802def ext_subscript_non_lvalue : Extension<
6803  "ISO C90 does not allow subscripting non-lvalue array">;
6804def err_typecheck_subscript_value : Error<
6805  "subscripted value is not an array, pointer, or vector">;
6806def err_typecheck_subscript_not_integer : Error<
6807  "array subscript is not an integer">;
6808def err_subscript_function_type : Error<
6809  "subscript of pointer to function type %0">;
6810def err_subscript_incomplete_or_sizeless_type : Error<
6811  "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6812def err_subscript_svbool_t : Error<
6813  "subscript of svbool_t is not allowed">;
6814def err_dereference_incomplete_type : Error<
6815  "dereference of pointer to incomplete type %0">;
6816def ext_gnu_subscript_void_type : Extension<
6817  "subscript of a pointer to void is a GNU extension">,
6818  InGroup<GNUPointerArith>;
6819def err_typecheck_member_reference_struct_union : Error<
6820  "member reference base type %0 is not a structure or union">;
6821def err_typecheck_member_reference_ivar : Error<
6822  "%0 does not have a member named %1">;
6823def err_arc_weak_ivar_access : Error<
6824  "dereferencing a __weak pointer is not allowed due to possible "
6825  "null value caused by race condition, assign it to strong variable first">;
6826def err_typecheck_member_reference_arrow : Error<
6827  "member reference type %0 is not a pointer">;
6828def err_typecheck_member_reference_suggestion : Error<
6829  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6830def note_typecheck_member_reference_suggestion : Note<
6831  "did you mean to use '.' instead?">;
6832def note_member_reference_arrow_from_operator_arrow : Note<
6833  "'->' applied to return value of the operator->() declared here">;
6834def err_typecheck_member_reference_type : Error<
6835  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6836def err_typecheck_member_reference_unknown : Error<
6837  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6838def err_member_reference_needs_call : Error<
6839  "base of member reference is a function; perhaps you meant to call "
6840  "it%select{| with no arguments}0?">;
6841def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6842  InGroup<CharSubscript>, DefaultIgnore;
6843
6844def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6845def err_no_member : Error<"no member named %0 in %1">;
6846def err_no_member_overloaded_arrow : Error<
6847  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6848
6849def err_member_not_yet_instantiated : Error<
6850  "no member %0 in %1; it has not yet been instantiated">;
6851def note_non_instantiated_member_here : Note<
6852  "not-yet-instantiated member is declared here">;
6853
6854def err_enumerator_does_not_exist : Error<
6855  "enumerator %0 does not exist in instantiation of %1">;
6856def note_enum_specialized_here : Note<
6857  "enum %0 was explicitly specialized here">;
6858
6859def err_specialization_not_primary_template : Error<
6860  "cannot reference member of primary template because deduced class "
6861  "template specialization %0 is %select{instantiated from a partial|"
6862  "an explicit}1 specialization">;
6863
6864def err_member_redeclared : Error<"class member cannot be redeclared">;
6865def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6866  InGroup<RedeclaredClassMember>;
6867def err_member_redeclared_in_instantiation : Error<
6868  "multiple overloads of %0 instantiate to the same signature %1">;
6869def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6870def err_member_def_undefined_record : Error<
6871  "out-of-line definition of %0 from class %1 without definition">;
6872def err_member_decl_does_not_match : Error<
6873  "out-of-line %select{declaration|definition}2 of %0 "
6874  "does not match any declaration in %1">;
6875def err_friend_decl_with_def_arg_must_be_def : Error<
6876  "friend declaration specifying a default argument must be a definition">;
6877def err_friend_decl_with_def_arg_redeclared : Error<
6878  "friend declaration specifying a default argument must be the only declaration">;
6879def err_friend_decl_does_not_match : Error<
6880  "friend declaration of %0 does not match any declaration in %1">;
6881def err_member_decl_does_not_match_suggest : Error<
6882  "out-of-line %select{declaration|definition}2 of %0 "
6883  "does not match any declaration in %1; did you mean %3?">;
6884def err_member_def_does_not_match_ret_type : Error<
6885  "return type of out-of-line definition of %q0 differs from "
6886  "that in the declaration">;
6887def err_nonstatic_member_out_of_line : Error<
6888  "non-static data member defined out-of-line">;
6889def err_qualified_typedef_declarator : Error<
6890  "typedef declarator cannot be qualified">;
6891def err_qualified_param_declarator : Error<
6892  "parameter declarator cannot be qualified">;
6893def ext_out_of_line_declaration : ExtWarn<
6894  "out-of-line declaration of a member must be a definition">,
6895  InGroup<OutOfLineDeclaration>, DefaultError;
6896def err_member_extra_qualification : Error<
6897  "extra qualification on member %0">;
6898def warn_member_extra_qualification : Warning<
6899  err_member_extra_qualification.Summary>, InGroup<MicrosoftExtraQualification>;
6900def warn_namespace_member_extra_qualification : Warning<
6901  "extra qualification on member %0">,
6902  InGroup<DiagGroup<"extra-qualification">>;
6903def err_member_qualification : Error<
6904  "non-friend class member %0 cannot have a qualified name">;
6905def note_member_def_close_match : Note<"member declaration nearly matches">;
6906def note_member_def_close_const_match : Note<
6907  "member declaration does not match because "
6908  "it %select{is|is not}0 const qualified">;
6909def note_member_def_close_param_match : Note<
6910  "type of %ordinal0 parameter of member declaration does not match definition"
6911  "%diff{ ($ vs $)|}1,2">;
6912def note_local_decl_close_match : Note<"local declaration nearly matches">;
6913def note_local_decl_close_param_match : Note<
6914  "type of %ordinal0 parameter of local declaration does not match definition"
6915  "%diff{ ($ vs $)|}1,2">;
6916def err_typecheck_ivar_variable_size : Error<
6917  "instance variables must have a constant size">;
6918def err_ivar_reference_type : Error<
6919  "instance variables cannot be of reference type">;
6920def err_typecheck_illegal_increment_decrement : Error<
6921  "cannot %select{decrement|increment}1 value of type %0">;
6922def err_typecheck_expect_int : Error<
6923  "used type %0 where integer is required">;
6924def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
6925  "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
6926def err_typecheck_pointer_arith_function_type : Error<
6927  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
6928  "function type%select{|s}2 %1%select{| and %3}2">;
6929def err_typecheck_pointer_arith_void_type : Error<
6930  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
6931def err_typecheck_decl_incomplete_type : Error<
6932  "variable has incomplete type %0">;
6933def ext_typecheck_decl_incomplete_type : ExtWarn<
6934  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
6935  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
6936def err_tentative_def_incomplete_type : Error<
6937  "tentative definition has type %0 that is never completed">;
6938def warn_tentative_incomplete_array : Warning<
6939  "tentative array definition assumed to have one element">;
6940def err_typecheck_incomplete_array_needs_initializer : Error<
6941  "definition of variable with array type needs an explicit size "
6942  "or an initializer">;
6943def err_array_init_not_init_list : Error<
6944  "array initializer must be an initializer "
6945  "list%select{| or string literal| or wide string literal}0">;
6946def err_array_init_narrow_string_into_wchar : Error<
6947  "initializing wide char array with non-wide string literal">;
6948def err_array_init_wide_string_into_char : Error<
6949  "initializing char array with wide string literal">;
6950def err_array_init_incompat_wide_string_into_wchar : Error<
6951  "initializing wide char array with incompatible wide string literal">;
6952def err_array_init_plain_string_into_char8_t : Error<
6953  "initializing 'char8_t' array with plain string literal">;
6954def note_array_init_plain_string_into_char8_t : Note<
6955  "add 'u8' prefix to form a 'char8_t' string literal">;
6956def err_array_init_utf8_string_into_char : Error<
6957  "initialization of %select{|signed }0char array with "
6958  "UTF-8 string literal is not permitted by %select{'-fchar8_t'|C++20}1">;
6959def warn_cxx20_compat_utf8_string : Warning<
6960  "type of UTF-8 string literal will change from array of const char to "
6961  "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
6962def note_cxx20_compat_utf8_string_remove_u8 : Note<
6963  "remove 'u8' prefix to avoid a change of behavior; "
6964  "Clang encodes unprefixed narrow string literals as UTF-8">;
6965def err_array_init_different_type : Error<
6966  "cannot initialize array %diff{of type $ with array of type $|"
6967  "with different type of array}0,1">;
6968def err_array_init_non_constant_array : Error<
6969  "cannot initialize array %diff{of type $ with non-constant array of type $|"
6970  "with different type of array}0,1">;
6971def ext_array_init_copy : Extension<
6972  "initialization of an array "
6973  "%diff{of type $ from a compound literal of type $|"
6974  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
6975// This is intentionally not disabled by -Wno-gnu.
6976def ext_array_init_parens : ExtWarn<
6977  "parenthesized initialization of a member array is a GNU extension">,
6978  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
6979def warn_deprecated_string_literal_conversion : Warning<
6980  "conversion from string literal to %0 is deprecated">,
6981  InGroup<CXX11CompatDeprecatedWritableStr>;
6982def ext_deprecated_string_literal_conversion : ExtWarn<
6983  "ISO C++11 does not allow conversion from string literal to %0">,
6984  InGroup<WritableStrings>, SFINAEFailure;
6985def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
6986def err_typecheck_sclass_fscope : Error<
6987  "illegal storage class on file-scoped variable">;
6988def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
6989  InGroup<MissingDeclarations>;
6990def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
6991  "of a type">, InGroup<MissingDeclarations>;
6992def err_standalone_class_nested_name_specifier : Error<
6993  "forward declaration of %select{class|struct|interface|union|enum|enum class|enum struct}0 cannot "
6994  "have a nested name specifier">;
6995def err_typecheck_sclass_func : Error<"illegal storage class on function">;
6996def err_static_block_func : Error<
6997  "function declared in block scope cannot have 'static' storage class">;
6998def err_typecheck_address_of : Error<"address of %select{bit-field"
6999  "|vector element|property expression|register variable|matrix element}0 requested">;
7000def ext_typecheck_addrof_void : Extension<
7001  "ISO C forbids taking the address of an expression of type 'void'">;
7002def err_unqualified_pointer_member_function : Error<
7003  "must explicitly qualify name of member function when taking its address">;
7004def err_invalid_form_pointer_member_function : Error<
7005  "cannot create a non-constant pointer to member function">;
7006def err_address_of_function_with_pass_object_size_params: Error<
7007  "cannot take address of function %0 because parameter %1 has "
7008  "pass_object_size attribute">;
7009def err_parens_pointer_member_function : Error<
7010  "cannot parenthesize the name of a method when forming a member pointer">;
7011def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
7012  "extra '&' taking address of overloaded function">;
7013def err_typecheck_invalid_lvalue_addrof : Error<
7014  "cannot take the address of an rvalue of type %0">;
7015def ext_typecheck_addrof_temporary : ExtWarn<
7016  "taking the address of a temporary object of type %0">,
7017  InGroup<AddressOfTemporary>, DefaultError;
7018def err_typecheck_addrof_temporary : Error<
7019  "taking the address of a temporary object of type %0">;
7020def err_typecheck_addrof_dtor : Error<
7021  "taking the address of a destructor">;
7022def err_typecheck_unary_expr : Error<
7023  "invalid argument type %0 to unary expression">;
7024def err_typecheck_indirection_requires_pointer : Error<
7025  "indirection requires pointer operand (%0 invalid)">;
7026def ext_typecheck_indirection_through_void_pointer : ExtWarn<
7027  "ISO C does not allow indirection on operand of type %0">,
7028  InGroup<VoidPointerDeref>;
7029def err_typecheck_indirection_through_void_pointer_cpp
7030    : Error<"indirection not permitted on operand of type %0">;
7031def warn_indirection_through_null : Warning<
7032  "indirection of non-volatile null pointer will be deleted, not trap">,
7033  InGroup<NullDereference>;
7034def warn_binding_null_to_reference : Warning<
7035  "binding dereferenced null pointer to reference has undefined behavior">,
7036  InGroup<NullDereference>;
7037def note_indirection_through_null : Note<
7038  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
7039def warn_pointer_indirection_from_incompatible_type : Warning<
7040  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
7041  "behavior">,
7042  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7043def warn_taking_address_of_packed_member : Warning<
7044  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
7045  InGroup<DiagGroup<"address-of-packed-member">>;
7046def warn_param_mismatched_alignment : Warning<
7047  "passing %0-byte aligned argument to %1-byte aligned parameter %2%select{| of %4}3 may result in an unaligned pointer access">,
7048  InGroup<DiagGroup<"align-mismatch">>;
7049
7050def err_objc_object_assignment : Error<
7051  "cannot assign to class object (%0 invalid)">;
7052def err_typecheck_invalid_operands : Error<
7053  "invalid operands to binary expression (%0 and %1)">, Deferrable;
7054def note_typecheck_invalid_operands_converted : Note<
7055  "%select{first|second}0 operand was implicitly converted to type %1">;
7056def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
7057  "logical expression with vector %select{type %1 and non-vector type %2|types"
7058  " %1 and %2}0 is only supported in C++">;
7059def err_typecheck_sub_ptr_compatible : Error<
7060  "%diff{$ and $ are not pointers to compatible types|"
7061  "pointers to incompatible types}0,1">;
7062def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
7063  "ordered comparison between pointer and integer (%0 and %1)">;
7064def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
7065  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
7066def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
7067  "ordered comparison between pointer and zero (%0 and %1)">;
7068def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
7069  "three-way comparison between pointer and zero">;
7070def ext_typecheck_compare_complete_incomplete_pointers : Extension<
7071  "pointer comparisons before C11 "
7072  "need to be between two complete or two incomplete types; "
7073  "%0 is %select{|in}2complete and "
7074  "%1 is %select{|in}3complete">,
7075  InGroup<C11>;
7076def warn_typecheck_ordered_comparison_of_function_pointers : Warning<
7077  "ordered comparison of function pointers (%0 and %1)">,
7078  InGroup<OrderedCompareFunctionPointers>;
7079def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
7080  "ordered comparison of function pointers (%0 and %1)">,
7081  InGroup<OrderedCompareFunctionPointers>;
7082def err_typecheck_ordered_comparison_of_function_pointers : Error<
7083  "ordered comparison of function pointers (%0 and %1)">;
7084def ext_typecheck_comparison_of_fptr_to_void : Extension<
7085  "equality comparison between function pointer and void pointer (%0 and %1)">;
7086def err_typecheck_comparison_of_fptr_to_void : Error<
7087  "equality comparison between function pointer and void pointer (%0 and %1)">;
7088def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
7089  "comparison between pointer and integer (%0 and %1)">,
7090  InGroup<DiagGroup<"pointer-integer-compare">>;
7091def err_typecheck_comparison_of_pointer_integer : Error<
7092  "comparison between pointer and integer (%0 and %1)">;
7093def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
7094  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
7095  InGroup<CompareDistinctPointerType>;
7096def ext_typecheck_cond_incompatible_operands : ExtWarn<
7097  "incompatible operand types (%0 and %1)">;
7098def err_cond_voidptr_arc : Error <
7099  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
7100  "in ARC mode">;
7101def err_typecheck_comparison_of_distinct_pointers : Error<
7102  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
7103def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
7104  "%select{comparison between %diff{ ($ and $)|}0,1"
7105  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
7106  "|conditional operator with the second and third operands of type "
7107  "%diff{ ($ and $)|}0,1}2"
7108  " which are pointers to non-overlapping address spaces">;
7109
7110def select_arith_conv_kind : TextSubstitution<
7111  "%select{arithmetic between|bitwise operation between|comparison of|"
7112  "conditional expression between|compound assignment of}0">;
7113def warn_arith_conv_enum_float : Warning<
7114  "%sub{select_arith_conv_kind}0 "
7115  "%select{floating-point|enumeration}1 type %2 "
7116  "%plural{2:with|4:from|:and}0 "
7117  "%select{enumeration|floating-point}1 type %3">,
7118  InGroup<EnumFloatConversion>, DefaultIgnore;
7119def warn_arith_conv_enum_float_cxx20 : Warning<
7120  "%sub{select_arith_conv_kind}0 "
7121  "%select{floating-point|enumeration}1 type %2 "
7122  "%plural{2:with|4:from|:and}0 "
7123  "%select{enumeration|floating-point}1 type %3 is deprecated">,
7124  InGroup<DeprecatedEnumFloatConversion>;
7125def warn_arith_conv_mixed_enum_types : Warning<
7126  "%sub{select_arith_conv_kind}0 "
7127  "different enumeration types%diff{ ($ and $)|}1,2">,
7128  InGroup<EnumEnumConversion>, DefaultIgnore;
7129def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
7130  "%sub{select_arith_conv_kind}0 "
7131  "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
7132  InGroup<DeprecatedEnumEnumConversion>;
7133def warn_arith_conv_mixed_anon_enum_types : Warning<
7134  warn_arith_conv_mixed_enum_types.Summary>,
7135  InGroup<AnonEnumEnumConversion>, DefaultIgnore;
7136def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
7137  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7138  InGroup<DeprecatedAnonEnumEnumConversion>;
7139def warn_conditional_mixed_enum_types : Warning<
7140  warn_arith_conv_mixed_enum_types.Summary>,
7141  InGroup<EnumCompareConditional>, DefaultIgnore;
7142def warn_conditional_mixed_enum_types_cxx20 : Warning<
7143  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7144  InGroup<DeprecatedEnumCompareConditional>;
7145def warn_comparison_mixed_enum_types : Warning<
7146  warn_arith_conv_mixed_enum_types.Summary>,
7147  InGroup<EnumCompare>;
7148def warn_comparison_mixed_enum_types_cxx20 : Warning<
7149  warn_arith_conv_mixed_enum_types_cxx20.Summary>,
7150  InGroup<DeprecatedEnumCompare>;
7151def warn_comparison_of_mixed_enum_types_switch : Warning<
7152  "comparison of different enumeration types in switch statement"
7153  "%diff{ ($ and $)|}0,1">,
7154  InGroup<EnumCompareSwitch>;
7155
7156def err_typecheck_assign_const : Error<
7157  "%select{"
7158  "cannot assign to return value because function %1 returns a const value|"
7159  "cannot assign to variable %1 with const-qualified type %2|"
7160  "cannot assign to %select{non-|}1static data member %2 "
7161  "with const-qualified type %3|"
7162  "cannot assign to non-static data member within const member function %1|"
7163  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
7164  "with %select{|nested }3const-qualified data member %4|"
7165  "read-only variable is not assignable}0">;
7166
7167def note_typecheck_assign_const : Note<
7168  "%select{"
7169  "function %1 which returns const-qualified type %2 declared here|"
7170  "variable %1 declared const here|"
7171  "%select{non-|}1static data member %2 declared const here|"
7172  "member function %q1 is declared const here|"
7173  "%select{|nested }1data member %2 declared const here}0">;
7174
7175def warn_unsigned_always_true_comparison : Warning<
7176  "result of comparison of %select{%3|unsigned expression}0 %2 "
7177  "%select{unsigned expression|%3}0 is always %4">,
7178  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
7179def warn_unsigned_char_always_true_comparison : Warning<
7180  "result of comparison of %select{%3|char expression}0 %2 "
7181  "%select{char expression|%3}0 is always %4, since char is interpreted as "
7182  "unsigned">, InGroup<TautologicalUnsignedCharZeroCompare>, DefaultIgnore;
7183def warn_unsigned_enum_always_true_comparison : Warning<
7184  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
7185  "%select{unsigned enum expression|%3}0 is always %4">,
7186  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
7187def warn_tautological_constant_compare : Warning<
7188  "result of comparison %select{%3|%1}0 %2 "
7189  "%select{%1|%3}0 is always %4">,
7190  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
7191def warn_tautological_compare_objc_bool : Warning<
7192  "result of comparison of constant %0 with expression of type 'BOOL'"
7193  " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
7194  InGroup<TautologicalObjCBoolCompare>;
7195def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
7196def warn_tautological_compare_value_range : Warning<
7197  "result of comparison of "
7198  "%select{%4|%sub{subst_int_range}1,2}0 %3 "
7199  "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
7200  InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
7201
7202def warn_mixed_sign_comparison : Warning<
7203  "comparison of integers of different signs: %0 and %1">,
7204  InGroup<SignCompare>, DefaultIgnore;
7205def warn_out_of_range_compare : Warning<
7206  "result of comparison of %select{constant %0|true|false}1 with "
7207  "%select{expression of type %2|boolean expression}3 is always %4">,
7208  InGroup<TautologicalOutOfRangeCompare>;
7209def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Summary>,
7210  InGroup<TautologicalConstantCompare>;
7211def warn_integer_constants_in_conditional_always_true : Warning<
7212  "converting the result of '?:' with integer constants to a boolean always "
7213  "evaluates to 'true'">,
7214  InGroup<TautologicalConstantCompare>;
7215def warn_left_shift_always : Warning<
7216  "converting the result of '<<' to a boolean always evaluates "
7217  "to %select{false|true}0">,
7218  InGroup<TautologicalConstantCompare>;
7219def warn_null_in_arithmetic_operation : Warning<
7220  "use of NULL in arithmetic operation">,
7221  InGroup<NullArithmetic>;
7222def warn_null_in_comparison_operation : Warning<
7223  "comparison between NULL and non-pointer "
7224  "%select{(%1 and NULL)|(NULL and %1)}0">,
7225  InGroup<NullArithmetic>;
7226def err_shift_rhs_only_vector : Error<
7227  "requested shift is a vector of type %0 but the first operand is not a "
7228  "vector (%1)">;
7229
7230def warn_logical_not_on_lhs_of_check : Warning<
7231  "logical not is only applied to the left hand side of this "
7232  "%select{comparison|bitwise operator}0">,
7233  InGroup<LogicalNotParentheses>;
7234def note_logical_not_fix : Note<
7235  "add parentheses after the '!' to evaluate the "
7236  "%select{comparison|bitwise operator}0 first">;
7237def note_logical_not_silence_with_parens : Note<
7238  "add parentheses around left hand side expression to silence this warning">;
7239
7240def err_invalid_this_use : Error<
7241  "invalid use of 'this' outside of a non-static member function">;
7242def err_this_static_member_func : Error<
7243  "'this' cannot be%select{| implicitly}0 used in a static member function "
7244  "declaration">;
7245def err_invalid_member_use_in_static_method : Error<
7246  "invalid use of member %0 in static member function">;
7247def err_invalid_qualified_function_type : Error<
7248  "%select{non-member function|static member function|deduction guide}0 "
7249  "%select{of type %2 |}1cannot have '%3' qualifier">;
7250def err_compound_qualified_function_type : Error<
7251  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
7252  "cannot have '%3' qualifier">;
7253def err_qualified_function_typeid : Error<
7254  "type operand %0 of 'typeid' cannot have '%1' qualifier">;
7255
7256def err_ref_qualifier_overload : Error<
7257  "cannot overload a member function %select{without a ref-qualifier|with "
7258  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
7259  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
7260
7261def err_invalid_non_static_member_use : Error<
7262  "invalid use of non-static data member %0">;
7263def err_nested_non_static_member_use : Error<
7264  "%select{call to non-static member function|use of non-static data member}0 "
7265  "%2 of %1 from nested type %3">;
7266def warn_cxx98_compat_non_static_member_use : Warning<
7267  "use of non-static data member %0 in an unevaluated context is "
7268  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
7269def err_invalid_incomplete_type_use : Error<
7270  "invalid use of incomplete type %0">;
7271def err_builtin_func_cast_more_than_one_arg : Error<
7272  "function-style cast to a builtin type can only take one argument">;
7273def err_value_init_for_array_type : Error<
7274  "array types cannot be value-initialized">;
7275def err_init_for_function_type : Error<
7276  "cannot create object of function type %0">;
7277def warn_format_nonliteral_noargs : Warning<
7278  "format string is not a string literal (potentially insecure)">,
7279  InGroup<FormatSecurity>;
7280def warn_format_nonliteral : Warning<
7281  "format string is not a string literal">,
7282  InGroup<FormatNonLiteral>, DefaultIgnore;
7283
7284def err_unexpected_interface : Error<
7285  "unexpected interface name %0: expected expression">;
7286def err_ref_non_value : Error<"%0 does not refer to a value">;
7287def err_ref_vm_type : Error<
7288  "cannot refer to declaration with a variably modified type inside block">;
7289def err_ref_flexarray_type : Error<
7290  "cannot refer to declaration of structure variable with flexible array member "
7291  "inside block">;
7292def err_ref_array_type : Error<
7293  "cannot refer to declaration with an array type inside block">;
7294def err_property_not_found : Error<
7295  "property %0 not found on object of type %1">;
7296def err_invalid_property_name : Error<
7297  "%0 is not a valid property name (accessing an object of type %1)">;
7298def err_getter_not_found : Error<
7299  "no getter method for read from property">;
7300def err_objc_subscript_method_not_found : Error<
7301  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
7302  "found on object of type %0">;
7303def err_objc_subscript_index_type : Error<
7304  "method index parameter type %0 is not integral type">;
7305def err_objc_subscript_key_type : Error<
7306  "method key parameter type %0 is not object type">;
7307def err_objc_subscript_dic_object_type : Error<
7308  "method object parameter type %0 is not object type">;
7309def err_objc_subscript_object_type : Error<
7310  "cannot assign to this %select{dictionary|array}1 because assigning method's "
7311  "2nd parameter of type %0 is not an Objective-C pointer type">;
7312def err_objc_subscript_base_type : Error<
7313  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
7314def err_objc_multiple_subscript_type_conversion : Error<
7315  "indexing expression is invalid because subscript type %0 has "
7316  "multiple type conversion functions">;
7317def err_objc_subscript_type_conversion : Error<
7318  "indexing expression is invalid because subscript type %0 is not an integral"
7319  " or Objective-C pointer type">;
7320def err_objc_subscript_pointer : Error<
7321  "indexing expression is invalid because subscript type %0 is not an"
7322  " Objective-C pointer">;
7323def err_objc_indexing_method_result_type : Error<
7324  "method for accessing %select{dictionary|array}1 element must have Objective-C"
7325  " object return type instead of %0">;
7326def err_objc_index_incomplete_class_type : Error<
7327  "Objective-C index expression has incomplete class type %0">;
7328def err_illegal_container_subscripting_op : Error<
7329  "illegal operation on Objective-C container subscripting">;
7330def err_property_not_found_forward_class : Error<
7331  "property %0 cannot be found in forward class object %1">;
7332def err_property_not_as_forward_class : Error<
7333  "property %0 refers to an incomplete Objective-C class %1 "
7334  "(with no @interface available)">;
7335def note_forward_class : Note<
7336  "forward declaration of class here">;
7337def err_duplicate_property : Error<
7338  "property has a previous declaration">;
7339def ext_gnu_void_ptr : Extension<
7340  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
7341  InGroup<GNUPointerArith>;
7342def ext_gnu_ptr_func_arith : Extension<
7343  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
7344  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
7345  InGroup<GNUPointerArith>;
7346def err_readonly_message_assignment : Error<
7347  "assigning to 'readonly' return result of an Objective-C message not allowed">;
7348def ext_integer_increment_complex : Extension<
7349  "ISO C does not support '++'/'--' on complex integer type %0">;
7350def ext_integer_complement_complex : Extension<
7351  "ISO C does not support '~' for complex conjugation of %0">;
7352def err_nosetter_property_assignment : Error<
7353  "%select{assignment to readonly property|"
7354  "no setter method %1 for assignment to property}0">;
7355def err_nosetter_property_incdec : Error<
7356  "%select{%select{increment|decrement}1 of readonly property|"
7357  "no setter method %2 for %select{increment|decrement}1 of property}0">;
7358def err_nogetter_property_compound_assignment : Error<
7359  "a getter method is needed to perform a compound assignment on a property">;
7360def err_nogetter_property_incdec : Error<
7361  "no getter method %1 for %select{increment|decrement}0 of property">;
7362def err_no_subobject_property_setting : Error<
7363  "expression is not assignable">;
7364def err_qualified_objc_access : Error<
7365  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
7366
7367def ext_freestanding_complex : Extension<
7368  "complex numbers are an extension in a freestanding C99 implementation">;
7369
7370// FIXME: Remove when we support imaginary.
7371def err_imaginary_not_supported : Error<"imaginary types are not supported">;
7372
7373// Obj-c expressions
7374def warn_root_inst_method_not_found : Warning<
7375  "instance method %0 is being used on 'Class' which is not in the root class">,
7376  InGroup<MethodAccess>;
7377def warn_class_method_not_found : Warning<
7378  "class method %objcclass0 not found (return type defaults to 'id')">,
7379  InGroup<MethodAccess>;
7380def warn_instance_method_on_class_found : Warning<
7381  "instance method %0 found instead of class method %1">,
7382  InGroup<MethodAccess>;
7383def warn_inst_method_not_found : Warning<
7384  "instance method %objcinstance0 not found (return type defaults to 'id')">,
7385  InGroup<MethodAccess>;
7386def warn_instance_method_not_found_with_typo : Warning<
7387  "instance method %objcinstance0 not found (return type defaults to 'id')"
7388  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
7389def warn_class_method_not_found_with_typo : Warning<
7390  "class method %objcclass0 not found (return type defaults to 'id')"
7391  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
7392def err_method_not_found_with_typo : Error<
7393  "%select{instance|class}1 method %0 not found "
7394  "; did you mean %2?">;
7395def err_no_super_class_message : Error<
7396  "no @interface declaration found in class messaging of %0">;
7397def err_root_class_cannot_use_super : Error<
7398  "%0 cannot use 'super' because it is a root class">;
7399def err_invalid_receiver_to_message_super : Error<
7400  "'super' is only valid in a method body">;
7401def err_invalid_receiver_class_message : Error<
7402  "receiver type %0 is not an Objective-C class">;
7403def err_missing_open_square_message_send : Error<
7404  "missing '[' at start of message send expression">;
7405def warn_bad_receiver_type : Warning<
7406  "receiver type %0 is not 'id' or interface pointer, consider "
7407  "casting it to 'id'">,InGroup<ObjCReceiver>;
7408def err_bad_receiver_type : Error<"bad receiver type %0">;
7409def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
7410def err_unknown_receiver_suggest : Error<
7411  "unknown receiver %0; did you mean %1?">;
7412def err_objc_throw_expects_object : Error<
7413  "@throw requires an Objective-C object type (%0 invalid)">;
7414def err_objc_synchronized_expects_object : Error<
7415  "@synchronized requires an Objective-C object type (%0 invalid)">;
7416def err_rethrow_used_outside_catch : Error<
7417  "@throw (rethrow) used outside of a @catch block">;
7418def err_attribute_multiple_objc_gc : Error<
7419  "multiple garbage collection attributes specified for type">;
7420def err_catch_param_not_objc_type : Error<
7421  "@catch parameter is not a pointer to an interface type">;
7422def err_illegal_qualifiers_on_catch_parm : Error<
7423  "illegal qualifiers on @catch parameter">;
7424def err_storage_spec_on_catch_parm : Error<
7425  "@catch parameter cannot have storage specifier '%0'">;
7426def warn_register_objc_catch_parm : Warning<
7427  "'register' storage specifier on @catch parameter will be ignored">;
7428def err_qualified_objc_catch_parm : Error<
7429  "@catch parameter declarator cannot be qualified">;
7430def warn_objc_pointer_cxx_catch_fragile : Warning<
7431  "cannot catch an exception thrown with @throw in C++ in the non-unified "
7432  "exception model">, InGroup<ObjCNonUnifiedException>;
7433def err_objc_object_catch : Error<
7434  "cannot catch an Objective-C object by value">;
7435def err_incomplete_type_objc_at_encode : Error<
7436  "'@encode' of incomplete type %0">;
7437def warn_objc_circular_container : Warning<
7438  "adding %0 to %1 might cause circular dependency in container">,
7439  InGroup<DiagGroup<"objc-circular-container">>;
7440def note_objc_circular_container_declared_here : Note<"%0 declared here">;
7441def warn_objc_unsafe_perform_selector : Warning<
7442  "%0 is incompatible with selectors that return a "
7443  "%select{struct|union|vector}1 type">,
7444  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
7445def note_objc_unsafe_perform_selector_method_declared_here :  Note<
7446  "method %0 that returns %1 declared here">;
7447def err_attribute_arm_builtin_alias : Error<
7448  "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
7449def err_attribute_arm_mve_polymorphism : Error<
7450  "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
7451def err_attribute_webassembly_funcref : Error<
7452  "'__funcref' attribute can only be applied to a function pointer type">;
7453
7454def warn_setter_getter_impl_required : Warning<
7455  "property %0 requires method %1 to be defined - "
7456  "use @synthesize, @dynamic or provide a method implementation "
7457  "in this class implementation">,
7458  InGroup<ObjCPropertyImpl>;
7459def warn_setter_getter_impl_required_in_category : Warning<
7460  "property %0 requires method %1 to be defined - "
7461  "use @dynamic or provide a method implementation in this category">,
7462  InGroup<ObjCPropertyImpl>;
7463def note_parameter_named_here : Note<
7464  "passing argument to parameter %0 here">;
7465def note_parameter_here : Note<
7466  "passing argument to parameter here">;
7467def note_method_return_type_change : Note<
7468  "compiler has implicitly changed method %0 return type">;
7469
7470def warn_impl_required_for_class_property : Warning<
7471  "class property %0 requires method %1 to be defined - "
7472  "use @dynamic or provide a method implementation "
7473  "in this class implementation">,
7474  InGroup<ObjCPropertyImpl>;
7475def warn_impl_required_in_category_for_class_property : Warning<
7476  "class property %0 requires method %1 to be defined - "
7477  "use @dynamic or provide a method implementation in this category">,
7478  InGroup<ObjCPropertyImpl>;
7479
7480// C++ casts
7481// These messages adhere to the TryCast pattern: %0 is an int specifying the
7482// cast type, %1 is the source type, %2 is the destination type.
7483def err_bad_reinterpret_cast_overload : Error<
7484  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
7485
7486def warn_reinterpret_different_from_static : Warning<
7487  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
7488  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
7489  "'static_cast'">, InGroup<ReinterpretBaseClass>;
7490def note_reinterpret_updowncast_use_static: Note<
7491  "use 'static_cast' to adjust the pointer correctly while "
7492  "%select{upcasting|downcasting}0">;
7493
7494def err_bad_static_cast_overload : Error<
7495  "address of overloaded function %0 cannot be static_cast to type %1">;
7496
7497def err_bad_cstyle_cast_overload : Error<
7498  "address of overloaded function %0 cannot be cast to type %1">;
7499
7500
7501def err_bad_cxx_cast_generic : Error<
7502  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7503  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7504def err_bad_cxx_cast_unrelated_class : Error<
7505  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7506  "functional-style cast|}0 from %1 to %2, which are not related by "
7507  "inheritance, is not allowed">;
7508def note_type_incomplete : Note<"%0 is incomplete">;
7509def err_bad_cxx_cast_rvalue : Error<
7510  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7511  "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7512def err_bad_cxx_cast_bitfield : Error<
7513  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7514  "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7515def err_bad_cxx_cast_qualifiers_away : Error<
7516  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7517  "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7518def err_bad_cxx_cast_addr_space_mismatch : Error<
7519  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7520  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7521  " spaces">;
7522def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7523  "ISO C++ does not allow "
7524  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7525  "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
7526  "even though the source and destination types are unrelated">,
7527  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
7528def err_bad_const_cast_dest : Error<
7529  "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
7530  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
7531def ext_cast_fn_obj : Extension<
7532  "cast between pointer-to-function and pointer-to-object is an extension">;
7533def ext_ms_cast_fn_obj : ExtWarn<
7534  "static_cast between pointer-to-function and pointer-to-object is a "
7535  "Microsoft extension">, InGroup<MicrosoftCast>;
7536def warn_cxx98_compat_cast_fn_obj : Warning<
7537  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
7538  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7539def err_bad_reinterpret_cast_small_int : Error<
7540  "cast from pointer to smaller type %2 loses information">;
7541def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
7542  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7543  "to scalar %2 of different size">;
7544def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
7545  "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
7546  "to vector %2 of different size">;
7547def err_bad_cxx_cast_vector_to_vector_different_size : Error<
7548  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7549  "to vector %2 of different size">;
7550def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
7551  "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
7552  "changes address space of nested pointers">,
7553  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7554def err_bad_lvalue_to_rvalue_cast : Error<
7555  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
7556  "not compatible">;
7557def err_bad_rvalue_to_rvalue_cast : Error<
7558  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
7559  "not compatible">;
7560def err_bad_static_cast_pointer_nonpointer : Error<
7561  "cannot cast from type %1 to pointer type %2">;
7562def err_bad_static_cast_member_pointer_nonmp : Error<
7563  "cannot cast from type %1 to member pointer type %2">;
7564def err_bad_cxx_cast_member_pointer_size : Error<
7565  "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
7566  "type %1 to member pointer type %2 of different size">;
7567def err_bad_reinterpret_cast_reference : Error<
7568  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
7569def warn_undefined_reinterpret_cast : Warning<
7570  "reinterpret_cast from %0 to %1 has undefined behavior">,
7571  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7572
7573// These messages don't adhere to the pattern.
7574// FIXME: Display the path somehow better.
7575def err_ambiguous_base_to_derived_cast : Error<
7576  "ambiguous cast from base %0 to derived %1:%2">;
7577def err_static_downcast_via_virtual : Error<
7578  "cannot cast %0 to %1 via virtual base %2">;
7579def err_downcast_from_inaccessible_base : Error<
7580  "cannot cast %select{private|protected}2 base class %1 to %0">;
7581def err_upcast_to_inaccessible_base : Error<
7582  "cannot cast %0 to its %select{private|protected}2 base class %1">;
7583def err_bad_dynamic_cast_not_ref_or_ptr : Error<
7584  "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
7585def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
7586def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
7587def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
7588def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
7589
7590// Other C++ expressions
7591def err_need_header_before_typeid : Error<
7592  "you need to include <typeinfo> before using the 'typeid' operator">;
7593def err_need_header_before_placement_new : Error<
7594  "no matching %0 function for non-allocating placement new expression; "
7595  "include <new>">;
7596def err_ms___leave_not_in___try : Error<
7597  "'__leave' statement not in __try block">;
7598def err_uuidof_without_guid : Error<
7599  "cannot call operator __uuidof on a type with no GUID">;
7600def err_uuidof_with_multiple_guids : Error<
7601  "cannot call operator __uuidof on a type with multiple GUIDs">;
7602def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
7603def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
7604def err_static_illegal_in_new : Error<
7605  "the 'static' modifier for the array size is not legal in new expressions">;
7606def err_array_new_needs_size : Error<
7607  "array size must be specified in new expression with no initializer">;
7608def err_bad_new_type : Error<
7609  "cannot allocate %select{function|reference}1 type %0 with new">;
7610def err_new_incomplete_or_sizeless_type : Error<
7611  "allocation of %select{incomplete|sizeless}0 type %1">;
7612def err_new_array_nonconst : Error<
7613  "only the first dimension of an allocated array may have dynamic size">;
7614def err_new_array_size_unknown_from_init : Error<
7615  "cannot determine allocated array size from initializer">;
7616def err_new_array_init_args : Error<
7617  "array 'new' cannot have initialization arguments">;
7618def ext_new_paren_array_nonconst : ExtWarn<
7619  "when type is in parentheses, array cannot have dynamic size">;
7620def err_placement_new_non_placement_delete : Error<
7621  "'new' expression with placement arguments refers to non-placement "
7622  "'operator delete'">;
7623def err_array_size_not_integral : Error<
7624  "array size expression must have integral or %select{|unscoped }0"
7625  "enumeration type, not %1">;
7626def err_array_size_incomplete_type : Error<
7627  "array size expression has incomplete class type %0">;
7628def err_array_size_explicit_conversion : Error<
7629  "array size expression of type %0 requires explicit conversion to type %1">;
7630def note_array_size_conversion : Note<
7631  "conversion to %select{integral|enumeration}0 type %1 declared here">;
7632def err_array_size_ambiguous_conversion : Error<
7633  "ambiguous conversion of array size expression of type %0 to an integral or "
7634  "enumeration type">;
7635def ext_array_size_conversion : Extension<
7636  "implicit conversion from array size expression of type %0 to "
7637  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7638  InGroup<CXX11>;
7639def warn_cxx98_compat_array_size_conversion : Warning<
7640  "implicit conversion from array size expression of type %0 to "
7641  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7642  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7643def err_address_space_qualified_new : Error<
7644  "'new' cannot allocate objects of type %0 in address space '%1'">;
7645def err_address_space_qualified_delete : Error<
7646  "'delete' cannot delete objects of type %0 in address space '%1'">;
7647
7648def err_default_init_const : Error<
7649  "default initialization of an object of const type %0"
7650  "%select{| without a user-provided default constructor}1">;
7651def ext_default_init_const : ExtWarn<
7652  "default initialization of an object of const type %0"
7653  "%select{| without a user-provided default constructor}1 "
7654  "is a Microsoft extension">,
7655  InGroup<MicrosoftConstInit>;
7656def err_delete_operand : Error<"cannot delete expression of type %0">;
7657def ext_delete_void_ptr_operand : ExtWarn<
7658  "cannot delete expression with pointer-to-'void' type %0">,
7659  InGroup<DeleteIncomplete>;
7660def err_ambiguous_delete_operand : Error<
7661  "ambiguous conversion of delete expression of type %0 to a pointer">;
7662def warn_delete_incomplete : Warning<
7663  "deleting pointer to incomplete type %0 may cause undefined behavior">,
7664  InGroup<DeleteIncomplete>;
7665def err_delete_incomplete_class_type : Error<
7666  "deleting incomplete class type %0; no conversions to pointer type">;
7667def err_delete_explicit_conversion : Error<
7668  "converting delete expression from type %0 to type %1 invokes an explicit "
7669  "conversion function">;
7670def note_delete_conversion : Note<"conversion to pointer type %0">;
7671def warn_delete_array_type : Warning<
7672  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7673def warn_mismatched_delete_new : Warning<
7674  "'delete%select{|[]}0' applied to a pointer that was allocated with "
7675  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7676  InGroup<DiagGroup<"mismatched-new-delete">>;
7677def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7678def err_no_suitable_delete_member_function_found : Error<
7679  "no suitable member %0 in %1">;
7680def err_ambiguous_suitable_delete_member_function_found : Error<
7681  "multiple suitable %0 functions in %1">;
7682def warn_ambiguous_suitable_delete_function_found : Warning<
7683  "multiple suitable %0 functions for %1; no 'operator delete' function "
7684  "will be invoked if initialization throws an exception">,
7685  InGroup<DiagGroup<"ambiguous-delete">>;
7686def note_member_declared_here : Note<
7687  "member %0 declared here">;
7688def note_member_first_declared_here : Note<
7689  "member %0 first declared here">;
7690def warn_bitwise_instead_of_logical : Warning<
7691  "use of bitwise '%0' with boolean operands">,
7692  InGroup<BitwiseInsteadOfLogical>, DefaultIgnore;
7693def warn_bitwise_negation_bool : Warning<
7694  "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7695  "did you mean logical negation?">,
7696  InGroup<BoolOperation>, DefaultIgnore;
7697def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7698def warn_increment_bool : Warning<
7699  "incrementing expression of type bool is deprecated and "
7700  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7701def ext_increment_bool : ExtWarn<
7702  "ISO C++17 does not allow incrementing expression of type bool">,
7703  DefaultError, SFINAEFailure, InGroup<IncrementBool>;
7704def err_increment_decrement_enum : Error<
7705  "cannot %select{decrement|increment}0 expression of enum type %1">;
7706
7707def warn_deprecated_increment_decrement_volatile : Warning<
7708  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7709  "is deprecated">, InGroup<DeprecatedVolatile>;
7710def warn_deprecated_simple_assign_volatile : Warning<
7711  "use of result of assignment to object of volatile-qualified type %0 "
7712  "is deprecated">, InGroup<DeprecatedVolatile>;
7713def warn_deprecated_volatile_return : Warning<
7714  "volatile-qualified return type %0 is deprecated">,
7715  InGroup<DeprecatedVolatile>;
7716def warn_deprecated_volatile_param : Warning<
7717  "volatile-qualified parameter type %0 is deprecated">,
7718  InGroup<DeprecatedVolatile>;
7719def warn_deprecated_volatile_structured_binding : Warning<
7720  "volatile qualifier in structured binding declaration is deprecated">,
7721  InGroup<DeprecatedVolatile>;
7722
7723def warn_deprecated_altivec_src_compat : Warning<
7724  "Current handling of vector bool and vector pixel types in this context are "
7725  "deprecated. The default behaviour will soon change to that implied by the "
7726  "'-altivec-compat=xl' option">,
7727  InGroup<DiagGroup<"deprecated-altivec-src-compat">>;
7728
7729def warn_deprecated_lax_vec_conv_all : Warning<
7730  "Implicit conversion between vector types ('%0' and '%1') is deprecated. "
7731  "In the future, the behavior implied by '-fno-lax-vector-conversions' "
7732  "will be the default.">,
7733  InGroup<DiagGroup<"deprecate-lax-vec-conv-all">>;
7734
7735def err_catch_incomplete_ptr : Error<
7736  "cannot catch pointer to incomplete type %0">;
7737def err_catch_incomplete_ref : Error<
7738  "cannot catch reference to incomplete type %0">;
7739def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7740def err_catch_sizeless : Error<
7741  "cannot catch %select{|reference to }0sizeless type %1">;
7742def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7743def err_catch_variably_modified : Error<
7744  "cannot catch variably modified type %0">;
7745def err_qualified_catch_declarator : Error<
7746  "exception declarator cannot be qualified">;
7747def err_early_catch_all : Error<"catch-all handler must come last">;
7748def err_bad_memptr_rhs : Error<
7749  "right hand operand to %0 has non-pointer-to-member type %1">;
7750def err_bad_memptr_lhs : Error<
7751  "left hand operand to %0 must be a %select{|pointer to }1class "
7752  "compatible with the right hand operand, but is %2">;
7753def err_memptr_incomplete : Error<
7754  "member pointer has incomplete base type %0">;
7755def warn_exception_caught_by_earlier_handler : Warning<
7756  "exception of type %0 will be caught by earlier handler">,
7757  InGroup<Exceptions>;
7758def note_previous_exception_handler : Note<"for type %0">;
7759def err_exceptions_disabled : Error<
7760  "cannot use '%0' with exceptions disabled">;
7761def err_objc_exceptions_disabled : Error<
7762  "cannot use '%0' with Objective-C exceptions disabled">;
7763def warn_throw_in_noexcept_func : Warning<
7764  "%0 has a non-throwing exception specification but can still throw">,
7765  InGroup<Exceptions>;
7766def note_throw_in_dtor : Note<
7767  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7768  "non-throwing}1 exception specification">;
7769def note_throw_in_function : Note<"function declared non-throwing here">;
7770def err_seh_try_outside_functions : Error<
7771  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7772def err_mixing_cxx_try_seh_try : Error<
7773  "cannot use %select{C++ 'try'|Objective-C '@try'}0 "
7774  "in the same function as SEH '__try'">;
7775def err_seh_try_unsupported : Error<
7776  "SEH '__try' is not supported on this target">;
7777def note_conflicting_try_here : Note<
7778  "conflicting %0 here">;
7779def warn_jump_out_of_seh_finally : Warning<
7780  "jump out of __finally block has undefined behavior">,
7781  InGroup<DiagGroup<"jump-seh-finally">>;
7782def warn_non_virtual_dtor : Warning<
7783  "%0 has virtual functions but non-virtual destructor">,
7784  InGroup<NonVirtualDtor>, DefaultIgnore;
7785def warn_delete_non_virtual_dtor : Warning<
7786  "%select{delete|destructor}0 called on non-final %1 that has "
7787  "virtual functions but non-virtual destructor">,
7788  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7789def note_delete_non_virtual : Note<
7790  "qualify call to silence this warning">;
7791def warn_delete_abstract_non_virtual_dtor : Warning<
7792  "%select{delete|destructor}0 called on %1 that is abstract but has "
7793  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7794def warn_overloaded_virtual : Warning<
7795  "%q0 hides overloaded virtual %select{function|functions}1">,
7796  InGroup<OverloadedVirtual>, DefaultIgnore;
7797def note_hidden_overloaded_virtual_declared_here : Note<
7798  "hidden overloaded virtual function %q0 declared here"
7799  "%select{|: different classes%diff{ ($ vs $)|}2,3"
7800  "|: different number of parameters (%2 vs %3)"
7801  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7802  "|: different return type%diff{ ($ vs $)|}2,3"
7803  "|: different qualifiers (%2 vs %3)"
7804  "|: different exception specifications}1">;
7805def warn_using_directive_in_header : Warning<
7806  "using namespace directive in global context in header">,
7807  InGroup<HeaderHygiene>, DefaultIgnore;
7808def warn_overaligned_type : Warning<
7809  "type %0 requires %1 bytes of alignment and the default allocator only "
7810  "guarantees %2 bytes">,
7811  InGroup<OveralignedType>, DefaultIgnore;
7812def err_array_element_alignment : Error<
7813  "size of array element of type %0 (%1 bytes) isn't a multiple of its alignment (%2 bytes)">;
7814def err_aligned_allocation_unavailable : Error<
7815  "aligned %select{allocation|deallocation}0 function of type '%1' is "
7816  "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
7817def note_silence_aligned_allocation_unavailable : Note<
7818  "if you supply your own aligned allocation functions, use "
7819  "-faligned-allocation to silence this diagnostic">;
7820
7821def err_conditional_void_nonvoid : Error<
7822  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7823  "is of type %0">;
7824def err_conditional_ambiguous : Error<
7825  "conditional expression is ambiguous; "
7826  "%diff{$ can be converted to $ and vice versa|"
7827  "types can be convert to each other}0,1">;
7828def err_conditional_ambiguous_ovl : Error<
7829  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7830  "can be converted to several common types">;
7831def err_conditional_vector_size : Error<
7832  "vector condition type %0 and result type %1 do not have the same number "
7833  "of elements">;
7834def err_conditional_vector_element_size : Error<
7835  "vector condition type %0 and result type %1 do not have elements of the "
7836  "same size">;
7837def err_conditional_vector_has_void : Error<
7838  "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7839def err_conditional_vector_operand_type
7840    : Error<"enumeration type %0 is not allowed in a vector conditional">;
7841def err_conditional_vector_cond_result_mismatch
7842    : Error<"cannot mix vectors and extended vectors in a vector conditional">;
7843def err_conditional_vector_mismatched
7844    : Error<"vector operands to the vector conditional must be the same type "
7845            "%diff{($ and $)|}0,1}">;
7846
7847def err_throw_incomplete : Error<
7848  "cannot throw object of incomplete type %0">;
7849def err_throw_incomplete_ptr : Error<
7850  "cannot throw pointer to object of incomplete type %0">;
7851def err_throw_sizeless : Error<
7852  "cannot throw object of sizeless type %0">;
7853def warn_throw_underaligned_obj : Warning<
7854  "underaligned exception object thrown">,
7855  InGroup<UnderalignedExceptionObject>;
7856def note_throw_underaligned_obj : Note<
7857  "required alignment of type %0 (%1 bytes) is larger than the supported "
7858  "alignment of C++ exception objects on this target (%2 bytes)">;
7859def err_return_in_constructor_handler : Error<
7860  "return in the catch of a function try block of a constructor is illegal">;
7861def warn_cdtor_function_try_handler_mem_expr : Warning<
7862  "cannot refer to a non-static member from the handler of a "
7863  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
7864
7865let CategoryName = "Lambda Issue" in {
7866  def err_capture_more_than_once : Error<
7867    "%0 can appear only once in a capture list">;
7868  def err_reference_capture_with_reference_default : Error<
7869    "'&' cannot precede a capture when the capture default is '&'">;
7870  def err_copy_capture_with_copy_default : Error<
7871    "'&' must precede a capture when the capture default is '='">;
7872  def err_capture_does_not_name_variable : Error<
7873    "%0 in capture list does not name a variable">;
7874  def err_capture_non_automatic_variable : Error<
7875    "%0 cannot be captured because it does not have automatic storage "
7876    "duration">;
7877  def err_this_capture : Error<
7878    "'this' cannot be %select{implicitly |}0captured in this context">;
7879  def note_lambda_this_capture_fixit : Note<
7880    "explicitly capture 'this'">;
7881  def err_lambda_capture_anonymous_var : Error<
7882    "unnamed variable cannot be implicitly captured in a lambda expression">;
7883  def err_lambda_capture_flexarray_type : Error<
7884    "variable %0 with flexible array member cannot be captured in "
7885    "a lambda expression">;
7886  def err_lambda_impcap : Error<
7887    "variable %0 cannot be implicitly captured in a lambda with no "
7888    "capture-default specified">;
7889  def note_lambda_variable_capture_fixit : Note<
7890    "capture %0 by %select{value|reference}1">;
7891  def note_lambda_default_capture_fixit : Note<
7892    "default capture by %select{value|reference}0">;
7893  def note_lambda_decl : Note<"lambda expression begins here">;
7894  def err_lambda_unevaluated_operand : Error<
7895    "lambda expression in an unevaluated operand">;
7896  def err_lambda_in_constant_expression : Error<
7897    "a lambda expression may not appear inside of a constant expression">;
7898  def err_lambda_in_invalid_context : Error<
7899    "a lambda expression cannot appear in this context">;
7900  def err_lambda_return_init_list : Error<
7901    "cannot deduce lambda return type from initializer list">;
7902  def err_lambda_capture_default_arg : Error<
7903    "lambda expression in default argument cannot capture any entity">;
7904  def err_lambda_incomplete_result : Error<
7905    "incomplete result type %0 in lambda expression">;
7906  def err_noreturn_lambda_has_return_expr : Error<
7907    "lambda declared 'noreturn' should not return">;
7908  def warn_maybe_falloff_nonvoid_lambda : Warning<
7909    "non-void lambda does not return a value in all control paths">,
7910    InGroup<ReturnType>;
7911  def warn_falloff_nonvoid_lambda : Warning<
7912    "non-void lambda does not return a value">,
7913    InGroup<ReturnType>;
7914  def err_access_lambda_capture : Error<
7915    // The ERRORs represent other special members that aren't constructors, in
7916    // hopes that someone will bother noticing and reporting if they appear
7917    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
7918    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
7919    AccessControl;
7920  def note_lambda_to_block_conv : Note<
7921    "implicit capture of lambda object due to conversion to block pointer "
7922    "here">;
7923  def note_var_explicitly_captured_here : Note<"variable %0 is"
7924    "%select{| explicitly}1 captured here">;
7925
7926  // C++14 lambda init-captures.
7927  def warn_cxx11_compat_init_capture : Warning<
7928    "initialized lambda captures are incompatible with C++ standards "
7929    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
7930  def ext_init_capture : ExtWarn<
7931    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
7932  def err_init_capture_no_expression : Error<
7933    "initializer missing for lambda capture %0">;
7934  def err_init_capture_multiple_expressions : Error<
7935    "initializer for lambda capture %0 contains multiple expressions">;
7936  def err_init_capture_paren_braces : Error<
7937    "cannot deduce type for lambda capture %1 from "
7938    "%select{parenthesized|nested}0 initializer list">;
7939  def err_init_capture_deduction_failure : Error<
7940    "cannot deduce type for lambda capture %0 from initializer of type %2">;
7941  def err_init_capture_deduction_failure_from_init_list : Error<
7942    "cannot deduce type for lambda capture %0 from initializer list">;
7943  def warn_cxx17_compat_init_capture_pack : Warning<
7944    "initialized lambda capture packs are incompatible with C++ standards "
7945    "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7946  def ext_init_capture_pack : ExtWarn<
7947    "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
7948
7949  // C++14 generic lambdas.
7950  def warn_cxx11_compat_generic_lambda : Warning<
7951    "generic lambdas are incompatible with C++11">,
7952    InGroup<CXXPre14Compat>, DefaultIgnore;
7953
7954  // C++17 '*this' captures.
7955  def warn_cxx14_compat_star_this_lambda_capture : Warning<
7956    "by value capture of '*this' is incompatible with C++ standards before C++17">,
7957     InGroup<CXXPre17Compat>, DefaultIgnore;
7958  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
7959    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
7960
7961  // C++17 parameter shadows capture
7962  def err_parameter_shadow_capture : Error<
7963    "a lambda parameter cannot shadow an explicitly captured entity">;
7964
7965  // C++20 [=, this] captures.
7966  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
7967    "explicit capture of 'this' with a capture default of '=' is incompatible "
7968    "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7969  def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
7970    "explicit capture of 'this' with a capture default of '=' "
7971    "is a C++20 extension">, InGroup<CXX20>;
7972  def warn_deprecated_this_capture : Warning<
7973    "implicit capture of 'this' with a capture default of '=' is deprecated">,
7974    InGroup<DeprecatedThisCapture>;
7975  def note_deprecated_this_capture : Note<
7976    "add an explicit capture of 'this' to capture '*this' by reference">;
7977
7978  // C++20 default constructible / assignable lambdas.
7979  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
7980    "%select{default construction|assignment}0 of lambda is incompatible with "
7981    "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7982}
7983
7984def err_return_in_captured_stmt : Error<
7985  "cannot return from %0">;
7986def err_capture_block_variable : Error<
7987  "__block variable %0 cannot be captured in a "
7988  "%select{lambda expression|captured statement}1">;
7989
7990def err_operator_arrow_circular : Error<
7991  "circular pointer delegation detected">;
7992def err_operator_arrow_depth_exceeded : Error<
7993  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
7994  "'operator->' calls">;
7995def note_operator_arrow_here : Note<
7996  "'operator->' declared here produces an object of type %0">;
7997def note_operator_arrows_suppressed : Note<
7998  "(skipping %0 'operator->'%s0 in backtrace)">;
7999def note_operator_arrow_depth : Note<
8000  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
8001
8002def err_pseudo_dtor_base_not_scalar : Error<
8003  "object expression of non-scalar type %0 cannot be used in a "
8004  "pseudo-destructor expression">;
8005def ext_pseudo_dtor_on_void : ExtWarn<
8006  "pseudo-destructors on type void are a Microsoft extension">,
8007  InGroup<MicrosoftVoidPseudoDtor>;
8008def err_pseudo_dtor_type_mismatch : Error<
8009  "the type of object expression "
8010  "%diff{($) does not match the type being destroyed ($)|"
8011  "does not match the type being destroyed}0,1 "
8012  "in pseudo-destructor expression">;
8013def err_pseudo_dtor_call_with_args : Error<
8014  "call to pseudo-destructor cannot have any arguments">;
8015def err_dtor_expr_without_call : Error<
8016  "reference to %select{destructor|pseudo-destructor}0 must be called"
8017  "%select{|; did you mean to call it with no arguments?}1">;
8018def err_pseudo_dtor_destructor_non_type : Error<
8019  "%0 does not refer to a type name in pseudo-destructor expression; expected "
8020  "the name of type %1">;
8021def err_invalid_use_of_function_type : Error<
8022  "a function type is not allowed here">;
8023def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
8024def err_typecheck_bool_condition : Error<
8025  "value of type %0 is not contextually convertible to 'bool'">;
8026def err_typecheck_ambiguous_condition : Error<
8027  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
8028def err_typecheck_nonviable_condition : Error<
8029  "no viable conversion%select{%diff{ from $ to $|}1,2|"
8030  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
8031def err_typecheck_nonviable_condition_incomplete : Error<
8032  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
8033def err_typecheck_deleted_function : Error<
8034  "conversion function %diff{from $ to $|between types}0,1 "
8035  "invokes a deleted function">;
8036
8037def err_expected_class_or_namespace : Error<"%0 is not a class"
8038  "%select{ or namespace|, namespace, or enumeration}1">;
8039def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
8040  "because namespace %1 does not enclose namespace %2">;
8041def err_export_non_namespace_scope_name : Error<
8042  "cannot export %0 as it is not at namespace scope">;
8043def err_redeclaration_non_exported : Error <
8044  "cannot export redeclaration %0 here since the previous declaration "
8045  "%select{is not exported|has internal linkage|has module linkage}1">;
8046def err_invalid_declarator_global_scope : Error<
8047  "definition or redeclaration of %0 cannot name the global scope">;
8048def err_invalid_declarator_in_function : Error<
8049  "definition or redeclaration of %0 not allowed inside a function">;
8050def err_invalid_declarator_in_block : Error<
8051  "definition or redeclaration of %0 not allowed inside a block">;
8052def err_not_tag_in_scope : Error<
8053  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
8054
8055def err_no_typeid_with_fno_rtti : Error<
8056  "use of typeid requires -frtti">;
8057def err_no_dynamic_cast_with_fno_rtti : Error<
8058  "use of dynamic_cast requires -frtti">;
8059def warn_no_dynamic_cast_with_rtti_disabled: Warning<
8060  "dynamic_cast will not work since RTTI data is disabled by "
8061  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8062def warn_no_typeid_with_rtti_disabled: Warning<
8063  "typeid will not work since RTTI data is disabled by "
8064  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
8065
8066def err_cannot_form_pointer_to_member_of_reference_type : Error<
8067  "cannot form a pointer-to-member to member %0 of reference type %1">;
8068def err_incomplete_object_call : Error<
8069  "incomplete type in call to object of type %0">;
8070
8071def warn_condition_is_assignment : Warning<"using the result of an "
8072  "assignment as a condition without parentheses">,
8073  InGroup<Parentheses>;
8074def warn_free_nonheap_object
8075  : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
8076    InGroup<FreeNonHeapObject>;
8077
8078// Completely identical except off by default.
8079def warn_condition_is_idiomatic_assignment : Warning<"using the result "
8080  "of an assignment as a condition without parentheses">,
8081  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
8082def note_condition_assign_to_comparison : Note<
8083  "use '==' to turn this assignment into an equality comparison">;
8084def note_condition_or_assign_to_comparison : Note<
8085  "use '!=' to turn this compound assignment into an inequality comparison">;
8086def note_condition_assign_silence : Note<
8087  "place parentheses around the assignment to silence this warning">;
8088
8089def warn_equality_with_extra_parens : Warning<"equality comparison with "
8090  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
8091def note_equality_comparison_to_assign : Note<
8092  "use '=' to turn this equality comparison into an assignment">;
8093def note_equality_comparison_silence : Note<
8094  "remove extraneous parentheses around the comparison to silence this warning">;
8095
8096// assignment related diagnostics (also for argument passing, returning, etc).
8097// In most of these diagnostics the %2 is a value from the
8098// Sema::AssignmentAction enumeration
8099def err_typecheck_convert_incompatible : Error<
8100  "%select{%diff{assigning to $ from incompatible type $|"
8101  "assigning to type from incompatible type}0,1"
8102  "|%diff{passing $ to parameter of incompatible type $|"
8103  "passing type to parameter of incompatible type}0,1"
8104  "|%diff{returning $ from a function with incompatible result type $|"
8105  "returning type from a function with incompatible result type}0,1"
8106  "|%diff{converting $ to incompatible type $|"
8107  "converting type to incompatible type}0,1"
8108  "|%diff{initializing $ with an expression of incompatible type $|"
8109  "initializing type with an expression of incompatible type}0,1"
8110  "|%diff{sending $ to parameter of incompatible type $|"
8111  "sending type to parameter of incompatible type}0,1"
8112  "|%diff{casting $ to incompatible type $|"
8113  "casting type to incompatible type}0,1}2"
8114  "%select{|; dereference with *|"
8115  "; take the address with &|"
8116  "; remove *|"
8117  "; remove &}3"
8118  "%select{|: different classes%diff{ ($ vs $)|}5,6"
8119  "|: different number of parameters (%5 vs %6)"
8120  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
8121  "|: different return type%diff{ ($ vs $)|}5,6"
8122  "|: different qualifiers (%5 vs %6)"
8123  "|: different exception specifications}4">;
8124def err_typecheck_missing_return_type_incompatible : Error<
8125  "%diff{return type $ must match previous return type $|"
8126  "return type must match previous return type}0,1 when %select{block "
8127  "literal|lambda expression}2 has unspecified explicit return type">;
8128
8129def note_incomplete_class_and_qualified_id : Note<
8130  "conformance of forward class %0 to protocol %1 can not be confirmed">;
8131def warn_incompatible_qualified_id : Warning<
8132  "%select{%diff{assigning to $ from incompatible type $|"
8133  "assigning to type from incompatible type}0,1"
8134  "|%diff{passing $ to parameter of incompatible type $|"
8135  "passing type to parameter of incompatible type}0,1"
8136  "|%diff{returning $ from a function with incompatible result type $|"
8137  "returning type from a function with incompatible result type}0,1"
8138  "|%diff{converting $ to incompatible type $|"
8139  "converting type to incompatible type}0,1"
8140  "|%diff{initializing $ with an expression of incompatible type $|"
8141  "initializing type with an expression of incompatible type}0,1"
8142  "|%diff{sending $ to parameter of incompatible type $|"
8143  "sending type to parameter of incompatible type}0,1"
8144  "|%diff{casting $ to incompatible type $|"
8145  "casting type to incompatible type}0,1}2">;
8146def err_incompatible_qualified_id : Error<
8147  "%select{%diff{assigning to $ from incompatible type $|"
8148  "assigning to type from incompatible type}0,1"
8149  "|%diff{passing $ to parameter of incompatible type $|"
8150  "passing type to parameter of incompatible type}0,1"
8151  "|%diff{returning $ from a function with incompatible result type $|"
8152  "returning type from a function with incompatible result type}0,1"
8153  "|%diff{converting $ to incompatible type $|"
8154  "converting type to incompatible type}0,1"
8155  "|%diff{initializing $ with an expression of incompatible type $|"
8156  "initializing type with an expression of incompatible type}0,1"
8157  "|%diff{sending $ to parameter of incompatible type $|"
8158  "sending type to parameter of incompatible type}0,1"
8159  "|%diff{casting $ to incompatible type $|"
8160  "casting type to incompatible type}0,1}2">;
8161def err_typecheck_convert_pointer_int : Error<
8162  "incompatible pointer to integer conversion "
8163  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8164  "|%diff{passing $ to parameter of type $|"
8165  "passing to parameter of different type}0,1"
8166  "|%diff{returning $ from a function with result type $|"
8167  "returning from function with different return type}0,1"
8168  "|%diff{converting $ to type $|converting between types}0,1"
8169  "|%diff{initializing $ with an expression of type $|"
8170  "initializing with expression of different type}0,1"
8171  "|%diff{sending $ to parameter of type $|"
8172  "sending to parameter of different type}0,1"
8173  "|%diff{casting $ to type $|casting between types}0,1}2"
8174  "%select{|; dereference with *|"
8175  "; take the address with &|"
8176  "; remove *|"
8177  "; remove &}3">;
8178def ext_typecheck_convert_pointer_int : ExtWarn<
8179  err_typecheck_convert_pointer_int.Summary>,
8180  InGroup<IntConversion>, DefaultError;
8181def err_typecheck_convert_int_pointer : Error<
8182  "incompatible integer to pointer conversion "
8183  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8184  "|%diff{passing $ to parameter of type $|"
8185  "passing to parameter of different type}0,1"
8186  "|%diff{returning $ from a function with result type $|"
8187  "returning from function with different return type}0,1"
8188  "|%diff{converting $ to type $|converting between types}0,1"
8189  "|%diff{initializing $ with an expression of type $|"
8190  "initializing with expression of different type}0,1"
8191  "|%diff{sending $ to parameter of type $|"
8192  "sending to parameter of different type}0,1"
8193  "|%diff{casting $ to type $|casting between types}0,1}2"
8194  "%select{|; dereference with *|"
8195  "; take the address with &|"
8196  "; remove *|"
8197  "; remove &}3">;
8198def ext_typecheck_convert_int_pointer : ExtWarn<
8199  err_typecheck_convert_int_pointer.Summary>,
8200  InGroup<IntConversion>, DefaultError;
8201def ext_typecheck_convert_pointer_void_func : Extension<
8202  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8203  "|%diff{passing $ to parameter of type $|"
8204  "passing to parameter of different type}0,1"
8205  "|%diff{returning $ from a function with result type $|"
8206  "returning from function with different return type}0,1"
8207  "|%diff{converting $ to type $|converting between types}0,1"
8208  "|%diff{initializing $ with an expression of type $|"
8209  "initializing with expression of different type}0,1"
8210  "|%diff{sending $ to parameter of type $|"
8211  "sending to parameter of different type}0,1"
8212  "|%diff{casting $ to type $|casting between types}0,1}2"
8213  " converts between void pointer and function pointer">;
8214def err_typecheck_convert_pointer_void_func : Error<
8215  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8216  "|%diff{passing $ to parameter of type $|"
8217  "passing to parameter of different type}0,1"
8218  "|%diff{returning $ from a function with result type $|"
8219  "returning from function with different return type}0,1"
8220  "|%diff{converting $ to type $|converting between types}0,1"
8221  "|%diff{initializing $ with an expression of type $|"
8222  "initializing with expression of different type}0,1"
8223  "|%diff{sending $ to parameter of type $|"
8224  "sending to parameter of different type}0,1"
8225  "|%diff{casting $ to type $|casting between types}0,1}2"
8226  " converts between void pointer and function pointer">;
8227def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
8228  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8229  "|%diff{passing $ to parameter of type $|"
8230  "passing to parameter of different type}0,1"
8231  "|%diff{returning $ from a function with result type $|"
8232  "returning from function with different return type}0,1"
8233  "|%diff{converting $ to type $|converting between types}0,1"
8234  "|%diff{initializing $ with an expression of type $|"
8235  "initializing with expression of different type}0,1"
8236  "|%diff{sending $ to parameter of type $|"
8237  "sending to parameter of different type}0,1"
8238  "|%diff{casting $ to type $|casting between types}0,1}2"
8239  " converts between pointers to integer types %select{with different sign|"
8240  "where one is of the unique plain 'char' type and the other is not}3">,
8241  InGroup<DiagGroup<"pointer-sign">>;
8242def err_typecheck_convert_incompatible_pointer_sign :
8243  Error<ext_typecheck_convert_incompatible_pointer_sign.Summary>;
8244def ext_typecheck_convert_incompatible_pointer : ExtWarn<
8245  "incompatible pointer types "
8246  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8247  "|%diff{passing $ to parameter of type $|"
8248  "passing to parameter of different type}0,1"
8249  "|%diff{returning $ from a function with result type $|"
8250  "returning from function with different return type}0,1"
8251  "|%diff{converting $ to type $|converting between types}0,1"
8252  "|%diff{initializing $ with an expression of type $|"
8253  "initializing with expression of different type}0,1"
8254  "|%diff{sending $ to parameter of type $|"
8255  "sending to parameter of different type}0,1"
8256  "|%diff{casting $ to type $|casting between types}0,1}2"
8257  "%select{|; dereference with *|"
8258  "; take the address with &|"
8259  "; remove *|"
8260  "; remove &}3">,
8261  InGroup<IncompatiblePointerTypes>;
8262def err_typecheck_convert_incompatible_pointer : Error<
8263  "incompatible pointer types "
8264  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8265  "|%diff{passing $ to parameter of type $|"
8266  "passing to parameter of different type}0,1"
8267  "|%diff{returning $ from a function with result type $|"
8268  "returning from function with different return type}0,1"
8269  "|%diff{converting $ to type $|converting between types}0,1"
8270  "|%diff{initializing $ with an expression of type $|"
8271  "initializing with expression of different type}0,1"
8272  "|%diff{sending $ to parameter of type $|"
8273  "sending to parameter of different type}0,1"
8274  "|%diff{casting $ to type $|casting between types}0,1}2"
8275  "%select{|; dereference with *|"
8276  "; take the address with &|"
8277  "; remove *|"
8278  "; remove &}3">;
8279def err_typecheck_convert_incompatible_function_pointer : Error<
8280  "incompatible function pointer types "
8281  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8282  "|%diff{passing $ to parameter of type $|"
8283  "passing to parameter of different type}0,1"
8284  "|%diff{returning $ from a function with result type $|"
8285  "returning from function with different return type}0,1"
8286  "|%diff{converting $ to type $|converting between types}0,1"
8287  "|%diff{initializing $ with an expression of type $|"
8288  "initializing with expression of different type}0,1"
8289  "|%diff{sending $ to parameter of type $|"
8290  "sending to parameter of different type}0,1"
8291  "|%diff{casting $ to type $|casting between types}0,1}2"
8292  "%select{|; dereference with *|"
8293  "; take the address with &|"
8294  "; remove *|"
8295  "; remove &}3">;
8296def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
8297  err_typecheck_convert_incompatible_function_pointer.Summary>,
8298  InGroup<IncompatibleFunctionPointerTypes>, DefaultError;
8299def warn_typecheck_convert_incompatible_function_pointer_strict : Warning<
8300  err_typecheck_convert_incompatible_function_pointer.Summary>,
8301  InGroup<DiagGroup<"incompatible-function-pointer-types-strict">>, DefaultIgnore;
8302def ext_typecheck_convert_discards_qualifiers : ExtWarn<
8303  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
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  " discards qualifiers">,
8315  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8316def err_typecheck_convert_discards_qualifiers : Error<
8317  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8318  "|%diff{passing $ to parameter of type $|"
8319  "passing to parameter of different type}0,1"
8320  "|%diff{returning $ from a function with result type $|"
8321  "returning from function with different return type}0,1"
8322  "|%diff{converting $ to type $|converting between types}0,1"
8323  "|%diff{initializing $ with an expression of type $|"
8324  "initializing with expression of different type}0,1"
8325  "|%diff{sending $ to parameter of type $|"
8326  "sending to parameter of different type}0,1"
8327  "|%diff{casting $ to type $|casting between types}0,1}2"
8328  " discards qualifiers">;
8329def ext_nested_pointer_qualifier_mismatch : ExtWarn<
8330  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8331  "|%diff{passing $ to parameter of type $|"
8332  "passing to parameter of different type}0,1"
8333  "|%diff{returning $ from a function with result type $|"
8334  "returning from function with different return type}0,1"
8335  "|%diff{converting $ to type $|converting between types}0,1"
8336  "|%diff{initializing $ with an expression of type $|"
8337  "initializing with expression of different type}0,1"
8338  "|%diff{sending $ to parameter of type $|"
8339  "sending to parameter of different type}0,1"
8340  "|%diff{casting $ to type $|casting between types}0,1}2"
8341  " discards qualifiers in nested pointer types">,
8342  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8343def err_nested_pointer_qualifier_mismatch : Error<
8344  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8345  "|%diff{passing $ to parameter of type $|"
8346  "passing to parameter of different type}0,1"
8347  "|%diff{returning $ from a function with result type $|"
8348  "returning from function with different return type}0,1"
8349  "|%diff{converting $ to type $|converting between types}0,1"
8350  "|%diff{initializing $ with an expression of type $|"
8351  "initializing with expression of different type}0,1"
8352  "|%diff{sending $ to parameter of type $|"
8353  "sending to parameter of different type}0,1"
8354  "|%diff{casting $ to type $|casting between types}0,1}2"
8355  " discards qualifiers in nested pointer types">;
8356def warn_incompatible_vectors : Warning<
8357  "incompatible vector types "
8358  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8359  "|%diff{passing $ to parameter of type $|"
8360  "passing to parameter of different type}0,1"
8361  "|%diff{returning $ from a function with result type $|"
8362  "returning from function with different return type}0,1"
8363  "|%diff{converting $ to type $|converting between types}0,1"
8364  "|%diff{initializing $ with an expression of type $|"
8365  "initializing with expression of different type}0,1"
8366  "|%diff{sending $ to parameter of type $|"
8367  "sending to parameter of different type}0,1"
8368  "|%diff{casting $ to type $|casting between types}0,1}2">,
8369  InGroup<VectorConversion>, DefaultIgnore;
8370def err_incompatible_vectors : Error<
8371  "incompatible vector types "
8372  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8373  "|%diff{passing $ to parameter of type $|"
8374  "passing to parameter of different type}0,1"
8375  "|%diff{returning $ from a function with result type $|"
8376  "returning from function with different return type}0,1"
8377  "|%diff{converting $ to type $|converting between types}0,1"
8378  "|%diff{initializing $ with an expression of type $|"
8379  "initializing with expression of different type}0,1"
8380  "|%diff{sending $ to parameter of type $|"
8381  "sending to parameter of different type}0,1"
8382  "|%diff{casting $ to type $|casting between types}0,1}2">;
8383def err_int_to_block_pointer : Error<
8384  "invalid block pointer conversion "
8385  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8386  "|%diff{passing $ to parameter of type $|"
8387  "passing to parameter of different type}0,1"
8388  "|%diff{returning $ from a function with result type $|"
8389  "returning from function with different return type}0,1"
8390  "|%diff{converting $ to type $|converting between types}0,1"
8391  "|%diff{initializing $ with an expression of type $|"
8392  "initializing with expression of different type}0,1"
8393  "|%diff{sending $ to parameter of type $|"
8394  "sending to parameter of different type}0,1"
8395  "|%diff{casting $ to type $|casting between types}0,1}2">;
8396def err_typecheck_convert_incompatible_block_pointer : Error<
8397  "incompatible block pointer types "
8398  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8399  "|%diff{passing $ to parameter of type $|"
8400  "passing to parameter of different type}0,1"
8401  "|%diff{returning $ from a function with result type $|"
8402  "returning from function with different return type}0,1"
8403  "|%diff{converting $ to type $|converting between types}0,1"
8404  "|%diff{initializing $ with an expression of type $|"
8405  "initializing with expression of different type}0,1"
8406  "|%diff{sending $ to parameter of type $|"
8407  "sending to parameter of different type}0,1"
8408  "|%diff{casting $ to type $|casting between types}0,1}2">;
8409def err_typecheck_incompatible_address_space : Error<
8410  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8411  "|%diff{passing $ to parameter of type $|"
8412  "passing to parameter of different type}0,1"
8413  "|%diff{returning $ from a function with result type $|"
8414  "returning from function with different return type}0,1"
8415  "|%diff{converting $ to type $|converting between types}0,1"
8416  "|%diff{initializing $ with an expression of type $|"
8417  "initializing with expression of different type}0,1"
8418  "|%diff{sending $ to parameter of type $|"
8419  "sending to parameter of different type}0,1"
8420  "|%diff{casting $ to type $|casting between types}0,1}2"
8421  " changes address space of pointer">;
8422def err_typecheck_incompatible_nested_address_space : Error<
8423  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8424  "|%diff{passing $ to parameter of type $|"
8425  "passing to parameter of different type}0,1"
8426  "|%diff{returning $ from a function with result type $|"
8427  "returning from function with different return type}0,1"
8428  "|%diff{converting $ to type $|converting between types}0,1"
8429  "|%diff{initializing $ with an expression of type $|"
8430  "initializing with expression of different type}0,1"
8431  "|%diff{sending $ to parameter of type $|"
8432  "sending to parameter of different type}0,1"
8433  "|%diff{casting $ to type $|casting between types}0,1}2"
8434  " changes address space of nested pointer">;
8435def err_typecheck_incompatible_ownership : Error<
8436  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8437  "|%diff{passing $ to parameter of type $|"
8438  "passing to parameter of different type}0,1"
8439  "|%diff{returning $ from a function with result type $|"
8440  "returning from function with different return type}0,1"
8441  "|%diff{converting $ to type $|converting between types}0,1"
8442  "|%diff{initializing $ with an expression of type $|"
8443  "initializing with expression of different type}0,1"
8444  "|%diff{sending $ to parameter of type $|"
8445  "sending to parameter of different type}0,1"
8446  "|%diff{casting $ to type $|casting between types}0,1}2"
8447  " changes retain/release properties of pointer">;
8448def err_typecheck_comparison_of_distinct_blocks : Error<
8449  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
8450
8451def err_typecheck_array_not_modifiable_lvalue : Error<
8452  "array type %0 is not assignable">;
8453def err_typecheck_non_object_not_modifiable_lvalue : Error<
8454  "non-object type %0 is not assignable">;
8455def err_typecheck_expression_not_modifiable_lvalue : Error<
8456  "expression is not assignable">;
8457def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
8458  "incomplete type %0 is not assignable">;
8459def err_typecheck_lvalue_casts_not_supported : Error<
8460  "assignment to cast is illegal, lvalue casts are not supported">;
8461
8462def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
8463  "vector is not assignable (contains duplicate components)">;
8464def err_block_decl_ref_not_modifiable_lvalue : Error<
8465  "variable is not assignable (missing __block type specifier)">;
8466def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8467  "cannot assign to a variable captured by copy in a non-mutable lambda">;
8468def err_typecheck_call_not_function : Error<
8469  "called object type %0 is not a function or function pointer">;
8470def err_call_incomplete_return : Error<
8471  "calling function with incomplete return type %0">;
8472def err_call_function_incomplete_return : Error<
8473  "calling %0 with incomplete return type %1">;
8474def err_call_incomplete_argument : Error<
8475  "argument type %0 is incomplete">;
8476def err_typecheck_call_too_few_args : Error<
8477  "too few %select{|||execution configuration }0arguments to "
8478  "%select{function|block|method|kernel function}0 call, "
8479  "expected %1, have %2">;
8480def err_typecheck_call_too_few_args_one : Error<
8481  "too few %select{|||execution configuration }0arguments to "
8482  "%select{function|block|method|kernel function}0 call, "
8483  "single argument %1 was not specified">;
8484def err_typecheck_call_too_few_args_at_least : Error<
8485  "too few %select{|||execution configuration }0arguments to "
8486  "%select{function|block|method|kernel function}0 call, "
8487  "expected at least %1, have %2">;
8488def err_typecheck_call_too_few_args_at_least_one : Error<
8489  "too few %select{|||execution configuration }0arguments to "
8490  "%select{function|block|method|kernel function}0 call, "
8491  "at least argument %1 must be specified">;
8492def err_typecheck_call_too_few_args_suggest : Error<
8493  "too few %select{|||execution configuration }0arguments to "
8494  "%select{function|block|method|kernel function}0 call, "
8495  "expected %1, have %2; did you mean %3?">;
8496def err_typecheck_call_too_few_args_at_least_suggest : Error<
8497  "too few %select{|||execution configuration }0arguments to "
8498  "%select{function|block|method|kernel function}0 call, "
8499  "expected at least %1, have %2; did you mean %3?">;
8500def err_typecheck_call_too_many_args : Error<
8501  "too many %select{|||execution configuration }0arguments to "
8502  "%select{function|block|method|kernel function}0 call, "
8503  "expected %1, have %2">;
8504def err_typecheck_call_too_many_args_one : Error<
8505  "too many %select{|||execution configuration }0arguments to "
8506  "%select{function|block|method|kernel function}0 call, "
8507  "expected single argument %1, have %2 arguments">;
8508def err_typecheck_call_too_many_args_at_most : Error<
8509  "too many %select{|||execution configuration }0arguments to "
8510  "%select{function|block|method|kernel function}0 call, "
8511  "expected at most %1, have %2">;
8512def err_typecheck_call_too_many_args_at_most_one : Error<
8513  "too many %select{|||execution configuration }0arguments to "
8514  "%select{function|block|method|kernel function}0 call, "
8515  "expected at most single argument %1, have %2 arguments">;
8516def err_typecheck_call_too_many_args_suggest : Error<
8517  "too many %select{|||execution configuration }0arguments to "
8518  "%select{function|block|method|kernel function}0 call, "
8519  "expected %1, have %2; did you mean %3?">;
8520def err_typecheck_call_too_many_args_at_most_suggest : Error<
8521  "too many %select{|||execution configuration }0arguments to "
8522  "%select{function|block|method|kernel function}0 call, "
8523  "expected at most %1, have %2; did you mean %3?">;
8524
8525def err_arc_typecheck_convert_incompatible_pointer : Error<
8526  "incompatible pointer types passing retainable parameter of type %0"
8527  "to a CF function expecting %1 type">;
8528
8529def err_builtin_fn_use : Error<"builtin functions must be directly called">;
8530
8531def warn_call_wrong_number_of_arguments : Warning<
8532  "too %select{few|many}0 arguments in call to %1">;
8533def err_atomic_builtin_must_be_pointer : Error<
8534  "address argument to atomic builtin must be a pointer (%0 invalid)">;
8535def err_atomic_builtin_must_be_pointer_intptr : Error<
8536  "address argument to atomic builtin must be a pointer to integer or pointer"
8537  " (%0 invalid)">;
8538def err_atomic_builtin_cannot_be_const : Error<
8539  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
8540def err_atomic_builtin_must_be_pointer_intfltptr : Error<
8541  "address argument to atomic builtin must be a pointer to integer,"
8542  " floating-point or pointer (%0 invalid)">;
8543def err_atomic_builtin_pointer_size : Error<
8544  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
8545  "type (%0 invalid)">;
8546def err_atomic_exclusive_builtin_pointer_size : Error<
8547  "address argument to load or store exclusive builtin must be a pointer to"
8548  " 1,2,4 or 8 byte type (%0 invalid)">;
8549def err_atomic_builtin_ext_int_size : Error<
8550  "Atomic memory operand must have a power-of-two size">;
8551def err_atomic_builtin_bit_int_prohibit : Error<
8552  "argument to atomic builtin of type '_BitInt' is not supported">;
8553def err_atomic_op_needs_atomic : Error<
8554  "address argument to atomic operation must be a pointer to _Atomic "
8555  "type (%0 invalid)">;
8556def err_atomic_op_needs_non_const_atomic : Error<
8557  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
8558  "type (%1 invalid)">;
8559def err_atomic_op_needs_non_const_pointer : Error<
8560  "address argument to atomic operation must be a pointer to non-const "
8561  "type (%0 invalid)">;
8562def err_atomic_op_needs_trivial_copy : Error<
8563  "address argument to atomic operation must be a pointer to a "
8564  "trivially-copyable type (%0 invalid)">;
8565def err_atomic_op_needs_atomic_int_ptr_or_fp : Error<
8566  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8567  "integer, pointer or supported floating point type (%1 invalid)">;
8568def err_atomic_op_needs_atomic_int_or_ptr : Error<
8569  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8570  "integer or pointer (%1 invalid)">;
8571def err_atomic_op_needs_atomic_int_or_fp : Error<
8572  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8573  "integer or supported floating point type (%1 invalid)">;
8574def err_atomic_op_needs_atomic_int : Error<
8575  "address argument to atomic operation must be a pointer to "
8576  "%select{|atomic }0integer (%1 invalid)">;
8577def warn_atomic_op_has_invalid_memory_order : Warning<
8578  "memory order argument to atomic operation is invalid">,
8579  InGroup<DiagGroup<"atomic-memory-ordering">>;
8580def err_atomic_op_has_invalid_synch_scope : Error<
8581  "synchronization scope argument to atomic operation is invalid">;
8582def warn_atomic_implicit_seq_cst : Warning<
8583  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
8584  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
8585
8586def err_overflow_builtin_must_be_int : Error<
8587  "operand argument to overflow builtin must be an integer (%0 invalid)">;
8588def err_overflow_builtin_must_be_ptr_int : Error<
8589  "result argument to overflow builtin must be a pointer "
8590  "to a non-const integer (%0 invalid)">;
8591def err_overflow_builtin_bit_int_max_size : Error<
8592  "__builtin_mul_overflow does not support 'signed _BitInt' operands of more "
8593  "than %0 bits">;
8594def err_expected_struct_pointer_argument : Error<
8595  "expected pointer to struct as %ordinal0 argument to %1, found %2">;
8596def err_expected_callable_argument : Error<
8597  "expected a callable expression as %ordinal0 argument to %1, found %2">;
8598def note_building_builtin_dump_struct_call : Note<
8599  "in call to printing function with arguments '(%0)' while dumping struct">;
8600
8601def err_atomic_load_store_uses_lib : Error<
8602  "atomic %select{load|store}0 requires runtime support that is not "
8603  "available for this target">;
8604
8605def err_nontemporal_builtin_must_be_pointer : Error<
8606  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
8607def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
8608  "address argument to nontemporal builtin must be a pointer to integer, float, "
8609  "pointer, or a vector of such types (%0 invalid)">;
8610
8611def err_deleted_function_use : Error<"attempt to use a deleted function">;
8612def err_deleted_inherited_ctor_use : Error<
8613  "constructor inherited by %0 from base class %1 is implicitly deleted">;
8614
8615def note_called_by : Note<"called by %0">;
8616def err_kern_type_not_void_return : Error<
8617  "kernel function type %0 must have void return type">;
8618def err_kern_is_nonstatic_method : Error<
8619  "kernel function %0 must be a free function or static member function">;
8620def err_config_scalar_return : Error<
8621  "CUDA special function '%0' must have scalar return type">;
8622def err_kern_call_not_global_function : Error<
8623  "kernel call to non-global function %0">;
8624def err_global_call_not_config : Error<
8625  "call to global function %0 not configured">;
8626def err_ref_bad_target : Error<
8627  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8628  "%select{function|variable}1 %2 in %select{__device__|__global__|__host__|__host__ __device__}3 function">;
8629def note_cuda_const_var_unpromoted : Note<
8630  "const variable cannot be emitted on device side due to dynamic initialization">;
8631def note_cuda_host_var : Note<
8632  "host variable declared here">;
8633def err_ref_bad_target_global_initializer : Error<
8634  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8635  "function %1 in global initializer">;
8636def err_capture_bad_target : Error<
8637  "capture host variable %0 by reference in device or host device lambda function">;
8638def warn_maybe_capture_bad_target_this_ptr : Warning<
8639  "capture host side class data member by this pointer in device or host device lambda function "
8640  "may result in invalid memory access if this pointer is not accessible on device side">,
8641  InGroup<DiagGroup<"gpu-maybe-wrong-side">>;
8642def warn_kern_is_method : Extension<
8643  "kernel function %0 is a member function; this may not be accepted by nvcc">,
8644  InGroup<CudaCompat>;
8645def warn_kern_is_inline : Warning<
8646  "ignored 'inline' attribute on kernel function %0">,
8647  InGroup<CudaCompat>;
8648def err_variadic_device_fn : Error<
8649  "CUDA device code does not support variadic functions">;
8650def err_va_arg_in_device : Error<
8651  "CUDA device code does not support va_arg">;
8652def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
8653def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8654  "constexpr function %0 without __host__ or __device__ attributes cannot "
8655  "overload __device__ function with same signature.  Add a __host__ "
8656  "attribute, or build with -fno-cuda-host-device-constexpr.">;
8657def note_cuda_conflicting_device_function_declared_here : Note<
8658  "conflicting __device__ function declared here">;
8659def err_cuda_device_exceptions : Error<
8660  "cannot use '%0' in "
8661  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8662def err_dynamic_var_init : Error<
8663    "dynamic initialization is not supported for "
8664    "__device__, __constant__, __shared__, and __managed__ variables.">;
8665def err_shared_var_init : Error<
8666    "initialization is not supported for __shared__ variables.">;
8667def err_cuda_vla : Error<
8668    "cannot use variable-length arrays in "
8669    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8670def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8671def err_cuda_host_shared : Error<
8672    "__shared__ local variables not allowed in "
8673    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8674def err_cuda_nonstatic_constdev: Error<"__constant__, __device__, and "
8675    "__managed__ are not allowed on non-static local variables">;
8676def err_cuda_ovl_target : Error<
8677  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8678  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8679def note_cuda_ovl_candidate_target_mismatch : Note<
8680    "candidate template ignored: target attributes do not match">;
8681
8682def err_cuda_device_builtin_surftex_cls_template : Error<
8683    "illegal device builtin %select{surface|texture}0 reference "
8684    "class template %1 declared here">;
8685def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8686    "%0 needs to have exactly %1 template parameters">;
8687def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8688    "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8689    "%select{a type|an integer or enum value}2">;
8690
8691def err_cuda_device_builtin_surftex_ref_decl : Error<
8692    "illegal device builtin %select{surface|texture}0 reference "
8693    "type %1 declared here">;
8694def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8695    "%0 needs to be instantiated from a class template with proper "
8696    "template arguments">;
8697
8698def err_hip_invalid_args_builtin_mangled_name : Error<
8699    "invalid argument: symbol must be a device-side function or global variable">;
8700
8701def warn_hip_omp_target_directives : Warning<
8702  "HIP does not support OpenMP target directives; directive has been ignored">,
8703  InGroup<HIPOpenMPOffloading>, DefaultError;
8704
8705def warn_non_pod_vararg_with_format_string : Warning<
8706  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8707  "%select{function|block|method|constructor}2; expected type from format "
8708  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8709// The arguments to this diagnostic should match the warning above.
8710def err_cannot_pass_objc_interface_to_vararg_format : Error<
8711  "cannot pass object with interface type %1 by value to variadic "
8712  "%select{function|block|method|constructor}2; expected type from format "
8713  "string was %3">;
8714def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8715  "cannot pass non-trivial C object of type %0 by value to variadic "
8716  "%select{function|block|method|constructor}1">;
8717
8718
8719def err_cannot_pass_objc_interface_to_vararg : Error<
8720  "cannot pass object with interface type %0 by value through variadic "
8721  "%select{function|block|method|constructor}1">;
8722def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8723  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8724  " %select{function|block|method|constructor}2; call will abort at runtime">,
8725  InGroup<NonPODVarargs>, DefaultError;
8726def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8727  "passing object of trivial but non-POD type %0 through variadic"
8728  " %select{function|block|method|constructor}1 is incompatible with C++98">,
8729  InGroup<CXX98Compat>, DefaultIgnore;
8730def warn_pass_class_arg_to_vararg : Warning<
8731  "passing object of class type %0 through variadic "
8732  "%select{function|block|method|constructor}1"
8733  "%select{|; did you mean to call '%3'?}2">,
8734  InGroup<ClassVarargs>, DefaultIgnore;
8735def err_cannot_pass_to_vararg : Error<
8736  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8737  "%select{function|block|method|constructor}2">;
8738def err_cannot_pass_to_vararg_format : Error<
8739  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8740  "%select{function|block|method|constructor}2; expected type from format "
8741  "string was %3">;
8742
8743def err_typecheck_call_invalid_ordered_compare : Error<
8744  "ordered compare requires two args of floating point type"
8745  "%diff{ ($ and $)|}0,1">;
8746def err_typecheck_call_invalid_unary_fp : Error<
8747  "floating point classification requires argument of floating point type "
8748  "(passed in %0)">;
8749def err_typecheck_cond_expect_int_float : Error<
8750  "used type %0 where integer or floating point type is required">;
8751def err_typecheck_cond_expect_scalar : Error<
8752  "used type %0 where arithmetic or pointer type is required">;
8753def err_typecheck_cond_expect_nonfloat : Error<
8754  "used type %0 where floating point type is not allowed">;
8755def ext_typecheck_cond_one_void : Extension<
8756  "C99 forbids conditional expressions with only one void side">;
8757def err_typecheck_cast_to_incomplete : Error<
8758  "cast to incomplete type %0">;
8759def ext_typecheck_cast_nonscalar : Extension<
8760  "C99 forbids casting nonscalar type %0 to the same type">;
8761def ext_typecheck_cast_to_union : Extension<
8762  "cast to union type is a GNU extension">,
8763  InGroup<GNUUnionCast>;
8764def err_typecheck_cast_to_union_no_type : Error<
8765  "cast to union type from type %0 not present in union">;
8766def err_cast_pointer_from_non_pointer_int : Error<
8767  "operand of type %0 cannot be cast to a pointer type">;
8768def warn_cast_pointer_from_sel : Warning<
8769  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8770  InGroup<SelTypeCast>;
8771def warn_function_def_in_objc_container : Warning<
8772  "function definition inside an Objective-C container is deprecated">,
8773  InGroup<FunctionDefInObjCContainer>;
8774def err_typecheck_call_requires_real_fp : Error<
8775  "argument type %0 is not a real floating point type">;
8776def err_typecheck_call_different_arg_types : Error<
8777  "arguments are of different types%diff{ ($ vs $)|}0,1">;
8778
8779def warn_cast_calling_conv : Warning<
8780  "cast between incompatible calling conventions '%0' and '%1'; "
8781  "calls through this pointer may abort at runtime">,
8782  InGroup<DiagGroup<"cast-calling-convention">>;
8783def note_change_calling_conv_fixit : Note<
8784  "consider defining %0 with the '%1' calling convention">;
8785def warn_bad_function_cast : Warning<
8786  "cast from function call of type %0 to non-matching type %1">,
8787  InGroup<BadFunctionCast>, DefaultIgnore;
8788def warn_cast_function_type : Warning<
8789  "cast %diff{from $ to $ |}0,1converts to incompatible function type">,
8790  InGroup<CastFunctionType>, DefaultIgnore;
8791def warn_cast_function_type_strict : Warning<warn_cast_function_type.Summary>,
8792  InGroup<CastFunctionTypeStrict>, DefaultIgnore;
8793def err_cast_pointer_to_non_pointer_int : Error<
8794  "pointer cannot be cast to type %0">;
8795def err_nullptr_cast : Error<
8796  "cannot cast an object of type %select{'nullptr_t' to %1|%1 to 'nullptr_t'}0"
8797>;
8798def err_typecheck_expect_scalar_operand : Error<
8799  "operand of type %0 where arithmetic or pointer type is required">;
8800def err_typecheck_cond_incompatible_operands : Error<
8801  "incompatible operand types%diff{ ($ and $)|}0,1">;
8802def err_typecheck_expect_flt_or_vector : Error<
8803  "invalid operand of type %0 where floating, complex or "
8804  "a vector of such types is required">;
8805def err_cast_selector_expr : Error<
8806  "cannot type cast @selector expression">;
8807def err_make_signed_integral_only : Error<
8808  "'%select{make_unsigned|make_signed}0' is only compatible with "
8809  "non-%select{bool|_BitInt(1)}1 integers and enum types, but was given "
8810  "%2%select{| whose underlying type is %4}3">;
8811def ext_typecheck_cond_incompatible_pointers : ExtWarn<
8812  "pointer type mismatch%diff{ ($ and $)|}0,1">,
8813  InGroup<DiagGroup<"pointer-type-mismatch">>;
8814def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
8815  "pointer/integer type mismatch in conditional expression"
8816  "%diff{ ($ and $)|}0,1">,
8817  InGroup<DiagGroup<"conditional-type-mismatch">>;
8818def err_typecheck_choose_expr_requires_constant : Error<
8819  "'__builtin_choose_expr' requires a constant expression">;
8820def warn_unused_expr : Warning<"expression result unused">,
8821  InGroup<UnusedValue>;
8822def warn_unused_comma_left_operand : Warning<
8823  "left operand of comma operator has no effect">,
8824  InGroup<UnusedValue>;
8825def warn_unused_voidptr : Warning<
8826  "expression result unused; should this cast be to 'void'?">,
8827  InGroup<UnusedValue>;
8828def warn_unused_property_expr : Warning<
8829 "property access result unused - getters should not be used for side effects">,
8830  InGroup<UnusedGetterReturnValue>;
8831def warn_unused_container_subscript_expr : Warning<
8832 "container access result unused - container access should not be used for side effects">,
8833  InGroup<UnusedValue>;
8834def warn_unused_call : Warning<
8835  "ignoring return value of function declared with %0 attribute">,
8836  InGroup<UnusedValue>;
8837def warn_unused_constructor : Warning<
8838  "ignoring temporary created by a constructor declared with %0 attribute">,
8839  InGroup<UnusedValue>;
8840def warn_unused_constructor_msg : Warning<
8841  "ignoring temporary created by a constructor declared with %0 attribute: %1">,
8842  InGroup<UnusedValue>;
8843def warn_side_effects_unevaluated_context : Warning<
8844  "expression with side effects has no effect in an unevaluated context">,
8845  InGroup<UnevaluatedExpression>;
8846def warn_side_effects_typeid : Warning<
8847  "expression with side effects will be evaluated despite being used as an "
8848  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
8849def warn_unused_result : Warning<
8850  "ignoring return value of function declared with %0 attribute">,
8851  InGroup<UnusedResult>;
8852def warn_unused_result_msg : Warning<
8853  "ignoring return value of function declared with %0 attribute: %1">,
8854  InGroup<UnusedResult>;
8855def warn_unused_result_typedef_unsupported_spelling : Warning<
8856  "'[[%select{nodiscard|gnu::warn_unused_result}0]]' attribute ignored when "
8857  "applied to a typedef; consider using '__attribute__((warn_unused_result))' "
8858  "or '[[clang::warn_unused_result]]' instead">, InGroup<IgnoredAttributes>;
8859def warn_unused_volatile : Warning<
8860  "expression result unused; assign into a variable to force a volatile load">,
8861  InGroup<DiagGroup<"unused-volatile-lvalue">>;
8862
8863def ext_cxx14_attr : Extension<
8864  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14Attrs>;
8865def ext_cxx17_attr : Extension<
8866  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17Attrs>;
8867def ext_cxx20_attr : Extension<
8868  "use of the %0 attribute is a C++20 extension">, InGroup<CXX20Attrs>;
8869
8870def warn_unused_comparison : Warning<
8871  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
8872  InGroup<UnusedComparison>;
8873def note_inequality_comparison_to_or_assign : Note<
8874  "use '|=' to turn this inequality comparison into an or-assignment">;
8875
8876def err_incomplete_type_used_in_type_trait_expr : Error<
8877  "incomplete type %0 used in type trait expression">;
8878
8879// C++20 constinit and require_constant_initialization attribute
8880def warn_cxx20_compat_constinit : Warning<
8881  "'constinit' specifier is incompatible with C++ standards before C++20">,
8882  InGroup<CXX20Compat>, DefaultIgnore;
8883def err_constinit_local_variable : Error<
8884  "local variable cannot be declared 'constinit'">;
8885def err_require_constant_init_failed : Error<
8886  "variable does not have a constant initializer">;
8887def note_declared_required_constant_init_here : Note<
8888  "required by %select{'require_constant_initialization' attribute|"
8889  "'constinit' specifier}0 here">;
8890def ext_constinit_missing : ExtWarn<
8891  "'constinit' specifier missing on initializing declaration of %0">,
8892  InGroup<DiagGroup<"missing-constinit">>;
8893def note_constinit_specified_here : Note<"variable declared constinit here">;
8894def err_constinit_added_too_late : Error<
8895  "'constinit' specifier added after initialization of variable">;
8896def warn_require_const_init_added_too_late : Warning<
8897  "'require_constant_initialization' attribute added after initialization "
8898  "of variable">, InGroup<IgnoredAttributes>;
8899def note_constinit_missing_here : Note<
8900  "add the "
8901  "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
8902  "to the initializing declaration here">;
8903
8904def err_dimension_expr_not_constant_integer : Error<
8905  "dimension expression does not evaluate to a constant unsigned int">;
8906
8907def err_typecheck_cond_incompatible_operands_null : Error<
8908  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
8909def ext_empty_struct_union : Extension<
8910  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
8911def ext_no_named_members_in_struct_union : Extension<
8912  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
8913def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
8914  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8915  InGroup<CXXCompat>, DefaultIgnore;
8916def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
8917  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8918  InGroup<ExternCCompat>;
8919def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
8920  "volatile qualifiers|const qualifier|volatile qualifier}2">,
8921  InGroup<CastQual>, DefaultIgnore;
8922def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
8923  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
8924def warn_redefine_extname_not_applied : Warning<
8925  "#pragma redefine_extname is applicable to external C declarations only; "
8926  "not applied to %select{function|variable}0 %1">,
8927  InGroup<Pragmas>;
8928} // End of general sema category.
8929
8930// inline asm.
8931let CategoryName = "Inline Assembly Issue" in {
8932  def err_asm_pmf_through_constraint_not_permitted
8933    : Error<"cannot pass a pointer-to-member through register-constrained "
8934            "inline assembly parameter">;
8935  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
8936  def err_asm_invalid_output_constraint : Error<
8937    "invalid output constraint '%0' in asm">;
8938  def err_asm_invalid_lvalue_in_input : Error<
8939    "invalid lvalue in asm input for constraint '%0'">;
8940  def err_asm_invalid_input_constraint : Error<
8941    "invalid input constraint '%0' in asm">;
8942  def err_asm_tying_incompatible_types : Error<
8943    "unsupported inline asm: input with type "
8944    "%diff{$ matching output with type $|}0,1">;
8945  def err_asm_unexpected_constraint_alternatives : Error<
8946    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
8947  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
8948  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
8949  def err_asm_unwind_and_goto : Error<"unwind clobber can't be used with asm goto">;
8950  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
8951    "global register variables on this target">;
8952  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
8953    "match variable size">;
8954  def err_asm_bad_register_type : Error<"bad type for named register variable">;
8955  def err_asm_invalid_input_size : Error<
8956    "invalid input size for constraint '%0'">;
8957  def err_asm_invalid_output_size : Error<
8958    "invalid output size for constraint '%0'">;
8959  def err_invalid_asm_cast_lvalue : Error<
8960    "invalid use of a cast in a inline asm context requiring an lvalue: "
8961    "remove the cast or build with -fheinous-gnu-extensions">;
8962  def err_invalid_asm_value_for_constraint
8963      : Error <"value '%0' out of range for constraint '%1'">;
8964  def err_asm_non_addr_value_in_memory_constraint : Error <
8965    "reference to a %select{bit-field|vector element|global register variable}0"
8966    " in asm %select{input|output}1 with a memory constraint '%2'">;
8967  def err_asm_input_duplicate_match : Error<
8968    "more than one input constraint matches the same output '%0'">;
8969  def err_store_value_to_reg : Error<
8970    "impossible constraint in asm: can't store value into a register">;
8971
8972  def warn_asm_label_on_auto_decl : Warning<
8973    "ignored asm label '%0' on automatic variable">;
8974  def warn_invalid_asm_cast_lvalue : Warning<
8975    "invalid use of a cast in an inline asm context requiring an lvalue: "
8976    "accepted due to -fheinous-gnu-extensions, but clang may remove support "
8977    "for this in the future">;
8978  def warn_asm_mismatched_size_modifier : Warning<
8979    "value size does not match register size specified by the constraint "
8980    "and modifier">,
8981    InGroup<ASMOperandWidths>;
8982
8983  def note_asm_missing_constraint_modifier : Note<
8984    "use constraint modifier \"%0\"">;
8985  def note_asm_input_duplicate_first : Note<
8986    "constraint '%0' is already present here">;
8987 def error_duplicate_asm_operand_name : Error<
8988    "duplicate use of asm operand name \"%0\"">;
8989 def note_duplicate_asm_operand_name : Note<
8990    "asm operand name \"%0\" first referenced here">;
8991}
8992
8993  def error_inoutput_conflict_with_clobber : Error<
8994    "asm-specifier for input or output variable conflicts with asm"
8995    " clobber list">;
8996
8997let CategoryName = "Semantic Issue" in {
8998
8999def err_invalid_conversion_between_matrixes : Error<
9000  "conversion between matrix types%diff{ $ and $|}0,1 of different size is not allowed">;
9001
9002def err_invalid_conversion_between_matrix_and_type : Error<
9003  "conversion between matrix type %0 and incompatible type %1 is not allowed">;
9004
9005def err_invalid_conversion_between_vectors : Error<
9006  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
9007  "size">;
9008def err_invalid_conversion_between_vector_and_integer : Error<
9009  "invalid conversion between vector type %0 and integer type %1 "
9010  "of different size">;
9011
9012def err_opencl_function_pointer : Error<
9013  "%select{pointers|references}0 to functions are not allowed">;
9014
9015def err_opencl_taking_address_capture : Error<
9016  "taking address of a capture is not allowed">;
9017
9018def err_invalid_conversion_between_vector_and_scalar : Error<
9019  "invalid conversion between vector type %0 and scalar type %1">;
9020
9021// C++ member initializers.
9022def err_only_constructors_take_base_inits : Error<
9023  "only constructors take base initializers">;
9024
9025def err_multiple_mem_initialization : Error <
9026  "multiple initializations given for non-static member %0">;
9027def err_multiple_mem_union_initialization : Error <
9028  "initializing multiple members of union">;
9029def err_multiple_base_initialization : Error <
9030  "multiple initializations given for base %0">;
9031
9032def err_mem_init_not_member_or_class : Error<
9033  "member initializer %0 does not name a non-static data member or base "
9034  "class">;
9035
9036def warn_initializer_out_of_order : Warning<
9037  "%select{field|base class}0 %1 will be initialized after "
9038  "%select{field|base}2 %3">,
9039  InGroup<ReorderCtor>, DefaultIgnore;
9040
9041def warn_some_initializers_out_of_order : Warning<
9042  "initializer order does not match the declaration order">,
9043  InGroup<ReorderCtor>, DefaultIgnore;
9044
9045def note_initializer_out_of_order : Note<
9046  "%select{field|base class}0 %1 will be initialized after "
9047  "%select{field|base}2 %3">;
9048
9049def warn_abstract_vbase_init_ignored : Warning<
9050  "initializer for virtual base class %0 of abstract class %1 "
9051  "will never be used">,
9052  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
9053
9054def err_base_init_does_not_name_class : Error<
9055  "constructor initializer %0 does not name a class">;
9056def err_base_init_direct_and_virtual : Error<
9057  "base class initializer %0 names both a direct base class and an "
9058  "inherited virtual base class">;
9059def err_not_direct_base_or_virtual : Error<
9060  "type %0 is not a direct or virtual base of %1">;
9061
9062def err_in_class_initializer_non_const : Error<
9063  "non-const static data member must be initialized out of line">;
9064def err_in_class_initializer_volatile : Error<
9065  "static const volatile data member must be initialized out of line">;
9066def err_in_class_initializer_bad_type : Error<
9067  "static data member of type %0 must be initialized out of line">;
9068def ext_in_class_initializer_float_type : ExtWarn<
9069  "in-class initializer for static data member of type %0 is a GNU extension">,
9070  InGroup<GNUStaticFloatInit>;
9071def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
9072  "in-class initializer for static data member of type %0 requires "
9073  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
9074def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
9075def err_in_class_initializer_literal_type : Error<
9076  "in-class initializer for static data member of type %0 requires "
9077  "'constexpr' specifier">;
9078def err_in_class_initializer_non_constant : Error<
9079  "in-class initializer for static data member is not a constant expression">;
9080def err_default_member_initializer_not_yet_parsed : Error<
9081  "default member initializer for %1 needed within definition of enclosing "
9082  "class %0 outside of member functions">;
9083def note_default_member_initializer_not_yet_parsed : Note<
9084  "default member initializer declared here">;
9085def err_default_member_initializer_cycle
9086    : Error<"default member initializer for %0 uses itself">;
9087
9088def ext_in_class_initializer_non_constant : Extension<
9089  "in-class initializer for static data member is not a constant expression; "
9090  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
9091
9092def err_thread_dynamic_init : Error<
9093  "initializer for thread-local variable must be a constant expression">;
9094def err_thread_nontrivial_dtor : Error<
9095  "type of thread-local variable has non-trivial destruction">;
9096def note_use_thread_local : Note<
9097  "use 'thread_local' to allow this">;
9098
9099// C++ anonymous unions and GNU anonymous structs/unions
9100def ext_anonymous_union : Extension<
9101  "anonymous unions are a C11 extension">, InGroup<C11>;
9102def ext_gnu_anonymous_struct : Extension<
9103  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
9104def ext_c11_anonymous_struct : Extension<
9105  "anonymous structs are a C11 extension">, InGroup<C11>;
9106def err_anonymous_union_not_static : Error<
9107  "anonymous unions at namespace or global scope must be declared 'static'">;
9108def err_anonymous_union_with_storage_spec : Error<
9109  "anonymous union at class scope must not have a storage specifier">;
9110def err_anonymous_struct_not_member : Error<
9111  "anonymous %select{structs|structs and classes}0 must be "
9112  "%select{struct or union|class}0 members">;
9113def err_anonymous_record_member_redecl : Error<
9114  "member of anonymous %select{struct|union}0 redeclares %1">;
9115def err_anonymous_record_with_type : Error<
9116  "types cannot be declared in an anonymous %select{struct|union}0">;
9117def ext_anonymous_record_with_type : Extension<
9118  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
9119  "extension">, InGroup<MicrosoftAnonTag>;
9120def ext_anonymous_record_with_anonymous_type : Extension<
9121  "anonymous types declared in an anonymous %select{struct|union}0 "
9122  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
9123def err_anonymous_record_with_function : Error<
9124  "functions cannot be declared in an anonymous %select{struct|union}0">;
9125def err_anonymous_record_with_static : Error<
9126  "static members cannot be declared in an anonymous %select{struct|union}0">;
9127def err_anonymous_record_bad_member : Error<
9128  "anonymous %select{struct|union}0 can only contain non-static data members">;
9129def err_anonymous_record_nonpublic_member : Error<
9130  "anonymous %select{struct|union}0 cannot contain a "
9131  "%select{private|protected}1 data member">;
9132def ext_ms_anonymous_record : ExtWarn<
9133  "anonymous %select{structs|unions}0 are a Microsoft extension">,
9134  InGroup<MicrosoftAnonTag>;
9135
9136// C++ local classes
9137def err_reference_to_local_in_enclosing_context : Error<
9138  "reference to local %select{variable|binding}1 %0 declared in enclosing "
9139  "%select{%3|block literal|lambda expression|context}2">;
9140def err_capture_binding_openmp : Error<
9141  "capturing a structured binding is not yet supported in OpenMP">;
9142def ext_capture_binding : ExtWarn<
9143  "captured structured bindings are a C++20 extension">, InGroup<CXX20>;
9144def warn_cxx17_compat_capture_binding : Warning<
9145  "captured structured bindings are incompatible with "
9146  "C++ standards before C++20">,
9147  InGroup<CXXPre20Compat>, DefaultIgnore;
9148
9149def err_static_data_member_not_allowed_in_local_class : Error<
9150  "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
9151
9152// C++ derived classes
9153def err_base_clause_on_union : Error<"unions cannot have base classes">;
9154def err_base_must_be_class : Error<"base specifier must name a class">;
9155def err_union_as_base_class : Error<"unions cannot be base classes">;
9156def err_circular_inheritance : Error<
9157  "circular inheritance between %0 and %1">;
9158def err_base_class_has_flexible_array_member : Error<
9159  "base class %0 has a flexible array member">;
9160def err_incomplete_base_class : Error<"base class has incomplete type">;
9161def err_duplicate_base_class : Error<
9162  "base class %0 specified more than once as a direct base class">;
9163def warn_inaccessible_base_class : Warning<
9164  "direct base %0 is inaccessible due to ambiguity:%1">,
9165  InGroup<DiagGroup<"inaccessible-base">>;
9166// FIXME: better way to display derivation?  Pass entire thing into diagclient?
9167def err_ambiguous_derived_to_base_conv : Error<
9168  "ambiguous conversion from derived class %0 to base class %1:%2">;
9169def err_ambiguous_memptr_conv : Error<
9170  "ambiguous conversion from pointer to member of %select{base|derived}0 "
9171  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
9172def ext_ms_ambiguous_direct_base : ExtWarn<
9173  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
9174  InGroup<MicrosoftInaccessibleBase>;
9175
9176def err_memptr_conv_via_virtual : Error<
9177  "conversion from pointer to member of class %0 to pointer to member "
9178  "of class %1 via virtual base %2 is not allowed">;
9179
9180// C++ member name lookup
9181def err_ambiguous_member_multiple_subobjects : Error<
9182  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
9183def err_ambiguous_member_multiple_subobject_types : Error<
9184  "member %0 found in multiple base classes of different types">;
9185def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
9186def note_ambiguous_member_type_found : Note<
9187  "member type %0 found by ambiguous name lookup">;
9188def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
9189def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
9190def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
9191  "declaration in a different namespace">;
9192def note_hidden_tag : Note<"type declaration hidden">;
9193def note_hiding_object : Note<"declaration hides type">;
9194
9195// C++ operator overloading
9196def err_operator_overload_needs_class_or_enum : Error<
9197  "overloaded %0 must have at least one parameter of class "
9198  "or enumeration type">;
9199
9200def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
9201def warn_cxx20_compat_operator_overload_static : Warning<
9202  "declaring overloaded %0 as 'static' is incompatible with C++ standards "
9203  "before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
9204def ext_operator_overload_static : ExtWarn<
9205  "declaring overloaded %0 as 'static' is a C++23 extension">, InGroup<CXX23>;
9206def err_operator_overload_static : Error<
9207  "overloaded %0 cannot be a static member function">;
9208def err_operator_overload_default_arg : Error<
9209  "parameter of overloaded %0 cannot have a default argument">;
9210
9211def ext_subscript_overload : Warning<
9212  "overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a "
9213  "C++23 extension">, InGroup<CXXPre23Compat>, DefaultIgnore;
9214def error_subscript_overload : Error<
9215  "overloaded %0 cannot have %select{no|a defaulted|more than one}1 parameter before C++23">;
9216
9217def err_operator_overload_must_be : Error<
9218  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
9219  "(has %1 parameter%s1)">;
9220
9221def err_operator_overload_must_be_member : Error<
9222  "overloaded %0 must be a non-static member function">;
9223def err_operator_overload_post_incdec_must_be_int : Error<
9224  "parameter of overloaded post-%select{increment|decrement}1 operator must "
9225  "have type 'int' (not %0)">;
9226
9227// C++ allocation and deallocation functions.
9228def err_operator_new_delete_declared_in_namespace : Error<
9229  "%0 cannot be declared inside a namespace">;
9230def err_operator_new_delete_declared_static : Error<
9231  "%0 cannot be declared static in global scope">;
9232def ext_operator_new_delete_declared_inline : ExtWarn<
9233  "replacement function %0 cannot be declared 'inline'">,
9234  InGroup<DiagGroup<"inline-new-delete">>;
9235def err_operator_new_delete_invalid_result_type : Error<
9236  "%0 must return type %1">;
9237def err_operator_new_delete_dependent_result_type : Error<
9238  "%0 cannot have a dependent return type; use %1 instead">;
9239def err_operator_new_delete_too_few_parameters : Error<
9240  "%0 must have at least one parameter">;
9241def err_operator_new_delete_template_too_few_parameters : Error<
9242  "%0 template must have at least two parameters">;
9243def warn_operator_new_returns_null : Warning<
9244  "%0 should not return a null pointer unless it is declared 'throw()'"
9245  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
9246
9247def err_operator_new_dependent_param_type : Error<
9248  "%0 cannot take a dependent type as first parameter; "
9249  "use size_t (%1) instead">;
9250def err_operator_new_param_type : Error<
9251  "%0 takes type size_t (%1) as first parameter">;
9252def err_operator_new_default_arg: Error<
9253  "parameter of %0 cannot have a default argument">;
9254def err_operator_delete_dependent_param_type : Error<
9255  "%0 cannot take a dependent type as first parameter; use %1 instead">;
9256def err_operator_delete_param_type : Error<
9257  "first parameter of %0 must have type %1">;
9258def err_destroying_operator_delete_not_usual : Error<
9259  "destroying operator delete can have only an optional size and optional "
9260  "alignment parameter">;
9261def note_implicit_delete_this_in_destructor_here : Note<
9262  "while checking implicit 'delete this' for virtual destructor">;
9263def err_builtin_operator_new_delete_not_usual : Error<
9264  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
9265  "selects non-usual %select{allocation|deallocation}0 function">;
9266def note_non_usual_function_declared_here : Note<
9267  "non-usual %0 declared here">;
9268
9269// C++ literal operators
9270def err_literal_operator_outside_namespace : Error<
9271  "literal operator %0 must be in a namespace or global scope">;
9272def err_literal_operator_id_outside_namespace : Error<
9273  "non-namespace scope '%0' cannot have a literal operator member">;
9274def err_literal_operator_default_argument : Error<
9275  "literal operator cannot have a default argument">;
9276def err_literal_operator_bad_param_count : Error<
9277  "non-template literal operator must have one or two parameters">;
9278def err_literal_operator_invalid_param : Error<
9279  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
9280def err_literal_operator_param : Error<
9281  "invalid literal operator parameter type %0, did you mean %1?">;
9282def err_literal_operator_template_with_params : Error<
9283  "literal operator template cannot have any parameters">;
9284def err_literal_operator_template : Error<
9285  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
9286def err_literal_operator_extern_c : Error<
9287  "literal operator must have C++ linkage">;
9288def ext_string_literal_operator_template : ExtWarn<
9289  "string literal operator templates are a GNU extension">,
9290  InGroup<GNUStringLiteralOperatorTemplate>;
9291def warn_user_literal_reserved : Warning<
9292  "user-defined literal suffixes %select{<ERROR>|not starting with '_'|containing '__'}0 are reserved"
9293  "%select{; no literal will invoke this operator|}1">,
9294  InGroup<UserDefinedLiterals>;
9295
9296// C++ conversion functions
9297def err_conv_function_not_member : Error<
9298  "conversion function must be a non-static member function">;
9299def err_conv_function_return_type : Error<
9300  "conversion function cannot have a return type">;
9301def err_conv_function_with_params : Error<
9302  "conversion function cannot have any parameters">;
9303def err_conv_function_variadic : Error<
9304  "conversion function cannot be variadic">;
9305def err_conv_function_to_array : Error<
9306  "conversion function cannot convert to an array type">;
9307def err_conv_function_to_function : Error<
9308  "conversion function cannot convert to a function type">;
9309def err_conv_function_with_complex_decl : Error<
9310  "cannot specify any part of a return type in the "
9311  "declaration of a conversion function"
9312  "%select{"
9313  "; put the complete type after 'operator'|"
9314  "; use a typedef to declare a conversion to %1|"
9315  "; use an alias template to declare a conversion to %1|"
9316  "}0">;
9317def err_conv_function_redeclared : Error<
9318  "conversion function cannot be redeclared">;
9319def warn_conv_to_self_not_used : Warning<
9320  "conversion function converting %0 to itself will never be used">,
9321  InGroup<ClassConversion>;
9322def warn_conv_to_base_not_used : Warning<
9323  "conversion function converting %0 to its base class %1 will never be used">,
9324  InGroup<ClassConversion>;
9325def warn_conv_to_void_not_used : Warning<
9326  "conversion function converting %0 to %1 will never be used">,
9327  InGroup<ClassConversion>;
9328
9329def warn_not_compound_assign : Warning<
9330  "use of unary operator that may be intended as compound assignment (%0=)">;
9331
9332// C++11 explicit conversion operators
9333def ext_explicit_conversion_functions : ExtWarn<
9334  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
9335def warn_cxx98_compat_explicit_conversion_functions : Warning<
9336  "explicit conversion functions are incompatible with C++98">,
9337  InGroup<CXX98Compat>, DefaultIgnore;
9338
9339// C++11 defaulted functions
9340def err_defaulted_special_member_params : Error<
9341  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
9342  "have default arguments">;
9343def err_defaulted_special_member_variadic : Error<
9344  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
9345  "be variadic">;
9346def err_defaulted_special_member_return_type : Error<
9347  "explicitly-defaulted %select{copy|move}0 assignment operator must "
9348  "return %1">;
9349def err_defaulted_special_member_quals : Error<
9350  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
9351  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
9352def err_defaulted_special_member_volatile_param : Error<
9353  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
9354  "may not be volatile">;
9355def err_defaulted_special_member_move_const_param : Error<
9356  "the parameter for an explicitly-defaulted move "
9357  "%select{constructor|assignment operator}0 may not be const">;
9358def err_defaulted_special_member_copy_const_param : Error<
9359  "the parameter for this explicitly-defaulted copy "
9360  "%select{constructor|assignment operator}0 is const, but a member or base "
9361  "requires it to be non-const">;
9362def err_defaulted_copy_assign_not_ref : Error<
9363  "the parameter for an explicitly-defaulted copy assignment operator must be an "
9364  "lvalue reference type">;
9365def err_incorrect_defaulted_constexpr : Error<
9366  "defaulted definition of %sub{select_special_member_kind}0 "
9367  "is not constexpr">;
9368def err_incorrect_defaulted_consteval : Error<
9369  "defaulted declaration of %sub{select_special_member_kind}0 "
9370  "cannot be consteval because implicit definition is not constexpr">;
9371def warn_defaulted_method_deleted : Warning<
9372  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
9373  "deleted">, InGroup<DefaultedFunctionDeleted>;
9374def note_replace_equals_default_to_delete : Note<
9375  "replace 'default' with 'delete'">;
9376def err_out_of_line_default_deletes : Error<
9377  "defaulting this %sub{select_special_member_kind}0 "
9378  "would delete it after its first declaration">;
9379def note_deleted_type_mismatch : Note<
9380  "function is implicitly deleted because its declared type does not match "
9381  "the type of an implicit %sub{select_special_member_kind}0">;
9382def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
9383  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
9384  "different from the implicit type is incompatible with C++ standards before "
9385  "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9386def warn_vbase_moved_multiple_times : Warning<
9387  "defaulted move assignment operator of %0 will move assign virtual base "
9388  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
9389def note_vbase_moved_here : Note<
9390  "%select{%1 is a virtual base class of base class %2 declared here|"
9391  "virtual base class %1 declared here}0">;
9392
9393// C++20 defaulted comparisons
9394// This corresponds to values of Sema::DefaultedComparisonKind.
9395def select_defaulted_comparison_kind : TextSubstitution<
9396  "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
9397  "operator">;
9398def ext_defaulted_comparison : ExtWarn<
9399  "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
9400def warn_cxx17_compat_defaulted_comparison : Warning<
9401  "defaulted comparison operators are incompatible with C++ standards "
9402  "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9403def err_defaulted_comparison_template : Error<
9404  "comparison operator template cannot be defaulted">;
9405def err_defaulted_comparison_num_args : Error<
9406  "%select{non-member|member}0 %sub{select_defaulted_comparison_kind}1"
9407  " comparison operator must have %select{2|1}0 parameters">;
9408def err_defaulted_comparison_param : Error<
9409  "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
9410  "; found %1, expected %2%select{| or %4}3">;
9411def err_defaulted_comparison_param_unknown : Error<
9412  "invalid parameter type for non-member defaulted"
9413  " %sub{select_defaulted_comparison_kind}0"
9414  "; found %1, expected class or reference to a constant class">;
9415def err_defaulted_comparison_param_mismatch : Error<
9416  "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
9417  "must have the same type%diff{ (found $ vs $)|}1,2">;
9418def err_defaulted_comparison_not_friend : Error<
9419  "%sub{select_defaulted_comparison_kind}0 is not a friend of"
9420  " %select{|incomplete class }1%2">;
9421def err_defaulted_comparison_non_const : Error<
9422  "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
9423  "const-qualified">;
9424def err_defaulted_comparison_return_type_not_bool : Error<
9425  "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9426  "must be 'bool', not %1">;
9427def err_defaulted_comparison_deduced_return_type_not_auto : Error<
9428  "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9429  "must be 'auto', not %1">;
9430def warn_defaulted_comparison_deleted : Warning<
9431  "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
9432  "deleted">, InGroup<DefaultedFunctionDeleted>;
9433def err_non_first_default_compare_deletes : Error<
9434  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
9435  "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
9436  "would delete it after its first declaration">;
9437def err_non_first_default_compare_in_class : Error<
9438  "defaulting this %sub{select_defaulted_comparison_kind}0 "
9439  "is not allowed because it was already declared outside the class">;
9440def note_defaulted_comparison_union : Note<
9441  "defaulted %0 is implicitly deleted because "
9442  "%2 is a %select{union-like class|union}1 with variant members">;
9443def note_defaulted_comparison_reference_member : Note<
9444  "defaulted %0 is implicitly deleted because "
9445  "class %1 has a reference member">;
9446def note_defaulted_comparison_ambiguous : Note<
9447  "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
9448  "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
9449def note_defaulted_comparison_inaccessible : Note<
9450  "defaulted %0 is implicitly deleted because it would invoke a "
9451  "%select{private|protected}3 %4%select{ member of %6|"
9452  " member of %6 to compare member %2| to compare base class %2}1">;
9453def note_defaulted_comparison_calls_deleted : Note<
9454  "defaulted %0 is implicitly deleted because it would invoke a deleted "
9455  "comparison function%select{| for member %2| for base class %2}1">;
9456def note_defaulted_comparison_no_viable_function : Note<
9457  "defaulted %0 is implicitly deleted because there is no viable "
9458  "%select{three-way comparison function|'operator=='}1 for "
9459  "%select{|member |base class }2%3">;
9460def note_defaulted_comparison_no_viable_function_synthesized : Note<
9461  "three-way comparison cannot be synthesized because there is no viable "
9462  "function for %select{'=='|'<'}0 comparison">;
9463def note_defaulted_comparison_not_rewritten_callee : Note<
9464  "defaulted %0 is implicitly deleted because this non-rewritten comparison "
9465  "function would be the best match for the comparison">;
9466def note_defaulted_comparison_not_rewritten_conversion : Note<
9467  "defaulted %0 is implicitly deleted because a builtin comparison function "
9468  "using this conversion would be the best match for the comparison">;
9469def note_defaulted_comparison_cannot_deduce : Note<
9470  "return type of defaulted 'operator<=>' cannot be deduced because "
9471  "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
9472  "is not a standard comparison category type">;
9473def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
9474  "return type of defaulted 'operator<=>' cannot be deduced because "
9475  "three-way comparison for %select{|member|base class}0 %1 "
9476  "has a deduced return type and is not yet defined">;
9477def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
9478  "%select{|member|base class}0 %1 declared here">;
9479def note_defaulted_comparison_cannot_deduce_callee : Note<
9480  "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
9481def ext_defaulted_comparison_constexpr_mismatch : Extension<
9482  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9483  "three-way comparison operator}0 that is "
9484  "declared %select{constexpr|consteval}2 but"
9485  "%select{|for which the corresponding implicit 'operator==' }0 "
9486  "invokes a non-constexpr comparison function is a C++23 extension">,
9487  InGroup<DiagGroup<"c++23-default-comp-relaxed-constexpr">>;
9488def warn_cxx23_compat_defaulted_comparison_constexpr_mismatch : Warning<
9489  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9490  "three-way comparison operator}0 that is "
9491  "declared %select{constexpr|consteval}2 but"
9492  "%select{|for which the corresponding implicit 'operator==' }0 "
9493  "invokes a non-constexpr comparison function is incompatible with C++ "
9494  "standards before C++23">,
9495  InGroup<CXXPre23Compat>, DefaultIgnore;
9496def note_defaulted_comparison_not_constexpr : Note<
9497  "non-constexpr comparison function would be used to compare "
9498  "%select{|member %1|base class %1}0">;
9499def note_defaulted_comparison_not_constexpr_here : Note<
9500  "non-constexpr comparison function declared here">;
9501def note_in_declaration_of_implicit_equality_comparison : Note<
9502  "while declaring the corresponding implicit 'operator==' "
9503  "for this defaulted 'operator<=>'">;
9504def err_volatile_comparison_operator : Error<
9505  "defaulted comparison function must not be volatile">;
9506def err_ref_qualifier_comparison_operator : Error<
9507  "ref-qualifier '&&' is not allowed on a defaulted comparison operator">;
9508
9509def ext_implicit_exception_spec_mismatch : ExtWarn<
9510  "function previously declared with an %select{explicit|implicit}0 exception "
9511  "specification redeclared with an %select{implicit|explicit}0 exception "
9512  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
9513
9514def warn_ptr_arith_precedes_bounds : Warning<
9515  "the pointer decremented by %0 refers before the beginning of the array">,
9516  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9517def warn_ptr_arith_exceeds_bounds : Warning<
9518  "the pointer incremented by %0 refers past the end of the array (that has type %1)">,
9519  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9520def warn_array_index_precedes_bounds : Warning<
9521  "array index %0 is before the beginning of the array">,
9522  InGroup<ArrayBounds>;
9523def warn_array_index_exceeds_bounds : Warning<
9524  "array index %0 is past the end of the array (that has type %1%select{|, cast to %3}2)">,
9525  InGroup<ArrayBounds>;
9526def warn_ptr_arith_exceeds_max_addressable_bounds : Warning<
9527  "the pointer incremented by %0 refers past the last possible element for an array in %1-bit "
9528  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9529  InGroup<ArrayBounds>;
9530def warn_array_index_exceeds_max_addressable_bounds : Warning<
9531  "array index %0 refers past the last possible element for an array in %1-bit "
9532  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9533  InGroup<ArrayBounds>;
9534def note_array_declared_here : Note<
9535  "array %0 declared here">;
9536
9537def warn_inconsistent_array_form : Warning<
9538  "argument %0 of type %1 with mismatched bound">,
9539  InGroup<ArrayParameter>, DefaultIgnore;
9540def note_previous_declaration_as : Note<
9541  "previously declared as %0 here">;
9542
9543def warn_printf_insufficient_data_args : Warning<
9544  "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
9545def warn_printf_data_arg_not_used : Warning<
9546  "data argument not used by format string">, InGroup<FormatExtraArgs>;
9547def warn_format_invalid_conversion : Warning<
9548  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
9549def warn_printf_incomplete_specifier : Warning<
9550  "incomplete format specifier">, InGroup<Format>;
9551def warn_missing_format_string : Warning<
9552  "format string missing">, InGroup<Format>;
9553def warn_scanf_nonzero_width : Warning<
9554  "zero field width in scanf format string is unused">,
9555  InGroup<Format>;
9556def warn_format_conversion_argument_type_mismatch : Warning<
9557  "format specifies type %0 but the argument has "
9558  "%select{type|underlying type}2 %1">,
9559  InGroup<Format>;
9560def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
9561  warn_format_conversion_argument_type_mismatch.Summary>,
9562  InGroup<FormatPedantic>;
9563def warn_format_conversion_argument_type_mismatch_confusion : Warning<
9564  warn_format_conversion_argument_type_mismatch.Summary>,
9565  InGroup<FormatTypeConfusion>, DefaultIgnore;
9566def warn_format_argument_needs_cast : Warning<
9567  "%select{values of type|enum values with underlying type}2 '%0' should not "
9568  "be used as format arguments; add an explicit cast to %1 instead">,
9569  InGroup<Format>;
9570def warn_format_argument_needs_cast_pedantic : Warning<
9571  warn_format_argument_needs_cast.Summary>,
9572  InGroup<FormatPedantic>, DefaultIgnore;
9573def warn_printf_positional_arg_exceeds_data_args : Warning <
9574  "data argument position '%0' exceeds the number of data arguments (%1)">,
9575  InGroup<Format>;
9576def warn_format_zero_positional_specifier : Warning<
9577  "position arguments in format strings start counting at 1 (not 0)">,
9578  InGroup<Format>;
9579def warn_format_invalid_positional_specifier : Warning<
9580  "invalid position specified for %select{field width|field precision}0">,
9581  InGroup<Format>;
9582def warn_format_mix_positional_nonpositional_args : Warning<
9583  "cannot mix positional and non-positional arguments in format string">,
9584  InGroup<Format>;
9585def warn_static_array_too_small : Warning<
9586  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
9587  " callee requires at least %1">,
9588  InGroup<ArrayBounds>;
9589def note_callee_static_array : Note<
9590  "callee declares array parameter as static here">;
9591def warn_empty_format_string : Warning<
9592  "format string is empty">, InGroup<FormatZeroLength>;
9593def warn_format_string_is_wide_literal : Warning<
9594  "format string should not be a wide string">, InGroup<Format>;
9595def warn_printf_format_string_contains_null_char : Warning<
9596  "format string contains '\\0' within the string body">, InGroup<Format>;
9597def warn_printf_format_string_not_null_terminated : Warning<
9598  "format string is not null-terminated">, InGroup<Format>;
9599def warn_printf_asterisk_missing_arg : Warning<
9600  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
9601  InGroup<Format>;
9602def warn_printf_asterisk_wrong_type : Warning<
9603  "field %select{width|precision}0 should have type %1, but argument has type %2">,
9604  InGroup<Format>;
9605def warn_printf_nonsensical_optional_amount: Warning<
9606  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
9607  InGroup<Format>;
9608def warn_printf_nonsensical_flag: Warning<
9609  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
9610  InGroup<Format>;
9611def warn_format_nonsensical_length: Warning<
9612  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
9613  InGroup<Format>;
9614def warn_format_non_standard_positional_arg: Warning<
9615  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
9616def warn_format_non_standard: Warning<
9617  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
9618  InGroup<FormatNonStandard>, DefaultIgnore;
9619def warn_format_non_standard_conversion_spec: Warning<
9620  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
9621  InGroup<FormatNonStandard>, DefaultIgnore;
9622def err_invalid_mask_type_size : Error<
9623  "mask type size must be between 1-byte and 8-bytes">;
9624def warn_format_invalid_annotation : Warning<
9625  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
9626  InGroup<Format>;
9627def warn_format_P_no_precision : Warning<
9628  "using '%%P' format specifier without precision">,
9629  InGroup<Format>;
9630def warn_printf_ignored_flag: Warning<
9631  "flag '%0' is ignored when flag '%1' is present">,
9632  InGroup<Format>;
9633def warn_printf_empty_objc_flag: Warning<
9634  "missing object format flag">,
9635  InGroup<Format>;
9636def warn_printf_ObjCflags_without_ObjCConversion: Warning<
9637  "object format flags cannot be used with '%0' conversion specifier">,
9638  InGroup<Format>;
9639def warn_printf_invalid_objc_flag: Warning<
9640    "'%0' is not a valid object format flag">,
9641    InGroup<Format>;
9642def warn_printf_narg_not_supported : Warning<
9643    "'%%n' specifier not supported on this platform">,
9644    InGroup<Format>;
9645def warn_scanf_scanlist_incomplete : Warning<
9646  "no closing ']' for '%%[' in scanf format string">,
9647  InGroup<Format>;
9648def warn_format_bool_as_character : Warning<
9649  "using '%0' format specifier, but argument has boolean value">,
9650  InGroup<Format>;
9651def note_format_string_defined : Note<"format string is defined here">;
9652def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
9653def note_printf_c_str: Note<"did you mean to call the %0 method?">;
9654def note_format_security_fixit: Note<
9655  "treat the string as an argument to avoid this">;
9656
9657def warn_null_arg : Warning<
9658  "null passed to a callee that requires a non-null argument">,
9659  InGroup<NonNull>;
9660def warn_null_ret : Warning<
9661  "null returned from %select{function|method}0 that requires a non-null return value">,
9662  InGroup<NonNull>;
9663
9664def err_lifetimebound_no_object_param : Error<
9665  "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
9666  "function has no implicit object parameter">;
9667def err_lifetimebound_ctor_dtor : Error<
9668  "'lifetimebound' attribute cannot be applied to a "
9669  "%select{constructor|destructor}0">;
9670
9671// CHECK: returning address/reference of stack memory
9672def warn_ret_stack_addr_ref : Warning<
9673  "%select{address of|reference to}0 stack memory associated with "
9674  "%select{local variable|parameter}2 %1 returned">,
9675  InGroup<ReturnStackAddress>;
9676def warn_ret_local_temp_addr_ref : Warning<
9677  "returning %select{address of|reference to}0 local temporary object">,
9678  InGroup<ReturnStackAddress>;
9679def warn_ret_addr_label : Warning<
9680  "returning address of label, which is local">,
9681  InGroup<ReturnStackAddress>;
9682def err_ret_local_block : Error<
9683  "returning block that lives on the local stack">;
9684def note_local_var_initializer : Note<
9685  "%select{via initialization of|binding reference}0 variable "
9686  "%select{%2 |}1here">;
9687def note_lambda_capture_initializer : Note<
9688  "%select{implicitly |}2captured%select{| by reference}3"
9689  "%select{%select{ due to use|}2 here|"
9690  " via initialization of lambda capture %0}1">;
9691def note_init_with_default_member_initializer : Note<
9692  "initializing field %0 with default member initializer">;
9693
9694// Check for initializing a member variable with the address or a reference to
9695// a constructor parameter.
9696def warn_bind_ref_member_to_parameter : Warning<
9697  "binding reference member %0 to stack allocated "
9698  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9699def warn_init_ptr_member_to_parameter_addr : Warning<
9700  "initializing pointer member %0 with the stack address of "
9701  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9702def note_ref_or_ptr_member_declared_here : Note<
9703  "%select{reference|pointer}0 member declared here">;
9704
9705def err_dangling_member : Error<
9706  "%select{reference|backing array for 'std::initializer_list'}2 "
9707  "%select{|subobject of }1member %0 "
9708  "%select{binds to|is}2 a temporary object "
9709  "whose lifetime would be shorter than the lifetime of "
9710  "the constructed object">;
9711def warn_dangling_member : Warning<
9712  "%select{reference|backing array for 'std::initializer_list'}2 "
9713  "%select{|subobject of }1member %0 "
9714  "%select{binds to|is}2 a temporary object "
9715  "whose lifetime is shorter than the lifetime of the constructed object">,
9716  InGroup<DanglingField>;
9717def warn_dangling_lifetime_pointer_member : Warning<
9718  "initializing pointer member %0 to point to a temporary object "
9719  "whose lifetime is shorter than the lifetime of the constructed object">,
9720  InGroup<DanglingGsl>;
9721def note_lifetime_extending_member_declared_here : Note<
9722  "%select{%select{reference|'std::initializer_list'}0 member|"
9723  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
9724  "declared here">;
9725def warn_dangling_variable : Warning<
9726  "%select{temporary %select{whose address is used as value of|"
9727  "%select{|implicitly }2bound to}4 "
9728  "%select{%select{|reference }4member of local variable|"
9729  "local %select{variable|reference}4}1|"
9730  "array backing "
9731  "%select{initializer list subobject of local variable|"
9732  "local initializer list}1}0 "
9733  "%select{%3 |}2will be destroyed at the end of the full-expression">,
9734  InGroup<Dangling>;
9735def warn_new_dangling_reference : Warning<
9736  "temporary bound to reference member of allocated object "
9737  "will be destroyed at the end of the full-expression">,
9738  InGroup<DanglingField>;
9739def warn_dangling_lifetime_pointer : Warning<
9740  "object backing the pointer "
9741  "will be destroyed at the end of the full-expression">,
9742  InGroup<DanglingGsl>;
9743def warn_new_dangling_initializer_list : Warning<
9744  "array backing "
9745  "%select{initializer list subobject of the allocated object|"
9746  "the allocated initializer list}0 "
9747  "will be destroyed at the end of the full-expression">,
9748  InGroup<DanglingInitializerList>;
9749def warn_unsupported_lifetime_extension : Warning<
9750  "sorry, lifetime extension of "
9751  "%select{temporary|backing array of initializer list}0 created "
9752  "by aggregate initialization using default member initializer "
9753  "is not supported; lifetime of %select{temporary|backing array}0 "
9754  "will end at the end of the full-expression">, InGroup<Dangling>;
9755
9756// For non-floating point, expressions of the form x == x or x != x
9757// should result in a warning, since these always evaluate to a constant.
9758// Array comparisons have similar warnings
9759def warn_comparison_always : Warning<
9760  "%select{self-|array }0comparison always evaluates to "
9761  "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9762  InGroup<TautologicalCompare>;
9763def warn_comparison_bitwise_always : Warning<
9764  "bitwise comparison always evaluates to %select{false|true}0">,
9765  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9766def warn_comparison_bitwise_or : Warning<
9767  "bitwise or with non-zero value always evaluates to true">,
9768  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9769def warn_tautological_overlap_comparison : Warning<
9770  "overlapping comparisons always evaluate to %select{false|true}0">,
9771  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9772def warn_depr_array_comparison : Warning<
9773  "comparison between two arrays is deprecated; "
9774  "to compare array addresses, use unary '+' to decay operands to pointers">,
9775  InGroup<DeprecatedArrayCompare>;
9776
9777def warn_stringcompare : Warning<
9778  "result of comparison against %select{a string literal|@encode}0 is "
9779  "unspecified (use an explicit string comparison function instead)">,
9780  InGroup<StringCompare>;
9781
9782def warn_identity_field_assign : Warning<
9783  "assigning %select{field|instance variable}0 to itself">,
9784  InGroup<SelfAssignmentField>;
9785
9786// Type safety attributes
9787def err_type_tag_for_datatype_not_ice : Error<
9788  "'type_tag_for_datatype' attribute requires the initializer to be "
9789  "an %select{integer|integral}0 constant expression">;
9790def err_type_tag_for_datatype_too_large : Error<
9791  "'type_tag_for_datatype' attribute requires the initializer to be "
9792  "an %select{integer|integral}0 constant expression "
9793  "that can be represented by a 64 bit integer">;
9794def err_tag_index_out_of_range : Error<
9795  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
9796def warn_type_tag_for_datatype_wrong_kind : Warning<
9797  "this type tag was not designed to be used with this function">,
9798  InGroup<TypeSafety>;
9799def warn_type_safety_type_mismatch : Warning<
9800  "argument type %0 doesn't match specified %1 type tag "
9801  "%select{that requires %3|}2">, InGroup<TypeSafety>;
9802def warn_type_safety_null_pointer_required : Warning<
9803  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
9804
9805// Generic selections.
9806def err_assoc_type_incomplete : Error<
9807  "type %0 in generic association incomplete">;
9808def err_assoc_type_nonobject : Error<
9809  "type %0 in generic association not an object type">;
9810def err_assoc_type_variably_modified : Error<
9811  "type %0 in generic association is a variably modified type">;
9812def err_assoc_compatible_types : Error<
9813  "type %0 in generic association compatible with previously specified type %1">;
9814def note_compat_assoc : Note<
9815  "compatible type %0 specified here">;
9816def err_generic_sel_no_match : Error<
9817  "controlling expression type %0 not compatible with any generic association type">;
9818def err_generic_sel_multi_match : Error<
9819  "controlling expression type %0 compatible with %1 generic association types">;
9820
9821
9822// Blocks
9823def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
9824  " or %select{pick a deployment target that supports them|for OpenCL C 2.0"
9825  " or OpenCL C 3.0 with __opencl_c_device_enqueue feature}0">;
9826def err_block_returning_array_function : Error<
9827  "block cannot return %select{array|function}0 type %1">;
9828
9829// Builtin annotation
9830def err_builtin_annotation_first_arg : Error<
9831  "first argument to __builtin_annotation must be an integer">;
9832def err_builtin_annotation_second_arg : Error<
9833  "second argument to __builtin_annotation must be a non-wide string constant">;
9834def err_msvc_annotation_wide_str : Error<
9835  "arguments to __annotation must be wide string constants">;
9836
9837// CFString checking
9838def err_cfstring_literal_not_string_constant : Error<
9839  "CFString literal is not a string constant">;
9840def warn_cfstring_truncated : Warning<
9841  "input conversion stopped due to an input byte that does not "
9842  "belong to the input codeset UTF-8">,
9843  InGroup<DiagGroup<"CFString-literal">>;
9844
9845// os_log checking
9846// TODO: separate diagnostic for os_trace()
9847def err_os_log_format_not_string_constant : Error<
9848  "os_log() format argument is not a string constant">;
9849def err_os_log_argument_too_big : Error<
9850  "os_log() argument %0 is too big (%1 bytes, max %2)">;
9851def warn_os_log_format_narg : Error<
9852 "os_log() '%%n' format specifier is not allowed">, DefaultError;
9853
9854// Statements.
9855def err_continue_not_in_loop : Error<
9856  "'continue' statement not in loop statement">;
9857def err_break_not_in_loop_or_switch : Error<
9858  "'break' statement not in loop or switch statement">;
9859def warn_loop_ctrl_binds_to_inner : Warning<
9860  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
9861  InGroup<GccCompat>;
9862def warn_break_binds_to_switch : Warning<
9863  "'break' is bound to loop, GCC binds it to switch">,
9864  InGroup<GccCompat>;
9865def err_default_not_in_switch : Error<
9866  "'default' statement not in switch statement">;
9867def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
9868def warn_bool_switch_condition : Warning<
9869  "switch condition has boolean value">, InGroup<SwitchBool>;
9870def warn_case_value_overflow : Warning<
9871  "overflow converting case value to switch condition type (%0 to %1)">,
9872  InGroup<Switch>;
9873def err_duplicate_case : Error<"duplicate case value '%0'">;
9874def err_duplicate_case_differing_expr : Error<
9875  "duplicate case value: '%0' and '%1' both equal '%2'">;
9876def warn_case_empty_range : Warning<"empty case range specified">;
9877def warn_missing_case_for_condition :
9878  Warning<"no case matching constant switch condition '%0'">;
9879
9880def warn_def_missing_case : Warning<"%plural{"
9881  "1:enumeration value %1 not explicitly handled in switch|"
9882  "2:enumeration values %1 and %2 not explicitly handled in switch|"
9883  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
9884  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
9885  InGroup<SwitchEnum>, DefaultIgnore;
9886
9887def warn_missing_case : Warning<"%plural{"
9888  "1:enumeration value %1 not handled in switch|"
9889  "2:enumeration values %1 and %2 not handled in switch|"
9890  "3:enumeration values %1, %2, and %3 not handled in switch|"
9891  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
9892  InGroup<Switch>;
9893
9894def warn_unannotated_fallthrough : Warning<
9895  "unannotated fall-through between switch labels">,
9896  InGroup<ImplicitFallthrough>, DefaultIgnore;
9897def warn_unannotated_fallthrough_per_function : Warning<
9898  "unannotated fall-through between switch labels in partly-annotated "
9899  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
9900def note_insert_fallthrough_fixit : Note<
9901  "insert '%0;' to silence this warning">;
9902def note_insert_break_fixit : Note<
9903  "insert 'break;' to avoid fall-through">;
9904def err_fallthrough_attr_wrong_target : Error<
9905  "%0 attribute is only allowed on empty statements">;
9906def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
9907def err_fallthrough_attr_outside_switch : Error<
9908  "fallthrough annotation is outside switch statement">;
9909def err_fallthrough_attr_invalid_placement : Error<
9910  "fallthrough annotation does not directly precede switch label">;
9911
9912def warn_unreachable_default : Warning<
9913  "default label in switch which covers all enumeration values">,
9914  InGroup<CoveredSwitchDefault>, DefaultIgnore;
9915def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
9916  InGroup<Switch>;
9917def warn_not_in_enum_assignment : Warning<"integer constant not in range "
9918  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
9919def err_typecheck_statement_requires_scalar : Error<
9920  "statement requires expression of scalar type (%0 invalid)">;
9921def err_typecheck_statement_requires_integer : Error<
9922  "statement requires expression of integer type (%0 invalid)">;
9923def err_multiple_default_labels_defined : Error<
9924  "multiple default labels in one switch">;
9925def err_switch_multiple_conversions : Error<
9926  "multiple conversions from switch condition type %0 to an integral or "
9927  "enumeration type">;
9928def note_switch_conversion : Note<
9929  "conversion to %select{integral|enumeration}0 type %1">;
9930def err_switch_explicit_conversion : Error<
9931  "switch condition type %0 requires explicit conversion to %1">;
9932def err_switch_incomplete_class_type : Error<
9933  "switch condition has incomplete class type %0">;
9934
9935def warn_empty_if_body : Warning<
9936  "if statement has empty body">, InGroup<EmptyBody>;
9937def warn_empty_for_body : Warning<
9938  "for loop has empty body">, InGroup<EmptyBody>;
9939def warn_empty_range_based_for_body : Warning<
9940  "range-based for loop has empty body">, InGroup<EmptyBody>;
9941def warn_empty_while_body : Warning<
9942  "while loop has empty body">, InGroup<EmptyBody>;
9943def warn_empty_switch_body : Warning<
9944  "switch statement has empty body">, InGroup<EmptyBody>;
9945def note_empty_body_on_separate_line : Note<
9946  "put the semicolon on a separate line to silence this warning">;
9947
9948def err_va_start_captured_stmt : Error<
9949  "'va_start' cannot be used in a captured statement">;
9950def err_va_start_outside_function : Error<
9951  "'va_start' cannot be used outside a function">;
9952def err_va_start_fixed_function : Error<
9953  "'va_start' used in function with fixed args">;
9954def err_va_start_used_in_wrong_abi_function : Error<
9955  "'va_start' used in %select{System V|Win64}0 ABI function">;
9956def err_ms_va_start_used_in_sysv_function : Error<
9957  "'__builtin_ms_va_start' used in System V ABI function">;
9958def warn_second_arg_of_va_start_not_last_named_param : Warning<
9959  "second argument to 'va_start' is not the last named parameter">,
9960  InGroup<Varargs>;
9961def warn_c17_compat_ellipsis_only_parameter : Warning<
9962  "'...' as the only parameter of a function is incompatible with C standards "
9963  "before C2x">, DefaultIgnore, InGroup<CPre2xCompat>;
9964def warn_va_start_type_is_undefined : Warning<
9965  "passing %select{an object that undergoes default argument promotion|"
9966  "an object of reference type|a parameter declared with the 'register' "
9967  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
9968def err_first_argument_to_va_arg_not_of_type_va_list : Error<
9969  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
9970def err_second_parameter_to_va_arg_incomplete: Error<
9971  "second argument to 'va_arg' is of incomplete type %0">;
9972def err_second_parameter_to_va_arg_abstract: Error<
9973  "second argument to 'va_arg' is of abstract type %0">;
9974def warn_second_parameter_to_va_arg_not_pod : Warning<
9975  "second argument to 'va_arg' is of non-POD type %0">,
9976  InGroup<NonPODVarargs>, DefaultError;
9977def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
9978  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
9979  InGroup<NonPODVarargs>, DefaultError;
9980def warn_second_parameter_to_va_arg_never_compatible : Warning<
9981  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
9982  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
9983
9984def warn_return_missing_expr : Warning<
9985  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9986  InGroup<ReturnType>;
9987def ext_return_missing_expr : ExtWarn<
9988  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9989  InGroup<ReturnType>;
9990def ext_return_has_expr : ExtWarn<
9991  "%select{void function|void method|constructor|destructor}1 %0 "
9992  "should not return a value">,
9993  DefaultError, InGroup<ReturnType>;
9994def ext_return_has_void_expr : Extension<
9995  "void %select{function|method|block}1 %0 should not return void expression">;
9996def err_return_init_list : Error<
9997  "%select{void function|void method|constructor|destructor}1 %0 "
9998  "must not return a value">;
9999def err_ctor_dtor_returns_void : Error<
10000  "%select{constructor|destructor}1 %0 must not return void expression">;
10001def warn_noreturn_function_has_return_expr : Warning<
10002  "function %0 declared 'noreturn' should not return">,
10003  InGroup<InvalidNoreturn>;
10004def warn_falloff_noreturn_function : Warning<
10005  "function declared 'noreturn' should not return">,
10006  InGroup<InvalidNoreturn>;
10007def err_noreturn_block_has_return_expr : Error<
10008  "block declared 'noreturn' should not return">;
10009def err_carries_dependency_missing_on_first_decl : Error<
10010  "%select{function|parameter}0 declared '[[carries_dependency]]' "
10011  "after its first declaration">;
10012def note_carries_dependency_missing_first_decl : Note<
10013  "declaration missing '[[carries_dependency]]' attribute is here">;
10014def err_carries_dependency_param_not_function_decl : Error<
10015  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
10016  "declaration or lambda">;
10017def err_block_on_nonlocal : Error<
10018  "__block attribute not allowed, only allowed on local variables">;
10019def err_block_on_vm : Error<
10020  "__block attribute not allowed on declaration with a variably modified type">;
10021def err_sizeless_nonlocal : Error<
10022  "non-local variable with sizeless type %0">;
10023
10024def err_vec_builtin_non_vector : Error<
10025 "first two arguments to %0 must be vectors">;
10026def err_vec_builtin_incompatible_vector : Error<
10027  "first two arguments to %0 must have the same type">;
10028def err_vsx_builtin_nonconstant_argument : Error<
10029  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
10030
10031def err_shufflevector_nonconstant_argument : Error<
10032  "index for __builtin_shufflevector must be a constant integer">;
10033def err_shufflevector_argument_too_large : Error<
10034  "index for __builtin_shufflevector must be less than the total number "
10035  "of vector elements">;
10036
10037def err_convertvector_non_vector : Error<
10038  "first argument to __builtin_convertvector must be a vector">;
10039def err_convertvector_non_vector_type : Error<
10040  "second argument to __builtin_convertvector must be a vector type">;
10041def err_convertvector_incompatible_vector : Error<
10042  "first two arguments to __builtin_convertvector must have the same number of elements">;
10043
10044def err_first_argument_to_cwsc_not_call : Error<
10045  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
10046def err_first_argument_to_cwsc_block_call : Error<
10047  "first argument to __builtin_call_with_static_chain must not be a block call">;
10048def err_first_argument_to_cwsc_builtin_call : Error<
10049  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
10050def err_first_argument_to_cwsc_pdtor_call : Error<
10051  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
10052def err_second_argument_to_cwsc_not_pointer : Error<
10053  "second argument to __builtin_call_with_static_chain must be of pointer type">;
10054
10055def err_vector_incorrect_num_initializers : Error<
10056  "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
10057def err_altivec_empty_initializer : Error<"expected initializer">;
10058
10059def err_invalid_neon_type_code : Error<
10060  "incompatible constant for this __builtin_neon function">;
10061def err_argument_invalid_range : Error<
10062  "argument value %0 is outside the valid range [%1, %2]">;
10063def warn_argument_invalid_range : Warning<
10064  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
10065  InGroup<DiagGroup<"argument-outside-range">>;
10066def warn_argument_undefined_behaviour : Warning<
10067  "argument value %0 will result in undefined behaviour">,
10068  InGroup<DiagGroup<"argument-undefined-behaviour">>;
10069def err_argument_not_multiple : Error<
10070  "argument should be a multiple of %0">;
10071def err_argument_not_power_of_2 : Error<
10072  "argument should be a power of 2">;
10073def err_argument_not_shifted_byte : Error<
10074  "argument should be an 8-bit value shifted by a multiple of 8 bits">;
10075def err_argument_not_shifted_byte_or_xxff : Error<
10076  "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
10077def err_argument_not_contiguous_bit_field : Error<
10078  "argument %0 value should represent a contiguous bit field">;
10079def err_rotation_argument_to_cadd : Error<
10080  "argument should be the value 90 or 270">;
10081def err_rotation_argument_to_cmla : Error<
10082  "argument should be the value 0, 90, 180 or 270">;
10083def warn_neon_vector_initializer_non_portable : Warning<
10084  "vector initializers are not compatible with NEON intrinsics in big endian "
10085  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
10086def note_neon_vector_initializer_non_portable : Note<
10087  "consider using vld1_%0%1() to initialize a vector from memory, or "
10088  "vcreate_%0%1() to initialize from an integer constant">;
10089def note_neon_vector_initializer_non_portable_q : Note<
10090  "consider using vld1q_%0%1() to initialize a vector from memory, or "
10091  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
10092  "constants">;
10093def err_systemz_invalid_tabort_code : Error<
10094  "invalid transaction abort code">;
10095def err_64_bit_builtin_32_bit_tgt : Error<
10096  "this builtin is only available on 64-bit targets">;
10097def err_32_bit_builtin_64_bit_tgt : Error<
10098  "this builtin is only available on 32-bit targets">;
10099def err_builtin_x64_aarch64_only : Error<
10100  "this builtin is only available on x86-64 and aarch64 targets">;
10101def err_mips_builtin_requires_dsp : Error<
10102  "this builtin requires 'dsp' ASE, please use -mdsp">;
10103def err_mips_builtin_requires_dspr2 : Error<
10104  "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
10105def err_mips_builtin_requires_msa : Error<
10106  "this builtin requires 'msa' ASE, please use -mmsa">;
10107def err_ppc_builtin_requires_abi : Error<
10108  "this builtin requires ABI -mabi=%0">;
10109def err_ppc_invalid_use_mma_type : Error<
10110  "invalid use of PPC MMA type">;
10111def err_ppc_invalid_test_data_class_type : Error<
10112  "expected a 'float', 'double' or '__float128' for the first argument">;
10113def err_x86_builtin_invalid_rounding : Error<
10114  "invalid rounding argument">;
10115def err_x86_builtin_invalid_scale : Error<
10116  "scale argument must be 1, 2, 4, or 8">;
10117def err_x86_builtin_tile_arg_duplicate : Error<
10118  "tile arguments must refer to different tiles">;
10119
10120def err_builtin_target_unsupported : Error<
10121  "builtin is not supported on this target">;
10122def err_builtin_longjmp_unsupported : Error<
10123  "__builtin_longjmp is not supported for the current target">;
10124def err_builtin_setjmp_unsupported : Error<
10125  "__builtin_setjmp is not supported for the current target">;
10126
10127def err_builtin_longjmp_invalid_val : Error<
10128  "argument to __builtin_longjmp must be a constant 1">;
10129def err_builtin_requires_language : Error<"'%0' is only available in %1">;
10130
10131def err_constant_integer_arg_type : Error<
10132  "argument to %0 must be a constant integer">;
10133
10134def ext_mixed_decls_code : Extension<
10135  "mixing declarations and code is a C99 extension">,
10136  InGroup<DeclarationAfterStatement>;
10137def warn_mixed_decls_code : Warning<
10138  "mixing declarations and code is incompatible with standards before C99">,
10139  InGroup<DeclarationAfterStatement>, DefaultIgnore;
10140
10141def err_non_local_variable_decl_in_for : Error<
10142  "declaration of non-local variable in 'for' loop">;
10143def err_non_variable_decl_in_for : Error<
10144  "non-variable declaration in 'for' loop">;
10145def err_toomany_element_decls : Error<
10146  "only one element declaration is allowed">;
10147def err_selector_element_not_lvalue : Error<
10148  "selector element is not a valid lvalue">;
10149def err_selector_element_type : Error<
10150  "selector element type %0 is not a valid object">;
10151def err_selector_element_const_type : Error<
10152  "selector element of type %0 cannot be a constant lvalue expression">;
10153def err_collection_expr_type : Error<
10154  "the type %0 is not a pointer to a fast-enumerable object">;
10155def warn_collection_expr_type : Warning<
10156  "collection expression type %0 may not respond to %1">;
10157
10158def err_invalid_conversion_between_ext_vectors : Error<
10159  "invalid conversion between ext-vector type %0 and %1">;
10160
10161def warn_duplicate_attribute_exact : Warning<
10162  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
10163
10164def warn_duplicate_attribute : Warning<
10165  "attribute %0 is already applied with different arguments">,
10166  InGroup<IgnoredAttributes>;
10167def err_disallowed_duplicate_attribute : Error<
10168  "attribute %0 cannot appear more than once on a declaration">;
10169
10170def warn_sync_fetch_and_nand_semantics_change : Warning<
10171  "the semantics of this intrinsic changed with GCC "
10172  "version 4.4 - the newer semantics are provided here">,
10173  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
10174
10175// Type
10176def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
10177  InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
10178def warn_receiver_forward_class : Warning<
10179  "receiver %0 is a forward class and corresponding @interface may not exist">,
10180  InGroup<ForwardClassReceiver>;
10181def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
10182def ext_missing_type_specifier : ExtWarn<
10183  "type specifier missing, defaults to 'int'; ISO C99 and later do not support "
10184  "implicit int">, InGroup<ImplicitInt>;
10185def err_missing_type_specifier : Error<
10186  "a type specifier is required for all declarations">;
10187def err_decimal_unsupported : Error<
10188  "GNU decimal type extension not supported">;
10189def err_objc_array_of_interfaces : Error<
10190  "array of interface %0 is invalid (probably should be an array of pointers)">;
10191def ext_c99_array_usage : Extension<
10192  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10193  "feature">, InGroup<C99>;
10194def err_c99_array_usage_cxx : Error<
10195  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
10196  "feature, not permitted in C++">;
10197def err_type_unsupported : Error<
10198  "%0 is not supported on this target">;
10199def err_nsconsumed_attribute_mismatch : Error<
10200  "overriding method has mismatched ns_consumed attribute on its"
10201  " parameter">;
10202def err_nsreturns_retained_attribute_mismatch : Error<
10203  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
10204  " attributes">;
10205def err_nserrordomain_invalid_decl : Error<
10206  "domain argument %select{|%1 }0does not refer to global constant">;
10207def err_nserrordomain_wrong_type : Error<
10208  "domain argument %0 does not point to an NSString or CFString constant">;
10209
10210def warn_nsconsumed_attribute_mismatch : Warning<
10211  err_nsconsumed_attribute_mismatch.Summary>, InGroup<NSConsumedMismatch>;
10212def warn_nsreturns_retained_attribute_mismatch : Warning<
10213  err_nsreturns_retained_attribute_mismatch.Summary>, InGroup<NSReturnsMismatch>;
10214
10215def note_getter_unavailable : Note<
10216  "or because setter is declared here, but no getter method %0 is found">;
10217def err_invalid_protocol_qualifiers : Error<
10218  "invalid protocol qualifiers on non-ObjC type">;
10219def warn_ivar_use_hidden : Warning<
10220  "local declaration of %0 hides instance variable">,
10221   InGroup<ShadowIvar>;
10222def warn_direct_initialize_call : Warning<
10223  "explicit call to +initialize results in duplicate call to +initialize">,
10224   InGroup<ExplicitInitializeCall>;
10225def warn_direct_super_initialize_call : Warning<
10226  "explicit call to [super initialize] should only be in implementation "
10227  "of +initialize">,
10228   InGroup<ExplicitInitializeCall>;
10229def err_ivar_use_in_class_method : Error<
10230  "instance variable %0 accessed in class method">;
10231def err_private_ivar_access : Error<"instance variable %0 is private">,
10232  AccessControl;
10233def err_protected_ivar_access : Error<"instance variable %0 is protected">,
10234  AccessControl;
10235def warn_maynot_respond : Warning<"%0 may not respond to %1">;
10236def ext_typecheck_base_super : Warning<
10237  "method parameter type "
10238  "%diff{$ does not match super class method parameter type $|"
10239  "does not match super class method parameter type}0,1">,
10240   InGroup<SuperSubClassMismatch>, DefaultIgnore;
10241def warn_missing_method_return_type : Warning<
10242  "method has no return type specified; defaults to 'id'">,
10243  InGroup<MissingMethodReturnType>, DefaultIgnore;
10244def warn_direct_ivar_access : Warning<"instance variable %0 is being "
10245  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
10246
10247// Spell-checking diagnostics
10248def err_unknown_typename : Error<
10249  "unknown type name %0">;
10250def err_unknown_type_or_class_name_suggest : Error<
10251  "unknown %select{type|class}1 name %0; did you mean %2?">;
10252def err_unknown_typename_suggest : Error<
10253  "unknown type name %0; did you mean %1?">;
10254def err_unknown_nested_typename_suggest : Error<
10255  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
10256def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
10257def err_undeclared_use_suggest : Error<
10258  "use of undeclared %0; did you mean %1?">;
10259def err_undeclared_var_use_suggest : Error<
10260  "use of undeclared identifier %0; did you mean %1?">;
10261def err_no_template : Error<"no template named %0">;
10262def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
10263def err_no_member_template : Error<"no template named %0 in %1">;
10264def err_no_member_template_suggest : Error<
10265  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
10266def err_non_template_in_template_id : Error<
10267  "%0 does not name a template but is followed by template arguments">;
10268def err_non_template_in_template_id_suggest : Error<
10269  "%0 does not name a template but is followed by template arguments; "
10270  "did you mean %1?">;
10271def err_non_template_in_member_template_id_suggest : Error<
10272  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
10273def note_non_template_in_template_id_found : Note<
10274  "non-template declaration found by name lookup">;
10275def err_mem_init_not_member_or_class_suggest : Error<
10276  "initializer %0 does not name a non-static data member or base "
10277  "class; did you mean the %select{base class|member}1 %2?">;
10278def err_field_designator_unknown_suggest : Error<
10279  "field designator %0 does not refer to any field in type %1; did you mean "
10280  "%2?">;
10281def err_typecheck_member_reference_ivar_suggest : Error<
10282  "%0 does not have a member named %1; did you mean %2?">;
10283def err_property_not_found_suggest : Error<
10284  "property %0 not found on object of type %1; did you mean %2?">;
10285def err_class_property_found : Error<
10286  "property %0 is a class property; did you mean to access it with class '%1'?">;
10287def err_ivar_access_using_property_syntax_suggest : Error<
10288  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
10289def warn_property_access_suggest : Warning<
10290"property %0 not found on object of type %1; did you mean to access property %2?">,
10291InGroup<PropertyAccessDotSyntax>;
10292def err_property_found_suggest : Error<
10293  "property %0 found on object of type %1; did you mean to access "
10294  "it with the \".\" operator?">;
10295def err_undef_interface_suggest : Error<
10296  "cannot find interface declaration for %0; did you mean %1?">;
10297def warn_undef_interface_suggest : Warning<
10298  "cannot find interface declaration for %0; did you mean %1?">;
10299def err_undef_superclass_suggest : Error<
10300  "cannot find interface declaration for %0, superclass of %1; did you mean "
10301  "%2?">;
10302def err_undeclared_protocol_suggest : Error<
10303  "cannot find protocol declaration for %0; did you mean %1?">;
10304def note_base_class_specified_here : Note<
10305  "base class %0 specified here">;
10306def err_using_directive_suggest : Error<
10307  "no namespace named %0; did you mean %1?">;
10308def err_using_directive_member_suggest : Error<
10309  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
10310def note_namespace_defined_here : Note<"namespace %0 defined here">;
10311def err_sizeof_pack_no_pack_name_suggest : Error<
10312  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
10313def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
10314
10315def err_uncasted_use_of_unknown_any : Error<
10316  "%0 has unknown type; cast it to its declared type to use it">;
10317def err_uncasted_call_of_unknown_any : Error<
10318  "%0 has unknown return type; cast the call to its declared return type">;
10319def err_uncasted_send_to_unknown_any_method : Error<
10320  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
10321  "message send to the method's return type">;
10322def err_unsupported_unknown_any_decl : Error<
10323  "%0 has unknown type, which is not supported for this kind of declaration">;
10324def err_unsupported_unknown_any_expr : Error<
10325  "unsupported expression with unknown type">;
10326def err_unsupported_unknown_any_call : Error<
10327  "call to unsupported expression with unknown type">;
10328def err_unknown_any_addrof : Error<
10329  "the address of a declaration with unknown type "
10330  "can only be cast to a pointer type">;
10331def err_unknown_any_addrof_call : Error<
10332  "address-of operator cannot be applied to a call to a function with "
10333  "unknown return type">;
10334def err_unknown_any_var_function_type : Error<
10335  "variable %0 with unknown type cannot be given a function type">;
10336def err_unknown_any_function : Error<
10337  "function %0 with unknown type must be given a function type">;
10338
10339def err_filter_expression_integral : Error<
10340  "filter expression has non-integral type %0">;
10341
10342def err_non_asm_stmt_in_naked_function : Error<
10343  "non-ASM statement in naked function is not supported">;
10344def err_asm_naked_this_ref : Error<
10345  "'this' pointer references not allowed in naked functions">;
10346def err_asm_naked_parm_ref : Error<
10347  "parameter references not allowed in naked functions">;
10348
10349// OpenCL warnings and errors.
10350def err_invalid_astype_of_different_size : Error<
10351  "invalid reinterpretation: sizes of %0 and %1 must match">;
10352def err_static_kernel : Error<
10353  "kernel functions cannot be declared static">;
10354def err_method_kernel : Error<
10355  "kernel functions cannot be class members">;
10356def err_template_kernel : Error<
10357  "kernel functions cannot be used in a template declaration, instantiation or specialization">;
10358def err_opencl_ptrptr_kernel_param : Error<
10359  "kernel parameter cannot be declared as a pointer to a pointer">;
10360def err_kernel_arg_address_space : Error<
10361  "pointer arguments to kernel functions must reside in '__global', "
10362  "'__constant' or '__local' address space">;
10363def err_opencl_ext_vector_component_invalid_length : Error<
10364  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
10365def err_opencl_function_variable : Error<
10366  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
10367def err_opencl_addrspace_scope : Error<
10368  "variables in the %0 address space can only be declared in the outermost "
10369  "scope of a kernel function">;
10370def err_static_function_scope : Error<
10371  "variables in function scope cannot be declared static">;
10372def err_opencl_bitfields : Error<
10373  "bit-fields are not supported in OpenCL">;
10374def err_opencl_vla : Error<
10375  "variable length arrays are not supported in OpenCL">;
10376def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
10377    "scalar operand type has greater rank than the type of the vector "
10378    "element. (%0 and %1)">;
10379def err_bad_kernel_param_type : Error<
10380  "%0 cannot be used as the type of a kernel parameter">;
10381def err_record_with_pointers_kernel_param : Error<
10382  "%select{struct|union}0 kernel parameters may not contain pointers">;
10383def note_within_field_of_type : Note<
10384  "within field of type %0 declared here">;
10385def note_illegal_field_declared_here : Note<
10386  "field of illegal %select{type|pointer type}0 %1 declared here">;
10387def err_opencl_type_struct_or_union_field : Error<
10388  "the %0 type cannot be used to declare a structure or union field">;
10389def err_event_t_addr_space_qual : Error<
10390  "the event_t type can only be used with __private address space qualifier">;
10391def err_expected_kernel_void_return_type : Error<
10392  "kernel must have void return type">;
10393def err_sampler_initializer_not_integer : Error<
10394  "sampler_t initialization requires 32-bit integer, not %0">;
10395def warn_sampler_initializer_invalid_bits : Warning<
10396  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
10397def err_sampler_argument_required : Error<
10398  "sampler_t variable required - got %0">;
10399def err_wrong_sampler_addressspace: Error<
10400  "sampler type cannot be used with the __local and __global address space qualifiers">;
10401def err_opencl_nonconst_global_sampler : Error<
10402  "global sampler requires a const or constant address space qualifier">;
10403def err_opencl_cast_non_zero_to_event_t : Error<
10404  "cannot cast non-zero value '%0' to 'event_t'">;
10405def err_opencl_global_invalid_addr_space : Error<
10406  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
10407def err_missing_actual_pipe_type : Error<
10408  "missing actual type specifier for pipe">;
10409def err_reference_pipe_type : Error <
10410  "pipes packet types cannot be of reference type">;
10411def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
10412def err_opencl_kernel_attr :
10413  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
10414def err_return_value_with_address_space : Error<
10415  "return type cannot be qualified with address space">;
10416def err_opencl_constant_no_init : Error<
10417  "variable in constant address space must be initialized">;
10418def err_opencl_atomic_init: Error<
10419  "atomic variable can be %select{assigned|initialized}0 to a variable only "
10420  "in global address space">;
10421def err_opencl_implicit_vector_conversion : Error<
10422  "implicit conversions between vector types (%0 and %1) are not permitted">;
10423def err_opencl_invalid_type_array : Error<
10424  "array of %0 type is invalid in OpenCL">;
10425def err_opencl_ternary_with_block : Error<
10426  "block type cannot be used as expression in ternary expression in OpenCL">;
10427def err_opencl_pointer_to_type : Error<
10428  "pointer to type %0 is invalid in OpenCL">;
10429def err_opencl_type_can_only_be_used_as_function_parameter : Error <
10430  "type %0 can only be used as a function parameter in OpenCL">;
10431def err_opencl_type_not_found : Error<
10432  "%0 type %1 not found; include the base header with -finclude-default-header">;
10433def warn_opencl_attr_deprecated_ignored : Warning <
10434  "%0 attribute is deprecated and ignored in %1">, InGroup<IgnoredAttributes>;
10435def err_opencl_variadic_function : Error<
10436  "invalid prototype, variadic arguments are not allowed in OpenCL">;
10437def err_opencl_requires_extension : Error<
10438  "use of %select{type|declaration}0 %1 requires %2 support">;
10439def ext_opencl_double_without_pragma : Extension<
10440  "Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is"
10441  " supported">;
10442def warn_opencl_generic_address_space_arg : Warning<
10443  "passing non-generic address space pointer to %0"
10444  " may cause dynamic conversion affecting performance">,
10445  InGroup<Conversion>, DefaultIgnore;
10446
10447// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
10448def err_opencl_builtin_pipe_first_arg : Error<
10449  "first argument to %0 must be a pipe type">;
10450def err_opencl_builtin_pipe_arg_num : Error<
10451  "invalid number of arguments to function: %0">;
10452def err_opencl_builtin_pipe_invalid_arg : Error<
10453  "invalid argument type to function %0 (expecting %1 having %2)">;
10454def err_opencl_builtin_pipe_invalid_access_modifier : Error<
10455  "invalid pipe access modifier (expecting %0)">;
10456
10457// OpenCL access qualifier
10458def err_opencl_invalid_access_qualifier : Error<
10459  "access qualifier can only be used for pipe and image type">;
10460def err_opencl_invalid_read_write : Error<
10461  "access qualifier %0 can not be used for %1 %select{|prior to OpenCL C version 2.0 or in version 3.0 "
10462  "and without __opencl_c_read_write_images feature}2">;
10463def err_opencl_multiple_access_qualifiers : Error<
10464  "multiple access qualifiers">;
10465def note_opencl_typedef_access_qualifier : Note<
10466  "previously declared '%0' here">;
10467
10468// OpenCL v2.0 s6.12.5 Blocks restrictions
10469def err_opencl_block_storage_type : Error<
10470  "the __block storage type is not permitted">;
10471def err_opencl_invalid_block_declaration : Error<
10472  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
10473def err_opencl_extern_block_declaration : Error<
10474  "invalid block variable declaration - using 'extern' storage class is disallowed">;
10475def err_opencl_block_ref_block : Error<
10476  "cannot refer to a block inside block">;
10477
10478// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
10479def err_opencl_builtin_to_addr_invalid_arg : Error<
10480  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
10481
10482// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
10483def err_opencl_enqueue_kernel_incorrect_args : Error<
10484  "illegal call to enqueue_kernel, incorrect argument types">;
10485def err_opencl_enqueue_kernel_local_size_args : Error<
10486  "mismatch in number of block parameters and local size arguments passed">;
10487def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
10488  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
10489def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
10490  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
10491def err_opencl_enqueue_kernel_blocks_no_args : Error<
10492  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
10493
10494def err_opencl_builtin_expected_type : Error<
10495  "illegal call to %0, expected %1 argument type">;
10496
10497// OpenCL v3.0 s6.3.7 - Vector Components
10498def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
10499  "vector component name '%0' is a feature from OpenCL version 3.0 onwards">,
10500  InGroup<OpenCLUnsupportedRGBA>;
10501
10502def err_openclcxx_placement_new : Error<
10503  "use of placement new requires explicit declaration">;
10504
10505// MIG routine annotations.
10506def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
10507  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
10508  InGroup<IgnoredAttributes>;
10509
10510def warn_imp_cast_drops_unaligned : Warning<
10511  "implicit cast from type %0 to type %1 drops __unaligned qualifier">,
10512  InGroup<DiagGroup<"unaligned-qualifier-implicit-cast">>;
10513
10514} // end of sema category
10515
10516let CategoryName = "OpenMP Issue" in {
10517// OpenMP support.
10518def err_omp_expected_var_arg : Error<
10519  "%0 is not a global variable, static local variable or static data member">;
10520def err_omp_expected_var_arg_suggest : Error<
10521  "%0 is not a global variable, static local variable or static data member; "
10522  "did you mean %1">;
10523def err_omp_global_var_arg : Error<
10524  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
10525def err_omp_ref_type_arg : Error<
10526  "arguments of '#pragma omp %0' cannot be of reference type %1">;
10527def err_omp_region_not_file_context : Error<
10528  "directive must be at file or namespace scope">;
10529def err_omp_var_scope : Error<
10530  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
10531def err_omp_var_used : Error<
10532  "'#pragma omp %0' must precede all references to variable %q1">;
10533def err_omp_var_thread_local : Error<
10534  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
10535def err_omp_private_incomplete_type : Error<
10536  "a private variable with incomplete type %0">;
10537def err_omp_firstprivate_incomplete_type : Error<
10538  "a firstprivate variable with incomplete type %0">;
10539def err_omp_lastprivate_incomplete_type : Error<
10540  "a lastprivate variable with incomplete type %0">;
10541def err_omp_reduction_incomplete_type : Error<
10542  "a reduction list item with incomplete type %0">;
10543def warn_omp_minus_in_reduction_deprecated : Warning<
10544  "minus(-) operator for reductions is deprecated; use + or user defined reduction instead">,
10545  InGroup<Deprecated>;
10546def err_omp_unexpected_clause_value : Error<
10547  "expected %0 in OpenMP clause '%1'">;
10548def err_omp_unexpected_call_to_omp_runtime_api
10549    : Error<"calls to OpenMP runtime API are not allowed within a region that "
10550            "corresponds to a construct with an order clause that specifies "
10551            "concurrent">;
10552def err_omp_expected_var_name_member_expr : Error<
10553  "expected variable name%select{| or data member of current class}0">;
10554def err_omp_expected_var_name_member_expr_with_type : Error<
10555  "expected variable%select{| or static data member|, static data member, "
10556  "or non-static data member of current class}0 of type '%1'">;
10557def err_omp_expected_var_name_member_expr_or_array_item : Error<
10558  "expected variable name%select{|, data member of current class}0, array element or array section">;
10559def err_omp_expected_addressable_lvalue_or_array_item : Error<
10560  "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">;
10561def err_omp_expected_named_var_member_or_array_expression: Error<
10562  "expected expression containing only member accesses and/or array sections based on named variables">;
10563def err_omp_bit_fields_forbidden_in_clause : Error<
10564  "bit fields cannot be used to specify storage in a '%0' clause">;
10565def err_array_section_does_not_specify_contiguous_storage : Error<
10566  "array section does not specify contiguous storage">;
10567def err_array_section_does_not_specify_length : Error<
10568  "array section does not specify length for outermost dimension">;
10569def err_omp_union_type_not_allowed : Error<
10570  "mapping of union members is not allowed">;
10571def err_omp_expected_access_to_data_field : Error<
10572  "expected access to data field">;
10573def err_omp_multiple_array_items_in_map_clause : Error<
10574  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
10575def err_omp_duplicate_map_type_modifier : Error<
10576  "same map type modifier has been specified more than once">;
10577def err_omp_duplicate_motion_modifier : Error<
10578  "same motion modifier has been specified more than once">;
10579def err_omp_pointer_mapped_along_with_derived_section : Error<
10580  "pointer cannot be mapped along with a section derived from itself">;
10581def err_omp_original_storage_is_shared_and_does_not_contain : Error<
10582  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
10583def err_omp_same_pointer_dereferenced : Error<
10584  "same pointer dereferenced in multiple different ways in map clause expressions">;
10585def note_omp_task_predetermined_firstprivate_here : Note<
10586  "predetermined as a firstprivate in a task construct here">;
10587def err_omp_threadprivate_incomplete_type : Error<
10588  "threadprivate variable with incomplete type %0">;
10589def err_omp_no_dsa_for_variable : Error<
10590  "variable %0 must have explicitly specified data sharing attributes">;
10591def err_omp_defaultmap_no_attr_for_variable : Error<
10592  "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
10593def note_omp_default_dsa_none : Note<
10594  "explicit data sharing attribute requested here">;
10595def note_omp_defaultmap_attr_none : Note<
10596  "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
10597def err_omp_wrong_dsa : Error<
10598  "%0 variable cannot be %1">;
10599def err_omp_variably_modified_type_not_supported : Error<
10600  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
10601def note_omp_explicit_dsa : Note<
10602  "defined as %0">;
10603def note_omp_predetermined_dsa : Note<
10604  "%select{static data member is predetermined as shared|"
10605  "variable with static storage duration is predetermined as shared|"
10606  "loop iteration variable is predetermined as private|"
10607  "loop iteration variable is predetermined as linear|"
10608  "loop iteration variable is predetermined as lastprivate|"
10609  "constant variable is predetermined as shared|"
10610  "global variable is predetermined as shared|"
10611  "non-shared variable in a task construct is predetermined as firstprivate|"
10612  "variable with automatic storage duration is predetermined as private}0"
10613  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
10614def note_omp_implicit_dsa : Note<
10615  "implicitly determined as %0">;
10616def err_omp_loop_var_dsa : Error<
10617  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
10618def err_omp_not_for : Error<
10619  "%select{statement after '#pragma omp %1' must be a for loop|"
10620  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
10621def note_omp_collapse_ordered_expr : Note<
10622  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
10623def err_omp_negative_expression_in_clause : Error<
10624  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
10625def err_omp_not_integral : Error<
10626  "expression must have integral or unscoped enumeration "
10627  "type, not %0">;
10628def err_omp_threadprivate_in_target : Error<
10629  "threadprivate variables cannot be used in target constructs">;
10630def err_omp_incomplete_type : Error<
10631  "expression has incomplete class type %0">;
10632def err_omp_explicit_conversion : Error<
10633  "expression requires explicit conversion from %0 to %1">;
10634def note_omp_conversion_here : Note<
10635  "conversion to %select{integral|enumeration}0 type %1 declared here">;
10636def err_omp_ambiguous_conversion : Error<
10637  "ambiguous conversion from type %0 to an integral or unscoped "
10638  "enumeration type">;
10639def err_omp_iterator_not_integral_or_pointer : Error<
10640  "expected integral or pointer type as the iterator-type, not %0">;
10641def err_omp_iterator_step_not_integral : Error<
10642  "iterator step expression %0 is not the integral expression">;
10643def err_omp_iterator_step_constant_zero : Error<
10644  "iterator step expression %0 evaluates to 0">;
10645def err_omp_required_access : Error<
10646  "%0 variable must be %1">;
10647def err_omp_const_variable : Error<
10648  "const-qualified variable cannot be %0">;
10649def err_omp_const_not_mutable_variable : Error<
10650  "const-qualified variable without mutable fields cannot be %0">;
10651def err_omp_const_list_item : Error<
10652  "const-qualified list item cannot be %0">;
10653def err_omp_linear_incomplete_type : Error<
10654  "a linear variable with incomplete type %0">;
10655def err_omp_linear_expected_int_or_ptr : Error<
10656  "argument of a linear clause should be of integral or pointer "
10657  "type, not %0">;
10658def warn_omp_linear_step_zero : Warning<
10659  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
10660  InGroup<OpenMPClauses>;
10661def warn_omp_alignment_not_power_of_two : Warning<
10662  "aligned clause will be ignored because the requested alignment is not a power of 2">,
10663  InGroup<OpenMPClauses>;
10664def err_omp_invalid_target_decl : Error<
10665  "%0 used in declare target directive is not a variable or a function name">;
10666def err_omp_declare_target_to_and_link : Error<
10667  "%0 must not appear in both clauses 'to' and 'link'">;
10668def warn_omp_not_in_target_context : Warning<
10669  "declaration is not declared in any declare target region">,
10670  InGroup<OpenMPTarget>;
10671def err_omp_function_in_link_clause : Error<
10672  "function name is not allowed in 'link' clause">;
10673def err_omp_aligned_expected_array_or_ptr : Error<
10674  "argument of aligned clause should be array"
10675  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
10676  ", not %0">;
10677def err_omp_used_in_clause_twice : Error<
10678  "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
10679def err_omp_local_var_in_threadprivate_init : Error<
10680  "variable with local storage in initial value of threadprivate variable">;
10681def err_omp_loop_not_canonical_init : Error<
10682  "initialization clause of OpenMP for loop is not in canonical form "
10683  "('var = init' or 'T var = init')">;
10684def ext_omp_loop_not_canonical_init : ExtWarn<
10685  "initialization clause of OpenMP for loop is not in canonical form "
10686  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
10687def err_omp_loop_not_canonical_cond : Error<
10688  "condition of OpenMP for loop must be a relational comparison "
10689  "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
10690def err_omp_loop_not_canonical_incr : Error<
10691  "increment clause of OpenMP for loop must perform simple addition "
10692  "or subtraction on loop variable %0">;
10693def err_omp_loop_variable_type : Error<
10694  "variable must be of integer or %select{pointer|random access iterator}0 type">;
10695def err_omp_loop_incr_not_compatible : Error<
10696  "increment expression must cause %0 to %select{decrease|increase}1 "
10697  "on each iteration of OpenMP for loop">;
10698def note_omp_loop_cond_requres_compatible_incr : Note<
10699  "loop step is expected to be %select{negative|positive}0 due to this condition">;
10700def err_omp_loop_diff_cxx : Error<
10701  "could not calculate number of iterations calling 'operator-' with "
10702  "upper and lower loop bounds">;
10703def err_omp_loop_cannot_use_stmt : Error<
10704  "'%0' statement cannot be used in OpenMP for loop">;
10705def err_omp_simd_region_cannot_use_stmt : Error<
10706  "'%0' statement cannot be used in OpenMP simd region">;
10707def warn_omp_loop_64_bit_var : Warning<
10708  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
10709  InGroup<OpenMPLoopForm>;
10710def err_omp_unknown_reduction_identifier_prior_omp_6_0 : Error<
10711  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
10712  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10713def err_omp_unknown_reduction_identifier_since_omp_6_0 : Error<
10714  "incorrect reduction identifier, expected one of '+', '*', '&', '|', '^', "
10715  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10716def err_omp_not_resolved_reduction_identifier : Error<
10717  "unable to resolve declare reduction construct for type %0">;
10718def err_omp_reduction_ref_type_arg : Error<
10719  "argument of OpenMP clause '%0' must reference the same object in all threads">;
10720def err_omp_clause_not_arithmetic_type_arg : Error<
10721  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
10722def err_omp_clause_floating_type_arg : Error<
10723  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
10724def err_omp_once_referenced : Error<
10725  "variable can appear only once in OpenMP '%0' clause">;
10726def err_omp_once_referenced_in_target_update : Error<
10727  "variable can appear only once in OpenMP 'target update' construct">;
10728def note_omp_referenced : Note<
10729  "previously referenced here">;
10730def err_omp_reduction_in_task : Error<
10731  "reduction variables may not be accessed in an explicit task">;
10732def err_omp_reduction_id_not_compatible : Error<
10733  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
10734def err_omp_reduction_identifier_mismatch : Error<
10735  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
10736def note_omp_previous_reduction_identifier : Note<
10737  "previously marked as task_reduction with different reduction operation">;
10738def err_omp_prohibited_region : Error<
10739  "region cannot be%select{| closely}0 nested inside '%1' region"
10740  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
10741  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
10742  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
10743  "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
10744  "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
10745def err_omp_prohibited_region_simd : Error<
10746  "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
10747def err_omp_prohibited_region_atomic : Error<
10748  "OpenMP constructs may not be nested inside an atomic region">;
10749def err_omp_prohibited_region_order
10750    : Error<"construct '%0' not allowed in a region associated with a "
10751            "directive with 'order' clause">;
10752def err_omp_prohibited_region_critical_same_name : Error<
10753  "cannot nest 'critical' regions having the same name %0">;
10754def note_omp_previous_critical_region : Note<
10755  "previous 'critical' region starts here">;
10756def err_omp_several_directives_in_region : Error<
10757  "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
10758def note_omp_previous_directive : Note<
10759  "previous '%0' directive used here">;
10760def err_omp_sections_not_compound_stmt : Error<
10761  "the statement for '#pragma omp sections' must be a compound statement">;
10762def err_omp_parallel_sections_not_compound_stmt : Error<
10763  "the statement for '#pragma omp parallel sections' must be a compound statement">;
10764def err_omp_orphaned_section_directive : Error<
10765  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
10766  " must be closely nested to a sections region%select{|, not a %1 region}0">;
10767def err_omp_sections_substmt_not_section : Error<
10768  "statement in 'omp sections' directive must be enclosed into a section region">;
10769def err_omp_parallel_sections_substmt_not_section : Error<
10770  "statement in 'omp parallel sections' directive must be enclosed into a section region">;
10771def err_omp_parallel_reduction_in_task_firstprivate : Error<
10772  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
10773def err_omp_atomic_read_not_expression_statement : Error<
10774  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
10775  " where v and x are both lvalue expressions with scalar type">;
10776def note_omp_atomic_read_write: Note<
10777  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
10778def err_omp_atomic_write_not_expression_statement : Error<
10779  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
10780  " where x is a lvalue expression with scalar type">;
10781def err_omp_atomic_update_not_expression_statement : Error<
10782  "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',"
10783  " where x is an lvalue expression with scalar type">;
10784def err_omp_atomic_not_expression_statement : Error<
10785  "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',"
10786  " where x is an lvalue expression with scalar type">;
10787def note_omp_atomic_update: Note<
10788  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
10789  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
10790  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
10791def err_omp_atomic_capture_not_expression_statement : Error<
10792  "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',"
10793  " where x and v are both lvalue expressions with scalar type">;
10794def err_omp_atomic_capture_not_compound_statement : Error<
10795  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
10796  " '{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;}',"
10797  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
10798  " where x is an lvalue expression with scalar type">;
10799def note_omp_atomic_capture: Note<
10800  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
10801def err_omp_atomic_compare : Error<
10802  "the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}',"
10803  " '{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;}',"
10804  " 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type,"
10805  " and 'ordop' is one of '<' or '>'.">;
10806def err_omp_atomic_compare_capture : Error<
10807  "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;}}',"
10808  " '{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;}',"
10809  " '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,"
10810  " and 'ordop' is one of '<' or '>'.">;
10811def note_omp_atomic_compare: Note<
10812  "%select{expected compound statement|expected exactly one expression statement|expected assignment statement|expected conditional operator|expect result value to be at false expression|"
10813  "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'|"
10814  "expect lvalue for result value|expect scalar value|expect integer value|unexpected 'else' statement|expect '==' operator|expect an assignment statement 'v = x'|"
10815  "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">;
10816def err_omp_atomic_several_clauses : Error<
10817  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
10818def err_omp_several_mem_order_clauses : Error<
10819  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
10820def err_omp_atomic_incompatible_mem_order_clause : Error<
10821  "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
10822def note_omp_previous_mem_order_clause : Note<
10823  "'%0' clause used here">;
10824def err_omp_target_contains_not_only_teams : Error<
10825  "target construct with nested teams region contains statements outside of the teams construct">;
10826def note_omp_nested_teams_construct_here : Note<
10827  "nested teams construct here">;
10828def note_omp_nested_statement_here : Note<
10829  "%select{statement|directive}0 outside teams construct here">;
10830def err_omp_single_copyprivate_with_nowait : Error<
10831  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
10832def err_omp_nowait_clause_without_depend: Error<
10833  "directive '#pragma omp taskwait' cannot use 'nowait' clause without 'depend' clause">;
10834def note_omp_nowait_clause_here : Note<
10835  "'nowait' clause is here">;
10836def err_omp_single_decl_in_declare_simd_variant : Error<
10837  "single declaration is expected after 'declare %select{simd|variant}0' directive">;
10838def err_omp_function_expected : Error<
10839  "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
10840def err_omp_wrong_cancel_region : Error<
10841  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
10842def err_omp_parent_cancel_region_nowait : Error<
10843  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
10844def err_omp_parent_cancel_region_ordered : Error<
10845  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
10846def 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">;
10847def 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">;
10848def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
10849def err_omp_mapper_wrong_type : Error<
10850  "mapper type must be of struct, union or class type">;
10851def err_omp_declare_mapper_wrong_var : Error<
10852  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
10853def err_omp_declare_mapper_redefinition : Error<
10854  "redefinition of user-defined mapper for type %0 with name %1">;
10855def err_omp_invalid_mapper: Error<
10856  "cannot find a valid user-defined mapper for type %0 with name %1">;
10857def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
10858def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
10859def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
10860def err_omp_typecheck_section_value : Error<
10861  "subscripted value is not an array or pointer">;
10862def err_omp_typecheck_section_not_integer : Error<
10863  "array section %select{lower bound|length}0 is not an integer">;
10864def err_omp_typecheck_shaping_not_integer : Error<
10865  "array shaping operation dimension is not an integer">;
10866def err_omp_shaping_dimension_not_positive : Error<
10867  "array shaping dimension is evaluated to a non-positive value %0">;
10868def err_omp_section_function_type : Error<
10869  "section of pointer to function type %0">;
10870def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
10871  InGroup<CharSubscript>, DefaultIgnore;
10872def err_omp_section_incomplete_type : Error<
10873  "section of pointer to incomplete type %0">;
10874def err_omp_section_not_subset_of_array : Error<
10875  "array section must be a subset of the original array">;
10876def err_omp_section_length_negative : Error<
10877  "section length is evaluated to a negative value %0">;
10878def err_omp_section_stride_non_positive : Error<
10879  "section stride is evaluated to a non-positive value %0">;
10880def err_omp_section_length_undefined : Error<
10881  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
10882def err_omp_wrong_linear_modifier : Error<
10883  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
10884def err_omp_wrong_linear_modifier_non_reference : Error<
10885  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
10886def err_omp_wrong_simdlen_safelen_values : Error<
10887  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
10888def err_omp_wrong_if_directive_name_modifier : Error<
10889  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
10890def err_omp_no_more_if_clause : Error<
10891  "no more 'if' clause is allowed">;
10892def err_omp_unnamed_if_clause : Error<
10893  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
10894def note_omp_previous_named_if_clause : Note<
10895  "previous clause with directive name modifier specified here">;
10896def err_omp_ordered_directive_with_param : Error<
10897  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
10898def err_omp_ordered_directive_without_param : Error<
10899  "'ordered' directive with '%0' clause cannot be closely nested inside ordered region without specified parameter">;
10900def note_omp_ordered_param : Note<
10901  "'ordered' clause%select{| with specified parameter}0">;
10902def err_omp_expected_base_var_name : Error<
10903  "expected variable name as a base of the array %select{subscript|section}0">;
10904def err_omp_map_shared_storage : Error<
10905  "variable already marked as mapped in current construct">;
10906def err_omp_invalid_map_type_for_directive : Error<
10907  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
10908def err_omp_invalid_map_type_modifier_for_directive : Error<
10909  "map type modifier '%0' is not allowed for '#pragma omp %1'">;
10910def err_omp_no_clause_for_directive : Error<
10911  "expected at least one %0 clause for '#pragma omp %1'">;
10912def err_omp_threadprivate_in_clause : Error<
10913  "threadprivate variables are not allowed in '%0' clause">;
10914def err_omp_wrong_ordered_loop_count : Error<
10915  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
10916def note_collapse_loop_count : Note<
10917  "parameter of the 'collapse' clause">;
10918def err_omp_clauses_mutually_exclusive : Error<
10919  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
10920def note_omp_previous_clause : Note<
10921  "'%0' clause is specified here">;
10922def err_omp_hint_clause_no_name : Error<
10923  "the name of the construct must be specified in presence of 'hint' clause">;
10924def err_omp_critical_with_hint : Error<
10925  "constructs with the same name must have a 'hint' clause with the same value">;
10926def note_omp_critical_hint_here : Note<
10927  "%select{|previous }0'hint' clause with value '%1'">;
10928def note_omp_critical_no_hint : Note<
10929  "%select{|previous }0directive with no 'hint' clause specified">;
10930def err_omp_depend_clause_thread_simd : Error<
10931  "'%0' clauses cannot be mixed with '%1' clause">;
10932def err_omp_depend_sink_expected_loop_iteration : Error<
10933  "expected%select{| %1}0 loop iteration variable">;
10934def err_omp_depend_sink_unexpected_expr : Error<
10935  "unexpected expression: number of expressions is larger than the number of associated loops">;
10936def err_omp_depend_sink_expected_plus_minus : Error<
10937  "expected '+' or '-' operation">;
10938def err_omp_taskwait_depend_mutexinoutset_not_allowed : Error<
10939  "'mutexinoutset' modifier not allowed in 'depend' clause on 'taskwait' directive">;
10940def err_omp_sink_and_source_not_allowed : Error<
10941  "'%0(%select{source|sink:vec}1)' clause%select{|s}1 cannot be mixed with '%0(%select{sink:vec|source}1)' clause%select{s|}1">;
10942def err_omp_depend_zero_length_array_section_not_allowed : Error<
10943  "zero-length array section is not allowed in 'depend' clause">;
10944def err_omp_depend_sink_source_with_modifier : Error<
10945  "depend modifier cannot be used with 'sink' or 'source' depend type">;
10946def err_omp_depend_modifier_not_iterator : Error<
10947  "expected iterator specification as depend modifier">;
10948def err_omp_map_modifier_not_iterator : Error<
10949  "expected iterator specification as map modifier">;
10950def err_omp_linear_ordered : Error<
10951  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
10952def err_omp_unexpected_schedule_modifier : Error<
10953  "modifier '%0' cannot be used along with modifier '%1'">;
10954def err_omp_schedule_nonmonotonic_static : Error<
10955  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
10956def err_omp_simple_clause_incompatible_with_ordered : Error<
10957  "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
10958def err_omp_ordered_simd : Error<
10959  "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
10960def err_omp_variable_in_given_clause_and_dsa : Error<
10961  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
10962def err_omp_param_or_this_in_clause : Error<
10963  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
10964def err_omp_expected_uniform_param : Error<
10965  "expected a reference to a parameter specified in a 'uniform' clause">;
10966def err_omp_expected_int_param : Error<
10967  "expected a reference to an integer-typed parameter">;
10968def err_omp_at_least_one_motion_clause_required : Error<
10969  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
10970def err_omp_cannot_update_with_internal_linkage : Error<
10971  "the host cannot update a declare target variable that is not externally visible.">;
10972def err_omp_usedeviceptr_not_a_pointer : Error<
10973  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
10974def err_omp_argument_type_isdeviceptr : Error <
10975  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
10976def warn_omp_nesting_simd : Warning<
10977  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
10978  InGroup<SourceUsesOpenMP>;
10979def err_omp_orphaned_device_directive : Error<
10980  "orphaned 'omp %0' directives are prohibited"
10981  "; perhaps you forget to enclose the directive into a "
10982  "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
10983def err_omp_reduction_non_addressable_expression : Error<
10984  "expected addressable reduction item for the task-based directives">;
10985def err_omp_reduction_with_nogroup : Error<
10986  "'reduction' clause cannot be used with 'nogroup' clause">;
10987def err_omp_reduction_vla_unsupported : Error<
10988  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
10989def err_omp_linear_distribute_var_non_loop_iteration : Error<
10990  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
10991def warn_omp_non_trivial_type_mapped : Warning<
10992  "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
10993  InGroup<OpenMPMapping>;
10994def err_omp_requires_clause_redeclaration : Error <
10995  "Only one %0 clause can appear on a requires directive in a single translation unit">;
10996def note_omp_requires_previous_clause : Note <
10997  "%0 clause previously used here">;
10998def err_omp_directive_before_requires : Error <
10999  "'%0' region encountered before requires directive with '%1' clause">;
11000def note_omp_requires_encountered_directive : Note <
11001  "'%0' previously encountered here">;
11002def err_omp_device_ancestor_without_requires_reverse_offload : Error <
11003  "Device clause with ancestor device-modifier used without specifying 'requires reverse_offload'">;
11004def err_omp_invalid_scope : Error <
11005  "'#pragma omp %0' directive must appear only in file scope">;
11006def note_omp_invalid_length_on_this_ptr_mapping : Note <
11007  "expected length on mapping of 'this' array section expression to be '1'">;
11008def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
11009  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
11010def note_omp_invalid_subscript_on_this_ptr_map : Note <
11011  "expected 'this' subscript expression on map clause to be 'this[0]'">;
11012def err_omp_invalid_map_this_expr : Error <
11013  "invalid 'this' expression on 'map' clause">;
11014def err_omp_implied_type_not_found : Error<
11015  "'%0' type not found; include <omp.h>">;
11016def err_omp_expected_omp_depend_t_lvalue : Error<
11017  "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
11018def err_omp_depobj_expected : Error<
11019  "expected depobj expression">;
11020def err_omp_depobj_single_clause_expected : Error<
11021  "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
11022def err_omp_scan_single_clause_expected : Error<
11023  "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
11024def err_omp_inclusive_exclusive_not_reduction : Error<
11025  "the list item must appear in 'reduction' clause with the 'inscan' modifier "
11026  "of the parent directive">;
11027def err_omp_reduction_not_inclusive_exclusive : Error<
11028  "the inscan reduction list item must appear as a list item in an 'inclusive' or"
11029  " 'exclusive' clause on an inner 'omp scan' directive">;
11030def err_omp_wrong_inscan_reduction : Error<
11031  "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
11032  " 'omp parallel for', or 'omp parallel for simd' directive">;
11033def err_omp_inscan_reduction_expected : Error<
11034  "expected 'reduction' clause with the 'inscan' modifier">;
11035def note_omp_previous_inscan_reduction : Note<
11036  "'reduction' clause with 'inscan' modifier is used here">;
11037def err_omp_expected_predefined_allocator : Error<
11038  "expected one of the predefined allocators for the variables with the static "
11039  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
11040  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
11041  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
11042def warn_omp_used_different_allocator : Warning<
11043  "allocate directive specifies %select{default|'%1'}0 allocator while "
11044  "previously used %select{default|'%3'}2">,
11045  InGroup<OpenMPClauses>;
11046def note_omp_previous_allocator : Note<
11047  "previous allocator is specified here">;
11048def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
11049  "inside of the target region; provide an 'allocator' clause or use 'requires'"
11050  " directive with the 'dynamic_allocators' clause">;
11051def err_expected_allocator_expression : Error<"expected an allocator expression "
11052  "inside of the target region; provide an allocator expression or use 'requires'"
11053  " directive with the 'dynamic_allocators' clause">;
11054def warn_omp_allocate_thread_on_task_target_directive : Warning<
11055  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
11056  InGroup<OpenMPClauses>;
11057def err_omp_expected_private_copy_for_allocate : Error<
11058  "the referenced item is not found in any private clause on the same directive">;
11059def err_omp_stmt_depends_on_loop_counter : Error<
11060  "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
11061def err_omp_invariant_dependency : Error<
11062  "expected loop invariant expression">;
11063def err_omp_invariant_or_linear_dependency : Error<
11064  "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
11065def err_omp_wrong_dependency_iterator_type : Error<
11066  "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
11067def err_target_unsupported_type
11068    : Error<"%0 requires %select{|%2 bit size}1 %3 %select{|return }4type support,"
11069            " but target '%5' does not support it">;
11070def err_omp_lambda_capture_in_declare_target_not_to : Error<
11071  "variable captured in declare target region must appear in a to clause">;
11072def err_omp_device_type_mismatch : Error<
11073  "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
11074def err_omp_wrong_device_function_call : Error<
11075  "function with 'device_type(%0)' is not available on %select{device|host}1">;
11076def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
11077def warn_omp_declare_target_after_first_use : Warning<
11078  "declaration marked as declare target after first use, it may lead to incorrect results">,
11079  InGroup<OpenMPTarget>;
11080def err_omp_declare_variant_incompat_attributes : Error<
11081  "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
11082def warn_omp_declare_variant_score_not_constant
11083    : Warning<"score expressions in the OpenMP context selector need to be "
11084              "constant; %0 is not and will be ignored">,
11085      InGroup<SourceUsesOpenMP>;
11086def err_omp_declare_variant_user_condition_not_constant
11087    : Error<"the user condition in the OpenMP context selector needs to be "
11088            "constant; %0 is not">;
11089def warn_omp_declare_variant_after_used : Warning<
11090  "'#pragma omp declare variant' cannot be applied for function after first "
11091  "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
11092def warn_omp_declare_variant_after_emitted : Warning<
11093  "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
11094  " the original function might be used">, InGroup<SourceUsesOpenMP>;
11095def err_omp_declare_variant_doesnt_support : Error<
11096  "'#pragma omp declare variant' does not "
11097  "support %select{function templates|virtual functions|"
11098  "deduced return types|constructors|destructors|deleted functions|"
11099  "defaulted functions|constexpr functions|consteval function}0">;
11100def err_omp_declare_variant_diff : Error<
11101  "function with '#pragma omp declare variant' has a different %select{calling convention"
11102  "|return type|constexpr specification|inline specification|storage class|"
11103  "linkage}0">;
11104def err_omp_declare_variant_prototype_required : Error<
11105  "function with '#pragma omp declare variant' must have a prototype when "
11106  "'append_args' is used">;
11107def err_omp_interop_type_not_found : Error<
11108  "'omp_interop_t' must be defined when 'append_args' clause is used; include <omp.h>">;
11109def err_omp_declare_variant_incompat_types : Error<
11110  "variant in '#pragma omp declare variant' with type %0 is incompatible with"
11111  " type %1%select{| with appended arguments}2">;
11112def err_omp_declare_variant_same_base_function : Error<
11113  "variant in '#pragma omp declare variant' is the same as the base function">;
11114def warn_omp_declare_variant_marked_as_declare_variant : Warning<
11115  "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
11116  >, InGroup<SourceUsesOpenMP>;
11117def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
11118def err_omp_one_defaultmap_each_category: Error<
11119  "at most one defaultmap clause for each variable-category can appear on the directive">;
11120def err_omp_lastprivate_conditional_non_scalar : Error<
11121  "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
11122  >;
11123def err_omp_flush_order_clause_and_list : Error<
11124  "'flush' directive with memory order clause '%0' cannot have the list">;
11125def note_omp_flush_order_clause_here : Note<
11126  "memory order clause '%0' is specified here">;
11127def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
11128  "expected addressable lvalue in '%0' clause">;
11129def err_omp_var_expected : Error<
11130  "expected variable of the '%0' type%select{|, not %2}1">;
11131def err_omp_non_pointer_type_array_shaping_base : Error<
11132  "expected expression with a pointer to a complete type as a base of an array "
11133  "shaping operation">;
11134def err_omp_reduction_task_not_parallel_or_worksharing : Error<
11135  "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
11136  " worksharing constructs">;
11137def err_omp_expected_array_alloctraits : Error<
11138  "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
11139def err_omp_predefined_allocator_with_traits : Error<
11140  "predefined allocator cannot have traits specified">;
11141def note_omp_predefined_allocator : Note<
11142  "predefined trait '%0' used here">;
11143def err_omp_nonpredefined_allocator_without_traits : Error<
11144  "non-predefined allocator must have traits specified">;
11145def err_omp_allocator_used_in_clauses : Error<
11146  "allocators used in 'uses_allocators' clause cannot appear in other "
11147  "data-sharing or data-mapping attribute clauses">;
11148def err_omp_allocator_not_in_uses_allocators : Error<
11149  "allocator must be specified in the 'uses_allocators' clause">;
11150def note_omp_protected_structured_block
11151    : Note<"jump bypasses OpenMP structured block">;
11152def note_omp_exits_structured_block
11153    : Note<"jump exits scope of OpenMP structured block">;
11154def err_omp_lastprivate_loop_var_non_loop_iteration : Error<
11155  "only loop iteration variables are allowed in 'lastprivate' clause in "
11156  "'omp %0' directives">;
11157def err_omp_interop_variable_expected : Error<
11158  "expected%select{| non-const}0 variable of type 'omp_interop_t'">;
11159def err_omp_interop_variable_wrong_type : Error<
11160  "interop variable must be of type 'omp_interop_t'">;
11161def err_omp_interop_prefer_type : Error<
11162  "prefer_list item must be a string literal or constant integral "
11163  "expression">;
11164def err_omp_interop_bad_depend_clause : Error<
11165  "'depend' clause requires the 'targetsync' interop type">;
11166def err_omp_interop_var_multiple_actions : Error<
11167  "interop variable %0 used in multiple action clauses">;
11168def err_omp_dispatch_statement_call
11169    : Error<"statement after '#pragma omp dispatch' must be a direct call"
11170            " to a target function or an assignment to one">;
11171def err_omp_unroll_full_variable_trip_count : Error<
11172  "loop to be fully unrolled must have a constant trip count">;
11173def note_omp_directive_here : Note<"'%0' directive found here">;
11174def err_omp_instantiation_not_supported
11175    : Error<"instantiation of '%0' not supported yet">;
11176def err_omp_adjust_arg_multiple_clauses : Error<
11177  "'adjust_arg' argument %0 used in multiple clauses">;
11178def err_omp_clause_requires_dispatch_construct : Error<
11179  "'%0' clause requires 'dispatch' context selector">;
11180def err_omp_append_args_with_varargs : Error<
11181  "'append_args' is not allowed with varargs functions">;
11182def err_openmp_vla_in_task_untied : Error<
11183  "variable length arrays are not supported in OpenMP tasking regions with 'untied' clause">;
11184def warn_omp_unterminated_declare_target : Warning<
11185  "expected '#pragma omp end declare target' at end of file to match '#pragma omp %0'">,
11186  InGroup<SourceUsesOpenMP>;
11187} // end of OpenMP category
11188
11189let CategoryName = "Related Result Type Issue" in {
11190// Objective-C related result type compatibility
11191def warn_related_result_type_compatibility_class : Warning<
11192  "method is expected to return an instance of its class type "
11193  "%diff{$, but is declared to return $|"
11194  ", but is declared to return different type}0,1">;
11195def warn_related_result_type_compatibility_protocol : Warning<
11196  "protocol method is expected to return an instance of the implementing "
11197  "class, but is declared to return %0">;
11198def note_related_result_type_family : Note<
11199  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
11200  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
11201  "self}1' method family%select{| and is expected to return an instance of its "
11202  "class type}0">;
11203def note_related_result_type_overridden : Note<
11204  "overridden method returns an instance of its class type">;
11205def note_related_result_type_inferred : Note<
11206  "%select{class|instance}0 method %1 is assumed to return an instance of "
11207  "its receiver type (%2)">;
11208def note_related_result_type_explicit : Note<
11209  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
11210  "%select{| and is expected to return an instance of its class type}0">;
11211def err_invalid_type_for_program_scope_var : Error<
11212  "the %0 type cannot be used to declare a program scope variable">;
11213
11214}
11215
11216let CategoryName = "Modules Issue" in {
11217def err_module_decl_in_module_map_module : Error<
11218  "'module' declaration found while building module from module map">;
11219def err_module_decl_in_header_unit : Error<
11220  "'module' declaration found while building header unit">;
11221def err_module_interface_implementation_mismatch : Error<
11222  "missing 'export' specifier in module declaration while "
11223  "building module interface">;
11224def err_current_module_name_mismatch : Error<
11225  "module name '%0' specified on command line does not match name of module">;
11226def err_module_redefinition : Error<
11227  "redefinition of module '%0'">;
11228def note_prev_module_definition : Note<"previously defined here">;
11229def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
11230def err_module_not_defined : Error<
11231  "definition of module '%0' is not available; use -fmodule-file= to specify "
11232  "path to precompiled module interface">;
11233def err_module_redeclaration : Error<
11234  "translation unit contains multiple module declarations">;
11235def note_prev_module_declaration : Note<"previous module declaration is here">;
11236def err_module_declaration_missing : Error<
11237  "missing 'export module' declaration in module interface unit">;
11238def err_module_declaration_missing_after_global_module_introducer : Error<
11239  "missing 'module' declaration at end of global module fragment "
11240  "introduced here">;
11241def err_module_private_specialization : Error<
11242  "%select{template|partial|member}0 specialization cannot be "
11243  "declared __module_private__">;
11244def err_module_private_local : Error<
11245  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
11246  "__module_private__">;
11247def err_module_private_local_class : Error<
11248  "local %select{struct|interface|union|class|enum}0 cannot be declared "
11249  "__module_private__">;
11250def err_module_unimported_use : Error<
11251  "%select{declaration|definition|default argument|"
11252  "explicit specialization|partial specialization}0 of %1 must be imported "
11253  "from module '%2' before it is required">;
11254def err_module_unimported_use_header : Error<
11255  "%select{missing '#include'|missing '#include %3'}2; "
11256  "%select{||default argument of |explicit specialization of |"
11257  "partial specialization of }0%1 must be "
11258  "%select{declared|defined|defined|declared|declared}0 "
11259  "before it is used">;
11260def err_module_unimported_use_multiple : Error<
11261  "%select{declaration|definition|default argument|"
11262  "explicit specialization|partial specialization}0 of %1 must be imported "
11263  "from one of the following modules before it is required:%2">;
11264def note_unreachable_entity : Note<
11265  "%select{declaration|definition|default argument declared|"
11266  "explicit specialization declared|partial specialization declared}0 here "
11267  "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
11268def ext_module_import_in_extern_c : ExtWarn<
11269  "import of C++ module '%0' appears within extern \"C\" language linkage "
11270  "specification">, DefaultError,
11271  InGroup<DiagGroup<"module-import-in-extern-c">>;
11272def err_module_import_not_at_top_level_fatal : Error<
11273  "import of module '%0' appears within %1">, DefaultFatal;
11274def ext_module_import_not_at_top_level_noop : ExtWarn<
11275  "redundant #include of module '%0' appears within %1">, DefaultError,
11276  InGroup<DiagGroup<"modules-import-nested-redundant">>;
11277def note_module_import_not_at_top_level : Note<"%0 begins here">;
11278def err_module_self_import : Error<
11279  "import of module '%0' appears within same top-level module '%1'">;
11280def err_module_self_import_cxx20 : Error<
11281  "import of module '%0' appears within its own %select{interface|implementation}1">;
11282def err_module_import_in_implementation : Error<
11283  "@import of module '%0' in implementation of '%1'; use #import">;
11284
11285// C++ Modules
11286def err_module_decl_not_at_start : Error<
11287  "module declaration must occur at the start of the translation unit">;
11288def note_global_module_introducer_missing : Note<
11289  "add 'module;' to the start of the file to introduce a "
11290  "global module fragment">;
11291def err_export_within_anonymous_namespace : Error<
11292  "export declaration appears within anonymous namespace">;
11293def note_anonymous_namespace : Note<"anonymous namespace begins here">;
11294def note_export : Note<"export block begins here">;
11295def err_export_within_export : Error<
11296  "export declaration appears within another export declaration">;
11297def err_export_anon_ns_internal : Error<
11298  "anonymous namespaces cannot be exported">;
11299def err_export_internal : Error<
11300  "declaration of %0 with internal linkage cannot be exported">;
11301def err_export_using_internal : Error<
11302  "using declaration referring to %1 with %select{internal|module|unknown}0 "
11303  "linkage cannot be exported">;
11304def err_export_not_in_module_interface : Error<
11305  "export declaration can only be used within a module purview">;
11306def err_export_inline_not_defined : Error<
11307  "inline function not defined%select{| before the private module fragment}0">;
11308def err_export_partition_impl : Error<
11309  "module partition implementations cannot be exported">;
11310def err_export_in_private_module_fragment : Error<
11311  "export declaration cannot be used in a private module fragment">;
11312def note_private_module_fragment : Note<
11313  "private module fragment begins here">;
11314def err_private_module_fragment_not_module : Error<
11315  "private module fragment declaration with no preceding module declaration">;
11316def err_private_module_fragment_redefined : Error<
11317  "private module fragment redefined">;
11318def err_private_module_fragment_not_module_interface : Error<
11319  "private module fragment in module implementation unit">;
11320def note_not_module_interface_add_export : Note<
11321  "add 'export' here if this is intended to be a module interface unit">;
11322def err_invalid_module_name : Error<"%0 is an invalid name for a module">;
11323def err_extern_def_in_header_unit : Error<
11324  "non-inline external definitions are not permitted in C++ header units">;
11325
11326def warn_experimental_header_unit : Warning<
11327  "the implementation of header units is in an experimental phase">,
11328  InGroup<DiagGroup<"experimental-header-units">>;
11329
11330def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
11331  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
11332  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
11333def note_equivalent_internal_linkage_decl : Note<
11334  "declared here%select{ in module '%1'|}0">;
11335
11336def note_redefinition_modules_same_file : Note<
11337  "'%0' included multiple times, additional include site in header from module '%1'">;
11338def note_redefinition_include_same_file : Note<
11339  "'%0' included multiple times, additional include site here">;
11340}
11341
11342let CategoryName = "Coroutines Issue" in {
11343def err_return_in_coroutine : Error<
11344  "return statement not allowed in coroutine; did you mean 'co_return'?">;
11345def note_declared_coroutine_here : Note<
11346  "function is a coroutine due to use of '%0' here">;
11347def err_coroutine_objc_method : Error<
11348  "Objective-C methods as coroutines are not yet supported">;
11349def err_coroutine_unevaluated_context : Error<
11350  "'%0' cannot be used in an unevaluated context">;
11351def err_coroutine_within_handler : Error<
11352  "'%0' cannot be used in the handler of a try block">;
11353def err_coroutine_outside_function : Error<
11354  "'%0' cannot be used outside a function">;
11355def err_coroutine_invalid_func_context : Error<
11356  "'%1' cannot be used in %select{a constructor|a destructor"
11357  "|the 'main' function|a constexpr function"
11358  "|a function with a deduced return type|a varargs function"
11359  "|a consteval function}0">;
11360def err_implied_coroutine_type_not_found : Error<
11361  "%0 type was not found; include <coroutine> before defining "
11362  "a coroutine">;
11363def err_implicit_coroutine_std_nothrow_type_not_found : Error<
11364  "std::nothrow was not found; include <new> before defining a coroutine which "
11365  "uses get_return_object_on_allocation_failure()">;
11366def err_malformed_std_nothrow : Error<
11367  "std::nothrow must be a valid variable declaration">;
11368def err_malformed_std_coroutine_handle : Error<
11369  "std::coroutine_handle isn't a class template">;
11370def err_coroutine_handle_missing_member : Error<
11371  "std::coroutine_handle must have a member named '%0'">;
11372def err_malformed_std_coroutine_traits : Error<
11373  "std::coroutine_traits isn't a class template">;
11374def err_implied_std_coroutine_traits_promise_type_not_found : Error<
11375  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
11376def err_implied_std_coroutine_traits_promise_type_not_class : Error<
11377  "this function cannot be a coroutine: %0 is not a class">;
11378def err_coroutine_promise_type_incomplete : Error<
11379  "this function cannot be a coroutine: %0 is an incomplete type">;
11380def err_coroutine_type_missing_specialization : Error<
11381  "this function cannot be a coroutine: missing definition of "
11382  "specialization %0">;
11383def err_coroutine_promise_incompatible_return_functions : Error<
11384  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
11385def note_coroutine_promise_implicit_await_transform_required_here : Note<
11386  "call to 'await_transform' implicitly required by 'co_await' here">;
11387def note_coroutine_promise_suspend_implicitly_required : Note<
11388  "call to '%select{initial_suspend|final_suspend}0' implicitly "
11389  "required by the %select{initial suspend point|final suspend point}0">;
11390def err_coroutine_promise_unhandled_exception_required : Error<
11391  "%0 is required to declare the member 'unhandled_exception()'">;
11392def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
11393  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
11394  InGroup<CoroutineMissingUnhandledException>;
11395def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
11396  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
11397def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
11398  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
11399def err_coroutine_promise_new_requires_nothrow : Error<
11400  "%0 is required to have a non-throwing noexcept specification when the promise "
11401   "type declares 'get_return_object_on_allocation_failure()'">;
11402def note_coroutine_promise_call_implicitly_required : Note<
11403  "call to %0 implicitly required by coroutine function here">;
11404def err_await_suspend_invalid_return_type : Error<
11405  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
11406>;
11407def note_await_ready_no_bool_conversion : Note<
11408  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
11409>;
11410def warn_coroutine_handle_address_invalid_return_type : Warning <
11411  "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">,
11412  InGroup<Coroutine>;
11413def err_coroutine_promise_final_suspend_requires_nothrow : Error<
11414  "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
11415>;
11416def note_coroutine_function_declare_noexcept : Note<
11417  "must be declared with 'noexcept'"
11418>;
11419def warn_always_inline_coroutine : Warning<
11420  "this coroutine may be split into pieces; not every piece is guaranteed to be inlined"
11421  >,
11422  InGroup<AlwaysInlineCoroutine>;
11423def err_coroutine_unusable_new : Error<
11424  "'operator new' provided by %0 is not usable with the function signature of %1"
11425>;
11426def err_coroutine_unfound_nothrow_new : Error <
11427  "unable to find %select{'::operator new(size_t, nothrow_t)'|"
11428  "'::operator new(size_t, align_val_t, nothrow_t)'}1 for %0"
11429>;
11430def warn_non_aligned_allocation_function : Warning <
11431  "under -fcoro-aligned-allocation, the non-aligned allocation function "
11432  "for the promise type %0 has higher precedence than the global aligned "
11433  "allocation function">,
11434  InGroup<CoroNonAlignedAllocationFunction>;
11435def err_conflicting_aligned_options : Error <
11436  "conflicting option '-fcoro-aligned-allocation' and '-fno-aligned-allocation'"
11437>;
11438def err_coro_invalid_addr_of_label : Error<
11439  "the GNU address of label extension is not allowed in coroutines."
11440>;
11441} // end of coroutines issue category
11442
11443let CategoryName = "Documentation Issue" in {
11444def warn_not_a_doxygen_trailing_member_comment : Warning<
11445  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
11446def warn_splice_in_doxygen_comment : Warning<
11447  "line splicing in Doxygen comments are not supported">, InGroup<Documentation>, DefaultIgnore;
11448} // end of documentation issue category
11449
11450let CategoryName = "Nullability Issue" in {
11451
11452def warn_mismatched_nullability_attr : Warning<
11453  "nullability specifier %0 conflicts with existing specifier %1">,
11454  InGroup<Nullability>;
11455
11456def warn_nullability_declspec : Warning<
11457  "nullability specifier %0 cannot be applied "
11458  "to non-pointer type %1; did you mean to apply the specifier to the "
11459  "%select{pointer|block pointer|member pointer|function pointer|"
11460  "member function pointer}2?">,
11461  InGroup<NullabilityDeclSpec>,
11462  DefaultError;
11463
11464def note_nullability_here : Note<"%0 specified here">;
11465
11466def err_nullability_nonpointer : Error<
11467  "nullability specifier %0 cannot be applied to non-pointer type %1">;
11468
11469def warn_nullability_lost : Warning<
11470  "implicit conversion from nullable pointer %0 to non-nullable pointer "
11471  "type %1">,
11472  InGroup<NullableToNonNullConversion>, DefaultIgnore;
11473def warn_zero_as_null_pointer_constant : Warning<
11474  "zero as null pointer constant">,
11475  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
11476
11477def err_nullability_cs_multilevel : Error<
11478  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
11479def note_nullability_type_specifier : Note<
11480  "use nullability type specifier %0 to affect the innermost "
11481  "pointer type of %1">;
11482
11483def warn_null_resettable_setter : Warning<
11484  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
11485  InGroup<Nullability>;
11486
11487def warn_nullability_missing : Warning<
11488  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
11489  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
11490  InGroup<NullabilityCompleteness>;
11491def warn_nullability_missing_array : Warning<
11492  "array parameter is missing a nullability type specifier (_Nonnull, "
11493  "_Nullable, or _Null_unspecified)">,
11494  InGroup<NullabilityCompletenessOnArrays>;
11495def note_nullability_fix_it : Note<
11496  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
11497  "%select{pointer|block pointer|member pointer|array parameter}1 "
11498  "%select{should never be null|may be null|should not declare nullability}0">;
11499
11500def warn_nullability_inferred_on_nested_type : Warning<
11501  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
11502  "deprecated">,
11503  InGroup<NullabilityInferredOnNestedType>;
11504
11505def err_objc_type_arg_explicit_nullability : Error<
11506  "type argument %0 cannot explicitly specify nullability">;
11507
11508def err_objc_type_param_bound_explicit_nullability : Error<
11509  "type parameter %0 bound %1 cannot explicitly specify nullability">;
11510
11511}
11512
11513let CategoryName = "Generics Issue" in {
11514
11515def err_objc_type_param_bound_nonobject : Error<
11516  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
11517
11518def err_objc_type_param_bound_missing_pointer : Error<
11519  "missing '*' in type bound %0 for type parameter %1">;
11520def err_objc_type_param_bound_qualified : Error<
11521  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
11522
11523def err_objc_type_param_redecl : Error<
11524  "redeclaration of type parameter %0">;
11525
11526def err_objc_type_param_arity_mismatch : Error<
11527  "%select{forward class declaration|class definition|category|extension}0 has "
11528  "too %select{few|many}1 type parameters (expected %2, have %3)">;
11529
11530def err_objc_type_param_bound_conflict : Error<
11531  "type bound %0 for type parameter %1 conflicts with "
11532  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
11533
11534def err_objc_type_param_variance_conflict : Error<
11535  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
11536  "%select{in|co|contra}2variant type parameter %3">;
11537
11538def note_objc_type_param_here : Note<"type parameter %0 declared here">;
11539
11540def err_objc_type_param_bound_missing : Error<
11541  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
11542
11543def err_objc_parameterized_category_nonclass : Error<
11544  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
11545  "parameters">;
11546
11547def err_objc_parameterized_forward_class : Error<
11548  "forward declaration of non-parameterized class %0 cannot have type "
11549  "parameters">;
11550
11551def err_objc_parameterized_forward_class_first : Error<
11552  "class %0 previously declared with type parameters">;
11553
11554def err_objc_type_arg_missing_star : Error<
11555  "type argument %0 must be a pointer (requires a '*')">;
11556def err_objc_type_arg_qualified : Error<
11557  "type argument %0 cannot be qualified with '%1'">;
11558
11559def err_objc_type_arg_missing : Error<
11560  "no type or protocol named %0">;
11561
11562def err_objc_type_args_and_protocols : Error<
11563  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
11564  "%select{protocol|type}0 (%2)">;
11565
11566def err_objc_type_args_non_class : Error<
11567  "type arguments cannot be applied to non-class type %0">;
11568
11569def err_objc_type_args_non_parameterized_class : Error<
11570  "type arguments cannot be applied to non-parameterized class %0">;
11571
11572def err_objc_type_args_specialized_class : Error<
11573  "type arguments cannot be applied to already-specialized class type %0">;
11574
11575def err_objc_type_args_wrong_arity : Error<
11576  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
11577}
11578
11579def err_type_available_only_in_default_eval_method : Error<
11580  "cannot use type '%0' within '#pragma clang fp eval_method'; type is set "
11581  "according to the default eval method for the translation unit">;
11582
11583def err_objc_type_arg_not_id_compatible : Error<
11584  "type argument %0 is neither an Objective-C object nor a block type">;
11585
11586def err_objc_type_arg_does_not_match_bound : Error<
11587  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
11588
11589def warn_objc_redundant_qualified_class_type : Warning<
11590  "parameterized class %0 already conforms to the protocols listed; did you "
11591  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
11592
11593def warn_block_literal_attributes_on_omitted_return_type : Warning<
11594  "attribute %0 ignored, because it cannot be applied to omitted return type">,
11595  InGroup<IgnoredAttributes>;
11596
11597def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
11598  "'%0' qualifier on omitted return type %1 has no effect">,
11599  InGroup<IgnoredQualifiers>;
11600
11601def warn_shadow_field : Warning<
11602  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
11603  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
11604def note_shadow_field : Note<"declared here">;
11605
11606def err_multiversion_required_in_redecl : Error<
11607  "function declaration is missing %select{'target'|'cpu_specific' or "
11608  "'cpu_dispatch'|'target_version'}0 attribute in a multiversioned function">;
11609def note_multiversioning_caused_here : Note<
11610  "function multiversioning caused by this declaration">;
11611def err_multiversion_after_used : Error<
11612  "function declaration cannot become a multiversioned function after first "
11613  "usage">;
11614def err_bad_multiversion_option : Error<
11615  "function multiversioning doesn't support %select{feature|architecture}0 "
11616  "'%1'">;
11617def err_multiversion_duplicate : Error<
11618  "multiversioned function redeclarations require identical target attributes">;
11619def err_multiversion_noproto : Error<
11620  "multiversioned function must have a prototype">;
11621def err_multiversion_disallowed_other_attr
11622    : Error<"attribute "
11623            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
11624            "multiversioning cannot be combined"
11625            " with attribute %1">;
11626def err_multiversion_diff : Error<
11627  "multiversioned function declaration has a different %select{calling convention"
11628  "|return type|constexpr specification|inline specification|linkage|"
11629  "language linkage}0">;
11630def err_multiversion_doesnt_support
11631    : Error<"attribute "
11632            "'%select{|target|cpu_specific|cpu_dispatch|target_clones|target_version}0' "
11633            "multiversioned functions do not "
11634            "yet support %select{function templates|virtual functions|"
11635            "deduced return types|constructors|destructors|deleted functions|"
11636            "defaulted functions|constexpr functions|consteval "
11637            "function|lambdas}1">;
11638def err_multiversion_not_allowed_on_main : Error<
11639  "'main' cannot be a multiversioned function">;
11640def err_multiversion_not_supported : Error<
11641 "function multiversioning is not supported on the current target">;
11642def err_multiversion_types_mixed : Error<
11643  "multiversioning attributes cannot be combined">;
11644def err_cpu_dispatch_mismatch : Error<
11645 "'cpu_dispatch' function redeclared with different CPUs">;
11646def err_cpu_specific_multiple_defs : Error<
11647 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
11648def warn_multiversion_duplicate_entries : Warning<
11649 "CPU list contains duplicate entries; attribute ignored">,
11650  InGroup<FunctionMultiVersioning>;
11651def warn_dispatch_body_ignored : Warning<
11652  "body of cpu_dispatch function will be ignored">,
11653  InGroup<FunctionMultiVersioning>;
11654def err_target_clone_must_have_default
11655    : Error<"'target_clones' multiversioning requires a default target">;
11656def err_target_clone_doesnt_match
11657    : Error<"'target_clones' attribute does not match previous declaration">;
11658def warn_target_clone_mixed_values
11659    : ExtWarn<
11660          "mixing 'target_clones' specifier mechanisms is permitted for GCC "
11661          "compatibility; use a comma separated sequence of string literals, "
11662          "or a string literal containing a comma-separated list of versions">,
11663      InGroup<TargetClonesMixedSpecifiers>;
11664def warn_target_clone_duplicate_options
11665    : Warning<"version list contains duplicate entries">,
11666      InGroup<FunctionMultiVersioning>;
11667def warn_target_clone_no_impact_options
11668    : Warning<"version list contains entries that don't impact code generation">,
11669      InGroup<FunctionMultiVersioning>;
11670
11671// three-way comparison operator diagnostics
11672def err_implied_comparison_category_type_not_found : Error<
11673  "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
11674  "because type '%0' was not found; include <compare>">;
11675def err_spaceship_argument_narrowing : Error<
11676  "argument to 'operator<=>' "
11677  "%select{cannot be narrowed from type %1 to %2|"
11678  "evaluates to %1, which cannot be narrowed to type %2}0">;
11679def err_std_compare_type_not_supported : Error<
11680  "standard library implementation of %0 is not supported; "
11681   "%select{member '%2' does not have expected form|"
11682   "member '%2' is missing|"
11683   "the type is not trivially copyable|"
11684   "the type does not have the expected form}1">;
11685def note_rewriting_operator_as_spaceship : Note<
11686  "while rewriting comparison as call to 'operator<=>' declared here">;
11687def err_three_way_vector_comparison : Error<
11688  "three-way comparison between vectors is not supported">;
11689
11690// Memory Tagging Extensions (MTE) diagnostics
11691def err_memtag_arg_null_or_pointer : Error<
11692  "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
11693def err_memtag_any2arg_pointer : Error<
11694  "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
11695def err_memtag_arg_must_be_pointer : Error<
11696  "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
11697def err_memtag_arg_must_be_integer : Error<
11698  "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
11699
11700def warn_dereference_of_noderef_type : Warning<
11701  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
11702def warn_dereference_of_noderef_type_no_decl : Warning<
11703  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
11704def warn_noderef_on_non_pointer_or_array : Warning<
11705  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
11706def warn_noderef_to_dereferenceable_pointer : Warning<
11707  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
11708
11709def err_builtin_launder_invalid_arg : Error<
11710  "%select{non-pointer|function pointer|void pointer}0 argument to "
11711  "'__builtin_launder' is not allowed">;
11712
11713def err_builtin_invalid_arg_type: Error <
11714  "%ordinal0 argument must be a "
11715  "%select{vector, integer or floating point type|matrix|"
11716  "pointer to a valid matrix element type|"
11717  "signed integer or floating point type|vector type|"
11718  "floating point type|"
11719  "vector of integers}1 (was %2)">;
11720
11721def err_builtin_matrix_disabled: Error<
11722  "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
11723def err_matrix_index_not_integer: Error<
11724  "matrix %select{row|column}0 index is not an integer">;
11725def err_matrix_index_outside_range: Error<
11726  "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
11727def err_matrix_incomplete_index: Error<
11728  "single subscript expressions are not allowed for matrix values">;
11729def err_matrix_separate_incomplete_index: Error<
11730  "matrix row and column subscripts cannot be separated by any expression">;
11731def err_matrix_subscript_comma: Error<
11732  "comma expressions are not allowed as indices in matrix subscript expressions">;
11733def err_builtin_matrix_scalar_unsigned_arg: Error<
11734  "%0 argument must be a constant unsigned integer expression">;
11735def err_builtin_matrix_pointer_arg_mismatch: Error<
11736  "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
11737def err_builtin_matrix_store_to_const: Error<
11738  "cannot store matrix to read-only pointer">;
11739def err_builtin_matrix_stride_too_small: Error<
11740  "stride must be greater or equal to the number of rows">;
11741def err_builtin_matrix_invalid_dimension: Error<
11742  "%0 dimension is outside the allowed range [1, %1]">;
11743
11744def warn_mismatched_import : Warning<
11745  "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
11746  "previous declaration">,
11747  InGroup<IgnoredAttributes>;
11748def warn_import_on_definition : Warning<
11749  "import %select{module|name}0 cannot be applied to a function with a definition">,
11750  InGroup<IgnoredAttributes>;
11751
11752def err_preserve_field_info_not_field : Error<
11753  "__builtin_preserve_field_info argument %0 not a field access">;
11754def err_preserve_field_info_not_const: Error<
11755  "__builtin_preserve_field_info argument %0 not a constant">;
11756def err_btf_type_id_not_const: Error<
11757  "__builtin_btf_type_id argument %0 not a constant">;
11758def err_preserve_type_info_invalid : Error<
11759  "__builtin_preserve_type_info argument %0 invalid">;
11760def err_preserve_type_info_not_const: Error<
11761  "__builtin_preserve_type_info argument %0 not a constant">;
11762def err_preserve_enum_value_invalid : Error<
11763  "__builtin_preserve_enum_value argument %0 invalid">;
11764def err_preserve_enum_value_not_const: Error<
11765  "__builtin_preserve_enum_value argument %0 not a constant">;
11766
11767def err_bit_cast_non_trivially_copyable : Error<
11768  "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
11769def err_bit_cast_type_size_mismatch : Error<
11770  "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
11771
11772// SYCL-specific diagnostics
11773def warn_sycl_kernel_num_of_template_params : Warning<
11774  "'sycl_kernel' attribute only applies to a function template with at least"
11775  " two template parameters">, InGroup<IgnoredAttributes>;
11776def warn_sycl_kernel_invalid_template_param_type : Warning<
11777  "template parameter of a function template with the 'sycl_kernel' attribute"
11778  " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
11779def warn_sycl_kernel_num_of_function_params : Warning<
11780  "function template with 'sycl_kernel' attribute must have a single parameter">,
11781  InGroup<IgnoredAttributes>;
11782def warn_sycl_kernel_return_type : Warning<
11783  "function template with 'sycl_kernel' attribute must have a 'void' return type">,
11784  InGroup<IgnoredAttributes>;
11785def err_sycl_special_type_num_init_method : Error<
11786  "types with 'sycl_special_class' attribute must have one and only one '__init' "
11787  "method defined">;
11788
11789def err_bit_int_bad_size : Error<"%select{signed|unsigned}0 _BitInt must "
11790                                 "have a bit size of at least %select{2|1}0">;
11791def err_bit_int_max_size : Error<"%select{signed|unsigned}0 _BitInt of bit "
11792                                 "sizes greater than %1 not supported">;
11793
11794// errors of expect.with.probability
11795def err_probability_not_constant_float : Error<
11796   "probability argument to __builtin_expect_with_probability must be constant "
11797   "floating-point expression">;
11798def err_probability_out_of_range : Error<
11799   "probability argument to __builtin_expect_with_probability is outside the "
11800   "range [0.0, 1.0]">;
11801
11802// TCB warnings
11803def err_tcb_conflicting_attributes : Error<
11804  "attributes '%0(\"%2\")' and '%1(\"%2\")' are mutually exclusive">;
11805def warn_tcb_enforcement_violation : Warning<
11806  "calling %0 is a violation of trusted computing base '%1'">,
11807  InGroup<DiagGroup<"tcb-enforcement">>;
11808
11809// RISC-V builtin required extension warning
11810def err_riscv_builtin_requires_extension : Error<
11811  "builtin requires%select{| at least one of the following extensions to be enabled}0: %1">;
11812def err_riscv_builtin_invalid_lmul : Error<
11813  "LMUL argument must be in the range [0,3] or [5,7]">;
11814def err_riscv_type_requires_extension : Error<
11815  "RISC-V type %0 requires the '%1' extension"
11816>;
11817
11818def err_std_source_location_impl_not_found : Error<
11819  "'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called">;
11820def err_std_source_location_impl_malformed : Error<
11821  "'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'">;
11822
11823// HLSL Diagnostics
11824def 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">;
11825def err_hlsl_attr_invalid_type : Error<
11826   "attribute %0 only applies to a field or parameter of type '%1'">;
11827def err_hlsl_attr_invalid_ast_node : Error<
11828   "attribute %0 only applies to %1">;
11829def err_hlsl_entry_shader_attr_mismatch : Error<
11830   "%0 attribute on entry function does not match the pipeline stage">;
11831def err_hlsl_numthreads_argument_oor : Error<"argument '%select{X|Y|Z}0' to numthreads attribute cannot exceed %1">;
11832def err_hlsl_numthreads_invalid : Error<"total number of threads cannot exceed %0">;
11833def err_hlsl_missing_numthreads : Error<"missing numthreads attribute for %0 shader entry">;
11834def err_hlsl_attribute_param_mismatch : Error<"%0 attribute parameters do not match the previous declaration">;
11835def err_hlsl_missing_semantic_annotation : Error<
11836  "semantic annotations must be present for all parameters of an entry "
11837  "function or patch constant function">;
11838def err_hlsl_init_priority_unsupported : Error<
11839  "initializer priorities are not supported in HLSL">;
11840
11841def err_hlsl_unsupported_register_type : Error<"invalid resource class specifier '%0' used; expected 'b', 's', 't', or 'u'">;
11842def err_hlsl_unsupported_register_number : Error<"register number should be an integer">;
11843def err_hlsl_expected_space : Error<"invalid space specifier '%0' used; expected 'space' followed by an integer, like space1">;
11844def err_hlsl_pointers_unsupported : Error<
11845  "%select{pointers|references}0 are unsupported in HLSL">;
11846
11847def err_hlsl_operator_unsupported : Error<
11848  "the '%select{&|*|->}0' operator is unsupported in HLSL">;
11849
11850// Layout randomization diagnostics.
11851def err_non_designated_init_used : Error<
11852  "a randomized struct can only be initialized with a designated initializer">;
11853def err_cast_from_randomized_struct : Error<
11854  "casting from randomized structure pointer type %0 to %1">;
11855
11856// LoongArch-specific Diagnostics
11857def err_loongarch_builtin_requires_la64 : Error<
11858  "this builtin requires target: loongarch64">;
11859
11860// Unsafe buffer usage diagnostics.
11861def warn_unsafe_buffer_variable : Warning<
11862  "%0 is an %select{unsafe pointer used for buffer access|unsafe buffer that "
11863  "does not perform bounds checks}1">,
11864  InGroup<UnsafeBufferUsage>, DefaultIgnore;
11865def warn_unsafe_buffer_operation : Warning<
11866  "%select{unsafe pointer operation|unsafe pointer arithmetic|"
11867  "unsafe buffer access|function introduces unsafe buffer manipulation}0">,
11868  InGroup<UnsafeBufferUsage>, DefaultIgnore;
11869def note_unsafe_buffer_operation : Note<
11870  "used%select{| in pointer arithmetic| in buffer access}0 here">;
11871def note_unsafe_buffer_variable_fixit_group : Note<
11872  "change type of %0 to '%select{std::span|std::array|std::span::iterator}1' to preserve bounds information%select{|, and change %2 to '%select{std::span|std::array|std::span::iterator}1' to propagate bounds information between them}3">;
11873def note_safe_buffer_usage_suggestions_disabled : Note<
11874  "pass -fsafe-buffer-usage-suggestions to receive code hardening suggestions">;
11875def err_loongarch_builtin_requires_la32 : Error<
11876  "this builtin requires target: loongarch32">;
11877
11878def err_builtin_pass_in_regs_non_class : Error<
11879  "argument %0 is not an unqualified class type">;
11880
11881
11882// WebAssembly reference type and table diagnostics.
11883def err_wasm_reference_pr : Error<
11884  "%select{pointer|reference}0 to WebAssembly reference type is not allowed">;
11885def err_wasm_ca_reference : Error<
11886  "cannot %select{capture|take address of}0 WebAssembly reference">;
11887def err_wasm_funcref_not_wasm : Error<
11888  "invalid use of '__funcref' keyword outside the WebAssembly triple">;
11889def err_wasm_table_pr : Error<
11890  "cannot form a %select{pointer|reference}0 to a WebAssembly table">;
11891def err_typecheck_wasm_table_must_have_zero_length : Error<
11892  "only zero-length WebAssembly tables are currently supported">;
11893def err_wasm_table_in_function : Error<
11894  "WebAssembly table cannot be declared within a function">;
11895def err_wasm_table_as_function_parameter : Error<
11896  "cannot use WebAssembly table as a function parameter">;
11897def err_wasm_table_invalid_uett_operand : Error<
11898  "invalid application of '%0' to WebAssembly table">;
11899def err_wasm_cast_table : Error<
11900  "cannot cast %select{to|from}0 a WebAssembly table">;
11901def err_wasm_table_conditional_expression : Error<
11902  "cannot use a WebAssembly table within a branch of a conditional expression">;
11903def err_wasm_table_art : Error<
11904  "cannot %select{assign|return|throw|subscript}0 a WebAssembly table">;
11905def err_wasm_reftype_tc : Error<
11906  "cannot %select{throw|catch}0 a WebAssembly reference type">;
11907def err_wasm_reftype_exception_spec : Error<
11908  "WebAssembly reference type not allowed in exception specification">;
11909def err_wasm_table_must_be_static : Error<
11910  "WebAssembly table must be static">;
11911def err_wasm_reftype_multidimensional_array : Error<
11912  "multi-dimensional arrays of WebAssembly references are not allowed">;
11913def err_wasm_builtin_arg_must_be_table_type : Error <
11914  "%ordinal0 argument must be a WebAssembly table">;
11915def err_wasm_builtin_arg_must_match_table_element_type : Error <
11916  "%ordinal0 argument must match the element type of the WebAssembly table in the %ordinal1 argument">;
11917def err_wasm_builtin_arg_must_be_integer_type : Error <
11918  "%ordinal0 argument must be an integer">;
11919} // end of sema component.
11920