xref: /freebsd/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
1//==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Semantic Analysis
11//===----------------------------------------------------------------------===//
12
13let Component = "Sema" in {
14let CategoryName = "Semantic Issue" in {
15def note_previous_decl : Note<"%0 declared here">;
16def note_entity_declared_at : Note<"%0 declared here">;
17def note_callee_decl : Note<"%0 declared here">;
18def note_defined_here : Note<"%0 defined here">;
19
20// For loop analysis
21def warn_variables_not_in_loop_body : Warning<
22  "variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 "
23  "used in loop condition not modified in loop body">,
24  InGroup<ForLoopAnalysis>, DefaultIgnore;
25def warn_redundant_loop_iteration : Warning<
26  "variable %0 is %select{decremented|incremented}1 both in the loop header "
27  "and in the loop body">,
28  InGroup<ForLoopAnalysis>, DefaultIgnore;
29def note_loop_iteration_here : Note<"%select{decremented|incremented}0 here">;
30
31def warn_duplicate_enum_values : Warning<
32  "element %0 has been implicitly assigned %1 which another element has "
33  "been assigned">, InGroup<DiagGroup<"duplicate-enum">>, DefaultIgnore;
34def note_duplicate_element : Note<"element %0 also has value %1">;
35
36// Absolute value functions
37def warn_unsigned_abs : Warning<
38  "taking the absolute value of unsigned type %0 has no effect">,
39  InGroup<AbsoluteValue>;
40def note_remove_abs : Note<
41  "remove the call to '%0' since unsigned values cannot be negative">;
42def warn_abs_too_small : Warning<
43  "absolute value function %0 given an argument of type %1 but has parameter "
44  "of type %2 which may cause truncation of value">, InGroup<AbsoluteValue>;
45def warn_wrong_absolute_value_type : Warning<
46  "using %select{integer|floating point|complex}1 absolute value function %0 "
47  "when argument is of %select{integer|floating point|complex}2 type">,
48  InGroup<AbsoluteValue>;
49def note_replace_abs_function : Note<"use function '%0' instead">;
50def warn_pointer_abs : Warning<
51  "taking the absolute value of %select{pointer|function|array}0 type %1 is suspicious">,
52  InGroup<AbsoluteValue>;
53
54def warn_max_unsigned_zero : Warning<
55  "taking the max of "
56  "%select{a value and unsigned zero|unsigned zero and a value}0 "
57  "is always equal to the other value">,
58  InGroup<MaxUnsignedZero>;
59def note_remove_max_call : Note<
60  "remove call to max function and unsigned zero argument">;
61
62def warn_infinite_recursive_function : Warning<
63  "all paths through this function will call itself">,
64  InGroup<InfiniteRecursion>, DefaultIgnore;
65
66def warn_comma_operator : Warning<"possible misuse of comma operator here">,
67  InGroup<DiagGroup<"comma">>, DefaultIgnore;
68def note_cast_to_void : Note<"cast expression to void to silence warning">;
69def note_cast_operand_to_int : Note<"cast one or both operands to int to silence this warning">;
70
71// Constant expressions
72def err_expr_not_ice : Error<
73  "expression is not an %select{integer|integral}0 constant expression">;
74def ext_expr_not_ice : Extension<
75  "expression is not an %select{integer|integral}0 constant expression; "
76  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
77def err_typecheck_converted_constant_expression : Error<
78  "value of type %0 is not implicitly convertible to %1">;
79def err_typecheck_converted_constant_expression_disallowed : Error<
80  "conversion from %0 to %1 is not allowed in a converted constant expression">;
81def err_typecheck_converted_constant_expression_indirect : Error<
82  "conversion from %0 to %1 in converted constant expression would "
83  "bind reference to a temporary">;
84def err_expr_not_cce : Error<
85  "%select{case value|enumerator value|non-type template argument|"
86  "array size|explicit specifier argument|noexcept specifier argument}0 "
87  "is not a constant expression">;
88def ext_cce_narrowing : ExtWarn<
89  "%select{case value|enumerator value|non-type template argument|"
90  "array size|explicit specifier argument|noexcept specifier argument}0 "
91  "%select{cannot be narrowed from type %2 to %3|"
92  "evaluates to %2, which cannot be narrowed to type %3}1">,
93  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
94def err_ice_not_integral : Error<
95  "%select{integer|integral}1 constant expression must have "
96  "%select{integer|integral or unscoped enumeration}1 type, not %0">;
97def err_ice_incomplete_type : Error<
98  "integral constant expression has incomplete class type %0">;
99def err_ice_explicit_conversion : Error<
100  "integral constant expression requires explicit conversion from %0 to %1">;
101def note_ice_conversion_here : Note<
102  "conversion to %select{integral|enumeration}0 type %1 declared here">;
103def err_ice_ambiguous_conversion : Error<
104  "ambiguous conversion from type %0 to an integral or unscoped "
105  "enumeration type">;
106def err_ice_too_large : Error<
107  "integer constant expression evaluates to value %0 that cannot be "
108  "represented in a %1-bit %select{signed|unsigned}2 integer type">;
109def err_expr_not_string_literal : Error<"expression is not a string literal">;
110
111// Semantic analysis of constant literals.
112def ext_predef_outside_function : Warning<
113  "predefined identifier is only valid inside function">,
114  InGroup<DiagGroup<"predefined-identifier-outside-function">>;
115def warn_float_overflow : Warning<
116  "magnitude of floating-point constant too large for type %0; maximum is %1">,
117   InGroup<LiteralRange>;
118def warn_float_underflow : Warning<
119  "magnitude of floating-point constant too small for type %0; minimum is %1">,
120  InGroup<LiteralRange>;
121def warn_double_const_requires_fp64 : Warning<
122  "double precision constant requires %select{cl_khr_fp64|cl_khr_fp64 and __opencl_c_fp64}0, "
123  "casting to single precision">;
124def err_half_const_requires_fp16 : Error<
125  "half precision constant requires cl_khr_fp16">;
126
127// C99 variable-length arrays
128def ext_vla : Extension<"variable length arrays are a C99 feature">,
129  InGroup<VLAExtension>;
130def warn_vla_used : Warning<"variable length array used">,
131  InGroup<VLA>, DefaultIgnore;
132def err_vla_in_sfinae : Error<
133  "variable length array cannot be formed during template argument deduction">;
134def err_array_star_in_function_definition : Error<
135  "variable length array must be bound in function definition">;
136def err_vla_decl_in_file_scope : Error<
137  "variable length array declaration not allowed at file scope">;
138def err_vla_decl_has_static_storage : Error<
139  "variable length array declaration cannot have 'static' storage duration">;
140def err_vla_decl_has_extern_linkage : Error<
141  "variable length array declaration cannot have 'extern' linkage">;
142def ext_vla_folded_to_constant : ExtWarn<
143  "variable length array folded to constant array as an extension">,
144  InGroup<GNUFoldingConstant>;
145def err_vla_unsupported : Error<
146  "variable length arrays are not supported for the current target">;
147def note_vla_unsupported : Note<
148  "variable length arrays are not supported for the current target">;
149
150// C99 variably modified types
151def err_variably_modified_template_arg : Error<
152  "variably modified type %0 cannot be used as a template argument">;
153def err_variably_modified_nontype_template_param : Error<
154  "non-type template parameter of variably modified type %0">;
155def err_variably_modified_new_type : Error<
156  "'new' cannot allocate object of variably modified type %0">;
157
158// C99 Designated Initializers
159def ext_designated_init : Extension<
160  "designated initializers are a C99 feature">, InGroup<C99Designator>;
161def err_array_designator_negative : Error<
162  "array designator value '%0' is negative">;
163def err_array_designator_empty_range : Error<
164  "array designator range [%0, %1] is empty">;
165def err_array_designator_non_array : Error<
166  "array designator cannot initialize non-array type %0">;
167def err_array_designator_too_large : Error<
168  "array designator index (%0) exceeds array bounds (%1)">;
169def err_field_designator_non_aggr : Error<
170  "field designator cannot initialize a "
171  "%select{non-struct, non-union|non-class}0 type %1">;
172def err_field_designator_unknown : Error<
173  "field designator %0 does not refer to any field in type %1">;
174def err_field_designator_nonfield : Error<
175  "field designator %0 does not refer to a non-static data member">;
176def note_field_designator_found : Note<"field designator refers here">;
177def err_designator_for_scalar_or_sizeless_init : Error<
178  "designator in initializer for %select{scalar|indivisible sizeless}0 "
179  "type %1">;
180def warn_initializer_overrides : Warning<
181  "initializer %select{partially |}0overrides prior initialization of "
182  "this subobject">, InGroup<InitializerOverrides>;
183def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Text>,
184  InGroup<InitializerOverrides>, SFINAEFailure;
185def err_initializer_overrides_destructed : Error<
186  "initializer would partially override prior initialization of object of "
187  "type %1 with non-trivial destruction">;
188def note_previous_initializer : Note<
189  "previous initialization %select{|with side effects }0is here"
190  "%select{| (side effects will not occur at run time)}0">;
191def err_designator_into_flexible_array_member : Error<
192  "designator into flexible array member subobject">;
193def note_flexible_array_member : Note<
194  "initialized flexible array member %0 is here">;
195def ext_flexible_array_init : Extension<
196  "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
197
198// C++20 designated initializers
199def ext_cxx_designated_init : Extension<
200  "designated initializers are a C++20 extension">, InGroup<CXX20Designator>,
201  SuppressInSystemMacro;
202def warn_cxx17_compat_designated_init : Warning<
203  "designated initializers are incompatible with C++ standards before C++20">,
204  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
205def ext_designated_init_mixed : ExtWarn<
206  "mixture of designated and non-designated initializers in the same "
207  "initializer list is a C99 extension">, InGroup<C99Designator>;
208def note_designated_init_mixed : Note<
209  "first non-designated initializer is here">;
210def ext_designated_init_array : ExtWarn<
211  "array designators are a C99 extension">, InGroup<C99Designator>;
212def ext_designated_init_nested : ExtWarn<
213  "nested designators are a C99 extension">, InGroup<C99Designator>;
214def ext_designated_init_reordered : ExtWarn<
215  "ISO C++ requires field designators to be specified in declaration order; "
216  "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
217  SFINAEFailure;
218def note_previous_field_init : Note<
219  "previous initialization for field %0 is here">;
220def ext_designated_init_brace_elision : ExtWarn<
221  "brace elision for designated initializer is a C99 extension">,
222  InGroup<C99Designator>, SFINAEFailure;
223
224// Declarations.
225def ext_plain_complex : ExtWarn<
226  "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
227def ext_imaginary_constant : Extension<
228  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
229def ext_integer_complex : Extension<
230  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
231
232def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
233  "'_Fract' or '_Accum', not '%0'">;
234def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
235def err_invalid_width_spec : Error<
236  "'%select{|short|long|long long}0 %1' is invalid">;
237def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
238
239def ext_auto_type_specifier : ExtWarn<
240  "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
241def warn_auto_storage_class : Warning<
242  "'auto' storage class specifier is redundant and incompatible with C++11">,
243  InGroup<CXX11Compat>, DefaultIgnore;
244
245def warn_deprecated_register : Warning<
246  "'register' storage class specifier is deprecated "
247  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
248def ext_register_storage_class : ExtWarn<
249  "ISO C++17 does not allow 'register' storage class specifier">,
250  DefaultError, InGroup<Register>;
251
252def err_invalid_decl_spec_combination : Error<
253  "cannot combine with previous '%0' declaration specifier">;
254def err_invalid_vector_decl_spec_combination : Error<
255  "cannot combine with previous '%0' declaration specifier. "
256  "'__vector' must be first">;
257def err_invalid_pixel_decl_spec_combination : Error<
258  "'__pixel' must be preceded by '__vector'.  "
259  "'%0' declaration specifier not allowed here">;
260def err_invalid_vector_bool_decl_spec : Error<
261  "cannot use '%0' with '__vector bool'">;
262def err_invalid_vector_long_decl_spec : Error<
263  "cannot use 'long' with '__vector'">;
264def err_invalid_vector_float_decl_spec : Error<
265  "cannot use 'float' with '__vector'">;
266def err_invalid_vector_double_decl_spec : Error <
267  "use of 'double' with '__vector' requires VSX support to be enabled "
268  "(available on POWER7 or later)">;
269def err_invalid_vector_bool_int128_decl_spec : Error <
270  "use of '__int128' with '__vector bool' requires VSX support enabled (on "
271  "POWER10 or later)">;
272def err_invalid_vector_int128_decl_spec : Error<
273  "use of '__int128' with '__vector' requires extended Altivec support"
274  " (available on POWER8 or later)">;
275def err_invalid_vector_long_long_decl_spec : Error <
276  "use of 'long long' with '__vector' requires VSX support (available on "
277  "POWER7 or later) to be enabled">;
278def err_invalid_vector_long_double_decl_spec : Error<
279  "cannot use 'long double' with '__vector'">;
280def warn_vector_long_decl_spec_combination : Warning<
281  "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
282
283def err_redeclaration_different_type : Error<
284  "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
285def err_bad_variable_name : Error<
286  "%0 cannot be the name of a variable or data member">;
287def err_bad_parameter_name : Error<
288  "%0 cannot be the name of a parameter">;
289def err_bad_parameter_name_template_id : Error<
290  "parameter name cannot have template arguments">;
291def ext_parameter_name_omitted_c2x : ExtWarn<
292  "omitting the parameter name in a function definition is a C2x extension">,
293  InGroup<C2x>;
294def err_anyx86_interrupt_attribute : Error<
295  "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
296  "have %select{a 'void' return type|"
297  "only a pointer parameter optionally followed by an integer parameter|"
298  "a pointer as the first parameter|a %2 type as the second parameter}1">;
299def err_anyx86_interrupt_called : Error<
300  "interrupt service routine cannot be called directly">;
301def warn_anyx86_interrupt_regsave : Warning<
302  "interrupt service routine should only call a function"
303  " with attribute 'no_caller_saved_registers'">,
304  InGroup<DiagGroup<"interrupt-service-routine">>;
305def warn_arm_interrupt_calling_convention : Warning<
306   "call to function without interrupt attribute could clobber interruptee's VFP registers">,
307   InGroup<Extra>;
308def warn_interrupt_attribute_invalid : Warning<
309   "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
310   "functions that have %select{no parameters|a 'void' return type}1">,
311   InGroup<IgnoredAttributes>;
312def warn_riscv_repeated_interrupt_attribute : Warning<
313  "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
314def note_riscv_repeated_interrupt_attribute : Note<
315  "repeated RISC-V 'interrupt' attribute is here">;
316def warn_unused_parameter : Warning<"unused parameter %0">,
317  InGroup<UnusedParameter>, DefaultIgnore;
318def warn_unused_but_set_parameter : Warning<"parameter %0 set but not used">,
319  InGroup<UnusedButSetParameter>, DefaultIgnore;
320def warn_unused_variable : Warning<"unused variable %0">,
321  InGroup<UnusedVariable>, DefaultIgnore;
322def warn_unused_but_set_variable : Warning<"variable %0 set but not used">,
323  InGroup<UnusedButSetVariable>, DefaultIgnore;
324def warn_unused_local_typedef : Warning<
325  "unused %select{typedef|type alias}0 %1">,
326  InGroup<UnusedLocalTypedef>, DefaultIgnore;
327def warn_unused_property_backing_ivar :
328  Warning<"ivar %0 which backs the property is not "
329  "referenced in this property's accessor">,
330  InGroup<UnusedPropertyIvar>, DefaultIgnore;
331def warn_unused_const_variable : Warning<"unused variable %0">,
332  InGroup<UnusedConstVariable>, DefaultIgnore;
333def warn_unused_exception_param : Warning<"unused exception parameter %0">,
334  InGroup<UnusedExceptionParameter>, DefaultIgnore;
335def warn_decl_in_param_list : Warning<
336  "declaration of %0 will not be visible outside of this function">,
337  InGroup<Visibility>;
338def warn_redefinition_in_param_list : Warning<
339  "redefinition of %0 will not be visible outside of this function">,
340  InGroup<Visibility>;
341def warn_empty_parens_are_function_decl : Warning<
342  "empty parentheses interpreted as a function declaration">,
343  InGroup<VexingParse>;
344def warn_parens_disambiguated_as_function_declaration : Warning<
345  "parentheses were disambiguated as a function declaration">,
346  InGroup<VexingParse>;
347def warn_parens_disambiguated_as_variable_declaration : Warning<
348  "parentheses were disambiguated as redundant parentheses around declaration "
349  "of variable named %0">, InGroup<VexingParse>;
350def warn_redundant_parens_around_declarator : Warning<
351  "redundant parentheses surrounding declarator">,
352  InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
353def note_additional_parens_for_variable_declaration : Note<
354  "add a pair of parentheses to declare a variable">;
355def note_raii_guard_add_name : Note<
356  "add a variable name to declare a %0 initialized with %1">;
357def note_function_style_cast_add_parentheses : Note<
358  "add enclosing parentheses to perform a function-style cast">;
359def note_remove_parens_for_variable_declaration : Note<
360  "remove parentheses to silence this warning">;
361def note_empty_parens_function_call : Note<
362  "change this ',' to a ';' to call %0">;
363def note_empty_parens_default_ctor : Note<
364  "remove parentheses to declare a variable">;
365def note_empty_parens_zero_initialize : Note<
366  "replace parentheses with an initializer to declare a variable">;
367def warn_unused_function : Warning<"unused function %0">,
368  InGroup<UnusedFunction>, DefaultIgnore;
369def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
370  InGroup<UnusedTemplate>, DefaultIgnore;
371def warn_unused_member_function : Warning<"unused member function %0">,
372  InGroup<UnusedMemberFunction>, DefaultIgnore;
373def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
374  InGroup<UsedButMarkedUnused>, DefaultIgnore;
375def warn_unneeded_internal_decl : Warning<
376  "%select{function|variable}0 %1 is not needed and will not be emitted">,
377  InGroup<UnneededInternalDecl>, DefaultIgnore;
378def warn_unneeded_static_internal_decl : Warning<
379  "'static' function %0 declared in header file "
380  "should be declared 'static inline'">,
381  InGroup<UnneededInternalDecl>, DefaultIgnore;
382def warn_unneeded_member_function : Warning<
383  "member function %0 is not needed and will not be emitted">,
384  InGroup<UnneededMemberFunction>, DefaultIgnore;
385def warn_unused_private_field: Warning<"private field %0 is not used">,
386  InGroup<UnusedPrivateField>, DefaultIgnore;
387def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
388  "%select{used|required to be captured for this use}1">,
389  InGroup<UnusedLambdaCapture>, DefaultIgnore;
390
391def warn_reserved_extern_symbol: Warning<
392  "identifier %0 is reserved because %select{"
393  "<ERROR>|" // ReservedIdentifierStatus::NotReserved
394  "it starts with '_' at global scope|"
395  "it starts with '_' and has C language linkage|"
396  "it starts with '__'|"
397  "it starts with '_' followed by a capital letter|"
398  "it contains '__'}1">,
399  InGroup<ReservedIdentifier>, DefaultIgnore;
400
401def warn_parameter_size: Warning<
402  "%0 is a large (%1 bytes) pass-by-value argument; "
403  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
404def warn_return_value_size: Warning<
405  "return value of %0 is a large (%1 bytes) pass-by-value object; "
406  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
407def warn_return_value_udt: Warning<
408  "%0 has C-linkage specified, but returns user-defined type %1 which is "
409  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
410def warn_return_value_udt_incomplete: Warning<
411  "%0 has C-linkage specified, but returns incomplete type %1 which could be "
412  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
413def warn_implicit_function_decl : Warning<
414  "implicit declaration of function %0">,
415  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
416def ext_implicit_function_decl : ExtWarn<
417  "implicit declaration of function %0 is invalid in C99">,
418  InGroup<ImplicitFunctionDeclare>;
419def note_function_suggestion : Note<"did you mean %0?">;
420
421def err_ellipsis_first_param : Error<
422  "ISO C requires a named parameter before '...'">;
423def err_declarator_need_ident : Error<"declarator requires an identifier">;
424def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
425def err_language_linkage_spec_not_ascii : Error<
426  "string literal in language linkage specifier cannot have an "
427  "encoding-prefix">;
428def ext_use_out_of_scope_declaration : ExtWarn<
429  "use of out-of-scope declaration of %0%select{| whose type is not "
430  "compatible with that of an implicit declaration}1">,
431  InGroup<DiagGroup<"out-of-scope-function">>;
432def err_inline_non_function : Error<
433  "'inline' can only appear on functions%select{| and non-local variables}0">;
434def err_noreturn_non_function : Error<
435  "'_Noreturn' can only appear on functions">;
436def warn_qual_return_type : Warning<
437  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
438  InGroup<IgnoredQualifiers>, DefaultIgnore;
439def warn_deprecated_redundant_constexpr_static_def : Warning<
440  "out-of-line definition of constexpr static data member is redundant "
441  "in C++17 and is deprecated">,
442  InGroup<Deprecated>, DefaultIgnore;
443
444def warn_decl_shadow :
445  Warning<"declaration shadows a %select{"
446          "local variable|"
447          "variable in %2|"
448          "static data member of %2|"
449          "field of %2|"
450          "typedef in %2|"
451          "type alias in %2|"
452          "structured binding}1">,
453  InGroup<Shadow>, DefaultIgnore, SuppressInSystemMacro;
454def warn_decl_shadow_uncaptured_local :
455  Warning<warn_decl_shadow.Text>,
456  InGroup<ShadowUncapturedLocal>, DefaultIgnore;
457def warn_ctor_parm_shadows_field:
458  Warning<"constructor parameter %0 shadows the field %1 of %2">,
459  InGroup<ShadowFieldInConstructor>, DefaultIgnore;
460def warn_modifying_shadowing_decl :
461  Warning<"modifying constructor parameter %0 that shadows a "
462          "field of %1">,
463  InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
464
465// C++ decomposition declarations
466def err_decomp_decl_context : Error<
467  "decomposition declaration not permitted in this context">;
468def warn_cxx14_compat_decomp_decl : Warning<
469  "decomposition declarations are incompatible with "
470  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
471def ext_decomp_decl : ExtWarn<
472  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
473def ext_decomp_decl_cond : ExtWarn<
474  "ISO C++17 does not permit structured binding declaration in a condition">,
475  InGroup<DiagGroup<"binding-in-condition">>;
476def err_decomp_decl_spec : Error<
477  "decomposition declaration cannot be declared "
478  "%plural{1:'%1'|:with '%1' specifiers}0">;
479def ext_decomp_decl_spec : ExtWarn<
480  "decomposition declaration declared "
481  "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
482  InGroup<CXX20>;
483def warn_cxx17_compat_decomp_decl_spec : Warning<
484  "decomposition declaration declared "
485  "%plural{1:'%1'|:with '%1' specifiers}0 "
486  "is incompatible with C++ standards before C++20">,
487  InGroup<CXXPre20Compat>, DefaultIgnore;
488def err_decomp_decl_type : Error<
489  "decomposition declaration cannot be declared with type %0; "
490  "declared type must be 'auto' or reference to 'auto'">;
491def err_decomp_decl_parens : Error<
492  "decomposition declaration cannot be declared with parentheses">;
493def err_decomp_decl_template : Error<
494  "decomposition declaration template not supported">;
495def err_decomp_decl_not_alone : Error<
496  "decomposition declaration must be the only declaration in its group">;
497def err_decomp_decl_requires_init : Error<
498  "decomposition declaration %0 requires an initializer">;
499def err_decomp_decl_wrong_number_bindings : Error<
500  "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
501  "%select{%plural{0:no|:only %1}1|%1}4 "
502  "%plural{1:name was|:names were}1 provided">;
503def err_decomp_decl_unbindable_type : Error<
504  "cannot decompose %select{union|non-class, non-array}1 type %2">;
505def err_decomp_decl_multiple_bases_with_members : Error<
506  "cannot decompose class type %1: "
507  "%select{its base classes %2 and|both it and its base class}0 %3 "
508  "have non-static data members">;
509def err_decomp_decl_ambiguous_base : Error<
510  "cannot decompose members of ambiguous base class %1 of %0:%2">;
511def err_decomp_decl_inaccessible_base : Error<
512  "cannot decompose members of inaccessible base class %1 of %0">,
513  AccessControl;
514def err_decomp_decl_inaccessible_field : Error<
515  "cannot decompose %select{private|protected}0 member %1 of %3">,
516  AccessControl;
517def err_decomp_decl_lambda : Error<
518  "cannot decompose lambda closure type">;
519def err_decomp_decl_anon_union_member : Error<
520  "cannot decompose class type %0 because it has an anonymous "
521  "%select{struct|union}1 member">;
522def err_decomp_decl_std_tuple_element_not_specialized : Error<
523  "cannot decompose this type; 'std::tuple_element<%0>::type' "
524  "does not name a type">;
525def err_decomp_decl_std_tuple_size_not_constant : Error<
526  "cannot decompose this type; 'std::tuple_size<%0>::value' "
527  "is not a valid integral constant expression">;
528def note_in_binding_decl_init : Note<
529  "in implicit initialization of binding declaration %0">;
530
531def err_std_type_trait_not_class_template : Error<
532  "unsupported standard library implementation: "
533  "'std::%0' is not a class template">;
534
535// C++ using declarations
536def err_using_requires_qualname : Error<
537  "using declaration requires a qualified name">;
538def err_using_typename_non_type : Error<
539  "'typename' keyword used on a non-type">;
540def err_using_dependent_value_is_type : Error<
541  "dependent using declaration resolved to type without 'typename'">;
542def err_using_decl_nested_name_specifier_is_not_class : Error<
543  "using declaration in class refers into '%0', which is not a class">;
544def warn_cxx17_compat_using_decl_non_member_enumerator : Warning<
545  "member using declaration naming non-class '%0' enumerator is "
546  "incompatible with C++ standards before C++20">, InGroup<CXXPre20Compat>,
547  DefaultIgnore;
548def err_using_decl_nested_name_specifier_is_current_class : Error<
549  "using declaration refers to its own class">;
550def err_using_decl_nested_name_specifier_is_not_base_class : Error<
551  "using declaration refers into '%0', which is not a base class of %1">;
552def err_using_decl_constructor_not_in_direct_base : Error<
553  "%0 is not a direct base of %1, cannot inherit constructors">;
554def err_using_decl_can_not_refer_to_class_member : Error<
555  "using declaration cannot refer to class member">;
556def warn_cxx17_compat_using_decl_class_member_enumerator : Warning<
557  "member using declaration naming a non-member enumerator is incompatible "
558  "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
559def ext_using_decl_class_member_enumerator : ExtWarn<
560  "member using declaration naming a non-member enumerator is "
561  "a C++20 extension">, InGroup<CXX20>;
562def err_using_enum_is_dependent : Error<
563  "using-enum cannot name a dependent type">;
564def err_ambiguous_inherited_constructor : Error<
565  "constructor of %0 inherited from multiple base class subobjects">;
566def note_ambiguous_inherited_constructor_using : Note<
567  "inherited from base class %0 here">;
568def note_using_decl_class_member_workaround : Note<
569  "use %select{an alias declaration|a typedef declaration|a reference|"
570  "a const variable|a constexpr variable}0 instead">;
571def err_using_decl_can_not_refer_to_namespace : Error<
572  "using declaration cannot refer to a namespace">;
573def warn_cxx17_compat_using_decl_scoped_enumerator: Warning<
574  "using declaration naming a scoped enumerator is incompatible with "
575  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
576def ext_using_decl_scoped_enumerator : ExtWarn<
577  "using declaration naming a scoped enumerator is a C++20 extension">,
578  InGroup<CXX20>;
579def err_using_decl_constructor : Error<
580  "using declaration cannot refer to a constructor">;
581def warn_cxx98_compat_using_decl_constructor : Warning<
582  "inheriting constructors are incompatible with C++98">,
583  InGroup<CXX98Compat>, DefaultIgnore;
584def err_using_decl_destructor : Error<
585  "using declaration cannot refer to a destructor">;
586def err_using_decl_template_id : Error<
587  "using declaration cannot refer to a template specialization">;
588def note_using_decl_target : Note<"target of using declaration">;
589def note_using_decl_conflict : Note<"conflicting declaration">;
590def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
591def err_using_decl_conflict : Error<
592  "target of using declaration conflicts with declaration already in scope">;
593def err_using_decl_conflict_reverse : Error<
594  "declaration conflicts with target of using declaration already in scope">;
595def note_using_decl : Note<"%select{|previous }0using declaration">;
596def err_using_decl_redeclaration_expansion : Error<
597  "using declaration pack expansion at block scope produces multiple values">;
598def err_use_of_empty_using_if_exists : Error<
599  "reference to unresolved using declaration">;
600def note_empty_using_if_exists_here : Note<
601  "using declaration annotated with 'using_if_exists' here">;
602def err_using_if_exists_on_ctor : Error<
603  "'using_if_exists' attribute cannot be applied to an inheriting constructor">;
604def err_using_enum_decl_redeclaration : Error<
605  "redeclaration of using-enum declaration">;
606def note_using_enum_decl : Note<"%select{|previous }0using-enum declaration">;
607
608def warn_access_decl_deprecated : Warning<
609  "access declarations are deprecated; use using declarations instead">,
610  InGroup<Deprecated>;
611def err_access_decl : Error<
612  "ISO C++11 does not allow access declarations; "
613  "use using declarations instead">;
614def warn_deprecated_copy : Warning<
615  "definition of implicit copy %select{constructor|assignment operator}1 "
616  "for %0 is deprecated because it has a user-declared copy "
617  "%select{assignment operator|constructor}1">,
618  InGroup<DeprecatedCopy>, DefaultIgnore;
619def warn_deprecated_copy_with_dtor : Warning<
620  "definition of implicit copy %select{constructor|assignment operator}1 "
621  "for %0 is deprecated because it has a user-declared destructor">,
622  InGroup<DeprecatedCopyWithDtor>, DefaultIgnore;
623def warn_deprecated_copy_with_user_provided_copy: Warning<
624  "definition of implicit copy %select{constructor|assignment operator}1 "
625  "for %0 is deprecated because it has a user-provided copy "
626  "%select{assignment operator|constructor}1">,
627  InGroup<DeprecatedCopyWithUserProvidedCopy>, DefaultIgnore;
628def warn_deprecated_copy_with_user_provided_dtor : Warning<
629  "definition of implicit copy %select{constructor|assignment operator}1 "
630  "for %0 is deprecated because it has a user-provided destructor">,
631  InGroup<DeprecatedCopyWithUserProvidedDtor>, DefaultIgnore;
632def warn_cxx17_compat_exception_spec_in_signature : Warning<
633  "mangled name of %0 will change in C++17 due to non-throwing exception "
634  "specification in function signature">, InGroup<CXX17CompatMangling>;
635
636def warn_global_constructor : Warning<
637  "declaration requires a global constructor">,
638  InGroup<GlobalConstructors>, DefaultIgnore;
639def warn_global_destructor : Warning<
640  "declaration requires a global destructor">,
641   InGroup<GlobalConstructors>, DefaultIgnore;
642def warn_exit_time_destructor : Warning<
643  "declaration requires an exit-time destructor">,
644  InGroup<ExitTimeDestructors>, DefaultIgnore;
645
646def err_invalid_thread : Error<
647  "'%0' is only allowed on variable declarations">;
648def err_thread_non_global : Error<
649  "'%0' variables must have global storage">;
650def err_thread_unsupported : Error<
651  "thread-local storage is not supported for the current target">;
652
653// FIXME: Combine fallout warnings to just one warning.
654def warn_maybe_falloff_nonvoid_function : Warning<
655  "non-void function does not return a value in all control paths">,
656  InGroup<ReturnType>;
657def warn_falloff_nonvoid_function : Warning<
658  "non-void function does not return a value">,
659  InGroup<ReturnType>;
660def err_maybe_falloff_nonvoid_block : Error<
661  "non-void block does not return a value in all control paths">;
662def err_falloff_nonvoid_block : Error<
663  "non-void block does not return a value">;
664def warn_maybe_falloff_nonvoid_coroutine : Warning<
665  "non-void coroutine does not return a value in all control paths">,
666  InGroup<ReturnType>;
667def warn_falloff_nonvoid_coroutine : Warning<
668  "non-void coroutine does not return a value">,
669  InGroup<ReturnType>;
670def warn_suggest_noreturn_function : Warning<
671  "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
672  InGroup<MissingNoreturn>, DefaultIgnore;
673def warn_suggest_noreturn_block : Warning<
674  "block could be declared with attribute 'noreturn'">,
675  InGroup<MissingNoreturn>, DefaultIgnore;
676
677// Unreachable code.
678def warn_unreachable : Warning<
679  "code will never be executed">,
680  InGroup<UnreachableCode>, DefaultIgnore;
681def warn_unreachable_break : Warning<
682  "'break' will never be executed">,
683  InGroup<UnreachableCodeBreak>, DefaultIgnore;
684def warn_unreachable_return : Warning<
685  "'return' will never be executed">,
686  InGroup<UnreachableCodeReturn>, DefaultIgnore;
687def warn_unreachable_loop_increment : Warning<
688  "loop will run at most once (loop increment never executed)">,
689  InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
690def warn_unreachable_fallthrough_attr : Warning<
691  "fallthrough annotation in unreachable code">,
692  InGroup<UnreachableCodeFallthrough>, DefaultIgnore;
693def note_unreachable_silence : Note<
694  "silence by adding parentheses to mark code as explicitly dead">;
695
696/// Built-in functions.
697def ext_implicit_lib_function_decl : ExtWarn<
698  "implicitly declaring library function '%0' with type %1">,
699  InGroup<ImplicitFunctionDeclare>;
700def note_include_header_or_declare : Note<
701  "include the header <%0> or explicitly provide a declaration for '%1'">;
702def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
703def warn_implicit_decl_no_jmp_buf
704    : Warning<"declaration of built-in function '%0' requires the declaration"
705    " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
706      InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
707def warn_implicit_decl_requires_sysheader : Warning<
708  "declaration of built-in function '%1' requires inclusion of the header <%0>">,
709  InGroup<BuiltinRequiresHeader>;
710def warn_redecl_library_builtin : Warning<
711  "incompatible redeclaration of library function %0">,
712  InGroup<DiagGroup<"incompatible-library-redeclaration">>;
713def err_builtin_definition : Error<"definition of builtin function %0">;
714def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
715def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
716def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
717  "%select{GCP|CDE}1">;
718def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
719def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
720def err_invalid_cpu_specific_dispatch_value : Error<
721"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
722def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
723  InGroup<ImplicitFunctionDeclare>, DefaultError;
724def warn_cstruct_memaccess : Warning<
725  "%select{destination for|source of|first operand of|second operand of}0 this "
726  "%1 call is a pointer to record %2 that is not trivial to "
727  "%select{primitive-default-initialize|primitive-copy}3">,
728  InGroup<NonTrivialMemaccess>;
729def note_nontrivial_field : Note<
730  "field is non-trivial to %select{copy|default-initialize}0">;
731def err_non_trivial_c_union_in_invalid_context : Error<
732  "cannot %select{"
733  "use type %1 for a function/method parameter|"
734  "use type %1 for function/method return|"
735  "default-initialize an object of type %1|"
736  "declare an automatic variable of type %1|"
737  "copy-initialize an object of type %1|"
738  "assign to a variable of type %1|"
739  "construct an automatic compound literal of type %1|"
740  "capture a variable of type %1|"
741  "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
742  "}3 "
743  "since it %select{contains|is}2 a union that is non-trivial to "
744  "%select{default-initialize|destruct|copy}0">;
745def note_non_trivial_c_union : Note<
746  "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
747  "non-trivial to %select{default-initialize|destruct|copy}1">;
748def warn_dyn_class_memaccess : Warning<
749  "%select{destination for|source of|first operand of|second operand of}0 this "
750  "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
751  "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
752  InGroup<DynamicClassMemaccess>;
753def note_bad_memaccess_silence : Note<
754  "explicitly cast the pointer to silence this warning">;
755def warn_sizeof_pointer_expr_memaccess : Warning<
756  "'%0' call operates on objects of type %1 while the size is based on a "
757  "different type %2">,
758  InGroup<SizeofPointerMemaccess>;
759def warn_sizeof_pointer_expr_memaccess_note : Note<
760  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
761  "it by the number of elements)|remove the addressof in the argument to "
762  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
763  "length}0?">;
764def warn_sizeof_pointer_type_memaccess : Warning<
765  "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
766  "%select{destination|source}2; expected %3 or an explicit length">,
767  InGroup<SizeofPointerMemaccess>;
768def warn_strlcpycat_wrong_size : Warning<
769  "size argument in %0 call appears to be size of the source; "
770  "expected the size of the destination">,
771  InGroup<DiagGroup<"strlcpy-strlcat-size">>;
772def note_strlcpycat_wrong_size : Note<
773  "change size argument to be the size of the destination">;
774def warn_memsize_comparison : Warning<
775  "size argument in %0 call is a comparison">,
776  InGroup<DiagGroup<"memsize-comparison">>;
777def note_memsize_comparison_paren : Note<
778  "did you mean to compare the result of %0 instead?">;
779def note_memsize_comparison_cast_silence : Note<
780  "explicitly cast the argument to size_t to silence this warning">;
781def warn_suspicious_sizeof_memset : Warning<
782  "%select{'size' argument to memset is '0'|"
783  "setting buffer to a 'sizeof' expression}0"
784  "; did you mean to transpose the last two arguments?">,
785  InGroup<MemsetTransposedArgs>;
786def note_suspicious_sizeof_memset_silence : Note<
787  "%select{parenthesize the third argument|"
788  "cast the second argument to 'int'}0 to silence">;
789def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
790  InGroup<SuspiciousBzero>;
791def note_suspicious_bzero_size_silence : Note<
792  "parenthesize the second argument to silence">;
793
794def warn_strncat_large_size : Warning<
795  "the value of the size argument in 'strncat' is too large, might lead to a "
796  "buffer overflow">, InGroup<StrncatSize>;
797def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
798  "to be size of the source">, InGroup<StrncatSize>;
799def warn_strncat_wrong_size : Warning<
800  "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
801def note_strncat_wrong_size : Note<
802  "change the argument to be the free space in the destination buffer minus "
803  "the terminating null byte">;
804
805def warn_assume_side_effects : Warning<
806  "the argument to %0 has side effects that will be discarded">,
807  InGroup<DiagGroup<"assume">>;
808def warn_assume_attribute_string_unknown : Warning<
809  "unknown assumption string '%0'; attribute is potentially ignored">,
810  InGroup<UnknownAssumption>;
811def warn_assume_attribute_string_unknown_suggested : Warning<
812  "unknown assumption string '%0' may be misspelled; attribute is potentially "
813  "ignored, did you mean '%1'?">,
814  InGroup<MisspelledAssumption>;
815
816def warn_builtin_chk_overflow : Warning<
817  "'%0' will always overflow; destination buffer has size %1,"
818  " but size argument is %2">,
819  InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
820
821def warn_fortify_source_overflow
822  : Warning<warn_builtin_chk_overflow.Text>, InGroup<FortifySource>;
823def warn_fortify_source_size_mismatch : Warning<
824  "'%0' size argument is too large; destination buffer has size %1,"
825  " but size argument is %2">, InGroup<FortifySource>;
826
827def warn_fortify_strlen_overflow: Warning<
828  "'%0' will always overflow; destination buffer has size %1,"
829  " but the source string has length %2 (including NUL byte)">,
830  InGroup<FortifySource>;
831
832def warn_fortify_source_format_overflow : Warning<
833  "'%0' will always overflow; destination buffer has size %1,"
834  " but format string expands to at least %2">,
835  InGroup<FortifySource>;
836
837def warn_fortify_scanf_overflow : Warning<
838  "'%0' may overflow; destination buffer in argument %1 has size "
839  "%2, but the corresponding specifier may require size %3">,
840  InGroup<FortifySource>;
841
842def err_function_start_invalid_type: Error<
843  "argument must be a function">;
844
845/// main()
846// static main() is not an error in C, just in C++.
847def warn_static_main : Warning<"'main' should not be declared static">,
848    InGroup<Main>;
849def err_static_main : Error<"'main' is not allowed to be declared static">;
850def err_inline_main : Error<"'main' is not allowed to be declared inline">;
851def ext_variadic_main : ExtWarn<
852  "'main' is not allowed to be declared variadic">, InGroup<Main>;
853def ext_noreturn_main : ExtWarn<
854  "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
855def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
856def err_constexpr_main : Error<
857  "'main' is not allowed to be declared %select{constexpr|consteval}0">;
858def err_deleted_main : Error<"'main' is not allowed to be deleted">;
859def err_mainlike_template_decl : Error<"%0 cannot be a template">;
860def err_main_returns_nonint : Error<"'main' must return 'int'">;
861def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
862    InGroup<MainReturnType>;
863def note_main_change_return_type : Note<"change return type to 'int'">;
864def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
865    "must be 0, 2, or 3">;
866def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
867    InGroup<Main>;
868def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
869    "parameter of 'main' (%select{argument count|argument array|environment|"
870    "platform-specific data}0) must be of type %1">;
871def warn_main_returns_bool_literal : Warning<"bool literal returned from "
872    "'main'">, InGroup<Main>;
873def err_main_global_variable :
874    Error<"main cannot be declared as global variable">;
875def warn_main_redefined : Warning<"variable named 'main' with external linkage "
876    "has undefined behavior">, InGroup<Main>;
877def ext_main_used : Extension<
878  "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
879
880/// parser diagnostics
881def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
882  InGroup<MissingDeclarations>;
883def err_no_declarators : Error<"declaration does not declare anything">;
884def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
885  InGroup<MissingDeclarations>;
886def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
887
888def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
889  "anonymous non-C-compatible type given name for linkage purposes "
890  "by %select{typedef|alias}0 declaration; "
891  "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
892def err_non_c_like_anon_struct_in_typedef : Error<
893  "anonymous non-C-compatible type given name for linkage purposes "
894  "by %select{typedef|alias}0 declaration after its linkage was computed; "
895  "add a tag name here to establish linkage prior to definition">;
896def err_typedef_changes_linkage : Error<
897  "unsupported: anonymous type given name for linkage purposes "
898  "by %select{typedef|alias}0 declaration after its linkage was computed; "
899  "add a tag name here to establish linkage prior to definition">;
900def note_non_c_like_anon_struct : Note<
901  "type is not C-compatible due to this "
902  "%select{base class|default member initializer|lambda expression|"
903  "friend declaration|member declaration}0">;
904def note_typedef_for_linkage_here : Note<
905  "type is given name %0 for linkage purposes by this "
906  "%select{typedef|alias}1 declaration">;
907
908def err_statically_allocated_object : Error<
909  "interface type cannot be statically allocated">;
910def err_object_cannot_be_passed_returned_by_value : Error<
911  "interface type %1 cannot be %select{returned|passed}0 by value"
912  "; did you forget * in %1?">;
913def err_parameters_retval_cannot_have_fp16_type : Error<
914  "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
915def err_opencl_half_load_store : Error<
916  "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
917  "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
918def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
919def err_opencl_half_declaration : Error<
920  "declaring variable of type %0 is not allowed">;
921def err_opencl_invalid_param : Error<
922  "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
923def err_opencl_invalid_return : Error<
924  "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
925def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
926def warn_pragma_options_align_reset_failed : Warning<
927  "#pragma options align=reset failed: %0">,
928  InGroup<IgnoredPragmas>;
929def err_pragma_options_align_mac68k_target_unsupported : Error<
930  "mac68k alignment pragma is not supported on this target">;
931def warn_pragma_align_not_xl_compatible : Warning<
932  "#pragma align(packed) may not be compatible with objects generated with AIX XL C/C++">,
933  InGroup<AIXCompat>;
934def warn_pragma_pack_invalid_alignment : Warning<
935  "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
936  InGroup<IgnoredPragmas>;
937def err_pragma_pack_invalid_alignment : Error<
938  warn_pragma_pack_invalid_alignment.Text>;
939def warn_pragma_pack_non_default_at_include : Warning<
940  "non-default #pragma pack value changes the alignment of struct or union "
941  "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
942  DefaultIgnore;
943def warn_pragma_pack_modified_after_include : Warning<
944  "the current #pragma pack alignment value is modified in the included "
945  "file">, InGroup<PragmaPack>;
946def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
947  "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
948def note_pragma_pack_here : Note<
949  "previous '#pragma pack' directive that modifies alignment is here">;
950def note_pragma_pack_pop_instead_reset : Note<
951  "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
952// Follow the Microsoft implementation.
953def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
954def warn_pragma_pack_pop_identifier_and_alignment : Warning<
955  "specifying both a name and alignment to 'pop' is undefined">;
956def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
957  InGroup<IgnoredPragmas>;
958def err_pragma_fc_pp_scope : Error<
959  "'#pragma float_control push/pop' can only appear at file or namespace scope "
960  "or within a language linkage specification">;
961def err_pragma_fc_noprecise_requires_nofenv : Error<
962  "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
963def err_pragma_fc_except_requires_precise : Error<
964  "'#pragma float_control(except, on)' is illegal when precise is disabled">;
965def err_pragma_fc_noprecise_requires_noexcept : Error<
966  "'#pragma float_control(precise, off)' is illegal when except is enabled">;
967def err_pragma_fenv_requires_precise : Error<
968  "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
969def warn_cxx_ms_struct :
970  Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
971          "with base classes or virtual functions">,
972  DefaultError, InGroup<IncompatibleMSStruct>;
973def err_pragma_pack_identifer_not_supported : Error<
974  "specifying an identifier within `#pragma pack` is not supported on this target">;
975def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
976def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
977def err_invalid_super_scope : Error<"invalid use of '__super', "
978  "this keyword can only be used inside class or member function scope">;
979def err_super_in_lambda_unsupported : Error<
980  "use of '__super' inside a lambda is unsupported">;
981
982def warn_pragma_unused_undeclared_var : Warning<
983  "undeclared variable %0 used as an argument for '#pragma unused'">,
984  InGroup<IgnoredPragmas>;
985def warn_atl_uuid_deprecated : Warning<
986  "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
987  InGroup<DeprecatedDeclarations>;
988def warn_pragma_unused_expected_var_arg : Warning<
989  "only variables can be arguments to '#pragma unused'">,
990  InGroup<IgnoredPragmas>;
991def err_pragma_push_visibility_mismatch : Error<
992  "#pragma visibility push with no matching #pragma visibility pop">;
993def note_surrounding_namespace_ends_here : Note<
994  "surrounding namespace with visibility attribute ends here">;
995def err_pragma_pop_visibility_mismatch : Error<
996  "#pragma visibility pop with no matching #pragma visibility push">;
997def note_surrounding_namespace_starts_here : Note<
998  "surrounding namespace with visibility attribute starts here">;
999def err_pragma_loop_invalid_argument_type : Error<
1000  "invalid argument of type %0; expected an integer type">;
1001def err_pragma_loop_invalid_argument_value : Error<
1002  "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
1003def err_pragma_loop_compatibility : Error<
1004  "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
1005def err_pragma_loop_precedes_nonloop : Error<
1006  "expected a for, while, or do-while loop to follow '%0'">;
1007
1008def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
1009  "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
1010  "those declarations">;
1011def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
1012  "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
1013def err_pragma_attribute_invalid_matchers : Error<
1014  "attribute %0 can't be applied to %1">;
1015def err_pragma_attribute_stack_mismatch : Error<
1016  "'#pragma clang attribute %select{%1.|}0pop' with no matching"
1017  " '#pragma clang attribute %select{%1.|}0push'">;
1018def warn_pragma_attribute_unused : Warning<
1019  "unused attribute %0 in '#pragma clang attribute push' region">,
1020  InGroup<PragmaClangAttribute>;
1021def note_pragma_attribute_region_ends_here : Note<
1022  "'#pragma clang attribute push' regions ends here">;
1023def err_pragma_attribute_no_pop_eof : Error<"unterminated "
1024  "'#pragma clang attribute push' at end of file">;
1025def note_pragma_attribute_applied_decl_here : Note<
1026  "when applied to this declaration">;
1027def err_pragma_attr_attr_no_push : Error<
1028  "'#pragma clang attribute' attribute with no matching "
1029  "'#pragma clang attribute push'">;
1030
1031/// Objective-C parser diagnostics
1032def err_duplicate_class_def : Error<
1033  "duplicate interface definition for class %0">;
1034def err_undef_superclass : Error<
1035  "cannot find interface declaration for %0, superclass of %1">;
1036def err_forward_superclass : Error<
1037  "attempting to use the forward class %0 as superclass of %1">;
1038def err_no_nsconstant_string_class : Error<
1039  "cannot find interface declaration for %0">;
1040def err_recursive_superclass : Error<
1041  "trying to recursively use %0 as superclass of %1">;
1042def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
1043def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
1044def warn_duplicate_protocol_def : Warning<
1045  "duplicate protocol definition of %0 is ignored">,
1046  InGroup<DiagGroup<"duplicate-protocol">>;
1047def err_protocol_has_circular_dependency : Error<
1048  "protocol has circular dependency">;
1049def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
1050def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
1051def err_atprotocol_protocol : Error<
1052  "@protocol is using a forward protocol declaration of %0">;
1053def warn_readonly_property : Warning<
1054  "attribute 'readonly' of property %0 restricts attribute "
1055  "'readwrite' of property inherited from %1">,
1056  InGroup<PropertyAttr>;
1057
1058def warn_property_attribute : Warning<
1059  "'%1' attribute on property %0 does not match the property inherited from %2">,
1060  InGroup<PropertyAttr>;
1061def warn_property_types_are_incompatible : Warning<
1062  "property type %0 is incompatible with type %1 inherited from %2">,
1063  InGroup<DiagGroup<"incompatible-property-type">>;
1064def warn_protocol_property_mismatch : Warning<
1065  "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
1066  "getter %1|with setter %1}0 was selected for synthesis">,
1067  InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
1068def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Text>;
1069def err_undef_interface : Error<"cannot find interface declaration for %0">;
1070def err_category_forward_interface : Error<
1071  "cannot define %select{category|class extension}0 for undefined class %1">;
1072def err_class_extension_after_impl : Error<
1073  "cannot declare class extension for %0 after class implementation">;
1074def note_implementation_declared : Note<
1075  "class implementation is declared here">;
1076def note_while_in_implementation : Note<
1077  "detected while default synthesizing properties in class implementation">;
1078def note_class_declared : Note<
1079  "class is declared here">;
1080def note_receiver_class_declared : Note<
1081  "receiver is instance of class declared here">;
1082def note_receiver_expr_here : Note<
1083  "receiver expression is here">;
1084def note_receiver_is_id : Note<
1085  "receiver is treated with 'id' type for purpose of method lookup">;
1086def note_suppressed_class_declare : Note<
1087  "class with specified objc_requires_property_definitions attribute is declared here">;
1088def err_objc_root_class_subclass : Error<
1089  "objc_root_class attribute may only be specified on a root class declaration">;
1090def err_restricted_superclass_mismatch : Error<
1091  "cannot subclass a class that was declared with the "
1092  "'objc_subclassing_restricted' attribute">;
1093def err_class_stub_subclassing_mismatch : Error<
1094  "'objc_class_stub' attribute cannot be specified on a class that does not "
1095  "have the 'objc_subclassing_restricted' attribute">;
1096def err_implementation_of_class_stub : Error<
1097  "cannot declare implementation of a class declared with the "
1098  "'objc_class_stub' attribute">;
1099def warn_objc_root_class_missing : Warning<
1100  "class %0 defined without specifying a base class">,
1101  InGroup<ObjCRootClass>;
1102def err_objc_runtime_visible_category : Error<
1103  "cannot implement a category for class %0 that is only visible via the "
1104  "Objective-C runtime">;
1105def err_objc_runtime_visible_subclass : Error<
1106  "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1107  "Objective-C runtime">;
1108def note_objc_needs_superclass : Note<
1109  "add a super class to fix this problem">;
1110def err_conflicting_super_class : Error<"conflicting super class name %0">;
1111def err_dup_implementation_class : Error<"reimplementation of class %0">;
1112def err_dup_implementation_category : Error<
1113  "reimplementation of category %1 for class %0">;
1114def err_conflicting_ivar_type : Error<
1115  "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1116def err_duplicate_ivar_declaration : Error<
1117  "instance variable is already declared">;
1118def warn_on_superclass_use : Warning<
1119  "class implementation may not have super class">;
1120def err_conflicting_ivar_bitwidth : Error<
1121  "instance variable %0 has conflicting bit-field width">;
1122def err_conflicting_ivar_name : Error<
1123  "conflicting instance variable names: %0 vs %1">;
1124def err_inconsistent_ivar_count : Error<
1125  "inconsistent number of instance variables specified">;
1126def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1127  InGroup<DiagGroup<"incomplete-implementation">>;
1128def warn_objc_boxing_invalid_utf8_string : Warning<
1129  "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1130  InGroup<ObjCBoxing>;
1131
1132def err_objc_non_runtime_protocol_in_protocol_expr : Error<
1133  "cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression">;
1134def err_objc_direct_on_protocol : Error<
1135  "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1136  "declared in an Objective-C protocol">;
1137def err_objc_direct_duplicate_decl : Error<
1138  "%select{|direct }0%select{method|property}1 declaration conflicts "
1139  "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1140def err_objc_direct_impl_decl_mismatch : Error<
1141  "direct method was declared in %select{the primary interface|an extension|a category}0 "
1142  "but is implemented in %select{the primary interface|a category|a different category}1">;
1143def err_objc_direct_missing_on_decl : Error<
1144  "direct method implementation was previously declared not direct">;
1145def err_objc_direct_on_override : Error<
1146  "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1147def err_objc_override_direct_method : Error<
1148  "cannot override a method that is declared direct by a superclass">;
1149def warn_objc_direct_ignored : Warning<
1150  "%0 attribute isn't implemented by this Objective-C runtime">,
1151  InGroup<IgnoredAttributes>;
1152def warn_objc_direct_property_ignored : Warning<
1153  "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1154  InGroup<IgnoredAttributes>;
1155def err_objc_direct_dynamic_property : Error<
1156  "direct property cannot be @dynamic">;
1157def err_objc_direct_protocol_conformance : Error<
1158  "%select{category %1|class extension}0 cannot conform to protocol %2 because "
1159  "of direct members declared in interface %3">;
1160def note_direct_member_here : Note<"direct member declared here">;
1161
1162def warn_conflicting_overriding_ret_types : Warning<
1163  "conflicting return type in "
1164  "declaration of %0%diff{: $ vs $|}1,2">,
1165  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1166
1167def warn_conflicting_ret_types : Warning<
1168  "conflicting return type in "
1169  "implementation of %0%diff{: $ vs $|}1,2">,
1170  InGroup<MismatchedReturnTypes>;
1171
1172def warn_conflicting_overriding_ret_type_modifiers : Warning<
1173  "conflicting distributed object modifiers on return type "
1174  "in declaration of %0">,
1175  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1176
1177def warn_conflicting_ret_type_modifiers : Warning<
1178  "conflicting distributed object modifiers on return type "
1179  "in implementation of %0">,
1180  InGroup<DistributedObjectModifiers>;
1181
1182def warn_non_covariant_overriding_ret_types : Warning<
1183  "conflicting return type in "
1184  "declaration of %0: %1 vs %2">,
1185  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1186
1187def warn_non_covariant_ret_types : Warning<
1188  "conflicting return type in "
1189  "implementation of %0: %1 vs %2">,
1190  InGroup<MethodSignatures>, DefaultIgnore;
1191
1192def warn_conflicting_overriding_param_types : Warning<
1193  "conflicting parameter types in "
1194  "declaration of %0%diff{: $ vs $|}1,2">,
1195  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1196
1197def warn_conflicting_param_types : Warning<
1198  "conflicting parameter types in "
1199  "implementation of %0%diff{: $ vs $|}1,2">,
1200  InGroup<MismatchedParameterTypes>;
1201
1202def warn_conflicting_param_modifiers : Warning<
1203  "conflicting distributed object modifiers on parameter type "
1204  "in implementation of %0">,
1205  InGroup<DistributedObjectModifiers>;
1206
1207def warn_conflicting_overriding_param_modifiers : Warning<
1208  "conflicting distributed object modifiers on parameter type "
1209  "in declaration of %0">,
1210  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1211
1212def warn_non_contravariant_overriding_param_types : Warning<
1213  "conflicting parameter types in "
1214  "declaration of %0: %1 vs %2">,
1215  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1216
1217def warn_non_contravariant_param_types : Warning<
1218  "conflicting parameter types in "
1219  "implementation of %0: %1 vs %2">,
1220  InGroup<MethodSignatures>, DefaultIgnore;
1221
1222def warn_conflicting_overriding_variadic :Warning<
1223  "conflicting variadic declaration of method and its "
1224  "implementation">,
1225  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1226
1227def warn_conflicting_variadic :Warning<
1228  "conflicting variadic declaration of method and its "
1229  "implementation">;
1230
1231def warn_category_method_impl_match:Warning<
1232  "category is implementing a method which will also be implemented"
1233  " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1234
1235def warn_implements_nscopying : Warning<
1236"default assign attribute on property %0 which implements "
1237"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1238
1239def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1240  InGroup<ObjCMultipleMethodNames>;
1241def warn_strict_multiple_method_decl : Warning<
1242  "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1243def warn_accessor_property_type_mismatch : Warning<
1244  "type of property %0 does not match type of accessor %1">;
1245def note_conv_function_declared_at : Note<"type conversion function declared here">;
1246def note_method_declared_at : Note<"method %0 declared here">;
1247def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1248def note_property_attribute : Note<"property %0 is declared "
1249  "%select{deprecated|unavailable|partial}1 here">;
1250def err_setter_type_void : Error<"type of setter must be void">;
1251def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1252def warn_duplicate_method_decl :
1253  Warning<"multiple declarations of method %0 found and ignored">,
1254  InGroup<MethodDuplicate>, DefaultIgnore;
1255def warn_objc_cdirective_format_string :
1256  Warning<"using %0 directive in %select{NSString|CFString}1 "
1257          "which is being passed as a formatting argument to the formatting "
1258          "%select{method|CFfunction}2">,
1259  InGroup<ObjCCStringFormat>, DefaultIgnore;
1260def err_objc_var_decl_inclass :
1261    Error<"cannot declare variable inside @interface or @protocol">;
1262def err_missing_method_context : Error<
1263  "missing context for method declaration">;
1264def err_objc_property_attr_mutually_exclusive : Error<
1265  "property attributes '%0' and '%1' are mutually exclusive">;
1266def err_objc_property_requires_object : Error<
1267  "property with '%0' attribute must be of object type">;
1268def warn_objc_property_assign_on_object : Warning<
1269  "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1270  InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1271def warn_objc_property_no_assignment_attribute : Warning<
1272  "no 'assign', 'retain', or 'copy' attribute is specified - "
1273  "'assign' is assumed">,
1274  InGroup<ObjCPropertyNoAttribute>;
1275def warn_objc_isa_use : Warning<
1276  "direct access to Objective-C's isa is deprecated in favor of "
1277  "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1278def warn_objc_isa_assign : Warning<
1279  "assignment to Objective-C's isa is deprecated in favor of "
1280  "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1281def warn_objc_pointer_masking : Warning<
1282  "bitmasking for introspection of Objective-C object pointers is strongly "
1283  "discouraged">,
1284  InGroup<ObjCPointerIntrospect>;
1285def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
1286  InGroup<ObjCPointerIntrospectPerformSelector>;
1287def warn_objc_property_default_assign_on_object : Warning<
1288  "default property attribute 'assign' not appropriate for object">,
1289  InGroup<ObjCPropertyNoAttribute>;
1290def warn_property_attr_mismatch : Warning<
1291  "property attribute in class extension does not match the primary class">,
1292  InGroup<PropertyAttr>;
1293def warn_property_implicitly_mismatched : Warning <
1294  "primary property declaration is implicitly strong while redeclaration "
1295  "in class extension is weak">,
1296  InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1297def warn_objc_property_copy_missing_on_block : Warning<
1298    "'copy' attribute must be specified for the block property "
1299    "when -fobjc-gc-only is specified">;
1300def warn_objc_property_retain_of_block : Warning<
1301    "retain'ed block property does not copy the block "
1302    "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1303def warn_objc_readonly_property_has_setter : Warning<
1304    "setter cannot be specified for a readonly property">,
1305    InGroup<ObjCReadonlyPropertyHasSetter>;
1306def warn_atomic_property_rule : Warning<
1307  "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1308  "with a user defined %select{getter|setter}2">,
1309  InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1310def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1311  "synthesized, or both be user defined,or the property must be nonatomic">;
1312def err_atomic_property_nontrivial_assign_op : Error<
1313  "atomic property of reference type %0 cannot have non-trivial assignment"
1314  " operator">;
1315def warn_cocoa_naming_owned_rule : Warning<
1316  "property follows Cocoa naming"
1317  " convention for returning 'owned' objects">,
1318  InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1319def err_cocoa_naming_owned_rule : Error<
1320  "property follows Cocoa naming"
1321  " convention for returning 'owned' objects">;
1322def note_cocoa_naming_declare_family : Note<
1323  "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1324  "object">;
1325def warn_auto_synthesizing_protocol_property :Warning<
1326  "auto property synthesis will not synthesize property %0"
1327  " declared in protocol %1">,
1328  InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1329def note_add_synthesize_directive : Note<
1330  "add a '@synthesize' directive">;
1331def warn_no_autosynthesis_shared_ivar_property : Warning <
1332  "auto property synthesis will not synthesize property "
1333  "%0 because it cannot share an ivar with another synthesized property">,
1334  InGroup<ObjCNoPropertyAutoSynthesis>;
1335def warn_no_autosynthesis_property : Warning<
1336  "auto property synthesis will not synthesize property "
1337  "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1338  "via another property">,
1339  InGroup<ObjCNoPropertyAutoSynthesis>;
1340def warn_autosynthesis_property_in_superclass : Warning<
1341  "auto property synthesis will not synthesize property "
1342  "%0; it will be implemented by its superclass, use @dynamic to "
1343  "acknowledge intention">,
1344  InGroup<ObjCNoPropertyAutoSynthesis>;
1345def warn_autosynthesis_property_ivar_match :Warning<
1346  "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1347  "%2, not existing instance variable %3">,
1348  InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1349def warn_missing_explicit_synthesis : Warning <
1350  "auto property synthesis is synthesizing property not explicitly synthesized">,
1351  InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1352def warn_property_getter_owning_mismatch : Warning<
1353  "property declared as returning non-retained objects"
1354  "; getter returning retained objects">;
1355def warn_property_redecl_getter_mismatch : Warning<
1356  "getter name mismatch between property redeclaration (%1) and its original "
1357  "declaration (%0)">, InGroup<PropertyAttr>;
1358def err_property_setter_ambiguous_use : Error<
1359  "synthesized properties %0 and %1 both claim setter %2 -"
1360  " use of this setter will cause unexpected behavior">;
1361def warn_default_atomic_custom_getter_setter : Warning<
1362  "atomic by default property %0 has a user defined %select{getter|setter}1 "
1363  "(property should be marked 'atomic' if this is intended)">,
1364  InGroup<CustomAtomic>, DefaultIgnore;
1365def err_use_continuation_class : Error<
1366  "illegal redeclaration of property in class extension %0"
1367  " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1368def err_type_mismatch_continuation_class : Error<
1369  "type of property %0 in class extension does not match "
1370  "property type in primary class">;
1371def err_use_continuation_class_redeclaration_readwrite : Error<
1372  "illegal redeclaration of 'readwrite' property in class extension %0"
1373  " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1374  "'readonly' public property?)">;
1375def err_continuation_class : Error<"class extension has no primary class">;
1376def err_property_type : Error<"property cannot have array or function type %0">;
1377def err_missing_property_context : Error<
1378  "missing context for property implementation declaration">;
1379def err_bad_property_decl : Error<
1380  "property implementation must have its declaration in interface %0 or one of "
1381  "its extensions">;
1382def err_category_property : Error<
1383  "property declared in category %0 cannot be implemented in "
1384  "class implementation">;
1385def note_property_declare : Note<
1386  "property declared here">;
1387def note_protocol_property_declare : Note<
1388  "it could also be property "
1389  "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1390  "%1|with setter %1}0 declared here">;
1391def note_property_synthesize : Note<
1392  "property synthesized here">;
1393def err_synthesize_category_decl : Error<
1394  "@synthesize not allowed in a category's implementation">;
1395def err_synthesize_on_class_property : Error<
1396  "@synthesize not allowed on a class property %0">;
1397def err_missing_property_interface : Error<
1398  "property implementation in a category with no category declaration">;
1399def err_bad_category_property_decl : Error<
1400  "property implementation must have its declaration in the category %0">;
1401def err_bad_property_context : Error<
1402  "property implementation must be in a class or category implementation">;
1403def err_missing_property_ivar_decl : Error<
1404  "synthesized property %0 must either be named the same as a compatible"
1405  " instance variable or must explicitly name an instance variable">;
1406def err_arc_perform_selector_retains : Error<
1407  "performSelector names a selector which retains the object">;
1408def warn_arc_perform_selector_leaks : Warning<
1409  "performSelector may cause a leak because its selector is unknown">,
1410  InGroup<DiagGroup<"arc-performSelector-leaks">>;
1411def warn_dealloc_in_category : Warning<
1412"-dealloc is being overridden in a category">,
1413InGroup<DeallocInCategory>;
1414def err_gc_weak_property_strong_type : Error<
1415  "weak attribute declared on a __strong type property in GC mode">;
1416def warn_arc_repeated_use_of_weak : Warning <
1417  "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1418  "accessed multiple times in this %select{function|method|block|lambda}2 "
1419  "but may be unpredictably set to nil; assign to a strong variable to keep "
1420  "the object alive">,
1421  InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1422def warn_implicitly_retains_self : Warning <
1423  "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1424  "this is intended behavior">,
1425  InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1426def warn_arc_possible_repeated_use_of_weak : Warning <
1427  "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1428  "be accessed multiple times in this %select{function|method|block|lambda}2 "
1429  "and may be unpredictably set to nil; assign to a strong variable to keep "
1430  "the object alive">,
1431  InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1432def note_arc_weak_also_accessed_here : Note<
1433  "also accessed here">;
1434def err_incomplete_synthesized_property : Error<
1435  "cannot synthesize property %0 with incomplete type %1">;
1436
1437def err_property_ivar_type : Error<
1438  "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1439def err_property_accessor_type : Error<
1440  "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1441def err_ivar_in_superclass_use : Error<
1442  "property %0 attempting to use instance variable %1 declared in super class %2">;
1443def err_weak_property : Error<
1444  "existing instance variable %1 for __weak property %0 must be __weak">;
1445def err_strong_property : Error<
1446  "existing instance variable %1 for strong property %0 may not be __weak">;
1447def err_dynamic_property_ivar_decl : Error<
1448  "dynamic property cannot have instance variable specification">;
1449def err_duplicate_ivar_use : Error<
1450  "synthesized properties %0 and %1 both claim instance variable %2">;
1451def err_property_implemented : Error<"property %0 is already implemented">;
1452def warn_objc_missing_super_call : Warning<
1453  "method possibly missing a [super %0] call">,
1454  InGroup<ObjCMissingSuperCalls>;
1455def err_dealloc_bad_result_type : Error<
1456  "dealloc return type must be correctly specified as 'void' under ARC, "
1457  "instead of %0">;
1458def warn_undeclared_selector : Warning<
1459  "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1460def warn_undeclared_selector_with_typo : Warning<
1461  "undeclared selector %0; did you mean %1?">,
1462  InGroup<UndeclaredSelector>, DefaultIgnore;
1463def warn_implicit_atomic_property : Warning<
1464  "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1465def note_auto_readonly_iboutlet_fixup_suggest : Note<
1466  "property should be changed to be readwrite">;
1467def warn_auto_readonly_iboutlet_property : Warning<
1468  "readonly IBOutlet property %0 when auto-synthesized may "
1469  "not work correctly with 'nib' loader">,
1470  InGroup<DiagGroup<"readonly-iboutlet-property">>;
1471def warn_auto_implicit_atomic_property : Warning<
1472  "property is assumed atomic when auto-synthesizing the property">,
1473  InGroup<ImplicitAtomic>, DefaultIgnore;
1474def warn_unimplemented_selector:  Warning<
1475  "no method with selector %0 is implemented in this translation unit">,
1476  InGroup<Selector>, DefaultIgnore;
1477def warn_unimplemented_protocol_method : Warning<
1478  "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1479def warn_multiple_selectors: Warning<
1480  "several methods with selector %0 of mismatched types are found "
1481  "for the @selector expression">,
1482  InGroup<SelectorTypeMismatch>, DefaultIgnore;
1483def err_direct_selector_expression : Error<
1484  "@selector expression formed with direct selector %0">;
1485def warn_potentially_direct_selector_expression : Warning<
1486  "@selector expression formed with potentially direct selector %0">,
1487  InGroup<ObjCPotentiallyDirectSelector>;
1488def warn_strict_potentially_direct_selector_expression : Warning<
1489  warn_potentially_direct_selector_expression.Text>,
1490  InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1491
1492def err_objc_kindof_nonobject : Error<
1493  "'__kindof' specifier cannot be applied to non-object type %0">;
1494def err_objc_kindof_wrong_position : Error<
1495  "'__kindof' type specifier must precede the declarator">;
1496
1497def err_objc_method_unsupported_param_ret_type : Error<
1498  "%0 %select{parameter|return}1 type is unsupported; "
1499  "support for vector types for this target is introduced in %2">;
1500
1501def warn_messaging_unqualified_id : Warning<
1502  "messaging unqualified id">, DefaultIgnore,
1503  InGroup<DiagGroup<"objc-messaging-id">>;
1504def err_messaging_unqualified_id_with_direct_method : Error<
1505  "messaging unqualified id with a method that is possibly direct">;
1506def err_messaging_super_with_direct_method : Error<
1507  "messaging super with a direct method">;
1508def err_messaging_class_with_direct_method : Error<
1509  "messaging a Class with a method that is possibly direct">;
1510
1511// C++ declarations
1512def err_static_assert_expression_is_not_constant : Error<
1513  "static_assert expression is not an integral constant expression">;
1514def err_constexpr_if_condition_expression_is_not_constant : Error<
1515  "constexpr if condition is not a constant expression">;
1516def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
1517def err_static_assert_requirement_failed : Error<
1518  "static_assert failed due to requirement '%0'%select{ %2|}1">;
1519
1520def warn_consteval_if_always_true : Warning<
1521  "consteval if is always true in an %select{unevaluated|immediate}0 context">,
1522  InGroup<DiagGroup<"redundant-consteval-if">>;
1523
1524def ext_inline_variable : ExtWarn<
1525  "inline variables are a C++17 extension">, InGroup<CXX17>;
1526def warn_cxx14_compat_inline_variable : Warning<
1527  "inline variables are incompatible with C++ standards before C++17">,
1528  DefaultIgnore, InGroup<CXXPre17Compat>;
1529
1530def warn_inline_namespace_reopened_noninline : Warning<
1531  "inline namespace reopened as a non-inline namespace">,
1532  InGroup<InlineNamespaceReopenedNoninline>;
1533def err_inline_namespace_mismatch : Error<
1534  "non-inline namespace cannot be reopened as inline">;
1535
1536def err_unexpected_friend : Error<
1537  "friends can only be classes or functions">;
1538def ext_enum_friend : ExtWarn<
1539  "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1540def warn_cxx98_compat_enum_friend : Warning<
1541  "befriending enumeration type %0 is incompatible with C++98">,
1542  InGroup<CXX98Compat>, DefaultIgnore;
1543def ext_nonclass_type_friend : ExtWarn<
1544  "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1545def warn_cxx98_compat_nonclass_type_friend : Warning<
1546  "non-class friend type %0 is incompatible with C++98">,
1547  InGroup<CXX98Compat>, DefaultIgnore;
1548def err_friend_is_member : Error<
1549  "friends cannot be members of the declaring class">;
1550def warn_cxx98_compat_friend_is_member : Warning<
1551  "friend declaration naming a member of the declaring class is incompatible "
1552  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1553def ext_unelaborated_friend_type : ExtWarn<
1554  "unelaborated friend declaration is a C++11 extension; specify "
1555  "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1556  InGroup<CXX11>;
1557def warn_cxx98_compat_unelaborated_friend_type : Warning<
1558  "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1559  "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1560def err_qualified_friend_no_match : Error<
1561  "friend declaration of %0 does not match any declaration in %1">;
1562def err_introducing_special_friend : Error<
1563  "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1564  " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1565  "as a friend">;
1566def err_tagless_friend_type_template : Error<
1567  "friend type templates must use an elaborated type">;
1568def err_no_matching_local_friend : Error<
1569  "no matching function found in local scope">;
1570def err_no_matching_local_friend_suggest : Error<
1571  "no matching function %0 found in local scope; did you mean %3?">;
1572def err_partial_specialization_friend : Error<
1573  "partial specialization cannot be declared as a friend">;
1574def err_qualified_friend_def : Error<
1575  "friend function definition cannot be qualified with '%0'">;
1576def err_friend_def_in_local_class : Error<
1577  "friend function cannot be defined in a local class">;
1578def err_friend_not_first_in_declaration : Error<
1579  "'friend' must appear first in a non-function declaration">;
1580def err_using_decl_friend : Error<
1581  "cannot befriend target of using declaration">;
1582def warn_template_qualified_friend_unsupported : Warning<
1583  "dependent nested name specifier '%0' for friend class declaration is "
1584  "not supported; turning off access control for %1">,
1585  InGroup<UnsupportedFriend>;
1586def warn_template_qualified_friend_ignored : Warning<
1587  "dependent nested name specifier '%0' for friend template declaration is "
1588  "not supported; ignoring this friend declaration">,
1589  InGroup<UnsupportedFriend>;
1590def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1591  "unqualified friend declaration referring to type outside of the nearest "
1592  "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1593  InGroup<MicrosoftUnqualifiedFriend>;
1594def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1595
1596def err_invalid_base_in_interface : Error<
1597  "interface type cannot inherit from "
1598  "%select{struct|non-public interface|class}0 %1">;
1599
1600def err_abstract_type_in_decl : Error<
1601  "%select{return|parameter|variable|field|instance variable|"
1602  "synthesized instance variable}0 type %1 is an abstract class">;
1603def err_allocation_of_abstract_type : Error<
1604  "allocating an object of abstract class type %0">;
1605def err_throw_abstract_type : Error<
1606  "cannot throw an object of abstract type %0">;
1607def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1608def err_capture_of_abstract_type : Error<
1609  "by-copy capture of value of abstract type %0">;
1610def err_capture_of_incomplete_or_sizeless_type : Error<
1611  "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1612def err_capture_default_non_local : Error<
1613  "non-local lambda expression cannot have a capture-default">;
1614
1615def err_multiple_final_overriders : Error<
1616  "virtual function %q0 has more than one final overrider in %1">;
1617def note_final_overrider : Note<"final overrider of %q0 in %1">;
1618
1619def err_type_defined_in_type_specifier : Error<
1620  "%0 cannot be defined in a type specifier">;
1621def err_type_defined_in_result_type : Error<
1622  "%0 cannot be defined in the result type of a function">;
1623def err_type_defined_in_param_type : Error<
1624  "%0 cannot be defined in a parameter type">;
1625def err_type_defined_in_alias_template : Error<
1626  "%0 cannot be defined in a type alias template">;
1627def err_type_defined_in_condition : Error<
1628  "%0 cannot be defined in a condition">;
1629def err_type_defined_in_enum : Error<
1630  "%0 cannot be defined in an enumeration">;
1631
1632def note_pure_virtual_function : Note<
1633  "unimplemented pure virtual method %0 in %1">;
1634
1635def note_pure_qualified_call_kext : Note<
1636  "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1637
1638def err_deleted_decl_not_first : Error<
1639  "deleted definition must be first declaration">;
1640
1641def err_deleted_override : Error<
1642  "deleted function %0 cannot override a non-deleted function">;
1643def err_non_deleted_override : Error<
1644  "non-deleted function %0 cannot override a deleted function">;
1645def err_consteval_override : Error<
1646  "consteval function %0 cannot override a non-consteval function">;
1647def err_non_consteval_override : Error<
1648  "non-consteval function %0 cannot override a consteval function">;
1649
1650def warn_weak_vtable : Warning<
1651  "%0 has no out-of-line virtual method definitions; its vtable will be "
1652  "emitted in every translation unit">,
1653  InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1654def warn_weak_template_vtable : Warning<
1655  "this warning is no longer in use and will be removed in the next release">,
1656  InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1657
1658def ext_using_undefined_std : ExtWarn<
1659  "using directive refers to implicitly-defined namespace 'std'">;
1660
1661// C++ exception specifications
1662def err_exception_spec_in_typedef : Error<
1663  "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1664def err_distant_exception_spec : Error<
1665  "exception specifications are not allowed beyond a single level "
1666  "of indirection">;
1667def err_incomplete_in_exception_spec : Error<
1668  "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1669  "in exception specification">;
1670def err_sizeless_in_exception_spec : Error<
1671  "%select{|reference to }0sizeless type %1 is not allowed "
1672  "in exception specification">;
1673def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Text>,
1674  InGroup<MicrosoftExceptionSpec>;
1675def err_rref_in_exception_spec : Error<
1676  "rvalue reference type %0 is not allowed in exception specification">;
1677def err_mismatched_exception_spec : Error<
1678  "exception specification in declaration does not match previous declaration">;
1679def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Text>,
1680  InGroup<MicrosoftExceptionSpec>;
1681def err_override_exception_spec : Error<
1682  "exception specification of overriding function is more lax than "
1683  "base version">;
1684def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Text>,
1685  InGroup<MicrosoftExceptionSpec>;
1686def err_incompatible_exception_specs : Error<
1687  "target exception specification is not superset of source">;
1688def warn_incompatible_exception_specs : Warning<
1689  err_incompatible_exception_specs.Text>, InGroup<IncompatibleExceptionSpec>;
1690def err_deep_exception_specs_differ : Error<
1691  "exception specifications of %select{return|argument}0 types differ">;
1692def warn_deep_exception_specs_differ : Warning<
1693  err_deep_exception_specs_differ.Text>, InGroup<IncompatibleExceptionSpec>;
1694def err_missing_exception_specification : Error<
1695  "%0 is missing exception specification '%1'">;
1696def ext_missing_exception_specification : ExtWarn<
1697  err_missing_exception_specification.Text>,
1698  InGroup<DiagGroup<"missing-exception-spec">>;
1699def err_noexcept_needs_constant_expression : Error<
1700  "argument to noexcept specifier must be a constant expression">;
1701def err_exception_spec_not_parsed : Error<
1702  "exception specification is not available until end of class definition">;
1703def err_exception_spec_cycle : Error<
1704  "exception specification of %0 uses itself">;
1705def err_exception_spec_incomplete_type : Error<
1706  "exception specification needed for member of incomplete class %0">;
1707def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1708  "dynamic exception specifications with types are currently ignored in wasm">,
1709  InGroup<WebAssemblyExceptionSpec>;
1710
1711// C++ access checking
1712def err_class_redeclared_with_different_access : Error<
1713  "%0 redeclared with '%1' access">;
1714def err_access : Error<
1715  "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1716def ext_ms_using_declaration_inaccessible : ExtWarn<
1717  "using declaration referring to inaccessible member '%0' (which refers "
1718  "to accessible member '%1') is a Microsoft compatibility extension">,
1719    AccessControl, InGroup<MicrosoftUsingDecl>;
1720def err_access_ctor : Error<
1721  "calling a %select{private|protected}0 constructor of class %2">,
1722  AccessControl;
1723def ext_rvalue_to_reference_access_ctor : Extension<
1724  "C++98 requires an accessible copy constructor for class %2 when binding "
1725  "a reference to a temporary; was %select{private|protected}0">,
1726  AccessControl, InGroup<BindToTemporaryCopy>;
1727def err_access_base_ctor : Error<
1728  // The ERRORs represent other special members that aren't constructors, in
1729  // hopes that someone will bother noticing and reporting if they appear
1730  "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1731  "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1732  "|*ERROR*|}2constructor">, AccessControl;
1733def err_access_field_ctor : Error<
1734  // The ERRORs represent other special members that aren't constructors, in
1735  // hopes that someone will bother noticing and reporting if they appear
1736  "field of type %0 has %select{private|protected}2 "
1737  "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1738  AccessControl;
1739def err_access_friend_function : Error<
1740  "friend function %1 is a %select{private|protected}0 member of %3">,
1741  AccessControl;
1742
1743def err_access_dtor : Error<
1744  "calling a %select{private|protected}1 destructor of class %0">,
1745  AccessControl;
1746def err_access_dtor_base :
1747    Error<"base class %0 has %select{private|protected}1 destructor">,
1748    AccessControl;
1749def err_access_dtor_vbase :
1750    Error<"inherited virtual base class %1 has "
1751    "%select{private|protected}2 destructor">,
1752    AccessControl;
1753def err_access_dtor_temp :
1754    Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1755    AccessControl;
1756def err_access_dtor_exception :
1757    Error<"exception object of type %0 has %select{private|protected}1 "
1758          "destructor">, AccessControl;
1759def err_access_dtor_field :
1760    Error<"field of type %1 has %select{private|protected}2 destructor">,
1761    AccessControl;
1762def err_access_dtor_var :
1763    Error<"variable of type %1 has %select{private|protected}2 destructor">,
1764    AccessControl;
1765def err_access_dtor_ivar :
1766    Error<"instance variable of type %0 has %select{private|protected}1 "
1767          "destructor">,
1768    AccessControl;
1769def note_previous_access_declaration : Note<
1770  "previously declared '%1' here">;
1771def note_access_natural : Note<
1772  "%select{|implicitly }1declared %select{private|protected}0 here">;
1773def note_access_constrained_by_path : Note<
1774  "constrained by %select{|implicitly }1%select{private|protected}0"
1775  " inheritance here">;
1776def note_access_protected_restricted_noobject : Note<
1777  "must name member using the type of the current context %0">;
1778def note_access_protected_restricted_ctordtor : Note<
1779  "protected %select{constructor|destructor}0 can only be used to "
1780  "%select{construct|destroy}0 a base class subobject">;
1781def note_access_protected_restricted_object : Note<
1782  "can only access this member on an object of type %0">;
1783def warn_cxx98_compat_sfinae_access_control : Warning<
1784  "substitution failure due to access control is incompatible with C++98">,
1785  InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1786
1787// C++ name lookup
1788def err_incomplete_nested_name_spec : Error<
1789  "incomplete type %0 named in nested name specifier">;
1790def err_incomplete_enum : Error<
1791  "enumeration %0 is incomplete">;
1792def err_dependent_nested_name_spec : Error<
1793  "nested name specifier for a declaration cannot depend on a template "
1794  "parameter">;
1795def err_nested_name_member_ref_lookup_ambiguous : Error<
1796  "lookup of %0 in member access expression is ambiguous">;
1797def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1798  "lookup of %0 in member access expression is ambiguous; using member of %1">,
1799  InGroup<AmbigMemberTemplate>;
1800def note_ambig_member_ref_object_type : Note<
1801  "lookup in the object type %0 refers here">;
1802def note_ambig_member_ref_scope : Note<
1803  "lookup from the current scope refers here">;
1804def err_qualified_member_nonclass : Error<
1805  "qualified member access refers to a member in %0">;
1806def err_incomplete_member_access : Error<
1807  "member access into incomplete type %0">;
1808def err_incomplete_type : Error<
1809  "incomplete type %0 where a complete type is required">;
1810def warn_cxx98_compat_enum_nested_name_spec : Warning<
1811  "enumeration type in nested name specifier is incompatible with C++98">,
1812  InGroup<CXX98Compat>, DefaultIgnore;
1813def err_nested_name_spec_is_not_class : Error<
1814  "%0 cannot appear before '::' because it is not a class"
1815  "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1816def ext_nested_name_spec_is_enum : ExtWarn<
1817  "use of enumeration in a nested name specifier is a C++11 extension">,
1818  InGroup<CXX11>;
1819def err_out_of_line_qualified_id_type_names_constructor : Error<
1820  "qualified reference to %0 is a constructor name rather than a "
1821  "%select{template name|type}1 in this context">;
1822def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1823  "ISO C++ specifies that "
1824  "qualified reference to %0 is a constructor name rather than a "
1825  "%select{template name|type}1 in this context, despite preceding "
1826  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1827  InGroup<DiagGroup<"injected-class-name">>;
1828
1829// C++ class members
1830def err_storageclass_invalid_for_member : Error<
1831  "storage class specified for a member declaration">;
1832def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1833def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1834def ext_mutable_reference : ExtWarn<
1835  "'mutable' on a reference type is a Microsoft extension">,
1836  InGroup<MicrosoftMutableReference>;
1837def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1838def err_mutable_nonmember : Error<
1839  "'mutable' can only be applied to member variables">;
1840def err_virtual_in_union : Error<
1841  "unions cannot have virtual functions">;
1842def err_virtual_non_function : Error<
1843  "'virtual' can only appear on non-static member functions">;
1844def err_virtual_out_of_class : Error<
1845  "'virtual' can only be specified inside the class definition">;
1846def err_virtual_member_function_template : Error<
1847  "'virtual' cannot be specified on member function templates">;
1848def err_static_overrides_virtual : Error<
1849  "'static' member function %0 overrides a virtual function in a base class">;
1850def err_explicit_non_function : Error<
1851  "'explicit' can only appear on non-static member functions">;
1852def err_explicit_out_of_class : Error<
1853  "'explicit' can only be specified inside the class definition">;
1854def err_explicit_non_ctor_or_conv_function : Error<
1855  "'explicit' can only be applied to a constructor or conversion function">;
1856def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1857def err_static_out_of_line : Error<
1858  "'static' can only be specified inside the class definition">;
1859def ext_static_out_of_line : ExtWarn<
1860  err_static_out_of_line.Text>,
1861  InGroup<MicrosoftTemplate>;
1862def err_storage_class_for_static_member : Error<
1863  "static data member definition cannot specify a storage class">;
1864def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1865def err_not_integral_type_bitfield : Error<
1866  "bit-field %0 has non-integral type %1">;
1867def err_not_integral_type_anon_bitfield : Error<
1868  "anonymous bit-field has non-integral type %0">;
1869def err_anon_bitfield_qualifiers : Error<
1870  "anonymous bit-field cannot have qualifiers">;
1871def err_member_function_initialization : Error<
1872  "initializer on function does not look like a pure-specifier">;
1873def err_non_virtual_pure : Error<
1874  "%0 is not virtual and cannot be declared pure">;
1875def ext_pure_function_definition : ExtWarn<
1876  "function definition with pure-specifier is a Microsoft extension">,
1877  InGroup<MicrosoftPureDefinition>;
1878def err_qualified_member_of_unrelated : Error<
1879  "%q0 is not a member of class %1">;
1880
1881def err_member_function_call_bad_cvr : Error<
1882  "'this' argument to member function %0 has type %1, but function is not marked "
1883  "%select{const|restrict|const or restrict|volatile|const or volatile|"
1884  "volatile or restrict|const, volatile, or restrict}2">;
1885def err_member_function_call_bad_ref : Error<
1886  "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1887  "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1888def err_member_function_call_bad_type : Error<
1889  "cannot initialize object parameter of type %0 with an expression "
1890  "of type %1">;
1891
1892def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1893  "call to pure virtual member function %0 has undefined behavior; "
1894  "overrides of %0 in subclasses are not available in the "
1895  "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1896
1897def select_special_member_kind : TextSubstitution<
1898  "%select{default constructor|copy constructor|move constructor|"
1899  "copy assignment operator|move assignment operator|destructor}0">;
1900
1901def note_member_declared_at : Note<"member is declared here">;
1902def note_ivar_decl : Note<"instance variable is declared here">;
1903def note_bitfield_decl : Note<"bit-field is declared here">;
1904def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1905def note_member_synthesized_at : Note<
1906  "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
1907  "first required here">;
1908def note_comparison_synthesized_at : Note<
1909  "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
1910  "first required here">;
1911def err_missing_default_ctor : Error<
1912  "%select{constructor for %1 must explicitly initialize the|"
1913  "implicit default constructor for %1 must explicitly initialize the|"
1914  "cannot use constructor inherited from base class %4;}0 "
1915  "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1916  "does not have a default constructor">;
1917def note_due_to_dllexported_class : Note<
1918  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1919
1920def err_illegal_union_or_anon_struct_member : Error<
1921  "%select{anonymous struct|union}0 member %1 has a non-trivial "
1922  "%sub{select_special_member_kind}2">;
1923
1924def warn_frame_address : Warning<
1925  "calling '%0' with a nonzero argument is unsafe">,
1926  InGroup<FrameAddress>, DefaultIgnore;
1927
1928def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1929  "%select{anonymous struct|union}0 member %1 with a non-trivial "
1930  "%sub{select_special_member_kind}2 is incompatible with C++98">,
1931  InGroup<CXX98Compat>, DefaultIgnore;
1932
1933def note_nontrivial_virtual_dtor : Note<
1934  "destructor for %0 is not trivial because it is virtual">;
1935def note_nontrivial_has_virtual : Note<
1936  "because type %0 has a virtual %select{member function|base class}1">;
1937def note_nontrivial_no_def_ctor : Note<
1938  "because %select{base class of |field of |}0type %1 has no "
1939  "default constructor">;
1940def note_user_declared_ctor : Note<
1941  "implicit default constructor suppressed by user-declared constructor">;
1942def note_nontrivial_no_copy : Note<
1943  "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1944  "assignment operator|<<ERROR>>}2 can be used to "
1945  "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1946  "%select{base class|field|an object}0 of type %3">;
1947def note_nontrivial_user_provided : Note<
1948  "because %select{base class of |field of |}0type %1 has a user-provided "
1949  "%sub{select_special_member_kind}2">;
1950def note_nontrivial_default_member_init : Note<
1951  "because field %0 has an initializer">;
1952def note_nontrivial_param_type : Note<
1953  "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
1954def note_nontrivial_default_arg : Note<"because it has a default argument">;
1955def note_nontrivial_variadic : Note<"because it is a variadic function">;
1956def note_nontrivial_subobject : Note<
1957  "because the function selected to %select{construct|copy|move|copy|move|"
1958  "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
1959def note_nontrivial_objc_ownership : Note<
1960  "because type %0 has a member with %select{no|no|__strong|__weak|"
1961  "__autoreleasing}1 ownership">;
1962
1963/// Selector for a TagTypeKind value.
1964def select_tag_type_kind : TextSubstitution<
1965  "%select{struct|interface|union|class|enum}0">;
1966
1967def err_static_data_member_not_allowed_in_anon_struct : Error<
1968  "static data member %0 not allowed in anonymous "
1969  "%sub{select_tag_type_kind}1">;
1970def ext_static_data_member_in_union : ExtWarn<
1971  "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
1972def warn_cxx98_compat_static_data_member_in_union : Warning<
1973  "static data member %0 in union is incompatible with C++98">,
1974  InGroup<CXX98Compat>, DefaultIgnore;
1975def ext_union_member_of_reference_type : ExtWarn<
1976  "union member %0 has reference type %1, which is a Microsoft extension">,
1977  InGroup<MicrosoftUnionMemberReference>;
1978def err_union_member_of_reference_type : Error<
1979  "union member %0 has reference type %1">;
1980def ext_anonymous_struct_union_qualified : Extension<
1981  "anonymous %select{struct|union}0 cannot be '%1'">;
1982def err_different_return_type_for_overriding_virtual_function : Error<
1983  "virtual function %0 has a different return type "
1984  "%diff{($) than the function it overrides (which has return type $)|"
1985  "than the function it overrides}1,2">;
1986def note_overridden_virtual_function : Note<
1987  "overridden virtual function is here">;
1988def err_conflicting_overriding_cc_attributes : Error<
1989  "virtual function %0 has different calling convention attributes "
1990  "%diff{($) than the function it overrides (which has calling convention $)|"
1991  "than the function it overrides}1,2">;
1992def warn_overriding_method_missing_noescape : Warning<
1993  "parameter of overriding method should be annotated with "
1994  "__attribute__((noescape))">, InGroup<MissingNoEscape>;
1995def note_overridden_marked_noescape : Note<
1996  "parameter of overridden method is annotated with __attribute__((noescape))">;
1997def note_cat_conform_to_noescape_prot : Note<
1998  "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
1999
2000def err_covariant_return_inaccessible_base : Error<
2001  "invalid covariant return for virtual function: %1 is a "
2002  "%select{private|protected}2 base class of %0">, AccessControl;
2003def err_covariant_return_ambiguous_derived_to_base_conv : Error<
2004  "return type of virtual function %3 is not covariant with the return type of "
2005  "the function it overrides (ambiguous conversion from derived class "
2006  "%0 to base class %1:%2)">;
2007def err_covariant_return_not_derived : Error<
2008  "return type of virtual function %0 is not covariant with the return type of "
2009  "the function it overrides (%1 is not derived from %2)">;
2010def err_covariant_return_incomplete : Error<
2011  "return type of virtual function %0 is not covariant with the return type of "
2012  "the function it overrides (%1 is incomplete)">;
2013def err_covariant_return_type_different_qualifications : Error<
2014  "return type of virtual function %0 is not covariant with the return type of "
2015  "the function it overrides (%1 has different qualifiers than %2)">;
2016def err_covariant_return_type_class_type_more_qualified : Error<
2017  "return type of virtual function %0 is not covariant with the return type of "
2018  "the function it overrides (class type %1 is more qualified than class "
2019  "type %2">;
2020
2021// C++ implicit special member functions
2022def note_in_declaration_of_implicit_special_member : Note<
2023  "while declaring the implicit %sub{select_special_member_kind}1"
2024  " for %0">;
2025
2026// C++ constructors
2027def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
2028def err_invalid_qualified_constructor : Error<
2029  "'%0' qualifier is not allowed on a constructor">;
2030def err_ref_qualifier_constructor : Error<
2031  "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
2032
2033def err_constructor_return_type : Error<
2034  "constructor cannot have a return type">;
2035def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
2036def err_constructor_byvalue_arg : Error<
2037  "copy constructor must pass its first argument by reference">;
2038def warn_no_constructor_for_refconst : Warning<
2039  "%select{struct|interface|union|class|enum}0 %1 does not declare any "
2040  "constructor to initialize its non-modifiable members">;
2041def note_refconst_member_not_initialized : Note<
2042  "%select{const|reference}0 member %1 will never be initialized">;
2043def ext_ms_explicit_constructor_call : ExtWarn<
2044  "explicit constructor calls are a Microsoft extension">,
2045  InGroup<MicrosoftExplicitConstructorCall>;
2046
2047// C++ destructors
2048def err_destructor_not_member : Error<
2049  "destructor must be a non-static member function">;
2050def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
2051def err_invalid_qualified_destructor : Error<
2052  "'%0' qualifier is not allowed on a destructor">;
2053def err_ref_qualifier_destructor : Error<
2054  "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
2055def err_destructor_return_type : Error<"destructor cannot have a return type">;
2056def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
2057def err_destructor_with_params : Error<"destructor cannot have any parameters">;
2058def err_destructor_variadic : Error<"destructor cannot be variadic">;
2059def ext_destructor_typedef_name : ExtWarn<
2060  "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
2061  "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
2062def err_undeclared_destructor_name : Error<
2063  "undeclared identifier %0 in destructor name">;
2064def err_destructor_name : Error<
2065  "expected the class name after '~' to name the enclosing class">;
2066def err_destructor_name_nontype : Error<
2067  "identifier %0 after '~' in destructor name does not name a type">;
2068def err_destructor_expr_mismatch : Error<
2069  "identifier %0 in object destruction expression does not name the type "
2070  "%1 of the object being destroyed">;
2071def err_destructor_expr_nontype : Error<
2072  "identifier %0 in object destruction expression does not name a type">;
2073def err_destructor_expr_type_mismatch : Error<
2074  "destructor type %0 in object destruction expression does not match the "
2075  "type %1 of the object being destroyed">;
2076def note_destructor_type_here : Note<
2077  "type %0 found by destructor name lookup">;
2078def note_destructor_nontype_here : Note<
2079  "non-type declaration found by destructor name lookup">;
2080def ext_dtor_named_in_wrong_scope : Extension<
2081  "ISO C++ requires the name after '::~' to be found in the same scope as "
2082  "the name before '::~'">, InGroup<DtorName>;
2083def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
2084  "qualified destructor name only found in lexical scope; omit the qualifier "
2085  "to find this type name by unqualified lookup">, InGroup<DtorName>;
2086def ext_dtor_name_ambiguous : Extension<
2087  "ISO C++ considers this destructor name lookup to be ambiguous">,
2088  InGroup<DtorName>;
2089
2090def err_destroy_attr_on_non_static_var : Error<
2091  "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
2092  " variable with static or thread storage duration">;
2093
2094def err_destructor_template : Error<
2095  "destructor cannot be declared as a template">;
2096
2097// C++ initialization
2098def err_init_conversion_failed : Error<
2099  "cannot initialize %select{a variable|a parameter|template parameter|"
2100  "return object|statement expression result|an "
2101  "exception object|a member subobject|an array element|a new value|a value|a "
2102  "base class|a constructor delegation|a vector element|a block element|a "
2103  "block element|a complex element|a lambda capture|a compound literal "
2104  "initializer|a related result|a parameter of CF audited function}0 "
2105  "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2106  "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2107  "%select{|: different classes%diff{ ($ vs $)|}5,6"
2108  "|: different number of parameters (%5 vs %6)"
2109  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2110  "|: different return type%diff{ ($ vs $)|}5,6"
2111  "|: different qualifiers (%5 vs %6)"
2112  "|: different exception specifications}4">;
2113def note_forward_class_conversion : Note<"%0 is not defined, but forward "
2114  "declared here; conversion would be valid if it was derived from %1">;
2115
2116def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2117  "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2118def err_lvalue_reference_bind_to_initlist : Error<
2119  "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2120  "initializer list temporary">;
2121def err_lvalue_reference_bind_to_temporary : Error<
2122  "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2123  "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2124def err_lvalue_reference_bind_to_unrelated : Error<
2125  "%select{non-const|volatile}0 lvalue reference "
2126  "%diff{to type $ cannot bind to a value of unrelated type $|"
2127  "cannot bind to a value of unrelated type}1,2">;
2128def err_reference_bind_drops_quals : Error<
2129  "binding reference %diff{of type $ to value of type $|to value}0,1 "
2130  "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2131  "not permitted due to incompatible qualifiers}2">;
2132def err_reference_bind_failed : Error<
2133  "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2134  "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2135  "incompatible type}0,3">;
2136def err_reference_bind_temporary_addrspace : Error<
2137  "reference of type %0 cannot bind to a temporary object because of "
2138  "address space mismatch">;
2139def err_reference_bind_init_list : Error<
2140  "reference to type %0 cannot bind to an initializer list">;
2141def err_init_list_bad_dest_type : Error<
2142  "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2143  "list">;
2144def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2145  "aggregate initialization of type %0 with user-declared constructors "
2146  "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2147
2148def err_reference_bind_to_bitfield : Error<
2149  "%select{non-const|volatile}0 reference cannot bind to "
2150  "bit-field%select{| %1}2">;
2151def err_reference_bind_to_vector_element : Error<
2152  "%select{non-const|volatile}0 reference cannot bind to vector element">;
2153def err_reference_bind_to_matrix_element : Error<
2154  "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2155def err_reference_var_requires_init : Error<
2156  "declaration of reference variable %0 requires an initializer">;
2157def err_reference_without_init : Error<
2158  "reference to type %0 requires an initializer">;
2159def note_value_initialization_here : Note<
2160  "in value-initialization of type %0 here">;
2161def err_reference_has_multiple_inits : Error<
2162  "reference cannot be initialized with multiple values">;
2163def err_init_non_aggr_init_list : Error<
2164  "initialization of non-aggregate type %0 with an initializer list">;
2165def err_init_reference_member_uninitialized : Error<
2166  "reference member of type %0 uninitialized">;
2167def note_uninit_reference_member : Note<
2168  "uninitialized reference member is here">;
2169def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2170  InGroup<Uninitialized>;
2171def warn_base_class_is_uninit : Warning<
2172  "base class %0 is uninitialized when used here to access %q1">,
2173  InGroup<Uninitialized>;
2174def warn_reference_field_is_uninit : Warning<
2175  "reference %0 is not yet bound to a value when used here">,
2176  InGroup<Uninitialized>;
2177def note_uninit_in_this_constructor : Note<
2178  "during field initialization in %select{this|the implicit default}0 "
2179  "constructor">;
2180def warn_static_self_reference_in_init : Warning<
2181  "static variable %0 is suspiciously used within its own initialization">,
2182  InGroup<UninitializedStaticSelfInit>;
2183def warn_uninit_self_reference_in_init : Warning<
2184  "variable %0 is uninitialized when used within its own initialization">,
2185  InGroup<Uninitialized>;
2186def warn_uninit_self_reference_in_reference_init : Warning<
2187  "reference %0 is not yet bound to a value when used within its own"
2188  " initialization">,
2189  InGroup<Uninitialized>;
2190def warn_uninit_var : Warning<
2191  "variable %0 is uninitialized when %select{used here|captured by block}1">,
2192  InGroup<Uninitialized>, DefaultIgnore;
2193def warn_sometimes_uninit_var : Warning<
2194  "variable %0 is %select{used|captured}1 uninitialized whenever "
2195  "%select{'%3' condition is %select{true|false}4|"
2196  "'%3' loop %select{is entered|exits because its condition is false}4|"
2197  "'%3' loop %select{condition is true|exits because its condition is false}4|"
2198  "switch %3 is taken|"
2199  "its declaration is reached|"
2200  "%3 is called}2">,
2201  InGroup<UninitializedSometimes>, DefaultIgnore;
2202def warn_maybe_uninit_var : Warning<
2203  "variable %0 may be uninitialized when "
2204  "%select{used here|captured by block}1">,
2205  InGroup<UninitializedMaybe>, DefaultIgnore;
2206def note_var_declared_here : Note<"variable %0 is declared here">;
2207def note_uninit_var_use : Note<
2208  "%select{uninitialized use occurs|variable is captured by block}0 here">;
2209def warn_uninit_byref_blockvar_captured_by_block : Warning<
2210  "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2211  "block">, InGroup<Uninitialized>, DefaultIgnore;
2212def note_block_var_fixit_add_initialization : Note<
2213  "did you mean to use __block %0?">;
2214def note_in_omitted_aggregate_initializer : Note<
2215  "in implicit initialization of %select{"
2216  "array element %1 with omitted initializer|"
2217  "field %1 with omitted initializer|"
2218  "trailing array elements in runtime-sized array new}0">;
2219def note_in_reference_temporary_list_initializer : Note<
2220  "in initialization of temporary of type %0 created to "
2221  "list-initialize this reference">;
2222def note_var_fixit_add_initialization : Note<
2223  "initialize the variable %0 to silence this warning">;
2224def note_uninit_fixit_remove_cond : Note<
2225  "remove the %select{'%1' if its condition|condition if it}0 "
2226  "is always %select{false|true}2">;
2227def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2228def err_list_init_in_parens : Error<
2229  "cannot initialize %select{non-class|reference}0 type %1 with a "
2230  "parenthesized initializer list">;
2231
2232def warn_uninit_const_reference : Warning<
2233  "variable %0 is uninitialized when passed as a const reference argument "
2234  "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2235
2236def warn_unsequenced_mod_mod : Warning<
2237  "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2238def warn_unsequenced_mod_use : Warning<
2239  "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2240
2241def select_initialized_entity_kind : TextSubstitution<
2242  "%select{copying variable|copying parameter|initializing template parameter|"
2243  "returning object|initializing statement expression result|"
2244  "throwing object|copying member subobject|copying array element|"
2245  "allocating object|copying temporary|initializing base subobject|"
2246  "initializing vector element|capturing value}0">;
2247
2248def err_temp_copy_no_viable : Error<
2249  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2250def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2251  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2252  "C++98 requires a copy constructor when binding a reference to a temporary">,
2253  InGroup<BindToTemporaryCopy>;
2254def err_temp_copy_ambiguous : Error<
2255  "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2256  "of type %1">;
2257def err_temp_copy_deleted : Error<
2258  "%sub{select_initialized_entity_kind}0 of type %1 "
2259  "invokes deleted constructor">;
2260def err_temp_copy_incomplete : Error<
2261  "copying a temporary object of incomplete type %0">;
2262def warn_cxx98_compat_temp_copy : Warning<
2263  "%sub{select_initialized_entity_kind}1 "
2264  "of type %2 when binding a reference to a temporary would %select{invoke "
2265  "an inaccessible constructor|find no viable constructor|find ambiguous "
2266  "constructors|invoke a deleted constructor}0 in C++98">,
2267  InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2268def err_selected_explicit_constructor : Error<
2269  "chosen constructor is explicit in copy-initialization">;
2270def note_explicit_ctor_deduction_guide_here : Note<
2271  "explicit %select{constructor|deduction guide}0 declared here">;
2272
2273// C++11 decltype
2274def err_decltype_in_declarator : Error<
2275    "'decltype' cannot be used to name a declaration">;
2276
2277// C++11 auto
2278def warn_cxx98_compat_auto_type_specifier : Warning<
2279  "'auto' type specifier is incompatible with C++98">,
2280  InGroup<CXX98Compat>, DefaultIgnore;
2281def err_auto_variable_cannot_appear_in_own_initializer : Error<
2282  "variable %0 declared with deduced type %1 "
2283  "cannot appear in its own initializer">;
2284def err_binding_cannot_appear_in_own_initializer : Error<
2285  "binding %0 cannot appear in the initializer of its own "
2286  "decomposition declaration">;
2287def err_illegal_decl_array_of_auto : Error<
2288  "'%0' declared as array of %1">;
2289def err_new_array_of_auto : Error<
2290  "cannot allocate array of 'auto'">;
2291def err_auto_not_allowed : Error<
2292  "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2293  "use of "
2294  "%select{class template|function template|variable template|alias template|"
2295  "template template parameter|concept|template}2 %3 requires template "
2296  "arguments; argument deduction}0 not allowed "
2297  "%select{in function prototype"
2298  "|in non-static struct member|in struct member"
2299  "|in non-static union member|in union member"
2300  "|in non-static class member|in interface member"
2301  "|in exception declaration|in template parameter until C++17|in block literal"
2302  "|in template argument|in typedef|in type alias|in function return type"
2303  "|in conversion function type|here|in lambda parameter"
2304  "|in type allocated by 'new'|in K&R-style function parameter"
2305  "|in template parameter|in friend declaration|in function prototype that is "
2306  "not a function declaration|in requires expression parameter}1">;
2307def err_dependent_deduced_tst : Error<
2308  "typename specifier refers to "
2309  "%select{class template|function template|variable template|alias template|"
2310  "template template parameter|template}0 member in %1; "
2311  "argument deduction not allowed here">;
2312def err_deduced_tst : Error<
2313  "typename specifier refers to "
2314  "%select{class template|function template|variable template|alias template|"
2315  "template template parameter|template}0; argument deduction not allowed "
2316  "here">;
2317def err_auto_not_allowed_var_inst : Error<
2318  "'auto' variable template instantiation is not allowed">;
2319def err_auto_var_requires_init : Error<
2320  "declaration of variable %0 with deduced type %1 requires an initializer">;
2321def err_auto_new_requires_ctor_arg : Error<
2322  "new expression for type %0 requires a constructor argument">;
2323def ext_auto_new_list_init : Extension<
2324  "ISO C++ standards before C++17 do not allow new expression for "
2325  "type %0 to use list-initialization">, InGroup<CXX17>;
2326def err_auto_var_init_no_expression : Error<
2327  "initializer for variable %0 with type %1 is empty">;
2328def err_auto_var_init_multiple_expressions : Error<
2329  "initializer for variable %0 with type %1 contains multiple expressions">;
2330def err_auto_var_init_paren_braces : Error<
2331  "cannot deduce type for variable %1 with type %2 from "
2332  "%select{parenthesized|nested}0 initializer list">;
2333def err_auto_new_ctor_multiple_expressions : Error<
2334  "new expression for type %0 contains multiple constructor arguments">;
2335def err_auto_missing_trailing_return : Error<
2336  "'auto' return without trailing return type; deduced return types are a "
2337  "C++14 extension">;
2338def err_deduced_return_type : Error<
2339  "deduced return types are a C++14 extension">;
2340def err_trailing_return_without_auto : Error<
2341  "function with trailing return type must specify return type 'auto', not %0">;
2342def err_trailing_return_in_parens : Error<
2343  "trailing return type may not be nested within parentheses">;
2344def err_auto_var_deduction_failure : Error<
2345  "variable %0 with type %1 has incompatible initializer of type %2">;
2346def err_auto_var_deduction_failure_from_init_list : Error<
2347  "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2348def err_auto_new_deduction_failure : Error<
2349  "new expression for type %0 has incompatible constructor argument of type %1">;
2350def err_auto_inconsistent_deduction : Error<
2351  "deduced conflicting types %diff{($ vs $) |}0,1"
2352  "for initializer list element type">;
2353def err_auto_different_deductions : Error<
2354  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2355  "deduced as %1 in declaration of %2 and "
2356  "deduced as %3 in declaration of %4">;
2357def err_auto_non_deduced_not_alone : Error<
2358  "%select{function with deduced return type|"
2359  "declaration with trailing return type}0 "
2360  "must be the only declaration in its group">;
2361def err_implied_std_initializer_list_not_found : Error<
2362  "cannot deduce type of initializer list because std::initializer_list was "
2363  "not found; include <initializer_list>">;
2364def err_malformed_std_initializer_list : Error<
2365  "std::initializer_list must be a class template with a single type parameter">;
2366def err_auto_init_list_from_c : Error<
2367  "cannot use __auto_type with initializer list in C">;
2368def err_auto_bitfield : Error<
2369  "cannot pass bit-field as __auto_type initializer in C">;
2370
2371// C++1y decltype(auto) type
2372def err_decltype_auto_invalid : Error<
2373  "'decltype(auto)' not allowed here">;
2374def err_decltype_auto_cannot_be_combined : Error<
2375  "'decltype(auto)' cannot be combined with other type specifiers">;
2376def err_decltype_auto_function_declarator_not_declaration : Error<
2377  "'decltype(auto)' can only be used as a return type "
2378  "in a function declaration">;
2379def err_decltype_auto_compound_type : Error<
2380  "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2381def err_decltype_auto_initializer_list : Error<
2382  "cannot deduce 'decltype(auto)' from initializer list">;
2383
2384// C++17 deduced class template specialization types
2385def err_deduced_class_template_compound_type : Error<
2386  "cannot %select{form pointer to|form reference to|form array of|"
2387  "form function returning|use parentheses when declaring variable with}0 "
2388  "deduced class template specialization type">;
2389def err_deduced_non_class_template_specialization_type : Error<
2390  "%select{<error>|function template|variable template|alias template|"
2391  "template template parameter|concept|template}0 %1 requires template "
2392  "arguments; argument deduction only allowed for class templates">;
2393def err_deduced_class_template_ctor_ambiguous : Error<
2394  "ambiguous deduction for template arguments of %0">;
2395def err_deduced_class_template_ctor_no_viable : Error<
2396  "no viable constructor or deduction guide for deduction of "
2397  "template arguments of %0">;
2398def err_deduced_class_template_incomplete : Error<
2399  "template %0 has no definition and no %select{|viable }1deduction guides "
2400  "for deduction of template arguments">;
2401def err_deduced_class_template_deleted : Error<
2402  "class template argument deduction for %0 selected a deleted constructor">;
2403def err_deduced_class_template_explicit : Error<
2404  "class template argument deduction for %0 selected an explicit "
2405  "%select{constructor|deduction guide}1 for copy-list-initialization">;
2406def err_deduction_guide_no_trailing_return_type : Error<
2407  "deduction guide declaration without trailing return type">;
2408def err_deduction_guide_bad_trailing_return_type : Error<
2409  "deduced type %1 of deduction guide is not %select{|written as }2"
2410  "a specialization of template %0">;
2411def err_deduction_guide_with_complex_decl : Error<
2412  "cannot specify any part of a return type in the "
2413  "declaration of a deduction guide">;
2414def err_deduction_guide_invalid_specifier : Error<
2415  "deduction guide cannot be declared '%0'">;
2416def err_deduction_guide_name_not_class_template : Error<
2417  "cannot specify deduction guide for "
2418  "%select{<error>|function template|variable template|alias template|"
2419  "template template parameter|concept|dependent template name}0 %1">;
2420def err_deduction_guide_wrong_scope : Error<
2421  "deduction guide must be declared in the same scope as template %q0">;
2422def err_deduction_guide_defines_function : Error<
2423  "deduction guide cannot have a function definition">;
2424def err_deduction_guide_redeclared : Error<
2425  "redeclaration of deduction guide">;
2426def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2427  "%select{explicitly instantiated|explicitly specialized}0">;
2428def err_deduction_guide_template_not_deducible : Error<
2429  "deduction guide template contains "
2430  "%select{a template parameter|template parameters}0 that cannot be "
2431  "deduced">;
2432def err_deduction_guide_wrong_access : Error<
2433  "deduction guide has different access from the corresponding "
2434  "member template">;
2435def note_deduction_guide_template_access : Note<
2436  "member template declared %0 here">;
2437def note_deduction_guide_access : Note<
2438  "deduction guide declared %0 by intervening access specifier">;
2439def warn_cxx14_compat_class_template_argument_deduction : Warning<
2440  "class template argument deduction is incompatible with C++ standards "
2441  "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2442  InGroup<CXXPre17Compat>, DefaultIgnore;
2443def warn_ctad_maybe_unsupported : Warning<
2444  "%0 may not intend to support class template argument deduction">,
2445  InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2446def note_suppress_ctad_maybe_unsupported : Note<
2447  "add a deduction guide to suppress this warning">;
2448
2449
2450// C++14 deduced return types
2451def err_auto_fn_deduction_failure : Error<
2452  "cannot deduce return type %0 from returned value of type %1">;
2453def err_auto_fn_different_deductions : Error<
2454  "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2455  "deduced as %2 in earlier return statement">;
2456def err_auto_fn_used_before_defined : Error<
2457  "function %0 with deduced return type cannot be used before it is defined">;
2458def err_auto_fn_no_return_but_not_auto : Error<
2459  "cannot deduce return type %0 for function with no return statements">;
2460def err_auto_fn_return_void_but_not_auto : Error<
2461  "cannot deduce return type %0 from omitted return expression">;
2462def err_auto_fn_return_init_list : Error<
2463  "cannot deduce return type from initializer list">;
2464def err_auto_fn_virtual : Error<
2465  "function with deduced return type cannot be virtual">;
2466def warn_cxx11_compat_deduced_return_type : Warning<
2467  "return type deduction is incompatible with C++ standards before C++14">,
2468  InGroup<CXXPre14Compat>, DefaultIgnore;
2469
2470// C++11 override control
2471def override_keyword_only_allowed_on_virtual_member_functions : Error<
2472  "only virtual member functions can be marked '%0'">;
2473def override_keyword_hides_virtual_member_function : Error<
2474  "non-virtual member function marked '%0' hides virtual member "
2475  "%select{function|functions}1">;
2476def err_function_marked_override_not_overriding : Error<
2477  "%0 marked 'override' but does not override any member functions">;
2478def warn_destructor_marked_not_override_overriding : TextSubstitution <
2479  "%0 overrides a destructor but is not marked 'override'">;
2480def warn_function_marked_not_override_overriding : TextSubstitution <
2481  "%0 overrides a member function but is not marked 'override'">;
2482def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2483  "%sub{warn_destructor_marked_not_override_overriding}0">,
2484  InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2485def warn_inconsistent_function_marked_not_override_overriding : Warning <
2486  "%sub{warn_function_marked_not_override_overriding}0">,
2487  InGroup<CXX11WarnInconsistentOverrideMethod>;
2488def warn_suggest_destructor_marked_not_override_overriding : Warning <
2489  "%sub{warn_destructor_marked_not_override_overriding}0">,
2490  InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2491def warn_suggest_function_marked_not_override_overriding : Warning <
2492  "%sub{warn_function_marked_not_override_overriding}0">,
2493  InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2494def err_class_marked_final_used_as_base : Error<
2495  "base %0 is marked '%select{final|sealed}1'">;
2496def warn_abstract_final_class : Warning<
2497  "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2498def warn_final_dtor_non_final_class : Warning<
2499  "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2500  InGroup<FinalDtorNonFinalClass>;
2501def note_final_dtor_non_final_class_silence : Note<
2502  "mark %0 as '%select{final|sealed}1' to silence this warning">;
2503
2504// C++11 attributes
2505def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2506
2507// C++11 final
2508def err_final_function_overridden : Error<
2509  "declaration of %0 overrides a '%select{final|sealed}1' function">;
2510
2511// C++11 scoped enumerations
2512def err_enum_invalid_underlying : Error<
2513  "non-integral type %0 is an invalid underlying type">;
2514def err_enumerator_too_large : Error<
2515  "enumerator value is not representable in the underlying type %0">;
2516def ext_enumerator_too_large : Extension<
2517  "enumerator value is not representable in the underlying type %0">,
2518  InGroup<MicrosoftEnumValue>;
2519def err_enumerator_wrapped : Error<
2520  "enumerator value %0 is not representable in the underlying type %1">;
2521def err_enum_redeclare_type_mismatch : Error<
2522  "enumeration redeclared with different underlying type %0 (was %1)">;
2523def err_enum_redeclare_fixed_mismatch : Error<
2524  "enumeration previously declared with %select{non|}0fixed underlying type">;
2525def err_enum_redeclare_scoped_mismatch : Error<
2526  "enumeration previously declared as %select{un|}0scoped">;
2527def err_only_enums_have_underlying_types : Error<
2528  "only enumeration types have underlying types">;
2529def err_underlying_type_of_incomplete_enum : Error<
2530  "cannot determine underlying type of incomplete enumeration type %0">;
2531
2532// C++11 delegating constructors
2533def err_delegating_ctor : Error<
2534  "delegating constructors are permitted only in C++11">;
2535def warn_cxx98_compat_delegating_ctor : Warning<
2536  "delegating constructors are incompatible with C++98">,
2537  InGroup<CXX98Compat>, DefaultIgnore;
2538def err_delegating_initializer_alone : Error<
2539  "an initializer for a delegating constructor must appear alone">;
2540def warn_delegating_ctor_cycle : Warning<
2541  "constructor for %0 creates a delegation cycle">, DefaultError,
2542  InGroup<DelegatingCtorCycles>;
2543def note_it_delegates_to : Note<"it delegates to">;
2544def note_which_delegates_to : Note<"which delegates to">;
2545
2546// C++11 range-based for loop
2547def err_for_range_decl_must_be_var : Error<
2548  "for range declaration must declare a variable">;
2549def err_for_range_storage_class : Error<
2550  "loop variable %0 may not be declared %select{'extern'|'static'|"
2551  "'__private_extern__'|'auto'|'register'|'constexpr'|'thread_local'}1">;
2552def err_type_defined_in_for_range : Error<
2553  "types may not be defined in a for range declaration">;
2554def err_for_range_deduction_failure : Error<
2555  "cannot use type %0 as a range">;
2556def err_for_range_incomplete_type : Error<
2557  "cannot use incomplete type %0 as a range">;
2558def err_for_range_iter_deduction_failure : Error<
2559  "cannot use type %0 as an iterator">;
2560def ext_for_range_begin_end_types_differ : ExtWarn<
2561  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2562  InGroup<CXX17>;
2563def warn_for_range_begin_end_types_differ : Warning<
2564  "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2565  "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2566def note_in_for_range: Note<
2567  "when looking up '%select{begin|end}0' function for range expression "
2568  "of type %1">;
2569def err_for_range_invalid: Error<
2570  "invalid range expression of type %0; no viable '%select{begin|end}1' "
2571  "function available">;
2572def note_for_range_member_begin_end_ignored : Note<
2573  "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2574def err_range_on_array_parameter : Error<
2575  "cannot build range expression with array function parameter %0 since "
2576  "parameter with array type %1 is treated as pointer type %2">;
2577def err_for_range_dereference : Error<
2578  "invalid range expression of type %0; did you mean to dereference it "
2579  "with '*'?">;
2580def note_for_range_invalid_iterator : Note <
2581  "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2582def note_for_range_begin_end : Note<
2583  "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2584def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2585  "loop variable %0 "
2586  "%diff{of type $ binds to a temporary constructed from type $"
2587  "|binds to a temporary constructed from a different type}1,2">,
2588  InGroup<RangeLoopConstruct>, DefaultIgnore;
2589def note_use_type_or_non_reference : Note<
2590  "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2591def warn_for_range_ref_binds_ret_temp : Warning<
2592  "loop variable %0 binds to a temporary value produced by a range of type %1">,
2593  InGroup<RangeLoopBindReference>, DefaultIgnore;
2594def note_use_non_reference_type : Note<"use non-reference type %0">;
2595def warn_for_range_copy : Warning<
2596  "loop variable %0 creates a copy from type %1">,
2597  InGroup<RangeLoopConstruct>, DefaultIgnore;
2598def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2599def err_objc_for_range_init_stmt : Error<
2600  "initialization statement is not supported when iterating over Objective-C "
2601  "collection">;
2602
2603// C++11 constexpr
2604def warn_cxx98_compat_constexpr : Warning<
2605  "'constexpr' specifier is incompatible with C++98">,
2606  InGroup<CXX98Compat>, DefaultIgnore;
2607// FIXME: Maybe this should also go in -Wc++14-compat?
2608def warn_cxx14_compat_constexpr_not_const : Warning<
2609  "'constexpr' non-static member function will not be implicitly 'const' "
2610  "in C++14; add 'const' to avoid a change in behavior">,
2611  InGroup<DiagGroup<"constexpr-not-const">>;
2612def err_invalid_consteval_take_address : Error<
2613  "cannot take address of consteval function %0 outside"
2614  " of an immediate invocation">;
2615def err_invalid_consteval_call : Error<
2616  "call to consteval function %q0 is not a constant expression">;
2617def err_invalid_consteval_decl_kind : Error<
2618  "%0 cannot be declared consteval">;
2619def err_invalid_constexpr : Error<
2620  "%select{function parameter|typedef}0 "
2621  "cannot be %sub{select_constexpr_spec_kind}1">;
2622def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2623  "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2624def err_constexpr_tag : Error<
2625  "%select{class|struct|interface|union|enum}0 "
2626  "cannot be marked %sub{select_constexpr_spec_kind}1">;
2627def err_constexpr_dtor : Error<
2628  "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2629def err_constexpr_dtor_subobject : Error<
2630  "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2631  "%select{data member %2|base class %3}1 does not have a "
2632  "constexpr destructor">;
2633def note_constexpr_dtor_subobject : Note<
2634  "%select{data member %1|base class %2}0 declared here">;
2635def err_constexpr_wrong_decl_kind : Error<
2636  "%sub{select_constexpr_spec_kind}0 can only be used "
2637  "in %select{|variable and function|function|variable}0 declarations">;
2638def err_invalid_constexpr_var_decl : Error<
2639  "constexpr variable declaration must be a definition">;
2640def err_constexpr_static_mem_var_requires_init : Error<
2641  "declaration of constexpr static data member %0 requires an initializer">;
2642def err_constexpr_var_non_literal : Error<
2643  "constexpr variable cannot have non-literal type %0">;
2644def err_constexpr_var_requires_const_init : Error<
2645  "constexpr variable %0 must be initialized by a constant expression">;
2646def err_constexpr_var_requires_const_destruction : Error<
2647  "constexpr variable %0 must have constant destruction">;
2648def err_constexpr_redecl_mismatch : Error<
2649  "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2650  " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2651def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2652def warn_cxx17_compat_constexpr_virtual : Warning<
2653  "virtual constexpr functions are incompatible with "
2654  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2655def err_constexpr_virtual_base : Error<
2656  "constexpr %select{member function|constructor}0 not allowed in "
2657  "%select{struct|interface|class}1 with virtual base "
2658  "%plural{1:class|:classes}2">;
2659def note_non_literal_incomplete : Note<
2660  "incomplete type %0 is not a literal type">;
2661def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2662  "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2663def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2664def err_constexpr_non_literal_return : Error<
2665  "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2666def err_constexpr_non_literal_param : Error<
2667  "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2668  "not a literal type">;
2669def err_constexpr_body_invalid_stmt : Error<
2670  "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2671def ext_constexpr_body_invalid_stmt : ExtWarn<
2672  "use of this statement in a constexpr %select{function|constructor}0 "
2673  "is a C++14 extension">, InGroup<CXX14>;
2674def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2675  "use of this statement in a constexpr %select{function|constructor}0 "
2676  "is incompatible with C++ standards before C++14">,
2677  InGroup<CXXPre14Compat>, DefaultIgnore;
2678def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2679  "use of this statement in a constexpr %select{function|constructor}0 "
2680  "is a C++20 extension">, InGroup<CXX20>;
2681def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2682  "use of this statement in a constexpr %select{function|constructor}0 "
2683  "is incompatible with C++ standards before C++20">,
2684  InGroup<CXXPre20Compat>, DefaultIgnore;
2685def ext_constexpr_type_definition : ExtWarn<
2686  "type definition in a constexpr %select{function|constructor}0 "
2687  "is a C++14 extension">, InGroup<CXX14>;
2688def warn_cxx11_compat_constexpr_type_definition : Warning<
2689  "type definition in a constexpr %select{function|constructor}0 "
2690  "is incompatible with C++ standards before C++14">,
2691  InGroup<CXXPre14Compat>, DefaultIgnore;
2692def err_constexpr_vla : Error<
2693  "variably-modified type %0 cannot be used in a constexpr "
2694  "%select{function|constructor}1">;
2695def ext_constexpr_local_var : ExtWarn<
2696  "variable declaration in a constexpr %select{function|constructor}0 "
2697  "is a C++14 extension">, InGroup<CXX14>;
2698def warn_cxx11_compat_constexpr_local_var : Warning<
2699  "variable declaration in a constexpr %select{function|constructor}0 "
2700  "is incompatible with C++ standards before C++14">,
2701  InGroup<CXXPre14Compat>, DefaultIgnore;
2702def err_constexpr_local_var_static : Error<
2703  "%select{static|thread_local}1 variable not permitted in a constexpr "
2704  "%select{function|constructor}0">;
2705def err_constexpr_local_var_non_literal_type : Error<
2706  "variable of non-literal type %1 cannot be defined in a constexpr "
2707  "%select{function|constructor}0">;
2708def ext_constexpr_local_var_no_init : ExtWarn<
2709  "uninitialized variable in a constexpr %select{function|constructor}0 "
2710  "is a C++20 extension">, InGroup<CXX20>;
2711def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2712  "uninitialized variable in a constexpr %select{function|constructor}0 "
2713  "is incompatible with C++ standards before C++20">,
2714  InGroup<CXXPre20Compat>, DefaultIgnore;
2715def ext_constexpr_function_never_constant_expr : ExtWarn<
2716  "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2717  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2718def err_attr_cond_never_constant_expr : Error<
2719  "%0 attribute expression never produces a constant expression">;
2720def err_diagnose_if_invalid_diagnostic_type : Error<
2721  "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2722  "instead">;
2723def err_constexpr_body_no_return : Error<
2724  "no return statement in %select{constexpr|consteval}0 function">;
2725def err_constexpr_return_missing_expr : Error<
2726  "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2727def warn_cxx11_compat_constexpr_body_no_return : Warning<
2728  "constexpr function with no return statements is incompatible with C++ "
2729  "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2730def ext_constexpr_body_multiple_return : ExtWarn<
2731  "multiple return statements in constexpr function is a C++14 extension">,
2732  InGroup<CXX14>;
2733def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2734  "multiple return statements in constexpr function "
2735  "is incompatible with C++ standards before C++14">,
2736  InGroup<CXXPre14Compat>, DefaultIgnore;
2737def note_constexpr_body_previous_return : Note<
2738  "previous return statement is here">;
2739
2740// C++20 function try blocks in constexpr
2741def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2742  "function try block in constexpr %select{function|constructor}0 is "
2743  "a C++20 extension">, InGroup<CXX20>;
2744def warn_cxx17_compat_constexpr_function_try_block : Warning<
2745  "function try block in constexpr %select{function|constructor}0 is "
2746  "incompatible with C++ standards before C++20">,
2747  InGroup<CXXPre20Compat>, DefaultIgnore;
2748
2749def ext_constexpr_union_ctor_no_init : ExtWarn<
2750  "constexpr union constructor that does not initialize any member "
2751  "is a C++20 extension">, InGroup<CXX20>;
2752def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2753  "constexpr union constructor that does not initialize any member "
2754  "is incompatible with C++ standards before C++20">,
2755  InGroup<CXXPre20Compat>, DefaultIgnore;
2756def ext_constexpr_ctor_missing_init : ExtWarn<
2757  "constexpr constructor that does not initialize all members "
2758  "is a C++20 extension">, InGroup<CXX20>;
2759def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2760  "constexpr constructor that does not initialize all members "
2761  "is incompatible with C++ standards before C++20">,
2762  InGroup<CXXPre20Compat>, DefaultIgnore;
2763def note_constexpr_ctor_missing_init : Note<
2764  "member not initialized by constructor">;
2765def note_non_literal_no_constexpr_ctors : Note<
2766  "%0 is not literal because it is not an aggregate and has no constexpr "
2767  "constructors other than copy or move constructors">;
2768def note_non_literal_base_class : Note<
2769  "%0 is not literal because it has base class %1 of non-literal type">;
2770def note_non_literal_field : Note<
2771  "%0 is not literal because it has data member %1 of "
2772  "%select{non-literal|volatile}3 type %2">;
2773def note_non_literal_user_provided_dtor : Note<
2774  "%0 is not literal because it has a user-provided destructor">;
2775def note_non_literal_nontrivial_dtor : Note<
2776  "%0 is not literal because it has a non-trivial destructor">;
2777def note_non_literal_non_constexpr_dtor : Note<
2778  "%0 is not literal because its destructor is not constexpr">;
2779def note_non_literal_lambda : Note<
2780  "lambda closure types are non-literal types before C++17">;
2781def warn_private_extern : Warning<
2782  "use of __private_extern__ on a declaration may not produce external symbol "
2783  "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2784def note_private_extern : Note<
2785  "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2786
2787// C++ Concepts
2788def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2789  "concept declarations may only appear in global or namespace scope">;
2790def err_concept_no_parameters : Error<
2791  "concept template parameter list must have at least one parameter; explicit "
2792  "specialization of concepts is not allowed">;
2793def err_concept_extra_headers : Error<
2794  "extraneous template parameter list in concept definition">;
2795def err_concept_no_associated_constraints : Error<
2796  "concept cannot have associated constraints">;
2797def err_non_constant_constraint_expression : Error<
2798  "substitution into constraint expression resulted in a non-constant "
2799  "expression">;
2800def err_non_bool_atomic_constraint : Error<
2801  "atomic constraint must be of type 'bool' (found %0)">;
2802def err_template_arg_list_constraints_not_satisfied : Error<
2803  "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2804  "template template parameter|template}0 %1%2">;
2805def note_substituted_constraint_expr_is_ill_formed : Note<
2806  "because substituted constraint expression is ill-formed%0">;
2807def note_atomic_constraint_evaluated_to_false : Note<
2808  "%select{and|because}0 '%1' evaluated to false">;
2809def note_concept_specialization_constraint_evaluated_to_false : Note<
2810  "%select{and|because}0 '%1' evaluated to false">;
2811def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2812  "%select{and|because}0 %1 does not satisfy %2">;
2813def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2814  "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2815def err_constrained_virtual_method : Error<
2816  "virtual function cannot have a requires clause">;
2817def err_trailing_requires_clause_on_deduction_guide : Error<
2818  "deduction guide cannot have a requires clause">;
2819def err_reference_to_function_with_unsatisfied_constraints : Error<
2820  "invalid reference to function %0: constraints not satisfied">;
2821def err_requires_expr_local_parameter_default_argument : Error<
2822  "default arguments not allowed for parameters of a requires expression">;
2823def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2824  "constraint variable %0 cannot be used in an evaluated context">;
2825def note_expr_requirement_expr_substitution_error : Note<
2826  "%select{and|because}0 '%1' would be invalid: %2">;
2827def note_expr_requirement_expr_unknown_substitution_error : Note<
2828  "%select{and|because}0 '%1' would be invalid">;
2829def note_expr_requirement_noexcept_not_met : Note<
2830  "%select{and|because}0 '%1' may throw an exception">;
2831def note_expr_requirement_type_requirement_substitution_error : Note<
2832  "%select{and|because}0 '%1' would be invalid: %2">;
2833def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
2834  "%select{and|because}0 '%1' would be invalid">;
2835def note_expr_requirement_constraints_not_satisfied : Note<
2836  "%select{and|because}0 type constraint '%1' was not satisfied:">;
2837def note_expr_requirement_constraints_not_satisfied_simple : Note<
2838  "%select{and|because}0 %1 does not satisfy %2:">;
2839def note_type_requirement_substitution_error : Note<
2840  "%select{and|because}0 '%1' would be invalid: %2">;
2841def note_type_requirement_unknown_substitution_error : Note<
2842  "%select{and|because}0 '%1' would be invalid">;
2843def note_nested_requirement_substitution_error : Note<
2844  "%select{and|because}0 '%1' would be invalid: %2">;
2845def note_nested_requirement_unknown_substitution_error : Note<
2846  "%select{and|because}0 '%1' would be invalid">;
2847def note_ambiguous_atomic_constraints : Note<
2848  "similar constraint expressions not considered equivalent; constraint "
2849  "expressions cannot be considered equivalent unless they originate from the "
2850  "same concept">;
2851def note_ambiguous_atomic_constraints_similar_expression : Note<
2852  "similar constraint expression here">;
2853def err_unsupported_placeholder_constraint : Error<
2854  "constrained placeholder types other than simple 'auto' on non-type template "
2855  "parameters not supported yet">;
2856
2857def err_template_different_requires_clause : Error<
2858  "requires clause differs in template redeclaration">;
2859def err_template_different_type_constraint : Error<
2860  "type constraint differs in template redeclaration">;
2861def err_template_template_parameter_not_at_least_as_constrained : Error<
2862  "template template argument %0 is more constrained than template template "
2863  "parameter %1">;
2864
2865def err_type_constraint_non_type_concept : Error<
2866  "concept named in type constraint is not a type concept">;
2867def err_type_constraint_missing_arguments : Error<
2868  "%0 requires more than 1 template argument; provide the remaining arguments "
2869  "explicitly to use it here">;
2870def err_placeholder_constraints_not_satisfied : Error<
2871  "deduced type %0 does not satisfy %1">;
2872
2873// C++11 char16_t/char32_t
2874def warn_cxx98_compat_unicode_type : Warning<
2875  "'%0' type specifier is incompatible with C++98">,
2876  InGroup<CXX98Compat>, DefaultIgnore;
2877def warn_cxx17_compat_unicode_type : Warning<
2878  "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2879  InGroup<CXXPre20Compat>, DefaultIgnore;
2880
2881// __make_integer_seq
2882def err_integer_sequence_negative_length : Error<
2883  "integer sequences must have non-negative sequence length">;
2884def err_integer_sequence_integral_element_type : Error<
2885  "integer sequences must have integral element type">;
2886
2887// __type_pack_element
2888def err_type_pack_element_out_of_bounds : Error<
2889  "a parameter pack may not be accessed at an out of bounds index">;
2890
2891// Objective-C++
2892def err_objc_decls_may_only_appear_in_global_scope : Error<
2893  "Objective-C declarations may only appear in global scope">;
2894def warn_auto_var_is_id : Warning<
2895  "'auto' deduced as 'id' in declaration of %0">,
2896  InGroup<DiagGroup<"auto-var-id">>;
2897
2898// Attributes
2899def warn_nomerge_attribute_ignored_in_stmt: Warning<
2900  "%0 attribute is ignored because there exists no call expression inside the "
2901  "statement">,
2902  InGroup<IgnoredAttributes>;
2903
2904def err_musttail_needs_trivial_args : Error<
2905  "tail call requires that the return value, all parameters, and any "
2906  "temporaries created by the expression are trivially destructible">;
2907def err_musttail_needs_call : Error<
2908  "%0 attribute requires that the return value is the result of a function call"
2909  >;
2910def err_musttail_needs_prototype : Error<
2911  "%0 attribute requires that both caller and callee functions have a "
2912  "prototype">;
2913def note_musttail_fix_non_prototype : Note<
2914  "add 'void' to the parameter list to turn an old-style K&R function "
2915  "declaration into a prototype">;
2916def err_musttail_structors_forbidden : Error<"cannot perform a tail call "
2917  "%select{from|to}0 a %select{constructor|destructor}1">;
2918def note_musttail_structors_forbidden : Note<"target "
2919  "%select{constructor|destructor}0 is declared here">;
2920def err_musttail_forbidden_from_this_context : Error<
2921  "%0 attribute cannot be used from "
2922  "%select{a block|an Objective-C function|this context}1">;
2923def err_musttail_member_mismatch : Error<
2924  "%select{non-member|static member|non-static member}0 "
2925  "function cannot perform a tail call to "
2926  "%select{non-member|static member|non-static member|pointer-to-member}1 "
2927  "function%select{| %3}2">;
2928def note_musttail_callee_defined_here : Note<"%0 declared here">;
2929def note_tail_call_required : Note<"tail call required by %0 attribute here">;
2930def err_musttail_mismatch : Error<
2931  "cannot perform a tail call to function%select{| %1}0 because its signature "
2932  "is incompatible with the calling function">;
2933def note_musttail_mismatch : Note<
2934    "target function "
2935    "%select{is a member of different class%diff{ (expected $ but has $)|}1,2"
2936    "|has different number of parameters (expected %1 but has %2)"
2937    "|has type mismatch at %ordinal3 parameter"
2938    "%diff{ (expected $ but has $)|}1,2"
2939    "|has different return type%diff{ ($ expected but has $)|}1,2}0">;
2940def err_musttail_callconv_mismatch : Error<
2941  "cannot perform a tail call to function%select{| %1}0 because it uses an "
2942  "incompatible calling convention">;
2943def note_musttail_callconv_mismatch : Note<
2944  "target function has calling convention %1 (expected %0)">;
2945def err_musttail_scope : Error<
2946  "cannot perform a tail call from this return statement">;
2947def err_musttail_no_variadic : Error<
2948  "%0 attribute may not be used with variadic functions">;
2949
2950def err_nsobject_attribute : Error<
2951  "'NSObject' attribute is for pointer types only">;
2952def err_attributes_are_not_compatible : Error<
2953  "%0 and %1 attributes are not compatible">;
2954def err_attribute_invalid_argument : Error<
2955  "%select{a reference type|an array type|a non-vector or "
2956  "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
2957def err_attribute_wrong_number_arguments : Error<
2958  "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
2959  ":requires exactly %1 arguments}1">;
2960def err_attribute_wrong_number_arguments_for : Error <
2961  "%0 attribute references function %1, which %plural{0:takes no arguments|1:takes one argument|"
2962  ":takes exactly %2 arguments}2">;
2963def err_attribute_bounds_for_function : Error<
2964  "%0 attribute references parameter %1, but the function %2 has only %3 parameters">;
2965def err_attribute_no_member_function : Error<
2966  "%0 attribute cannot be applied to non-static member functions">;
2967def err_attribute_parameter_types : Error<
2968  "%0 attribute parameter types do not match: parameter %1 of function %2 has type %3, "
2969  "but parameter %4 of function %5 has type %6">;
2970
2971def err_attribute_too_many_arguments : Error<
2972  "%0 attribute takes no more than %1 argument%s1">;
2973def err_attribute_too_few_arguments : Error<
2974  "%0 attribute takes at least %1 argument%s1">;
2975def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
2976def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
2977def err_attribute_bad_neon_vector_size : Error<
2978  "Neon vector size must be 64 or 128 bits">;
2979def err_attribute_invalid_sve_type : Error<
2980  "%0 attribute applied to non-SVE type %1">;
2981def err_attribute_bad_sve_vector_size : Error<
2982  "invalid SVE vector size '%0', must match value set by "
2983  "'-msve-vector-bits' ('%1')">;
2984def err_attribute_arm_feature_sve_bits_unsupported : Error<
2985  "%0 is only supported when '-msve-vector-bits=<bits>' is specified with a "
2986  "value of 128, 256, 512, 1024 or 2048.">;
2987def err_attribute_requires_positive_integer : Error<
2988  "%0 attribute requires a %select{positive|non-negative}1 "
2989  "integral compile time constant expression">;
2990def err_attribute_requires_opencl_version : Error<
2991  "attribute %0 is supported in the OpenCL version %1%select{| onwards}2">;
2992def err_invalid_branch_protection_spec : Error<
2993  "invalid or misplaced branch protection specification '%0'">;
2994def warn_unsupported_branch_protection_spec : Warning<
2995  "unsupported branch protection specification '%0'">, InGroup<BranchProtection>;
2996
2997def warn_unsupported_target_attribute
2998    : Warning<"%select{unsupported|duplicate|unknown}0%select{| architecture|"
2999              " tune CPU}1 '%2' in the '%select{target|target_clones}3' "
3000              "attribute string; '%select{target|target_clones}3' "
3001              "attribute ignored">,
3002      InGroup<IgnoredAttributes>;
3003def err_attribute_unsupported
3004    : Error<"%0 attribute is not supported on targets missing %1;"
3005            " specify an appropriate -march= or -mcpu=">;
3006// The err_*_attribute_argument_not_int are separate because they're used by
3007// VerifyIntegerConstantExpression.
3008def err_aligned_attribute_argument_not_int : Error<
3009  "'aligned' attribute requires integer constant">;
3010def err_align_value_attribute_argument_not_int : Error<
3011  "'align_value' attribute requires integer constant">;
3012def err_alignas_attribute_wrong_decl_type : Error<
3013  "%0 attribute cannot be applied to a %select{function parameter|"
3014  "variable with 'register' storage class|'catch' variable|bit-field}1">;
3015def err_alignas_missing_on_definition : Error<
3016  "%0 must be specified on definition if it is specified on any declaration">;
3017def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
3018def err_alignas_mismatch : Error<
3019  "redeclaration has different alignment requirement (%1 vs %0)">;
3020def err_alignas_underaligned : Error<
3021  "requested alignment is less than minimum alignment of %1 for type %0">;
3022def warn_aligned_attr_underaligned : Warning<err_alignas_underaligned.Text>,
3023  InGroup<IgnoredAttributes>;
3024def err_attribute_sizeless_type : Error<
3025  "%0 attribute cannot be applied to sizeless type %1">;
3026def err_attribute_argument_n_type : Error<
3027  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
3028  "constant|a string|an identifier|a constant expression|a builtin function}2">;
3029def err_attribute_argument_type : Error<
3030  "%0 attribute requires %select{int or bool|an integer "
3031  "constant|a string|an identifier}1">;
3032def err_attribute_argument_out_of_range : Error<
3033  "%0 attribute requires integer constant between %1 and %2 inclusive">;
3034def err_init_priority_object_attr : Error<
3035  "can only use 'init_priority' attribute on file-scope definitions "
3036  "of objects of class type">;
3037def err_attribute_argument_out_of_bounds : Error<
3038  "%0 attribute parameter %1 is out of bounds">;
3039def err_attribute_only_once_per_parameter : Error<
3040  "%0 attribute can only be applied once per parameter">;
3041def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
3042def note_previous_uuid : Note<"previous uuid specified here">;
3043def warn_attribute_pointers_only : Warning<
3044  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
3045  InGroup<IgnoredAttributes>;
3046def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
3047def err_attribute_integers_only : Error<
3048  "%0 attribute argument may only refer to a function parameter of integer "
3049  "type">;
3050def warn_attribute_return_pointers_only : Warning<
3051  "%0 attribute only applies to return values that are pointers">,
3052  InGroup<IgnoredAttributes>;
3053def warn_attribute_return_pointers_refs_only : Warning<
3054  "%0 attribute only applies to return values that are pointers or references">,
3055  InGroup<IgnoredAttributes>;
3056def warn_attribute_pointer_or_reference_only : Warning<
3057  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
3058  InGroup<IgnoredAttributes>;
3059def err_attribute_no_member_pointers : Error<
3060  "%0 attribute cannot be used with pointers to members">;
3061def err_attribute_invalid_implicit_this_argument : Error<
3062  "%0 attribute is invalid for the implicit this argument">;
3063def err_ownership_type : Error<
3064  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
3065def err_ownership_returns_index_mismatch : Error<
3066  "'ownership_returns' attribute index does not match; here it is %0">;
3067def note_ownership_returns_index_mismatch : Note<
3068  "declared with index %0 here">;
3069def err_format_strftime_third_parameter : Error<
3070  "strftime format attribute requires 3rd parameter to be 0">;
3071def err_format_attribute_requires_variadic : Error<
3072  "format attribute requires variadic function">;
3073def err_format_attribute_not : Error<"format argument not %0">;
3074def err_format_attribute_result_not : Error<"function does not return %0">;
3075def err_format_attribute_implicit_this_format_string : Error<
3076  "format attribute cannot specify the implicit this argument as the format "
3077  "string">;
3078def err_callback_attribute_no_callee : Error<
3079  "'callback' attribute specifies no callback callee">;
3080def err_callback_attribute_invalid_callee : Error<
3081  "'callback' attribute specifies invalid callback callee">;
3082def err_callback_attribute_multiple : Error<
3083  "multiple 'callback' attributes specified">;
3084def err_callback_attribute_argument_unknown : Error<
3085  "'callback' attribute argument %0 is not a known function parameter">;
3086def err_callback_callee_no_function_type : Error<
3087  "'callback' attribute callee does not have function type">;
3088def err_callback_callee_is_variadic : Error<
3089  "'callback' attribute callee may not be variadic">;
3090def err_callback_implicit_this_not_available : Error<
3091  "'callback' argument at position %0 references unavailable implicit 'this'">;
3092def err_init_method_bad_return_type : Error<
3093  "init methods must return an object pointer type, not %0">;
3094def err_attribute_invalid_size : Error<
3095  "vector size not an integral multiple of component size">;
3096def err_attribute_zero_size : Error<"zero %0 size">;
3097def err_attribute_size_too_large : Error<"%0 size too large">;
3098def err_typecheck_sve_ambiguous : Error<
3099  "cannot combine fixed-length and sizeless SVE vectors in expression, result is ambiguous (%0 and %1)">;
3100def err_typecheck_sve_gnu_ambiguous : Error<
3101  "cannot combine GNU and SVE vectors in expression, result is ambiguous (%0 and %1)">;
3102def err_typecheck_vector_not_convertable_implict_truncation : Error<
3103   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
3104   " %2 as implicit conversion would cause truncation">;
3105def err_typecheck_vector_not_convertable : Error<
3106  "cannot convert between vector values of different size (%0 and %1)">;
3107def err_typecheck_vector_not_convertable_non_scalar : Error<
3108  "cannot convert between vector and non-scalar values (%0 and %1)">;
3109def err_typecheck_vector_lengths_not_equal : Error<
3110  "vector operands do not have the same number of elements (%0 and %1)">;
3111def warn_typecheck_vector_element_sizes_not_equal : Warning<
3112  "vector operands do not have the same elements sizes (%0 and %1)">,
3113  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
3114def err_ext_vector_component_exceeds_length : Error<
3115  "vector component access exceeds type %0">;
3116def err_ext_vector_component_name_illegal : Error<
3117  "illegal vector component name '%0'">;
3118def err_attribute_address_space_negative : Error<
3119  "address space is negative">;
3120def err_attribute_address_space_too_high : Error<
3121  "address space is larger than the maximum supported (%0)">;
3122def err_attribute_address_multiple_qualifiers : Error<
3123  "multiple address spaces specified for type">;
3124def warn_attribute_address_multiple_identical_qualifiers : Warning<
3125  "multiple identical address spaces specified for type">,
3126  InGroup<DuplicateDeclSpecifier>;
3127def err_attribute_not_clinkage : Error<
3128  "function type with %0 attribute must have C linkage">;
3129def err_function_decl_cmse_ns_call : Error<
3130  "functions may not be declared with 'cmse_nonsecure_call' attribute">;
3131def err_attribute_address_function_type : Error<
3132  "function type may not be qualified with an address space">;
3133def err_as_qualified_auto_decl : Error<
3134  "automatic variable qualified with an%select{| invalid}0 address space">;
3135def err_arg_with_address_space : Error<
3136  "parameter may not be qualified with an address space">;
3137def err_field_with_address_space : Error<
3138  "field may not be qualified with an address space">;
3139def err_compound_literal_with_address_space : Error<
3140  "compound literal in function scope may not be qualified with an address space">;
3141def err_address_space_mismatch_templ_inst : Error<
3142  "conflicting address space qualifiers are provided between types %0 and %1">;
3143def err_attr_objc_ownership_redundant : Error<
3144  "the type %0 is already explicitly ownership-qualified">;
3145def err_invalid_nsnumber_type : Error<
3146  "%0 is not a valid literal type for NSNumber">;
3147def err_objc_illegal_boxed_expression_type : Error<
3148  "illegal type %0 used in a boxed expression">;
3149def err_objc_non_trivially_copyable_boxed_expression_type : Error<
3150  "non-trivially copyable type %0 cannot be used in a boxed expression">;
3151def err_objc_incomplete_boxed_expression_type : Error<
3152  "incomplete type %0 used in a boxed expression">;
3153def err_undeclared_objc_literal_class : Error<
3154  "definition of class %0 must be available to use Objective-C "
3155  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
3156  "string literals}1">;
3157def err_undeclared_boxing_method : Error<
3158  "declaration of %0 is missing in %1 class">;
3159def err_objc_literal_method_sig : Error<
3160  "literal construction method %0 has incompatible signature">;
3161def note_objc_literal_method_param : Note<
3162  "%select{first|second|third}0 parameter has unexpected type %1 "
3163  "(should be %2)">;
3164def note_objc_literal_method_return : Note<
3165  "method returns unexpected type %0 (should be an object type)">;
3166def err_invalid_collection_element : Error<
3167  "collection element of type %0 is not an Objective-C object">;
3168def err_box_literal_collection : Error<
3169  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3170  "in a collection">;
3171def warn_objc_literal_comparison : Warning<
3172  "direct comparison of %select{an array literal|a dictionary literal|"
3173  "a numeric literal|a boxed expression|}0 has undefined behavior">,
3174  InGroup<ObjCLiteralComparison>;
3175def err_missing_atsign_prefix : Error<
3176  "%select{string|numeric}0 literal must be prefixed by '@'">;
3177def warn_objc_string_literal_comparison : Warning<
3178  "direct comparison of a string literal has undefined behavior">,
3179  InGroup<ObjCStringComparison>;
3180def warn_concatenated_literal_array_init : Warning<
3181  "suspicious concatenation of string literals in an array initialization; "
3182  "did you mean to separate the elements with a comma?">,
3183  InGroup<StringConcatation>, DefaultIgnore;
3184def warn_concatenated_nsarray_literal : Warning<
3185  "concatenated NSString literal for an NSArray expression - "
3186  "possibly missing a comma">,
3187  InGroup<ObjCStringConcatenation>;
3188def note_objc_literal_comparison_isequal : Note<
3189  "use 'isEqual:' instead">;
3190def warn_objc_collection_literal_element : Warning<
3191  "object of type %0 is not compatible with "
3192  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3193  InGroup<ObjCLiteralConversion>;
3194def warn_nsdictionary_duplicate_key : Warning<
3195  "duplicate key in dictionary literal">,
3196  InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3197def note_nsdictionary_duplicate_key_here : Note<
3198  "previous equal key is here">;
3199def err_swift_param_attr_not_swiftcall : Error<
3200  "'%0' parameter can only be used with swiftcall%select{ or swiftasynccall|}1 "
3201  "calling convention%select{|s}1">;
3202def err_swift_indirect_result_not_first : Error<
3203  "'swift_indirect_result' parameters must be first parameters of function">;
3204def err_swift_error_result_not_after_swift_context : Error<
3205  "'swift_error_result' parameter must follow 'swift_context' parameter">;
3206def err_swift_abi_parameter_wrong_type : Error<
3207  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3208  "type here is %2">;
3209
3210def err_attribute_argument_invalid : Error<
3211  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3212  "min must not be greater than max}1">;
3213def err_attribute_argument_is_zero : Error<
3214  "%0 attribute must be greater than 0">;
3215def warn_attribute_argument_n_negative : Warning<
3216  "%0 attribute parameter %1 is negative and will be ignored">,
3217  InGroup<CudaCompat>;
3218def err_property_function_in_objc_container : Error<
3219  "use of Objective-C property in function nested in Objective-C "
3220  "container not supported, move function outside its container">;
3221
3222let CategoryName = "Cocoa API Issue" in {
3223def warn_objc_redundant_literal_use : Warning<
3224  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3225}
3226
3227def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3228  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3229
3230def err_aix_attr_unsupported_tls_model : Error<"TLS model '%0' is not yet supported on AIX">;
3231
3232def err_tls_var_aligned_over_maximum : Error<
3233  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3234  "alignment (%2) for a thread-local variable on this target">;
3235
3236def err_only_annotate_after_access_spec : Error<
3237  "access specifier can only have annotation attributes">;
3238
3239def err_attribute_section_invalid_for_target : Error<
3240  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3241def err_pragma_section_invalid_for_target : Error<
3242  "argument to #pragma section is not valid for this target: %0">;
3243def warn_attribute_section_drectve : Warning<
3244  "#pragma %0(\".drectve\") has undefined behavior, "
3245  "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3246def warn_mismatched_section : Warning<
3247  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3248def warn_attribute_section_on_redeclaration : Warning<
3249  "section attribute is specified on redeclared variable">, InGroup<Section>;
3250def err_mismatched_code_seg_base : Error<
3251  "derived class must specify the same code segment as its base classes">;
3252def err_mismatched_code_seg_override : Error<
3253  "overriding virtual function must specify the same code segment as its overridden function">;
3254def err_conflicting_codeseg_attribute : Error<
3255  "conflicting code segment specifiers">;
3256def warn_duplicate_codeseg_attribute : Warning<
3257  "duplicate code segment specifiers">, InGroup<Section>;
3258
3259def err_anonymous_property: Error<
3260  "anonymous property is not supported">;
3261def err_property_is_variably_modified : Error<
3262  "property %0 has a variably modified type">;
3263def err_no_accessor_for_property : Error<
3264  "no %select{getter|setter}0 defined for property %1">;
3265def err_cannot_find_suitable_accessor : Error<
3266  "cannot find suitable %select{getter|setter}0 for property %1">;
3267
3268def warn_alloca : Warning<
3269  "use of function %0 is discouraged; there is no way to check for failure but "
3270  "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3271  InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3272
3273def warn_alloca_align_alignof : Warning<
3274  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3275  InGroup<DiagGroup<"alloca-with-align-alignof">>;
3276
3277def err_alignment_too_small : Error<
3278  "requested alignment must be %0 or greater">;
3279def err_alignment_too_big : Error<
3280  "requested alignment must be %0 or smaller">;
3281def err_alignment_not_power_of_two : Error<
3282  "requested alignment is not a power of 2">;
3283def warn_alignment_not_power_of_two : Warning<
3284  err_alignment_not_power_of_two.Text>,
3285  InGroup<DiagGroup<"non-power-of-two-alignment">>;
3286def err_alignment_dependent_typedef_name : Error<
3287  "requested alignment is dependent but declaration is not dependent">;
3288
3289def warn_alignment_builtin_useless : Warning<
3290  "%select{aligning a value|the result of checking whether a value is aligned}0"
3291  " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3292def err_attribute_aligned_too_great : Error<
3293  "requested alignment must be %0 bytes or smaller">;
3294def warn_assume_aligned_too_great
3295    : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3296              "alignment assumed">,
3297      InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3298def warn_not_xl_compatible
3299    : Warning<"requesting an alignment of 16 bytes or greater for struct"
3300              " members is not binary compatible with IBM XL C/C++ for AIX"
3301              " 16.1.0 and older">,
3302      InGroup<AIXCompat>;
3303def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3304  "%q0 redeclared without %1 attribute: previous %1 ignored">,
3305  InGroup<MicrosoftInconsistentDllImport>;
3306def warn_redeclaration_without_import_attribute : Warning<
3307  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3308  InGroup<MicrosoftInconsistentDllImport>;
3309def warn_dllimport_dropped_from_inline_function : Warning<
3310  "%q0 redeclared inline; %1 attribute ignored">,
3311  InGroup<IgnoredAttributes>;
3312def warn_attribute_ignored : Warning<"%0 attribute ignored">,
3313  InGroup<IgnoredAttributes>;
3314def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3315  " exception specification; attribute ignored">,
3316  InGroup<IgnoredAttributes>;
3317def warn_attribute_ignored_on_non_definition :
3318  Warning<"%0 attribute ignored on a non-definition declaration">,
3319  InGroup<IgnoredAttributes>;
3320def warn_attribute_ignored_on_inline :
3321  Warning<"%0 attribute ignored on inline function">,
3322  InGroup<IgnoredAttributes>;
3323def warn_nocf_check_attribute_ignored :
3324  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3325  InGroup<IgnoredAttributes>;
3326def warn_attribute_after_definition_ignored : Warning<
3327  "attribute %0 after definition is ignored">,
3328   InGroup<IgnoredAttributes>;
3329def warn_attributes_likelihood_ifstmt_conflict
3330    : Warning<"conflicting attributes %0 are ignored">,
3331      InGroup<IgnoredAttributes>;
3332def warn_cxx11_gnu_attribute_on_type : Warning<
3333  "attribute %0 ignored, because it cannot be applied to a type">,
3334  InGroup<IgnoredAttributes>;
3335def warn_unhandled_ms_attribute_ignored : Warning<
3336  "__declspec attribute %0 is not supported">,
3337  InGroup<IgnoredAttributes>;
3338def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3339  "attribute %0 has no effect when annotating an infinite loop">,
3340   InGroup<IgnoredAttributes>;
3341def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3342  "annotating the infinite loop here">;
3343def warn_attribute_has_no_effect_on_compile_time_if : Warning<
3344  "attribute %0 has no effect when annotating an 'if %select{constexpr|consteval}1' statement">,
3345   InGroup<IgnoredAttributes>;
3346def note_attribute_has_no_effect_on_compile_time_if_here : Note<
3347  "annotating the 'if %select{constexpr|consteval}0' statement here">;
3348def err_decl_attribute_invalid_on_stmt : Error<
3349  "%0 attribute cannot be applied to a statement">;
3350def err_stmt_attribute_invalid_on_decl : Error<
3351  "%0 attribute cannot be applied to a declaration">;
3352def warn_declspec_attribute_ignored : Warning<
3353  "attribute %0 is ignored, place it after "
3354  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
3355  "type declaration">, InGroup<IgnoredAttributes>;
3356def warn_attribute_precede_definition : Warning<
3357  "attribute declaration must precede definition">,
3358  InGroup<IgnoredAttributes>;
3359def warn_attribute_void_function_method : Warning<
3360  "attribute %0 cannot be applied to "
3361  "%select{functions|Objective-C method}1 without return value">,
3362  InGroup<IgnoredAttributes>;
3363def warn_attribute_weak_on_field : Warning<
3364  "__weak attribute cannot be specified on a field declaration">,
3365  InGroup<IgnoredAttributes>;
3366def warn_gc_attribute_weak_on_local : Warning<
3367  "Objective-C GC does not allow weak variables on the stack">,
3368  InGroup<IgnoredAttributes>;
3369def warn_nsobject_attribute : Warning<
3370  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3371  InGroup<NSobjectAttribute>;
3372def warn_independentclass_attribute : Warning<
3373  "'objc_independent_class' attribute may be put on a typedef only; "
3374  "attribute is ignored">,
3375  InGroup<IndependentClassAttribute>;
3376def warn_ptr_independentclass_attribute : Warning<
3377  "'objc_independent_class' attribute may be put on Objective-C object "
3378  "pointer type only; attribute is ignored">,
3379  InGroup<IndependentClassAttribute>;
3380def warn_attribute_weak_on_local : Warning<
3381  "__weak attribute cannot be specified on an automatic variable when ARC "
3382  "is not enabled">,
3383  InGroup<IgnoredAttributes>;
3384def warn_weak_identifier_undeclared : Warning<
3385  "weak identifier %0 never declared">;
3386def warn_attribute_cmse_entry_static : Warning<
3387  "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3388  InGroup<IgnoredAttributes>;
3389def warn_cmse_nonsecure_union : Warning<
3390  "passing union across security boundary via %select{parameter %1|return value}0 "
3391  "may leak information">,
3392  InGroup<DiagGroup<"cmse-union-leak">>;
3393def err_attribute_weak_static : Error<
3394  "weak declaration cannot have internal linkage">;
3395def err_attribute_selectany_non_extern_data : Error<
3396  "'selectany' can only be applied to data items with external linkage">;
3397def err_declspec_thread_on_thread_variable : Error<
3398  "'__declspec(thread)' applied to variable that already has a "
3399  "thread-local storage specifier">;
3400def err_attribute_dll_not_extern : Error<
3401  "%q0 must have external linkage when declared %q1">;
3402def err_attribute_dll_thread_local : Error<
3403  "%q0 cannot be thread local when declared %q1">;
3404def err_attribute_dll_lambda : Error<
3405  "lambda cannot be declared %0">;
3406def warn_attribute_invalid_on_definition : Warning<
3407  "'%0' attribute cannot be specified on a definition">,
3408  InGroup<IgnoredAttributes>;
3409def err_attribute_dll_redeclaration : Error<
3410  "redeclaration of %q0 cannot add %q1 attribute">;
3411def warn_attribute_dll_redeclaration : Warning<
3412  "redeclaration of %q0 should not add %q1 attribute">,
3413  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3414def err_attribute_dllimport_function_definition : Error<
3415  "dllimport cannot be applied to non-inline function definition">;
3416def err_attribute_dll_deleted : Error<
3417  "attribute %q0 cannot be applied to a deleted function">;
3418def err_attribute_dllimport_data_definition : Error<
3419  "definition of dllimport data">;
3420def err_attribute_dllimport_static_field_definition : Error<
3421  "definition of dllimport static field not allowed">;
3422def warn_attribute_dllimport_static_field_definition : Warning<
3423  "definition of dllimport static field">,
3424  InGroup<DiagGroup<"dllimport-static-field-def">>;
3425def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3426  "explicit instantiation declaration should not be 'dllexport'">,
3427  InGroup<DllexportExplicitInstantiationDecl>;
3428def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3429  "'dllexport' attribute ignored on explicit instantiation definition">,
3430  InGroup<IgnoredAttributes>;
3431def warn_invalid_initializer_from_system_header : Warning<
3432  "invalid constructor from class in system header, should not be explicit">,
3433  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3434def note_used_in_initialization_here : Note<"used in initialization here">;
3435def err_attribute_dll_member_of_dll_class : Error<
3436  "attribute %q0 cannot be applied to member of %q1 class">;
3437def warn_attribute_dll_instantiated_base_class : Warning<
3438  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3439  "base class template without dll attribute is not supported">,
3440  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3441def err_attribute_dll_ambiguous_default_ctor : Error<
3442  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3443def err_attribute_weakref_not_static : Error<
3444  "weakref declaration must have internal linkage">;
3445def err_attribute_weakref_not_global_context : Error<
3446  "weakref declaration of %0 must be in a global context">;
3447def err_attribute_weakref_without_alias : Error<
3448  "weakref declaration of %0 must also have an alias attribute">;
3449def err_alias_not_supported_on_darwin : Error <
3450  "aliases are not supported on darwin">;
3451def warn_attribute_wrong_decl_type_str : Warning<
3452  "%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
3453def err_attribute_wrong_decl_type_str : Error<
3454  warn_attribute_wrong_decl_type_str.Text>;
3455def warn_attribute_wrong_decl_type : Warning<
3456  "%0 attribute only applies to %select{"
3457  "functions"
3458  "|unions"
3459  "|variables and functions"
3460  "|functions and methods"
3461  "|functions, methods and blocks"
3462  "|functions, methods, and parameters"
3463  "|variables"
3464  "|variables and fields"
3465  "|variables, data members and tag types"
3466  "|types and namespaces"
3467  "|variables, functions and classes"
3468  "|kernel functions"
3469  "|non-K&R-style functions}1">,
3470  InGroup<IgnoredAttributes>;
3471def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
3472def warn_type_attribute_wrong_type : Warning<
3473  "'%0' only applies to %select{function|pointer|"
3474  "Objective-C object or block pointer}1 types; type here is %2">,
3475  InGroup<IgnoredAttributes>;
3476def warn_incomplete_encoded_type : Warning<
3477  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3478  InGroup<DiagGroup<"encode-type">>;
3479def warn_gnu_inline_attribute_requires_inline : Warning<
3480  "'gnu_inline' attribute requires function to be marked 'inline',"
3481  " attribute ignored">,
3482  InGroup<IgnoredAttributes>;
3483def warn_gnu_inline_cplusplus_without_extern : Warning<
3484  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3485  " available, this changed in Clang 10">,
3486  InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3487def err_attribute_vecreturn_only_vector_member : Error<
3488  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3489def err_attribute_vecreturn_only_pod_record : Error<
3490  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3491def err_cconv_change : Error<
3492  "function declared '%0' here was previously declared "
3493  "%select{'%2'|without calling convention}1">;
3494def warn_cconv_unsupported : Warning<
3495  "%0 calling convention is not supported %select{"
3496  // Use CallingConventionIgnoredReason Enum to specify these.
3497  "for this target"
3498  "|on variadic function"
3499  "|on constructor/destructor"
3500  "|on builtin function"
3501  "}1">,
3502  InGroup<IgnoredAttributes>;
3503def error_cconv_unsupported : Error<warn_cconv_unsupported.Text>;
3504def err_cconv_knr : Error<
3505  "function with no prototype cannot use the %0 calling convention">;
3506def warn_cconv_knr : Warning<
3507  err_cconv_knr.Text>,
3508  InGroup<DiagGroup<"missing-prototype-for-cc">>;
3509def err_cconv_varargs : Error<
3510  "variadic function cannot use %0 calling convention">;
3511def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3512  "attribute was previously declared "
3513  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3514def err_function_attribute_mismatch : Error<
3515  "function declared with %0 attribute "
3516  "was previously declared without the %0 attribute">;
3517def err_objc_precise_lifetime_bad_type : Error<
3518  "objc_precise_lifetime only applies to retainable types; type here is %0">;
3519def warn_objc_precise_lifetime_meaningless : Error<
3520  "objc_precise_lifetime is not meaningful for "
3521  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3522def err_invalid_pcs : Error<"invalid PCS type">;
3523def warn_attribute_not_on_decl : Warning<
3524  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3525def err_base_specifier_attribute : Error<
3526  "%0 attribute cannot be applied to a base specifier">;
3527def err_invalid_attribute_on_virtual_function : Error<
3528  "%0 attribute cannot be applied to virtual functions">;
3529def warn_declspec_allocator_nonpointer : Warning<
3530  "ignoring __declspec(allocator) because the function return type %0 is not "
3531  "a pointer or reference type">, InGroup<IgnoredAttributes>;
3532def err_cconv_incomplete_param_type : Error<
3533  "parameter %0 must have a complete type to use function %1 with the %2 "
3534  "calling convention">;
3535def err_attribute_output_parameter : Error<
3536  "attribute only applies to output parameters">;
3537
3538def ext_cannot_use_trivial_abi : ExtWarn<
3539  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3540def note_cannot_use_trivial_abi_reason : Note<
3541  "'trivial_abi' is disallowed on %0 because %select{"
3542  "its copy constructors and move constructors are all deleted|"
3543  "it is polymorphic|"
3544  "it has a base of a non-trivial class type|it has a virtual base|"
3545  "it has a __weak field|it has a field of a non-trivial class type}1">;
3546
3547// Availability attribute
3548def warn_availability_unknown_platform : Warning<
3549  "unknown platform %0 in availability macro">, InGroup<Availability>;
3550def warn_availability_version_ordering : Warning<
3551  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3552  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3553  "attribute ignored">, InGroup<Availability>;
3554def warn_mismatched_availability: Warning<
3555  "availability does not match previous declaration">, InGroup<Availability>;
3556def warn_mismatched_availability_override : Warning<
3557  "%select{|overriding }4method %select{introduced after|"
3558  "deprecated before|obsoleted before}0 "
3559  "%select{the protocol method it implements|overridden method}4 "
3560  "on %1 (%2 vs. %3)">, InGroup<Availability>;
3561def warn_mismatched_availability_override_unavail : Warning<
3562  "%select{|overriding }1method cannot be unavailable on %0 when "
3563  "%select{the protocol method it implements|its overridden method}1 is "
3564  "available">,
3565  InGroup<Availability>;
3566def warn_availability_on_static_initializer : Warning<
3567  "ignoring availability attribute %select{on '+load' method|"
3568  "with constructor attribute|with destructor attribute}0">,
3569  InGroup<Availability>;
3570def note_overridden_method : Note<
3571  "overridden method is here">;
3572def warn_availability_swift_unavailable_deprecated_only : Warning<
3573  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3574  InGroup<Availability>;
3575def note_protocol_method : Note<
3576  "protocol method is here">;
3577def warn_availability_fuchsia_unavailable_minor : Warning<
3578  "Fuchsia API Level prohibits specifying a minor or sub-minor version">,
3579  InGroup<Availability>;
3580
3581def warn_unguarded_availability :
3582  Warning<"%0 is only available on %1 %2 or newer">,
3583  InGroup<UnguardedAvailability>, DefaultIgnore;
3584def warn_unguarded_availability_new :
3585  Warning<warn_unguarded_availability.Text>,
3586  InGroup<UnguardedAvailabilityNew>;
3587def note_decl_unguarded_availability_silence : Note<
3588  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3589def note_unguarded_available_silence : Note<
3590  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3591  " this warning">;
3592def warn_at_available_unchecked_use : Warning<
3593  "%select{@available|__builtin_available}0 does not guard availability here; "
3594  "use if (%select{@available|__builtin_available}0) instead">,
3595  InGroup<DiagGroup<"unsupported-availability-guard">>;
3596
3597def warn_missing_sdksettings_for_availability_checking : Warning<
3598  "%0 availability is ignored without a valid 'SDKSettings.json' in the SDK">,
3599  InGroup<DiagGroup<"ignored-availability-without-sdk-settings">>;
3600
3601// Thread Safety Attributes
3602def warn_thread_attribute_ignored : Warning<
3603  "ignoring %0 attribute because its argument is invalid">,
3604  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3605def warn_thread_attribute_not_on_non_static_member : Warning<
3606  "%0 attribute without capability arguments can only be applied to non-static "
3607  "methods of a class">,
3608  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3609def warn_thread_attribute_not_on_capability_member : Warning<
3610  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3611  "annotated with 'capability' or 'scoped_lockable' attribute">,
3612  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3613def warn_thread_attribute_argument_not_lockable : Warning<
3614  "%0 attribute requires arguments whose type is annotated "
3615  "with 'capability' attribute; type here is %1">,
3616  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3617def warn_thread_attribute_decl_not_lockable : Warning<
3618  "%0 attribute can only be applied in a context annotated "
3619  "with 'capability' attribute">,
3620  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3621def warn_thread_attribute_decl_not_pointer : Warning<
3622  "%0 only applies to pointer types; type here is %1">,
3623  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3624def err_attribute_argument_out_of_bounds_extra_info : Error<
3625  "%0 attribute parameter %1 is out of bounds: "
3626  "%plural{0:no parameters to index into|"
3627  "1:can only be 1, since there is one parameter|"
3628  ":must be between 1 and %2}2">;
3629
3630// Thread Safety Analysis
3631def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3632  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3633def warn_unlock_kind_mismatch : Warning<
3634  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3635  "%select{shared|exclusive}3 access">,
3636  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3637def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3638  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3639def warn_no_unlock : Warning<
3640  "%0 '%1' is still held at the end of function">,
3641  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3642def warn_expecting_locked : Warning<
3643  "expecting %0 '%1' to be held at the end of function">,
3644  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3645// FIXME: improve the error message about locks not in scope
3646def warn_lock_some_predecessors : Warning<
3647  "%0 '%1' is not held on every path through here">,
3648  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3649def warn_expecting_lock_held_on_loop : Warning<
3650  "expecting %0 '%1' to be held at start of each loop">,
3651  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3652def note_locked_here : Note<"%0 acquired here">;
3653def note_unlocked_here : Note<"%0 released here">;
3654def warn_lock_exclusive_and_shared : Warning<
3655  "%0 '%1' is acquired exclusively and shared in the same scope">,
3656  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3657def note_lock_exclusive_and_shared : Note<
3658  "the other acquisition of %0 '%1' is here">;
3659def warn_variable_requires_any_lock : Warning<
3660  "%select{reading|writing}1 variable %0 requires holding "
3661  "%select{any mutex|any mutex exclusively}1">,
3662  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3663def warn_var_deref_requires_any_lock : Warning<
3664  "%select{reading|writing}1 the value pointed to by %0 requires holding "
3665  "%select{any mutex|any mutex exclusively}1">,
3666  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3667def warn_fun_excludes_mutex : Warning<
3668  "cannot call function '%1' while %0 '%2' is held">,
3669  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3670def warn_cannot_resolve_lock : Warning<
3671  "cannot resolve lock expression">,
3672  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3673def warn_acquired_before : Warning<
3674  "%0 '%1' must be acquired before '%2'">,
3675  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3676def warn_acquired_before_after_cycle : Warning<
3677  "Cycle in acquired_before/after dependencies, starting with '%0'">,
3678  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3679
3680
3681// Thread safety warnings negative capabilities
3682def warn_acquire_requires_negative_cap : Warning<
3683  "acquiring %0 '%1' requires negative capability '%2'">,
3684  InGroup<ThreadSafetyNegative>, DefaultIgnore;
3685def warn_fun_requires_negative_cap : Warning<
3686  "calling function %0 requires negative capability '%1'">,
3687  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3688
3689// Thread safety warnings on pass by reference
3690def warn_guarded_pass_by_reference : Warning<
3691  "passing variable %1 by reference requires holding %0 "
3692  "%select{'%2'|'%2' exclusively}3">,
3693  InGroup<ThreadSafetyReference>, DefaultIgnore;
3694def warn_pt_guarded_pass_by_reference : Warning<
3695  "passing the value that %1 points to by reference requires holding %0 "
3696  "%select{'%2'|'%2' exclusively}3">,
3697  InGroup<ThreadSafetyReference>, DefaultIgnore;
3698
3699// Imprecise thread safety warnings
3700def warn_variable_requires_lock : Warning<
3701  "%select{reading|writing}3 variable %1 requires holding %0 "
3702  "%select{'%2'|'%2' exclusively}3">,
3703  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3704def warn_var_deref_requires_lock : Warning<
3705  "%select{reading|writing}3 the value pointed to by %1 requires "
3706  "holding %0 %select{'%2'|'%2' exclusively}3">,
3707  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3708def warn_fun_requires_lock : Warning<
3709  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3710  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3711
3712// Precise thread safety warnings
3713def warn_variable_requires_lock_precise :
3714  Warning<warn_variable_requires_lock.Text>,
3715  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3716def warn_var_deref_requires_lock_precise :
3717  Warning<warn_var_deref_requires_lock.Text>,
3718  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3719def warn_fun_requires_lock_precise :
3720  Warning<warn_fun_requires_lock.Text>,
3721  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3722def note_found_mutex_near_match : Note<"found near match '%0'">;
3723
3724// Verbose thread safety warnings
3725def warn_thread_safety_verbose : Warning<"thread safety verbose warning">,
3726  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3727def note_thread_warning_in_fun : Note<"thread warning in function %0">;
3728def note_guarded_by_declared_here : Note<"guarded_by declared here">;
3729
3730// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3731def warn_thread_safety_beta : Warning<"thread safety beta warning">,
3732  InGroup<ThreadSafetyBeta>, DefaultIgnore;
3733
3734// Consumed warnings
3735def warn_use_in_invalid_state : Warning<
3736  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3737  "state">, InGroup<Consumed>, DefaultIgnore;
3738def warn_use_of_temp_in_invalid_state : Warning<
3739  "invalid invocation of method '%0' on a temporary object while it is in the "
3740  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3741def warn_attr_on_unconsumable_class : Warning<
3742  "consumed analysis attribute is attached to member of class %0 which isn't "
3743  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3744def warn_return_typestate_for_unconsumable_type : Warning<
3745  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3746  DefaultIgnore;
3747def warn_return_typestate_mismatch : Warning<
3748  "return value not in expected state; expected '%0', observed '%1'">,
3749  InGroup<Consumed>, DefaultIgnore;
3750def warn_loop_state_mismatch : Warning<
3751  "state of variable '%0' must match at the entry and exit of loop">,
3752  InGroup<Consumed>, DefaultIgnore;
3753def warn_param_return_typestate_mismatch : Warning<
3754  "parameter '%0' not in expected state when the function returns: expected "
3755  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3756def warn_param_typestate_mismatch : Warning<
3757  "argument not in expected state; expected '%0', observed '%1'">,
3758  InGroup<Consumed>, DefaultIgnore;
3759
3760// no_sanitize attribute
3761def warn_unknown_sanitizer_ignored : Warning<
3762  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3763
3764def warn_impcast_vector_scalar : Warning<
3765  "implicit conversion turns vector to scalar: %0 to %1">,
3766  InGroup<Conversion>, DefaultIgnore;
3767def warn_impcast_complex_scalar : Warning<
3768  "implicit conversion discards imaginary component: %0 to %1">,
3769  InGroup<Conversion>, DefaultIgnore;
3770def err_impcast_complex_scalar : Error<
3771  "implicit conversion from %0 to %1 is not permitted in C++">;
3772def warn_impcast_float_precision : Warning<
3773  "implicit conversion loses floating-point precision: %0 to %1">,
3774  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3775def warn_impcast_float_result_precision : Warning<
3776  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3777  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3778def warn_impcast_double_promotion : Warning<
3779  "implicit conversion increases floating-point precision: %0 to %1">,
3780  InGroup<DoublePromotion>, DefaultIgnore;
3781def warn_impcast_integer_sign : Warning<
3782  "implicit conversion changes signedness: %0 to %1">,
3783  InGroup<SignConversion>, DefaultIgnore;
3784def warn_impcast_integer_sign_conditional : Warning<
3785  "operand of ? changes signedness: %0 to %1">,
3786  InGroup<SignConversion>, DefaultIgnore;
3787def warn_impcast_integer_precision : Warning<
3788  "implicit conversion loses integer precision: %0 to %1">,
3789  InGroup<ImplicitIntConversion>, DefaultIgnore;
3790def warn_impcast_high_order_zero_bits : Warning<
3791  "higher order bits are zeroes after implicit conversion">,
3792  InGroup<ImplicitIntConversion>, DefaultIgnore;
3793def warn_impcast_nonnegative_result : Warning<
3794  "the resulting value is always non-negative after implicit conversion">,
3795  InGroup<SignConversion>, DefaultIgnore;
3796def warn_impcast_integer_64_32 : Warning<
3797  "implicit conversion loses integer precision: %0 to %1">,
3798  InGroup<Shorten64To32>, DefaultIgnore;
3799def warn_impcast_integer_precision_constant : Warning<
3800  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3801  InGroup<ConstantConversion>;
3802def warn_impcast_bitfield_precision_constant : Warning<
3803  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3804  InGroup<BitFieldConstantConversion>;
3805def warn_impcast_constant_value_to_objc_bool : Warning<
3806  "implicit conversion from constant value %0 to 'BOOL'; "
3807  "the only well defined values for 'BOOL' are YES and NO">,
3808  InGroup<ObjCBoolConstantConversion>;
3809
3810def warn_impcast_fixed_point_range : Warning<
3811  "implicit conversion from %0 cannot fit within the range of values for %1">,
3812  InGroup<ImplicitFixedPointConversion>;
3813
3814def warn_impcast_literal_float_to_integer : Warning<
3815  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3816  InGroup<LiteralConversion>;
3817def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3818  "implicit conversion of out of range value from %0 to %1 is undefined">,
3819  InGroup<LiteralConversion>;
3820def warn_impcast_float_integer : Warning<
3821  "implicit conversion turns floating-point number into integer: %0 to %1">,
3822  InGroup<FloatConversion>, DefaultIgnore;
3823def warn_impcast_float_to_objc_signed_char_bool : Warning<
3824  "implicit conversion from floating-point type %0 to 'BOOL'">,
3825  InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
3826def warn_impcast_int_to_objc_signed_char_bool : Warning<
3827  "implicit conversion from integral type %0 to 'BOOL'">,
3828  InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
3829
3830// Implicit int -> float conversion precision loss warnings.
3831def warn_impcast_integer_float_precision : Warning<
3832  "implicit conversion from %0 to %1 may lose precision">,
3833  InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
3834def warn_impcast_integer_float_precision_constant : Warning<
3835  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3836  InGroup<ImplicitConstIntFloatConversion>;
3837
3838def warn_impcast_float_to_integer : Warning<
3839  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3840  InGroup<FloatOverflowConversion>, DefaultIgnore;
3841def warn_impcast_float_to_integer_out_of_range : Warning<
3842  "implicit conversion of out of range value from %0 to %1 is undefined">,
3843  InGroup<FloatOverflowConversion>, DefaultIgnore;
3844def warn_impcast_float_to_integer_zero : Warning<
3845  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3846  InGroup<FloatZeroConversion>, DefaultIgnore;
3847
3848def warn_impcast_string_literal_to_bool : Warning<
3849  "implicit conversion turns string literal into bool: %0 to %1">,
3850  InGroup<StringConversion>, DefaultIgnore;
3851def warn_impcast_different_enum_types : Warning<
3852  "implicit conversion from enumeration type %0 to different enumeration type "
3853  "%1">, InGroup<EnumConversion>;
3854def warn_impcast_bool_to_null_pointer : Warning<
3855    "initialization of pointer of type %0 to null from a constant boolean "
3856    "expression">, InGroup<BoolConversion>;
3857def warn_non_literal_null_pointer : Warning<
3858    "expression which evaluates to zero treated as a null pointer constant of "
3859    "type %0">, InGroup<NonLiteralNullConversion>;
3860def warn_pointer_compare : Warning<
3861    "comparing a pointer to a null character constant; did you mean "
3862    "to compare to %select{NULL|(void *)0}0?">,
3863    InGroup<DiagGroup<"pointer-compare">>;
3864def warn_impcast_null_pointer_to_integer : Warning<
3865    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
3866    InGroup<NullConversion>;
3867def warn_impcast_floating_point_to_bool : Warning<
3868    "implicit conversion turns floating-point number into bool: %0 to %1">,
3869    InGroup<ImplicitConversionFloatingPointToBool>;
3870def ext_ms_impcast_fn_obj : ExtWarn<
3871  "implicit conversion between pointer-to-function and pointer-to-object is a "
3872  "Microsoft extension">, InGroup<MicrosoftCast>;
3873
3874def warn_impcast_pointer_to_bool : Warning<
3875    "address of%select{| function| array}0 '%1' will always evaluate to "
3876    "'true'">,
3877    InGroup<PointerBoolConversion>;
3878def warn_cast_nonnull_to_bool : Warning<
3879    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
3880    "'true' on first encounter">,
3881    InGroup<PointerBoolConversion>;
3882def warn_this_bool_conversion : Warning<
3883  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
3884  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
3885def warn_address_of_reference_bool_conversion : Warning<
3886  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3887  "code; pointer may be assumed to always convert to true">,
3888  InGroup<UndefinedBoolConversion>;
3889
3890def warn_xor_used_as_pow : Warning<
3891  "result of '%0' is %1; did you mean exponentiation?">,
3892  InGroup<XorUsedAsPow>;
3893def warn_xor_used_as_pow_base_extra : Warning<
3894  "result of '%0' is %1; did you mean '%2' (%3)?">,
3895  InGroup<XorUsedAsPow>;
3896def warn_xor_used_as_pow_base : Warning<
3897  "result of '%0' is %1; did you mean '%2'?">,
3898  InGroup<XorUsedAsPow>;
3899def note_xor_used_as_pow_silence : Note<
3900  "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
3901
3902def warn_null_pointer_compare : Warning<
3903    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
3904    "equal to a null pointer is always %select{true|false}2">,
3905    InGroup<TautologicalPointerCompare>;
3906def warn_nonnull_expr_compare : Warning<
3907    "comparison of nonnull %select{function call|parameter}0 '%1' "
3908    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
3909    "encounter">,
3910    InGroup<TautologicalPointerCompare>;
3911def warn_this_null_compare : Warning<
3912  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
3913  "assumed to always evaluate to %select{true|false}0">,
3914  InGroup<TautologicalUndefinedCompare>;
3915def warn_address_of_reference_null_compare : Warning<
3916  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3917  "code; comparison may be assumed to always evaluate to "
3918  "%select{true|false}0">,
3919  InGroup<TautologicalUndefinedCompare>;
3920def note_reference_is_return_value : Note<"%0 returns a reference">;
3921
3922def note_pointer_declared_here : Note<
3923  "pointer %0 declared here">;
3924def warn_division_sizeof_ptr : Warning<
3925  "'%0' will return the size of the pointer, not the array itself">,
3926  InGroup<DiagGroup<"sizeof-pointer-div">>;
3927def warn_division_sizeof_array : Warning<
3928  "expression does not compute the number of elements in this array; element "
3929  "type is %0, not %1">,
3930  InGroup<DiagGroup<"sizeof-array-div">>;
3931
3932def note_function_warning_silence : Note<
3933    "prefix with the address-of operator to silence this warning">;
3934def note_function_to_function_call : Note<
3935    "suffix with parentheses to turn this into a function call">;
3936def warn_impcast_objective_c_literal_to_bool : Warning<
3937    "implicit boolean conversion of Objective-C object literal always "
3938    "evaluates to true">,
3939    InGroup<ObjCLiteralConversion>;
3940
3941def warn_cast_align : Warning<
3942  "cast from %0 to %1 increases required alignment from %2 to %3">,
3943  InGroup<CastAlign>, DefaultIgnore;
3944def warn_old_style_cast : Warning<
3945  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore,
3946  SuppressInSystemMacro;
3947
3948// Separate between casts to void* and non-void* pointers.
3949// Some APIs use (abuse) void* for something like a user context,
3950// and often that value is an integer even if it isn't a pointer itself.
3951// Having a separate warning flag allows users to control the warning
3952// for their workflow.
3953def warn_int_to_pointer_cast : Warning<
3954  "cast to %1 from smaller integer type %0">,
3955  InGroup<IntToPointerCast>;
3956def warn_int_to_void_pointer_cast : Warning<
3957  "cast to %1 from smaller integer type %0">,
3958  InGroup<IntToVoidPointerCast>;
3959def warn_pointer_to_int_cast : Warning<
3960  "cast to smaller integer type %1 from %0">,
3961  InGroup<PointerToIntCast>;
3962def warn_pointer_to_enum_cast : Warning<
3963  warn_pointer_to_int_cast.Text>,
3964  InGroup<PointerToEnumCast>;
3965def warn_void_pointer_to_int_cast : Warning<
3966  "cast to smaller integer type %1 from %0">,
3967  InGroup<VoidPointerToIntCast>;
3968def warn_void_pointer_to_enum_cast : Warning<
3969  warn_void_pointer_to_int_cast.Text>,
3970  InGroup<VoidPointerToEnumCast>;
3971
3972def warn_attribute_ignored_for_field_of_type : Warning<
3973  "%0 attribute ignored for field of type %1">,
3974  InGroup<IgnoredAttributes>;
3975def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
3976  "enums in the Microsoft ABI are signed integers by default; consider giving "
3977  "the enum %0 an unsigned underlying type to make this code portable">,
3978  InGroup<SignedEnumBitfield>, DefaultIgnore;
3979def warn_attribute_packed_for_bitfield : Warning<
3980  "'packed' attribute was ignored on bit-fields with single-byte alignment "
3981  "in older versions of GCC and Clang">,
3982  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
3983def warn_transparent_union_attribute_field_size_align : Warning<
3984  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
3985  "%select{alignment|size}0 of the first field in transparent union; "
3986  "transparent_union attribute ignored">,
3987  InGroup<IgnoredAttributes>;
3988def note_transparent_union_first_field_size_align : Note<
3989  "%select{alignment|size}0 of first field is %1 bits">;
3990def warn_transparent_union_attribute_not_definition : Warning<
3991  "transparent_union attribute can only be applied to a union definition; "
3992  "attribute ignored">,
3993  InGroup<IgnoredAttributes>;
3994def warn_transparent_union_attribute_floating : Warning<
3995  "first field of a transparent union cannot have %select{floating point|"
3996  "vector}0 type %1; transparent_union attribute ignored">,
3997  InGroup<IgnoredAttributes>;
3998def warn_transparent_union_attribute_zero_fields : Warning<
3999  "transparent union definition must contain at least one field; "
4000  "transparent_union attribute ignored">,
4001  InGroup<IgnoredAttributes>;
4002def warn_attribute_type_not_supported : Warning<
4003  "%0 attribute argument not supported: %1">,
4004  InGroup<IgnoredAttributes>;
4005def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
4006  InGroup<IgnoredAttributes>;
4007def warn_attribute_protected_visibility :
4008  Warning<"target does not support 'protected' visibility; using 'default'">,
4009  InGroup<DiagGroup<"unsupported-visibility">>;
4010def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
4011def note_previous_attribute : Note<"previous attribute is here">;
4012def note_conflicting_attribute : Note<"conflicting attribute is here">;
4013def note_attribute : Note<"attribute is here">;
4014def err_mismatched_ms_inheritance : Error<
4015  "inheritance model does not match %select{definition|previous declaration}0">;
4016def warn_ignored_ms_inheritance : Warning<
4017  "inheritance model ignored on %select{primary template|partial specialization}0">,
4018  InGroup<IgnoredAttributes>;
4019def note_previous_ms_inheritance : Note<
4020  "previous inheritance model specified here">;
4021def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
4022def err_mode_not_primitive : Error<
4023  "mode attribute only supported for integer and floating-point types">;
4024def err_mode_wrong_type : Error<
4025  "type of machine mode does not match type of base type">;
4026def warn_vector_mode_deprecated : Warning<
4027  "specifying vector types with the 'mode' attribute is deprecated; "
4028  "use the 'vector_size' attribute instead">,
4029  InGroup<DeprecatedAttributes>;
4030def err_complex_mode_vector_type : Error<
4031  "type of machine mode does not support base vector types">;
4032def err_enum_mode_vector_type : Error<
4033  "mode %0 is not supported for enumeration types">;
4034def warn_attribute_nonnull_no_pointers : Warning<
4035  "'nonnull' attribute applied to function with no pointer arguments">,
4036  InGroup<IgnoredAttributes>;
4037def warn_attribute_nonnull_parm_no_args : Warning<
4038  "'nonnull' attribute when used on parameters takes no arguments">,
4039  InGroup<IgnoredAttributes>;
4040def note_declared_nonnull : Note<
4041  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
4042def warn_attribute_sentinel_named_arguments : Warning<
4043  "'sentinel' attribute requires named arguments">,
4044  InGroup<IgnoredAttributes>;
4045def warn_attribute_sentinel_not_variadic : Warning<
4046  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
4047  InGroup<IgnoredAttributes>;
4048def warn_deprecated_ignored_on_using : Warning<
4049  "%0 currently has no effect on a using declaration">,
4050  InGroup<IgnoredAttributes>;
4051def err_attribute_sentinel_less_than_zero : Error<
4052  "'sentinel' parameter 1 less than zero">;
4053def err_attribute_sentinel_not_zero_or_one : Error<
4054  "'sentinel' parameter 2 not 0 or 1">;
4055def warn_cleanup_ext : Warning<
4056  "GCC does not allow the 'cleanup' attribute argument to be anything other "
4057  "than a simple identifier">,
4058  InGroup<GccCompat>;
4059def err_attribute_cleanup_arg_not_function : Error<
4060  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
4061def err_attribute_cleanup_func_must_take_one_arg : Error<
4062  "'cleanup' function %0 must take 1 parameter">;
4063def err_attribute_cleanup_func_arg_incompatible_type : Error<
4064  "'cleanup' function %0 parameter has "
4065  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
4066def err_attribute_regparm_wrong_platform : Error<
4067  "'regparm' is not valid on this platform">;
4068def err_attribute_regparm_invalid_number : Error<
4069  "'regparm' parameter must be between 0 and %0 inclusive">;
4070def err_attribute_not_supported_in_lang : Error<
4071  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
4072def err_attribute_not_supported_on_arch
4073    : Error<"%0 attribute is not supported on '%1'">;
4074def warn_gcc_ignores_type_attr : Warning<
4075  "GCC does not allow the %0 attribute to be written on a type">,
4076  InGroup<GccCompat>;
4077
4078// Clang-Specific Attributes
4079def warn_attribute_iboutlet : Warning<
4080  "%0 attribute can only be applied to instance variables or properties">,
4081  InGroup<IgnoredAttributes>;
4082def err_iboutletcollection_type : Error<
4083  "invalid type %0 as argument of iboutletcollection attribute">;
4084def err_iboutletcollection_builtintype : Error<
4085  "type argument of iboutletcollection attribute cannot be a builtin type">;
4086def warn_iboutlet_object_type : Warning<
4087  "%select{instance variable|property}2 with %0 attribute must "
4088  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
4089def warn_iboutletcollection_property_assign : Warning<
4090  "IBOutletCollection properties should be copy/strong and not assign">,
4091  InGroup<ObjCInvalidIBOutletProperty>;
4092
4093def err_attribute_overloadable_mismatch : Error<
4094  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
4095def note_attribute_overloadable_prev_overload : Note<
4096  "previous %select{unmarked |}0overload of function is here">;
4097def err_attribute_overloadable_no_prototype : Error<
4098  "'overloadable' function %0 must have a prototype">;
4099def err_attribute_overloadable_multiple_unmarked_overloads : Error<
4100  "at most one overload for a given name may lack the 'overloadable' "
4101  "attribute">;
4102def warn_attribute_no_builtin_invalid_builtin_name : Warning<
4103  "'%0' is not a valid builtin name for %1">,
4104  InGroup<DiagGroup<"invalid-no-builtin-names">>;
4105def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
4106  "empty %0 cannot be composed with named ones">;
4107def err_attribute_no_builtin_on_non_definition : Error<
4108  "%0 attribute is permitted on definitions only">;
4109def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
4110  "%0 attribute has no effect on defaulted or deleted functions">;
4111def warn_ns_attribute_wrong_return_type : Warning<
4112  "%0 attribute only applies to %select{functions|methods|properties}1 that "
4113  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
4114  InGroup<IgnoredAttributes>;
4115def err_ns_attribute_wrong_parameter_type : Error<
4116  "%0 attribute only applies to "
4117  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
4118def warn_ns_attribute_wrong_parameter_type : Warning<
4119  "%0 attribute only applies to "
4120  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
4121  InGroup<IgnoredAttributes>;
4122def warn_objc_requires_super_protocol : Warning<
4123  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
4124  InGroup<DiagGroup<"requires-super-attribute">>;
4125def note_protocol_decl : Note<
4126  "protocol is declared here">;
4127def note_protocol_decl_undefined : Note<
4128  "protocol %0 has no definition">;
4129def err_attribute_preferred_name_arg_invalid : Error<
4130  "argument %0 to 'preferred_name' attribute is not a typedef for "
4131  "a specialization of %1">;
4132def err_attribute_builtin_alias : Error<
4133  "%0 attribute can only be applied to a ARM or RISC-V builtin">;
4134
4135// called-once attribute diagnostics.
4136def err_called_once_attribute_wrong_type : Error<
4137  "'called_once' attribute only applies to function-like parameters">;
4138
4139def warn_completion_handler_never_called : Warning<
4140  "%select{|captured }1completion handler is never called">,
4141  InGroup<CompletionHandler>, DefaultIgnore;
4142def warn_called_once_never_called : Warning<
4143  "%select{|captured }1%0 parameter marked 'called_once' is never called">,
4144  InGroup<CalledOnceParameter>;
4145
4146def warn_completion_handler_never_called_when : Warning<
4147  "completion handler is never %select{used|called}1 when "
4148  "%select{taking true branch|taking false branch|"
4149  "handling this case|none of the cases applies|"
4150  "entering the loop|skipping the loop|taking one of the branches}2">,
4151  InGroup<CompletionHandler>, DefaultIgnore;
4152def warn_called_once_never_called_when : Warning<
4153  "%0 parameter marked 'called_once' is never %select{used|called}1 when "
4154  "%select{taking true branch|taking false branch|"
4155  "handling this case|none of the cases applies|"
4156  "entering the loop|skipping the loop|taking one of the branches}2">,
4157  InGroup<CalledOnceParameter>;
4158
4159def warn_completion_handler_called_twice : Warning<
4160  "completion handler is called twice">,
4161  InGroup<CompletionHandler>, DefaultIgnore;
4162def warn_called_once_gets_called_twice : Warning<
4163  "%0 parameter marked 'called_once' is called twice">,
4164  InGroup<CalledOnceParameter>;
4165def note_called_once_gets_called_twice : Note<
4166  "previous call is here%select{; set to nil to indicate "
4167  "it cannot be called afterwards|}0">;
4168
4169// objc_designated_initializer attribute diagnostics.
4170def warn_objc_designated_init_missing_super_call : Warning<
4171  "designated initializer missing a 'super' call to a designated initializer of the super class">,
4172  InGroup<ObjCDesignatedInit>;
4173def note_objc_designated_init_marked_here : Note<
4174  "method marked as designated initializer of the class here">;
4175def warn_objc_designated_init_non_super_designated_init_call : Warning<
4176  "designated initializer should only invoke a designated initializer on 'super'">,
4177  InGroup<ObjCDesignatedInit>;
4178def warn_objc_designated_init_non_designated_init_call : Warning<
4179  "designated initializer invoked a non-designated initializer">,
4180  InGroup<ObjCDesignatedInit>;
4181def warn_objc_secondary_init_super_init_call : Warning<
4182  "convenience initializer should not invoke an initializer on 'super'">,
4183  InGroup<ObjCDesignatedInit>;
4184def warn_objc_secondary_init_missing_init_call : Warning<
4185  "convenience initializer missing a 'self' call to another initializer">,
4186  InGroup<ObjCDesignatedInit>;
4187def warn_objc_implementation_missing_designated_init_override : Warning<
4188  "method override for the designated initializer of the superclass %objcinstance0 not found">,
4189  InGroup<ObjCDesignatedInit>;
4190def err_designated_init_attr_non_init : Error<
4191  "'objc_designated_initializer' attribute only applies to init methods "
4192  "of interface or class extension declarations">;
4193
4194// objc_bridge attribute diagnostics.
4195def err_objc_attr_not_id : Error<
4196  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
4197def err_objc_attr_typedef_not_id : Error<
4198  "parameter of %0 attribute must be 'id' when used on a typedef">;
4199def err_objc_attr_typedef_not_void_pointer : Error<
4200  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
4201def err_objc_cf_bridged_not_interface : Error<
4202  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
4203def err_objc_ns_bridged_invalid_cfobject : Error<
4204  "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
4205def warn_objc_invalid_bridge : Warning<
4206  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
4207def warn_objc_invalid_bridge_to_cf : Warning<
4208  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
4209
4210// objc_bridge_related attribute diagnostics.
4211def err_objc_bridged_related_invalid_class : Error<
4212  "could not find Objective-C class %0 to convert %1 to %2">;
4213def err_objc_bridged_related_invalid_class_name : Error<
4214  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
4215def err_objc_bridged_related_known_method : Error<
4216 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
4217 "method for this conversion">;
4218
4219def err_objc_attr_protocol_requires_definition : Error<
4220  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
4221
4222// Swift attributes.
4223def warn_attr_swift_name_function
4224  : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
4225    InGroup<SwiftNameAttribute>;
4226def warn_attr_swift_name_invalid_identifier
4227  : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4228    InGroup<SwiftNameAttribute>;
4229def warn_attr_swift_name_decl_kind
4230  : Warning<"%0 attribute cannot be applied to this declaration">,
4231    InGroup<SwiftNameAttribute>;
4232def warn_attr_swift_name_subscript_invalid_parameter
4233  : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4234        "have at least one parameter|"
4235        "have a 'self:' parameter}1">,
4236    InGroup<SwiftNameAttribute>;
4237def warn_attr_swift_name_missing_parameters
4238  : Warning<"%0 attribute is missing parameter label clause">,
4239    InGroup<SwiftNameAttribute>;
4240def warn_attr_swift_name_setter_parameters
4241  : Warning<"%0 attribute for setter must have one parameter for new value">,
4242    InGroup<SwiftNameAttribute>;
4243def warn_attr_swift_name_multiple_selfs
4244  : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4245    InGroup<SwiftNameAttribute>;
4246def warn_attr_swift_name_getter_parameters
4247  : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4248    InGroup<SwiftNameAttribute>;
4249def warn_attr_swift_name_subscript_setter_no_newValue
4250  : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4251    InGroup<SwiftNameAttribute>;
4252def warn_attr_swift_name_subscript_setter_multiple_newValues
4253  : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4254    InGroup<SwiftNameAttribute>;
4255def warn_attr_swift_name_subscript_getter_newValue
4256  : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4257    InGroup<SwiftNameAttribute>;
4258def warn_attr_swift_name_num_params
4259  : Warning<"too %select{few|many}0 parameters in the signature specified by "
4260            "the %1 attribute (expected %2; got %3)">,
4261    InGroup<SwiftNameAttribute>;
4262def warn_attr_swift_name_decl_missing_params
4263  : Warning<"%0 attribute cannot be applied to a %select{function|method}1 "
4264            "with no parameters">,
4265    InGroup<SwiftNameAttribute>;
4266
4267def err_attr_swift_error_no_error_parameter : Error<
4268  "%0 attribute can only be applied to a %select{function|method}1 with an "
4269  "error parameter">;
4270def err_attr_swift_error_return_type : Error<
4271  "%0 attribute with '%1' convention can only be applied to a "
4272  "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4273
4274def err_swift_async_no_access : Error<
4275  "first argument to 'swift_async' must be either 'none', 'swift_private', or "
4276  "'not_swift_private'">;
4277def err_swift_async_bad_block_type : Error<
4278  "'swift_async' completion handler parameter must have block type returning"
4279  " 'void', type here is %0">;
4280
4281def err_swift_async_error_without_swift_async : Error<
4282  "%0 attribute must be applied to a %select{function|method}1 annotated "
4283  "with non-'none' attribute 'swift_async'">;
4284def err_swift_async_error_no_error_parameter : Error<
4285  "%0 attribute with 'nonnull_error' convention can only be applied to a "
4286  "%select{function|method}1 with a completion handler with an error "
4287  "parameter">;
4288def err_swift_async_error_non_integral : Error<
4289  "%0 attribute with '%1' convention must have an integral-typed parameter "
4290  "in completion handler at index %2, type here is %3">;
4291
4292def warn_ignored_objc_externally_retained : Warning<
4293  "'objc_externally_retained' can only be applied to local variables "
4294  "%select{of retainable type|with strong ownership}0">,
4295  InGroup<IgnoredAttributes>;
4296
4297// Function Parameter Semantic Analysis.
4298def err_param_with_void_type : Error<"argument may not have 'void' type">;
4299def err_void_only_param : Error<
4300  "'void' must be the first and only parameter if specified">;
4301def err_void_param_qualified : Error<
4302  "'void' as parameter must not have type qualifiers">;
4303def err_ident_list_in_fn_declaration : Error<
4304  "a parameter list without types is only allowed in a function definition">;
4305def ext_param_not_declared : Extension<
4306  "parameter %0 was not declared, defaulting to type 'int'">;
4307def err_param_default_argument : Error<
4308  "C does not support default arguments">;
4309def err_param_default_argument_redefinition : Error<
4310  "redefinition of default argument">;
4311def ext_param_default_argument_redefinition : ExtWarn<
4312  err_param_default_argument_redefinition.Text>,
4313  InGroup<MicrosoftDefaultArgRedefinition>;
4314def err_param_default_argument_missing : Error<
4315  "missing default argument on parameter">;
4316def err_param_default_argument_missing_name : Error<
4317  "missing default argument on parameter %0">;
4318def err_param_default_argument_references_param : Error<
4319  "default argument references parameter %0">;
4320def err_param_default_argument_references_local : Error<
4321  "default argument references local variable %0 of enclosing function">;
4322def err_param_default_argument_references_this : Error<
4323  "default argument references 'this'">;
4324def err_param_default_argument_nonfunc : Error<
4325  "default arguments can only be specified for parameters in a function "
4326  "declaration">;
4327def err_param_default_argument_template_redecl : Error<
4328  "default arguments cannot be added to a function template that has already "
4329  "been declared">;
4330def err_param_default_argument_member_template_redecl : Error<
4331  "default arguments cannot be added to an out-of-line definition of a member "
4332  "of a %select{class template|class template partial specialization|nested "
4333  "class in a template}0">;
4334def err_param_default_argument_on_parameter_pack : Error<
4335  "parameter pack cannot have a default argument">;
4336def err_uninitialized_member_for_assign : Error<
4337  "cannot define the implicit copy assignment operator for %0, because "
4338  "non-static %select{reference|const}1 member %2 cannot use copy "
4339  "assignment operator">;
4340def err_uninitialized_member_in_ctor : Error<
4341  "%select{constructor for %1|"
4342  "implicit default constructor for %1|"
4343  "cannot use constructor inherited from %1:}0 must explicitly "
4344  "initialize the %select{reference|const}2 member %3">;
4345def err_default_arg_makes_ctor_special : Error<
4346  "addition of default argument on redeclaration makes this constructor a "
4347  "%select{default|copy|move}0 constructor">;
4348
4349def err_use_of_default_argument_to_function_declared_later : Error<
4350  "use of default argument to function %0 that is declared later in class %1">;
4351def note_default_argument_declared_here : Note<
4352  "default argument declared here">;
4353def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4354def note_recursive_default_argument_used_here : Note<
4355  "default argument used here">;
4356
4357def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4358  "%diff{promoted type $ of K&R function parameter is not compatible with the "
4359  "parameter type $|promoted type of K&R function parameter is not compatible "
4360  "with parameter type}0,1 declared in a previous prototype">,
4361  InGroup<KNRPromotedParameter>;
4362
4363
4364// C++ Overloading Semantic Analysis.
4365def err_ovl_diff_return_type : Error<
4366  "functions that differ only in their return type cannot be overloaded">;
4367def err_ovl_static_nonstatic_member : Error<
4368  "static and non-static member functions with the same parameter types "
4369  "cannot be overloaded">;
4370
4371let Deferrable = 1 in {
4372
4373def err_ovl_no_viable_function_in_call : Error<
4374  "no matching function for call to %0">;
4375def err_ovl_no_viable_member_function_in_call : Error<
4376  "no matching member function for call to %0">;
4377def err_ovl_ambiguous_call : Error<
4378  "call to %0 is ambiguous">;
4379def err_ovl_deleted_call : Error<"call to deleted function %0">;
4380def err_ovl_ambiguous_member_call : Error<
4381  "call to member function %0 is ambiguous">;
4382def err_ovl_deleted_member_call : Error<
4383  "call to deleted member function %0">;
4384def note_ovl_too_many_candidates : Note<
4385    "remaining %0 candidate%s0 omitted; "
4386    "pass -fshow-overloads=all to show them">;
4387
4388def select_ovl_candidate_kind : TextSubstitution<
4389  "%select{function|function|function (with reversed parameter order)|"
4390    "constructor|"
4391    "constructor (the implicit default constructor)|"
4392    "constructor (the implicit copy constructor)|"
4393    "constructor (the implicit move constructor)|"
4394    "function (the implicit copy assignment operator)|"
4395    "function (the implicit move assignment operator)|"
4396    "function (the implicit 'operator==' for this 'operator<=>)'|"
4397    "inherited constructor}0%select{| template| %2}1">;
4398
4399def note_ovl_candidate : Note<
4400    "candidate %sub{select_ovl_candidate_kind}0,1,3"
4401    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4402    "| has different number of parameters (expected %5 but has %6)"
4403    "| has type mismatch at %ordinal5 parameter"
4404    "%diff{ (expected $ but has $)|}6,7"
4405    "| has different return type%diff{ ($ expected but has $)|}5,6"
4406    "| has different qualifiers (expected %5 but found %6)"
4407    "| has different exception specification}4">;
4408
4409def note_ovl_candidate_explicit : Note<
4410    "explicit %select{constructor|conversion function|deduction guide}0 "
4411    "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4412def note_ovl_candidate_inherited_constructor : Note<
4413    "constructor from base class %0 inherited here">;
4414def note_ovl_candidate_inherited_constructor_slice : Note<
4415    "candidate %select{constructor|template}0 ignored: "
4416    "inherited constructor cannot be used to %select{copy|move}1 object">;
4417def note_ovl_candidate_illegal_constructor : Note<
4418    "candidate %select{constructor|template}0 ignored: "
4419    "instantiation %select{takes|would take}0 its own class type by value">;
4420def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4421    "candidate constructor ignored: cannot be used to construct an object "
4422    "in address space %0">;
4423def note_ovl_candidate_bad_deduction : Note<
4424    "candidate template ignored: failed template argument deduction">;
4425def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4426    "couldn't infer template argument %0">;
4427def note_ovl_candidate_incomplete_deduction_pack : Note<
4428    "candidate template ignored: "
4429    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4430    "expanded parameter in deduced argument pack %2">;
4431def note_ovl_candidate_inconsistent_deduction : Note<
4432    "candidate template ignored: deduced %select{conflicting types|"
4433    "conflicting values|conflicting templates|packs of different lengths}0 "
4434    "for parameter %1%diff{ ($ vs. $)|}2,3">;
4435def note_ovl_candidate_inconsistent_deduction_types : Note<
4436    "candidate template ignored: deduced values %diff{"
4437    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4438    "%1 and %3 of conflicting types for parameter %0}2,4">;
4439def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4440    "candidate template ignored: invalid explicitly-specified argument "
4441    "for template parameter %0">;
4442def note_ovl_candidate_unsatisfied_constraints : Note<
4443    "candidate template ignored: constraints not satisfied%0">;
4444def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4445    "candidate template ignored: invalid explicitly-specified argument "
4446    "for %ordinal0 template parameter">;
4447def note_ovl_candidate_instantiation_depth : Note<
4448    "candidate template ignored: substitution exceeded maximum template "
4449    "instantiation depth">;
4450def note_ovl_candidate_underqualified : Note<
4451    "candidate template ignored: cannot deduce a type for %0 that would "
4452    "make %2 equal %1">;
4453def note_ovl_candidate_substitution_failure : Note<
4454    "candidate template ignored: substitution failure%0%1">;
4455def note_ovl_candidate_disabled_by_enable_if : Note<
4456    "candidate template ignored: disabled by %0%1">;
4457def note_ovl_candidate_disabled_by_requirement : Note<
4458    "candidate template ignored: requirement '%0' was not satisfied%1">;
4459def note_ovl_candidate_has_pass_object_size_params: Note<
4460    "candidate address cannot be taken because parameter %0 has "
4461    "pass_object_size attribute">;
4462def err_diagnose_if_succeeded : Error<"%0">;
4463def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4464    ShowInSystemHeader;
4465def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4466    "candidate disabled: %0">;
4467def err_addrof_function_disabled_by_enable_if_attr : Error<
4468    "cannot take address of function %0 because it has one or more "
4469    "non-tautological enable_if conditions">;
4470def err_addrof_function_constraints_not_satisfied : Error<
4471    "cannot take address of function %0 because its constraints are not "
4472    "satisfied">;
4473def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4474    "candidate function made ineligible by enable_if">;
4475def note_ovl_candidate_deduced_mismatch : Note<
4476    "candidate template ignored: deduced type "
4477    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4478    "adjusted type $ of %select{|element of }4argument"
4479    "|of %select{|element of }4%ordinal0 parameter does not match "
4480    "adjusted type of %select{|element of }4argument}1,2%3">;
4481def note_ovl_candidate_non_deduced_mismatch : Note<
4482    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4483// This note is needed because the above note would sometimes print two
4484// different types with the same name.  Remove this note when the above note
4485// can handle that case properly.
4486def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4487    "candidate template ignored: could not match %q0 against %q1">;
4488
4489// Note that we don't treat templates differently for this diagnostic.
4490def note_ovl_candidate_arity : Note<"candidate "
4491    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4492    "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
4493    "%plural{1:was|:were}5 provided">;
4494
4495def note_ovl_candidate_arity_one : Note<"candidate "
4496    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4497    "%select{requires at least|allows at most single|requires single}3 "
4498    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4499
4500def note_ovl_candidate_deleted : Note<
4501    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4502    "%select{explicitly made unavailable|explicitly deleted|"
4503    "implicitly deleted}3">;
4504
4505// Giving the index of the bad argument really clutters this message, and
4506// it's relatively unimportant because 1) it's generally obvious which
4507// argument(s) are of the given object type and 2) the fix is usually
4508// to complete the type, which doesn't involve changes to the call line
4509// anyway.  If people complain, we can change it.
4510def note_ovl_candidate_bad_conv_incomplete : Note<
4511    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4512    "cannot convert argument of incomplete type "
4513    "%diff{$ to $|to parameter type}3,4 for "
4514    "%select{%ordinal6 argument|object argument}5"
4515    "%select{|; dereference the argument with *|"
4516    "; take the address of the argument with &|"
4517    "; remove *|"
4518    "; remove &}7">;
4519def note_ovl_candidate_bad_list_argument : Note<
4520    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4521    "%select{cannot convert initializer list|too few initializers in list"
4522    "|too many initializers in list}7 argument to %4">;
4523def note_ovl_candidate_bad_overload : Note<
4524    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4525    "no overload of %4 matching %3 for %ordinal5 argument">;
4526def note_ovl_candidate_bad_conv : Note<
4527    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4528    "no known conversion "
4529    "%diff{from $ to $|from argument type to parameter type}3,4 for "
4530    "%select{%ordinal6 argument|object argument}5"
4531    "%select{|; dereference the argument with *|"
4532    "; take the address of the argument with &|"
4533    "; remove *|"
4534    "; remove &}7">;
4535def note_ovl_candidate_bad_arc_conv : Note<
4536    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4537    "cannot implicitly convert argument "
4538    "%diff{of type $ to $|type to parameter type}3,4 for "
4539    "%select{%ordinal6 argument|object argument}5 under ARC">;
4540def note_ovl_candidate_bad_value_category : Note<
4541    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4542    "expects an %select{lvalue|rvalue}5 for "
4543    "%select{%ordinal4 argument|object argument}3">;
4544def note_ovl_candidate_bad_addrspace : Note<
4545    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4546    "cannot %select{pass pointer to|bind reference in}5 %3 "
4547    "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4548    "argument">;
4549def note_ovl_candidate_bad_addrspace_this : Note<
4550    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4551    "'this' object is in %3, but method expects object in %4">;
4552def note_ovl_candidate_bad_gc : Note<
4553    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4554    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4555    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4556def note_ovl_candidate_bad_ownership : Note<
4557    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4558    "%select{%ordinal7|'this'}6 argument (%3) has "
4559    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4560    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4561    "__autoreleasing}5 ownership">;
4562def note_ovl_candidate_bad_cvr_this : Note<
4563    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4564    "'this' argument has type %3, but method is not marked "
4565    "%select{const|restrict|const or restrict|volatile|const or volatile|"
4566    "volatile or restrict|const, volatile, or restrict}4">;
4567def note_ovl_candidate_bad_cvr : Note<
4568    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4569    "%ordinal5 argument (%3) would lose "
4570    "%select{const|restrict|const and restrict|volatile|const and volatile|"
4571    "volatile and restrict|const, volatile, and restrict}4 qualifier"
4572    "%select{||s||s|s|s}4">;
4573def note_ovl_candidate_bad_unaligned : Note<
4574    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4575    "%ordinal5 argument (%3) would lose __unaligned qualifier">;
4576def note_ovl_candidate_bad_base_to_derived_conv : Note<
4577    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4578    "cannot %select{convert from|convert from|bind}3 "
4579    "%select{base class pointer|superclass|base class object of type}3 %4 to "
4580    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4581    "%ordinal6 argument">;
4582def note_ovl_candidate_bad_target : Note<
4583    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4584    "call to "
4585    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4586    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4587def note_ovl_candidate_constraints_not_satisfied : Note<
4588    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4589    "not satisfied">;
4590def note_implicit_member_target_infer_collision : Note<
4591    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4592    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4593    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4594
4595def note_ambiguous_type_conversion: Note<
4596    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4597def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4598def err_ovl_no_viable_function_in_init : Error<
4599  "no matching constructor for initialization of %0">;
4600def err_ovl_no_conversion_in_cast : Error<
4601  "cannot convert %1 to %2 without a conversion operator">;
4602def err_ovl_no_viable_conversion_in_cast : Error<
4603  "no matching conversion for %select{|static_cast|reinterpret_cast|"
4604  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4605def err_ovl_ambiguous_conversion_in_cast : Error<
4606  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4607  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4608def err_ovl_deleted_conversion_in_cast : Error<
4609  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4610  "functional-style cast|}0 from %1 to %2 uses deleted function">;
4611def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4612def err_ref_init_ambiguous : Error<
4613  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4614def err_ovl_deleted_init : Error<
4615  "call to deleted constructor of %0">;
4616def err_ovl_deleted_special_init : Error<
4617  "call to implicitly-deleted %select{default constructor|copy constructor|"
4618  "move constructor|copy assignment operator|move assignment operator|"
4619  "destructor|function}0 of %1">;
4620def err_ovl_ambiguous_oper_unary : Error<
4621  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4622def err_ovl_ambiguous_oper_binary : Error<
4623  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4624def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4625  "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4626  "and %2) to be ambiguous despite there being a unique best viable function"
4627  "%select{ with non-reversed arguments|}3">,
4628  InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4629def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4630  "ambiguity is between a regular call to this operator and a call with the "
4631  "argument order reversed">;
4632def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4633  "candidate function with non-reversed arguments">;
4634def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4635  "ambiguous candidate function with reversed arguments">;
4636def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4637def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4638def err_ovl_deleted_oper : Error<
4639  "overload resolution selected deleted operator '%0'">;
4640def err_ovl_deleted_special_oper : Error<
4641  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4642  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4643  "implicitly deleted">;
4644def err_ovl_deleted_comparison : Error<
4645  "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4646def err_ovl_rewrite_equalequal_not_bool : Error<
4647  "return type %0 of selected 'operator==' function for rewritten "
4648  "'%1' comparison is not 'bool'">;
4649def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4650  "ISO C++20 requires return type of selected 'operator==' function for "
4651  "rewritten '%1' comparison to be 'bool', not %0">,
4652  InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4653def err_ovl_no_viable_subscript :
4654    Error<"no viable overloaded operator[] for type %0">;
4655def err_ovl_no_oper :
4656    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4657def err_ovl_unresolvable : Error<
4658  "reference to %select{overloaded|multiversioned}1 function could not be "
4659  "resolved; did you mean to call it%select{| with no arguments}0?">;
4660def err_bound_member_function : Error<
4661  "reference to non-static member function must be called"
4662  "%select{|; did you mean to call it with no arguments?}0">;
4663def note_possible_target_of_call : Note<"possible target for call">;
4664
4665def err_ovl_no_viable_object_call : Error<
4666  "no matching function for call to object of type %0">;
4667def err_ovl_ambiguous_object_call : Error<
4668  "call to object of type %0 is ambiguous">;
4669def err_ovl_deleted_object_call : Error<
4670  "call to deleted function call operator in type %0">;
4671def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4672def err_member_call_without_object : Error<
4673  "call to non-static member function without an object argument">;
4674
4675// C++ Address of Overloaded Function
4676def err_addr_ovl_no_viable : Error<
4677  "address of overloaded function %0 does not match required type %1">;
4678def err_addr_ovl_ambiguous : Error<
4679  "address of overloaded function %0 is ambiguous">;
4680def err_addr_ovl_not_func_ptrref : Error<
4681  "address of overloaded function %0 cannot be converted to type %1">;
4682def err_addr_ovl_no_qualifier : Error<
4683  "cannot form member pointer of type %0 without '&' and class name">;
4684
4685} // let Deferrable
4686
4687// C++11 Literal Operators
4688def err_ovl_no_viable_literal_operator : Error<
4689  "no matching literal operator for call to %0"
4690  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4691  "%select{| or 'const char *'}4"
4692  "%select{|, and no matching literal operator template}5">;
4693
4694// C++ Template Declarations
4695def err_template_param_shadow : Error<
4696  "declaration of %0 shadows template parameter">;
4697def ext_template_param_shadow : ExtWarn<
4698  err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
4699def note_template_param_here : Note<"template parameter is declared here">;
4700def warn_template_export_unsupported : Warning<
4701  "exported templates are unsupported">;
4702def err_template_outside_namespace_or_class_scope : Error<
4703  "templates can only be declared in namespace or class scope">;
4704def err_template_inside_local_class : Error<
4705  "templates cannot be declared inside of a local class">;
4706def err_template_linkage : Error<"templates must have C++ linkage">;
4707def err_template_typedef : Error<"a typedef cannot be a template">;
4708def err_template_unnamed_class : Error<
4709  "cannot declare a class template with no name">;
4710def err_template_param_list_different_arity : Error<
4711  "%select{too few|too many}0 template parameters in template "
4712  "%select{|template parameter }1redeclaration">;
4713def note_template_param_list_different_arity : Note<
4714  "%select{too few|too many}0 template parameters in template template "
4715  "argument">;
4716def note_template_prev_declaration : Note<
4717  "previous template %select{declaration|template parameter}0 is here">;
4718def err_template_param_different_kind : Error<
4719  "template parameter has a different kind in template "
4720  "%select{|template parameter }0redeclaration">;
4721def note_template_param_different_kind : Note<
4722  "template parameter has a different kind in template argument">;
4723
4724def err_invalid_decl_specifier_in_nontype_parm : Error<
4725  "invalid declaration specifier in template non-type parameter">;
4726
4727def err_template_nontype_parm_different_type : Error<
4728  "template non-type parameter has a different type %0 in template "
4729  "%select{|template parameter }1redeclaration">;
4730
4731def note_template_nontype_parm_different_type : Note<
4732  "template non-type parameter has a different type %0 in template argument">;
4733def note_template_nontype_parm_prev_declaration : Note<
4734  "previous non-type template parameter with type %0 is here">;
4735def err_template_nontype_parm_bad_type : Error<
4736  "a non-type template parameter cannot have type %0">;
4737def err_template_nontype_parm_bad_structural_type : Error<
4738  "a non-type template parameter cannot have type %0 before C++20">;
4739def err_template_nontype_parm_incomplete : Error<
4740  "non-type template parameter has incomplete type %0">;
4741def err_template_nontype_parm_not_literal : Error<
4742  "non-type template parameter has non-literal type %0">;
4743def err_template_nontype_parm_rvalue_ref : Error<
4744  "non-type template parameter has rvalue reference type %0">;
4745def err_template_nontype_parm_not_structural : Error<
4746  "type %0 of non-type template parameter is not a structural type">;
4747def note_not_structural_non_public : Note<
4748  "%0 is not a structural type because it has a "
4749  "%select{non-static data member|base class}1 that is not public">;
4750def note_not_structural_mutable_field : Note<
4751  "%0 is not a structural type because it has a mutable "
4752  "non-static data member">;
4753def note_not_structural_rvalue_ref_field : Note<
4754  "%0 is not a structural type because it has a non-static data member "
4755  "of rvalue reference type">;
4756def note_not_structural_subobject : Note<
4757  "%0 is not a structural type because it has a "
4758  "%select{non-static data member|base class}1 of non-structural type %2">;
4759def warn_cxx17_compat_template_nontype_parm_type : Warning<
4760  "non-type template parameter of type %0 is incompatible with "
4761  "C++ standards before C++20">,
4762  DefaultIgnore, InGroup<CXXPre20Compat>;
4763def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
4764  "non-type template parameters declared with %0 are incompatible with C++ "
4765  "standards before C++17">,
4766  DefaultIgnore, InGroup<CXXPre17Compat>;
4767def err_template_param_default_arg_redefinition : Error<
4768  "template parameter redefines default argument">;
4769def note_template_param_prev_default_arg : Note<
4770  "previous default template argument defined here">;
4771def err_template_param_default_arg_missing : Error<
4772  "template parameter missing a default argument">;
4773def ext_template_parameter_default_in_function_template : ExtWarn<
4774  "default template arguments for a function template are a C++11 extension">,
4775  InGroup<CXX11>;
4776def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
4777  "default template arguments for a function template are incompatible with C++98">,
4778  InGroup<CXX98Compat>, DefaultIgnore;
4779def err_template_parameter_default_template_member : Error<
4780  "cannot add a default template argument to the definition of a member of a "
4781  "class template">;
4782def err_template_parameter_default_friend_template : Error<
4783  "default template argument not permitted on a friend template">;
4784def err_template_template_parm_no_parms : Error<
4785  "template template parameter must have its own template parameters">;
4786
4787def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
4788  InGroup<CXX14>;
4789def warn_cxx11_compat_variable_template : Warning<
4790  "variable templates are incompatible with C++ standards before C++14">,
4791  InGroup<CXXPre14Compat>, DefaultIgnore;
4792def err_template_variable_noparams : Error<
4793  "extraneous 'template<>' in declaration of variable %0">;
4794def err_template_member : Error<"member %0 declared as a template">;
4795def err_template_member_noparams : Error<
4796  "extraneous 'template<>' in declaration of member %0">;
4797def err_template_tag_noparams : Error<
4798  "extraneous 'template<>' in declaration of %0 %1">;
4799
4800def warn_cxx17_compat_adl_only_template_id : Warning<
4801  "use of function template name with no prior function template "
4802  "declaration in function call with explicit template arguments "
4803  "is incompatible with C++ standards before C++20">,
4804  InGroup<CXXPre20Compat>, DefaultIgnore;
4805def ext_adl_only_template_id : ExtWarn<
4806  "use of function template name with no prior declaration in function call "
4807  "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
4808
4809// C++ Template Argument Lists
4810def err_template_missing_args : Error<
4811  "use of "
4812  "%select{class template|function template|variable template|alias template|"
4813  "template template parameter|concept|template}0 %1 requires template "
4814  "arguments">;
4815def err_template_arg_list_different_arity : Error<
4816  "%select{too few|too many}0 template arguments for "
4817  "%select{class template|function template|variable template|alias template|"
4818  "template template parameter|concept|template}1 %2">;
4819def note_template_decl_here : Note<"template is declared here">;
4820def err_template_arg_must_be_type : Error<
4821  "template argument for template type parameter must be a type">;
4822def err_template_arg_must_be_type_suggest : Error<
4823  "template argument for template type parameter must be a type; "
4824  "did you forget 'typename'?">;
4825def ext_ms_template_type_arg_missing_typename : ExtWarn<
4826  "template argument for template type parameter must be a type; "
4827  "omitted 'typename' is a Microsoft extension">,
4828  InGroup<MicrosoftTemplate>;
4829def err_template_arg_must_be_expr : Error<
4830  "template argument for non-type template parameter must be an expression">;
4831def err_template_arg_nontype_ambig : Error<
4832  "template argument for non-type template parameter is treated as function type %0">;
4833def err_template_arg_must_be_template : Error<
4834  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
4835def ext_template_arg_local_type : ExtWarn<
4836  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
4837def ext_template_arg_unnamed_type : ExtWarn<
4838  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
4839def warn_cxx98_compat_template_arg_local_type : Warning<
4840  "local type %0 as template argument is incompatible with C++98">,
4841  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
4842def warn_cxx98_compat_template_arg_unnamed_type : Warning<
4843  "unnamed type as template argument is incompatible with C++98">,
4844  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
4845def note_template_unnamed_type_here : Note<
4846  "unnamed type used in template argument was declared here">;
4847def err_template_arg_overload_type : Error<
4848  "template argument is the type of an unresolved overloaded function">;
4849def err_template_arg_not_valid_template : Error<
4850  "template argument does not refer to a class or alias template, or template "
4851  "template parameter">;
4852def note_template_arg_refers_here_func : Note<
4853  "template argument refers to function template %0, here">;
4854def err_template_arg_template_params_mismatch : Error<
4855  "template template argument has different template parameters than its "
4856  "corresponding template template parameter">;
4857def err_template_arg_not_integral_or_enumeral : Error<
4858  "non-type template argument of type %0 must have an integral or enumeration"
4859  " type">;
4860def err_template_arg_not_ice : Error<
4861  "non-type template argument of type %0 is not an integral constant "
4862  "expression">;
4863def err_template_arg_not_address_constant : Error<
4864  "non-type template argument of type %0 is not a constant expression">;
4865def warn_cxx98_compat_template_arg_null : Warning<
4866  "use of null pointer as non-type template argument is incompatible with "
4867  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4868def err_template_arg_untyped_null_constant : Error<
4869  "null non-type template argument must be cast to template parameter type %0">;
4870def err_template_arg_wrongtype_null_constant : Error<
4871  "null non-type template argument of type %0 does not match template parameter "
4872  "of type %1">;
4873def err_non_type_template_parm_type_deduction_failure : Error<
4874  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
4875def err_deduced_non_type_template_arg_type_mismatch : Error<
4876  "deduced non-type template argument does not have the same type as the "
4877  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
4878def err_non_type_template_arg_subobject : Error<
4879  "non-type template argument refers to subobject '%0'">;
4880def err_non_type_template_arg_addr_label_diff : Error<
4881  "template argument / label address difference / what did you expect?">;
4882def err_non_type_template_arg_unsupported : Error<
4883  "sorry, non-type template argument of type %0 is not yet supported">;
4884def err_template_arg_not_convertible : Error<
4885  "non-type template argument of type %0 cannot be converted to a value "
4886  "of type %1">;
4887def warn_template_arg_negative : Warning<
4888  "non-type template argument with value '%0' converted to '%1' for unsigned "
4889  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4890def warn_template_arg_too_large : Warning<
4891  "non-type template argument value '%0' truncated to '%1' for "
4892  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4893def err_template_arg_no_ref_bind : Error<
4894  "non-type template parameter of reference type "
4895  "%diff{$ cannot bind to template argument of type $"
4896  "|cannot bind to template of incompatible argument type}0,1">;
4897def err_template_arg_ref_bind_ignores_quals : Error<
4898  "reference binding of non-type template parameter "
4899  "%diff{of type $ to template argument of type $|to template argument}0,1 "
4900  "ignores qualifiers">;
4901def err_template_arg_not_decl_ref : Error<
4902  "non-type template argument does not refer to any declaration">;
4903def err_template_arg_not_address_of : Error<
4904  "non-type template argument for template parameter of pointer type %0 must "
4905  "have its address taken">;
4906def err_template_arg_address_of_non_pointer : Error<
4907  "address taken in non-type template argument for template parameter of "
4908  "reference type %0">;
4909def err_template_arg_reference_var : Error<
4910  "non-type template argument of reference type %0 is not an object">;
4911def err_template_arg_field : Error<
4912  "non-type template argument refers to non-static data member %0">;
4913def err_template_arg_method : Error<
4914  "non-type template argument refers to non-static member function %0">;
4915def err_template_arg_object_no_linkage : Error<
4916  "non-type template argument refers to %select{function|object}0 %1 that "
4917  "does not have linkage">;
4918def warn_cxx98_compat_template_arg_object_internal : Warning<
4919  "non-type template argument referring to %select{function|object}0 %1 with "
4920  "internal linkage is incompatible with C++98">,
4921  InGroup<CXX98Compat>, DefaultIgnore;
4922def ext_template_arg_object_internal : ExtWarn<
4923  "non-type template argument referring to %select{function|object}0 %1 with "
4924  "internal linkage is a C++11 extension">, InGroup<CXX11>;
4925def err_template_arg_thread_local : Error<
4926  "non-type template argument refers to thread-local object">;
4927def note_template_arg_internal_object : Note<
4928  "non-type template argument refers to %select{function|object}0 here">;
4929def note_template_arg_refers_here : Note<
4930  "non-type template argument refers here">;
4931def err_template_arg_not_object_or_func : Error<
4932  "non-type template argument does not refer to an object or function">;
4933def err_template_arg_not_pointer_to_member_form : Error<
4934  "non-type template argument is not a pointer to member constant">;
4935def err_template_arg_member_ptr_base_derived_not_supported : Error<
4936  "sorry, non-type template argument of pointer-to-member type %1 that refers "
4937  "to member %q0 of a different class is not supported yet">;
4938def ext_template_arg_extra_parens : ExtWarn<
4939  "address non-type template argument cannot be surrounded by parentheses">;
4940def warn_cxx98_compat_template_arg_extra_parens : Warning<
4941  "redundant parentheses surrounding address non-type template argument are "
4942  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4943def err_pointer_to_member_type : Error<
4944  "invalid use of pointer to member type after %select{.*|->*}0">;
4945def err_pointer_to_member_call_drops_quals : Error<
4946  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
4947def err_pointer_to_member_oper_value_classify: Error<
4948  "pointer-to-member function type %0 can only be called on an "
4949  "%select{rvalue|lvalue}1">;
4950def ext_pointer_to_const_ref_member_on_rvalue : Extension<
4951  "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
4952  InGroup<CXX20>, SFINAEFailure;
4953def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
4954  "invoking a pointer to a 'const &' member function on an rvalue is "
4955  "incompatible with C++ standards before C++20">,
4956  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
4957def ext_ms_deref_template_argument: ExtWarn<
4958  "non-type template argument containing a dereference operation is a "
4959  "Microsoft extension">, InGroup<MicrosoftTemplate>;
4960def ext_ms_delayed_template_argument: ExtWarn<
4961  "using the undeclared type %0 as a default template argument is a "
4962  "Microsoft extension">, InGroup<MicrosoftTemplate>;
4963def err_template_arg_deduced_incomplete_pack : Error<
4964  "deduced incomplete pack %0 for template parameter %1">;
4965
4966// C++ template specialization
4967def err_template_spec_unknown_kind : Error<
4968  "can only provide an explicit specialization for a class template, function "
4969  "template, variable template, or a member function, static data member, "
4970  "%select{or member class|member class, or member enumeration}0 of a "
4971  "class template">;
4972def note_specialized_entity : Note<
4973  "explicitly specialized declaration is here">;
4974def note_explicit_specialization_declared_here : Note<
4975  "explicit specialization declared here">;
4976def err_template_spec_decl_function_scope : Error<
4977  "explicit specialization of %0 in function scope">;
4978def err_template_spec_decl_friend : Error<
4979  "cannot declare an explicit specialization in a friend">;
4980def err_template_spec_redecl_out_of_scope : Error<
4981  "%select{class template|class template partial|variable template|"
4982  "variable template partial|function template|member "
4983  "function|static data member|member class|member enumeration}0 "
4984  "specialization of %1 not in %select{a namespace enclosing %2|"
4985  "class %2 or an enclosing namespace}3">;
4986def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
4987  "%select{class template|class template partial|variable template|"
4988  "variable template partial|function template|member "
4989  "function|static data member|member class|member enumeration}0 "
4990  "specialization of %1 not in %select{a namespace enclosing %2|"
4991  "class %2 or an enclosing namespace}3 "
4992  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
4993def err_template_spec_redecl_global_scope : Error<
4994  "%select{class template|class template partial|variable template|"
4995  "variable template partial|function template|member "
4996  "function|static data member|member class|member enumeration}0 "
4997  "specialization of %1 must occur at global scope">;
4998def err_spec_member_not_instantiated : Error<
4999  "specialization of member %q0 does not specialize an instantiated member">;
5000def note_specialized_decl : Note<"attempt to specialize declaration here">;
5001def err_specialization_after_instantiation : Error<
5002  "explicit specialization of %0 after instantiation">;
5003def note_instantiation_required_here : Note<
5004  "%select{implicit|explicit}0 instantiation first required here">;
5005def err_template_spec_friend : Error<
5006  "template specialization declaration cannot be a friend">;
5007def err_template_spec_default_arg : Error<
5008  "default argument not permitted on an explicit "
5009  "%select{instantiation|specialization}0 of function %1">;
5010def err_not_class_template_specialization : Error<
5011  "cannot specialize a %select{dependent template|template template "
5012  "parameter}0">;
5013def ext_explicit_specialization_storage_class : ExtWarn<
5014  "explicit specialization cannot have a storage class">;
5015def err_explicit_specialization_inconsistent_storage_class : Error<
5016  "explicit specialization has extraneous, inconsistent storage class "
5017  "'%select{none|extern|static|__private_extern__|auto|register}0'">;
5018def err_dependent_function_template_spec_no_match : Error<
5019  "no candidate function template was found for dependent"
5020  " friend function template specialization">;
5021def note_dependent_function_template_spec_discard_reason : Note<
5022  "candidate ignored: %select{not a function template"
5023  "|not a member of the enclosing namespace;"
5024  " did you mean to explicitly qualify the specialization?}0">;
5025
5026// C++ class template specializations and out-of-line definitions
5027def err_template_spec_needs_header : Error<
5028  "template specialization requires 'template<>'">;
5029def err_template_spec_needs_template_parameters : Error<
5030  "template specialization or definition requires a template parameter list "
5031  "corresponding to the nested type %0">;
5032def err_template_param_list_matches_nontemplate : Error<
5033  "template parameter list matching the non-templated nested type %0 should "
5034  "be empty ('template<>')">;
5035def err_alias_template_extra_headers : Error<
5036  "extraneous template parameter list in alias template declaration">;
5037def err_template_spec_extra_headers : Error<
5038  "extraneous template parameter list in template specialization or "
5039  "out-of-line template definition">;
5040def warn_template_spec_extra_headers : Warning<
5041  "extraneous template parameter list in template specialization">;
5042def note_explicit_template_spec_does_not_need_header : Note<
5043  "'template<>' header not required for explicitly-specialized class %0 "
5044  "declared here">;
5045def err_template_qualified_declarator_no_match : Error<
5046  "nested name specifier '%0' for declaration does not refer into a class, "
5047  "class template or class template partial specialization">;
5048def err_specialize_member_of_template : Error<
5049  "cannot specialize %select{|(with 'template<>') }0a member of an "
5050  "unspecialized template">;
5051
5052// C++ Class Template Partial Specialization
5053def err_default_arg_in_partial_spec : Error<
5054    "default template argument in a class template partial specialization">;
5055def err_dependent_non_type_arg_in_partial_spec : Error<
5056    "type of specialized non-type template argument depends on a template "
5057    "parameter of the partial specialization">;
5058def note_dependent_non_type_default_arg_in_partial_spec : Note<
5059    "template parameter is used in default argument declared here">;
5060def err_dependent_typed_non_type_arg_in_partial_spec : Error<
5061    "non-type template argument specializes a template parameter with "
5062    "dependent type %0">;
5063def err_partial_spec_args_match_primary_template : Error<
5064    "%select{class|variable}0 template partial specialization does not "
5065    "specialize any template argument; to %select{declare|define}1 the "
5066    "primary template, remove the template argument list">;
5067def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
5068    "%select{class|variable}0 template partial specialization is not "
5069    "more specialized than the primary template">, DefaultError,
5070    InGroup<DiagGroup<"invalid-partial-specialization">>;
5071def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
5072def ext_partial_specs_not_deducible : ExtWarn<
5073    "%select{class|variable}0 template partial specialization contains "
5074    "%select{a template parameter|template parameters}1 that cannot be "
5075    "deduced; this partial specialization will never be used">,
5076    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
5077def note_non_deducible_parameter : Note<
5078    "non-deducible template parameter %0">;
5079def err_partial_spec_ordering_ambiguous : Error<
5080    "ambiguous partial specializations of %0">;
5081def note_partial_spec_match : Note<"partial specialization matches %0">;
5082def err_partial_spec_redeclared : Error<
5083  "class template partial specialization %0 cannot be redeclared">;
5084def note_partial_specialization_declared_here : Note<
5085  "explicit specialization declared here">;
5086def note_prev_partial_spec_here : Note<
5087  "previous declaration of class template partial specialization %0 is here">;
5088def err_partial_spec_fully_specialized : Error<
5089  "partial specialization of %0 does not use any of its template parameters">;
5090
5091// C++ Variable Template Partial Specialization
5092def err_var_partial_spec_redeclared : Error<
5093  "variable template partial specialization %0 cannot be redefined">;
5094def note_var_prev_partial_spec_here : Note<
5095  "previous declaration of variable template partial specialization is here">;
5096def err_var_spec_no_template : Error<
5097  "no variable template matches%select{| partial}0 specialization">;
5098def err_var_spec_no_template_but_method : Error<
5099  "no variable template matches specialization; "
5100  "did you mean to use %0 as function template instead?">;
5101
5102// C++ Function template specializations
5103def err_function_template_spec_no_match : Error<
5104    "no function template matches function template specialization %0">;
5105def err_function_template_spec_ambiguous : Error<
5106    "function template specialization %0 ambiguously refers to more than one "
5107    "function template; explicitly specify%select{| additional}1 template "
5108    "arguments to identify a particular function template">;
5109def note_function_template_spec_matched : Note<
5110    "function template %q0 matches specialization %1">;
5111def err_function_template_partial_spec : Error<
5112    "function template partial specialization is not allowed">;
5113
5114// C++ Template Instantiation
5115def err_template_recursion_depth_exceeded : Error<
5116  "recursive template instantiation exceeded maximum depth of %0">,
5117  DefaultFatal, NoSFINAE;
5118def note_template_recursion_depth : Note<
5119  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
5120
5121def err_template_instantiate_within_definition : Error<
5122  "%select{implicit|explicit}0 instantiation of template %1 within its"
5123  " own definition">;
5124def err_template_instantiate_undefined : Error<
5125  "%select{implicit|explicit}0 instantiation of undefined template %1">;
5126def err_implicit_instantiate_member_undefined : Error<
5127  "implicit instantiation of undefined member %0">;
5128def note_template_class_instantiation_was_here : Note<
5129  "class template %0 was instantiated here">;
5130def note_template_class_explicit_specialization_was_here : Note<
5131  "class template %0 was explicitly specialized here">;
5132def note_template_class_instantiation_here : Note<
5133  "in instantiation of template class %q0 requested here">;
5134def note_template_member_class_here : Note<
5135  "in instantiation of member class %q0 requested here">;
5136def note_template_member_function_here : Note<
5137  "in instantiation of member function %q0 requested here">;
5138def note_function_template_spec_here : Note<
5139  "in instantiation of function template specialization %q0 requested here">;
5140def note_template_static_data_member_def_here : Note<
5141  "in instantiation of static data member %q0 requested here">;
5142def note_template_variable_def_here : Note<
5143  "in instantiation of variable template specialization %q0 requested here">;
5144def note_template_enum_def_here : Note<
5145  "in instantiation of enumeration %q0 requested here">;
5146def note_template_nsdmi_here : Note<
5147  "in instantiation of default member initializer %q0 requested here">;
5148def note_template_type_alias_instantiation_here : Note<
5149  "in instantiation of template type alias %0 requested here">;
5150def note_template_exception_spec_instantiation_here : Note<
5151  "in instantiation of exception specification for %0 requested here">;
5152def note_template_requirement_instantiation_here : Note<
5153  "in instantiation of requirement here">;
5154def warn_var_template_missing : Warning<"instantiation of variable %q0 "
5155  "required here, but no definition is available">,
5156  InGroup<UndefinedVarTemplate>;
5157def warn_func_template_missing : Warning<"instantiation of function %q0 "
5158  "required here, but no definition is available">,
5159  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
5160def note_forward_template_decl : Note<
5161  "forward declaration of template entity is here">;
5162def note_inst_declaration_hint : Note<"add an explicit instantiation "
5163  "declaration to suppress this warning if %q0 is explicitly instantiated in "
5164  "another translation unit">;
5165def note_evaluating_exception_spec_here : Note<
5166  "in evaluation of exception specification for %q0 needed here">;
5167
5168def note_default_arg_instantiation_here : Note<
5169  "in instantiation of default argument for '%0' required here">;
5170def note_default_function_arg_instantiation_here : Note<
5171  "in instantiation of default function argument expression "
5172  "for '%0' required here">;
5173def note_explicit_template_arg_substitution_here : Note<
5174  "while substituting explicitly-specified template arguments into function "
5175  "template %0 %1">;
5176def note_function_template_deduction_instantiation_here : Note<
5177  "while substituting deduced template arguments into function template %0 "
5178  "%1">;
5179def note_deduced_template_arg_substitution_here : Note<
5180  "during template argument deduction for %select{class|variable}0 template "
5181  "%select{partial specialization |}1%2 %3">;
5182def note_prior_template_arg_substitution : Note<
5183  "while substituting prior template arguments into %select{non-type|template}0"
5184  " template parameter%1 %2">;
5185def note_template_default_arg_checking : Note<
5186  "while checking a default template argument used here">;
5187def note_concept_specialization_here : Note<
5188  "while checking the satisfaction of concept '%0' requested here">;
5189def note_nested_requirement_here : Note<
5190  "while checking the satisfaction of nested requirement requested here">;
5191def note_checking_constraints_for_template_id_here : Note<
5192  "while checking constraint satisfaction for template '%0' required here">;
5193def note_checking_constraints_for_var_spec_id_here : Note<
5194  "while checking constraint satisfaction for variable template "
5195  "partial specialization '%0' required here">;
5196def note_checking_constraints_for_class_spec_id_here : Note<
5197  "while checking constraint satisfaction for class template partial "
5198  "specialization '%0' required here">;
5199def note_checking_constraints_for_function_here : Note<
5200  "while checking constraint satisfaction for function '%0' required here">;
5201def note_constraint_substitution_here : Note<
5202  "while substituting template arguments into constraint expression here">;
5203def note_constraint_normalization_here : Note<
5204  "while calculating associated constraint of template '%0' here">;
5205def note_parameter_mapping_substitution_here : Note<
5206  "while substituting into concept arguments here; substitution failures not "
5207  "allowed in concept arguments">;
5208def note_instantiation_contexts_suppressed : Note<
5209  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
5210  "see all)">;
5211
5212def err_field_instantiates_to_function : Error<
5213  "data member instantiated with function type %0">;
5214def err_variable_instantiates_to_function : Error<
5215  "%select{variable|static data member}0 instantiated with function type %1">;
5216def err_nested_name_spec_non_tag : Error<
5217  "type %0 cannot be used prior to '::' because it has no members">;
5218
5219def err_using_pack_expansion_empty : Error<
5220  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
5221
5222// C++ Explicit Instantiation
5223def err_explicit_instantiation_duplicate : Error<
5224    "duplicate explicit instantiation of %0">;
5225def ext_explicit_instantiation_duplicate : ExtWarn<
5226    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
5227    InGroup<MicrosoftTemplate>;
5228def note_previous_explicit_instantiation : Note<
5229    "previous explicit instantiation is here">;
5230def warn_explicit_instantiation_after_specialization : Warning<
5231  "explicit instantiation of %0 that occurs after an explicit "
5232  "specialization has no effect">,
5233  InGroup<DiagGroup<"instantiation-after-specialization">>;
5234def note_previous_template_specialization : Note<
5235    "previous template specialization is here">;
5236def err_explicit_instantiation_nontemplate_type : Error<
5237    "explicit instantiation of non-templated type %0">;
5238def note_nontemplate_decl_here : Note<
5239    "non-templated declaration is here">;
5240def err_explicit_instantiation_in_class : Error<
5241  "explicit instantiation of %0 in class scope">;
5242def err_explicit_instantiation_out_of_scope : Error<
5243  "explicit instantiation of %0 not in a namespace enclosing %1">;
5244def err_explicit_instantiation_must_be_global : Error<
5245  "explicit instantiation of %0 must occur at global scope">;
5246def warn_explicit_instantiation_out_of_scope_0x : Warning<
5247  "explicit instantiation of %0 not in a namespace enclosing %1">,
5248  InGroup<CXX11Compat>, DefaultIgnore;
5249def warn_explicit_instantiation_must_be_global_0x : Warning<
5250  "explicit instantiation of %0 must occur at global scope">,
5251  InGroup<CXX11Compat>, DefaultIgnore;
5252
5253def err_explicit_instantiation_requires_name : Error<
5254  "explicit instantiation declaration requires a name">;
5255def err_explicit_instantiation_of_typedef : Error<
5256  "explicit instantiation of typedef %0">;
5257def err_explicit_instantiation_storage_class : Error<
5258  "explicit instantiation cannot have a storage class">;
5259def err_explicit_instantiation_internal_linkage : Error<
5260  "explicit instantiation declaration of %0 with internal linkage">;
5261def err_explicit_instantiation_not_known : Error<
5262  "explicit instantiation of %0 does not refer to a function template, "
5263  "variable template, member function, member class, or static data member">;
5264def note_explicit_instantiation_here : Note<
5265  "explicit instantiation refers here">;
5266def err_explicit_instantiation_data_member_not_instantiated : Error<
5267  "explicit instantiation refers to static data member %q0 that is not an "
5268  "instantiation">;
5269def err_explicit_instantiation_member_function_not_instantiated : Error<
5270  "explicit instantiation refers to member function %q0 that is not an "
5271  "instantiation">;
5272def err_explicit_instantiation_ambiguous : Error<
5273  "partial ordering for explicit instantiation of %0 is ambiguous">;
5274def note_explicit_instantiation_candidate : Note<
5275  "explicit instantiation candidate function %q0 template here %1">;
5276def err_explicit_instantiation_inline : Error<
5277  "explicit instantiation cannot be 'inline'">;
5278def warn_explicit_instantiation_inline_0x : Warning<
5279  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5280  DefaultIgnore;
5281def err_explicit_instantiation_constexpr : Error<
5282  "explicit instantiation cannot be 'constexpr'">;
5283def ext_explicit_instantiation_without_qualified_id : Extension<
5284  "qualifier in explicit instantiation of %q0 requires a template-id "
5285  "(a typedef is not permitted)">;
5286def err_explicit_instantiation_without_template_id : Error<
5287  "explicit instantiation of %q0 must specify a template argument list">;
5288def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5289  "explicit instantiation of %q0 must occur in namespace %1">;
5290def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5291  "explicit instantiation of %q0 must occur in namespace %1">,
5292  InGroup<CXX11Compat>, DefaultIgnore;
5293def err_explicit_instantiation_undefined_member : Error<
5294  "explicit instantiation of undefined %select{member class|member function|"
5295  "static data member}0 %1 of class template %2">;
5296def err_explicit_instantiation_undefined_func_template : Error<
5297  "explicit instantiation of undefined function template %0">;
5298def err_explicit_instantiation_undefined_var_template : Error<
5299  "explicit instantiation of undefined variable template %q0">;
5300def err_explicit_instantiation_declaration_after_definition : Error<
5301  "explicit instantiation declaration (with 'extern') follows explicit "
5302  "instantiation definition (without 'extern')">;
5303def note_explicit_instantiation_definition_here : Note<
5304  "explicit instantiation definition is here">;
5305def err_invalid_var_template_spec_type : Error<"type %2 "
5306  "of %select{explicit instantiation|explicit specialization|"
5307  "partial specialization|redeclaration}0 of %1 does not match"
5308  " expected type %3">;
5309def err_mismatched_exception_spec_explicit_instantiation : Error<
5310  "exception specification in explicit instantiation does not match "
5311  "instantiated one">;
5312def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5313  err_mismatched_exception_spec_explicit_instantiation.Text>,
5314  InGroup<MicrosoftExceptionSpec>;
5315def err_explicit_instantiation_dependent : Error<
5316  "explicit instantiation has dependent template arguments">;
5317
5318// C++ typename-specifiers
5319def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5320def err_typename_nested_not_found_enable_if : Error<
5321  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5322  "this declaration">;
5323def err_typename_nested_not_found_requirement : Error<
5324  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5325  "declaration">;
5326def err_typename_nested_not_type : Error<
5327    "typename specifier refers to non-type member %0 in %1">;
5328def err_typename_not_type : Error<
5329    "typename specifier refers to non-type %0">;
5330def note_typename_member_refers_here : Note<
5331    "referenced member %0 is declared here">;
5332def note_typename_refers_here : Note<
5333    "referenced %0 is declared here">;
5334def err_typename_missing : Error<
5335  "missing 'typename' prior to dependent type name '%0%1'">;
5336def err_typename_missing_template : Error<
5337  "missing 'typename' prior to dependent type template name '%0%1'">;
5338def ext_typename_missing : ExtWarn<
5339  "missing 'typename' prior to dependent type name '%0%1'">,
5340  InGroup<DiagGroup<"typename-missing">>;
5341def ext_typename_outside_of_template : ExtWarn<
5342  "'typename' occurs outside of a template">, InGroup<CXX11>;
5343def warn_cxx98_compat_typename_outside_of_template : Warning<
5344  "use of 'typename' outside of a template is incompatible with C++98">,
5345  InGroup<CXX98Compat>, DefaultIgnore;
5346def err_typename_refers_to_using_value_decl : Error<
5347  "typename specifier refers to a dependent using declaration for a value "
5348  "%0 in %1">;
5349def note_using_value_decl_missing_typename : Note<
5350  "add 'typename' to treat this using declaration as a type">;
5351
5352def err_template_kw_refers_to_non_template : Error<
5353  "%0%select{| following the 'template' keyword}1 "
5354  "does not refer to a template">;
5355def note_template_kw_refers_to_non_template : Note<
5356  "declared as a non-template here">;
5357def err_template_kw_refers_to_dependent_non_template : Error<
5358  "%0%select{| following the 'template' keyword}1 "
5359  "cannot refer to a dependent template">;
5360def err_template_kw_refers_to_class_template : Error<
5361  "'%0%1' instantiated to a class template, not a function template">;
5362def note_referenced_class_template : Note<
5363  "class template declared here">;
5364def err_template_kw_missing : Error<
5365  "missing 'template' keyword prior to dependent template name '%0%1'">;
5366def ext_template_outside_of_template : ExtWarn<
5367  "'template' keyword outside of a template">, InGroup<CXX11>;
5368def warn_cxx98_compat_template_outside_of_template : Warning<
5369  "use of 'template' keyword outside of a template is incompatible with C++98">,
5370  InGroup<CXX98Compat>, DefaultIgnore;
5371
5372def err_non_type_template_in_nested_name_specifier : Error<
5373  "qualified name refers into a specialization of %select{function|variable}0 "
5374  "template %1">;
5375def err_template_id_not_a_type : Error<
5376  "template name refers to non-type template %0">;
5377def note_template_declared_here : Note<
5378  "%select{function template|class template|variable template"
5379  "|type alias template|template template parameter}0 "
5380  "%1 declared here">;
5381def err_template_expansion_into_fixed_list : Error<
5382  "pack expansion used as argument for non-pack parameter of %select{alias "
5383  "template|concept}0">;
5384def note_parameter_type : Note<
5385  "parameter of type %0 is declared here">;
5386
5387// C++11 Variadic Templates
5388def err_template_param_pack_default_arg : Error<
5389  "template parameter pack cannot have a default argument">;
5390def err_template_param_pack_must_be_last_template_parameter : Error<
5391  "template parameter pack must be the last template parameter">;
5392
5393def err_template_parameter_pack_non_pack : Error<
5394  "%select{template type|non-type template|template template}0 parameter"
5395  "%select{| pack}1 conflicts with previous %select{template type|"
5396  "non-type template|template template}0 parameter%select{ pack|}1">;
5397def note_template_parameter_pack_non_pack : Note<
5398  "%select{template type|non-type template|template template}0 parameter"
5399  "%select{| pack}1 does not match %select{template type|non-type template"
5400  "|template template}0 parameter%select{ pack|}1 in template argument">;
5401def note_template_parameter_pack_here : Note<
5402  "previous %select{template type|non-type template|template template}0 "
5403  "parameter%select{| pack}1 declared here">;
5404
5405def err_unexpanded_parameter_pack : Error<
5406  "%select{expression|base type|declaration type|data member type|bit-field "
5407  "size|static assertion|fixed underlying type|enumerator value|"
5408  "using declaration|friend declaration|qualifier|initializer|default argument|"
5409  "non-type template parameter type|exception type|partial specialization|"
5410  "__if_exists name|__if_not_exists name|lambda|block|type constraint|"
5411  "requirement|requires clause}0 "
5412  "contains%plural{0: an|:}1 unexpanded parameter pack"
5413  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5414
5415def err_pack_expansion_without_parameter_packs : Error<
5416  "pack expansion does not contain any unexpanded parameter packs">;
5417def err_pack_expansion_length_conflict : Error<
5418  "pack expansion contains parameter packs %0 and %1 that have different "
5419  "lengths (%2 vs. %3)">;
5420def err_pack_expansion_length_conflict_multilevel : Error<
5421  "pack expansion contains parameter pack %0 that has a different "
5422  "length (%1 vs. %2) from outer parameter packs">;
5423def err_pack_expansion_length_conflict_partial : Error<
5424  "pack expansion contains parameter pack %0 that has a different "
5425  "length (at least %1 vs. %2) from outer parameter packs">;
5426def err_pack_expansion_member_init : Error<
5427  "pack expansion for initialization of member %0">;
5428
5429def err_function_parameter_pack_without_parameter_packs : Error<
5430  "type %0 of function parameter pack does not contain any unexpanded "
5431  "parameter packs">;
5432def err_ellipsis_in_declarator_not_parameter : Error<
5433  "only function and template parameters can be parameter packs">;
5434
5435def err_sizeof_pack_no_pack_name : Error<
5436  "%0 does not refer to the name of a parameter pack">;
5437
5438def err_fold_expression_packs_both_sides : Error<
5439  "binary fold expression has unexpanded parameter packs in both operands">;
5440def err_fold_expression_empty : Error<
5441  "unary fold expression has empty expansion for operator '%0' "
5442  "with no fallback value">;
5443def err_fold_expression_bad_operand : Error<
5444  "expression not permitted as operand of fold expression">;
5445def err_fold_expression_limit_exceeded: Error<
5446  "instantiating fold expression with %0 arguments exceeded expression nesting "
5447  "limit of %1">, DefaultFatal, NoSFINAE;
5448
5449def err_unexpected_typedef : Error<
5450  "unexpected type name %0: expected expression">;
5451def err_unexpected_namespace : Error<
5452  "unexpected namespace name %0: expected expression">;
5453def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5454def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5455  "use of undeclared identifier %0; "
5456  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5457  InGroup<MicrosoftTemplate>;
5458def err_found_in_dependent_base : Error<
5459  "explicit qualification required to use member %0 from dependent base class">;
5460def ext_found_in_dependent_base : ExtWarn<"use of member %0 "
5461  "found via unqualified lookup into dependent bases of class templates is a "
5462  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5463def err_found_later_in_class : Error<"member %0 used before its declaration">;
5464def ext_found_later_in_class : ExtWarn<
5465  "use of member %0 before its declaration is a Microsoft extension">,
5466  InGroup<MicrosoftTemplate>;
5467def note_dependent_member_use : Note<
5468  "must qualify identifier to find this declaration in dependent base class">;
5469def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5470    "visible in the template definition nor found by argument-dependent lookup">;
5471def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5472    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5473def err_undeclared_use : Error<"use of undeclared %0">;
5474def warn_deprecated : Warning<"%0 is deprecated">,
5475    InGroup<DeprecatedDeclarations>;
5476def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5477def warn_property_method_deprecated :
5478    Warning<"property access is using %0 method which is deprecated">,
5479    InGroup<DeprecatedDeclarations>;
5480def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5481    InGroup<DeprecatedDeclarations>;
5482def warn_deprecated_anonymous_namespace : Warning<
5483  "'deprecated' attribute on anonymous namespace ignored">,
5484  InGroup<IgnoredAttributes>;
5485def warn_deprecated_fwdclass_message : Warning<
5486    "%0 may be deprecated because the receiver type is unknown">,
5487    InGroup<DeprecatedDeclarations>;
5488def warn_deprecated_def : Warning<
5489  "implementing deprecated %select{method|class|category}0">,
5490  InGroup<DeprecatedImplementations>, DefaultIgnore;
5491def warn_unavailable_def : Warning<
5492  "implementing unavailable method">,
5493  InGroup<DeprecatedImplementations>, DefaultIgnore;
5494def err_unavailable : Error<"%0 is unavailable">;
5495def err_property_method_unavailable :
5496    Error<"property access is using %0 method which is unavailable">;
5497def err_unavailable_message : Error<"%0 is unavailable: %1">;
5498def warn_unavailable_fwdclass_message : Warning<
5499    "%0 may be unavailable because the receiver type is unknown">,
5500    InGroup<UnavailableDeclarations>;
5501def note_availability_specified_here : Note<
5502  "%0 has been explicitly marked "
5503  "%select{unavailable|deleted|deprecated}1 here">;
5504def note_partial_availability_specified_here : Note<
5505  "%0 has been marked as being introduced in %1 %2 here, "
5506  "but the deployment target is %1 %3">;
5507def note_implicitly_deleted : Note<
5508  "explicitly defaulted function was implicitly deleted here">;
5509def warn_not_enough_argument : Warning<
5510  "not enough variable arguments in %0 declaration to fit a sentinel">,
5511  InGroup<Sentinel>;
5512def warn_missing_sentinel : Warning <
5513  "missing sentinel in %select{function call|method dispatch|block call}0">,
5514  InGroup<Sentinel>;
5515def note_sentinel_here : Note<
5516  "%select{function|method|block}0 has been explicitly marked sentinel here">;
5517def warn_missing_prototype : Warning<
5518  "no previous prototype for function %0">,
5519  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5520def note_declaration_not_a_prototype : Note<
5521  "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5522  "to make it %select{a prototype for a zero-parameter function|one}0">;
5523def warn_strict_prototypes : Warning<
5524  "this %select{function declaration is not|block declaration is not|"
5525  "old-style function definition is not preceded by}0 a prototype">,
5526  InGroup<DiagGroup<"strict-prototypes">>, DefaultIgnore;
5527def warn_missing_variable_declarations : Warning<
5528  "no previous extern declaration for non-static variable %0">,
5529  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5530def note_static_for_internal_linkage : Note<
5531  "declare 'static' if the %select{variable|function}0 is not intended to be "
5532  "used outside of this translation unit">;
5533def err_static_data_member_reinitialization :
5534  Error<"static data member %0 already has an initializer">;
5535def err_redefinition : Error<"redefinition of %0">;
5536def err_alias_after_tentative :
5537  Error<"alias definition of %0 after tentative definition">;
5538def err_alias_is_definition :
5539  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5540def err_definition_of_implicitly_declared_member : Error<
5541  "definition of implicitly declared %select{default constructor|copy "
5542  "constructor|move constructor|copy assignment operator|move assignment "
5543  "operator|destructor|function}1">;
5544def err_definition_of_explicitly_defaulted_member : Error<
5545  "definition of explicitly defaulted %select{default constructor|copy "
5546  "constructor|move constructor|copy assignment operator|move assignment "
5547  "operator|destructor|function}0">;
5548def err_redefinition_extern_inline : Error<
5549  "redefinition of a 'extern inline' function %0 is not supported in "
5550  "%select{C99 mode|C++}1">;
5551def warn_attr_abi_tag_namespace : Warning<
5552  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5553  InGroup<IgnoredAttributes>;
5554def err_abi_tag_on_redeclaration : Error<
5555  "cannot add 'abi_tag' attribute in a redeclaration">;
5556def err_new_abi_tag_on_redeclaration : Error<
5557  "'abi_tag' %0 missing in original declaration">;
5558def note_use_ifdef_guards : Note<
5559  "unguarded header; consider using #ifdef guards or #pragma once">;
5560
5561def note_deleted_dtor_no_operator_delete : Note<
5562  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5563def note_deleted_special_member_class_subobject : Note<
5564  "%select{default constructor of|copy constructor of|move constructor of|"
5565  "copy assignment operator of|move assignment operator of|destructor of|"
5566  "constructor inherited by}0 "
5567  "%1 is implicitly deleted because "
5568  "%select{base class %3|%select{||||variant }4field %3}2 "
5569  "%select{has "
5570  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5571  "%select{%select{default constructor|copy constructor|move constructor|copy "
5572  "assignment operator|move assignment operator|destructor|"
5573  "%select{default|corresponding|default|default|default}4 constructor}0|"
5574  "destructor}5"
5575  "%select{||s||}4"
5576  "|is an ObjC pointer}6">;
5577def note_deleted_default_ctor_uninit_field : Note<
5578  "%select{default constructor of|constructor inherited by}0 "
5579  "%1 is implicitly deleted because field %2 of "
5580  "%select{reference|const-qualified}4 type %3 would not be initialized">;
5581def note_deleted_default_ctor_all_const : Note<
5582  "%select{default constructor of|constructor inherited by}0 "
5583  "%1 is implicitly deleted because all "
5584  "%select{data members|data members of an anonymous union member}2"
5585  " are const-qualified">;
5586def note_deleted_copy_ctor_rvalue_reference : Note<
5587  "copy constructor of %0 is implicitly deleted because field %1 is of "
5588  "rvalue reference type %2">;
5589def note_deleted_copy_user_declared_move : Note<
5590  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5591  " %1 has a user-declared move %select{constructor|assignment operator}2">;
5592def note_deleted_assign_field : Note<
5593  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5594  "because field %2 is of %select{reference|const-qualified}4 type %3">;
5595
5596// These should be errors.
5597def warn_undefined_internal : Warning<
5598  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5599  InGroup<DiagGroup<"undefined-internal">>;
5600def err_undefined_internal_type : Error<
5601  "%select{function|variable}0 %q1 is used but not defined in this "
5602  "translation unit, and cannot be defined in any other translation unit "
5603  "because its type does not have linkage">;
5604def ext_undefined_internal_type : Extension<
5605  "ISO C++ requires a definition in this translation unit for "
5606  "%select{function|variable}0 %q1 because its type does not have linkage">,
5607  InGroup<DiagGroup<"undefined-internal-type">>;
5608def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5609  InGroup<DiagGroup<"undefined-inline">>;
5610def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5611def note_used_here : Note<"used here">;
5612
5613def err_attribute_missing_on_first_decl : Error<
5614  "%0 attribute does not appear on the first declaration">;
5615def warn_internal_linkage_local_storage : Warning<
5616  "'internal_linkage' attribute on a non-static local variable is ignored">,
5617  InGroup<IgnoredAttributes>;
5618
5619def ext_internal_in_extern_inline : ExtWarn<
5620  "static %select{function|variable}0 %1 is used in an inline function with "
5621  "external linkage">, InGroup<StaticInInline>;
5622def ext_internal_in_extern_inline_quiet : Extension<
5623  "static %select{function|variable}0 %1 is used in an inline function with "
5624  "external linkage">, InGroup<StaticInInline>;
5625def warn_static_local_in_extern_inline : Warning<
5626  "non-constant static local variable in inline function may be different "
5627  "in different files">, InGroup<StaticLocalInInline>;
5628def note_convert_inline_to_static : Note<
5629  "use 'static' to give inline function %0 internal linkage">;
5630
5631def ext_redefinition_of_typedef : ExtWarn<
5632  "redefinition of typedef %0 is a C11 feature">,
5633  InGroup<DiagGroup<"typedef-redefinition"> >;
5634def err_redefinition_variably_modified_typedef : Error<
5635  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5636
5637def err_inline_decl_follows_def : Error<
5638  "inline declaration of %0 follows non-inline definition">;
5639def err_inline_declaration_block_scope : Error<
5640  "inline declaration of %0 not allowed in block scope">;
5641def err_static_non_static : Error<
5642  "static declaration of %0 follows non-static declaration">;
5643def err_different_language_linkage : Error<
5644  "declaration of %0 has a different language linkage">;
5645def ext_retained_language_linkage : Extension<
5646  "friend function %0 retaining previous language linkage is an extension">,
5647  InGroup<DiagGroup<"retained-language-linkage">>;
5648def err_extern_c_global_conflict : Error<
5649  "declaration of %1 %select{with C language linkage|in global scope}0 "
5650  "conflicts with declaration %select{in global scope|with C language linkage}0">;
5651def note_extern_c_global_conflict : Note<
5652  "declared %select{in global scope|with C language linkage}0 here">;
5653def note_extern_c_begins_here : Note<
5654  "extern \"C\" language linkage specification begins here">;
5655def warn_weak_import : Warning <
5656  "an already-declared variable is made a weak_import declaration %0">;
5657def ext_static_non_static : Extension<
5658  "redeclaring non-static %0 as static is a Microsoft extension">,
5659  InGroup<MicrosoftRedeclareStatic>;
5660def err_non_static_static : Error<
5661  "non-static declaration of %0 follows static declaration">;
5662def err_extern_non_extern : Error<
5663  "extern declaration of %0 follows non-extern declaration">;
5664def err_non_extern_extern : Error<
5665  "non-extern declaration of %0 follows extern declaration">;
5666def err_non_thread_thread : Error<
5667  "non-thread-local declaration of %0 follows thread-local declaration">;
5668def err_thread_non_thread : Error<
5669  "thread-local declaration of %0 follows non-thread-local declaration">;
5670def err_thread_thread_different_kind : Error<
5671  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5672  "follows declaration with %select{dynamic|static}1 initialization">;
5673def err_mismatched_owning_module : Error<
5674  "declaration of %0 in %select{the global module|module %2}1 follows "
5675  "declaration in %select{the global module|module %4}3">;
5676def err_redefinition_different_type : Error<
5677  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5678def err_redefinition_different_kind : Error<
5679  "redefinition of %0 as different kind of symbol">;
5680def err_redefinition_different_namespace_alias : Error<
5681  "redefinition of %0 as an alias for a different namespace">;
5682def note_previous_namespace_alias : Note<
5683  "previously defined as an alias for %0">;
5684def warn_forward_class_redefinition : Warning<
5685  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5686  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5687def err_redefinition_different_typedef : Error<
5688  "%select{typedef|type alias|type alias template}0 "
5689  "redefinition with different types%diff{ ($ vs $)|}1,2">;
5690def err_tag_reference_non_tag : Error<
5691  "%select{non-struct type|non-class type|non-union type|non-enum "
5692  "type|typedef|type alias|template|type alias template|template "
5693  "template argument}1 %0 cannot be referenced with a "
5694  "%select{struct|interface|union|class|enum}2 specifier">;
5695def err_tag_reference_conflict : Error<
5696  "implicit declaration introduced by elaborated type conflicts with a "
5697  "%select{non-struct type|non-class type|non-union type|non-enum "
5698  "type|typedef|type alias|template|type alias template|template "
5699  "template argument}0 of the same name">;
5700def err_dependent_tag_decl : Error<
5701  "%select{declaration|definition}0 of "
5702  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5703def err_tag_definition_of_typedef : Error<
5704  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
5705def err_conflicting_types : Error<"conflicting types for %0">;
5706def err_different_pass_object_size_params : Error<
5707  "conflicting pass_object_size attributes on parameters">;
5708def err_late_asm_label_name : Error<
5709  "cannot apply asm label to %select{variable|function}0 after its first use">;
5710def err_different_asm_label : Error<"conflicting asm label">;
5711def err_nested_redefinition : Error<"nested redefinition of %0">;
5712def err_use_with_wrong_tag : Error<
5713  "use of %0 with tag type that does not match previous declaration">;
5714def warn_struct_class_tag_mismatch : Warning<
5715  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
5716  "declared as a %select{struct|interface|class}3%select{| template}1; "
5717  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5718  InGroup<MismatchedTags>, DefaultIgnore;
5719def warn_struct_class_previous_tag_mismatch : Warning<
5720  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
5721  "here but previously declared as "
5722  "%select{a struct|an interface|a class}3%select{| template}1; "
5723  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5724  InGroup<MismatchedTags>, DefaultIgnore;
5725def note_struct_class_suggestion : Note<
5726  "did you mean %select{struct|interface|class}0 here?">;
5727def ext_forward_ref_enum : Extension<
5728  "ISO C forbids forward references to 'enum' types">;
5729def err_forward_ref_enum : Error<
5730  "ISO C++ forbids forward references to 'enum' types">;
5731def ext_ms_forward_ref_enum : ExtWarn<
5732  "forward references to 'enum' types are a Microsoft extension">,
5733  InGroup<MicrosoftEnumForwardReference>;
5734def ext_forward_ref_enum_def : Extension<
5735  "redeclaration of already-defined enum %0 is a GNU extension">,
5736  InGroup<GNURedeclaredEnum>;
5737
5738def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
5739def err_duplicate_member : Error<"duplicate member %0">;
5740def err_misplaced_ivar : Error<
5741  "instance variables may not be placed in %select{categories|class extension}0">;
5742def warn_ivars_in_interface : Warning<
5743  "declaration of instance variables in the interface is deprecated">,
5744  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
5745def ext_enum_value_not_int : Extension<
5746  "ISO C restricts enumerator values to range of 'int' (%0 is too "
5747  "%select{small|large}1)">;
5748def ext_enum_too_large : ExtWarn<
5749  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
5750def ext_enumerator_increment_too_large : ExtWarn<
5751  "incremented enumerator value %0 is not representable in the "
5752  "largest integer type">, InGroup<EnumTooLarge>;
5753def warn_flag_enum_constant_out_of_range : Warning<
5754  "enumeration value %0 is out of range of flags in enumeration type %1">,
5755  InGroup<FlagEnum>;
5756
5757def err_vm_decl_in_file_scope : Error<
5758  "variably modified type declaration not allowed at file scope">;
5759def err_vm_decl_has_extern_linkage : Error<
5760  "variably modified type declaration cannot have 'extern' linkage">;
5761def err_typecheck_field_variable_size : Error<
5762  "fields must have a constant size: 'variable length array in structure' "
5763  "extension will never be supported">;
5764def err_vm_func_decl : Error<
5765  "function declaration cannot have variably modified type">;
5766def err_array_too_large : Error<
5767  "array is too large (%0 elements)">;
5768
5769def err_typecheck_negative_array_size : Error<"array size is negative">;
5770def warn_typecheck_function_qualifiers_ignored : Warning<
5771  "'%0' qualifier on function type %1 has no effect">,
5772  InGroup<IgnoredQualifiers>;
5773def warn_typecheck_function_qualifiers_unspecified : Warning<
5774  "'%0' qualifier on function type %1 has unspecified behavior">;
5775def warn_typecheck_reference_qualifiers : Warning<
5776  "'%0' qualifier on reference type %1 has no effect">,
5777  InGroup<IgnoredReferenceQualifiers>;
5778def err_typecheck_invalid_restrict_not_pointer : Error<
5779  "restrict requires a pointer or reference (%0 is invalid)">;
5780def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
5781  "restrict requires a pointer or reference">;
5782def err_typecheck_invalid_restrict_invalid_pointee : Error<
5783  "pointer to function type %0 may not be 'restrict' qualified">;
5784def ext_typecheck_zero_array_size : Extension<
5785  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
5786def err_typecheck_zero_array_size : Error<
5787  "zero-length arrays are not permitted in %select{C++|SYCL device code}0">;
5788def err_array_size_non_int : Error<"size of array has non-integer type %0">;
5789def err_init_element_not_constant : Error<
5790  "initializer element is not a compile-time constant">;
5791def ext_aggregate_init_not_constant : Extension<
5792  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
5793def err_local_cant_init : Error<
5794  "'__local' variable cannot have an initializer">;
5795def err_loader_uninitialized_cant_init
5796    : Error<"variable with 'loader_uninitialized' attribute cannot have an "
5797            "initializer">;
5798def err_loader_uninitialized_trivial_ctor
5799    : Error<"variable with 'loader_uninitialized' attribute must have a "
5800            "trivial default constructor">;
5801def err_loader_uninitialized_redeclaration
5802    : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
5803def err_loader_uninitialized_extern_decl
5804    : Error<"variable %0 cannot be declared both 'extern' and with the "
5805            "'loader_uninitialized' attribute">;
5806def err_block_extern_cant_init : Error<
5807  "'extern' variable cannot have an initializer">;
5808def warn_extern_init : Warning<"'extern' variable has an initializer">,
5809  InGroup<DiagGroup<"extern-initializer">>;
5810def err_variable_object_no_init : Error<
5811  "variable-sized object may not be initialized">;
5812def err_excess_initializers : Error<
5813  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
5814def ext_excess_initializers : ExtWarn<
5815  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
5816  InGroup<ExcessInitializers>;
5817def err_excess_initializers_for_sizeless_type : Error<
5818  "excess elements in initializer for indivisible sizeless type %0">;
5819def ext_excess_initializers_for_sizeless_type : ExtWarn<
5820  "excess elements in initializer for indivisible sizeless type %0">,
5821  InGroup<ExcessInitializers>;
5822def err_excess_initializers_in_char_array_initializer : Error<
5823  "excess elements in char array initializer">;
5824def ext_excess_initializers_in_char_array_initializer : ExtWarn<
5825  "excess elements in char array initializer">,
5826  InGroup<ExcessInitializers>;
5827def err_initializer_string_for_char_array_too_long : Error<
5828  "initializer-string for char array is too long">;
5829def ext_initializer_string_for_char_array_too_long : ExtWarn<
5830  "initializer-string for char array is too long">,
5831  InGroup<ExcessInitializers>;
5832def warn_missing_field_initializers : Warning<
5833  "missing field %0 initializer">,
5834  InGroup<MissingFieldInitializers>, DefaultIgnore;
5835def warn_braces_around_init : Warning<
5836  "braces around %select{scalar |}0initializer">,
5837  InGroup<DiagGroup<"braced-scalar-init">>;
5838def ext_many_braces_around_init : ExtWarn<
5839  "too many braces around %select{scalar |}0initializer">,
5840  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
5841def ext_complex_component_init : Extension<
5842  "complex initialization specifying real and imaginary components "
5843  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
5844def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
5845def err_empty_sizeless_initializer : Error<
5846  "initializer for sizeless type %0 cannot be empty">;
5847def warn_cxx98_compat_empty_scalar_initializer : Warning<
5848  "scalar initialized from empty initializer list is incompatible with C++98">,
5849  InGroup<CXX98Compat>, DefaultIgnore;
5850def warn_cxx98_compat_empty_sizeless_initializer : Warning<
5851  "initializing %0 from an empty initializer list is incompatible with C++98">,
5852  InGroup<CXX98Compat>, DefaultIgnore;
5853def warn_cxx98_compat_reference_list_init : Warning<
5854  "reference initialized from initializer list is incompatible with C++98">,
5855  InGroup<CXX98Compat>, DefaultIgnore;
5856def warn_cxx98_compat_initializer_list_init : Warning<
5857  "initialization of initializer_list object is incompatible with C++98">,
5858  InGroup<CXX98Compat>, DefaultIgnore;
5859def warn_cxx98_compat_ctor_list_init : Warning<
5860  "constructor call from initializer list is incompatible with C++98">,
5861  InGroup<CXX98Compat>, DefaultIgnore;
5862def err_illegal_initializer : Error<
5863  "illegal initializer (only variables can be initialized)">;
5864def err_illegal_initializer_type : Error<"illegal initializer type %0">;
5865def ext_init_list_type_narrowing : ExtWarn<
5866  "type %0 cannot be narrowed to %1 in initializer list">,
5867  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5868def ext_init_list_variable_narrowing : ExtWarn<
5869  "non-constant-expression cannot be narrowed from type %0 to %1 in "
5870  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5871def ext_init_list_constant_narrowing : ExtWarn<
5872  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
5873  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5874def warn_init_list_type_narrowing : Warning<
5875  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
5876  InGroup<CXX11Narrowing>, DefaultIgnore;
5877def warn_init_list_variable_narrowing : Warning<
5878  "non-constant-expression cannot be narrowed from type %0 to %1 in "
5879  "initializer list in C++11">,
5880  InGroup<CXX11Narrowing>, DefaultIgnore;
5881def warn_init_list_constant_narrowing : Warning<
5882  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
5883  "C++11">,
5884  InGroup<CXX11Narrowing>, DefaultIgnore;
5885def note_init_list_narrowing_silence : Note<
5886  "insert an explicit cast to silence this issue">;
5887def err_init_objc_class : Error<
5888  "cannot initialize Objective-C class type %0">;
5889def err_implicit_empty_initializer : Error<
5890  "initializer for aggregate with no elements requires explicit braces">;
5891def err_bitfield_has_negative_width : Error<
5892  "bit-field %0 has negative width (%1)">;
5893def err_anon_bitfield_has_negative_width : Error<
5894  "anonymous bit-field has negative width (%0)">;
5895def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
5896def err_bitfield_width_exceeds_type_width : Error<
5897  "width of%select{ anonymous|}0 bit-field%select{| %1}0 (%2 bits) exceeds the "
5898  "%select{width|size}3 of its type (%4 bit%s4)">;
5899def err_incorrect_number_of_vector_initializers : Error<
5900  "number of elements must be either one or match the size of the vector">;
5901
5902// Used by C++ which allows bit-fields that are wider than the type.
5903def warn_bitfield_width_exceeds_type_width: Warning<
5904  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
5905  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
5906def err_bitfield_too_wide : Error<
5907  "%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
5908def warn_bitfield_too_small_for_enum : Warning<
5909  "bit-field %0 is not wide enough to store all enumerators of %1">,
5910  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5911def note_widen_bitfield : Note<
5912  "widen this field to %0 bits to store all values of %1">;
5913def warn_unsigned_bitfield_assigned_signed_enum : Warning<
5914  "assigning value of signed enum type %1 to unsigned bit-field %0; "
5915  "negative enumerators of enum %1 will be converted to positive values">,
5916  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5917def warn_signed_bitfield_enum_conversion : Warning<
5918  "signed bit-field %0 needs an extra bit to represent the largest positive "
5919  "enumerators of %1">,
5920  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5921def note_change_bitfield_sign : Note<
5922  "consider making the bitfield type %select{unsigned|signed}0">;
5923
5924def warn_missing_braces : Warning<
5925  "suggest braces around initialization of subobject">,
5926  InGroup<MissingBraces>, DefaultIgnore;
5927
5928def err_redefinition_of_label : Error<"redefinition of label %0">;
5929def err_undeclared_label_use : Error<"use of undeclared label %0">;
5930def err_goto_ms_asm_label : Error<
5931  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
5932def note_goto_ms_asm_label : Note<
5933  "inline assembly label %0 declared here">;
5934def warn_unused_label : Warning<"unused label %0">,
5935  InGroup<UnusedLabel>, DefaultIgnore;
5936
5937def err_continue_from_cond_var_init : Error<
5938  "cannot jump from this continue statement to the loop increment; "
5939  "jump bypasses initialization of loop condition variable">;
5940def err_goto_into_protected_scope : Error<
5941  "cannot jump from this goto statement to its label">;
5942def ext_goto_into_protected_scope : ExtWarn<
5943  "jump from this goto statement to its label is a Microsoft extension">,
5944  InGroup<MicrosoftGoto>;
5945def warn_cxx98_compat_goto_into_protected_scope : Warning<
5946  "jump from this goto statement to its label is incompatible with C++98">,
5947  InGroup<CXX98Compat>, DefaultIgnore;
5948def err_switch_into_protected_scope : Error<
5949  "cannot jump from switch statement to this case label">;
5950def warn_cxx98_compat_switch_into_protected_scope : Warning<
5951  "jump from switch statement to this case label is incompatible with C++98">,
5952  InGroup<CXX98Compat>, DefaultIgnore;
5953def err_indirect_goto_without_addrlabel : Error<
5954  "indirect goto in function with no address-of-label expressions">;
5955def err_indirect_goto_in_protected_scope : Error<
5956  "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
5957def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
5958  "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
5959  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5960def note_indirect_goto_target : Note<
5961  "possible target of %select{indirect|asm}0 goto statement">;
5962def note_protected_by_variable_init : Note<
5963  "jump bypasses variable initialization">;
5964def note_protected_by_variable_nontriv_destructor : Note<
5965  "jump bypasses variable with a non-trivial destructor">;
5966def note_protected_by_variable_non_pod : Note<
5967  "jump bypasses initialization of non-POD variable">;
5968def note_protected_by_cleanup : Note<
5969  "jump bypasses initialization of variable with __attribute__((cleanup))">;
5970def note_protected_by_vla_typedef : Note<
5971  "jump bypasses initialization of VLA typedef">;
5972def note_protected_by_vla_type_alias : Note<
5973  "jump bypasses initialization of VLA type alias">;
5974def note_protected_by_constexpr_if : Note<
5975  "jump enters controlled statement of constexpr if">;
5976def note_protected_by_consteval_if : Note<
5977  "jump enters controlled statement of consteval if">;
5978def note_protected_by_if_available : Note<
5979  "jump enters controlled statement of if available">;
5980def note_protected_by_vla : Note<
5981  "jump bypasses initialization of variable length array">;
5982def note_protected_by_objc_fast_enumeration : Note<
5983  "jump enters Objective-C fast enumeration loop">;
5984def note_protected_by_objc_try : Note<
5985  "jump bypasses initialization of @try block">;
5986def note_protected_by_objc_catch : Note<
5987  "jump bypasses initialization of @catch block">;
5988def note_protected_by_objc_finally : Note<
5989  "jump bypasses initialization of @finally block">;
5990def note_protected_by_objc_synchronized : Note<
5991  "jump bypasses initialization of @synchronized block">;
5992def note_protected_by_objc_autoreleasepool : Note<
5993  "jump bypasses auto release push of @autoreleasepool block">;
5994def note_protected_by_cxx_try : Note<
5995  "jump bypasses initialization of try block">;
5996def note_protected_by_cxx_catch : Note<
5997  "jump bypasses initialization of catch block">;
5998def note_protected_by_seh_try : Note<
5999  "jump bypasses initialization of __try block">;
6000def note_protected_by_seh_except : Note<
6001  "jump bypasses initialization of __except block">;
6002def note_protected_by_seh_finally : Note<
6003  "jump bypasses initialization of __finally block">;
6004def note_protected_by___block : Note<
6005  "jump bypasses setup of __block variable">;
6006def note_protected_by_objc_strong_init : Note<
6007  "jump bypasses initialization of __strong variable">;
6008def note_protected_by_objc_weak_init : Note<
6009  "jump bypasses initialization of __weak variable">;
6010def note_protected_by_non_trivial_c_struct_init : Note<
6011  "jump bypasses initialization of variable of non-trivial C struct type">;
6012def note_enters_block_captures_cxx_obj : Note<
6013  "jump enters lifetime of block which captures a destructible C++ object">;
6014def note_enters_block_captures_strong : Note<
6015  "jump enters lifetime of block which strongly captures a variable">;
6016def note_enters_block_captures_weak : Note<
6017  "jump enters lifetime of block which weakly captures a variable">;
6018def note_enters_block_captures_non_trivial_c_struct : Note<
6019  "jump enters lifetime of block which captures a C struct that is non-trivial "
6020  "to destroy">;
6021def note_enters_compound_literal_scope : Note<
6022  "jump enters lifetime of a compound literal that is non-trivial to destruct">;
6023
6024def note_exits_cleanup : Note<
6025  "jump exits scope of variable with __attribute__((cleanup))">;
6026def note_exits_dtor : Note<
6027  "jump exits scope of variable with non-trivial destructor">;
6028def note_exits_temporary_dtor : Note<
6029  "jump exits scope of lifetime-extended temporary with non-trivial "
6030  "destructor">;
6031def note_exits___block : Note<
6032  "jump exits scope of __block variable">;
6033def note_exits_objc_try : Note<
6034  "jump exits @try block">;
6035def note_exits_objc_catch : Note<
6036  "jump exits @catch block">;
6037def note_exits_objc_finally : Note<
6038  "jump exits @finally block">;
6039def note_exits_objc_synchronized : Note<
6040  "jump exits @synchronized block">;
6041def note_exits_cxx_try : Note<
6042  "jump exits try block">;
6043def note_exits_cxx_catch : Note<
6044  "jump exits catch block">;
6045def note_exits_seh_try : Note<
6046  "jump exits __try block">;
6047def note_exits_seh_except : Note<
6048  "jump exits __except block">;
6049def note_exits_seh_finally : Note<
6050  "jump exits __finally block">;
6051def note_exits_objc_autoreleasepool : Note<
6052  "jump exits autoreleasepool block">;
6053def note_exits_objc_strong : Note<
6054  "jump exits scope of __strong variable">;
6055def note_exits_objc_weak : Note<
6056  "jump exits scope of __weak variable">;
6057def note_exits_block_captures_cxx_obj : Note<
6058  "jump exits lifetime of block which captures a destructible C++ object">;
6059def note_exits_block_captures_strong : Note<
6060  "jump exits lifetime of block which strongly captures a variable">;
6061def note_exits_block_captures_weak : Note<
6062  "jump exits lifetime of block which weakly captures a variable">;
6063def note_exits_block_captures_non_trivial_c_struct : Note<
6064  "jump exits lifetime of block which captures a C struct that is non-trivial "
6065  "to destroy">;
6066def note_exits_compound_literal_scope : Note<
6067  "jump exits lifetime of a compound literal that is non-trivial to destruct">;
6068
6069def err_func_returning_qualified_void : ExtWarn<
6070  "function cannot return qualified void type %0">,
6071  InGroup<DiagGroup<"qualified-void-return-type">>;
6072def err_func_returning_array_function : Error<
6073  "function cannot return %select{array|function}0 type %1">;
6074def err_field_declared_as_function : Error<"field %0 declared as a function">;
6075def err_field_incomplete_or_sizeless : Error<
6076  "field has %select{incomplete|sizeless}0 type %1">;
6077def ext_variable_sized_type_in_struct : ExtWarn<
6078  "field %0 with variable sized type %1 not at the end of a struct or class is"
6079  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
6080
6081def ext_c99_flexible_array_member : Extension<
6082  "flexible array members are a C99 feature">, InGroup<C99>;
6083def err_flexible_array_virtual_base : Error<
6084  "flexible array member %0 not allowed in "
6085  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
6086def err_flexible_array_empty_aggregate : Error<
6087  "flexible array member %0 not allowed in otherwise empty "
6088  "%select{struct|interface|union|class|enum}1">;
6089def err_flexible_array_has_nontrivial_dtor : Error<
6090  "flexible array member %0 of type %1 with non-trivial destruction">;
6091def ext_flexible_array_in_struct : Extension<
6092  "%0 may not be nested in a struct due to flexible array member">,
6093  InGroup<FlexibleArrayExtensions>;
6094def ext_flexible_array_in_array : Extension<
6095  "%0 may not be used as an array element due to flexible array member">,
6096  InGroup<FlexibleArrayExtensions>;
6097def err_flexible_array_init : Error<
6098  "initialization of flexible array member is not allowed">;
6099def ext_flexible_array_empty_aggregate_ms : Extension<
6100  "flexible array member %0 in otherwise empty "
6101  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
6102  InGroup<MicrosoftFlexibleArray>;
6103def err_flexible_array_union : Error<
6104  "flexible array member %0 in a union is not allowed">;
6105def ext_flexible_array_union_ms : Extension<
6106  "flexible array member %0 in a union is a Microsoft extension">,
6107  InGroup<MicrosoftFlexibleArray>;
6108def ext_flexible_array_empty_aggregate_gnu : Extension<
6109  "flexible array member %0 in otherwise empty "
6110  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
6111  InGroup<GNUEmptyStruct>;
6112def ext_flexible_array_union_gnu : Extension<
6113  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
6114
6115def err_flexible_array_not_at_end : Error<
6116  "flexible array member %0 with type %1 is not at the end of"
6117  " %select{struct|interface|union|class|enum}2">;
6118def err_objc_variable_sized_type_not_at_end : Error<
6119  "field %0 with variable sized type %1 is not at the end of class">;
6120def note_next_field_declaration : Note<
6121  "next field declaration is here">;
6122def note_next_ivar_declaration : Note<
6123  "next %select{instance variable declaration|synthesized instance variable}0"
6124  " is here">;
6125def err_synthesize_variable_sized_ivar : Error<
6126  "synthesized property with variable size type %0"
6127  " requires an existing instance variable">;
6128def err_flexible_array_arc_retainable : Error<
6129  "ARC forbids flexible array members with retainable object type">;
6130def warn_variable_sized_ivar_visibility : Warning<
6131  "field %0 with variable sized type %1 is not visible to subclasses and"
6132  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
6133def warn_superclass_variable_sized_type_not_at_end : Warning<
6134  "field %0 can overwrite instance variable %1 with variable sized type %2"
6135  " in superclass %3">, InGroup<ObjCFlexibleArray>;
6136
6137let CategoryName = "ARC Semantic Issue" in {
6138
6139// ARC-mode diagnostics.
6140
6141let CategoryName = "ARC Weak References" in {
6142
6143def err_arc_weak_no_runtime : Error<
6144  "cannot create __weak reference because the current deployment target "
6145  "does not support weak references">;
6146def err_arc_weak_disabled : Error<
6147  "cannot create __weak reference in file using manual reference counting">;
6148def err_synthesizing_arc_weak_property_disabled : Error<
6149  "cannot synthesize weak property in file using manual reference counting">;
6150def err_synthesizing_arc_weak_property_no_runtime : Error<
6151  "cannot synthesize weak property because the current deployment target "
6152  "does not support weak references">;
6153def err_arc_unsupported_weak_class : Error<
6154  "class is incompatible with __weak references">;
6155def err_arc_weak_unavailable_assign : Error<
6156  "assignment of a weak-unavailable object to a __weak object">;
6157def err_arc_weak_unavailable_property : Error<
6158  "synthesizing __weak instance variable of type %0, which does not "
6159  "support weak references">;
6160def note_implemented_by_class : Note<
6161  "when implemented by class %0">;
6162def err_arc_convesion_of_weak_unavailable : Error<
6163  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
6164  " a __weak object of type %2">;
6165
6166} // end "ARC Weak References" category
6167
6168let CategoryName = "ARC Restrictions" in {
6169
6170def err_unavailable_in_arc : Error<
6171  "%0 is unavailable in ARC">;
6172def note_arc_forbidden_type : Note<
6173  "declaration uses type that is ill-formed in ARC">;
6174def note_performs_forbidden_arc_conversion : Note<
6175  "inline function performs a conversion which is forbidden in ARC">;
6176def note_arc_init_returns_unrelated : Note<
6177  "init method must return a type related to its receiver type">;
6178def note_arc_weak_disabled : Note<
6179  "declaration uses __weak, but ARC is disabled">;
6180def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
6181  "the current deployment target does not support">;
6182def note_arc_field_with_ownership : Note<
6183  "field has non-trivial ownership qualification">;
6184
6185def err_arc_illegal_explicit_message : Error<
6186  "ARC forbids explicit message send of %0">;
6187def err_arc_unused_init_message : Error<
6188  "the result of a delegate init call must be immediately returned "
6189  "or assigned to 'self'">;
6190def err_arc_mismatched_cast : Error<
6191  "%select{implicit conversion|cast}0 of "
6192  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
6193  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
6194  " to %3 is disallowed with ARC">;
6195def err_arc_nolifetime_behavior : Error<
6196  "explicit ownership qualifier on cast result has no effect">;
6197def err_arc_objc_property_default_assign_on_object : Error<
6198  "ARC forbids synthesizing a property of an Objective-C object "
6199  "with unspecified ownership or storage attribute">;
6200def err_arc_illegal_selector : Error<
6201  "ARC forbids use of %0 in a @selector">;
6202def err_arc_illegal_method_def : Error<
6203  "ARC forbids %select{implementation|synthesis}0 of %1">;
6204def warn_arc_strong_pointer_objc_pointer : Warning<
6205  "method parameter of type %0 with no explicit ownership">,
6206  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
6207
6208} // end "ARC Restrictions" category
6209
6210def err_arc_lost_method_convention : Error<
6211  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
6212  "method, but its implementation doesn't match because %select{"
6213  "its result type is not an object pointer|"
6214  "its result type is unrelated to its receiver type}1">;
6215def note_arc_lost_method_convention : Note<"declaration in interface">;
6216def err_arc_gained_method_convention : Error<
6217  "method implementation does not match its declaration">;
6218def note_arc_gained_method_convention : Note<
6219  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
6220  "family because %select{its result type is not an object pointer|"
6221  "its result type is unrelated to its receiver type}1">;
6222def err_typecheck_arc_assign_self : Error<
6223  "cannot assign to 'self' outside of a method in the init family">;
6224def err_typecheck_arc_assign_self_class_method : Error<
6225  "cannot assign to 'self' in a class method">;
6226def err_typecheck_arr_assign_enumeration : Error<
6227  "fast enumeration variables cannot be modified in ARC by default; "
6228  "declare the variable __strong to allow this">;
6229def err_typecheck_arc_assign_externally_retained : Error<
6230  "variable declared with 'objc_externally_retained' "
6231  "cannot be modified in ARC">;
6232def warn_arc_retained_assign : Warning<
6233  "assigning retained object to %select{weak|unsafe_unretained}0 "
6234  "%select{property|variable}1"
6235  "; object will be released after assignment">,
6236  InGroup<ARCUnsafeRetainedAssign>;
6237def warn_arc_retained_property_assign : Warning<
6238  "assigning retained object to unsafe property"
6239  "; object will be released after assignment">,
6240  InGroup<ARCUnsafeRetainedAssign>;
6241def warn_arc_literal_assign : Warning<
6242  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
6243  " to a weak %select{property|variable}1"
6244  "; object will be released after assignment">,
6245  InGroup<ARCUnsafeRetainedAssign>;
6246def err_arc_new_array_without_ownership : Error<
6247  "'new' cannot allocate an array of %0 with no explicit ownership">;
6248def err_arc_autoreleasing_var : Error<
6249  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
6250  "__autoreleasing ownership">;
6251def err_arc_autoreleasing_capture : Error<
6252  "cannot capture __autoreleasing variable in a "
6253  "%select{block|lambda by copy}0">;
6254def err_arc_thread_ownership : Error<
6255  "thread-local variable has non-trivial ownership: type is %0">;
6256def err_arc_indirect_no_ownership : Error<
6257  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6258def err_arc_array_param_no_ownership : Error<
6259  "must explicitly describe intended ownership of an object array parameter">;
6260def err_arc_pseudo_dtor_inconstant_quals : Error<
6261  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6262  "type %1">;
6263def err_arc_init_method_unrelated_result_type : Error<
6264  "init methods must return a type related to the receiver type">;
6265def err_arc_nonlocal_writeback : Error<
6266  "passing address of %select{non-local|non-scalar}0 object to "
6267  "__autoreleasing parameter for write-back">;
6268def err_arc_method_not_found : Error<
6269  "no known %select{instance|class}1 method for selector %0">;
6270def err_arc_receiver_forward_class : Error<
6271  "receiver %0 for class message is a forward declaration">;
6272def err_arc_may_not_respond : Error<
6273  "no visible @interface for %0 declares the selector %1">;
6274def err_arc_receiver_forward_instance : Error<
6275  "receiver type %0 for instance message is a forward declaration">;
6276def warn_receiver_forward_instance : Warning<
6277  "receiver type %0 for instance message is a forward declaration">,
6278  InGroup<ForwardClassReceiver>, DefaultIgnore;
6279def err_arc_collection_forward : Error<
6280  "collection expression type %0 is a forward declaration">;
6281def err_arc_multiple_method_decl : Error<
6282  "multiple methods named %0 found with mismatched result, "
6283  "parameter type or attributes">;
6284def warn_arc_lifetime_result_type : Warning<
6285  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6286  "lifetime qualifier on return type is ignored">,
6287  InGroup<IgnoredQualifiers>;
6288
6289let CategoryName = "ARC Retain Cycle" in {
6290
6291def warn_arc_retain_cycle : Warning<
6292  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6293  InGroup<ARCRetainCycles>;
6294def note_arc_retain_cycle_owner : Note<
6295  "block will be retained by %select{the captured object|an object strongly "
6296  "retained by the captured object}0">;
6297
6298} // end "ARC Retain Cycle" category
6299
6300def warn_arc_object_memaccess : Warning<
6301  "%select{destination for|source of}0 this %1 call is a pointer to "
6302  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6303
6304let CategoryName = "ARC and @properties" in {
6305
6306def err_arc_strong_property_ownership : Error<
6307  "existing instance variable %1 for strong property %0 may not be "
6308  "%select{|__unsafe_unretained||__weak}2">;
6309def err_arc_assign_property_ownership : Error<
6310  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6311  "attribute must be __unsafe_unretained">;
6312def err_arc_inconsistent_property_ownership : Error<
6313  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6314  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6315
6316} // end "ARC and @properties" category
6317
6318def warn_block_capture_autoreleasing : Warning<
6319  "block captures an autoreleasing out-parameter, which may result in "
6320  "use-after-free bugs">,
6321  InGroup<BlockCaptureAutoReleasing>;
6322def note_declare_parameter_strong : Note<
6323  "declare the parameter __strong or capture a __block __strong variable to "
6324  "keep values alive across autorelease pools">;
6325
6326def err_arc_atomic_ownership : Error<
6327  "cannot perform atomic operation on a pointer to type %0: type has "
6328  "non-trivial ownership">;
6329
6330let CategoryName = "ARC Casting Rules" in {
6331
6332def err_arc_bridge_cast_incompatible : Error<
6333  "incompatible types casting %0 to %1 with a %select{__bridge|"
6334  "__bridge_transfer|__bridge_retained}2 cast">;
6335def err_arc_bridge_cast_wrong_kind : Error<
6336  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6337  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6338  "__bridge_transfer|__bridge_retained}4">;
6339def err_arc_cast_requires_bridge : Error<
6340  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6341  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6342  "requires a bridged cast">;
6343def note_arc_bridge : Note<
6344  "use __bridge to convert directly (no change in ownership)">;
6345def note_arc_cstyle_bridge : Note<
6346  "use __bridge with C-style cast to convert directly (no change in ownership)">;
6347def note_arc_bridge_transfer : Note<
6348  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6349  "ownership of a +1 %0 into ARC">;
6350def note_arc_cstyle_bridge_transfer : Note<
6351  "use __bridge_transfer with C-style cast to transfer "
6352  "ownership of a +1 %0 into ARC">;
6353def note_arc_bridge_retained : Note<
6354  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6355  "ARC object available as a +1 %0">;
6356def note_arc_cstyle_bridge_retained : Note<
6357  "use __bridge_retained with C-style cast to make an "
6358  "ARC object available as a +1 %0">;
6359
6360} // ARC Casting category
6361
6362} // ARC category name
6363
6364def err_flexible_array_init_needs_braces : Error<
6365  "flexible array requires brace-enclosed initializer">;
6366def err_illegal_decl_array_of_functions : Error<
6367  "'%0' declared as array of functions of type %1">;
6368def err_array_incomplete_or_sizeless_type : Error<
6369  "array has %select{incomplete|sizeless}0 element type %1">;
6370def err_illegal_message_expr_incomplete_type : Error<
6371  "Objective-C message has incomplete result type %0">;
6372def err_illegal_decl_array_of_references : Error<
6373  "'%0' declared as array of references of type %1">;
6374def err_decl_negative_array_size : Error<
6375  "'%0' declared as an array with a negative size">;
6376def err_array_static_outside_prototype : Error<
6377  "%0 used in array declarator outside of function prototype">;
6378def err_array_static_not_outermost : Error<
6379  "%0 used in non-outermost array type derivation">;
6380def err_array_star_outside_prototype : Error<
6381  "star modifier used outside of function prototype">;
6382def err_illegal_decl_pointer_to_reference : Error<
6383  "'%0' declared as a pointer to a reference of type %1">;
6384def err_illegal_decl_mempointer_to_reference : Error<
6385  "'%0' declared as a member pointer to a reference of type %1">;
6386def err_illegal_decl_mempointer_to_void : Error<
6387  "'%0' declared as a member pointer to void">;
6388def err_illegal_decl_mempointer_in_nonclass : Error<
6389  "'%0' does not point into a class">;
6390def err_mempointer_in_nonclass_type : Error<
6391  "member pointer refers into non-class type %0">;
6392def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6393def err_nonfunction_block_type : Error<
6394  "block pointer to non-function type is invalid">;
6395def err_return_block_has_expr : Error<"void block should not return a value">;
6396def err_block_return_missing_expr : Error<
6397  "non-void block should return a value">;
6398def err_func_def_incomplete_result : Error<
6399  "incomplete result type %0 in function definition">;
6400def err_atomic_specifier_bad_type
6401    : Error<"_Atomic cannot be applied to "
6402            "%select{incomplete |array |function |reference |atomic |qualified "
6403            "|sizeless ||integer }0type "
6404            "%1 %select{|||||||which is not trivially copyable|}0">;
6405
6406// Expressions.
6407def ext_sizeof_alignof_function_type : Extension<
6408  "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6409def ext_sizeof_alignof_void_type : Extension<
6410  "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6411def err_opencl_sizeof_alignof_type : Error<
6412  "invalid application of '%0' to a void type">;
6413def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6414  "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6415def err_sizeof_alignof_function_type : Error<
6416  "invalid application of '%0' to a function type">;
6417def err_openmp_default_simd_align_expr : Error<
6418  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6419def err_sizeof_alignof_typeof_bitfield : Error<
6420  "invalid application of '%select{sizeof|alignof|typeof}0' to bit-field">;
6421def err_alignof_member_of_incomplete_type : Error<
6422  "invalid application of 'alignof' to a field of a class still being defined">;
6423def err_vecstep_non_scalar_vector_type : Error<
6424  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6425def err_offsetof_incomplete_type : Error<
6426  "offsetof of incomplete type %0">;
6427def err_offsetof_record_type : Error<
6428  "offsetof requires struct, union, or class type, %0 invalid">;
6429def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6430def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6431  InGroup<InvalidOffsetof>;
6432def ext_offsetof_non_standardlayout_type : ExtWarn<
6433  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6434def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6435def err_offsetof_field_of_virtual_base : Error<
6436  "invalid application of 'offsetof' to a field of a virtual base">;
6437def warn_sub_ptr_zero_size_types : Warning<
6438  "subtraction of pointers to type %0 of zero size has undefined behavior">,
6439  InGroup<PointerArith>;
6440def warn_pointer_arith_null_ptr : Warning<
6441  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6442  InGroup<NullPointerArithmetic>, DefaultIgnore;
6443def warn_gnu_null_ptr_arith : Warning<
6444  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6445  InGroup<NullPointerArithmetic>, DefaultIgnore;
6446def warn_pointer_sub_null_ptr : Warning<
6447  "performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior">,
6448  InGroup<NullPointerSubtraction>, DefaultIgnore;
6449
6450def warn_floatingpoint_eq : Warning<
6451  "comparing floating point with == or != is unsafe">,
6452  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6453
6454def warn_remainder_division_by_zero : Warning<
6455  "%select{remainder|division}0 by zero is undefined">,
6456  InGroup<DivZero>;
6457def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6458  InGroup<DiagGroup<"shift-negative-value">>;
6459def warn_shift_negative : Warning<"shift count is negative">,
6460  InGroup<DiagGroup<"shift-count-negative">>;
6461def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6462  InGroup<DiagGroup<"shift-count-overflow">>;
6463def warn_shift_result_gt_typewidth : Warning<
6464  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6465  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6466def warn_shift_result_sets_sign_bit : Warning<
6467  "signed shift result (%0) sets the sign bit of the shift expression's "
6468  "type (%1) and becomes negative">,
6469  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6470
6471def warn_precedence_bitwise_rel : Warning<
6472  "%0 has lower precedence than %1; %1 will be evaluated first">,
6473  InGroup<Parentheses>;
6474def note_precedence_bitwise_first : Note<
6475  "place parentheses around the %0 expression to evaluate it first">;
6476def note_precedence_silence : Note<
6477  "place parentheses around the '%0' expression to silence this warning">;
6478
6479def warn_precedence_conditional : Warning<
6480  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6481  InGroup<Parentheses>;
6482def warn_precedence_bitwise_conditional : Warning<
6483  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6484  InGroup<BitwiseConditionalParentheses>;
6485def note_precedence_conditional_first : Note<
6486  "place parentheses around the '?:' expression to evaluate it first">;
6487
6488def warn_enum_constant_in_bool_context : Warning<
6489  "converting the enum constant to a boolean">,
6490  InGroup<IntInBoolContext>, DefaultIgnore;
6491def warn_left_shift_in_bool_context : Warning<
6492  "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6493  InGroup<IntInBoolContext>, DefaultIgnore;
6494def warn_logical_instead_of_bitwise : Warning<
6495  "use of logical '%0' with constant operand">,
6496  InGroup<DiagGroup<"constant-logical-operand">>;
6497def note_logical_instead_of_bitwise_change_operator : Note<
6498  "use '%0' for a bitwise operation">;
6499def note_logical_instead_of_bitwise_remove_constant : Note<
6500  "remove constant to silence this warning">;
6501
6502def warn_bitwise_op_in_bitwise_op : Warning<
6503  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6504
6505def warn_logical_and_in_logical_or : Warning<
6506  "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6507
6508def warn_overloaded_shift_in_comparison :Warning<
6509  "overloaded operator %select{>>|<<}0 has higher precedence than "
6510  "comparison operator">,
6511  InGroup<OverloadedShiftOpParentheses>;
6512def note_evaluate_comparison_first :Note<
6513  "place parentheses around comparison expression to evaluate it first">;
6514
6515def note_concatenated_string_literal_silence :Note<
6516  "place parentheses around the string literal to silence warning">;
6517
6518def warn_addition_in_bitshift : Warning<
6519  "operator '%0' has lower precedence than '%1'; "
6520  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6521
6522def warn_self_assignment_builtin : Warning<
6523  "explicitly assigning value of variable of type %0 to itself">,
6524  InGroup<SelfAssignment>, DefaultIgnore;
6525def warn_self_assignment_overloaded : Warning<
6526  "explicitly assigning value of variable of type %0 to itself">,
6527  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6528def warn_self_move : Warning<
6529  "explicitly moving variable of type %0 to itself">,
6530  InGroup<SelfMove>, DefaultIgnore;
6531
6532def warn_redundant_move_on_return : Warning<
6533  "redundant move in return statement">,
6534  InGroup<RedundantMove>, DefaultIgnore;
6535def warn_pessimizing_move_on_return : Warning<
6536  "moving a local object in a return statement prevents copy elision">,
6537  InGroup<PessimizingMove>, DefaultIgnore;
6538def warn_pessimizing_move_on_initialization : Warning<
6539  "moving a temporary object prevents copy elision">,
6540  InGroup<PessimizingMove>, DefaultIgnore;
6541def note_remove_move : Note<"remove std::move call here">;
6542
6543def warn_string_plus_int : Warning<
6544  "adding %0 to a string does not append to the string">,
6545  InGroup<StringPlusInt>;
6546def warn_string_plus_char : Warning<
6547  "adding %0 to a string pointer does not append to the string">,
6548  InGroup<StringPlusChar>;
6549def note_string_plus_scalar_silence : Note<
6550  "use array indexing to silence this warning">;
6551
6552def warn_sizeof_array_param : Warning<
6553  "sizeof on array function parameter will return size of %0 instead of %1">,
6554  InGroup<SizeofArrayArgument>;
6555
6556def warn_sizeof_array_decay : Warning<
6557  "sizeof on pointer operation will return size of %0 instead of %1">,
6558  InGroup<SizeofArrayDecay>;
6559
6560def err_sizeof_nonfragile_interface : Error<
6561  "application of '%select{alignof|sizeof}1' to interface %0 is "
6562  "not supported on this architecture and platform">;
6563def err_atdef_nonfragile_interface : Error<
6564  "use of @defs is not supported on this architecture and platform">;
6565def err_subscript_nonfragile_interface : Error<
6566  "subscript requires size of interface %0, which is not constant for "
6567  "this architecture and platform">;
6568
6569def err_arithmetic_nonfragile_interface : Error<
6570  "arithmetic on pointer to interface %0, which is not a constant size for "
6571  "this architecture and platform">;
6572
6573def warn_deprecated_comma_subscript : Warning<
6574  "top-level comma expression in array subscript is deprecated">,
6575  InGroup<DeprecatedCommaSubscript>;
6576
6577def ext_subscript_non_lvalue : Extension<
6578  "ISO C90 does not allow subscripting non-lvalue array">;
6579def err_typecheck_subscript_value : Error<
6580  "subscripted value is not an array, pointer, or vector">;
6581def err_typecheck_subscript_not_integer : Error<
6582  "array subscript is not an integer">;
6583def err_subscript_function_type : Error<
6584  "subscript of pointer to function type %0">;
6585def err_subscript_incomplete_or_sizeless_type : Error<
6586  "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6587def err_dereference_incomplete_type : Error<
6588  "dereference of pointer to incomplete type %0">;
6589def ext_gnu_subscript_void_type : Extension<
6590  "subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
6591def err_typecheck_member_reference_struct_union : Error<
6592  "member reference base type %0 is not a structure or union">;
6593def err_typecheck_member_reference_ivar : Error<
6594  "%0 does not have a member named %1">;
6595def err_arc_weak_ivar_access : Error<
6596  "dereferencing a __weak pointer is not allowed due to possible "
6597  "null value caused by race condition, assign it to strong variable first">;
6598def err_typecheck_member_reference_arrow : Error<
6599  "member reference type %0 is not a pointer">;
6600def err_typecheck_member_reference_suggestion : Error<
6601  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6602def note_typecheck_member_reference_suggestion : Note<
6603  "did you mean to use '.' instead?">;
6604def note_member_reference_arrow_from_operator_arrow : Note<
6605  "'->' applied to return value of the operator->() declared here">;
6606def err_typecheck_member_reference_type : Error<
6607  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6608def err_typecheck_member_reference_unknown : Error<
6609  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6610def err_member_reference_needs_call : Error<
6611  "base of member reference is a function; perhaps you meant to call "
6612  "it%select{| with no arguments}0?">;
6613def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6614  InGroup<CharSubscript>, DefaultIgnore;
6615
6616def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6617def err_no_member : Error<"no member named %0 in %1">;
6618def err_no_member_overloaded_arrow : Error<
6619  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6620
6621def err_member_not_yet_instantiated : Error<
6622  "no member %0 in %1; it has not yet been instantiated">;
6623def note_non_instantiated_member_here : Note<
6624  "not-yet-instantiated member is declared here">;
6625
6626def err_enumerator_does_not_exist : Error<
6627  "enumerator %0 does not exist in instantiation of %1">;
6628def note_enum_specialized_here : Note<
6629  "enum %0 was explicitly specialized here">;
6630
6631def err_specialization_not_primary_template : Error<
6632  "cannot reference member of primary template because deduced class "
6633  "template specialization %0 is %select{instantiated from a partial|"
6634  "an explicit}1 specialization">;
6635
6636def err_member_redeclared : Error<"class member cannot be redeclared">;
6637def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6638  InGroup<RedeclaredClassMember>;
6639def err_member_redeclared_in_instantiation : Error<
6640  "multiple overloads of %0 instantiate to the same signature %1">;
6641def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6642def err_member_def_undefined_record : Error<
6643  "out-of-line definition of %0 from class %1 without definition">;
6644def err_member_decl_does_not_match : Error<
6645  "out-of-line %select{declaration|definition}2 of %0 "
6646  "does not match any declaration in %1">;
6647def err_friend_decl_with_def_arg_must_be_def : Error<
6648  "friend declaration specifying a default argument must be a definition">;
6649def err_friend_decl_with_def_arg_redeclared : Error<
6650  "friend declaration specifying a default argument must be the only declaration">;
6651def err_friend_decl_does_not_match : Error<
6652  "friend declaration of %0 does not match any declaration in %1">;
6653def err_member_decl_does_not_match_suggest : Error<
6654  "out-of-line %select{declaration|definition}2 of %0 "
6655  "does not match any declaration in %1; did you mean %3?">;
6656def err_member_def_does_not_match_ret_type : Error<
6657  "return type of out-of-line definition of %q0 differs from "
6658  "that in the declaration">;
6659def err_nonstatic_member_out_of_line : Error<
6660  "non-static data member defined out-of-line">;
6661def err_qualified_typedef_declarator : Error<
6662  "typedef declarator cannot be qualified">;
6663def err_qualified_param_declarator : Error<
6664  "parameter declarator cannot be qualified">;
6665def ext_out_of_line_declaration : ExtWarn<
6666  "out-of-line declaration of a member must be a definition">,
6667  InGroup<OutOfLineDeclaration>, DefaultError;
6668def err_member_extra_qualification : Error<
6669  "extra qualification on member %0">;
6670def warn_member_extra_qualification : Warning<
6671  err_member_extra_qualification.Text>, InGroup<MicrosoftExtraQualification>;
6672def warn_namespace_member_extra_qualification : Warning<
6673  "extra qualification on member %0">,
6674  InGroup<DiagGroup<"extra-qualification">>;
6675def err_member_qualification : Error<
6676  "non-friend class member %0 cannot have a qualified name">;
6677def note_member_def_close_match : Note<"member declaration nearly matches">;
6678def note_member_def_close_const_match : Note<
6679  "member declaration does not match because "
6680  "it %select{is|is not}0 const qualified">;
6681def note_member_def_close_param_match : Note<
6682  "type of %ordinal0 parameter of member declaration does not match definition"
6683  "%diff{ ($ vs $)|}1,2">;
6684def note_local_decl_close_match : Note<"local declaration nearly matches">;
6685def note_local_decl_close_param_match : Note<
6686  "type of %ordinal0 parameter of local declaration does not match definition"
6687  "%diff{ ($ vs $)|}1,2">;
6688def err_typecheck_ivar_variable_size : Error<
6689  "instance variables must have a constant size">;
6690def err_ivar_reference_type : Error<
6691  "instance variables cannot be of reference type">;
6692def err_typecheck_illegal_increment_decrement : Error<
6693  "cannot %select{decrement|increment}1 value of type %0">;
6694def err_typecheck_expect_int : Error<
6695  "used type %0 where integer is required">;
6696def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
6697  "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
6698def err_typecheck_pointer_arith_function_type : Error<
6699  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
6700  "function type%select{|s}2 %1%select{| and %3}2">;
6701def err_typecheck_pointer_arith_void_type : Error<
6702  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
6703def err_typecheck_decl_incomplete_type : Error<
6704  "variable has incomplete type %0">;
6705def ext_typecheck_decl_incomplete_type : ExtWarn<
6706  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
6707  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
6708def err_tentative_def_incomplete_type : Error<
6709  "tentative definition has type %0 that is never completed">;
6710def warn_tentative_incomplete_array : Warning<
6711  "tentative array definition assumed to have one element">;
6712def err_typecheck_incomplete_array_needs_initializer : Error<
6713  "definition of variable with array type needs an explicit size "
6714  "or an initializer">;
6715def err_array_init_not_init_list : Error<
6716  "array initializer must be an initializer "
6717  "list%select{| or string literal| or wide string literal}0">;
6718def err_array_init_narrow_string_into_wchar : Error<
6719  "initializing wide char array with non-wide string literal">;
6720def err_array_init_wide_string_into_char : Error<
6721  "initializing char array with wide string literal">;
6722def err_array_init_incompat_wide_string_into_wchar : Error<
6723  "initializing wide char array with incompatible wide string literal">;
6724def err_array_init_plain_string_into_char8_t : Error<
6725  "initializing 'char8_t' array with plain string literal">;
6726def note_array_init_plain_string_into_char8_t : Note<
6727  "add 'u8' prefix to form a 'char8_t' string literal">;
6728def err_array_init_utf8_string_into_char : Error<
6729  "%select{|ISO C++20 does not permit }0initialization of char array with "
6730  "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">;
6731def warn_cxx20_compat_utf8_string : Warning<
6732  "type of UTF-8 string literal will change from array of const char to "
6733  "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
6734def note_cxx20_compat_utf8_string_remove_u8 : Note<
6735  "remove 'u8' prefix to avoid a change of behavior; "
6736  "Clang encodes unprefixed narrow string literals as UTF-8">;
6737def err_array_init_different_type : Error<
6738  "cannot initialize array %diff{of type $ with array of type $|"
6739  "with different type of array}0,1">;
6740def err_array_init_non_constant_array : Error<
6741  "cannot initialize array %diff{of type $ with non-constant array of type $|"
6742  "with different type of array}0,1">;
6743def ext_array_init_copy : Extension<
6744  "initialization of an array "
6745  "%diff{of type $ from a compound literal of type $|"
6746  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
6747// This is intentionally not disabled by -Wno-gnu.
6748def ext_array_init_parens : ExtWarn<
6749  "parenthesized initialization of a member array is a GNU extension">,
6750  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
6751def warn_deprecated_string_literal_conversion : Warning<
6752  "conversion from string literal to %0 is deprecated">,
6753  InGroup<CXX11CompatDeprecatedWritableStr>;
6754def ext_deprecated_string_literal_conversion : ExtWarn<
6755  "ISO C++11 does not allow conversion from string literal to %0">,
6756  InGroup<WritableStrings>, SFINAEFailure;
6757def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
6758def err_typecheck_sclass_fscope : Error<
6759  "illegal storage class on file-scoped variable">;
6760def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
6761  InGroup<MissingDeclarations>;
6762def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
6763  "of a type">, InGroup<MissingDeclarations>;
6764def err_standalone_class_nested_name_specifier : Error<
6765  "forward declaration of %select{class|struct|interface|union|enum}0 cannot "
6766  "have a nested name specifier">;
6767def err_typecheck_sclass_func : Error<"illegal storage class on function">;
6768def err_static_block_func : Error<
6769  "function declared in block scope cannot have 'static' storage class">;
6770def err_typecheck_address_of : Error<"address of %select{bit-field"
6771  "|vector element|property expression|register variable|matrix element}0 requested">;
6772def ext_typecheck_addrof_void : Extension<
6773  "ISO C forbids taking the address of an expression of type 'void'">;
6774def err_unqualified_pointer_member_function : Error<
6775  "must explicitly qualify name of member function when taking its address">;
6776def err_invalid_form_pointer_member_function : Error<
6777  "cannot create a non-constant pointer to member function">;
6778def err_address_of_function_with_pass_object_size_params: Error<
6779  "cannot take address of function %0 because parameter %1 has "
6780  "pass_object_size attribute">;
6781def err_parens_pointer_member_function : Error<
6782  "cannot parenthesize the name of a method when forming a member pointer">;
6783def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
6784  "extra '&' taking address of overloaded function">;
6785def err_typecheck_invalid_lvalue_addrof : Error<
6786  "cannot take the address of an rvalue of type %0">;
6787def ext_typecheck_addrof_temporary : ExtWarn<
6788  "taking the address of a temporary object of type %0">,
6789  InGroup<AddressOfTemporary>, DefaultError;
6790def err_typecheck_addrof_temporary : Error<
6791  "taking the address of a temporary object of type %0">;
6792def err_typecheck_addrof_dtor : Error<
6793  "taking the address of a destructor">;
6794def err_typecheck_unary_expr : Error<
6795  "invalid argument type %0 to unary expression">;
6796def err_typecheck_indirection_requires_pointer : Error<
6797  "indirection requires pointer operand (%0 invalid)">;
6798def ext_typecheck_indirection_through_void_pointer : ExtWarn<
6799  "ISO C++ does not allow indirection on operand of type %0">,
6800  InGroup<DiagGroup<"void-ptr-dereference">>;
6801def warn_indirection_through_null : Warning<
6802  "indirection of non-volatile null pointer will be deleted, not trap">,
6803  InGroup<NullDereference>;
6804def warn_binding_null_to_reference : Warning<
6805  "binding dereferenced null pointer to reference has undefined behavior">,
6806  InGroup<NullDereference>;
6807def note_indirection_through_null : Note<
6808  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
6809def warn_pointer_indirection_from_incompatible_type : Warning<
6810  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
6811  "behavior">,
6812  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6813def warn_taking_address_of_packed_member : Warning<
6814  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
6815  InGroup<DiagGroup<"address-of-packed-member">>;
6816def warn_param_mismatched_alignment : Warning<
6817  "passing %0-byte aligned argument to %1-byte aligned parameter %2%select{| of %4}3 may result in an unaligned pointer access">,
6818  InGroup<DiagGroup<"align-mismatch">>;
6819
6820def err_objc_object_assignment : Error<
6821  "cannot assign to class object (%0 invalid)">;
6822def err_typecheck_invalid_operands : Error<
6823  "invalid operands to binary expression (%0 and %1)">, Deferrable;
6824def note_typecheck_invalid_operands_converted : Note<
6825  "%select{first|second}0 operand was implicitly converted to type %1">;
6826def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
6827  "logical expression with vector %select{type %1 and non-vector type %2|types"
6828  " %1 and %2}0 is only supported in C++">;
6829def err_typecheck_sub_ptr_compatible : Error<
6830  "%diff{$ and $ are not pointers to compatible types|"
6831  "pointers to incompatible types}0,1">;
6832def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
6833  "ordered comparison between pointer and integer (%0 and %1)">;
6834def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
6835  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
6836def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
6837  "ordered comparison between pointer and zero (%0 and %1)">;
6838def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
6839  "three-way comparison between pointer and zero">;
6840def ext_typecheck_compare_complete_incomplete_pointers : Extension<
6841  "pointer comparisons before C11 "
6842  "need to be between two complete or two incomplete types; "
6843  "%0 is %select{|in}2complete and "
6844  "%1 is %select{|in}3complete">,
6845  InGroup<C11>;
6846def warn_typecheck_ordered_comparison_of_function_pointers : Warning<
6847  "ordered comparison of function pointers (%0 and %1)">,
6848  InGroup<OrderedCompareFunctionPointers>;
6849def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
6850  "ordered comparison of function pointers (%0 and %1)">,
6851  InGroup<OrderedCompareFunctionPointers>;
6852def err_typecheck_ordered_comparison_of_function_pointers : Error<
6853  "ordered comparison of function pointers (%0 and %1)">;
6854def ext_typecheck_comparison_of_fptr_to_void : Extension<
6855  "equality comparison between function pointer and void pointer (%0 and %1)">;
6856def err_typecheck_comparison_of_fptr_to_void : Error<
6857  "equality comparison between function pointer and void pointer (%0 and %1)">;
6858def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
6859  "comparison between pointer and integer (%0 and %1)">,
6860  InGroup<DiagGroup<"pointer-integer-compare">>;
6861def err_typecheck_comparison_of_pointer_integer : Error<
6862  "comparison between pointer and integer (%0 and %1)">;
6863def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
6864  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
6865  InGroup<CompareDistinctPointerType>;
6866def ext_typecheck_cond_incompatible_operands : ExtWarn<
6867  "incompatible operand types (%0 and %1)">;
6868def err_cond_voidptr_arc : Error <
6869  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
6870  "in ARC mode">;
6871def err_typecheck_comparison_of_distinct_pointers : Error<
6872  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
6873def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
6874  "%select{comparison between %diff{ ($ and $)|}0,1"
6875  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
6876  "|conditional operator with the second and third operands of type "
6877  "%diff{ ($ and $)|}0,1}2"
6878  " which are pointers to non-overlapping address spaces">;
6879
6880def select_arith_conv_kind : TextSubstitution<
6881  "%select{arithmetic between|bitwise operation between|comparison of|"
6882  "conditional expression between|compound assignment of}0">;
6883def warn_arith_conv_enum_float : Warning<
6884  "%sub{select_arith_conv_kind}0 "
6885  "%select{floating-point|enumeration}1 type %2 "
6886  "%plural{2:with|4:from|:and}0 "
6887  "%select{enumeration|floating-point}1 type %3">,
6888  InGroup<EnumFloatConversion>, DefaultIgnore;
6889def warn_arith_conv_enum_float_cxx20 : Warning<
6890  "%sub{select_arith_conv_kind}0 "
6891  "%select{floating-point|enumeration}1 type %2 "
6892  "%plural{2:with|4:from|:and}0 "
6893  "%select{enumeration|floating-point}1 type %3 is deprecated">,
6894  InGroup<DeprecatedEnumFloatConversion>;
6895def warn_arith_conv_mixed_enum_types : Warning<
6896  "%sub{select_arith_conv_kind}0 "
6897  "different enumeration types%diff{ ($ and $)|}1,2">,
6898  InGroup<EnumEnumConversion>, DefaultIgnore;
6899def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
6900  "%sub{select_arith_conv_kind}0 "
6901  "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
6902  InGroup<DeprecatedEnumEnumConversion>;
6903def warn_arith_conv_mixed_anon_enum_types : Warning<
6904  warn_arith_conv_mixed_enum_types.Text>,
6905  InGroup<AnonEnumEnumConversion>, DefaultIgnore;
6906def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
6907  warn_arith_conv_mixed_enum_types_cxx20.Text>,
6908  InGroup<DeprecatedAnonEnumEnumConversion>;
6909def warn_conditional_mixed_enum_types : Warning<
6910  warn_arith_conv_mixed_enum_types.Text>,
6911  InGroup<EnumCompareConditional>, DefaultIgnore;
6912def warn_conditional_mixed_enum_types_cxx20 : Warning<
6913  warn_arith_conv_mixed_enum_types_cxx20.Text>,
6914  InGroup<DeprecatedEnumCompareConditional>;
6915def warn_comparison_mixed_enum_types : Warning<
6916  warn_arith_conv_mixed_enum_types.Text>,
6917  InGroup<EnumCompare>;
6918def warn_comparison_mixed_enum_types_cxx20 : Warning<
6919  warn_arith_conv_mixed_enum_types_cxx20.Text>,
6920  InGroup<DeprecatedEnumCompare>;
6921def warn_comparison_of_mixed_enum_types_switch : Warning<
6922  "comparison of different enumeration types in switch statement"
6923  "%diff{ ($ and $)|}0,1">,
6924  InGroup<EnumCompareSwitch>;
6925
6926def err_typecheck_assign_const : Error<
6927  "%select{"
6928  "cannot assign to return value because function %1 returns a const value|"
6929  "cannot assign to variable %1 with const-qualified type %2|"
6930  "cannot assign to %select{non-|}1static data member %2 "
6931  "with const-qualified type %3|"
6932  "cannot assign to non-static data member within const member function %1|"
6933  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
6934  "with %select{|nested }3const-qualified data member %4|"
6935  "read-only variable is not assignable}0">;
6936
6937def note_typecheck_assign_const : Note<
6938  "%select{"
6939  "function %1 which returns const-qualified type %2 declared here|"
6940  "variable %1 declared const here|"
6941  "%select{non-|}1static data member %2 declared const here|"
6942  "member function %q1 is declared const here|"
6943  "%select{|nested }1data member %2 declared const here}0">;
6944
6945def warn_unsigned_always_true_comparison : Warning<
6946  "result of comparison of %select{%3|unsigned expression}0 %2 "
6947  "%select{unsigned expression|%3}0 is always %4">,
6948  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
6949def warn_unsigned_char_always_true_comparison : Warning<
6950  "result of comparison of %select{%3|char expression}0 %2 "
6951  "%select{char expression|%3}0 is always %4, since char is interpreted as "
6952  "unsigned">, InGroup<TautologicalUnsignedCharZeroCompare>, DefaultIgnore;
6953def warn_unsigned_enum_always_true_comparison : Warning<
6954  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
6955  "%select{unsigned enum expression|%3}0 is always %4">,
6956  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
6957def warn_tautological_constant_compare : Warning<
6958  "result of comparison %select{%3|%1}0 %2 "
6959  "%select{%1|%3}0 is always %4">,
6960  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
6961def warn_tautological_compare_objc_bool : Warning<
6962  "result of comparison of constant %0 with expression of type 'BOOL'"
6963  " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
6964  InGroup<TautologicalObjCBoolCompare>;
6965def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
6966def warn_tautological_compare_value_range : Warning<
6967  "result of comparison of "
6968  "%select{%4|%sub{subst_int_range}1,2}0 %3 "
6969  "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
6970  InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
6971
6972def warn_mixed_sign_comparison : Warning<
6973  "comparison of integers of different signs: %0 and %1">,
6974  InGroup<SignCompare>, DefaultIgnore;
6975def warn_out_of_range_compare : Warning<
6976  "result of comparison of %select{constant %0|true|false}1 with "
6977  "%select{expression of type %2|boolean expression}3 is always %4">,
6978  InGroup<TautologicalOutOfRangeCompare>;
6979def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
6980  InGroup<TautologicalConstantCompare>;
6981def warn_integer_constants_in_conditional_always_true : Warning<
6982  "converting the result of '?:' with integer constants to a boolean always "
6983  "evaluates to 'true'">,
6984  InGroup<TautologicalConstantCompare>;
6985def warn_left_shift_always : Warning<
6986  "converting the result of '<<' to a boolean always evaluates "
6987  "to %select{false|true}0">,
6988  InGroup<TautologicalConstantCompare>;
6989def warn_null_in_arithmetic_operation : Warning<
6990  "use of NULL in arithmetic operation">,
6991  InGroup<NullArithmetic>;
6992def warn_null_in_comparison_operation : Warning<
6993  "comparison between NULL and non-pointer "
6994  "%select{(%1 and NULL)|(NULL and %1)}0">,
6995  InGroup<NullArithmetic>;
6996def err_shift_rhs_only_vector : Error<
6997  "requested shift is a vector of type %0 but the first operand is not a "
6998  "vector (%1)">;
6999
7000def warn_logical_not_on_lhs_of_check : Warning<
7001  "logical not is only applied to the left hand side of this "
7002  "%select{comparison|bitwise operator}0">,
7003  InGroup<LogicalNotParentheses>;
7004def note_logical_not_fix : Note<
7005  "add parentheses after the '!' to evaluate the "
7006  "%select{comparison|bitwise operator}0 first">;
7007def note_logical_not_silence_with_parens : Note<
7008  "add parentheses around left hand side expression to silence this warning">;
7009
7010def err_invalid_this_use : Error<
7011  "invalid use of 'this' outside of a non-static member function">;
7012def err_this_static_member_func : Error<
7013  "'this' cannot be%select{| implicitly}0 used in a static member function "
7014  "declaration">;
7015def err_invalid_member_use_in_static_method : Error<
7016  "invalid use of member %0 in static member function">;
7017def err_invalid_qualified_function_type : Error<
7018  "%select{non-member function|static member function|deduction guide}0 "
7019  "%select{of type %2 |}1cannot have '%3' qualifier">;
7020def err_compound_qualified_function_type : Error<
7021  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
7022  "cannot have '%3' qualifier">;
7023def err_qualified_function_typeid : Error<
7024  "type operand %0 of 'typeid' cannot have '%1' qualifier">;
7025
7026def err_ref_qualifier_overload : Error<
7027  "cannot overload a member function %select{without a ref-qualifier|with "
7028  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
7029  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
7030
7031def err_invalid_non_static_member_use : Error<
7032  "invalid use of non-static data member %0">;
7033def err_nested_non_static_member_use : Error<
7034  "%select{call to non-static member function|use of non-static data member}0 "
7035  "%2 of %1 from nested type %3">;
7036def warn_cxx98_compat_non_static_member_use : Warning<
7037  "use of non-static data member %0 in an unevaluated context is "
7038  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
7039def err_invalid_incomplete_type_use : Error<
7040  "invalid use of incomplete type %0">;
7041def err_builtin_func_cast_more_than_one_arg : Error<
7042  "function-style cast to a builtin type can only take one argument">;
7043def err_value_init_for_array_type : Error<
7044  "array types cannot be value-initialized">;
7045def err_init_for_function_type : Error<
7046  "cannot create object of function type %0">;
7047def warn_format_nonliteral_noargs : Warning<
7048  "format string is not a string literal (potentially insecure)">,
7049  InGroup<FormatSecurity>;
7050def warn_format_nonliteral : Warning<
7051  "format string is not a string literal">,
7052  InGroup<FormatNonLiteral>, DefaultIgnore;
7053
7054def err_unexpected_interface : Error<
7055  "unexpected interface name %0: expected expression">;
7056def err_ref_non_value : Error<"%0 does not refer to a value">;
7057def err_ref_vm_type : Error<
7058  "cannot refer to declaration with a variably modified type inside block">;
7059def err_ref_flexarray_type : Error<
7060  "cannot refer to declaration of structure variable with flexible array member "
7061  "inside block">;
7062def err_ref_array_type : Error<
7063  "cannot refer to declaration with an array type inside block">;
7064def err_property_not_found : Error<
7065  "property %0 not found on object of type %1">;
7066def err_invalid_property_name : Error<
7067  "%0 is not a valid property name (accessing an object of type %1)">;
7068def err_getter_not_found : Error<
7069  "no getter method for read from property">;
7070def err_objc_subscript_method_not_found : Error<
7071  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
7072  "found on object of type %0">;
7073def err_objc_subscript_index_type : Error<
7074  "method index parameter type %0 is not integral type">;
7075def err_objc_subscript_key_type : Error<
7076  "method key parameter type %0 is not object type">;
7077def err_objc_subscript_dic_object_type : Error<
7078  "method object parameter type %0 is not object type">;
7079def err_objc_subscript_object_type : Error<
7080  "cannot assign to this %select{dictionary|array}1 because assigning method's "
7081  "2nd parameter of type %0 is not an Objective-C pointer type">;
7082def err_objc_subscript_base_type : Error<
7083  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
7084def err_objc_multiple_subscript_type_conversion : Error<
7085  "indexing expression is invalid because subscript type %0 has "
7086  "multiple type conversion functions">;
7087def err_objc_subscript_type_conversion : Error<
7088  "indexing expression is invalid because subscript type %0 is not an integral"
7089  " or Objective-C pointer type">;
7090def err_objc_subscript_pointer : Error<
7091  "indexing expression is invalid because subscript type %0 is not an"
7092  " Objective-C pointer">;
7093def err_objc_indexing_method_result_type : Error<
7094  "method for accessing %select{dictionary|array}1 element must have Objective-C"
7095  " object return type instead of %0">;
7096def err_objc_index_incomplete_class_type : Error<
7097  "Objective-C index expression has incomplete class type %0">;
7098def err_illegal_container_subscripting_op : Error<
7099  "illegal operation on Objective-C container subscripting">;
7100def err_property_not_found_forward_class : Error<
7101  "property %0 cannot be found in forward class object %1">;
7102def err_property_not_as_forward_class : Error<
7103  "property %0 refers to an incomplete Objective-C class %1 "
7104  "(with no @interface available)">;
7105def note_forward_class : Note<
7106  "forward declaration of class here">;
7107def err_duplicate_property : Error<
7108  "property has a previous declaration">;
7109def ext_gnu_void_ptr : Extension<
7110  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
7111  InGroup<PointerArith>;
7112def ext_gnu_ptr_func_arith : Extension<
7113  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
7114  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
7115  InGroup<PointerArith>;
7116def err_readonly_message_assignment : Error<
7117  "assigning to 'readonly' return result of an Objective-C message not allowed">;
7118def ext_integer_increment_complex : Extension<
7119  "ISO C does not support '++'/'--' on complex integer type %0">;
7120def ext_integer_complement_complex : Extension<
7121  "ISO C does not support '~' for complex conjugation of %0">;
7122def err_nosetter_property_assignment : Error<
7123  "%select{assignment to readonly property|"
7124  "no setter method %1 for assignment to property}0">;
7125def err_nosetter_property_incdec : Error<
7126  "%select{%select{increment|decrement}1 of readonly property|"
7127  "no setter method %2 for %select{increment|decrement}1 of property}0">;
7128def err_nogetter_property_compound_assignment : Error<
7129  "a getter method is needed to perform a compound assignment on a property">;
7130def err_nogetter_property_incdec : Error<
7131  "no getter method %1 for %select{increment|decrement}0 of property">;
7132def err_no_subobject_property_setting : Error<
7133  "expression is not assignable">;
7134def err_qualified_objc_access : Error<
7135  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
7136
7137def ext_freestanding_complex : Extension<
7138  "complex numbers are an extension in a freestanding C99 implementation">;
7139
7140// FIXME: Remove when we support imaginary.
7141def err_imaginary_not_supported : Error<"imaginary types are not supported">;
7142
7143// Obj-c expressions
7144def warn_root_inst_method_not_found : Warning<
7145  "instance method %0 is being used on 'Class' which is not in the root class">,
7146  InGroup<MethodAccess>;
7147def warn_class_method_not_found : Warning<
7148  "class method %objcclass0 not found (return type defaults to 'id')">,
7149  InGroup<MethodAccess>;
7150def warn_instance_method_on_class_found : Warning<
7151  "instance method %0 found instead of class method %1">,
7152  InGroup<MethodAccess>;
7153def warn_inst_method_not_found : Warning<
7154  "instance method %objcinstance0 not found (return type defaults to 'id')">,
7155  InGroup<MethodAccess>;
7156def warn_instance_method_not_found_with_typo : Warning<
7157  "instance method %objcinstance0 not found (return type defaults to 'id')"
7158  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
7159def warn_class_method_not_found_with_typo : Warning<
7160  "class method %objcclass0 not found (return type defaults to 'id')"
7161  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
7162def err_method_not_found_with_typo : Error<
7163  "%select{instance|class}1 method %0 not found "
7164  "; did you mean %2?">;
7165def err_no_super_class_message : Error<
7166  "no @interface declaration found in class messaging of %0">;
7167def err_root_class_cannot_use_super : Error<
7168  "%0 cannot use 'super' because it is a root class">;
7169def err_invalid_receiver_to_message_super : Error<
7170  "'super' is only valid in a method body">;
7171def err_invalid_receiver_class_message : Error<
7172  "receiver type %0 is not an Objective-C class">;
7173def err_missing_open_square_message_send : Error<
7174  "missing '[' at start of message send expression">;
7175def warn_bad_receiver_type : Warning<
7176  "receiver type %0 is not 'id' or interface pointer, consider "
7177  "casting it to 'id'">,InGroup<ObjCReceiver>;
7178def err_bad_receiver_type : Error<"bad receiver type %0">;
7179def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
7180def err_unknown_receiver_suggest : Error<
7181  "unknown receiver %0; did you mean %1?">;
7182def err_objc_throw_expects_object : Error<
7183  "@throw requires an Objective-C object type (%0 invalid)">;
7184def err_objc_synchronized_expects_object : Error<
7185  "@synchronized requires an Objective-C object type (%0 invalid)">;
7186def err_rethrow_used_outside_catch : Error<
7187  "@throw (rethrow) used outside of a @catch block">;
7188def err_attribute_multiple_objc_gc : Error<
7189  "multiple garbage collection attributes specified for type">;
7190def err_catch_param_not_objc_type : Error<
7191  "@catch parameter is not a pointer to an interface type">;
7192def err_illegal_qualifiers_on_catch_parm : Error<
7193  "illegal qualifiers on @catch parameter">;
7194def err_storage_spec_on_catch_parm : Error<
7195  "@catch parameter cannot have storage specifier '%0'">;
7196def warn_register_objc_catch_parm : Warning<
7197  "'register' storage specifier on @catch parameter will be ignored">;
7198def err_qualified_objc_catch_parm : Error<
7199  "@catch parameter declarator cannot be qualified">;
7200def warn_objc_pointer_cxx_catch_fragile : Warning<
7201  "cannot catch an exception thrown with @throw in C++ in the non-unified "
7202  "exception model">, InGroup<ObjCNonUnifiedException>;
7203def err_objc_object_catch : Error<
7204  "cannot catch an Objective-C object by value">;
7205def err_incomplete_type_objc_at_encode : Error<
7206  "'@encode' of incomplete type %0">;
7207def warn_objc_circular_container : Warning<
7208  "adding %0 to %1 might cause circular dependency in container">,
7209  InGroup<DiagGroup<"objc-circular-container">>;
7210def note_objc_circular_container_declared_here : Note<"%0 declared here">;
7211def warn_objc_unsafe_perform_selector : Warning<
7212  "%0 is incompatible with selectors that return a "
7213  "%select{struct|union|vector}1 type">,
7214  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
7215def note_objc_unsafe_perform_selector_method_declared_here :  Note<
7216  "method %0 that returns %1 declared here">;
7217def err_attribute_arm_builtin_alias : Error<
7218  "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
7219def err_attribute_arm_mve_polymorphism : Error<
7220  "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
7221
7222def warn_setter_getter_impl_required : Warning<
7223  "property %0 requires method %1 to be defined - "
7224  "use @synthesize, @dynamic or provide a method implementation "
7225  "in this class implementation">,
7226  InGroup<ObjCPropertyImpl>;
7227def warn_setter_getter_impl_required_in_category : Warning<
7228  "property %0 requires method %1 to be defined - "
7229  "use @dynamic or provide a method implementation in this category">,
7230  InGroup<ObjCPropertyImpl>;
7231def note_parameter_named_here : Note<
7232  "passing argument to parameter %0 here">;
7233def note_parameter_here : Note<
7234  "passing argument to parameter here">;
7235def note_method_return_type_change : Note<
7236  "compiler has implicitly changed method %0 return type">;
7237
7238def warn_impl_required_for_class_property : Warning<
7239  "class property %0 requires method %1 to be defined - "
7240  "use @dynamic or provide a method implementation "
7241  "in this class implementation">,
7242  InGroup<ObjCPropertyImpl>;
7243def warn_impl_required_in_category_for_class_property : Warning<
7244  "class property %0 requires method %1 to be defined - "
7245  "use @dynamic or provide a method implementation in this category">,
7246  InGroup<ObjCPropertyImpl>;
7247
7248// C++ casts
7249// These messages adhere to the TryCast pattern: %0 is an int specifying the
7250// cast type, %1 is the source type, %2 is the destination type.
7251def err_bad_reinterpret_cast_overload : Error<
7252  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
7253
7254def warn_reinterpret_different_from_static : Warning<
7255  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
7256  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
7257  "'static_cast'">, InGroup<ReinterpretBaseClass>;
7258def note_reinterpret_updowncast_use_static: Note<
7259  "use 'static_cast' to adjust the pointer correctly while "
7260  "%select{upcasting|downcasting}0">;
7261
7262def err_bad_static_cast_overload : Error<
7263  "address of overloaded function %0 cannot be static_cast to type %1">;
7264
7265def err_bad_cstyle_cast_overload : Error<
7266  "address of overloaded function %0 cannot be cast to type %1">;
7267
7268
7269def err_bad_cxx_cast_generic : Error<
7270  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7271  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7272def err_bad_cxx_cast_unrelated_class : Error<
7273  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7274  "functional-style cast|}0 from %1 to %2, which are not related by "
7275  "inheritance, is not allowed">;
7276def note_type_incomplete : Note<"%0 is incomplete">;
7277def err_bad_cxx_cast_rvalue : Error<
7278  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7279  "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7280def err_bad_cxx_cast_bitfield : Error<
7281  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7282  "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7283def err_bad_cxx_cast_qualifiers_away : Error<
7284  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7285  "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7286def err_bad_cxx_cast_addr_space_mismatch : Error<
7287  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7288  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7289  " spaces">;
7290def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7291  "ISO C++ does not allow "
7292  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7293  "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
7294  "even though the source and destination types are unrelated">,
7295  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
7296def err_bad_const_cast_dest : Error<
7297  "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
7298  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
7299def ext_cast_fn_obj : Extension<
7300  "cast between pointer-to-function and pointer-to-object is an extension">;
7301def ext_ms_cast_fn_obj : ExtWarn<
7302  "static_cast between pointer-to-function and pointer-to-object is a "
7303  "Microsoft extension">, InGroup<MicrosoftCast>;
7304def warn_cxx98_compat_cast_fn_obj : Warning<
7305  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
7306  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7307def err_bad_reinterpret_cast_small_int : Error<
7308  "cast from pointer to smaller type %2 loses information">;
7309def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
7310  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7311  "to scalar %2 of different size">;
7312def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
7313  "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
7314  "to vector %2 of different size">;
7315def err_bad_cxx_cast_vector_to_vector_different_size : Error<
7316  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7317  "to vector %2 of different size">;
7318def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
7319  "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
7320  "changes address space of nested pointers">,
7321  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7322def err_bad_lvalue_to_rvalue_cast : Error<
7323  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
7324  "not compatible">;
7325def err_bad_rvalue_to_rvalue_cast : Error<
7326  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
7327  "not compatible">;
7328def err_bad_static_cast_pointer_nonpointer : Error<
7329  "cannot cast from type %1 to pointer type %2">;
7330def err_bad_static_cast_member_pointer_nonmp : Error<
7331  "cannot cast from type %1 to member pointer type %2">;
7332def err_bad_cxx_cast_member_pointer_size : Error<
7333  "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
7334  "type %1 to member pointer type %2 of different size">;
7335def err_bad_reinterpret_cast_reference : Error<
7336  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
7337def warn_undefined_reinterpret_cast : Warning<
7338  "reinterpret_cast from %0 to %1 has undefined behavior">,
7339  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7340
7341// These messages don't adhere to the pattern.
7342// FIXME: Display the path somehow better.
7343def err_ambiguous_base_to_derived_cast : Error<
7344  "ambiguous cast from base %0 to derived %1:%2">;
7345def err_static_downcast_via_virtual : Error<
7346  "cannot cast %0 to %1 via virtual base %2">;
7347def err_downcast_from_inaccessible_base : Error<
7348  "cannot cast %select{private|protected}2 base class %1 to %0">;
7349def err_upcast_to_inaccessible_base : Error<
7350  "cannot cast %0 to its %select{private|protected}2 base class %1">;
7351def err_bad_dynamic_cast_not_ref_or_ptr : Error<
7352  "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
7353def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
7354def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
7355def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
7356def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
7357
7358// Other C++ expressions
7359def err_need_header_before_typeid : Error<
7360  "you need to include <typeinfo> before using the 'typeid' operator">;
7361def err_need_header_before_ms_uuidof : Error<
7362  "you need to include <guiddef.h> before using the '__uuidof' operator">;
7363def err_need_header_before_placement_new : Error<
7364  "no matching %0 function for non-allocating placement new expression; "
7365  "include <new>">;
7366def err_ms___leave_not_in___try : Error<
7367  "'__leave' statement not in __try block">;
7368def err_uuidof_without_guid : Error<
7369  "cannot call operator __uuidof on a type with no GUID">;
7370def err_uuidof_with_multiple_guids : Error<
7371  "cannot call operator __uuidof on a type with multiple GUIDs">;
7372def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
7373def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
7374def err_static_illegal_in_new : Error<
7375  "the 'static' modifier for the array size is not legal in new expressions">;
7376def err_array_new_needs_size : Error<
7377  "array size must be specified in new expression with no initializer">;
7378def err_bad_new_type : Error<
7379  "cannot allocate %select{function|reference}1 type %0 with new">;
7380def err_new_incomplete_or_sizeless_type : Error<
7381  "allocation of %select{incomplete|sizeless}0 type %1">;
7382def err_new_array_nonconst : Error<
7383  "only the first dimension of an allocated array may have dynamic size">;
7384def err_new_array_size_unknown_from_init : Error<
7385  "cannot determine allocated array size from initializer">;
7386def err_new_array_init_args : Error<
7387  "array 'new' cannot have initialization arguments">;
7388def ext_new_paren_array_nonconst : ExtWarn<
7389  "when type is in parentheses, array cannot have dynamic size">;
7390def err_placement_new_non_placement_delete : Error<
7391  "'new' expression with placement arguments refers to non-placement "
7392  "'operator delete'">;
7393def err_array_size_not_integral : Error<
7394  "array size expression must have integral or %select{|unscoped }0"
7395  "enumeration type, not %1">;
7396def err_array_size_incomplete_type : Error<
7397  "array size expression has incomplete class type %0">;
7398def err_array_size_explicit_conversion : Error<
7399  "array size expression of type %0 requires explicit conversion to type %1">;
7400def note_array_size_conversion : Note<
7401  "conversion to %select{integral|enumeration}0 type %1 declared here">;
7402def err_array_size_ambiguous_conversion : Error<
7403  "ambiguous conversion of array size expression of type %0 to an integral or "
7404  "enumeration type">;
7405def ext_array_size_conversion : Extension<
7406  "implicit conversion from array size expression of type %0 to "
7407  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7408  InGroup<CXX11>;
7409def warn_cxx98_compat_array_size_conversion : Warning<
7410  "implicit conversion from array size expression of type %0 to "
7411  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7412  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7413def err_address_space_qualified_new : Error<
7414  "'new' cannot allocate objects of type %0 in address space '%1'">;
7415def err_address_space_qualified_delete : Error<
7416  "'delete' cannot delete objects of type %0 in address space '%1'">;
7417
7418def err_default_init_const : Error<
7419  "default initialization of an object of const type %0"
7420  "%select{| without a user-provided default constructor}1">;
7421def ext_default_init_const : ExtWarn<
7422  "default initialization of an object of const type %0"
7423  "%select{| without a user-provided default constructor}1 "
7424  "is a Microsoft extension">,
7425  InGroup<MicrosoftConstInit>;
7426def err_delete_operand : Error<"cannot delete expression of type %0">;
7427def ext_delete_void_ptr_operand : ExtWarn<
7428  "cannot delete expression with pointer-to-'void' type %0">,
7429  InGroup<DeleteIncomplete>;
7430def err_ambiguous_delete_operand : Error<
7431  "ambiguous conversion of delete expression of type %0 to a pointer">;
7432def warn_delete_incomplete : Warning<
7433  "deleting pointer to incomplete type %0 may cause undefined behavior">,
7434  InGroup<DeleteIncomplete>;
7435def err_delete_incomplete_class_type : Error<
7436  "deleting incomplete class type %0; no conversions to pointer type">;
7437def err_delete_explicit_conversion : Error<
7438  "converting delete expression from type %0 to type %1 invokes an explicit "
7439  "conversion function">;
7440def note_delete_conversion : Note<"conversion to pointer type %0">;
7441def warn_delete_array_type : Warning<
7442  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7443def warn_mismatched_delete_new : Warning<
7444  "'delete%select{|[]}0' applied to a pointer that was allocated with "
7445  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7446  InGroup<DiagGroup<"mismatched-new-delete">>;
7447def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7448def err_no_suitable_delete_member_function_found : Error<
7449  "no suitable member %0 in %1">;
7450def err_ambiguous_suitable_delete_member_function_found : Error<
7451  "multiple suitable %0 functions in %1">;
7452def warn_ambiguous_suitable_delete_function_found : Warning<
7453  "multiple suitable %0 functions for %1; no 'operator delete' function "
7454  "will be invoked if initialization throws an exception">,
7455  InGroup<DiagGroup<"ambiguous-delete">>;
7456def note_member_declared_here : Note<
7457  "member %0 declared here">;
7458def note_member_first_declared_here : Note<
7459  "member %0 first declared here">;
7460def warn_bitwise_instead_of_logical : Warning<
7461  "use of bitwise '%0' with boolean operands">,
7462  InGroup<BitwiseInsteadOfLogical>, DefaultIgnore;
7463def warn_bitwise_negation_bool : Warning<
7464  "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7465  "did you mean logical negation?">,
7466  InGroup<BoolOperation>, DefaultIgnore;
7467def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7468def warn_increment_bool : Warning<
7469  "incrementing expression of type bool is deprecated and "
7470  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7471def ext_increment_bool : ExtWarn<
7472  "ISO C++17 does not allow incrementing expression of type bool">,
7473  DefaultError, InGroup<IncrementBool>;
7474def err_increment_decrement_enum : Error<
7475  "cannot %select{decrement|increment}0 expression of enum type %1">;
7476
7477def warn_deprecated_increment_decrement_volatile : Warning<
7478  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7479  "is deprecated">, InGroup<DeprecatedVolatile>;
7480def warn_deprecated_simple_assign_volatile : Warning<
7481  "use of result of assignment to object of volatile-qualified type %0 "
7482  "is deprecated">, InGroup<DeprecatedVolatile>;
7483def warn_deprecated_compound_assign_volatile : Warning<
7484  "compound assignment to object of volatile-qualified type %0 is deprecated">,
7485  InGroup<DeprecatedVolatile>;
7486def warn_deprecated_volatile_return : Warning<
7487  "volatile-qualified return type %0 is deprecated">,
7488  InGroup<DeprecatedVolatile>;
7489def warn_deprecated_volatile_param : Warning<
7490  "volatile-qualified parameter type %0 is deprecated">,
7491  InGroup<DeprecatedVolatile>;
7492def warn_deprecated_volatile_structured_binding : Warning<
7493  "volatile qualifier in structured binding declaration is deprecated">,
7494  InGroup<DeprecatedVolatile>;
7495
7496def warn_deprecated_altivec_src_compat : Warning<
7497  "Current handling of vector bool and vector pixel types in this context are "
7498  "deprecated. The default behaviour will soon change to that implied by the "
7499  "'-altivec-compat=xl' option">,
7500  InGroup<DiagGroup<"deprecated-altivec-src-compat">>;
7501
7502def err_catch_incomplete_ptr : Error<
7503  "cannot catch pointer to incomplete type %0">;
7504def err_catch_incomplete_ref : Error<
7505  "cannot catch reference to incomplete type %0">;
7506def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7507def err_catch_sizeless : Error<
7508  "cannot catch %select{|reference to }0sizeless type %1">;
7509def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7510def err_catch_variably_modified : Error<
7511  "cannot catch variably modified type %0">;
7512def err_qualified_catch_declarator : Error<
7513  "exception declarator cannot be qualified">;
7514def err_early_catch_all : Error<"catch-all handler must come last">;
7515def err_bad_memptr_rhs : Error<
7516  "right hand operand to %0 has non-pointer-to-member type %1">;
7517def err_bad_memptr_lhs : Error<
7518  "left hand operand to %0 must be a %select{|pointer to }1class "
7519  "compatible with the right hand operand, but is %2">;
7520def err_memptr_incomplete : Error<
7521  "member pointer has incomplete base type %0">;
7522def warn_exception_caught_by_earlier_handler : Warning<
7523  "exception of type %0 will be caught by earlier handler">,
7524  InGroup<Exceptions>;
7525def note_previous_exception_handler : Note<"for type %0">;
7526def err_exceptions_disabled : Error<
7527  "cannot use '%0' with exceptions disabled">;
7528def err_objc_exceptions_disabled : Error<
7529  "cannot use '%0' with Objective-C exceptions disabled">;
7530def warn_throw_in_noexcept_func : Warning<
7531  "%0 has a non-throwing exception specification but can still throw">,
7532  InGroup<Exceptions>;
7533def note_throw_in_dtor : Note<
7534  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7535  "non-throwing}1 exception specification">;
7536def note_throw_in_function : Note<"function declared non-throwing here">;
7537def err_seh_try_outside_functions : Error<
7538  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7539def err_mixing_cxx_try_seh_try : Error<
7540  "cannot use %select{C++ 'try'|Objective-C '@try'}0 "
7541  "in the same function as SEH '__try'">;
7542def err_seh_try_unsupported : Error<
7543  "SEH '__try' is not supported on this target">;
7544def note_conflicting_try_here : Note<
7545  "conflicting %0 here">;
7546def warn_jump_out_of_seh_finally : Warning<
7547  "jump out of __finally block has undefined behavior">,
7548  InGroup<DiagGroup<"jump-seh-finally">>;
7549def warn_non_virtual_dtor : Warning<
7550  "%0 has virtual functions but non-virtual destructor">,
7551  InGroup<NonVirtualDtor>, DefaultIgnore;
7552def warn_delete_non_virtual_dtor : Warning<
7553  "%select{delete|destructor}0 called on non-final %1 that has "
7554  "virtual functions but non-virtual destructor">,
7555  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7556def note_delete_non_virtual : Note<
7557  "qualify call to silence this warning">;
7558def warn_delete_abstract_non_virtual_dtor : Warning<
7559  "%select{delete|destructor}0 called on %1 that is abstract but has "
7560  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7561def warn_overloaded_virtual : Warning<
7562  "%q0 hides overloaded virtual %select{function|functions}1">,
7563  InGroup<OverloadedVirtual>, DefaultIgnore;
7564def note_hidden_overloaded_virtual_declared_here : Note<
7565  "hidden overloaded virtual function %q0 declared here"
7566  "%select{|: different classes%diff{ ($ vs $)|}2,3"
7567  "|: different number of parameters (%2 vs %3)"
7568  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7569  "|: different return type%diff{ ($ vs $)|}2,3"
7570  "|: different qualifiers (%2 vs %3)"
7571  "|: different exception specifications}1">;
7572def warn_using_directive_in_header : Warning<
7573  "using namespace directive in global context in header">,
7574  InGroup<HeaderHygiene>, DefaultIgnore;
7575def warn_overaligned_type : Warning<
7576  "type %0 requires %1 bytes of alignment and the default allocator only "
7577  "guarantees %2 bytes">,
7578  InGroup<OveralignedType>, DefaultIgnore;
7579def err_aligned_allocation_unavailable : Error<
7580  "aligned %select{allocation|deallocation}0 function of type '%1' is "
7581  "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
7582def note_silence_aligned_allocation_unavailable : Note<
7583  "if you supply your own aligned allocation functions, use "
7584  "-faligned-allocation to silence this diagnostic">;
7585
7586def err_conditional_void_nonvoid : Error<
7587  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7588  "is of type %0">;
7589def err_conditional_ambiguous : Error<
7590  "conditional expression is ambiguous; "
7591  "%diff{$ can be converted to $ and vice versa|"
7592  "types can be convert to each other}0,1">;
7593def err_conditional_ambiguous_ovl : Error<
7594  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7595  "can be converted to several common types">;
7596def err_conditional_vector_size : Error<
7597  "vector condition type %0 and result type %1 do not have the same number "
7598  "of elements">;
7599def err_conditional_vector_element_size : Error<
7600  "vector condition type %0 and result type %1 do not have elements of the "
7601  "same size">;
7602def err_conditional_vector_has_void : Error<
7603  "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7604def err_conditional_vector_operand_type
7605    : Error<"enumeration type %0 is not allowed in a vector conditional">;
7606def err_conditional_vector_cond_result_mismatch
7607    : Error<"cannot mix vectors and extended vectors in a vector conditional">;
7608def err_conditional_vector_mismatched
7609    : Error<"vector operands to the vector conditional must be the same type "
7610            "%diff{($ and $)|}0,1}">;
7611
7612def err_throw_incomplete : Error<
7613  "cannot throw object of incomplete type %0">;
7614def err_throw_incomplete_ptr : Error<
7615  "cannot throw pointer to object of incomplete type %0">;
7616def err_throw_sizeless : Error<
7617  "cannot throw object of sizeless type %0">;
7618def warn_throw_underaligned_obj : Warning<
7619  "underaligned exception object thrown">,
7620  InGroup<UnderalignedExceptionObject>;
7621def note_throw_underaligned_obj : Note<
7622  "required alignment of type %0 (%1 bytes) is larger than the supported "
7623  "alignment of C++ exception objects on this target (%2 bytes)">;
7624def err_return_in_constructor_handler : Error<
7625  "return in the catch of a function try block of a constructor is illegal">;
7626def warn_cdtor_function_try_handler_mem_expr : Warning<
7627  "cannot refer to a non-static member from the handler of a "
7628  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
7629
7630let CategoryName = "Lambda Issue" in {
7631  def err_capture_more_than_once : Error<
7632    "%0 can appear only once in a capture list">;
7633  def err_reference_capture_with_reference_default : Error<
7634    "'&' cannot precede a capture when the capture default is '&'">;
7635  def err_copy_capture_with_copy_default : Error<
7636    "'&' must precede a capture when the capture default is '='">;
7637  def err_capture_does_not_name_variable : Error<
7638    "%0 in capture list does not name a variable">;
7639  def err_capture_non_automatic_variable : Error<
7640    "%0 cannot be captured because it does not have automatic storage "
7641    "duration">;
7642  def err_this_capture : Error<
7643    "'this' cannot be %select{implicitly |}0captured in this context">;
7644  def note_lambda_this_capture_fixit : Note<
7645    "explicitly capture 'this'">;
7646  def err_lambda_capture_anonymous_var : Error<
7647    "unnamed variable cannot be implicitly captured in a lambda expression">;
7648  def err_lambda_capture_flexarray_type : Error<
7649    "variable %0 with flexible array member cannot be captured in "
7650    "a lambda expression">;
7651  def err_lambda_impcap : Error<
7652    "variable %0 cannot be implicitly captured in a lambda with no "
7653    "capture-default specified">;
7654  def note_lambda_variable_capture_fixit : Note<
7655    "capture %0 by %select{value|reference}1">;
7656  def note_lambda_default_capture_fixit : Note<
7657    "default capture by %select{value|reference}0">;
7658  def note_lambda_decl : Note<"lambda expression begins here">;
7659  def err_lambda_unevaluated_operand : Error<
7660    "lambda expression in an unevaluated operand">;
7661  def err_lambda_in_constant_expression : Error<
7662    "a lambda expression may not appear inside of a constant expression">;
7663  def err_lambda_in_invalid_context : Error<
7664    "a lambda expression cannot appear in this context">;
7665  def err_lambda_return_init_list : Error<
7666    "cannot deduce lambda return type from initializer list">;
7667  def err_lambda_capture_default_arg : Error<
7668    "lambda expression in default argument cannot capture any entity">;
7669  def err_lambda_incomplete_result : Error<
7670    "incomplete result type %0 in lambda expression">;
7671  def err_noreturn_lambda_has_return_expr : Error<
7672    "lambda declared 'noreturn' should not return">;
7673  def warn_maybe_falloff_nonvoid_lambda : Warning<
7674    "non-void lambda does not return a value in all control paths">,
7675    InGroup<ReturnType>;
7676  def warn_falloff_nonvoid_lambda : Warning<
7677    "non-void lambda does not return a value">,
7678    InGroup<ReturnType>;
7679  def err_access_lambda_capture : Error<
7680    // The ERRORs represent other special members that aren't constructors, in
7681    // hopes that someone will bother noticing and reporting if they appear
7682    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
7683    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
7684    AccessControl;
7685  def note_lambda_to_block_conv : Note<
7686    "implicit capture of lambda object due to conversion to block pointer "
7687    "here">;
7688  def note_var_explicitly_captured_here : Note<"variable %0 is"
7689    "%select{| explicitly}1 captured here">;
7690
7691  // C++14 lambda init-captures.
7692  def warn_cxx11_compat_init_capture : Warning<
7693    "initialized lambda captures are incompatible with C++ standards "
7694    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
7695  def ext_init_capture : ExtWarn<
7696    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
7697  def err_init_capture_no_expression : Error<
7698    "initializer missing for lambda capture %0">;
7699  def err_init_capture_multiple_expressions : Error<
7700    "initializer for lambda capture %0 contains multiple expressions">;
7701  def err_init_capture_paren_braces : Error<
7702    "cannot deduce type for lambda capture %1 from "
7703    "%select{parenthesized|nested}0 initializer list">;
7704  def err_init_capture_deduction_failure : Error<
7705    "cannot deduce type for lambda capture %0 from initializer of type %2">;
7706  def err_init_capture_deduction_failure_from_init_list : Error<
7707    "cannot deduce type for lambda capture %0 from initializer list">;
7708  def warn_cxx17_compat_init_capture_pack : Warning<
7709    "initialized lambda capture packs are incompatible with C++ standards "
7710    "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7711  def ext_init_capture_pack : ExtWarn<
7712    "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
7713
7714  // C++14 generic lambdas.
7715  def warn_cxx11_compat_generic_lambda : Warning<
7716    "generic lambdas are incompatible with C++11">,
7717    InGroup<CXXPre14Compat>, DefaultIgnore;
7718
7719  // C++17 '*this' captures.
7720  def warn_cxx14_compat_star_this_lambda_capture : Warning<
7721    "by value capture of '*this' is incompatible with C++ standards before C++17">,
7722     InGroup<CXXPre17Compat>, DefaultIgnore;
7723  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
7724    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
7725
7726  // C++17 parameter shadows capture
7727  def err_parameter_shadow_capture : Error<
7728    "a lambda parameter cannot shadow an explicitly captured entity">;
7729
7730  // C++20 [=, this] captures.
7731  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
7732    "explicit capture of 'this' with a capture default of '=' is incompatible "
7733    "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7734  def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
7735    "explicit capture of 'this' with a capture default of '=' "
7736    "is a C++20 extension">, InGroup<CXX20>;
7737  def warn_deprecated_this_capture : Warning<
7738    "implicit capture of 'this' with a capture default of '=' is deprecated">,
7739    InGroup<DeprecatedThisCapture>, DefaultIgnore;
7740  def note_deprecated_this_capture : Note<
7741    "add an explicit capture of 'this' to capture '*this' by reference">;
7742
7743  // C++20 default constructible / assignable lambdas.
7744  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
7745    "%select{default construction|assignment}0 of lambda is incompatible with "
7746    "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7747}
7748
7749def err_return_in_captured_stmt : Error<
7750  "cannot return from %0">;
7751def err_capture_block_variable : Error<
7752  "__block variable %0 cannot be captured in a "
7753  "%select{lambda expression|captured statement}1">;
7754
7755def err_operator_arrow_circular : Error<
7756  "circular pointer delegation detected">;
7757def err_operator_arrow_depth_exceeded : Error<
7758  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
7759  "'operator->' calls">;
7760def note_operator_arrow_here : Note<
7761  "'operator->' declared here produces an object of type %0">;
7762def note_operator_arrows_suppressed : Note<
7763  "(skipping %0 'operator->'%s0 in backtrace)">;
7764def note_operator_arrow_depth : Note<
7765  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
7766
7767def err_pseudo_dtor_base_not_scalar : Error<
7768  "object expression of non-scalar type %0 cannot be used in a "
7769  "pseudo-destructor expression">;
7770def ext_pseudo_dtor_on_void : ExtWarn<
7771  "pseudo-destructors on type void are a Microsoft extension">,
7772  InGroup<MicrosoftVoidPseudoDtor>;
7773def err_pseudo_dtor_type_mismatch : Error<
7774  "the type of object expression "
7775  "%diff{($) does not match the type being destroyed ($)|"
7776  "does not match the type being destroyed}0,1 "
7777  "in pseudo-destructor expression">;
7778def err_pseudo_dtor_call_with_args : Error<
7779  "call to pseudo-destructor cannot have any arguments">;
7780def err_dtor_expr_without_call : Error<
7781  "reference to %select{destructor|pseudo-destructor}0 must be called"
7782  "%select{|; did you mean to call it with no arguments?}1">;
7783def err_pseudo_dtor_destructor_non_type : Error<
7784  "%0 does not refer to a type name in pseudo-destructor expression; expected "
7785  "the name of type %1">;
7786def err_invalid_use_of_function_type : Error<
7787  "a function type is not allowed here">;
7788def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
7789def err_typecheck_bool_condition : Error<
7790  "value of type %0 is not contextually convertible to 'bool'">;
7791def err_typecheck_ambiguous_condition : Error<
7792  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
7793def err_typecheck_nonviable_condition : Error<
7794  "no viable conversion%select{%diff{ from $ to $|}1,2|"
7795  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
7796def err_typecheck_nonviable_condition_incomplete : Error<
7797  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
7798def err_typecheck_deleted_function : Error<
7799  "conversion function %diff{from $ to $|between types}0,1 "
7800  "invokes a deleted function">;
7801
7802def err_expected_class_or_namespace : Error<"%0 is not a class"
7803  "%select{ or namespace|, namespace, or enumeration}1">;
7804def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
7805  "because namespace %1 does not enclose namespace %2">;
7806def err_export_non_namespace_scope_name : Error<
7807  "cannot export %0 as it is not at namespace scope">;
7808def err_redeclaration_non_exported : Error <
7809  "cannot export redeclaration %0 here since the previous declaration is not "
7810  "exported">;
7811def err_invalid_declarator_global_scope : Error<
7812  "definition or redeclaration of %0 cannot name the global scope">;
7813def err_invalid_declarator_in_function : Error<
7814  "definition or redeclaration of %0 not allowed inside a function">;
7815def err_invalid_declarator_in_block : Error<
7816  "definition or redeclaration of %0 not allowed inside a block">;
7817def err_not_tag_in_scope : Error<
7818  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
7819
7820def err_no_typeid_with_fno_rtti : Error<
7821  "use of typeid requires -frtti">;
7822def err_no_dynamic_cast_with_fno_rtti : Error<
7823  "use of dynamic_cast requires -frtti">;
7824def warn_no_dynamic_cast_with_rtti_disabled: Warning<
7825  "dynamic_cast will not work since RTTI data is disabled by "
7826  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7827def warn_no_typeid_with_rtti_disabled: Warning<
7828  "typeid will not work since RTTI data is disabled by "
7829  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7830
7831def err_cannot_form_pointer_to_member_of_reference_type : Error<
7832  "cannot form a pointer-to-member to member %0 of reference type %1">;
7833def err_incomplete_object_call : Error<
7834  "incomplete type in call to object of type %0">;
7835
7836def warn_condition_is_assignment : Warning<"using the result of an "
7837  "assignment as a condition without parentheses">,
7838  InGroup<Parentheses>;
7839def warn_free_nonheap_object
7840  : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
7841    InGroup<FreeNonHeapObject>;
7842
7843// Completely identical except off by default.
7844def warn_condition_is_idiomatic_assignment : Warning<"using the result "
7845  "of an assignment as a condition without parentheses">,
7846  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
7847def note_condition_assign_to_comparison : Note<
7848  "use '==' to turn this assignment into an equality comparison">;
7849def note_condition_or_assign_to_comparison : Note<
7850  "use '!=' to turn this compound assignment into an inequality comparison">;
7851def note_condition_assign_silence : Note<
7852  "place parentheses around the assignment to silence this warning">;
7853
7854def warn_equality_with_extra_parens : Warning<"equality comparison with "
7855  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
7856def note_equality_comparison_to_assign : Note<
7857  "use '=' to turn this equality comparison into an assignment">;
7858def note_equality_comparison_silence : Note<
7859  "remove extraneous parentheses around the comparison to silence this warning">;
7860
7861// assignment related diagnostics (also for argument passing, returning, etc).
7862// In most of these diagnostics the %2 is a value from the
7863// Sema::AssignmentAction enumeration
7864def err_typecheck_convert_incompatible : Error<
7865  "%select{%diff{assigning to $ from incompatible type $|"
7866  "assigning to type from incompatible type}0,1"
7867  "|%diff{passing $ to parameter of incompatible type $|"
7868  "passing type to parameter of incompatible type}0,1"
7869  "|%diff{returning $ from a function with incompatible result type $|"
7870  "returning type from a function with incompatible result type}0,1"
7871  "|%diff{converting $ to incompatible type $|"
7872  "converting type to incompatible type}0,1"
7873  "|%diff{initializing $ with an expression of incompatible type $|"
7874  "initializing type with an expression of incompatible type}0,1"
7875  "|%diff{sending $ to parameter of incompatible type $|"
7876  "sending type to parameter of incompatible type}0,1"
7877  "|%diff{casting $ to incompatible type $|"
7878  "casting type to incompatible type}0,1}2"
7879  "%select{|; dereference with *|"
7880  "; take the address with &|"
7881  "; remove *|"
7882  "; remove &}3"
7883  "%select{|: different classes%diff{ ($ vs $)|}5,6"
7884  "|: different number of parameters (%5 vs %6)"
7885  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
7886  "|: different return type%diff{ ($ vs $)|}5,6"
7887  "|: different qualifiers (%5 vs %6)"
7888  "|: different exception specifications}4">;
7889def err_typecheck_missing_return_type_incompatible : Error<
7890  "%diff{return type $ must match previous return type $|"
7891  "return type must match previous return type}0,1 when %select{block "
7892  "literal|lambda expression}2 has unspecified explicit return type">;
7893
7894def note_incomplete_class_and_qualified_id : Note<
7895  "conformance of forward class %0 to protocol %1 can not be confirmed">;
7896def warn_incompatible_qualified_id : Warning<
7897  "%select{%diff{assigning to $ from incompatible type $|"
7898  "assigning to type from incompatible type}0,1"
7899  "|%diff{passing $ to parameter of incompatible type $|"
7900  "passing type to parameter of incompatible type}0,1"
7901  "|%diff{returning $ from a function with incompatible result type $|"
7902  "returning type from a function with incompatible result type}0,1"
7903  "|%diff{converting $ to incompatible type $|"
7904  "converting type to incompatible type}0,1"
7905  "|%diff{initializing $ with an expression of incompatible type $|"
7906  "initializing type with an expression of incompatible type}0,1"
7907  "|%diff{sending $ to parameter of incompatible type $|"
7908  "sending type to parameter of incompatible type}0,1"
7909  "|%diff{casting $ to incompatible type $|"
7910  "casting type to incompatible type}0,1}2">;
7911def err_incompatible_qualified_id : Error<
7912  "%select{%diff{assigning to $ from incompatible type $|"
7913  "assigning to type from incompatible type}0,1"
7914  "|%diff{passing $ to parameter of incompatible type $|"
7915  "passing type to parameter of incompatible type}0,1"
7916  "|%diff{returning $ from a function with incompatible result type $|"
7917  "returning type from a function with incompatible result type}0,1"
7918  "|%diff{converting $ to incompatible type $|"
7919  "converting type to incompatible type}0,1"
7920  "|%diff{initializing $ with an expression of incompatible type $|"
7921  "initializing type with an expression of incompatible type}0,1"
7922  "|%diff{sending $ to parameter of incompatible type $|"
7923  "sending type to parameter of incompatible type}0,1"
7924  "|%diff{casting $ to incompatible type $|"
7925  "casting type to incompatible type}0,1}2">;
7926def ext_typecheck_convert_pointer_int : ExtWarn<
7927  "incompatible pointer to integer conversion "
7928  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7929  "|%diff{passing $ to parameter of type $|"
7930  "passing to parameter of different type}0,1"
7931  "|%diff{returning $ from a function with result type $|"
7932  "returning from function with different return type}0,1"
7933  "|%diff{converting $ to type $|converting between types}0,1"
7934  "|%diff{initializing $ with an expression of type $|"
7935  "initializing with expression of different type}0,1"
7936  "|%diff{sending $ to parameter of type $|"
7937  "sending to parameter of different type}0,1"
7938  "|%diff{casting $ to type $|casting between types}0,1}2"
7939  "%select{|; dereference with *|"
7940  "; take the address with &|"
7941  "; remove *|"
7942  "; remove &}3">,
7943  InGroup<IntConversion>;
7944def err_typecheck_convert_pointer_int : Error<
7945  "incompatible pointer to integer conversion "
7946  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7947  "|%diff{passing $ to parameter of type $|"
7948  "passing to parameter of different type}0,1"
7949  "|%diff{returning $ from a function with result type $|"
7950  "returning from function with different return type}0,1"
7951  "|%diff{converting $ to type $|converting between types}0,1"
7952  "|%diff{initializing $ with an expression of type $|"
7953  "initializing with expression of different type}0,1"
7954  "|%diff{sending $ to parameter of type $|"
7955  "sending to parameter of different type}0,1"
7956  "|%diff{casting $ to type $|casting between types}0,1}2"
7957  "%select{|; dereference with *|"
7958  "; take the address with &|"
7959  "; remove *|"
7960  "; remove &}3">;
7961def ext_typecheck_convert_int_pointer : ExtWarn<
7962  "incompatible integer to pointer conversion "
7963  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7964  "|%diff{passing $ to parameter of type $|"
7965  "passing to parameter of different type}0,1"
7966  "|%diff{returning $ from a function with result type $|"
7967  "returning from function with different return type}0,1"
7968  "|%diff{converting $ to type $|converting between types}0,1"
7969  "|%diff{initializing $ with an expression of type $|"
7970  "initializing with expression of different type}0,1"
7971  "|%diff{sending $ to parameter of type $|"
7972  "sending to parameter of different type}0,1"
7973  "|%diff{casting $ to type $|casting between types}0,1}2"
7974  "%select{|; dereference with *|"
7975  "; take the address with &|"
7976  "; remove *|"
7977  "; remove &}3">,
7978  InGroup<IntConversion>, SFINAEFailure;
7979def err_typecheck_convert_int_pointer : Error<
7980  "incompatible integer to pointer conversion "
7981  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7982  "|%diff{passing $ to parameter of type $|"
7983  "passing to parameter of different type}0,1"
7984  "|%diff{returning $ from a function with result type $|"
7985  "returning from function with different return type}0,1"
7986  "|%diff{converting $ to type $|converting between types}0,1"
7987  "|%diff{initializing $ with an expression of type $|"
7988  "initializing with expression of different type}0,1"
7989  "|%diff{sending $ to parameter of type $|"
7990  "sending to parameter of different type}0,1"
7991  "|%diff{casting $ to type $|casting between types}0,1}2"
7992  "%select{|; dereference with *|"
7993  "; take the address with &|"
7994  "; remove *|"
7995  "; remove &}3">;
7996def ext_typecheck_convert_pointer_void_func : Extension<
7997  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7998  "|%diff{passing $ to parameter of type $|"
7999  "passing to parameter of different type}0,1"
8000  "|%diff{returning $ from a function with result type $|"
8001  "returning from function with different return type}0,1"
8002  "|%diff{converting $ to type $|converting between types}0,1"
8003  "|%diff{initializing $ with an expression of type $|"
8004  "initializing with expression of different type}0,1"
8005  "|%diff{sending $ to parameter of type $|"
8006  "sending to parameter of different type}0,1"
8007  "|%diff{casting $ to type $|casting between types}0,1}2"
8008  " converts between void pointer and function pointer">;
8009def err_typecheck_convert_pointer_void_func : Error<
8010  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8011  "|%diff{passing $ to parameter of type $|"
8012  "passing to parameter of different type}0,1"
8013  "|%diff{returning $ from a function with result type $|"
8014  "returning from function with different return type}0,1"
8015  "|%diff{converting $ to type $|converting between types}0,1"
8016  "|%diff{initializing $ with an expression of type $|"
8017  "initializing with expression of different type}0,1"
8018  "|%diff{sending $ to parameter of type $|"
8019  "sending to parameter of different type}0,1"
8020  "|%diff{casting $ to type $|casting between types}0,1}2"
8021  " converts between void pointer and function pointer">;
8022def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
8023  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8024  "|%diff{passing $ to parameter of type $|"
8025  "passing to parameter of different type}0,1"
8026  "|%diff{returning $ from a function with result type $|"
8027  "returning from function with different return type}0,1"
8028  "|%diff{converting $ to type $|converting between types}0,1"
8029  "|%diff{initializing $ with an expression of type $|"
8030  "initializing with expression of different type}0,1"
8031  "|%diff{sending $ to parameter of type $|"
8032  "sending to parameter of different type}0,1"
8033  "|%diff{casting $ to type $|casting between types}0,1}2"
8034  " converts between pointers to integer types %select{with different sign|"
8035  "where one is of the unique plain 'char' type and the other is not}3">,
8036  InGroup<DiagGroup<"pointer-sign">>;
8037def err_typecheck_convert_incompatible_pointer_sign :
8038  Error<ext_typecheck_convert_incompatible_pointer_sign.Text>;
8039def ext_typecheck_convert_incompatible_pointer : ExtWarn<
8040  "incompatible pointer types "
8041  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8042  "|%diff{passing $ to parameter of type $|"
8043  "passing to parameter of different type}0,1"
8044  "|%diff{returning $ from a function with result type $|"
8045  "returning from function with different return type}0,1"
8046  "|%diff{converting $ to type $|converting between types}0,1"
8047  "|%diff{initializing $ with an expression of type $|"
8048  "initializing with expression of different type}0,1"
8049  "|%diff{sending $ to parameter of type $|"
8050  "sending to parameter of different type}0,1"
8051  "|%diff{casting $ to type $|casting between types}0,1}2"
8052  "%select{|; dereference with *|"
8053  "; take the address with &|"
8054  "; remove *|"
8055  "; remove &}3">,
8056  InGroup<IncompatiblePointerTypes>;
8057def err_typecheck_convert_incompatible_pointer : Error<
8058  "incompatible pointer types "
8059  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8060  "|%diff{passing $ to parameter of type $|"
8061  "passing to parameter of different type}0,1"
8062  "|%diff{returning $ from a function with result type $|"
8063  "returning from function with different return type}0,1"
8064  "|%diff{converting $ to type $|converting between types}0,1"
8065  "|%diff{initializing $ with an expression of type $|"
8066  "initializing with expression of different type}0,1"
8067  "|%diff{sending $ to parameter of type $|"
8068  "sending to parameter of different type}0,1"
8069  "|%diff{casting $ to type $|casting between types}0,1}2"
8070  "%select{|; dereference with *|"
8071  "; take the address with &|"
8072  "; remove *|"
8073  "; remove &}3">;
8074def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
8075  "incompatible function pointer types "
8076  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8077  "|%diff{passing $ to parameter of type $|"
8078  "passing to parameter of different type}0,1"
8079  "|%diff{returning $ from a function with result type $|"
8080  "returning from function with different return type}0,1"
8081  "|%diff{converting $ to type $|converting between types}0,1"
8082  "|%diff{initializing $ with an expression of type $|"
8083  "initializing with expression of different type}0,1"
8084  "|%diff{sending $ to parameter of type $|"
8085  "sending to parameter of different type}0,1"
8086  "|%diff{casting $ to type $|casting between types}0,1}2"
8087  "%select{|; dereference with *|"
8088  "; take the address with &|"
8089  "; remove *|"
8090  "; remove &}3">,
8091  InGroup<IncompatibleFunctionPointerTypes>;
8092def err_typecheck_convert_incompatible_function_pointer : Error<
8093  "incompatible function pointer types "
8094  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8095  "|%diff{passing $ to parameter of type $|"
8096  "passing to parameter of different type}0,1"
8097  "|%diff{returning $ from a function with result type $|"
8098  "returning from function with different return type}0,1"
8099  "|%diff{converting $ to type $|converting between types}0,1"
8100  "|%diff{initializing $ with an expression of type $|"
8101  "initializing with expression of different type}0,1"
8102  "|%diff{sending $ to parameter of type $|"
8103  "sending to parameter of different type}0,1"
8104  "|%diff{casting $ to type $|casting between types}0,1}2"
8105  "%select{|; dereference with *|"
8106  "; take the address with &|"
8107  "; remove *|"
8108  "; remove &}3">;
8109def ext_typecheck_convert_discards_qualifiers : ExtWarn<
8110  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8111  "|%diff{passing $ to parameter of type $|"
8112  "passing to parameter of different type}0,1"
8113  "|%diff{returning $ from a function with result type $|"
8114  "returning from function with different return type}0,1"
8115  "|%diff{converting $ to type $|converting between types}0,1"
8116  "|%diff{initializing $ with an expression of type $|"
8117  "initializing with expression of different type}0,1"
8118  "|%diff{sending $ to parameter of type $|"
8119  "sending to parameter of different type}0,1"
8120  "|%diff{casting $ to type $|casting between types}0,1}2"
8121  " discards qualifiers">,
8122  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8123def err_typecheck_convert_discards_qualifiers : Error<
8124  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8125  "|%diff{passing $ to parameter of type $|"
8126  "passing to parameter of different type}0,1"
8127  "|%diff{returning $ from a function with result type $|"
8128  "returning from function with different return type}0,1"
8129  "|%diff{converting $ to type $|converting between types}0,1"
8130  "|%diff{initializing $ with an expression of type $|"
8131  "initializing with expression of different type}0,1"
8132  "|%diff{sending $ to parameter of type $|"
8133  "sending to parameter of different type}0,1"
8134  "|%diff{casting $ to type $|casting between types}0,1}2"
8135  " discards qualifiers">;
8136def ext_nested_pointer_qualifier_mismatch : ExtWarn<
8137  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8138  "|%diff{passing $ to parameter of type $|"
8139  "passing to parameter of different type}0,1"
8140  "|%diff{returning $ from a function with result type $|"
8141  "returning from function with different return type}0,1"
8142  "|%diff{converting $ to type $|converting between types}0,1"
8143  "|%diff{initializing $ with an expression of type $|"
8144  "initializing with expression of different type}0,1"
8145  "|%diff{sending $ to parameter of type $|"
8146  "sending to parameter of different type}0,1"
8147  "|%diff{casting $ to type $|casting between types}0,1}2"
8148  " discards qualifiers in nested pointer types">,
8149  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8150def err_nested_pointer_qualifier_mismatch : Error<
8151  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8152  "|%diff{passing $ to parameter of type $|"
8153  "passing to parameter of different type}0,1"
8154  "|%diff{returning $ from a function with result type $|"
8155  "returning from function with different return type}0,1"
8156  "|%diff{converting $ to type $|converting between types}0,1"
8157  "|%diff{initializing $ with an expression of type $|"
8158  "initializing with expression of different type}0,1"
8159  "|%diff{sending $ to parameter of type $|"
8160  "sending to parameter of different type}0,1"
8161  "|%diff{casting $ to type $|casting between types}0,1}2"
8162  " discards qualifiers in nested pointer types">;
8163def warn_incompatible_vectors : Warning<
8164  "incompatible vector types "
8165  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8166  "|%diff{passing $ to parameter of type $|"
8167  "passing to parameter of different type}0,1"
8168  "|%diff{returning $ from a function with result type $|"
8169  "returning from function with different return type}0,1"
8170  "|%diff{converting $ to type $|converting between types}0,1"
8171  "|%diff{initializing $ with an expression of type $|"
8172  "initializing with expression of different type}0,1"
8173  "|%diff{sending $ to parameter of type $|"
8174  "sending to parameter of different type}0,1"
8175  "|%diff{casting $ to type $|casting between types}0,1}2">,
8176  InGroup<VectorConversion>, DefaultIgnore;
8177def err_incompatible_vectors : Error<
8178  "incompatible vector types "
8179  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8180  "|%diff{passing $ to parameter of type $|"
8181  "passing to parameter of different type}0,1"
8182  "|%diff{returning $ from a function with result type $|"
8183  "returning from function with different return type}0,1"
8184  "|%diff{converting $ to type $|converting between types}0,1"
8185  "|%diff{initializing $ with an expression of type $|"
8186  "initializing with expression of different type}0,1"
8187  "|%diff{sending $ to parameter of type $|"
8188  "sending to parameter of different type}0,1"
8189  "|%diff{casting $ to type $|casting between types}0,1}2">;
8190def err_int_to_block_pointer : Error<
8191  "invalid block pointer conversion "
8192  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8193  "|%diff{passing $ to parameter of type $|"
8194  "passing to parameter of different type}0,1"
8195  "|%diff{returning $ from a function with result type $|"
8196  "returning from function with different return type}0,1"
8197  "|%diff{converting $ to type $|converting between types}0,1"
8198  "|%diff{initializing $ with an expression of type $|"
8199  "initializing with expression of different type}0,1"
8200  "|%diff{sending $ to parameter of type $|"
8201  "sending to parameter of different type}0,1"
8202  "|%diff{casting $ to type $|casting between types}0,1}2">;
8203def err_typecheck_convert_incompatible_block_pointer : Error<
8204  "incompatible block pointer types "
8205  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8206  "|%diff{passing $ to parameter of type $|"
8207  "passing to parameter of different type}0,1"
8208  "|%diff{returning $ from a function with result type $|"
8209  "returning from function with different return type}0,1"
8210  "|%diff{converting $ to type $|converting between types}0,1"
8211  "|%diff{initializing $ with an expression of type $|"
8212  "initializing with expression of different type}0,1"
8213  "|%diff{sending $ to parameter of type $|"
8214  "sending to parameter of different type}0,1"
8215  "|%diff{casting $ to type $|casting between types}0,1}2">;
8216def err_typecheck_incompatible_address_space : Error<
8217  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8218  "|%diff{passing $ to parameter of type $|"
8219  "passing to parameter of different type}0,1"
8220  "|%diff{returning $ from a function with result type $|"
8221  "returning from function with different return type}0,1"
8222  "|%diff{converting $ to type $|converting between types}0,1"
8223  "|%diff{initializing $ with an expression of type $|"
8224  "initializing with expression of different type}0,1"
8225  "|%diff{sending $ to parameter of type $|"
8226  "sending to parameter of different type}0,1"
8227  "|%diff{casting $ to type $|casting between types}0,1}2"
8228  " changes address space of pointer">;
8229def err_typecheck_incompatible_nested_address_space : Error<
8230  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8231  "|%diff{passing $ to parameter of type $|"
8232  "passing to parameter of different type}0,1"
8233  "|%diff{returning $ from a function with result type $|"
8234  "returning from function with different return type}0,1"
8235  "|%diff{converting $ to type $|converting between types}0,1"
8236  "|%diff{initializing $ with an expression of type $|"
8237  "initializing with expression of different type}0,1"
8238  "|%diff{sending $ to parameter of type $|"
8239  "sending to parameter of different type}0,1"
8240  "|%diff{casting $ to type $|casting between types}0,1}2"
8241  " changes address space of nested pointer">;
8242def err_typecheck_incompatible_ownership : Error<
8243  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8244  "|%diff{passing $ to parameter of type $|"
8245  "passing to parameter of different type}0,1"
8246  "|%diff{returning $ from a function with result type $|"
8247  "returning from function with different return type}0,1"
8248  "|%diff{converting $ to type $|converting between types}0,1"
8249  "|%diff{initializing $ with an expression of type $|"
8250  "initializing with expression of different type}0,1"
8251  "|%diff{sending $ to parameter of type $|"
8252  "sending to parameter of different type}0,1"
8253  "|%diff{casting $ to type $|casting between types}0,1}2"
8254  " changes retain/release properties of pointer">;
8255def err_typecheck_comparison_of_distinct_blocks : Error<
8256  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
8257
8258def err_typecheck_array_not_modifiable_lvalue : Error<
8259  "array type %0 is not assignable">;
8260def err_typecheck_non_object_not_modifiable_lvalue : Error<
8261  "non-object type %0 is not assignable">;
8262def err_typecheck_expression_not_modifiable_lvalue : Error<
8263  "expression is not assignable">;
8264def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
8265  "incomplete type %0 is not assignable">;
8266def err_typecheck_lvalue_casts_not_supported : Error<
8267  "assignment to cast is illegal, lvalue casts are not supported">;
8268
8269def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
8270  "vector is not assignable (contains duplicate components)">;
8271def err_block_decl_ref_not_modifiable_lvalue : Error<
8272  "variable is not assignable (missing __block type specifier)">;
8273def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8274  "cannot assign to a variable captured by copy in a non-mutable lambda">;
8275def err_typecheck_call_not_function : Error<
8276  "called object type %0 is not a function or function pointer">;
8277def err_call_incomplete_return : Error<
8278  "calling function with incomplete return type %0">;
8279def err_call_function_incomplete_return : Error<
8280  "calling %0 with incomplete return type %1">;
8281def err_call_incomplete_argument : Error<
8282  "argument type %0 is incomplete">;
8283def err_typecheck_call_too_few_args : Error<
8284  "too few %select{|||execution configuration }0arguments to "
8285  "%select{function|block|method|kernel function}0 call, "
8286  "expected %1, have %2">;
8287def err_typecheck_call_too_few_args_one : Error<
8288  "too few %select{|||execution configuration }0arguments to "
8289  "%select{function|block|method|kernel function}0 call, "
8290  "single argument %1 was not specified">;
8291def err_typecheck_call_too_few_args_at_least : Error<
8292  "too few %select{|||execution configuration }0arguments to "
8293  "%select{function|block|method|kernel function}0 call, "
8294  "expected at least %1, have %2">;
8295def err_typecheck_call_too_few_args_at_least_one : Error<
8296  "too few %select{|||execution configuration }0arguments to "
8297  "%select{function|block|method|kernel function}0 call, "
8298  "at least argument %1 must be specified">;
8299def err_typecheck_call_too_few_args_suggest : Error<
8300  "too few %select{|||execution configuration }0arguments to "
8301  "%select{function|block|method|kernel function}0 call, "
8302  "expected %1, have %2; did you mean %3?">;
8303def err_typecheck_call_too_few_args_at_least_suggest : Error<
8304  "too few %select{|||execution configuration }0arguments to "
8305  "%select{function|block|method|kernel function}0 call, "
8306  "expected at least %1, have %2; did you mean %3?">;
8307def err_typecheck_call_too_many_args : Error<
8308  "too many %select{|||execution configuration }0arguments to "
8309  "%select{function|block|method|kernel function}0 call, "
8310  "expected %1, have %2">;
8311def err_typecheck_call_too_many_args_one : Error<
8312  "too many %select{|||execution configuration }0arguments to "
8313  "%select{function|block|method|kernel function}0 call, "
8314  "expected single argument %1, have %2 arguments">;
8315def err_typecheck_call_too_many_args_at_most : Error<
8316  "too many %select{|||execution configuration }0arguments to "
8317  "%select{function|block|method|kernel function}0 call, "
8318  "expected at most %1, have %2">;
8319def err_typecheck_call_too_many_args_at_most_one : Error<
8320  "too many %select{|||execution configuration }0arguments to "
8321  "%select{function|block|method|kernel function}0 call, "
8322  "expected at most single argument %1, have %2 arguments">;
8323def err_typecheck_call_too_many_args_suggest : Error<
8324  "too many %select{|||execution configuration }0arguments to "
8325  "%select{function|block|method|kernel function}0 call, "
8326  "expected %1, have %2; did you mean %3?">;
8327def err_typecheck_call_too_many_args_at_most_suggest : Error<
8328  "too many %select{|||execution configuration }0arguments to "
8329  "%select{function|block|method|kernel function}0 call, "
8330  "expected at most %1, have %2; did you mean %3?">;
8331
8332def err_arc_typecheck_convert_incompatible_pointer : Error<
8333  "incompatible pointer types passing retainable parameter of type %0"
8334  "to a CF function expecting %1 type">;
8335
8336def err_builtin_fn_use : Error<"builtin functions must be directly called">;
8337
8338def warn_call_wrong_number_of_arguments : Warning<
8339  "too %select{few|many}0 arguments in call to %1">;
8340def err_atomic_builtin_must_be_pointer : Error<
8341  "address argument to atomic builtin must be a pointer (%0 invalid)">;
8342def err_atomic_builtin_must_be_pointer_intptr : Error<
8343  "address argument to atomic builtin must be a pointer to integer or pointer"
8344  " (%0 invalid)">;
8345def err_atomic_builtin_cannot_be_const : Error<
8346  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
8347def err_atomic_builtin_must_be_pointer_intfltptr : Error<
8348  "address argument to atomic builtin must be a pointer to integer,"
8349  " floating-point or pointer (%0 invalid)">;
8350def err_atomic_builtin_pointer_size : Error<
8351  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
8352  "type (%0 invalid)">;
8353def err_atomic_exclusive_builtin_pointer_size : Error<
8354  "address argument to load or store exclusive builtin must be a pointer to"
8355  " 1,2,4 or 8 byte type (%0 invalid)">;
8356def err_atomic_builtin_ext_int_size : Error<
8357  "Atomic memory operand must have a power-of-two size">;
8358def err_atomic_builtin_bit_int_prohibit : Error<
8359  "argument to atomic builtin of type '_BitInt' is not supported">;
8360def err_atomic_op_needs_atomic : Error<
8361  "address argument to atomic operation must be a pointer to _Atomic "
8362  "type (%0 invalid)">;
8363def err_atomic_op_needs_non_const_atomic : Error<
8364  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
8365  "type (%1 invalid)">;
8366def err_atomic_op_needs_non_const_pointer : Error<
8367  "address argument to atomic operation must be a pointer to non-const "
8368  "type (%0 invalid)">;
8369def err_atomic_op_needs_trivial_copy : Error<
8370  "address argument to atomic operation must be a pointer to a "
8371  "trivially-copyable type (%0 invalid)">;
8372def err_atomic_op_needs_atomic_int_ptr_or_fp : Error<
8373  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8374  "integer, pointer or supported floating point type (%1 invalid)">;
8375def err_atomic_op_needs_atomic_int_or_ptr : Error<
8376  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8377  "integer or pointer (%1 invalid)">;
8378def err_atomic_op_needs_atomic_int : Error<
8379  "address argument to atomic operation must be a pointer to "
8380  "%select{|atomic }0integer (%1 invalid)">;
8381def warn_atomic_op_has_invalid_memory_order : Warning<
8382  "memory order argument to atomic operation is invalid">,
8383  InGroup<DiagGroup<"atomic-memory-ordering">>;
8384def err_atomic_op_has_invalid_synch_scope : Error<
8385  "synchronization scope argument to atomic operation is invalid">;
8386def warn_atomic_implicit_seq_cst : Warning<
8387  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
8388  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
8389
8390def err_overflow_builtin_must_be_int : Error<
8391  "operand argument to overflow builtin must be an integer (%0 invalid)">;
8392def err_overflow_builtin_must_be_ptr_int : Error<
8393  "result argument to overflow builtin must be a pointer "
8394  "to a non-const integer (%0 invalid)">;
8395def err_overflow_builtin_bit_int_max_size : Error<
8396  "__builtin_mul_overflow does not support 'signed _BitInt' operands of more "
8397  "than %0 bits">;
8398
8399def err_atomic_load_store_uses_lib : Error<
8400  "atomic %select{load|store}0 requires runtime support that is not "
8401  "available for this target">;
8402
8403def err_nontemporal_builtin_must_be_pointer : Error<
8404  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
8405def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
8406  "address argument to nontemporal builtin must be a pointer to integer, float, "
8407  "pointer, or a vector of such types (%0 invalid)">;
8408
8409def err_deleted_function_use : Error<"attempt to use a deleted function">;
8410def err_deleted_inherited_ctor_use : Error<
8411  "constructor inherited by %0 from base class %1 is implicitly deleted">;
8412
8413def note_called_by : Note<"called by %0">;
8414def err_kern_type_not_void_return : Error<
8415  "kernel function type %0 must have void return type">;
8416def err_kern_is_nonstatic_method : Error<
8417  "kernel function %0 must be a free function or static member function">;
8418def err_config_scalar_return : Error<
8419  "CUDA special function '%0' must have scalar return type">;
8420def err_kern_call_not_global_function : Error<
8421  "kernel call to non-global function %0">;
8422def err_global_call_not_config : Error<
8423  "call to global function %0 not configured">;
8424def err_ref_bad_target : Error<
8425  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8426  "%select{function|variable}1 %2 in %select{__device__|__global__|__host__|__host__ __device__}3 function">;
8427def note_cuda_const_var_unpromoted : Note<
8428  "const variable cannot be emitted on device side due to dynamic initialization">;
8429def note_cuda_host_var : Note<
8430  "host variable declared here">;
8431def err_ref_bad_target_global_initializer : Error<
8432  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8433  "function %1 in global initializer">;
8434def err_capture_bad_target : Error<
8435  "capture host variable %0 by reference in device or host device lambda function">;
8436def warn_maybe_capture_bad_target_this_ptr : Warning<
8437  "capture host side class data member by this pointer in device or host device lambda function "
8438  "may result in invalid memory access if this pointer is not accessible on device side">,
8439  InGroup<DiagGroup<"gpu-maybe-wrong-side">>;
8440def warn_kern_is_method : Extension<
8441  "kernel function %0 is a member function; this may not be accepted by nvcc">,
8442  InGroup<CudaCompat>;
8443def warn_kern_is_inline : Warning<
8444  "ignored 'inline' attribute on kernel function %0">,
8445  InGroup<CudaCompat>;
8446def err_variadic_device_fn : Error<
8447  "CUDA device code does not support variadic functions">;
8448def err_va_arg_in_device : Error<
8449  "CUDA device code does not support va_arg">;
8450def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
8451def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8452  "constexpr function %0 without __host__ or __device__ attributes cannot "
8453  "overload __device__ function with same signature.  Add a __host__ "
8454  "attribute, or build with -fno-cuda-host-device-constexpr.">;
8455def note_cuda_conflicting_device_function_declared_here : Note<
8456  "conflicting __device__ function declared here">;
8457def err_cuda_device_exceptions : Error<
8458  "cannot use '%0' in "
8459  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8460def err_dynamic_var_init : Error<
8461    "dynamic initialization is not supported for "
8462    "__device__, __constant__, __shared__, and __managed__ variables.">;
8463def err_shared_var_init : Error<
8464    "initialization is not supported for __shared__ variables.">;
8465def err_cuda_vla : Error<
8466    "cannot use variable-length arrays in "
8467    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8468def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8469def err_cuda_host_shared : Error<
8470    "__shared__ local variables not allowed in "
8471    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8472def err_cuda_nonstatic_constdev: Error<"__constant__, __device__, and "
8473    "__managed__ are not allowed on non-static local variables">;
8474def err_cuda_ovl_target : Error<
8475  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8476  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8477def note_cuda_ovl_candidate_target_mismatch : Note<
8478    "candidate template ignored: target attributes do not match">;
8479
8480def err_cuda_device_builtin_surftex_cls_template : Error<
8481    "illegal device builtin %select{surface|texture}0 reference "
8482    "class template %1 declared here">;
8483def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8484    "%0 needs to have exactly %1 template parameters">;
8485def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8486    "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8487    "%select{a type|an integer or enum value}2">;
8488
8489def err_cuda_device_builtin_surftex_ref_decl : Error<
8490    "illegal device builtin %select{surface|texture}0 reference "
8491    "type %1 declared here">;
8492def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8493    "%0 needs to be instantiated from a class template with proper "
8494    "template arguments">;
8495
8496def err_hip_invalid_args_builtin_mangled_name : Error<
8497    "invalid argument: symbol must be a device-side function or global variable">;
8498
8499def warn_non_pod_vararg_with_format_string : Warning<
8500  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8501  "%select{function|block|method|constructor}2; expected type from format "
8502  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8503// The arguments to this diagnostic should match the warning above.
8504def err_cannot_pass_objc_interface_to_vararg_format : Error<
8505  "cannot pass object with interface type %1 by value to variadic "
8506  "%select{function|block|method|constructor}2; expected type from format "
8507  "string was %3">;
8508def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8509  "cannot pass non-trivial C object of type %0 by value to variadic "
8510  "%select{function|block|method|constructor}1">;
8511
8512
8513def err_cannot_pass_objc_interface_to_vararg : Error<
8514  "cannot pass object with interface type %0 by value through variadic "
8515  "%select{function|block|method|constructor}1">;
8516def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8517  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8518  " %select{function|block|method|constructor}2; call will abort at runtime">,
8519  InGroup<NonPODVarargs>, DefaultError;
8520def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8521  "passing object of trivial but non-POD type %0 through variadic"
8522  " %select{function|block|method|constructor}1 is incompatible with C++98">,
8523  InGroup<CXX98Compat>, DefaultIgnore;
8524def warn_pass_class_arg_to_vararg : Warning<
8525  "passing object of class type %0 through variadic "
8526  "%select{function|block|method|constructor}1"
8527  "%select{|; did you mean to call '%3'?}2">,
8528  InGroup<ClassVarargs>, DefaultIgnore;
8529def err_cannot_pass_to_vararg : Error<
8530  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8531  "%select{function|block|method|constructor}2">;
8532def err_cannot_pass_to_vararg_format : Error<
8533  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8534  "%select{function|block|method|constructor}2; expected type from format "
8535  "string was %3">;
8536
8537def err_typecheck_call_invalid_ordered_compare : Error<
8538  "ordered compare requires two args of floating point type"
8539  "%diff{ ($ and $)|}0,1">;
8540def err_typecheck_call_invalid_unary_fp : Error<
8541  "floating point classification requires argument of floating point type "
8542  "(passed in %0)">;
8543def err_typecheck_cond_expect_int_float : Error<
8544  "used type %0 where integer or floating point type is required">;
8545def err_typecheck_cond_expect_scalar : Error<
8546  "used type %0 where arithmetic or pointer type is required">;
8547def err_typecheck_cond_expect_nonfloat : Error<
8548  "used type %0 where floating point type is not allowed">;
8549def ext_typecheck_cond_one_void : Extension<
8550  "C99 forbids conditional expressions with only one void side">;
8551def err_typecheck_cast_to_incomplete : Error<
8552  "cast to incomplete type %0">;
8553def ext_typecheck_cast_nonscalar : Extension<
8554  "C99 forbids casting nonscalar type %0 to the same type">;
8555def ext_typecheck_cast_to_union : Extension<
8556  "cast to union type is a GNU extension">,
8557  InGroup<GNUUnionCast>;
8558def err_typecheck_cast_to_union_no_type : Error<
8559  "cast to union type from type %0 not present in union">;
8560def err_cast_pointer_from_non_pointer_int : Error<
8561  "operand of type %0 cannot be cast to a pointer type">;
8562def warn_cast_pointer_from_sel : Warning<
8563  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8564  InGroup<SelTypeCast>;
8565def warn_function_def_in_objc_container : Warning<
8566  "function definition inside an Objective-C container is deprecated">,
8567  InGroup<FunctionDefInObjCContainer>;
8568def err_typecheck_call_requires_real_fp : Error<
8569  "argument type %0 is not a real floating point type">;
8570def err_typecheck_call_different_arg_types : Error<
8571  "arguments are of different types%diff{ ($ vs $)|}0,1">;
8572
8573def warn_cast_calling_conv : Warning<
8574  "cast between incompatible calling conventions '%0' and '%1'; "
8575  "calls through this pointer may abort at runtime">,
8576  InGroup<DiagGroup<"cast-calling-convention">>;
8577def note_change_calling_conv_fixit : Note<
8578  "consider defining %0 with the '%1' calling convention">;
8579def warn_bad_function_cast : Warning<
8580  "cast from function call of type %0 to non-matching type %1">,
8581  InGroup<BadFunctionCast>, DefaultIgnore;
8582def warn_cast_function_type : Warning<
8583  "cast %diff{from $ to $ |}0,1converts to incompatible function type">,
8584  InGroup<CastFunctionType>, DefaultIgnore;
8585def err_cast_pointer_to_non_pointer_int : Error<
8586  "pointer cannot be cast to type %0">;
8587def err_cast_to_bfloat16 : Error<"cannot type-cast to __bf16">;
8588def err_cast_from_bfloat16 : Error<"cannot type-cast from __bf16">;
8589def err_typecheck_expect_scalar_operand : Error<
8590  "operand of type %0 where arithmetic or pointer type is required">;
8591def err_typecheck_cond_incompatible_operands : Error<
8592  "incompatible operand types%diff{ ($ and $)|}0,1">;
8593def err_typecheck_expect_flt_or_vector : Error<
8594  "invalid operand of type %0 where floating, complex or "
8595  "a vector of such types is required">;
8596def err_cast_selector_expr : Error<
8597  "cannot type cast @selector expression">;
8598def ext_typecheck_cond_incompatible_pointers : ExtWarn<
8599  "pointer type mismatch%diff{ ($ and $)|}0,1">,
8600  InGroup<DiagGroup<"pointer-type-mismatch">>;
8601def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
8602  "pointer/integer type mismatch in conditional expression"
8603  "%diff{ ($ and $)|}0,1">,
8604  InGroup<DiagGroup<"conditional-type-mismatch">>;
8605def err_typecheck_choose_expr_requires_constant : Error<
8606  "'__builtin_choose_expr' requires a constant expression">;
8607def warn_unused_expr : Warning<"expression result unused">,
8608  InGroup<UnusedValue>;
8609def warn_unused_comma_left_operand : Warning<
8610  "left operand of comma operator has no effect">,
8611  InGroup<UnusedValue>;
8612def warn_unused_voidptr : Warning<
8613  "expression result unused; should this cast be to 'void'?">,
8614  InGroup<UnusedValue>;
8615def warn_unused_property_expr : Warning<
8616 "property access result unused - getters should not be used for side effects">,
8617  InGroup<UnusedGetterReturnValue>;
8618def warn_unused_container_subscript_expr : Warning<
8619 "container access result unused - container access should not be used for side effects">,
8620  InGroup<UnusedValue>;
8621def warn_unused_call : Warning<
8622  "ignoring return value of function declared with %0 attribute">,
8623  InGroup<UnusedValue>;
8624def warn_unused_constructor : Warning<
8625  "ignoring temporary created by a constructor declared with %0 attribute">,
8626  InGroup<UnusedValue>;
8627def warn_unused_constructor_msg : Warning<
8628  "ignoring temporary created by a constructor declared with %0 attribute: %1">,
8629  InGroup<UnusedValue>;
8630def warn_side_effects_unevaluated_context : Warning<
8631  "expression with side effects has no effect in an unevaluated context">,
8632  InGroup<UnevaluatedExpression>;
8633def warn_side_effects_typeid : Warning<
8634  "expression with side effects will be evaluated despite being used as an "
8635  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
8636def warn_unused_result : Warning<
8637  "ignoring return value of function declared with %0 attribute">,
8638  InGroup<UnusedResult>;
8639def warn_unused_result_msg : Warning<
8640  "ignoring return value of function declared with %0 attribute: %1">,
8641  InGroup<UnusedResult>;
8642def warn_unused_volatile : Warning<
8643  "expression result unused; assign into a variable to force a volatile load">,
8644  InGroup<DiagGroup<"unused-volatile-lvalue">>;
8645
8646def ext_cxx14_attr : Extension<
8647  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14Attrs>;
8648def ext_cxx17_attr : Extension<
8649  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17Attrs>;
8650def ext_cxx20_attr : Extension<
8651  "use of the %0 attribute is a C++20 extension">, InGroup<CXX20Attrs>;
8652
8653def warn_unused_comparison : Warning<
8654  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
8655  InGroup<UnusedComparison>;
8656def note_inequality_comparison_to_or_assign : Note<
8657  "use '|=' to turn this inequality comparison into an or-assignment">;
8658
8659def err_incomplete_type_used_in_type_trait_expr : Error<
8660  "incomplete type %0 used in type trait expression">;
8661
8662// C++20 constinit and require_constant_initialization attribute
8663def warn_cxx20_compat_constinit : Warning<
8664  "'constinit' specifier is incompatible with C++ standards before C++20">,
8665  InGroup<CXX20Compat>, DefaultIgnore;
8666def err_constinit_local_variable : Error<
8667  "local variable cannot be declared 'constinit'">;
8668def err_require_constant_init_failed : Error<
8669  "variable does not have a constant initializer">;
8670def note_declared_required_constant_init_here : Note<
8671  "required by %select{'require_constant_initialization' attribute|"
8672  "'constinit' specifier}0 here">;
8673def ext_constinit_missing : ExtWarn<
8674  "'constinit' specifier missing on initializing declaration of %0">,
8675  InGroup<DiagGroup<"missing-constinit">>;
8676def note_constinit_specified_here : Note<"variable declared constinit here">;
8677def err_constinit_added_too_late : Error<
8678  "'constinit' specifier added after initialization of variable">;
8679def warn_require_const_init_added_too_late : Warning<
8680  "'require_constant_initialization' attribute added after initialization "
8681  "of variable">, InGroup<IgnoredAttributes>;
8682def note_constinit_missing_here : Note<
8683  "add the "
8684  "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
8685  "to the initializing declaration here">;
8686
8687def err_dimension_expr_not_constant_integer : Error<
8688  "dimension expression does not evaluate to a constant unsigned int">;
8689
8690def err_typecheck_cond_incompatible_operands_null : Error<
8691  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
8692def ext_empty_struct_union : Extension<
8693  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
8694def ext_no_named_members_in_struct_union : Extension<
8695  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
8696def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
8697  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8698  InGroup<CXXCompat>, DefaultIgnore;
8699def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
8700  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8701  InGroup<ExternCCompat>;
8702def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
8703  "volatile qualifiers|const qualifier|volatile qualifier}2">,
8704  InGroup<CastQual>, DefaultIgnore;
8705def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
8706  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
8707def warn_redefine_extname_not_applied : Warning<
8708  "#pragma redefine_extname is applicable to external C declarations only; "
8709  "not applied to %select{function|variable}0 %1">,
8710  InGroup<Pragmas>;
8711} // End of general sema category.
8712
8713// inline asm.
8714let CategoryName = "Inline Assembly Issue" in {
8715  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
8716  def err_asm_invalid_output_constraint : Error<
8717    "invalid output constraint '%0' in asm">;
8718  def err_asm_invalid_lvalue_in_input : Error<
8719    "invalid lvalue in asm input for constraint '%0'">;
8720  def err_asm_invalid_input_constraint : Error<
8721    "invalid input constraint '%0' in asm">;
8722  def err_asm_tying_incompatible_types : Error<
8723    "unsupported inline asm: input with type "
8724    "%diff{$ matching output with type $|}0,1">;
8725  def err_asm_unexpected_constraint_alternatives : Error<
8726    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
8727  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
8728  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
8729  def err_asm_unwind_and_goto : Error<"unwind clobber can't be used with asm goto">;
8730  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
8731    "global register variables on this target">;
8732  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
8733    "match variable size">;
8734  def err_asm_bad_register_type : Error<"bad type for named register variable">;
8735  def err_asm_invalid_input_size : Error<
8736    "invalid input size for constraint '%0'">;
8737  def err_asm_invalid_output_size : Error<
8738    "invalid output size for constraint '%0'">;
8739  def err_invalid_asm_cast_lvalue : Error<
8740    "invalid use of a cast in a inline asm context requiring an lvalue: "
8741    "remove the cast or build with -fheinous-gnu-extensions">;
8742  def err_invalid_asm_value_for_constraint
8743      : Error <"value '%0' out of range for constraint '%1'">;
8744  def err_asm_non_addr_value_in_memory_constraint : Error <
8745    "reference to a %select{bit-field|vector element|global register variable}0"
8746    " in asm %select{input|output}1 with a memory constraint '%2'">;
8747  def err_asm_input_duplicate_match : Error<
8748    "more than one input constraint matches the same output '%0'">;
8749
8750  def warn_asm_label_on_auto_decl : Warning<
8751    "ignored asm label '%0' on automatic variable">;
8752  def warn_invalid_asm_cast_lvalue : Warning<
8753    "invalid use of a cast in an inline asm context requiring an lvalue: "
8754    "accepted due to -fheinous-gnu-extensions, but clang may remove support "
8755    "for this in the future">;
8756  def warn_asm_mismatched_size_modifier : Warning<
8757    "value size does not match register size specified by the constraint "
8758    "and modifier">,
8759    InGroup<ASMOperandWidths>;
8760
8761  def note_asm_missing_constraint_modifier : Note<
8762    "use constraint modifier \"%0\"">;
8763  def note_asm_input_duplicate_first : Note<
8764    "constraint '%0' is already present here">;
8765 def error_duplicate_asm_operand_name : Error<
8766    "duplicate use of asm operand name \"%0\"">;
8767 def note_duplicate_asm_operand_name : Note<
8768    "asm operand name \"%0\" first referenced here">;
8769}
8770
8771  def error_inoutput_conflict_with_clobber : Error<
8772    "asm-specifier for input or output variable conflicts with asm"
8773    " clobber list">;
8774
8775let CategoryName = "Semantic Issue" in {
8776
8777def err_invalid_conversion_between_matrixes : Error<
8778  "conversion between matrix types%diff{ $ and $|}0,1 of different size is not allowed">;
8779
8780def err_invalid_conversion_between_matrix_and_type : Error<
8781  "conversion between matrix type %0 and incompatible type %1 is not allowed">;
8782
8783def err_invalid_conversion_between_vectors : Error<
8784  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
8785  "size">;
8786def err_invalid_conversion_between_vector_and_integer : Error<
8787  "invalid conversion between vector type %0 and integer type %1 "
8788  "of different size">;
8789
8790def err_opencl_function_pointer : Error<
8791  "%select{pointers|references}0 to functions are not allowed">;
8792
8793def err_opencl_taking_address_capture : Error<
8794  "taking address of a capture is not allowed">;
8795
8796def err_invalid_conversion_between_vector_and_scalar : Error<
8797  "invalid conversion between vector type %0 and scalar type %1">;
8798
8799// C++ member initializers.
8800def err_only_constructors_take_base_inits : Error<
8801  "only constructors take base initializers">;
8802
8803def err_multiple_mem_initialization : Error <
8804  "multiple initializations given for non-static member %0">;
8805def err_multiple_mem_union_initialization : Error <
8806  "initializing multiple members of union">;
8807def err_multiple_base_initialization : Error <
8808  "multiple initializations given for base %0">;
8809
8810def err_mem_init_not_member_or_class : Error<
8811  "member initializer %0 does not name a non-static data member or base "
8812  "class">;
8813
8814def warn_initializer_out_of_order : Warning<
8815  "%select{field|base class}0 %1 will be initialized after "
8816  "%select{field|base}2 %3">,
8817  InGroup<ReorderCtor>, DefaultIgnore;
8818
8819def warn_some_initializers_out_of_order : Warning<
8820  "initializer order does not match the declaration order">,
8821  InGroup<ReorderCtor>, DefaultIgnore;
8822
8823def note_initializer_out_of_order : Note<
8824  "%select{field|base class}0 %1 will be initialized after "
8825  "%select{field|base}2 %3">;
8826
8827def warn_abstract_vbase_init_ignored : Warning<
8828  "initializer for virtual base class %0 of abstract class %1 "
8829  "will never be used">,
8830  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
8831
8832def err_base_init_does_not_name_class : Error<
8833  "constructor initializer %0 does not name a class">;
8834def err_base_init_direct_and_virtual : Error<
8835  "base class initializer %0 names both a direct base class and an "
8836  "inherited virtual base class">;
8837def err_not_direct_base_or_virtual : Error<
8838  "type %0 is not a direct or virtual base of %1">;
8839
8840def err_in_class_initializer_non_const : Error<
8841  "non-const static data member must be initialized out of line">;
8842def err_in_class_initializer_volatile : Error<
8843  "static const volatile data member must be initialized out of line">;
8844def err_in_class_initializer_bad_type : Error<
8845  "static data member of type %0 must be initialized out of line">;
8846def ext_in_class_initializer_float_type : ExtWarn<
8847  "in-class initializer for static data member of type %0 is a GNU extension">,
8848  InGroup<GNUStaticFloatInit>;
8849def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
8850  "in-class initializer for static data member of type %0 requires "
8851  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
8852def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
8853def err_in_class_initializer_literal_type : Error<
8854  "in-class initializer for static data member of type %0 requires "
8855  "'constexpr' specifier">;
8856def err_in_class_initializer_non_constant : Error<
8857  "in-class initializer for static data member is not a constant expression">;
8858def err_default_member_initializer_not_yet_parsed : Error<
8859  "default member initializer for %1 needed within definition of enclosing "
8860  "class %0 outside of member functions">;
8861def note_default_member_initializer_not_yet_parsed : Note<
8862  "default member initializer declared here">;
8863def err_default_member_initializer_cycle
8864    : Error<"default member initializer for %0 uses itself">;
8865
8866def ext_in_class_initializer_non_constant : Extension<
8867  "in-class initializer for static data member is not a constant expression; "
8868  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
8869
8870def err_thread_dynamic_init : Error<
8871  "initializer for thread-local variable must be a constant expression">;
8872def err_thread_nontrivial_dtor : Error<
8873  "type of thread-local variable has non-trivial destruction">;
8874def note_use_thread_local : Note<
8875  "use 'thread_local' to allow this">;
8876
8877// C++ anonymous unions and GNU anonymous structs/unions
8878def ext_anonymous_union : Extension<
8879  "anonymous unions are a C11 extension">, InGroup<C11>;
8880def ext_gnu_anonymous_struct : Extension<
8881  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
8882def ext_c11_anonymous_struct : Extension<
8883  "anonymous structs are a C11 extension">, InGroup<C11>;
8884def err_anonymous_union_not_static : Error<
8885  "anonymous unions at namespace or global scope must be declared 'static'">;
8886def err_anonymous_union_with_storage_spec : Error<
8887  "anonymous union at class scope must not have a storage specifier">;
8888def err_anonymous_struct_not_member : Error<
8889  "anonymous %select{structs|structs and classes}0 must be "
8890  "%select{struct or union|class}0 members">;
8891def err_anonymous_record_member_redecl : Error<
8892  "member of anonymous %select{struct|union}0 redeclares %1">;
8893def err_anonymous_record_with_type : Error<
8894  "types cannot be declared in an anonymous %select{struct|union}0">;
8895def ext_anonymous_record_with_type : Extension<
8896  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
8897  "extension">, InGroup<MicrosoftAnonTag>;
8898def ext_anonymous_record_with_anonymous_type : Extension<
8899  "anonymous types declared in an anonymous %select{struct|union}0 "
8900  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
8901def err_anonymous_record_with_function : Error<
8902  "functions cannot be declared in an anonymous %select{struct|union}0">;
8903def err_anonymous_record_with_static : Error<
8904  "static members cannot be declared in an anonymous %select{struct|union}0">;
8905def err_anonymous_record_bad_member : Error<
8906  "anonymous %select{struct|union}0 can only contain non-static data members">;
8907def err_anonymous_record_nonpublic_member : Error<
8908  "anonymous %select{struct|union}0 cannot contain a "
8909  "%select{private|protected}1 data member">;
8910def ext_ms_anonymous_record : ExtWarn<
8911  "anonymous %select{structs|unions}0 are a Microsoft extension">,
8912  InGroup<MicrosoftAnonTag>;
8913
8914// C++ local classes
8915def err_reference_to_local_in_enclosing_context : Error<
8916  "reference to local %select{variable|binding}1 %0 declared in enclosing "
8917  "%select{%3|block literal|lambda expression|context}2">;
8918
8919def err_static_data_member_not_allowed_in_local_class : Error<
8920  "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
8921
8922// C++ derived classes
8923def err_base_clause_on_union : Error<"unions cannot have base classes">;
8924def err_base_must_be_class : Error<"base specifier must name a class">;
8925def err_union_as_base_class : Error<"unions cannot be base classes">;
8926def err_circular_inheritance : Error<
8927  "circular inheritance between %0 and %1">;
8928def err_base_class_has_flexible_array_member : Error<
8929  "base class %0 has a flexible array member">;
8930def err_incomplete_base_class : Error<"base class has incomplete type">;
8931def err_duplicate_base_class : Error<
8932  "base class %0 specified more than once as a direct base class">;
8933def warn_inaccessible_base_class : Warning<
8934  "direct base %0 is inaccessible due to ambiguity:%1">,
8935  InGroup<DiagGroup<"inaccessible-base">>;
8936// FIXME: better way to display derivation?  Pass entire thing into diagclient?
8937def err_ambiguous_derived_to_base_conv : Error<
8938  "ambiguous conversion from derived class %0 to base class %1:%2">;
8939def err_ambiguous_memptr_conv : Error<
8940  "ambiguous conversion from pointer to member of %select{base|derived}0 "
8941  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
8942def ext_ms_ambiguous_direct_base : ExtWarn<
8943  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
8944  InGroup<MicrosoftInaccessibleBase>;
8945
8946def err_memptr_conv_via_virtual : Error<
8947  "conversion from pointer to member of class %0 to pointer to member "
8948  "of class %1 via virtual base %2 is not allowed">;
8949
8950// C++ member name lookup
8951def err_ambiguous_member_multiple_subobjects : Error<
8952  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
8953def err_ambiguous_member_multiple_subobject_types : Error<
8954  "member %0 found in multiple base classes of different types">;
8955def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
8956def note_ambiguous_member_type_found : Note<
8957  "member type %0 found by ambiguous name lookup">;
8958def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
8959def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
8960def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
8961  "declaration in a different namespace">;
8962def note_hidden_tag : Note<"type declaration hidden">;
8963def note_hiding_object : Note<"declaration hides type">;
8964
8965// C++ operator overloading
8966def err_operator_overload_needs_class_or_enum : Error<
8967  "overloaded %0 must have at least one parameter of class "
8968  "or enumeration type">;
8969
8970def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
8971def err_operator_overload_static : Error<
8972  "overloaded %0 cannot be a static member function">;
8973def err_operator_overload_default_arg : Error<
8974  "parameter of overloaded %0 cannot have a default argument">;
8975def err_operator_overload_must_be : Error<
8976  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
8977  "(has %1 parameter%s1)">;
8978
8979def err_operator_overload_must_be_member : Error<
8980  "overloaded %0 must be a non-static member function">;
8981def err_operator_overload_post_incdec_must_be_int : Error<
8982  "parameter of overloaded post-%select{increment|decrement}1 operator must "
8983  "have type 'int' (not %0)">;
8984
8985// C++ allocation and deallocation functions.
8986def err_operator_new_delete_declared_in_namespace : Error<
8987  "%0 cannot be declared inside a namespace">;
8988def err_operator_new_delete_declared_static : Error<
8989  "%0 cannot be declared static in global scope">;
8990def ext_operator_new_delete_declared_inline : ExtWarn<
8991  "replacement function %0 cannot be declared 'inline'">,
8992  InGroup<DiagGroup<"inline-new-delete">>;
8993def err_operator_new_delete_invalid_result_type : Error<
8994  "%0 must return type %1">;
8995def err_operator_new_delete_dependent_result_type : Error<
8996  "%0 cannot have a dependent return type; use %1 instead">;
8997def err_operator_new_delete_too_few_parameters : Error<
8998  "%0 must have at least one parameter">;
8999def err_operator_new_delete_template_too_few_parameters : Error<
9000  "%0 template must have at least two parameters">;
9001def warn_operator_new_returns_null : Warning<
9002  "%0 should not return a null pointer unless it is declared 'throw()'"
9003  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
9004
9005def err_operator_new_dependent_param_type : Error<
9006  "%0 cannot take a dependent type as first parameter; "
9007  "use size_t (%1) instead">;
9008def err_operator_new_param_type : Error<
9009  "%0 takes type size_t (%1) as first parameter">;
9010def err_operator_new_default_arg: Error<
9011  "parameter of %0 cannot have a default argument">;
9012def err_operator_delete_dependent_param_type : Error<
9013  "%0 cannot take a dependent type as first parameter; use %1 instead">;
9014def err_operator_delete_param_type : Error<
9015  "first parameter of %0 must have type %1">;
9016def err_destroying_operator_delete_not_usual : Error<
9017  "destroying operator delete can have only an optional size and optional "
9018  "alignment parameter">;
9019def note_implicit_delete_this_in_destructor_here : Note<
9020  "while checking implicit 'delete this' for virtual destructor">;
9021def err_builtin_operator_new_delete_not_usual : Error<
9022  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
9023  "selects non-usual %select{allocation|deallocation}0 function">;
9024def note_non_usual_function_declared_here : Note<
9025  "non-usual %0 declared here">;
9026
9027// C++ literal operators
9028def err_literal_operator_outside_namespace : Error<
9029  "literal operator %0 must be in a namespace or global scope">;
9030def err_literal_operator_id_outside_namespace : Error<
9031  "non-namespace scope '%0' cannot have a literal operator member">;
9032def err_literal_operator_default_argument : Error<
9033  "literal operator cannot have a default argument">;
9034def err_literal_operator_bad_param_count : Error<
9035  "non-template literal operator must have one or two parameters">;
9036def err_literal_operator_invalid_param : Error<
9037  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
9038def err_literal_operator_param : Error<
9039  "invalid literal operator parameter type %0, did you mean %1?">;
9040def err_literal_operator_template_with_params : Error<
9041  "literal operator template cannot have any parameters">;
9042def err_literal_operator_template : Error<
9043  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
9044def err_literal_operator_extern_c : Error<
9045  "literal operator must have C++ linkage">;
9046def ext_string_literal_operator_template : ExtWarn<
9047  "string literal operator templates are a GNU extension">,
9048  InGroup<GNUStringLiteralOperatorTemplate>;
9049def warn_user_literal_reserved : Warning<
9050  "user-defined literal suffixes not starting with '_' are reserved"
9051  "%select{; no literal will invoke this operator|}0">,
9052  InGroup<UserDefinedLiterals>;
9053
9054// C++ conversion functions
9055def err_conv_function_not_member : Error<
9056  "conversion function must be a non-static member function">;
9057def err_conv_function_return_type : Error<
9058  "conversion function cannot have a return type">;
9059def err_conv_function_with_params : Error<
9060  "conversion function cannot have any parameters">;
9061def err_conv_function_variadic : Error<
9062  "conversion function cannot be variadic">;
9063def err_conv_function_to_array : Error<
9064  "conversion function cannot convert to an array type">;
9065def err_conv_function_to_function : Error<
9066  "conversion function cannot convert to a function type">;
9067def err_conv_function_with_complex_decl : Error<
9068  "cannot specify any part of a return type in the "
9069  "declaration of a conversion function"
9070  "%select{"
9071  "; put the complete type after 'operator'|"
9072  "; use a typedef to declare a conversion to %1|"
9073  "; use an alias template to declare a conversion to %1|"
9074  "}0">;
9075def err_conv_function_redeclared : Error<
9076  "conversion function cannot be redeclared">;
9077def warn_conv_to_self_not_used : Warning<
9078  "conversion function converting %0 to itself will never be used">,
9079  InGroup<ClassConversion>;
9080def warn_conv_to_base_not_used : Warning<
9081  "conversion function converting %0 to its base class %1 will never be used">,
9082  InGroup<ClassConversion>;
9083def warn_conv_to_void_not_used : Warning<
9084  "conversion function converting %0 to %1 will never be used">,
9085  InGroup<ClassConversion>;
9086
9087def warn_not_compound_assign : Warning<
9088  "use of unary operator that may be intended as compound assignment (%0=)">;
9089
9090// C++11 explicit conversion operators
9091def ext_explicit_conversion_functions : ExtWarn<
9092  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
9093def warn_cxx98_compat_explicit_conversion_functions : Warning<
9094  "explicit conversion functions are incompatible with C++98">,
9095  InGroup<CXX98Compat>, DefaultIgnore;
9096
9097// C++11 defaulted functions
9098def err_defaulted_special_member_params : Error<
9099  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
9100  "have default arguments">;
9101def err_defaulted_special_member_variadic : Error<
9102  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
9103  "be variadic">;
9104def err_defaulted_special_member_return_type : Error<
9105  "explicitly-defaulted %select{copy|move}0 assignment operator must "
9106  "return %1">;
9107def err_defaulted_special_member_quals : Error<
9108  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
9109  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
9110def err_defaulted_special_member_volatile_param : Error<
9111  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
9112  "may not be volatile">;
9113def err_defaulted_special_member_move_const_param : Error<
9114  "the parameter for an explicitly-defaulted move "
9115  "%select{constructor|assignment operator}0 may not be const">;
9116def err_defaulted_special_member_copy_const_param : Error<
9117  "the parameter for this explicitly-defaulted copy "
9118  "%select{constructor|assignment operator}0 is const, but a member or base "
9119  "requires it to be non-const">;
9120def err_defaulted_copy_assign_not_ref : Error<
9121  "the parameter for an explicitly-defaulted copy assignment operator must be an "
9122  "lvalue reference type">;
9123def err_incorrect_defaulted_constexpr : Error<
9124  "defaulted definition of %sub{select_special_member_kind}0 "
9125  "is not constexpr">;
9126def err_incorrect_defaulted_consteval : Error<
9127  "defaulted declaration of %sub{select_special_member_kind}0 "
9128  "cannot be consteval because implicit definition is not constexpr">;
9129def warn_defaulted_method_deleted : Warning<
9130  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
9131  "deleted">, InGroup<DefaultedFunctionDeleted>;
9132def err_out_of_line_default_deletes : Error<
9133  "defaulting this %sub{select_special_member_kind}0 "
9134  "would delete it after its first declaration">;
9135def note_deleted_type_mismatch : Note<
9136  "function is implicitly deleted because its declared type does not match "
9137  "the type of an implicit %sub{select_special_member_kind}0">;
9138def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
9139  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
9140  "different from the implicit type is incompatible with C++ standards before "
9141  "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9142def warn_vbase_moved_multiple_times : Warning<
9143  "defaulted move assignment operator of %0 will move assign virtual base "
9144  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
9145def note_vbase_moved_here : Note<
9146  "%select{%1 is a virtual base class of base class %2 declared here|"
9147  "virtual base class %1 declared here}0">;
9148
9149// C++20 defaulted comparisons
9150// This corresponds to values of Sema::DefaultedComparisonKind.
9151def select_defaulted_comparison_kind : TextSubstitution<
9152  "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
9153  "operator">;
9154def ext_defaulted_comparison : ExtWarn<
9155  "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
9156def warn_cxx17_compat_defaulted_comparison : Warning<
9157  "defaulted comparison operators are incompatible with C++ standards "
9158  "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9159def err_defaulted_comparison_template : Error<
9160  "comparison operator template cannot be defaulted">;
9161def err_defaulted_comparison_num_args : Error<
9162  "%select{non-member|member}0 %sub{select_defaulted_comparison_kind}1"
9163  " comparison operator must have %select{2|1}0 parameters">;
9164def err_defaulted_comparison_param : Error<
9165  "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
9166  "; found %1, expected %2%select{| or %4}3">;
9167def err_defaulted_comparison_param_unknown : Error<
9168  "invalid parameter type for non-member defaulted"
9169  " %sub{select_defaulted_comparison_kind}0"
9170  "; found %1, expected class or reference to a constant class">;
9171def err_defaulted_comparison_param_mismatch : Error<
9172  "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
9173  "must have the same type%diff{ (found $ vs $)|}1,2">;
9174def err_defaulted_comparison_not_friend : Error<
9175  "%sub{select_defaulted_comparison_kind}0 is not a friend of"
9176  " %select{|incomplete class }1%2">;
9177def err_defaulted_comparison_non_const : Error<
9178  "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
9179  "const-qualified">;
9180def err_defaulted_comparison_return_type_not_bool : Error<
9181  "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9182  "must be 'bool', not %1">;
9183def err_defaulted_comparison_deduced_return_type_not_auto : Error<
9184  "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9185  "must be 'auto', not %1">;
9186def warn_defaulted_comparison_deleted : Warning<
9187  "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
9188  "deleted">, InGroup<DefaultedFunctionDeleted>;
9189def err_non_first_default_compare_deletes : Error<
9190  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
9191  "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
9192  "would delete it after its first declaration">;
9193def note_defaulted_comparison_union : Note<
9194  "defaulted %0 is implicitly deleted because "
9195  "%2 is a %select{union-like class|union}1 with variant members">;
9196def note_defaulted_comparison_reference_member : Note<
9197  "defaulted %0 is implicitly deleted because "
9198  "class %1 has a reference member">;
9199def note_defaulted_comparison_ambiguous : Note<
9200  "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
9201  "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
9202def note_defaulted_comparison_inaccessible : Note<
9203  "defaulted %0 is implicitly deleted because it would invoke a "
9204  "%select{private|protected}3 %4%select{ member of %6|"
9205  " member of %6 to compare member %2| to compare base class %2}1">;
9206def note_defaulted_comparison_calls_deleted : Note<
9207  "defaulted %0 is implicitly deleted because it would invoke a deleted "
9208  "comparison function%select{| for member %2| for base class %2}1">;
9209def note_defaulted_comparison_no_viable_function : Note<
9210  "defaulted %0 is implicitly deleted because there is no viable "
9211  "%select{three-way comparison function|'operator=='}1 for "
9212  "%select{|member |base class }2%3">;
9213def note_defaulted_comparison_no_viable_function_synthesized : Note<
9214  "three-way comparison cannot be synthesized because there is no viable "
9215  "function for %select{'=='|'<'}0 comparison">;
9216def note_defaulted_comparison_not_rewritten_callee : Note<
9217  "defaulted %0 is implicitly deleted because this non-rewritten comparison "
9218  "function would be the best match for the comparison">;
9219def note_defaulted_comparison_not_rewritten_conversion : Note<
9220  "defaulted %0 is implicitly deleted because a builtin comparison function "
9221  "using this conversion would be the best match for the comparison">;
9222def note_defaulted_comparison_cannot_deduce : Note<
9223  "return type of defaulted 'operator<=>' cannot be deduced because "
9224  "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
9225  "is not a standard comparison category type">;
9226def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
9227  "return type of defaulted 'operator<=>' cannot be deduced because "
9228  "three-way comparison for %select{|member|base class}0 %1 "
9229  "has a deduced return type and is not yet defined">;
9230def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
9231  "%select{|member|base class}0 %1 declared here">;
9232def note_defaulted_comparison_cannot_deduce_callee : Note<
9233  "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
9234def err_incorrect_defaulted_comparison_constexpr : Error<
9235  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9236  "three-way comparison operator}0 "
9237  "cannot be declared %select{constexpr|consteval}2 because "
9238  "%select{it|the corresponding implicit 'operator=='}0 "
9239  "invokes a non-constexpr comparison function">;
9240def note_defaulted_comparison_not_constexpr : Note<
9241  "non-constexpr comparison function would be used to compare "
9242  "%select{|member %1|base class %1}0">;
9243def note_defaulted_comparison_not_constexpr_here : Note<
9244  "non-constexpr comparison function declared here">;
9245def note_in_declaration_of_implicit_equality_comparison : Note<
9246  "while declaring the corresponding implicit 'operator==' "
9247  "for this defaulted 'operator<=>'">;
9248
9249def ext_implicit_exception_spec_mismatch : ExtWarn<
9250  "function previously declared with an %select{explicit|implicit}0 exception "
9251  "specification redeclared with an %select{implicit|explicit}0 exception "
9252  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
9253
9254def warn_ptr_arith_precedes_bounds : Warning<
9255  "the pointer decremented by %0 refers before the beginning of the array">,
9256  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9257def warn_ptr_arith_exceeds_bounds : Warning<
9258  "the pointer incremented by %0 refers past the end of the array (that "
9259  "contains %1 element%s2)">,
9260  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9261def warn_array_index_precedes_bounds : Warning<
9262  "array index %0 is before the beginning of the array">,
9263  InGroup<ArrayBounds>;
9264def warn_array_index_exceeds_bounds : Warning<
9265  "array index %0 is past the end of the array (which contains %1 "
9266  "element%s2)">, InGroup<ArrayBounds>;
9267def warn_ptr_arith_exceeds_max_addressable_bounds : Warning<
9268  "the pointer incremented by %0 refers past the last possible element for an array in %1-bit "
9269  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9270  InGroup<ArrayBounds>;
9271def warn_array_index_exceeds_max_addressable_bounds : Warning<
9272  "array index %0 refers past the last possible element for an array in %1-bit "
9273  "address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)">,
9274  InGroup<ArrayBounds>;
9275def note_array_declared_here : Note<
9276  "array %0 declared here">;
9277
9278def warn_printf_insufficient_data_args : Warning<
9279  "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
9280def warn_printf_data_arg_not_used : Warning<
9281  "data argument not used by format string">, InGroup<FormatExtraArgs>;
9282def warn_format_invalid_conversion : Warning<
9283  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
9284def warn_printf_incomplete_specifier : Warning<
9285  "incomplete format specifier">, InGroup<Format>;
9286def warn_missing_format_string : Warning<
9287  "format string missing">, InGroup<Format>;
9288def warn_scanf_nonzero_width : Warning<
9289  "zero field width in scanf format string is unused">,
9290  InGroup<Format>;
9291def warn_format_conversion_argument_type_mismatch : Warning<
9292  "format specifies type %0 but the argument has "
9293  "%select{type|underlying type}2 %1">,
9294  InGroup<Format>;
9295def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
9296  warn_format_conversion_argument_type_mismatch.Text>,
9297  InGroup<FormatPedantic>;
9298def warn_format_conversion_argument_type_mismatch_confusion : Warning<
9299  warn_format_conversion_argument_type_mismatch.Text>,
9300  InGroup<FormatTypeConfusion>, DefaultIgnore;
9301def warn_format_argument_needs_cast : Warning<
9302  "%select{values of type|enum values with underlying type}2 '%0' should not "
9303  "be used as format arguments; add an explicit cast to %1 instead">,
9304  InGroup<Format>;
9305def warn_format_argument_needs_cast_pedantic : Warning<
9306  warn_format_argument_needs_cast.Text>,
9307  InGroup<FormatPedantic>, DefaultIgnore;
9308def warn_printf_positional_arg_exceeds_data_args : Warning <
9309  "data argument position '%0' exceeds the number of data arguments (%1)">,
9310  InGroup<Format>;
9311def warn_format_zero_positional_specifier : Warning<
9312  "position arguments in format strings start counting at 1 (not 0)">,
9313  InGroup<Format>;
9314def warn_format_invalid_positional_specifier : Warning<
9315  "invalid position specified for %select{field width|field precision}0">,
9316  InGroup<Format>;
9317def warn_format_mix_positional_nonpositional_args : Warning<
9318  "cannot mix positional and non-positional arguments in format string">,
9319  InGroup<Format>;
9320def warn_static_array_too_small : Warning<
9321  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
9322  " callee requires at least %1">,
9323  InGroup<ArrayBounds>;
9324def note_callee_static_array : Note<
9325  "callee declares array parameter as static here">;
9326def warn_empty_format_string : Warning<
9327  "format string is empty">, InGroup<FormatZeroLength>;
9328def warn_format_string_is_wide_literal : Warning<
9329  "format string should not be a wide string">, InGroup<Format>;
9330def warn_printf_format_string_contains_null_char : Warning<
9331  "format string contains '\\0' within the string body">, InGroup<Format>;
9332def warn_printf_format_string_not_null_terminated : Warning<
9333  "format string is not null-terminated">, InGroup<Format>;
9334def warn_printf_asterisk_missing_arg : Warning<
9335  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
9336  InGroup<Format>;
9337def warn_printf_asterisk_wrong_type : Warning<
9338  "field %select{width|precision}0 should have type %1, but argument has type %2">,
9339  InGroup<Format>;
9340def warn_printf_nonsensical_optional_amount: Warning<
9341  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
9342  InGroup<Format>;
9343def warn_printf_nonsensical_flag: Warning<
9344  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
9345  InGroup<Format>;
9346def warn_format_nonsensical_length: Warning<
9347  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
9348  InGroup<Format>;
9349def warn_format_non_standard_positional_arg: Warning<
9350  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
9351def warn_format_non_standard: Warning<
9352  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
9353  InGroup<FormatNonStandard>, DefaultIgnore;
9354def warn_format_non_standard_conversion_spec: Warning<
9355  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
9356  InGroup<FormatNonStandard>, DefaultIgnore;
9357def err_invalid_mask_type_size : Error<
9358  "mask type size must be between 1-byte and 8-bytes">;
9359def warn_format_invalid_annotation : Warning<
9360  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
9361  InGroup<Format>;
9362def warn_format_P_no_precision : Warning<
9363  "using '%%P' format specifier without precision">,
9364  InGroup<Format>;
9365def warn_printf_ignored_flag: Warning<
9366  "flag '%0' is ignored when flag '%1' is present">,
9367  InGroup<Format>;
9368def warn_printf_empty_objc_flag: Warning<
9369  "missing object format flag">,
9370  InGroup<Format>;
9371def warn_printf_ObjCflags_without_ObjCConversion: Warning<
9372  "object format flags cannot be used with '%0' conversion specifier">,
9373  InGroup<Format>;
9374def warn_printf_invalid_objc_flag: Warning<
9375    "'%0' is not a valid object format flag">,
9376    InGroup<Format>;
9377def warn_printf_narg_not_supported : Warning<
9378    "'%%n' specifier not supported on this platform">,
9379    InGroup<Format>;
9380def warn_scanf_scanlist_incomplete : Warning<
9381  "no closing ']' for '%%[' in scanf format string">,
9382  InGroup<Format>;
9383def warn_format_bool_as_character : Warning<
9384  "using '%0' format specifier, but argument has boolean value">,
9385  InGroup<Format>;
9386def note_format_string_defined : Note<"format string is defined here">;
9387def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
9388def note_printf_c_str: Note<"did you mean to call the %0 method?">;
9389def note_format_security_fixit: Note<
9390  "treat the string as an argument to avoid this">;
9391
9392def warn_null_arg : Warning<
9393  "null passed to a callee that requires a non-null argument">,
9394  InGroup<NonNull>;
9395def warn_null_ret : Warning<
9396  "null returned from %select{function|method}0 that requires a non-null return value">,
9397  InGroup<NonNull>;
9398
9399def err_lifetimebound_no_object_param : Error<
9400  "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
9401  "function has no implicit object parameter">;
9402def err_lifetimebound_ctor_dtor : Error<
9403  "'lifetimebound' attribute cannot be applied to a "
9404  "%select{constructor|destructor}0">;
9405
9406// CHECK: returning address/reference of stack memory
9407def warn_ret_stack_addr_ref : Warning<
9408  "%select{address of|reference to}0 stack memory associated with "
9409  "%select{local variable|parameter}2 %1 returned">,
9410  InGroup<ReturnStackAddress>;
9411def warn_ret_local_temp_addr_ref : Warning<
9412  "returning %select{address of|reference to}0 local temporary object">,
9413  InGroup<ReturnStackAddress>;
9414def warn_ret_addr_label : Warning<
9415  "returning address of label, which is local">,
9416  InGroup<ReturnStackAddress>;
9417def err_ret_local_block : Error<
9418  "returning block that lives on the local stack">;
9419def note_local_var_initializer : Note<
9420  "%select{via initialization of|binding reference}0 variable "
9421  "%select{%2 |}1here">;
9422def note_lambda_capture_initializer : Note<
9423  "%select{implicitly |}2captured%select{| by reference}3"
9424  "%select{%select{ due to use|}2 here|"
9425  " via initialization of lambda capture %0}1">;
9426def note_init_with_default_member_initalizer : Note<
9427  "initializing field %0 with default member initializer">;
9428
9429// Check for initializing a member variable with the address or a reference to
9430// a constructor parameter.
9431def warn_bind_ref_member_to_parameter : Warning<
9432  "binding reference member %0 to stack allocated "
9433  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9434def warn_init_ptr_member_to_parameter_addr : Warning<
9435  "initializing pointer member %0 with the stack address of "
9436  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9437def note_ref_or_ptr_member_declared_here : Note<
9438  "%select{reference|pointer}0 member declared here">;
9439
9440def err_dangling_member : Error<
9441  "%select{reference|backing array for 'std::initializer_list'}2 "
9442  "%select{|subobject of }1member %0 "
9443  "%select{binds to|is}2 a temporary object "
9444  "whose lifetime would be shorter than the lifetime of "
9445  "the constructed object">;
9446def warn_dangling_member : Warning<
9447  "%select{reference|backing array for 'std::initializer_list'}2 "
9448  "%select{|subobject of }1member %0 "
9449  "%select{binds to|is}2 a temporary object "
9450  "whose lifetime is shorter than the lifetime of the constructed object">,
9451  InGroup<DanglingField>;
9452def warn_dangling_lifetime_pointer_member : Warning<
9453  "initializing pointer member %0 to point to a temporary object "
9454  "whose lifetime is shorter than the lifetime of the constructed object">,
9455  InGroup<DanglingGsl>;
9456def note_lifetime_extending_member_declared_here : Note<
9457  "%select{%select{reference|'std::initializer_list'}0 member|"
9458  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
9459  "declared here">;
9460def warn_dangling_variable : Warning<
9461  "%select{temporary %select{whose address is used as value of|"
9462  "%select{|implicitly }2bound to}4 "
9463  "%select{%select{|reference }4member of local variable|"
9464  "local %select{variable|reference}4}1|"
9465  "array backing "
9466  "%select{initializer list subobject of local variable|"
9467  "local initializer list}1}0 "
9468  "%select{%3 |}2will be destroyed at the end of the full-expression">,
9469  InGroup<Dangling>;
9470def warn_new_dangling_reference : Warning<
9471  "temporary bound to reference member of allocated object "
9472  "will be destroyed at the end of the full-expression">,
9473  InGroup<DanglingField>;
9474def warn_dangling_lifetime_pointer : Warning<
9475  "object backing the pointer "
9476  "will be destroyed at the end of the full-expression">,
9477  InGroup<DanglingGsl>;
9478def warn_new_dangling_initializer_list : Warning<
9479  "array backing "
9480  "%select{initializer list subobject of the allocated object|"
9481  "the allocated initializer list}0 "
9482  "will be destroyed at the end of the full-expression">,
9483  InGroup<DanglingInitializerList>;
9484def warn_unsupported_lifetime_extension : Warning<
9485  "sorry, lifetime extension of "
9486  "%select{temporary|backing array of initializer list}0 created "
9487  "by aggregate initialization using default member initializer "
9488  "is not supported; lifetime of %select{temporary|backing array}0 "
9489  "will end at the end of the full-expression">, InGroup<Dangling>;
9490
9491// For non-floating point, expressions of the form x == x or x != x
9492// should result in a warning, since these always evaluate to a constant.
9493// Array comparisons have similar warnings
9494def warn_comparison_always : Warning<
9495  "%select{self-|array }0comparison always evaluates to "
9496  "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9497  InGroup<TautologicalCompare>;
9498def warn_comparison_bitwise_always : Warning<
9499  "bitwise comparison always evaluates to %select{false|true}0">,
9500  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9501def warn_comparison_bitwise_or : Warning<
9502  "bitwise or with non-zero value always evaluates to true">,
9503  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9504def warn_tautological_overlap_comparison : Warning<
9505  "overlapping comparisons always evaluate to %select{false|true}0">,
9506  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9507def warn_depr_array_comparison : Warning<
9508  "comparison between two arrays is deprecated; "
9509  "to compare array addresses, use unary '+' to decay operands to pointers">,
9510  InGroup<DeprecatedArrayCompare>;
9511
9512def warn_stringcompare : Warning<
9513  "result of comparison against %select{a string literal|@encode}0 is "
9514  "unspecified (use an explicit string comparison function instead)">,
9515  InGroup<StringCompare>;
9516
9517def warn_identity_field_assign : Warning<
9518  "assigning %select{field|instance variable}0 to itself">,
9519  InGroup<SelfAssignmentField>;
9520
9521// Type safety attributes
9522def err_type_tag_for_datatype_not_ice : Error<
9523  "'type_tag_for_datatype' attribute requires the initializer to be "
9524  "an %select{integer|integral}0 constant expression">;
9525def err_type_tag_for_datatype_too_large : Error<
9526  "'type_tag_for_datatype' attribute requires the initializer to be "
9527  "an %select{integer|integral}0 constant expression "
9528  "that can be represented by a 64 bit integer">;
9529def err_tag_index_out_of_range : Error<
9530  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
9531def warn_type_tag_for_datatype_wrong_kind : Warning<
9532  "this type tag was not designed to be used with this function">,
9533  InGroup<TypeSafety>;
9534def warn_type_safety_type_mismatch : Warning<
9535  "argument type %0 doesn't match specified %1 type tag "
9536  "%select{that requires %3|}2">, InGroup<TypeSafety>;
9537def warn_type_safety_null_pointer_required : Warning<
9538  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
9539
9540// Generic selections.
9541def err_assoc_type_incomplete : Error<
9542  "type %0 in generic association incomplete">;
9543def err_assoc_type_nonobject : Error<
9544  "type %0 in generic association not an object type">;
9545def err_assoc_type_variably_modified : Error<
9546  "type %0 in generic association is a variably modified type">;
9547def err_assoc_compatible_types : Error<
9548  "type %0 in generic association compatible with previously specified type %1">;
9549def note_compat_assoc : Note<
9550  "compatible type %0 specified here">;
9551def err_generic_sel_no_match : Error<
9552  "controlling expression type %0 not compatible with any generic association type">;
9553def err_generic_sel_multi_match : Error<
9554  "controlling expression type %0 compatible with %1 generic association types">;
9555
9556
9557// Blocks
9558def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
9559  " or %select{pick a deployment target that supports them|for OpenCL C 2.0"
9560  " or OpenCL C 3.0 with __opencl_c_device_enqueue feature}0">;
9561def err_block_returning_array_function : Error<
9562  "block cannot return %select{array|function}0 type %1">;
9563
9564// Builtin annotation
9565def err_builtin_annotation_first_arg : Error<
9566  "first argument to __builtin_annotation must be an integer">;
9567def err_builtin_annotation_second_arg : Error<
9568  "second argument to __builtin_annotation must be a non-wide string constant">;
9569def err_msvc_annotation_wide_str : Error<
9570  "arguments to __annotation must be wide string constants">;
9571
9572// CFString checking
9573def err_cfstring_literal_not_string_constant : Error<
9574  "CFString literal is not a string constant">;
9575def warn_cfstring_truncated : Warning<
9576  "input conversion stopped due to an input byte that does not "
9577  "belong to the input codeset UTF-8">,
9578  InGroup<DiagGroup<"CFString-literal">>;
9579
9580// os_log checking
9581// TODO: separate diagnostic for os_trace()
9582def err_os_log_format_not_string_constant : Error<
9583  "os_log() format argument is not a string constant">;
9584def err_os_log_argument_too_big : Error<
9585  "os_log() argument %0 is too big (%1 bytes, max %2)">;
9586def warn_os_log_format_narg : Error<
9587 "os_log() '%%n' format specifier is not allowed">, DefaultError;
9588
9589// Statements.
9590def err_continue_not_in_loop : Error<
9591  "'continue' statement not in loop statement">;
9592def err_break_not_in_loop_or_switch : Error<
9593  "'break' statement not in loop or switch statement">;
9594def warn_loop_ctrl_binds_to_inner : Warning<
9595  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
9596  InGroup<GccCompat>;
9597def warn_break_binds_to_switch : Warning<
9598  "'break' is bound to loop, GCC binds it to switch">,
9599  InGroup<GccCompat>;
9600def err_default_not_in_switch : Error<
9601  "'default' statement not in switch statement">;
9602def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
9603def warn_bool_switch_condition : Warning<
9604  "switch condition has boolean value">, InGroup<SwitchBool>;
9605def warn_case_value_overflow : Warning<
9606  "overflow converting case value to switch condition type (%0 to %1)">,
9607  InGroup<Switch>;
9608def err_duplicate_case : Error<"duplicate case value '%0'">;
9609def err_duplicate_case_differing_expr : Error<
9610  "duplicate case value: '%0' and '%1' both equal '%2'">;
9611def warn_case_empty_range : Warning<"empty case range specified">;
9612def warn_missing_case_for_condition :
9613  Warning<"no case matching constant switch condition '%0'">;
9614
9615def warn_def_missing_case : Warning<"%plural{"
9616  "1:enumeration value %1 not explicitly handled in switch|"
9617  "2:enumeration values %1 and %2 not explicitly handled in switch|"
9618  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
9619  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
9620  InGroup<SwitchEnum>, DefaultIgnore;
9621
9622def warn_missing_case : Warning<"%plural{"
9623  "1:enumeration value %1 not handled in switch|"
9624  "2:enumeration values %1 and %2 not handled in switch|"
9625  "3:enumeration values %1, %2, and %3 not handled in switch|"
9626  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
9627  InGroup<Switch>;
9628
9629def warn_unannotated_fallthrough : Warning<
9630  "unannotated fall-through between switch labels">,
9631  InGroup<ImplicitFallthrough>, DefaultIgnore;
9632def warn_unannotated_fallthrough_per_function : Warning<
9633  "unannotated fall-through between switch labels in partly-annotated "
9634  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
9635def note_insert_fallthrough_fixit : Note<
9636  "insert '%0;' to silence this warning">;
9637def note_insert_break_fixit : Note<
9638  "insert 'break;' to avoid fall-through">;
9639def err_fallthrough_attr_wrong_target : Error<
9640  "%0 attribute is only allowed on empty statements">;
9641def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
9642def err_fallthrough_attr_outside_switch : Error<
9643  "fallthrough annotation is outside switch statement">;
9644def err_fallthrough_attr_invalid_placement : Error<
9645  "fallthrough annotation does not directly precede switch label">;
9646
9647def warn_unreachable_default : Warning<
9648  "default label in switch which covers all enumeration values">,
9649  InGroup<CoveredSwitchDefault>, DefaultIgnore;
9650def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
9651  InGroup<Switch>;
9652def warn_not_in_enum_assignment : Warning<"integer constant not in range "
9653  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
9654def err_typecheck_statement_requires_scalar : Error<
9655  "statement requires expression of scalar type (%0 invalid)">;
9656def err_typecheck_statement_requires_integer : Error<
9657  "statement requires expression of integer type (%0 invalid)">;
9658def err_multiple_default_labels_defined : Error<
9659  "multiple default labels in one switch">;
9660def err_switch_multiple_conversions : Error<
9661  "multiple conversions from switch condition type %0 to an integral or "
9662  "enumeration type">;
9663def note_switch_conversion : Note<
9664  "conversion to %select{integral|enumeration}0 type %1">;
9665def err_switch_explicit_conversion : Error<
9666  "switch condition type %0 requires explicit conversion to %1">;
9667def err_switch_incomplete_class_type : Error<
9668  "switch condition has incomplete class type %0">;
9669
9670def warn_empty_if_body : Warning<
9671  "if statement has empty body">, InGroup<EmptyBody>;
9672def warn_empty_for_body : Warning<
9673  "for loop has empty body">, InGroup<EmptyBody>;
9674def warn_empty_range_based_for_body : Warning<
9675  "range-based for loop has empty body">, InGroup<EmptyBody>;
9676def warn_empty_while_body : Warning<
9677  "while loop has empty body">, InGroup<EmptyBody>;
9678def warn_empty_switch_body : Warning<
9679  "switch statement has empty body">, InGroup<EmptyBody>;
9680def note_empty_body_on_separate_line : Note<
9681  "put the semicolon on a separate line to silence this warning">;
9682
9683def err_va_start_captured_stmt : Error<
9684  "'va_start' cannot be used in a captured statement">;
9685def err_va_start_outside_function : Error<
9686  "'va_start' cannot be used outside a function">;
9687def err_va_start_fixed_function : Error<
9688  "'va_start' used in function with fixed args">;
9689def err_va_start_used_in_wrong_abi_function : Error<
9690  "'va_start' used in %select{System V|Win64}0 ABI function">;
9691def err_ms_va_start_used_in_sysv_function : Error<
9692  "'__builtin_ms_va_start' used in System V ABI function">;
9693def warn_second_arg_of_va_start_not_last_named_param : Warning<
9694  "second argument to 'va_start' is not the last named parameter">,
9695  InGroup<Varargs>;
9696def warn_va_start_type_is_undefined : Warning<
9697  "passing %select{an object that undergoes default argument promotion|"
9698  "an object of reference type|a parameter declared with the 'register' "
9699  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
9700def err_first_argument_to_va_arg_not_of_type_va_list : Error<
9701  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
9702def err_second_parameter_to_va_arg_incomplete: Error<
9703  "second argument to 'va_arg' is of incomplete type %0">;
9704def err_second_parameter_to_va_arg_abstract: Error<
9705  "second argument to 'va_arg' is of abstract type %0">;
9706def warn_second_parameter_to_va_arg_not_pod : Warning<
9707  "second argument to 'va_arg' is of non-POD type %0">,
9708  InGroup<NonPODVarargs>, DefaultError;
9709def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
9710  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
9711  InGroup<NonPODVarargs>, DefaultError;
9712def warn_second_parameter_to_va_arg_never_compatible : Warning<
9713  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
9714  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
9715
9716def warn_return_missing_expr : Warning<
9717  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9718  InGroup<ReturnType>;
9719def ext_return_missing_expr : ExtWarn<
9720  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9721  InGroup<ReturnType>;
9722def ext_return_has_expr : ExtWarn<
9723  "%select{void function|void method|constructor|destructor}1 %0 "
9724  "should not return a value">,
9725  DefaultError, InGroup<ReturnType>;
9726def ext_return_has_void_expr : Extension<
9727  "void %select{function|method|block}1 %0 should not return void expression">;
9728def err_return_init_list : Error<
9729  "%select{void function|void method|constructor|destructor}1 %0 "
9730  "must not return a value">;
9731def err_ctor_dtor_returns_void : Error<
9732  "%select{constructor|destructor}1 %0 must not return void expression">;
9733def warn_noreturn_function_has_return_expr : Warning<
9734  "function %0 declared 'noreturn' should not return">,
9735  InGroup<InvalidNoreturn>;
9736def warn_falloff_noreturn_function : Warning<
9737  "function declared 'noreturn' should not return">,
9738  InGroup<InvalidNoreturn>;
9739def err_noreturn_block_has_return_expr : Error<
9740  "block declared 'noreturn' should not return">;
9741def err_carries_dependency_missing_on_first_decl : Error<
9742  "%select{function|parameter}0 declared '[[carries_dependency]]' "
9743  "after its first declaration">;
9744def note_carries_dependency_missing_first_decl : Note<
9745  "declaration missing '[[carries_dependency]]' attribute is here">;
9746def err_carries_dependency_param_not_function_decl : Error<
9747  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
9748  "declaration or lambda">;
9749def err_block_on_nonlocal : Error<
9750  "__block attribute not allowed, only allowed on local variables">;
9751def err_block_on_vm : Error<
9752  "__block attribute not allowed on declaration with a variably modified type">;
9753def err_sizeless_nonlocal : Error<
9754  "non-local variable with sizeless type %0">;
9755
9756def err_vec_builtin_non_vector : Error<
9757 "first two arguments to %0 must be vectors">;
9758def err_vec_builtin_incompatible_vector : Error<
9759  "first two arguments to %0 must have the same type">;
9760def err_vsx_builtin_nonconstant_argument : Error<
9761  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
9762
9763def err_shufflevector_nonconstant_argument : Error<
9764  "index for __builtin_shufflevector must be a constant integer">;
9765def err_shufflevector_argument_too_large : Error<
9766  "index for __builtin_shufflevector must be less than the total number "
9767  "of vector elements">;
9768
9769def err_convertvector_non_vector : Error<
9770  "first argument to __builtin_convertvector must be a vector">;
9771def err_convertvector_non_vector_type : Error<
9772  "second argument to __builtin_convertvector must be a vector type">;
9773def err_convertvector_incompatible_vector : Error<
9774  "first two arguments to __builtin_convertvector must have the same number of elements">;
9775
9776def err_first_argument_to_cwsc_not_call : Error<
9777  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
9778def err_first_argument_to_cwsc_block_call : Error<
9779  "first argument to __builtin_call_with_static_chain must not be a block call">;
9780def err_first_argument_to_cwsc_builtin_call : Error<
9781  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
9782def err_first_argument_to_cwsc_pdtor_call : Error<
9783  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
9784def err_second_argument_to_cwsc_not_pointer : Error<
9785  "second argument to __builtin_call_with_static_chain must be of pointer type">;
9786
9787def err_vector_incorrect_num_initializers : Error<
9788  "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
9789def err_altivec_empty_initializer : Error<"expected initializer">;
9790
9791def err_invalid_neon_type_code : Error<
9792  "incompatible constant for this __builtin_neon function">;
9793def err_argument_invalid_range : Error<
9794  "argument value %0 is outside the valid range [%1, %2]">;
9795def warn_argument_invalid_range : Warning<
9796  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
9797  InGroup<DiagGroup<"argument-outside-range">>;
9798def warn_argument_undefined_behaviour : Warning<
9799  "argument value %0 will result in undefined behaviour">,
9800  InGroup<DiagGroup<"argument-undefined-behaviour">>;
9801def err_argument_not_multiple : Error<
9802  "argument should be a multiple of %0">;
9803def err_argument_not_power_of_2 : Error<
9804  "argument should be a power of 2">;
9805def err_argument_not_shifted_byte : Error<
9806  "argument should be an 8-bit value shifted by a multiple of 8 bits">;
9807def err_argument_not_shifted_byte_or_xxff : Error<
9808  "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
9809def err_argument_not_contiguous_bit_field : Error<
9810  "argument %0 value should represent a contiguous bit field">;
9811def err_rotation_argument_to_cadd
9812    : Error<"argument should be the value 90 or 270">;
9813def err_rotation_argument_to_cmla
9814    : Error<"argument should be the value 0, 90, 180 or 270">;
9815def warn_neon_vector_initializer_non_portable : Warning<
9816  "vector initializers are not compatible with NEON intrinsics in big endian "
9817  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
9818def note_neon_vector_initializer_non_portable : Note<
9819  "consider using vld1_%0%1() to initialize a vector from memory, or "
9820  "vcreate_%0%1() to initialize from an integer constant">;
9821def note_neon_vector_initializer_non_portable_q : Note<
9822  "consider using vld1q_%0%1() to initialize a vector from memory, or "
9823  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
9824  "constants">;
9825def err_systemz_invalid_tabort_code : Error<
9826  "invalid transaction abort code">;
9827def err_64_bit_builtin_32_bit_tgt : Error<
9828  "this builtin is only available on 64-bit targets">;
9829def err_32_bit_builtin_64_bit_tgt : Error<
9830  "this builtin is only available on 32-bit targets">;
9831def err_builtin_x64_aarch64_only : Error<
9832  "this builtin is only available on x86-64 and aarch64 targets">;
9833def err_mips_builtin_requires_dsp : Error<
9834  "this builtin requires 'dsp' ASE, please use -mdsp">;
9835def err_mips_builtin_requires_dspr2 : Error<
9836  "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
9837def err_mips_builtin_requires_msa : Error<
9838  "this builtin requires 'msa' ASE, please use -mmsa">;
9839def err_ppc_builtin_only_on_arch : Error<
9840  "this builtin is only valid on POWER%0 or later CPUs">;
9841def err_ppc_builtin_requires_vsx : Error<
9842  "this builtin requires VSX to be enabled">;
9843def err_ppc_builtin_requires_htm : Error<
9844  "this builtin requires HTM to be enabled">;
9845def err_ppc_builtin_requires_abi : Error<
9846  "this builtin requires ABI -mabi=%0">;
9847def err_ppc_invalid_use_mma_type : Error<
9848  "invalid use of PPC MMA type">;
9849def err_ppc_invalid_test_data_class_type : Error<
9850  "expected a 'float' or 'double' for the first argument">;
9851def err_x86_builtin_invalid_rounding : Error<
9852  "invalid rounding argument">;
9853def err_x86_builtin_invalid_scale : Error<
9854  "scale argument must be 1, 2, 4, or 8">;
9855def err_x86_builtin_tile_arg_duplicate : Error<
9856  "tile arguments must refer to different tiles">;
9857
9858def err_builtin_target_unsupported : Error<
9859  "builtin is not supported on this target">;
9860def err_builtin_longjmp_unsupported : Error<
9861  "__builtin_longjmp is not supported for the current target">;
9862def err_builtin_setjmp_unsupported : Error<
9863  "__builtin_setjmp is not supported for the current target">;
9864
9865def err_builtin_longjmp_invalid_val : Error<
9866  "argument to __builtin_longjmp must be a constant 1">;
9867def err_builtin_requires_language : Error<"'%0' is only available in %1">;
9868
9869def err_constant_integer_arg_type : Error<
9870  "argument to %0 must be a constant integer">;
9871
9872def ext_mixed_decls_code : Extension<
9873  "mixing declarations and code is a C99 extension">,
9874  InGroup<DeclarationAfterStatement>;
9875def warn_mixed_decls_code : Warning<
9876  "mixing declarations and code is incompatible with standards before C99">,
9877  InGroup<DeclarationAfterStatement>, DefaultIgnore;
9878
9879def err_non_local_variable_decl_in_for : Error<
9880  "declaration of non-local variable in 'for' loop">;
9881def err_non_variable_decl_in_for : Error<
9882  "non-variable declaration in 'for' loop">;
9883def err_toomany_element_decls : Error<
9884  "only one element declaration is allowed">;
9885def err_selector_element_not_lvalue : Error<
9886  "selector element is not a valid lvalue">;
9887def err_selector_element_type : Error<
9888  "selector element type %0 is not a valid object">;
9889def err_selector_element_const_type : Error<
9890  "selector element of type %0 cannot be a constant lvalue expression">;
9891def err_collection_expr_type : Error<
9892  "the type %0 is not a pointer to a fast-enumerable object">;
9893def warn_collection_expr_type : Warning<
9894  "collection expression type %0 may not respond to %1">;
9895
9896def err_invalid_conversion_between_ext_vectors : Error<
9897  "invalid conversion between ext-vector type %0 and %1">;
9898
9899def warn_duplicate_attribute_exact : Warning<
9900  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
9901
9902def warn_duplicate_attribute : Warning<
9903  "attribute %0 is already applied with different arguments">,
9904  InGroup<IgnoredAttributes>;
9905def err_disallowed_duplicate_attribute : Error<
9906  "attribute %0 cannot appear more than once on a declaration">;
9907
9908def warn_sync_fetch_and_nand_semantics_change : Warning<
9909  "the semantics of this intrinsic changed with GCC "
9910  "version 4.4 - the newer semantics are provided here">,
9911  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
9912
9913// Type
9914def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
9915  InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
9916def warn_receiver_forward_class : Warning<
9917  "receiver %0 is a forward class and corresponding @interface may not exist">,
9918  InGroup<ForwardClassReceiver>;
9919def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
9920def ext_missing_declspec : ExtWarn<
9921  "declaration specifier missing, defaulting to 'int'">;
9922def ext_missing_type_specifier : ExtWarn<
9923  "type specifier missing, defaults to 'int'">,
9924  InGroup<ImplicitInt>;
9925def err_decimal_unsupported : Error<
9926  "GNU decimal type extension not supported">;
9927def err_missing_type_specifier : Error<
9928  "C++ requires a type specifier for all declarations">;
9929def err_objc_array_of_interfaces : Error<
9930  "array of interface %0 is invalid (probably should be an array of pointers)">;
9931def ext_c99_array_usage : Extension<
9932  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9933  "feature">, InGroup<C99>;
9934def err_c99_array_usage_cxx : Error<
9935  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9936  "feature, not permitted in C++">;
9937def err_type_unsupported : Error<
9938  "%0 is not supported on this target">;
9939def err_nsconsumed_attribute_mismatch : Error<
9940  "overriding method has mismatched ns_consumed attribute on its"
9941  " parameter">;
9942def err_nsreturns_retained_attribute_mismatch : Error<
9943  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
9944  " attributes">;
9945def err_nserrordomain_invalid_decl : Error<
9946  "domain argument %select{|%1 }0does not refer to global constant">;
9947def err_nserrordomain_wrong_type : Error<
9948  "domain argument %0 does not point to an NSString or CFString constant">;
9949
9950def warn_nsconsumed_attribute_mismatch : Warning<
9951  err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
9952def warn_nsreturns_retained_attribute_mismatch : Warning<
9953  err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
9954
9955def note_getter_unavailable : Note<
9956  "or because setter is declared here, but no getter method %0 is found">;
9957def err_invalid_protocol_qualifiers : Error<
9958  "invalid protocol qualifiers on non-ObjC type">;
9959def warn_ivar_use_hidden : Warning<
9960  "local declaration of %0 hides instance variable">,
9961   InGroup<ShadowIvar>;
9962def warn_direct_initialize_call : Warning<
9963  "explicit call to +initialize results in duplicate call to +initialize">,
9964   InGroup<ExplicitInitializeCall>;
9965def warn_direct_super_initialize_call : Warning<
9966  "explicit call to [super initialize] should only be in implementation "
9967  "of +initialize">,
9968   InGroup<ExplicitInitializeCall>;
9969def err_ivar_use_in_class_method : Error<
9970  "instance variable %0 accessed in class method">;
9971def err_private_ivar_access : Error<"instance variable %0 is private">,
9972  AccessControl;
9973def err_protected_ivar_access : Error<"instance variable %0 is protected">,
9974  AccessControl;
9975def warn_maynot_respond : Warning<"%0 may not respond to %1">;
9976def ext_typecheck_base_super : Warning<
9977  "method parameter type "
9978  "%diff{$ does not match super class method parameter type $|"
9979  "does not match super class method parameter type}0,1">,
9980   InGroup<SuperSubClassMismatch>, DefaultIgnore;
9981def warn_missing_method_return_type : Warning<
9982  "method has no return type specified; defaults to 'id'">,
9983  InGroup<MissingMethodReturnType>, DefaultIgnore;
9984def warn_direct_ivar_access : Warning<"instance variable %0 is being "
9985  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
9986
9987// Spell-checking diagnostics
9988def err_unknown_typename : Error<
9989  "unknown type name %0">;
9990def err_unknown_type_or_class_name_suggest : Error<
9991  "unknown %select{type|class}1 name %0; did you mean %2?">;
9992def err_unknown_typename_suggest : Error<
9993  "unknown type name %0; did you mean %1?">;
9994def err_unknown_nested_typename_suggest : Error<
9995  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
9996def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
9997def err_undeclared_use_suggest : Error<
9998  "use of undeclared %0; did you mean %1?">;
9999def err_undeclared_var_use_suggest : Error<
10000  "use of undeclared identifier %0; did you mean %1?">;
10001def err_no_template : Error<"no template named %0">;
10002def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
10003def err_no_member_template : Error<"no template named %0 in %1">;
10004def err_no_member_template_suggest : Error<
10005  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
10006def err_non_template_in_template_id : Error<
10007  "%0 does not name a template but is followed by template arguments">;
10008def err_non_template_in_template_id_suggest : Error<
10009  "%0 does not name a template but is followed by template arguments; "
10010  "did you mean %1?">;
10011def err_non_template_in_member_template_id_suggest : Error<
10012  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
10013def note_non_template_in_template_id_found : Note<
10014  "non-template declaration found by name lookup">;
10015def err_mem_init_not_member_or_class_suggest : Error<
10016  "initializer %0 does not name a non-static data member or base "
10017  "class; did you mean the %select{base class|member}1 %2?">;
10018def err_field_designator_unknown_suggest : Error<
10019  "field designator %0 does not refer to any field in type %1; did you mean "
10020  "%2?">;
10021def err_typecheck_member_reference_ivar_suggest : Error<
10022  "%0 does not have a member named %1; did you mean %2?">;
10023def err_property_not_found_suggest : Error<
10024  "property %0 not found on object of type %1; did you mean %2?">;
10025def err_class_property_found : Error<
10026  "property %0 is a class property; did you mean to access it with class '%1'?">;
10027def err_ivar_access_using_property_syntax_suggest : Error<
10028  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
10029def warn_property_access_suggest : Warning<
10030"property %0 not found on object of type %1; did you mean to access property %2?">,
10031InGroup<PropertyAccessDotSyntax>;
10032def err_property_found_suggest : Error<
10033  "property %0 found on object of type %1; did you mean to access "
10034  "it with the \".\" operator?">;
10035def err_undef_interface_suggest : Error<
10036  "cannot find interface declaration for %0; did you mean %1?">;
10037def warn_undef_interface_suggest : Warning<
10038  "cannot find interface declaration for %0; did you mean %1?">;
10039def err_undef_superclass_suggest : Error<
10040  "cannot find interface declaration for %0, superclass of %1; did you mean "
10041  "%2?">;
10042def err_undeclared_protocol_suggest : Error<
10043  "cannot find protocol declaration for %0; did you mean %1?">;
10044def note_base_class_specified_here : Note<
10045  "base class %0 specified here">;
10046def err_using_directive_suggest : Error<
10047  "no namespace named %0; did you mean %1?">;
10048def err_using_directive_member_suggest : Error<
10049  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
10050def note_namespace_defined_here : Note<"namespace %0 defined here">;
10051def err_sizeof_pack_no_pack_name_suggest : Error<
10052  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
10053def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
10054
10055def err_uncasted_use_of_unknown_any : Error<
10056  "%0 has unknown type; cast it to its declared type to use it">;
10057def err_uncasted_call_of_unknown_any : Error<
10058  "%0 has unknown return type; cast the call to its declared return type">;
10059def err_uncasted_send_to_unknown_any_method : Error<
10060  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
10061  "message send to the method's return type">;
10062def err_unsupported_unknown_any_decl : Error<
10063  "%0 has unknown type, which is not supported for this kind of declaration">;
10064def err_unsupported_unknown_any_expr : Error<
10065  "unsupported expression with unknown type">;
10066def err_unsupported_unknown_any_call : Error<
10067  "call to unsupported expression with unknown type">;
10068def err_unknown_any_addrof : Error<
10069  "the address of a declaration with unknown type "
10070  "can only be cast to a pointer type">;
10071def err_unknown_any_addrof_call : Error<
10072  "address-of operator cannot be applied to a call to a function with "
10073  "unknown return type">;
10074def err_unknown_any_var_function_type : Error<
10075  "variable %0 with unknown type cannot be given a function type">;
10076def err_unknown_any_function : Error<
10077  "function %0 with unknown type must be given a function type">;
10078
10079def err_filter_expression_integral : Error<
10080  "filter expression has non-integral type %0">;
10081
10082def err_non_asm_stmt_in_naked_function : Error<
10083  "non-ASM statement in naked function is not supported">;
10084def err_asm_naked_this_ref : Error<
10085  "'this' pointer references not allowed in naked functions">;
10086def err_asm_naked_parm_ref : Error<
10087  "parameter references not allowed in naked functions">;
10088
10089// OpenCL warnings and errors.
10090def err_invalid_astype_of_different_size : Error<
10091  "invalid reinterpretation: sizes of %0 and %1 must match">;
10092def err_static_kernel : Error<
10093  "kernel functions cannot be declared static">;
10094def err_method_kernel : Error<
10095  "kernel functions cannot be class members">;
10096def err_template_kernel : Error<
10097  "kernel functions cannot be used in a template declaration, instantiation or specialization">;
10098def err_opencl_ptrptr_kernel_param : Error<
10099  "kernel parameter cannot be declared as a pointer to a pointer">;
10100def err_kernel_arg_address_space : Error<
10101  "pointer arguments to kernel functions must reside in '__global', "
10102  "'__constant' or '__local' address space">;
10103def err_opencl_ext_vector_component_invalid_length : Error<
10104  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
10105def err_opencl_function_variable : Error<
10106  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
10107def err_opencl_addrspace_scope : Error<
10108  "variables in the %0 address space can only be declared in the outermost "
10109  "scope of a kernel function">;
10110def err_static_function_scope : Error<
10111  "variables in function scope cannot be declared static">;
10112def err_opencl_bitfields : Error<
10113  "bit-fields are not supported in OpenCL">;
10114def err_opencl_vla : Error<
10115  "variable length arrays are not supported in OpenCL">;
10116def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
10117    "scalar operand type has greater rank than the type of the vector "
10118    "element. (%0 and %1)">;
10119def err_bad_kernel_param_type : Error<
10120  "%0 cannot be used as the type of a kernel parameter">;
10121def err_opencl_implicit_function_decl : Error<
10122  "implicit declaration of function %0 is invalid in OpenCL">;
10123def err_record_with_pointers_kernel_param : Error<
10124  "%select{struct|union}0 kernel parameters may not contain pointers">;
10125def note_within_field_of_type : Note<
10126  "within field of type %0 declared here">;
10127def note_illegal_field_declared_here : Note<
10128  "field of illegal %select{type|pointer type}0 %1 declared here">;
10129def err_opencl_type_struct_or_union_field : Error<
10130  "the %0 type cannot be used to declare a structure or union field">;
10131def err_event_t_addr_space_qual : Error<
10132  "the event_t type can only be used with __private address space qualifier">;
10133def err_expected_kernel_void_return_type : Error<
10134  "kernel must have void return type">;
10135def err_sampler_initializer_not_integer : Error<
10136  "sampler_t initialization requires 32-bit integer, not %0">;
10137def warn_sampler_initializer_invalid_bits : Warning<
10138  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
10139def err_sampler_argument_required : Error<
10140  "sampler_t variable required - got %0">;
10141def err_wrong_sampler_addressspace: Error<
10142  "sampler type cannot be used with the __local and __global address space qualifiers">;
10143def err_opencl_nonconst_global_sampler : Error<
10144  "global sampler requires a const or constant address space qualifier">;
10145def err_opencl_cast_non_zero_to_event_t : Error<
10146  "cannot cast non-zero value '%0' to 'event_t'">;
10147def err_opencl_global_invalid_addr_space : Error<
10148  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
10149def err_missing_actual_pipe_type : Error<
10150  "missing actual type specifier for pipe">;
10151def err_reference_pipe_type : Error <
10152  "pipes packet types cannot be of reference type">;
10153def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
10154def err_opencl_kernel_attr :
10155  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
10156def err_opencl_return_value_with_address_space : Error<
10157  "return value cannot be qualified with address space">;
10158def err_opencl_constant_no_init : Error<
10159  "variable in constant address space must be initialized">;
10160def err_opencl_atomic_init: Error<
10161  "atomic variable can be %select{assigned|initialized}0 to a variable only "
10162  "in global address space">;
10163def err_opencl_implicit_vector_conversion : Error<
10164  "implicit conversions between vector types (%0 and %1) are not permitted">;
10165def err_opencl_invalid_type_array : Error<
10166  "array of %0 type is invalid in OpenCL">;
10167def err_opencl_ternary_with_block : Error<
10168  "block type cannot be used as expression in ternary expression in OpenCL">;
10169def err_opencl_pointer_to_type : Error<
10170  "pointer to type %0 is invalid in OpenCL">;
10171def err_opencl_type_can_only_be_used_as_function_parameter : Error <
10172  "type %0 can only be used as a function parameter in OpenCL">;
10173def err_opencl_type_not_found : Error<
10174  "%0 type %1 not found; include the base header with -finclude-default-header">;
10175def warn_opencl_attr_deprecated_ignored : Warning <
10176  "%0 attribute is deprecated and ignored in %1">, InGroup<IgnoredAttributes>;
10177def err_opencl_variadic_function : Error<
10178  "invalid prototype, variadic arguments are not allowed in OpenCL">;
10179def err_opencl_requires_extension : Error<
10180  "use of %select{type|declaration}0 %1 requires %2 support">;
10181def ext_opencl_double_without_pragma : Extension<
10182  "Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is"
10183  " supported">;
10184def warn_opencl_generic_address_space_arg : Warning<
10185  "passing non-generic address space pointer to %0"
10186  " may cause dynamic conversion affecting performance">,
10187  InGroup<Conversion>, DefaultIgnore;
10188
10189// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
10190def err_opencl_builtin_pipe_first_arg : Error<
10191  "first argument to %0 must be a pipe type">;
10192def err_opencl_builtin_pipe_arg_num : Error<
10193  "invalid number of arguments to function: %0">;
10194def err_opencl_builtin_pipe_invalid_arg : Error<
10195  "invalid argument type to function %0 (expecting %1 having %2)">;
10196def err_opencl_builtin_pipe_invalid_access_modifier : Error<
10197  "invalid pipe access modifier (expecting %0)">;
10198
10199// OpenCL access qualifier
10200def err_opencl_invalid_access_qualifier : Error<
10201  "access qualifier can only be used for pipe and image type">;
10202def err_opencl_invalid_read_write : Error<
10203  "access qualifier %0 can not be used for %1 %select{|prior to OpenCL C version 2.0 or in version 3.0 "
10204  "and without __opencl_c_read_write_images feature}2">;
10205def err_opencl_multiple_access_qualifiers : Error<
10206  "multiple access qualifiers">;
10207def note_opencl_typedef_access_qualifier : Note<
10208  "previously declared '%0' here">;
10209
10210// OpenCL v2.0 s6.12.5 Blocks restrictions
10211def err_opencl_block_storage_type : Error<
10212  "the __block storage type is not permitted">;
10213def err_opencl_invalid_block_declaration : Error<
10214  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
10215def err_opencl_extern_block_declaration : Error<
10216  "invalid block variable declaration - using 'extern' storage class is disallowed">;
10217def err_opencl_block_ref_block : Error<
10218  "cannot refer to a block inside block">;
10219
10220// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
10221def err_opencl_builtin_to_addr_invalid_arg : Error<
10222  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
10223
10224// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
10225def err_opencl_enqueue_kernel_incorrect_args : Error<
10226  "illegal call to enqueue_kernel, incorrect argument types">;
10227def err_opencl_enqueue_kernel_local_size_args : Error<
10228  "mismatch in number of block parameters and local size arguments passed">;
10229def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
10230  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
10231def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
10232  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
10233def err_opencl_enqueue_kernel_blocks_no_args : Error<
10234  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
10235
10236def err_opencl_builtin_expected_type : Error<
10237  "illegal call to %0, expected %1 argument type">;
10238
10239// OpenCL v3.0 s6.3.7 - Vector Components
10240def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
10241  "vector component name '%0' is a feature from OpenCL version 3.0 onwards">,
10242  InGroup<OpenCLUnsupportedRGBA>;
10243
10244def err_openclcxx_placement_new : Error<
10245  "use of placement new requires explicit declaration">;
10246
10247// MIG routine annotations.
10248def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
10249  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
10250  InGroup<IgnoredAttributes>;
10251} // end of sema category
10252
10253let CategoryName = "OpenMP Issue" in {
10254// OpenMP support.
10255def err_omp_expected_var_arg : Error<
10256  "%0 is not a global variable, static local variable or static data member">;
10257def err_omp_expected_var_arg_suggest : Error<
10258  "%0 is not a global variable, static local variable or static data member; "
10259  "did you mean %1">;
10260def err_omp_global_var_arg : Error<
10261  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
10262def err_omp_ref_type_arg : Error<
10263  "arguments of '#pragma omp %0' cannot be of reference type %1">;
10264def err_omp_region_not_file_context : Error<
10265  "directive must be at file or namespace scope">;
10266def err_omp_var_scope : Error<
10267  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
10268def err_omp_var_used : Error<
10269  "'#pragma omp %0' must precede all references to variable %q1">;
10270def err_omp_var_thread_local : Error<
10271  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
10272def err_omp_private_incomplete_type : Error<
10273  "a private variable with incomplete type %0">;
10274def err_omp_firstprivate_incomplete_type : Error<
10275  "a firstprivate variable with incomplete type %0">;
10276def err_omp_lastprivate_incomplete_type : Error<
10277  "a lastprivate variable with incomplete type %0">;
10278def err_omp_reduction_incomplete_type : Error<
10279  "a reduction list item with incomplete type %0">;
10280def err_omp_unexpected_clause_value : Error<
10281  "expected %0 in OpenMP clause '%1'">;
10282def err_omp_expected_var_name_member_expr : Error<
10283  "expected variable name%select{| or data member of current class}0">;
10284def err_omp_expected_var_name_member_expr_or_array_item : Error<
10285  "expected variable name%select{|, data member of current class}0, array element or array section">;
10286def err_omp_expected_addressable_lvalue_or_array_item : Error<
10287  "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">;
10288def err_omp_expected_named_var_member_or_array_expression: Error<
10289  "expected expression containing only member accesses and/or array sections based on named variables">;
10290def err_omp_bit_fields_forbidden_in_clause : Error<
10291  "bit fields cannot be used to specify storage in a '%0' clause">;
10292def err_array_section_does_not_specify_contiguous_storage : Error<
10293  "array section does not specify contiguous storage">;
10294def err_array_section_does_not_specify_length : Error<
10295  "array section does not specify length for outermost dimension">;
10296def err_omp_union_type_not_allowed : Error<
10297  "mapping of union members is not allowed">;
10298def err_omp_expected_access_to_data_field : Error<
10299  "expected access to data field">;
10300def err_omp_multiple_array_items_in_map_clause : Error<
10301  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
10302def err_omp_duplicate_map_type_modifier : Error<
10303  "same map type modifier has been specified more than once">;
10304def err_omp_duplicate_motion_modifier : Error<
10305  "same motion modifier has been specified more than once">;
10306def err_omp_pointer_mapped_along_with_derived_section : Error<
10307  "pointer cannot be mapped along with a section derived from itself">;
10308def err_omp_original_storage_is_shared_and_does_not_contain : Error<
10309  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
10310def err_omp_same_pointer_dereferenced : Error<
10311  "same pointer dereferenced in multiple different ways in map clause expressions">;
10312def note_omp_task_predetermined_firstprivate_here : Note<
10313  "predetermined as a firstprivate in a task construct here">;
10314def err_omp_threadprivate_incomplete_type : Error<
10315  "threadprivate variable with incomplete type %0">;
10316def err_omp_no_dsa_for_variable : Error<
10317  "variable %0 must have explicitly specified data sharing attributes">;
10318def err_omp_defaultmap_no_attr_for_variable : Error<
10319  "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
10320def note_omp_default_dsa_none : Note<
10321  "explicit data sharing attribute requested here">;
10322def note_omp_defaultmap_attr_none : Note<
10323  "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
10324def err_omp_wrong_dsa : Error<
10325  "%0 variable cannot be %1">;
10326def err_omp_variably_modified_type_not_supported : Error<
10327  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
10328def note_omp_explicit_dsa : Note<
10329  "defined as %0">;
10330def note_omp_predetermined_dsa : Note<
10331  "%select{static data member is predetermined as shared|"
10332  "variable with static storage duration is predetermined as shared|"
10333  "loop iteration variable is predetermined as private|"
10334  "loop iteration variable is predetermined as linear|"
10335  "loop iteration variable is predetermined as lastprivate|"
10336  "constant variable is predetermined as shared|"
10337  "global variable is predetermined as shared|"
10338  "non-shared variable in a task construct is predetermined as firstprivate|"
10339  "variable with automatic storage duration is predetermined as private}0"
10340  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
10341def note_omp_implicit_dsa : Note<
10342  "implicitly determined as %0">;
10343def err_omp_loop_var_dsa : Error<
10344  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
10345def err_omp_not_for : Error<
10346  "%select{statement after '#pragma omp %1' must be a for loop|"
10347  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
10348def note_omp_collapse_ordered_expr : Note<
10349  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
10350def err_omp_negative_expression_in_clause : Error<
10351  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
10352def err_omp_not_integral : Error<
10353  "expression must have integral or unscoped enumeration "
10354  "type, not %0">;
10355def err_omp_threadprivate_in_target : Error<
10356  "threadprivate variables cannot be used in target constructs">;
10357def err_omp_incomplete_type : Error<
10358  "expression has incomplete class type %0">;
10359def err_omp_explicit_conversion : Error<
10360  "expression requires explicit conversion from %0 to %1">;
10361def note_omp_conversion_here : Note<
10362  "conversion to %select{integral|enumeration}0 type %1 declared here">;
10363def err_omp_ambiguous_conversion : Error<
10364  "ambiguous conversion from type %0 to an integral or unscoped "
10365  "enumeration type">;
10366def err_omp_iterator_not_integral_or_pointer : Error<
10367  "expected integral or pointer type as the iterator-type, not %0">;
10368def err_omp_iterator_step_not_integral : Error<
10369  "iterator step expression %0 is not the integral expression">;
10370def err_omp_iterator_step_constant_zero : Error<
10371  "iterator step expression %0 evaluates to 0">;
10372def err_omp_required_access : Error<
10373  "%0 variable must be %1">;
10374def err_omp_const_variable : Error<
10375  "const-qualified variable cannot be %0">;
10376def err_omp_const_not_mutable_variable : Error<
10377  "const-qualified variable without mutable fields cannot be %0">;
10378def err_omp_const_list_item : Error<
10379  "const-qualified list item cannot be %0">;
10380def err_omp_linear_incomplete_type : Error<
10381  "a linear variable with incomplete type %0">;
10382def err_omp_linear_expected_int_or_ptr : Error<
10383  "argument of a linear clause should be of integral or pointer "
10384  "type, not %0">;
10385def warn_omp_linear_step_zero : Warning<
10386  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
10387  InGroup<OpenMPClauses>;
10388def warn_omp_alignment_not_power_of_two : Warning<
10389  "aligned clause will be ignored because the requested alignment is not a power of 2">,
10390  InGroup<OpenMPClauses>;
10391def err_omp_invalid_target_decl : Error<
10392  "%0 used in declare target directive is not a variable or a function name">;
10393def err_omp_declare_target_to_and_link : Error<
10394  "%0 must not appear in both clauses 'to' and 'link'">;
10395def warn_omp_not_in_target_context : Warning<
10396  "declaration is not declared in any declare target region">,
10397  InGroup<OpenMPTarget>;
10398def err_omp_function_in_link_clause : Error<
10399  "function name is not allowed in 'link' clause">;
10400def err_omp_aligned_expected_array_or_ptr : Error<
10401  "argument of aligned clause should be array"
10402  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
10403  ", not %0">;
10404def err_omp_used_in_clause_twice : Error<
10405  "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
10406def err_omp_local_var_in_threadprivate_init : Error<
10407  "variable with local storage in initial value of threadprivate variable">;
10408def err_omp_loop_not_canonical_init : Error<
10409  "initialization clause of OpenMP for loop is not in canonical form "
10410  "('var = init' or 'T var = init')">;
10411def ext_omp_loop_not_canonical_init : ExtWarn<
10412  "initialization clause of OpenMP for loop is not in canonical form "
10413  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
10414def err_omp_loop_not_canonical_cond : Error<
10415  "condition of OpenMP for loop must be a relational comparison "
10416  "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
10417def err_omp_loop_not_canonical_incr : Error<
10418  "increment clause of OpenMP for loop must perform simple addition "
10419  "or subtraction on loop variable %0">;
10420def err_omp_loop_variable_type : Error<
10421  "variable must be of integer or %select{pointer|random access iterator}0 type">;
10422def err_omp_loop_incr_not_compatible : Error<
10423  "increment expression must cause %0 to %select{decrease|increase}1 "
10424  "on each iteration of OpenMP for loop">;
10425def note_omp_loop_cond_requres_compatible_incr : Note<
10426  "loop step is expected to be %select{negative|positive}0 due to this condition">;
10427def err_omp_loop_diff_cxx : Error<
10428  "could not calculate number of iterations calling 'operator-' with "
10429  "upper and lower loop bounds">;
10430def err_omp_loop_cannot_use_stmt : Error<
10431  "'%0' statement cannot be used in OpenMP for loop">;
10432def err_omp_simd_region_cannot_use_stmt : Error<
10433  "'%0' statement cannot be used in OpenMP simd region">;
10434def warn_omp_loop_64_bit_var : Warning<
10435  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
10436  InGroup<OpenMPLoopForm>;
10437def err_omp_unknown_reduction_identifier : Error<
10438  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
10439  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10440def err_omp_not_resolved_reduction_identifier : Error<
10441  "unable to resolve declare reduction construct for type %0">;
10442def err_omp_reduction_ref_type_arg : Error<
10443  "argument of OpenMP clause '%0' must reference the same object in all threads">;
10444def err_omp_clause_not_arithmetic_type_arg : Error<
10445  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
10446def err_omp_clause_floating_type_arg : Error<
10447  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
10448def err_omp_once_referenced : Error<
10449  "variable can appear only once in OpenMP '%0' clause">;
10450def err_omp_once_referenced_in_target_update : Error<
10451  "variable can appear only once in OpenMP 'target update' construct">;
10452def note_omp_referenced : Note<
10453  "previously referenced here">;
10454def err_omp_reduction_in_task : Error<
10455  "reduction variables may not be accessed in an explicit task">;
10456def err_omp_reduction_id_not_compatible : Error<
10457  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
10458def err_omp_reduction_identifier_mismatch : Error<
10459  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
10460def note_omp_previous_reduction_identifier : Note<
10461  "previously marked as task_reduction with different reduction operation">;
10462def err_omp_prohibited_region : Error<
10463  "region cannot be%select{| closely}0 nested inside '%1' region"
10464  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
10465  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
10466  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
10467  "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
10468  "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
10469def err_omp_prohibited_region_simd : Error<
10470  "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
10471def err_omp_prohibited_region_atomic : Error<
10472  "OpenMP constructs may not be nested inside an atomic region">;
10473def err_omp_prohibited_region_critical_same_name : Error<
10474  "cannot nest 'critical' regions having the same name %0">;
10475def note_omp_previous_critical_region : Note<
10476  "previous 'critical' region starts here">;
10477def err_omp_several_directives_in_region : Error<
10478  "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
10479def note_omp_previous_directive : Note<
10480  "previous '%0' directive used here">;
10481def err_omp_sections_not_compound_stmt : Error<
10482  "the statement for '#pragma omp sections' must be a compound statement">;
10483def err_omp_parallel_sections_not_compound_stmt : Error<
10484  "the statement for '#pragma omp parallel sections' must be a compound statement">;
10485def err_omp_orphaned_section_directive : Error<
10486  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
10487  " must be closely nested to a sections region%select{|, not a %1 region}0">;
10488def err_omp_sections_substmt_not_section : Error<
10489  "statement in 'omp sections' directive must be enclosed into a section region">;
10490def err_omp_parallel_sections_substmt_not_section : Error<
10491  "statement in 'omp parallel sections' directive must be enclosed into a section region">;
10492def err_omp_parallel_reduction_in_task_firstprivate : Error<
10493  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
10494def err_omp_atomic_read_not_expression_statement : Error<
10495  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
10496  " where v and x are both lvalue expressions with scalar type">;
10497def note_omp_atomic_read_write: Note<
10498  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
10499def err_omp_atomic_write_not_expression_statement : Error<
10500  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
10501  " where x is a lvalue expression with scalar type">;
10502def err_omp_atomic_update_not_expression_statement : Error<
10503  "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',"
10504  " where x is an lvalue expression with scalar type">;
10505def err_omp_atomic_not_expression_statement : Error<
10506  "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',"
10507  " where x is an lvalue expression with scalar type">;
10508def note_omp_atomic_update: Note<
10509  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
10510  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
10511  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
10512def err_omp_atomic_capture_not_expression_statement : Error<
10513  "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',"
10514  " where x and v are both lvalue expressions with scalar type">;
10515def err_omp_atomic_capture_not_compound_statement : Error<
10516  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
10517  " '{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;}',"
10518  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
10519  " where x is an lvalue expression with scalar type">;
10520def note_omp_atomic_capture: Note<
10521  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
10522def err_omp_atomic_several_clauses : Error<
10523  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
10524def err_omp_several_mem_order_clauses : Error<
10525  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
10526def err_omp_atomic_incompatible_mem_order_clause : Error<
10527  "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
10528def note_omp_previous_mem_order_clause : Note<
10529  "'%0' clause used here">;
10530def err_omp_target_contains_not_only_teams : Error<
10531  "target construct with nested teams region contains statements outside of the teams construct">;
10532def note_omp_nested_teams_construct_here : Note<
10533  "nested teams construct here">;
10534def note_omp_nested_statement_here : Note<
10535  "%select{statement|directive}0 outside teams construct here">;
10536def err_omp_single_copyprivate_with_nowait : Error<
10537  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
10538def note_omp_nowait_clause_here : Note<
10539  "'nowait' clause is here">;
10540def err_omp_single_decl_in_declare_simd_variant : Error<
10541  "single declaration is expected after 'declare %select{simd|variant}0' directive">;
10542def err_omp_function_expected : Error<
10543  "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
10544def err_omp_wrong_cancel_region : Error<
10545  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
10546def err_omp_parent_cancel_region_nowait : Error<
10547  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
10548def err_omp_parent_cancel_region_ordered : Error<
10549  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
10550def 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">;
10551def 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">;
10552def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
10553def err_omp_mapper_wrong_type : Error<
10554  "mapper type must be of struct, union or class type">;
10555def err_omp_declare_mapper_wrong_var : Error<
10556  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
10557def err_omp_declare_mapper_redefinition : Error<
10558  "redefinition of user-defined mapper for type %0 with name %1">;
10559def err_omp_invalid_mapper: Error<
10560  "cannot find a valid user-defined mapper for type %0 with name %1">;
10561def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
10562def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
10563def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
10564def err_omp_typecheck_section_value : Error<
10565  "subscripted value is not an array or pointer">;
10566def err_omp_typecheck_section_not_integer : Error<
10567  "array section %select{lower bound|length}0 is not an integer">;
10568def err_omp_typecheck_shaping_not_integer : Error<
10569  "array shaping operation dimension is not an integer">;
10570def err_omp_shaping_dimension_not_positive : Error<
10571  "array shaping dimension is evaluated to a non-positive value %0">;
10572def err_omp_section_function_type : Error<
10573  "section of pointer to function type %0">;
10574def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
10575  InGroup<CharSubscript>, DefaultIgnore;
10576def err_omp_section_incomplete_type : Error<
10577  "section of pointer to incomplete type %0">;
10578def err_omp_section_not_subset_of_array : Error<
10579  "array section must be a subset of the original array">;
10580def err_omp_section_length_negative : Error<
10581  "section length is evaluated to a negative value %0">;
10582def err_omp_section_stride_non_positive : Error<
10583  "section stride is evaluated to a non-positive value %0">;
10584def err_omp_section_length_undefined : Error<
10585  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
10586def err_omp_wrong_linear_modifier : Error<
10587  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
10588def err_omp_wrong_linear_modifier_non_reference : Error<
10589  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
10590def err_omp_wrong_simdlen_safelen_values : Error<
10591  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
10592def err_omp_wrong_if_directive_name_modifier : Error<
10593  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
10594def err_omp_no_more_if_clause : Error<
10595  "no more 'if' clause is allowed">;
10596def err_omp_unnamed_if_clause : Error<
10597  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
10598def note_omp_previous_named_if_clause : Note<
10599  "previous clause with directive name modifier specified here">;
10600def err_omp_ordered_directive_with_param : Error<
10601  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
10602def err_omp_ordered_directive_without_param : Error<
10603  "'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter">;
10604def note_omp_ordered_param : Note<
10605  "'ordered' clause%select{| with specified parameter}0">;
10606def err_omp_expected_base_var_name : Error<
10607  "expected variable name as a base of the array %select{subscript|section}0">;
10608def err_omp_map_shared_storage : Error<
10609  "variable already marked as mapped in current construct">;
10610def err_omp_invalid_map_type_for_directive : Error<
10611  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
10612def err_omp_invalid_map_type_modifier_for_directive : Error<
10613  "map type modifier '%0' is not allowed for '#pragma omp %1'">;
10614def err_omp_no_clause_for_directive : Error<
10615  "expected at least one %0 clause for '#pragma omp %1'">;
10616def err_omp_threadprivate_in_clause : Error<
10617  "threadprivate variables are not allowed in '%0' clause">;
10618def err_omp_wrong_ordered_loop_count : Error<
10619  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
10620def note_collapse_loop_count : Note<
10621  "parameter of the 'collapse' clause">;
10622def err_omp_clauses_mutually_exclusive : Error<
10623  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
10624def note_omp_previous_clause : Note<
10625  "'%0' clause is specified here">;
10626def err_omp_hint_clause_no_name : Error<
10627  "the name of the construct must be specified in presence of 'hint' clause">;
10628def err_omp_critical_with_hint : Error<
10629  "constructs with the same name must have a 'hint' clause with the same value">;
10630def note_omp_critical_hint_here : Note<
10631  "%select{|previous }0'hint' clause with value '%1'">;
10632def note_omp_critical_no_hint : Note<
10633  "%select{|previous }0directive with no 'hint' clause specified">;
10634def err_omp_depend_clause_thread_simd : Error<
10635  "'depend' clauses cannot be mixed with '%0' clause">;
10636def err_omp_depend_sink_expected_loop_iteration : Error<
10637  "expected%select{| %1}0 loop iteration variable">;
10638def err_omp_depend_sink_unexpected_expr : Error<
10639  "unexpected expression: number of expressions is larger than the number of associated loops">;
10640def err_omp_depend_sink_expected_plus_minus : Error<
10641  "expected '+' or '-' operation">;
10642def err_omp_taskwait_depend_mutexinoutset_not_allowed : Error<
10643  "'mutexinoutset' modifier not allowed in 'depend' clause on 'taskwait' directive">;
10644def err_omp_depend_sink_source_not_allowed : Error<
10645  "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
10646def err_omp_depend_zero_length_array_section_not_allowed : Error<
10647  "zero-length array section is not allowed in 'depend' clause">;
10648def err_omp_depend_sink_source_with_modifier : Error<
10649  "depend modifier cannot be used with 'sink' or 'source' depend type">;
10650def err_omp_depend_modifier_not_iterator : Error<
10651  "expected iterator specification as depend modifier">;
10652def err_omp_linear_ordered : Error<
10653  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
10654def err_omp_unexpected_schedule_modifier : Error<
10655  "modifier '%0' cannot be used along with modifier '%1'">;
10656def err_omp_schedule_nonmonotonic_static : Error<
10657  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
10658def err_omp_simple_clause_incompatible_with_ordered : Error<
10659  "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
10660def err_omp_ordered_simd : Error<
10661  "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
10662def err_omp_variable_in_given_clause_and_dsa : Error<
10663  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
10664def err_omp_param_or_this_in_clause : Error<
10665  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
10666def err_omp_expected_uniform_param : Error<
10667  "expected a reference to a parameter specified in a 'uniform' clause">;
10668def err_omp_expected_int_param : Error<
10669  "expected a reference to an integer-typed parameter">;
10670def err_omp_at_least_one_motion_clause_required : Error<
10671  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
10672def err_omp_usedeviceptr_not_a_pointer : Error<
10673  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
10674def err_omp_argument_type_isdeviceptr : Error <
10675  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
10676def warn_omp_nesting_simd : Warning<
10677  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
10678  InGroup<SourceUsesOpenMP>;
10679def err_omp_orphaned_device_directive : Error<
10680  "orphaned 'omp %0' directives are prohibited"
10681  "; perhaps you forget to enclose the directive into a "
10682  "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
10683def err_omp_reduction_non_addressable_expression : Error<
10684  "expected addressable reduction item for the task-based directives">;
10685def err_omp_reduction_with_nogroup : Error<
10686  "'reduction' clause cannot be used with 'nogroup' clause">;
10687def err_omp_reduction_vla_unsupported : Error<
10688  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
10689def err_omp_linear_distribute_var_non_loop_iteration : Error<
10690  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
10691def warn_omp_non_trivial_type_mapped : Warning<
10692  "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
10693  InGroup<OpenMPMapping>;
10694def err_omp_requires_clause_redeclaration : Error <
10695  "Only one %0 clause can appear on a requires directive in a single translation unit">;
10696def note_omp_requires_previous_clause : Note <
10697  "%0 clause previously used here">;
10698def err_omp_directive_before_requires : Error <
10699  "'%0' region encountered before requires directive with '%1' clause">;
10700def note_omp_requires_encountered_directive : Note <
10701  "'%0' previously encountered here">;
10702def err_omp_invalid_scope : Error <
10703  "'#pragma omp %0' directive must appear only in file scope">;
10704def note_omp_invalid_length_on_this_ptr_mapping : Note <
10705  "expected length on mapping of 'this' array section expression to be '1'">;
10706def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
10707  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
10708def note_omp_invalid_subscript_on_this_ptr_map : Note <
10709  "expected 'this' subscript expression on map clause to be 'this[0]'">;
10710def err_omp_invalid_map_this_expr : Error <
10711  "invalid 'this' expression on 'map' clause">;
10712def err_omp_implied_type_not_found : Error<
10713  "'%0' type not found; include <omp.h>">;
10714def err_omp_expected_omp_depend_t_lvalue : Error<
10715  "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
10716def err_omp_depobj_expected : Error<
10717  "expected depobj expression">;
10718def err_omp_depobj_single_clause_expected : Error<
10719  "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
10720def err_omp_scan_single_clause_expected : Error<
10721  "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
10722def err_omp_inclusive_exclusive_not_reduction : Error<
10723  "the list item must appear in 'reduction' clause with the 'inscan' modifier "
10724  "of the parent directive">;
10725def err_omp_reduction_not_inclusive_exclusive : Error<
10726  "the inscan reduction list item must appear as a list item in an 'inclusive' or"
10727  " 'exclusive' clause on an inner 'omp scan' directive">;
10728def err_omp_wrong_inscan_reduction : Error<
10729  "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
10730  " 'omp parallel for', or 'omp parallel for simd' directive">;
10731def err_omp_inscan_reduction_expected : Error<
10732  "expected 'reduction' clause with the 'inscan' modifier">;
10733def note_omp_previous_inscan_reduction : Note<
10734  "'reduction' clause with 'inscan' modifier is used here">;
10735def err_omp_expected_predefined_allocator : Error<
10736  "expected one of the predefined allocators for the variables with the static "
10737  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
10738  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
10739  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
10740def warn_omp_used_different_allocator : Warning<
10741  "allocate directive specifies %select{default|'%1'}0 allocator while "
10742  "previously used %select{default|'%3'}2">,
10743  InGroup<OpenMPClauses>;
10744def note_omp_previous_allocator : Note<
10745  "previous allocator is specified here">;
10746def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
10747  "inside of the target region; provide an 'allocator' clause or use 'requires'"
10748  " directive with the 'dynamic_allocators' clause">;
10749def err_expected_allocator_expression : Error<"expected an allocator expression "
10750  "inside of the target region; provide an allocator expression or use 'requires'"
10751  " directive with the 'dynamic_allocators' clause">;
10752def warn_omp_allocate_thread_on_task_target_directive : Warning<
10753  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
10754  InGroup<OpenMPClauses>;
10755def err_omp_expected_private_copy_for_allocate : Error<
10756  "the referenced item is not found in any private clause on the same directive">;
10757def err_omp_stmt_depends_on_loop_counter : Error<
10758  "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
10759def err_omp_invariant_dependency : Error<
10760  "expected loop invariant expression">;
10761def err_omp_invariant_or_linear_dependency : Error<
10762  "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
10763def err_omp_wrong_dependency_iterator_type : Error<
10764  "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
10765def err_target_unsupported_type
10766    : Error<"%0 requires %select{|%2 bit size}1 %3 %select{|return }4type support,"
10767            " but target '%5' does not support it">;
10768def err_omp_lambda_capture_in_declare_target_not_to : Error<
10769  "variable captured in declare target region must appear in a to clause">;
10770def err_omp_device_type_mismatch : Error<
10771  "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
10772def err_omp_wrong_device_function_call : Error<
10773  "function with 'device_type(%0)' is not available on %select{device|host}1">;
10774def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
10775def warn_omp_declare_target_after_first_use : Warning<
10776  "declaration marked as declare target after first use, it may lead to incorrect results">,
10777  InGroup<OpenMPTarget>;
10778def err_omp_declare_variant_incompat_attributes : Error<
10779  "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
10780def warn_omp_declare_variant_score_not_constant
10781    : Warning<"score expressions in the OpenMP context selector need to be "
10782              "constant; %0 is not and will be ignored">,
10783      InGroup<SourceUsesOpenMP>;
10784def err_omp_declare_variant_user_condition_not_constant
10785    : Error<"the user condition in the OpenMP context selector needs to be "
10786            "constant; %0 is not">;
10787def warn_omp_declare_variant_after_used : Warning<
10788  "'#pragma omp declare variant' cannot be applied for function after first "
10789  "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
10790def warn_omp_declare_variant_after_emitted : Warning<
10791  "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
10792  " the original function might be used">, InGroup<SourceUsesOpenMP>;
10793def err_omp_declare_variant_doesnt_support : Error<
10794  "'#pragma omp declare variant' does not "
10795  "support %select{function templates|virtual functions|"
10796  "deduced return types|constructors|destructors|deleted functions|"
10797  "defaulted functions|constexpr functions|consteval function}0">;
10798def err_omp_declare_variant_diff : Error<
10799  "function with '#pragma omp declare variant' has a different %select{calling convention"
10800  "|return type|constexpr specification|inline specification|storage class|"
10801  "linkage}0">;
10802def err_omp_declare_variant_prototype_required : Error<
10803  "function with '#pragma omp declare variant' must have a prototype when "
10804  "'append_args' is used">;
10805def err_omp_interop_type_not_found : Error<
10806  "'omp_interop_t' must be defined when 'append_args' clause is used; include <omp.h>">;
10807def err_omp_declare_variant_incompat_types : Error<
10808  "variant in '#pragma omp declare variant' with type %0 is incompatible with"
10809  " type %1%select{| with appended arguments}2">;
10810def warn_omp_declare_variant_marked_as_declare_variant : Warning<
10811  "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
10812  >, InGroup<SourceUsesOpenMP>;
10813def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
10814def err_omp_one_defaultmap_each_category: Error<
10815  "at most one defaultmap clause for each variable-category can appear on the directive">;
10816def err_omp_lastprivate_conditional_non_scalar : Error<
10817  "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
10818  >;
10819def err_omp_flush_order_clause_and_list : Error<
10820  "'flush' directive with memory order clause '%0' cannot have the list">;
10821def note_omp_flush_order_clause_here : Note<
10822  "memory order clause '%0' is specified here">;
10823def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
10824  "expected addressable lvalue in '%0' clause">;
10825def err_omp_var_expected : Error<
10826  "expected variable of the '%0' type%select{|, not %2}1">;
10827def err_omp_non_pointer_type_array_shaping_base : Error<
10828  "expected expression with a pointer to a complete type as a base of an array "
10829  "shaping operation">;
10830def err_omp_reduction_task_not_parallel_or_worksharing : Error<
10831  "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
10832  " worksharing constructs">;
10833def err_omp_expected_array_alloctraits : Error<
10834  "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
10835def err_omp_predefined_allocator_with_traits : Error<
10836  "predefined allocator cannot have traits specified">;
10837def note_omp_predefined_allocator : Note<
10838  "predefined trait '%0' used here">;
10839def err_omp_nonpredefined_allocator_without_traits : Error<
10840  "non-predefined allocator must have traits specified">;
10841def err_omp_allocator_used_in_clauses : Error<
10842  "allocators used in 'uses_allocators' clause cannot appear in other "
10843  "data-sharing or data-mapping attribute clauses">;
10844def err_omp_allocator_not_in_uses_allocators : Error<
10845  "allocator must be specified in the 'uses_allocators' clause">;
10846def note_omp_protected_structured_block
10847    : Note<"jump bypasses OpenMP structured block">;
10848def note_omp_exits_structured_block
10849    : Note<"jump exits scope of OpenMP structured block">;
10850def err_omp_lastprivate_loop_var_non_loop_iteration : Error<
10851  "only loop iteration variables are allowed in 'lastprivate' clause in "
10852  "'omp loop' directives">;
10853def err_omp_interop_variable_expected : Error<
10854  "expected%select{| non-const}0 variable of type 'omp_interop_t'">;
10855def err_omp_interop_variable_wrong_type : Error<
10856  "interop variable must be of type 'omp_interop_t'">;
10857def err_omp_interop_prefer_type : Error<
10858  "prefer_list item must be a string literal or constant integral "
10859  "expression">;
10860def err_omp_interop_bad_depend_clause : Error<
10861  "'depend' clause requires the 'targetsync' interop type">;
10862def err_omp_interop_var_multiple_actions : Error<
10863  "interop variable %0 used in multiple action clauses">;
10864def err_omp_dispatch_statement_call
10865    : Error<"statement after '#pragma omp dispatch' must be a direct call"
10866            " to a target function or an assignment to one">;
10867def err_omp_unroll_full_variable_trip_count : Error<
10868  "loop to be fully unrolled must have a constant trip count">;
10869def note_omp_directive_here : Note<"'%0' directive found here">;
10870def err_omp_instantiation_not_supported
10871    : Error<"instantiation of '%0' not supported yet">;
10872def err_omp_adjust_arg_multiple_clauses : Error<
10873  "'adjust_arg' argument %0 used in multiple clauses">;
10874def err_omp_clause_requires_dispatch_construct : Error<
10875  "'%0' clause requires 'dispatch' context selector">;
10876def err_omp_append_args_with_varargs : Error<
10877  "'append_args' is not allowed with varargs functions">;
10878} // end of OpenMP category
10879
10880let CategoryName = "Related Result Type Issue" in {
10881// Objective-C related result type compatibility
10882def warn_related_result_type_compatibility_class : Warning<
10883  "method is expected to return an instance of its class type "
10884  "%diff{$, but is declared to return $|"
10885  ", but is declared to return different type}0,1">;
10886def warn_related_result_type_compatibility_protocol : Warning<
10887  "protocol method is expected to return an instance of the implementing "
10888  "class, but is declared to return %0">;
10889def note_related_result_type_family : Note<
10890  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
10891  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
10892  "self}1' method family%select{| and is expected to return an instance of its "
10893  "class type}0">;
10894def note_related_result_type_overridden : Note<
10895  "overridden method returns an instance of its class type">;
10896def note_related_result_type_inferred : Note<
10897  "%select{class|instance}0 method %1 is assumed to return an instance of "
10898  "its receiver type (%2)">;
10899def note_related_result_type_explicit : Note<
10900  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
10901  "%select{| and is expected to return an instance of its class type}0">;
10902def err_invalid_type_for_program_scope_var : Error<
10903  "the %0 type cannot be used to declare a program scope variable">;
10904
10905}
10906
10907let CategoryName = "Modules Issue" in {
10908def err_module_decl_in_module_map_module : Error<
10909  "'module' declaration found while building module from module map">;
10910def err_module_decl_in_header_module : Error<
10911  "'module' declaration found while building header unit">;
10912def err_module_interface_implementation_mismatch : Error<
10913  "missing 'export' specifier in module declaration while "
10914  "building module interface">;
10915def err_current_module_name_mismatch : Error<
10916  "module name '%0' specified on command line does not match name of module">;
10917def err_module_redefinition : Error<
10918  "redefinition of module '%0'">;
10919def note_prev_module_definition : Note<"previously defined here">;
10920def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
10921def err_module_not_defined : Error<
10922  "definition of module '%0' is not available; use -fmodule-file= to specify "
10923  "path to precompiled module interface">;
10924def err_module_redeclaration : Error<
10925  "translation unit contains multiple module declarations">;
10926def note_prev_module_declaration : Note<"previous module declaration is here">;
10927def err_module_declaration_missing : Error<
10928  "missing 'export module' declaration in module interface unit">;
10929def err_module_declaration_missing_after_global_module_introducer : Error<
10930  "missing 'module' declaration at end of global module fragment "
10931  "introduced here">;
10932def err_module_private_specialization : Error<
10933  "%select{template|partial|member}0 specialization cannot be "
10934  "declared __module_private__">;
10935def err_module_private_local : Error<
10936  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
10937  "__module_private__">;
10938def err_module_private_local_class : Error<
10939  "local %select{struct|interface|union|class|enum}0 cannot be declared "
10940  "__module_private__">;
10941def err_module_unimported_use : Error<
10942  "%select{declaration|definition|default argument|"
10943  "explicit specialization|partial specialization}0 of %1 must be imported "
10944  "from module '%2' before it is required">;
10945def err_module_unimported_use_header : Error<
10946  "%select{missing '#include'|missing '#include %3'}2; "
10947  "%select{||default argument of |explicit specialization of |"
10948  "partial specialization of }0%1 must be "
10949  "%select{declared|defined|defined|declared|declared}0 "
10950  "before it is used">;
10951def err_module_unimported_use_multiple : Error<
10952  "%select{declaration|definition|default argument|"
10953  "explicit specialization|partial specialization}0 of %1 must be imported "
10954  "from one of the following modules before it is required:%2">;
10955def note_unreachable_entity : Note<
10956  "%select{declaration|definition|default argument declared|"
10957  "explicit specialization declared|partial specialization declared}0 here "
10958  "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
10959def ext_module_import_in_extern_c : ExtWarn<
10960  "import of C++ module '%0' appears within extern \"C\" language linkage "
10961  "specification">, DefaultError,
10962  InGroup<DiagGroup<"module-import-in-extern-c">>;
10963def err_module_import_not_at_top_level_fatal : Error<
10964  "import of module '%0' appears within %1">, DefaultFatal;
10965def ext_module_import_not_at_top_level_noop : ExtWarn<
10966  "redundant #include of module '%0' appears within %1">, DefaultError,
10967  InGroup<DiagGroup<"modules-import-nested-redundant">>;
10968def note_module_import_not_at_top_level : Note<"%0 begins here">;
10969def err_module_self_import : Error<
10970  "import of module '%0' appears within same top-level module '%1'">;
10971def err_module_import_in_implementation : Error<
10972  "@import of module '%0' in implementation of '%1'; use #import">;
10973
10974// C++ Modules
10975def err_module_decl_not_at_start : Error<
10976  "module declaration must occur at the start of the translation unit">;
10977def note_global_module_introducer_missing : Note<
10978  "add 'module;' to the start of the file to introduce a "
10979  "global module fragment">;
10980def err_export_within_anonymous_namespace : Error<
10981  "export declaration appears within anonymous namespace">;
10982def note_anonymous_namespace : Note<"anonymous namespace begins here">;
10983def ext_export_no_name_block : ExtWarn<
10984  "ISO C++20 does not permit %select{an empty|a static_assert}0 declaration "
10985  "to appear in an export block">, InGroup<ExportUnnamed>;
10986def ext_export_no_names : ExtWarn<
10987  "ISO C++20 does not permit a declaration that does not introduce any names "
10988  "to be exported">, InGroup<ExportUnnamed>;
10989def note_export : Note<"export block begins here">;
10990def err_export_no_name : Error<
10991  "%select{empty|static_assert|asm}0 declaration cannot be exported">;
10992def ext_export_using_directive : ExtWarn<
10993  "ISO C++20 does not permit using directive to be exported">,
10994  InGroup<DiagGroup<"export-using-directive">>;
10995def err_export_within_export : Error<
10996  "export declaration appears within another export declaration">;
10997def err_export_internal : Error<
10998  "declaration of %0 with internal linkage cannot be exported">;
10999def err_export_using_internal : Error<
11000  "using declaration referring to %0 with internal linkage cannot be exported">;
11001def err_export_not_in_module_interface : Error<
11002  "export declaration can only be used within a module interface unit"
11003  "%select{ after the module declaration|}0">;
11004def err_export_in_private_module_fragment : Error<
11005  "export declaration cannot be used in a private module fragment">;
11006def note_private_module_fragment : Note<
11007  "private module fragment begins here">;
11008def err_private_module_fragment_not_module : Error<
11009  "private module fragment declaration with no preceding module declaration">;
11010def err_private_module_fragment_redefined : Error<
11011  "private module fragment redefined">;
11012def err_private_module_fragment_not_module_interface : Error<
11013  "private module fragment in module implementation unit">;
11014def note_not_module_interface_add_export : Note<
11015  "add 'export' here if this is intended to be a module interface unit">;
11016
11017def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
11018  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
11019  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
11020def note_equivalent_internal_linkage_decl : Note<
11021  "declared here%select{ in module '%1'|}0">;
11022
11023def note_redefinition_modules_same_file : Note<
11024  "'%0' included multiple times, additional include site in header from module '%1'">;
11025def note_redefinition_include_same_file : Note<
11026  "'%0' included multiple times, additional include site here">;
11027}
11028
11029let CategoryName = "Coroutines Issue" in {
11030def err_return_in_coroutine : Error<
11031  "return statement not allowed in coroutine; did you mean 'co_return'?">;
11032def note_declared_coroutine_here : Note<
11033  "function is a coroutine due to use of '%0' here">;
11034def err_coroutine_objc_method : Error<
11035  "Objective-C methods as coroutines are not yet supported">;
11036def err_coroutine_unevaluated_context : Error<
11037  "'%0' cannot be used in an unevaluated context">;
11038def err_coroutine_within_handler : Error<
11039  "'%0' cannot be used in the handler of a try block">;
11040def err_coroutine_outside_function : Error<
11041  "'%0' cannot be used outside a function">;
11042def err_coroutine_invalid_func_context : Error<
11043  "'%1' cannot be used in %select{a constructor|a destructor"
11044  "|the 'main' function|a constexpr function"
11045  "|a function with a deduced return type|a varargs function"
11046  "|a consteval function}0">;
11047def err_implied_coroutine_type_not_found : Error<
11048  "%0 type was not found; include <coroutine> before defining "
11049  "a coroutine; include <experimental/coroutine> if your version "
11050  "of libcxx is less than 14.0">;
11051def warn_deprecated_coroutine_namespace : Warning<
11052  "support for std::experimental::%0 will be removed in LLVM 15; "
11053  "use std::%0 instead">,
11054  InGroup<DeprecatedExperimentalCoroutine>;
11055def err_mixed_use_std_and_experimental_namespace_for_coroutine : Error<
11056  "conflicting mixed use of std and std::experimental namespaces for "
11057  "coroutine components">;
11058def err_implicit_coroutine_std_nothrow_type_not_found : Error<
11059  "std::nothrow was not found; include <new> before defining a coroutine which "
11060  "uses get_return_object_on_allocation_failure()">;
11061def err_malformed_std_nothrow : Error<
11062  "std::nothrow must be a valid variable declaration">;
11063def err_malformed_std_coroutine_handle : Error<
11064  "std::coroutine_handle isn't a class template">;
11065def err_coroutine_handle_missing_member : Error<
11066  "std::coroutine_handle must have a member named '%0'">;
11067def err_malformed_std_coroutine_traits : Error<
11068  "std::coroutine_traits isn't a class template">;
11069def err_implied_std_coroutine_traits_promise_type_not_found : Error<
11070  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
11071def err_implied_std_coroutine_traits_promise_type_not_class : Error<
11072  "this function cannot be a coroutine: %0 is not a class">;
11073def err_coroutine_promise_type_incomplete : Error<
11074  "this function cannot be a coroutine: %0 is an incomplete type">;
11075def err_coroutine_type_missing_specialization : Error<
11076  "this function cannot be a coroutine: missing definition of "
11077  "specialization %0">;
11078def err_coroutine_promise_incompatible_return_functions : Error<
11079  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
11080def note_coroutine_promise_implicit_await_transform_required_here : Note<
11081  "call to 'await_transform' implicitly required by 'co_await' here">;
11082def note_coroutine_promise_suspend_implicitly_required : Note<
11083  "call to '%select{initial_suspend|final_suspend}0' implicitly "
11084  "required by the %select{initial suspend point|final suspend point}0">;
11085def err_coroutine_promise_unhandled_exception_required : Error<
11086  "%0 is required to declare the member 'unhandled_exception()'">;
11087def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
11088  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
11089  InGroup<CoroutineMissingUnhandledException>;
11090def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
11091  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
11092def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
11093  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
11094def err_coroutine_promise_new_requires_nothrow : Error<
11095  "%0 is required to have a non-throwing noexcept specification when the promise "
11096   "type declares 'get_return_object_on_allocation_failure()'">;
11097def note_coroutine_promise_call_implicitly_required : Note<
11098  "call to %0 implicitly required by coroutine function here">;
11099def err_await_suspend_invalid_return_type : Error<
11100  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
11101>;
11102def note_await_ready_no_bool_conversion : Note<
11103  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
11104>;
11105def warn_coroutine_handle_address_invalid_return_type : Warning <
11106  "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">,
11107  InGroup<Coroutine>;
11108def err_coroutine_promise_final_suspend_requires_nothrow : Error<
11109  "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
11110>;
11111def note_coroutine_function_declare_noexcept : Note<
11112  "must be declared with 'noexcept'"
11113>;
11114} // end of coroutines issue category
11115
11116let CategoryName = "Documentation Issue" in {
11117def warn_not_a_doxygen_trailing_member_comment : Warning<
11118  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
11119} // end of documentation issue category
11120
11121let CategoryName = "Nullability Issue" in {
11122
11123def warn_mismatched_nullability_attr : Warning<
11124  "nullability specifier %0 conflicts with existing specifier %1">,
11125  InGroup<Nullability>;
11126
11127def warn_nullability_declspec : Warning<
11128  "nullability specifier %0 cannot be applied "
11129  "to non-pointer type %1; did you mean to apply the specifier to the "
11130  "%select{pointer|block pointer|member pointer|function pointer|"
11131  "member function pointer}2?">,
11132  InGroup<NullabilityDeclSpec>,
11133  DefaultError;
11134
11135def note_nullability_here : Note<"%0 specified here">;
11136
11137def err_nullability_nonpointer : Error<
11138  "nullability specifier %0 cannot be applied to non-pointer type %1">;
11139
11140def warn_nullability_lost : Warning<
11141  "implicit conversion from nullable pointer %0 to non-nullable pointer "
11142  "type %1">,
11143  InGroup<NullableToNonNullConversion>, DefaultIgnore;
11144def warn_zero_as_null_pointer_constant : Warning<
11145  "zero as null pointer constant">,
11146  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
11147
11148def err_nullability_cs_multilevel : Error<
11149  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
11150def note_nullability_type_specifier : Note<
11151  "use nullability type specifier %0 to affect the innermost "
11152  "pointer type of %1">;
11153
11154def warn_null_resettable_setter : Warning<
11155  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
11156  InGroup<Nullability>;
11157
11158def warn_nullability_missing : Warning<
11159  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
11160  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
11161  InGroup<NullabilityCompleteness>;
11162def warn_nullability_missing_array : Warning<
11163  "array parameter is missing a nullability type specifier (_Nonnull, "
11164  "_Nullable, or _Null_unspecified)">,
11165  InGroup<NullabilityCompletenessOnArrays>;
11166def note_nullability_fix_it : Note<
11167  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
11168  "%select{pointer|block pointer|member pointer|array parameter}1 "
11169  "%select{should never be null|may be null|should not declare nullability}0">;
11170
11171def warn_nullability_inferred_on_nested_type : Warning<
11172  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
11173  "deprecated">,
11174  InGroup<NullabilityInferredOnNestedType>;
11175
11176def err_objc_type_arg_explicit_nullability : Error<
11177  "type argument %0 cannot explicitly specify nullability">;
11178
11179def err_objc_type_param_bound_explicit_nullability : Error<
11180  "type parameter %0 bound %1 cannot explicitly specify nullability">;
11181
11182}
11183
11184let CategoryName = "Generics Issue" in {
11185
11186def err_objc_type_param_bound_nonobject : Error<
11187  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
11188
11189def err_objc_type_param_bound_missing_pointer : Error<
11190  "missing '*' in type bound %0 for type parameter %1">;
11191def err_objc_type_param_bound_qualified : Error<
11192  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
11193
11194def err_objc_type_param_redecl : Error<
11195  "redeclaration of type parameter %0">;
11196
11197def err_objc_type_param_arity_mismatch : Error<
11198  "%select{forward class declaration|class definition|category|extension}0 has "
11199  "too %select{few|many}1 type parameters (expected %2, have %3)">;
11200
11201def err_objc_type_param_bound_conflict : Error<
11202  "type bound %0 for type parameter %1 conflicts with "
11203  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
11204
11205def err_objc_type_param_variance_conflict : Error<
11206  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
11207  "%select{in|co|contra}2variant type parameter %3">;
11208
11209def note_objc_type_param_here : Note<"type parameter %0 declared here">;
11210
11211def err_objc_type_param_bound_missing : Error<
11212  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
11213
11214def err_objc_parameterized_category_nonclass : Error<
11215  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
11216  "parameters">;
11217
11218def err_objc_parameterized_forward_class : Error<
11219  "forward declaration of non-parameterized class %0 cannot have type "
11220  "parameters">;
11221
11222def err_objc_parameterized_forward_class_first : Error<
11223  "class %0 previously declared with type parameters">;
11224
11225def err_objc_type_arg_missing_star : Error<
11226  "type argument %0 must be a pointer (requires a '*')">;
11227def err_objc_type_arg_qualified : Error<
11228  "type argument %0 cannot be qualified with '%1'">;
11229
11230def err_objc_type_arg_missing : Error<
11231  "no type or protocol named %0">;
11232
11233def err_objc_type_args_and_protocols : Error<
11234  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
11235  "%select{protocol|type}0 (%2)">;
11236
11237def err_objc_type_args_non_class : Error<
11238  "type arguments cannot be applied to non-class type %0">;
11239
11240def err_objc_type_args_non_parameterized_class : Error<
11241  "type arguments cannot be applied to non-parameterized class %0">;
11242
11243def err_objc_type_args_specialized_class : Error<
11244  "type arguments cannot be applied to already-specialized class type %0">;
11245
11246def err_objc_type_args_wrong_arity : Error<
11247  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
11248}
11249
11250def err_objc_type_arg_not_id_compatible : Error<
11251  "type argument %0 is neither an Objective-C object nor a block type">;
11252
11253def err_objc_type_arg_does_not_match_bound : Error<
11254  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
11255
11256def warn_objc_redundant_qualified_class_type : Warning<
11257  "parameterized class %0 already conforms to the protocols listed; did you "
11258  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
11259
11260def warn_block_literal_attributes_on_omitted_return_type : Warning<
11261  "attribute %0 ignored, because it cannot be applied to omitted return type">,
11262  InGroup<IgnoredAttributes>;
11263
11264def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
11265  "'%0' qualifier on omitted return type %1 has no effect">,
11266  InGroup<IgnoredQualifiers>;
11267
11268def warn_shadow_field : Warning<
11269  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
11270  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
11271def note_shadow_field : Note<"declared here">;
11272
11273def err_multiversion_required_in_redecl : Error<
11274  "function declaration is missing %select{'target'|'cpu_specific' or "
11275  "'cpu_dispatch'}0 attribute in a multiversioned function">;
11276def note_multiversioning_caused_here : Note<
11277  "function multiversioning caused by this declaration">;
11278def err_multiversion_after_used : Error<
11279  "function declaration cannot become a multiversioned function after first "
11280  "usage">;
11281def err_bad_multiversion_option : Error<
11282  "function multiversioning doesn't support %select{feature|architecture}0 "
11283  "'%1'">;
11284def err_multiversion_duplicate : Error<
11285  "multiversioned function redeclarations require identical target attributes">;
11286def err_multiversion_noproto : Error<
11287  "multiversioned function must have a prototype">;
11288def err_multiversion_disallowed_other_attr
11289    : Error<"attribute "
11290            "'%select{|target|cpu_specific|cpu_dispatch|target_clones}0' "
11291            "multiversioning cannot be combined"
11292            " with attribute %1">;
11293def err_multiversion_mismatched_attrs
11294    : Error<"attributes on multiversioned functions must all match, attribute "
11295            "%0 %select{is missing|has different arguments}1">;
11296def err_multiversion_diff : Error<
11297  "multiversioned function declaration has a different %select{calling convention"
11298  "|return type|constexpr specification|inline specification|linkage|"
11299  "language linkage}0">;
11300def err_multiversion_doesnt_support
11301    : Error<"attribute "
11302            "'%select{|target|cpu_specific|cpu_dispatch|target_clones}0' "
11303            "multiversioned functions do not "
11304            "yet support %select{function templates|virtual functions|"
11305            "deduced return types|constructors|destructors|deleted functions|"
11306            "defaulted functions|constexpr functions|consteval "
11307            "function|lambdas}1">;
11308def err_multiversion_not_allowed_on_main : Error<
11309  "'main' cannot be a multiversioned function">;
11310def err_multiversion_not_supported : Error<
11311 "function multiversioning is not supported on the current target">;
11312def err_multiversion_types_mixed : Error<
11313  "multiversioning attributes cannot be combined">;
11314def err_cpu_dispatch_mismatch : Error<
11315 "'cpu_dispatch' function redeclared with different CPUs">;
11316def err_cpu_specific_multiple_defs : Error<
11317 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
11318def warn_multiversion_duplicate_entries : Warning<
11319 "CPU list contains duplicate entries; attribute ignored">,
11320  InGroup<FunctionMultiVersioning>;
11321def warn_dispatch_body_ignored : Warning<
11322  "body of cpu_dispatch function will be ignored">,
11323  InGroup<FunctionMultiVersioning>;
11324def err_target_clone_must_have_default
11325    : Error<"'target_clones' multiversioning requires a default target">;
11326def err_target_clone_doesnt_match
11327    : Error<"'target_clones' attribute does not match previous declaration">;
11328def warn_target_clone_mixed_values
11329    : ExtWarn<
11330          "mixing 'target_clones' specifier mechanisms is permitted for GCC "
11331          "compatibility; use a comma separated sequence of string literals, "
11332          "or a string literal containing a comma-separated list of versions">,
11333      InGroup<TargetClonesMixedSpecifiers>;
11334def warn_target_clone_duplicate_options
11335    : Warning<"version list contains duplicate entries">,
11336      InGroup<FunctionMultiVersioning>;
11337
11338// three-way comparison operator diagnostics
11339def err_implied_comparison_category_type_not_found : Error<
11340  "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
11341  "because type '%0' was not found; include <compare>">;
11342def err_spaceship_argument_narrowing : Error<
11343  "argument to 'operator<=>' "
11344  "%select{cannot be narrowed from type %1 to %2|"
11345  "evaluates to %1, which cannot be narrowed to type %2}0">;
11346def err_std_compare_type_not_supported : Error<
11347  "standard library implementation of %0 is not supported; "
11348   "%select{member '%2' does not have expected form|"
11349   "member '%2' is missing|"
11350   "the type is not trivially copyable|"
11351   "the type does not have the expected form}1">;
11352def note_rewriting_operator_as_spaceship : Note<
11353  "while rewriting comparison as call to 'operator<=>' declared here">;
11354def err_three_way_vector_comparison : Error<
11355  "three-way comparison between vectors is not supported">;
11356
11357// Memory Tagging Extensions (MTE) diagnostics
11358def err_memtag_arg_null_or_pointer : Error<
11359  "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
11360def err_memtag_any2arg_pointer : Error<
11361  "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
11362def err_memtag_arg_must_be_pointer : Error<
11363  "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
11364def err_memtag_arg_must_be_integer : Error<
11365  "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
11366
11367def warn_dereference_of_noderef_type : Warning<
11368  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
11369def warn_dereference_of_noderef_type_no_decl : Warning<
11370  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
11371def warn_noderef_on_non_pointer_or_array : Warning<
11372  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
11373def warn_noderef_to_dereferenceable_pointer : Warning<
11374  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
11375
11376def err_builtin_launder_invalid_arg : Error<
11377  "%select{non-pointer|function pointer|void pointer}0 argument to "
11378  "'__builtin_launder' is not allowed">;
11379
11380def err_builtin_invalid_arg_type: Error <
11381  "%ordinal0 argument must be a "
11382  "%select{vector, integer or floating point type|matrix|"
11383  "pointer to a valid matrix element type|"
11384  "signed integer or floating point type|vector type|"
11385  "floating point type|"
11386  "vector of integers}1 (was %2)">;
11387
11388def err_builtin_matrix_disabled: Error<
11389  "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
11390def err_matrix_index_not_integer: Error<
11391  "matrix %select{row|column}0 index is not an integer">;
11392def err_matrix_index_outside_range: Error<
11393  "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
11394def err_matrix_incomplete_index: Error<
11395  "single subscript expressions are not allowed for matrix values">;
11396def err_matrix_separate_incomplete_index: Error<
11397  "matrix row and column subscripts cannot be separated by any expression">;
11398def err_matrix_subscript_comma: Error<
11399  "comma expressions are not allowed as indices in matrix subscript expressions">;
11400def err_builtin_matrix_scalar_unsigned_arg: Error<
11401  "%0 argument must be a constant unsigned integer expression">;
11402def err_builtin_matrix_pointer_arg_mismatch: Error<
11403  "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
11404def err_builtin_matrix_store_to_const: Error<
11405  "cannot store matrix to read-only pointer">;
11406def err_builtin_matrix_stride_too_small: Error<
11407  "stride must be greater or equal to the number of rows">;
11408def err_builtin_matrix_invalid_dimension: Error<
11409  "%0 dimension is outside the allowed range [1, %1]">;
11410
11411def warn_mismatched_import : Warning<
11412  "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
11413  "previous declaration">,
11414  InGroup<IgnoredAttributes>;
11415def warn_import_on_definition : Warning<
11416  "import %select{module|name}0 cannot be applied to a function with a definition">,
11417  InGroup<IgnoredAttributes>;
11418
11419def err_preserve_field_info_not_field : Error<
11420  "__builtin_preserve_field_info argument %0 not a field access">;
11421def err_preserve_field_info_not_const: Error<
11422  "__builtin_preserve_field_info argument %0 not a constant">;
11423def err_btf_type_id_not_const: Error<
11424  "__builtin_btf_type_id argument %0 not a constant">;
11425def err_preserve_type_info_invalid : Error<
11426  "__builtin_preserve_type_info argument %0 invalid">;
11427def err_preserve_type_info_not_const: Error<
11428  "__builtin_preserve_type_info argument %0 not a constant">;
11429def err_preserve_enum_value_invalid : Error<
11430  "__builtin_preserve_enum_value argument %0 invalid">;
11431def err_preserve_enum_value_not_const: Error<
11432  "__builtin_preserve_enum_value argument %0 not a constant">;
11433
11434def err_bit_cast_non_trivially_copyable : Error<
11435  "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
11436def err_bit_cast_type_size_mismatch : Error<
11437  "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
11438
11439// SYCL-specific diagnostics
11440def warn_sycl_kernel_num_of_template_params : Warning<
11441  "'sycl_kernel' attribute only applies to a function template with at least"
11442  " two template parameters">, InGroup<IgnoredAttributes>;
11443def warn_sycl_kernel_invalid_template_param_type : Warning<
11444  "template parameter of a function template with the 'sycl_kernel' attribute"
11445  " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
11446def warn_sycl_kernel_num_of_function_params : Warning<
11447  "function template with 'sycl_kernel' attribute must have a single parameter">,
11448  InGroup<IgnoredAttributes>;
11449def warn_sycl_kernel_return_type : Warning<
11450  "function template with 'sycl_kernel' attribute must have a 'void' return type">,
11451  InGroup<IgnoredAttributes>;
11452def err_sycl_special_type_num_init_method : Error<
11453  "types with 'sycl_special_class' attribute must have one and only one '__init' "
11454  "method defined">;
11455
11456def err_bit_int_bad_size : Error<"%select{signed|unsigned}0 _BitInt must "
11457                                 "have a bit size of at least %select{2|1}0">;
11458def err_bit_int_max_size : Error<"%select{signed|unsigned}0 _BitInt of bit "
11459                                 "sizes greater than %1 not supported">;
11460
11461// errors of expect.with.probability
11462def err_probability_not_constant_float : Error<
11463   "probability argument to __builtin_expect_with_probability must be constant "
11464   "floating-point expression">;
11465def err_probability_out_of_range : Error<
11466   "probability argument to __builtin_expect_with_probability is outside the "
11467   "range [0.0, 1.0]">;
11468
11469// TCB warnings
11470def err_tcb_conflicting_attributes : Error<
11471  "attributes '%0(\"%2\")' and '%1(\"%2\")' are mutually exclusive">;
11472def warn_tcb_enforcement_violation : Warning<
11473  "calling %0 is a violation of trusted computing base '%1'">,
11474  InGroup<DiagGroup<"tcb-enforcement">>;
11475
11476// RISC-V builtin required extension warning
11477def err_riscv_builtin_requires_extension : Error<
11478  "builtin requires at least one of the following extensions support to be enabled : %0">;
11479def err_riscv_builtin_invalid_lmul : Error<
11480  "LMUL argument must be in the range [0,3] or [5,7]">;
11481} // end of sema component.
11482