xref: /netbsd-src/external/apache2/llvm/dist/clang/include/clang/Basic/DiagnosticSemaKinds.td (revision e038c9c4676b0f19b1b7dd08a940c6ed64a6d5ae)
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">;
69
70// Constant expressions
71def err_expr_not_ice : Error<
72  "expression is not an %select{integer|integral}0 constant expression">;
73def ext_expr_not_ice : Extension<
74  "expression is not an %select{integer|integral}0 constant expression; "
75  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
76def err_typecheck_converted_constant_expression : Error<
77  "value of type %0 is not implicitly convertible to %1">;
78def err_typecheck_converted_constant_expression_disallowed : Error<
79  "conversion from %0 to %1 is not allowed in a converted constant expression">;
80def err_typecheck_converted_constant_expression_indirect : Error<
81  "conversion from %0 to %1 in converted constant expression would "
82  "bind reference to a temporary">;
83def err_expr_not_cce : Error<
84  "%select{case value|enumerator value|non-type template argument|"
85  "array size|constexpr if condition|explicit specifier argument}0 "
86  "is not a constant expression">;
87def ext_cce_narrowing : ExtWarn<
88  "%select{case value|enumerator value|non-type template argument|"
89  "array size|constexpr if condition|explicit specifier argument}0 "
90  "%select{cannot be narrowed from type %2 to %3|"
91  "evaluates to %2, which cannot be narrowed to type %3}1">,
92  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
93def err_ice_not_integral : Error<
94  "%select{integer|integral}1 constant expression must have "
95  "%select{integer|integral or unscoped enumeration}1 type, not %0">;
96def err_ice_incomplete_type : Error<
97  "integral constant expression has incomplete class type %0">;
98def err_ice_explicit_conversion : Error<
99  "integral constant expression requires explicit conversion from %0 to %1">;
100def note_ice_conversion_here : Note<
101  "conversion to %select{integral|enumeration}0 type %1 declared here">;
102def err_ice_ambiguous_conversion : Error<
103  "ambiguous conversion from type %0 to an integral or unscoped "
104  "enumeration type">;
105def err_ice_too_large : Error<
106  "integer constant expression evaluates to value %0 that cannot be "
107  "represented in a %1-bit %select{signed|unsigned}2 integer type">;
108def err_expr_not_string_literal : Error<"expression is not a string literal">;
109
110// Semantic analysis of constant literals.
111def ext_predef_outside_function : Warning<
112  "predefined identifier is only valid inside function">,
113  InGroup<DiagGroup<"predefined-identifier-outside-function">>;
114def warn_float_overflow : Warning<
115  "magnitude of floating-point constant too large for type %0; maximum is %1">,
116   InGroup<LiteralRange>;
117def warn_float_underflow : Warning<
118  "magnitude of floating-point constant too small for type %0; minimum is %1">,
119  InGroup<LiteralRange>;
120def warn_double_const_requires_fp64 : Warning<
121  "double precision constant requires %select{cl_khr_fp64|cl_khr_fp64 and __opencl_c_fp64}0, "
122  "casting to single precision">;
123def err_half_const_requires_fp16 : Error<
124  "half precision constant requires cl_khr_fp16">;
125
126// C99 variable-length arrays
127def ext_vla : Extension<"variable length arrays are a C99 feature">,
128  InGroup<VLAExtension>;
129def warn_vla_used : Warning<"variable length array used">,
130  InGroup<VLA>, DefaultIgnore;
131def err_vla_in_sfinae : Error<
132  "variable length array cannot be formed during template argument deduction">;
133def err_array_star_in_function_definition : Error<
134  "variable length array must be bound in function definition">;
135def err_vla_decl_in_file_scope : Error<
136  "variable length array declaration not allowed at file scope">;
137def err_vla_decl_has_static_storage : Error<
138  "variable length array declaration cannot have 'static' storage duration">;
139def err_vla_decl_has_extern_linkage : Error<
140  "variable length array declaration cannot have 'extern' linkage">;
141def ext_vla_folded_to_constant : ExtWarn<
142  "variable length array folded to constant array as an extension">,
143  InGroup<GNUFoldingConstant>;
144def err_vla_unsupported : Error<
145  "variable length arrays are not supported for the current target">;
146def note_vla_unsupported : Note<
147  "variable length arrays are not supported for the current target">;
148
149// C99 variably modified types
150def err_variably_modified_template_arg : Error<
151  "variably modified type %0 cannot be used as a template argument">;
152def err_variably_modified_nontype_template_param : Error<
153  "non-type template parameter of variably modified type %0">;
154def err_variably_modified_new_type : Error<
155  "'new' cannot allocate object of variably modified type %0">;
156
157// C99 Designated Initializers
158def ext_designated_init : Extension<
159  "designated initializers are a C99 feature">, InGroup<C99Designator>;
160def err_array_designator_negative : Error<
161  "array designator value '%0' is negative">;
162def err_array_designator_empty_range : Error<
163  "array designator range [%0, %1] is empty">;
164def err_array_designator_non_array : Error<
165  "array designator cannot initialize non-array type %0">;
166def err_array_designator_too_large : Error<
167  "array designator index (%0) exceeds array bounds (%1)">;
168def err_field_designator_non_aggr : Error<
169  "field designator cannot initialize a "
170  "%select{non-struct, non-union|non-class}0 type %1">;
171def err_field_designator_unknown : Error<
172  "field designator %0 does not refer to any field in type %1">;
173def err_field_designator_nonfield : Error<
174  "field designator %0 does not refer to a non-static data member">;
175def note_field_designator_found : Note<"field designator refers here">;
176def err_designator_for_scalar_or_sizeless_init : Error<
177  "designator in initializer for %select{scalar|indivisible sizeless}0 "
178  "type %1">;
179def warn_initializer_overrides : Warning<
180  "initializer %select{partially |}0overrides prior initialization of "
181  "this subobject">, InGroup<InitializerOverrides>;
182def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Text>,
183  InGroup<InitializerOverrides>, SFINAEFailure;
184def err_initializer_overrides_destructed : Error<
185  "initializer would partially override prior initialization of object of "
186  "type %1 with non-trivial destruction">;
187def note_previous_initializer : Note<
188  "previous initialization %select{|with side effects }0is here"
189  "%select{| (side effects will not occur at run time)}0">;
190def err_designator_into_flexible_array_member : Error<
191  "designator into flexible array member subobject">;
192def note_flexible_array_member : Note<
193  "initialized flexible array member %0 is here">;
194def ext_flexible_array_init : Extension<
195  "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
196
197// C++20 designated initializers
198def ext_cxx_designated_init : Extension<
199  "designated initializers are a C++20 extension">, InGroup<CXX20Designator>;
200def warn_cxx17_compat_designated_init : Warning<
201  "designated initializers are incompatible with C++ standards before C++20">,
202  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
203def ext_designated_init_mixed : ExtWarn<
204  "mixture of designated and non-designated initializers in the same "
205  "initializer list is a C99 extension">, InGroup<C99Designator>;
206def note_designated_init_mixed : Note<
207  "first non-designated initializer is here">;
208def ext_designated_init_array : ExtWarn<
209  "array designators are a C99 extension">, InGroup<C99Designator>;
210def ext_designated_init_nested : ExtWarn<
211  "nested designators are a C99 extension">, InGroup<C99Designator>;
212def ext_designated_init_reordered : ExtWarn<
213  "ISO C++ requires field designators to be specified in declaration order; "
214  "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
215  SFINAEFailure;
216def note_previous_field_init : Note<
217  "previous initialization for field %0 is here">;
218def ext_designated_init_brace_elision : ExtWarn<
219  "brace elision for designated initializer is a C99 extension">,
220  InGroup<C99Designator>, SFINAEFailure;
221
222// Declarations.
223def ext_plain_complex : ExtWarn<
224  "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
225def ext_imaginary_constant : Extension<
226  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
227def ext_integer_complex : Extension<
228  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
229
230def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
231  "'_Fract' or '_Accum', not '%0'">;
232def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
233def err_invalid_width_spec : Error<
234  "'%select{|short|long|long long}0 %1' is invalid">;
235def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
236
237def ext_auto_type_specifier : ExtWarn<
238  "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
239def warn_auto_storage_class : Warning<
240  "'auto' storage class specifier is redundant and incompatible with C++11">,
241  InGroup<CXX11Compat>, DefaultIgnore;
242
243def warn_deprecated_register : Warning<
244  "'register' storage class specifier is deprecated "
245  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
246def ext_register_storage_class : ExtWarn<
247  "ISO C++17 does not allow 'register' storage class specifier">,
248  DefaultError, InGroup<Register>;
249
250def err_invalid_decl_spec_combination : Error<
251  "cannot combine with previous '%0' declaration specifier">;
252def err_invalid_vector_decl_spec_combination : Error<
253  "cannot combine with previous '%0' declaration specifier. "
254  "'__vector' must be first">;
255def err_invalid_pixel_decl_spec_combination : Error<
256  "'__pixel' must be preceded by '__vector'.  "
257  "'%0' declaration specifier not allowed here">;
258def err_invalid_vector_bool_decl_spec : Error<
259  "cannot use '%0' with '__vector bool'">;
260def err_invalid_vector_long_decl_spec : Error<
261  "cannot use 'long' with '__vector'">;
262def err_invalid_vector_float_decl_spec : Error<
263  "cannot use 'float' with '__vector'">;
264def err_invalid_vector_double_decl_spec : Error <
265  "use of 'double' with '__vector' requires VSX support to be enabled "
266  "(available on POWER7 or later)">;
267def err_invalid_vector_bool_int128_decl_spec : Error <
268  "use of '__int128' with '__vector bool' requires VSX support enabled (on "
269  "POWER10 or later)">;
270def err_invalid_vector_long_long_decl_spec : Error <
271  "use of 'long long' with '__vector bool' requires VSX support (available on "
272  "POWER7 or later) or extended Altivec support (available on POWER8 or later) "
273  "to be enabled">;
274def err_invalid_vector_long_double_decl_spec : Error<
275  "cannot use 'long double' with '__vector'">;
276def warn_vector_long_decl_spec_combination : Warning<
277  "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
278
279def err_redeclaration_different_type : Error<
280  "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
281def err_bad_variable_name : Error<
282  "%0 cannot be the name of a variable or data member">;
283def err_bad_parameter_name : Error<
284  "%0 cannot be the name of a parameter">;
285def err_bad_parameter_name_template_id : Error<
286  "parameter name cannot have template arguments">;
287def ext_parameter_name_omitted_c2x : ExtWarn<
288  "omitting the parameter name in a function definition is a C2x extension">,
289  InGroup<C2x>;
290def err_anyx86_interrupt_attribute : Error<
291  "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
292  "have %select{a 'void' return type|"
293  "only a pointer parameter optionally followed by an integer parameter|"
294  "a pointer as the first parameter|a %2 type as the second parameter}1">;
295def err_anyx86_interrupt_called : Error<
296  "interrupt service routine cannot be called directly">;
297def warn_anyx86_interrupt_regsave : Warning<
298  "interrupt service routine should only call a function"
299  " with attribute 'no_caller_saved_registers'">,
300  InGroup<DiagGroup<"interrupt-service-routine">>;
301def warn_arm_interrupt_calling_convention : Warning<
302   "call to function without interrupt attribute could clobber interruptee's VFP registers">,
303   InGroup<Extra>;
304def warn_interrupt_attribute_invalid : Warning<
305   "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
306   "functions that have %select{no parameters|a 'void' return type}1">,
307   InGroup<IgnoredAttributes>;
308def warn_riscv_repeated_interrupt_attribute : Warning<
309  "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
310def note_riscv_repeated_interrupt_attribute : Note<
311  "repeated RISC-V 'interrupt' attribute is here">;
312def warn_unused_parameter : Warning<"unused parameter %0">,
313  InGroup<UnusedParameter>, DefaultIgnore;
314def warn_unused_variable : Warning<"unused variable %0">,
315  InGroup<UnusedVariable>, DefaultIgnore;
316def warn_unused_local_typedef : Warning<
317  "unused %select{typedef|type alias}0 %1">,
318  InGroup<UnusedLocalTypedef>, DefaultIgnore;
319def warn_unused_property_backing_ivar :
320  Warning<"ivar %0 which backs the property is not "
321  "referenced in this property's accessor">,
322  InGroup<UnusedPropertyIvar>, DefaultIgnore;
323def warn_unused_const_variable : Warning<"unused variable %0">,
324  InGroup<UnusedConstVariable>, DefaultIgnore;
325def warn_unused_exception_param : Warning<"unused exception parameter %0">,
326  InGroup<UnusedExceptionParameter>, DefaultIgnore;
327def warn_decl_in_param_list : Warning<
328  "declaration of %0 will not be visible outside of this function">,
329  InGroup<Visibility>;
330def warn_redefinition_in_param_list : Warning<
331  "redefinition of %0 will not be visible outside of this function">,
332  InGroup<Visibility>;
333def warn_empty_parens_are_function_decl : Warning<
334  "empty parentheses interpreted as a function declaration">,
335  InGroup<VexingParse>;
336def warn_parens_disambiguated_as_function_declaration : Warning<
337  "parentheses were disambiguated as a function declaration">,
338  InGroup<VexingParse>;
339def warn_parens_disambiguated_as_variable_declaration : Warning<
340  "parentheses were disambiguated as redundant parentheses around declaration "
341  "of variable named %0">, InGroup<VexingParse>;
342def warn_redundant_parens_around_declarator : Warning<
343  "redundant parentheses surrounding declarator">,
344  InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
345def note_additional_parens_for_variable_declaration : Note<
346  "add a pair of parentheses to declare a variable">;
347def note_raii_guard_add_name : Note<
348  "add a variable name to declare a %0 initialized with %1">;
349def note_function_style_cast_add_parentheses : Note<
350  "add enclosing parentheses to perform a function-style cast">;
351def note_remove_parens_for_variable_declaration : Note<
352  "remove parentheses to silence this warning">;
353def note_empty_parens_function_call : Note<
354  "change this ',' to a ';' to call %0">;
355def note_empty_parens_default_ctor : Note<
356  "remove parentheses to declare a variable">;
357def note_empty_parens_zero_initialize : Note<
358  "replace parentheses with an initializer to declare a variable">;
359def warn_unused_function : Warning<"unused function %0">,
360  InGroup<UnusedFunction>, DefaultIgnore;
361def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
362  InGroup<UnusedTemplate>, DefaultIgnore;
363def warn_unused_member_function : Warning<"unused member function %0">,
364  InGroup<UnusedMemberFunction>, DefaultIgnore;
365def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
366  InGroup<UsedButMarkedUnused>, DefaultIgnore;
367def warn_unneeded_internal_decl : Warning<
368  "%select{function|variable}0 %1 is not needed and will not be emitted">,
369  InGroup<UnneededInternalDecl>, DefaultIgnore;
370def warn_unneeded_static_internal_decl : Warning<
371  "'static' function %0 declared in header file "
372  "should be declared 'static inline'">,
373  InGroup<UnneededInternalDecl>, DefaultIgnore;
374def warn_unneeded_member_function : Warning<
375  "member function %0 is not needed and will not be emitted">,
376  InGroup<UnneededMemberFunction>, DefaultIgnore;
377def warn_unused_private_field: Warning<"private field %0 is not used">,
378  InGroup<UnusedPrivateField>, DefaultIgnore;
379def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
380  "%select{used|required to be captured for this use}1">,
381  InGroup<UnusedLambdaCapture>, DefaultIgnore;
382
383def warn_reserved_extern_symbol: Warning<
384  "identifier %0 is reserved because %select{"
385  "<ERROR>|" // ReservedIdentifierStatus::NotReserved
386  "it starts with '_' at global scope|"
387  "it starts with '__'|"
388  "it starts with '_' followed by a capital letter|"
389  "it contains '__'}1">,
390  InGroup<ReservedIdentifier>, DefaultIgnore;
391
392def warn_parameter_size: Warning<
393  "%0 is a large (%1 bytes) pass-by-value argument; "
394  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
395def warn_return_value_size: Warning<
396  "return value of %0 is a large (%1 bytes) pass-by-value object; "
397  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
398def warn_return_value_udt: Warning<
399  "%0 has C-linkage specified, but returns user-defined type %1 which is "
400  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
401def warn_return_value_udt_incomplete: Warning<
402  "%0 has C-linkage specified, but returns incomplete type %1 which could be "
403  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
404def warn_implicit_function_decl : Warning<
405  "implicit declaration of function %0">,
406  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
407def ext_implicit_function_decl : ExtWarn<
408  "implicit declaration of function %0 is invalid in C99">,
409  InGroup<ImplicitFunctionDeclare>;
410def note_function_suggestion : Note<"did you mean %0?">;
411
412def err_ellipsis_first_param : Error<
413  "ISO C requires a named parameter before '...'">;
414def err_declarator_need_ident : Error<"declarator requires an identifier">;
415def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
416def err_language_linkage_spec_not_ascii : Error<
417  "string literal in language linkage specifier cannot have an "
418  "encoding-prefix">;
419def ext_use_out_of_scope_declaration : ExtWarn<
420  "use of out-of-scope declaration of %0%select{| whose type is not "
421  "compatible with that of an implicit declaration}1">,
422  InGroup<DiagGroup<"out-of-scope-function">>;
423def err_inline_non_function : Error<
424  "'inline' can only appear on functions%select{| and non-local variables}0">;
425def err_noreturn_non_function : Error<
426  "'_Noreturn' can only appear on functions">;
427def warn_qual_return_type : Warning<
428  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
429  InGroup<IgnoredQualifiers>, DefaultIgnore;
430def warn_deprecated_redundant_constexpr_static_def : Warning<
431  "out-of-line definition of constexpr static data member is redundant "
432  "in C++17 and is deprecated">,
433  InGroup<Deprecated>, DefaultIgnore;
434
435def warn_decl_shadow :
436  Warning<"declaration shadows a %select{"
437          "local variable|"
438          "variable in %2|"
439          "static data member of %2|"
440          "field of %2|"
441          "typedef in %2|"
442          "type alias in %2|"
443          "structured binding}1">,
444  InGroup<Shadow>, DefaultIgnore;
445def warn_decl_shadow_uncaptured_local :
446  Warning<warn_decl_shadow.Text>,
447  InGroup<ShadowUncapturedLocal>, DefaultIgnore;
448def warn_ctor_parm_shadows_field:
449  Warning<"constructor parameter %0 shadows the field %1 of %2">,
450  InGroup<ShadowFieldInConstructor>, DefaultIgnore;
451def warn_modifying_shadowing_decl :
452  Warning<"modifying constructor parameter %0 that shadows a "
453          "field of %1">,
454  InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
455
456// C++ decomposition declarations
457def err_decomp_decl_context : Error<
458  "decomposition declaration not permitted in this context">;
459def warn_cxx14_compat_decomp_decl : Warning<
460  "decomposition declarations are incompatible with "
461  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
462def ext_decomp_decl : ExtWarn<
463  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
464def ext_decomp_decl_cond : ExtWarn<
465  "ISO C++17 does not permit structured binding declaration in a condition">,
466  InGroup<DiagGroup<"binding-in-condition">>;
467def err_decomp_decl_spec : Error<
468  "decomposition declaration cannot be declared "
469  "%plural{1:'%1'|:with '%1' specifiers}0">;
470def ext_decomp_decl_spec : ExtWarn<
471  "decomposition declaration declared "
472  "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
473  InGroup<CXX20>;
474def warn_cxx17_compat_decomp_decl_spec : Warning<
475  "decomposition declaration declared "
476  "%plural{1:'%1'|:with '%1' specifiers}0 "
477  "is incompatible with C++ standards before C++20">,
478  InGroup<CXXPre20Compat>, DefaultIgnore;
479def err_decomp_decl_type : Error<
480  "decomposition declaration cannot be declared with type %0; "
481  "declared type must be 'auto' or reference to 'auto'">;
482def err_decomp_decl_parens : Error<
483  "decomposition declaration cannot be declared with parentheses">;
484def err_decomp_decl_template : Error<
485  "decomposition declaration template not supported">;
486def err_decomp_decl_not_alone : Error<
487  "decomposition declaration must be the only declaration in its group">;
488def err_decomp_decl_requires_init : Error<
489  "decomposition declaration %0 requires an initializer">;
490def err_decomp_decl_wrong_number_bindings : Error<
491  "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
492  "%select{%plural{0:no|:only %1}1|%1}4 "
493  "%plural{1:name was|:names were}1 provided">;
494def err_decomp_decl_unbindable_type : Error<
495  "cannot decompose %select{union|non-class, non-array}1 type %2">;
496def err_decomp_decl_multiple_bases_with_members : Error<
497  "cannot decompose class type %1: "
498  "%select{its base classes %2 and|both it and its base class}0 %3 "
499  "have non-static data members">;
500def err_decomp_decl_ambiguous_base : Error<
501  "cannot decompose members of ambiguous base class %1 of %0:%2">;
502def err_decomp_decl_inaccessible_base : Error<
503  "cannot decompose members of inaccessible base class %1 of %0">,
504  AccessControl;
505def err_decomp_decl_inaccessible_field : Error<
506  "cannot decompose %select{private|protected}0 member %1 of %3">,
507  AccessControl;
508def err_decomp_decl_lambda : Error<
509  "cannot decompose lambda closure type">;
510def err_decomp_decl_anon_union_member : Error<
511  "cannot decompose class type %0 because it has an anonymous "
512  "%select{struct|union}1 member">;
513def err_decomp_decl_std_tuple_element_not_specialized : Error<
514  "cannot decompose this type; 'std::tuple_element<%0>::type' "
515  "does not name a type">;
516def err_decomp_decl_std_tuple_size_not_constant : Error<
517  "cannot decompose this type; 'std::tuple_size<%0>::value' "
518  "is not a valid integral constant expression">;
519def note_in_binding_decl_init : Note<
520  "in implicit initialization of binding declaration %0">;
521
522def err_std_type_trait_not_class_template : Error<
523  "unsupported standard library implementation: "
524  "'std::%0' is not a class template">;
525
526// C++ using declarations
527def err_using_requires_qualname : Error<
528  "using declaration requires a qualified name">;
529def err_using_typename_non_type : Error<
530  "'typename' keyword used on a non-type">;
531def err_using_dependent_value_is_type : Error<
532  "dependent using declaration resolved to type without 'typename'">;
533def err_using_decl_nested_name_specifier_is_not_class : Error<
534  "using declaration in class refers into '%0', which is not a class">;
535def err_using_decl_nested_name_specifier_is_current_class : Error<
536  "using declaration refers to its own class">;
537def err_using_decl_nested_name_specifier_is_not_base_class : Error<
538  "using declaration refers into '%0', which is not a base class of %1">;
539def err_using_decl_constructor_not_in_direct_base : Error<
540  "%0 is not a direct base of %1, cannot inherit constructors">;
541def err_using_decl_can_not_refer_to_class_member : Error<
542  "using declaration cannot refer to class member">;
543def err_ambiguous_inherited_constructor : Error<
544  "constructor of %0 inherited from multiple base class subobjects">;
545def note_ambiguous_inherited_constructor_using : Note<
546  "inherited from base class %0 here">;
547def note_using_decl_class_member_workaround : Note<
548  "use %select{an alias declaration|a typedef declaration|a reference|"
549  "a const variable|a constexpr variable}0 instead">;
550def err_using_decl_can_not_refer_to_namespace : Error<
551  "using declaration cannot refer to a namespace">;
552def err_using_decl_can_not_refer_to_scoped_enum : Error<
553  "using declaration cannot refer to a scoped enumerator">;
554def err_using_decl_constructor : Error<
555  "using declaration cannot refer to a constructor">;
556def warn_cxx98_compat_using_decl_constructor : Warning<
557  "inheriting constructors are incompatible with C++98">,
558  InGroup<CXX98Compat>, DefaultIgnore;
559def err_using_decl_destructor : Error<
560  "using declaration cannot refer to a destructor">;
561def err_using_decl_template_id : Error<
562  "using declaration cannot refer to a template specialization">;
563def note_using_decl_target : Note<"target of using declaration">;
564def note_using_decl_conflict : Note<"conflicting declaration">;
565def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
566def err_using_decl_conflict : Error<
567  "target of using declaration conflicts with declaration already in scope">;
568def err_using_decl_conflict_reverse : Error<
569  "declaration conflicts with target of using declaration already in scope">;
570def note_using_decl : Note<"%select{|previous }0using declaration">;
571def err_using_decl_redeclaration_expansion : Error<
572  "using declaration pack expansion at block scope produces multiple values">;
573
574def warn_access_decl_deprecated : Warning<
575  "access declarations are deprecated; use using declarations instead">,
576  InGroup<Deprecated>;
577def err_access_decl : Error<
578  "ISO C++11 does not allow access declarations; "
579  "use using declarations instead">;
580def warn_deprecated_copy : Warning<
581  "definition of implicit copy %select{constructor|assignment operator}1 "
582  "for %0 is deprecated because it has a user-declared copy "
583  "%select{assignment operator|constructor}1">,
584  InGroup<DeprecatedCopy>, DefaultIgnore;
585def warn_deprecated_copy_with_dtor : Warning<
586  "definition of implicit copy %select{constructor|assignment operator}1 "
587  "for %0 is deprecated because it has a user-declared destructor">,
588  InGroup<DeprecatedCopyWithDtor>, DefaultIgnore;
589def warn_deprecated_copy_with_user_provided_copy: Warning<
590  "definition of implicit copy %select{constructor|assignment operator}1 "
591  "for %0 is deprecated because it has a user-provided copy "
592  "%select{assignment operator|constructor}1">,
593  InGroup<DeprecatedCopyWithUserProvidedCopy>, DefaultIgnore;
594def warn_deprecated_copy_with_user_provided_dtor : Warning<
595  "definition of implicit copy %select{constructor|assignment operator}1 "
596  "for %0 is deprecated because it has a user-provided destructor">,
597  InGroup<DeprecatedCopyWithUserProvidedDtor>, DefaultIgnore;
598def warn_cxx17_compat_exception_spec_in_signature : Warning<
599  "mangled name of %0 will change in C++17 due to non-throwing exception "
600  "specification in function signature">, InGroup<CXX17CompatMangling>;
601
602def warn_global_constructor : Warning<
603  "declaration requires a global constructor">,
604  InGroup<GlobalConstructors>, DefaultIgnore;
605def warn_global_destructor : Warning<
606  "declaration requires a global destructor">,
607   InGroup<GlobalConstructors>, DefaultIgnore;
608def warn_exit_time_destructor : Warning<
609  "declaration requires an exit-time destructor">,
610  InGroup<ExitTimeDestructors>, DefaultIgnore;
611
612def err_invalid_thread : Error<
613  "'%0' is only allowed on variable declarations">;
614def err_thread_non_global : Error<
615  "'%0' variables must have global storage">;
616def err_thread_unsupported : Error<
617  "thread-local storage is not supported for the current target">;
618
619// FIXME: Combine fallout warnings to just one warning.
620def warn_maybe_falloff_nonvoid_function : Warning<
621  "non-void function does not return a value in all control paths">,
622  InGroup<ReturnType>;
623def warn_falloff_nonvoid_function : Warning<
624  "non-void function does not return a value">,
625  InGroup<ReturnType>;
626def err_maybe_falloff_nonvoid_block : Error<
627  "non-void block does not return a value in all control paths">;
628def err_falloff_nonvoid_block : Error<
629  "non-void block does not return a value">;
630def warn_maybe_falloff_nonvoid_coroutine : Warning<
631  "non-void coroutine does not return a value in all control paths">,
632  InGroup<ReturnType>;
633def warn_falloff_nonvoid_coroutine : Warning<
634  "non-void coroutine does not return a value">,
635  InGroup<ReturnType>;
636def warn_suggest_noreturn_function : Warning<
637  "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
638  InGroup<MissingNoreturn>, DefaultIgnore;
639def warn_suggest_noreturn_block : Warning<
640  "block could be declared with attribute 'noreturn'">,
641  InGroup<MissingNoreturn>, DefaultIgnore;
642
643// Unreachable code.
644def warn_unreachable : Warning<
645  "code will never be executed">,
646  InGroup<UnreachableCode>, DefaultIgnore;
647def warn_unreachable_break : Warning<
648  "'break' will never be executed">,
649  InGroup<UnreachableCodeBreak>, DefaultIgnore;
650def warn_unreachable_return : Warning<
651  "'return' will never be executed">,
652  InGroup<UnreachableCodeReturn>, DefaultIgnore;
653def warn_unreachable_loop_increment : Warning<
654  "loop will run at most once (loop increment never executed)">,
655  InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
656def note_unreachable_silence : Note<
657  "silence by adding parentheses to mark code as explicitly dead">;
658
659/// Built-in functions.
660def ext_implicit_lib_function_decl : ExtWarn<
661  "implicitly declaring library function '%0' with type %1">,
662  InGroup<ImplicitFunctionDeclare>;
663def note_include_header_or_declare : Note<
664  "include the header <%0> or explicitly provide a declaration for '%1'">;
665def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
666def warn_implicit_decl_no_jmp_buf
667    : Warning<"declaration of built-in function '%0' requires the declaration"
668    " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
669      InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
670def warn_implicit_decl_requires_sysheader : Warning<
671  "declaration of built-in function '%1' requires inclusion of the header <%0>">,
672  InGroup<BuiltinRequiresHeader>;
673def warn_redecl_library_builtin : Warning<
674  "incompatible redeclaration of library function %0">,
675  InGroup<DiagGroup<"incompatible-library-redeclaration">>;
676def err_builtin_definition : Error<"definition of builtin function %0">;
677def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
678def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
679def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
680  "%select{GCP|CDE}1">;
681def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
682def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
683def err_invalid_cpu_specific_dispatch_value : Error<
684"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
685def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
686  InGroup<ImplicitFunctionDeclare>, DefaultError;
687def warn_cstruct_memaccess : Warning<
688  "%select{destination for|source of|first operand of|second operand of}0 this "
689  "%1 call is a pointer to record %2 that is not trivial to "
690  "%select{primitive-default-initialize|primitive-copy}3">,
691  InGroup<NonTrivialMemaccess>;
692def note_nontrivial_field : Note<
693  "field is non-trivial to %select{copy|default-initialize}0">;
694def err_non_trivial_c_union_in_invalid_context : Error<
695  "cannot %select{"
696  "use type %1 for a function/method parameter|"
697  "use type %1 for function/method return|"
698  "default-initialize an object of type %1|"
699  "declare an automatic variable of type %1|"
700  "copy-initialize an object of type %1|"
701  "assign to a variable of type %1|"
702  "construct an automatic compound literal of type %1|"
703  "capture a variable of type %1|"
704  "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
705  "}3 "
706  "since it %select{contains|is}2 a union that is non-trivial to "
707  "%select{default-initialize|destruct|copy}0">;
708def note_non_trivial_c_union : Note<
709  "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
710  "non-trivial to %select{default-initialize|destruct|copy}1">;
711def warn_dyn_class_memaccess : Warning<
712  "%select{destination for|source of|first operand of|second operand of}0 this "
713  "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
714  "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
715  InGroup<DynamicClassMemaccess>;
716def note_bad_memaccess_silence : Note<
717  "explicitly cast the pointer to silence this warning">;
718def warn_sizeof_pointer_expr_memaccess : Warning<
719  "'%0' call operates on objects of type %1 while the size is based on a "
720  "different type %2">,
721  InGroup<SizeofPointerMemaccess>;
722def warn_sizeof_pointer_expr_memaccess_note : Note<
723  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
724  "it by the number of elements)|remove the addressof in the argument to "
725  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
726  "length}0?">;
727def warn_sizeof_pointer_type_memaccess : Warning<
728  "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
729  "%select{destination|source}2; expected %3 or an explicit length">,
730  InGroup<SizeofPointerMemaccess>;
731def warn_strlcpycat_wrong_size : Warning<
732  "size argument in %0 call appears to be size of the source; "
733  "expected the size of the destination">,
734  InGroup<DiagGroup<"strlcpy-strlcat-size">>;
735def note_strlcpycat_wrong_size : Note<
736  "change size argument to be the size of the destination">;
737def warn_memsize_comparison : Warning<
738  "size argument in %0 call is a comparison">,
739  InGroup<DiagGroup<"memsize-comparison">>;
740def note_memsize_comparison_paren : Note<
741  "did you mean to compare the result of %0 instead?">;
742def note_memsize_comparison_cast_silence : Note<
743  "explicitly cast the argument to size_t to silence this warning">;
744def warn_suspicious_sizeof_memset : Warning<
745  "%select{'size' argument to memset is '0'|"
746  "setting buffer to a 'sizeof' expression}0"
747  "; did you mean to transpose the last two arguments?">,
748  InGroup<MemsetTransposedArgs>;
749def note_suspicious_sizeof_memset_silence : Note<
750  "%select{parenthesize the third argument|"
751  "cast the second argument to 'int'}0 to silence">;
752def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
753  InGroup<SuspiciousBzero>;
754def note_suspicious_bzero_size_silence : Note<
755  "parenthesize the second argument to silence">;
756
757def warn_strncat_large_size : Warning<
758  "the value of the size argument in 'strncat' is too large, might lead to a "
759  "buffer overflow">, InGroup<StrncatSize>;
760def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
761  "to be size of the source">, InGroup<StrncatSize>;
762def warn_strncat_wrong_size : Warning<
763  "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
764def note_strncat_wrong_size : Note<
765  "change the argument to be the free space in the destination buffer minus "
766  "the terminating null byte">;
767
768def warn_assume_side_effects : Warning<
769  "the argument to %0 has side effects that will be discarded">,
770  InGroup<DiagGroup<"assume">>;
771def warn_assume_attribute_string_unknown : Warning<
772  "unknown assumption string '%0'; attribute is potentially ignored">,
773  InGroup<UnknownAssumption>;
774def warn_assume_attribute_string_unknown_suggested : Warning<
775  "unknown assumption string '%0' may be misspelled; attribute is potentially "
776  "ignored, did you mean '%1'?">,
777  InGroup<MisspelledAssumption>;
778
779def warn_builtin_chk_overflow : Warning<
780  "'%0' will always overflow; destination buffer has size %1,"
781  " but size argument is %2">,
782  InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
783
784def warn_fortify_source_overflow
785  : Warning<warn_builtin_chk_overflow.Text>, InGroup<FortifySource>;
786def warn_fortify_source_size_mismatch : Warning<
787  "'%0' size argument is too large; destination buffer has size %1,"
788  " but size argument is %2">, InGroup<FortifySource>;
789
790def warn_fortify_source_format_overflow : Warning<
791  "'%0' will always overflow; destination buffer has size %1,"
792  " but format string expands to at least %2">,
793  InGroup<FortifySource>;
794
795
796/// main()
797// static main() is not an error in C, just in C++.
798def warn_static_main : Warning<"'main' should not be declared static">,
799    InGroup<Main>;
800def err_static_main : Error<"'main' is not allowed to be declared static">;
801def err_inline_main : Error<"'main' is not allowed to be declared inline">;
802def ext_variadic_main : ExtWarn<
803  "'main' is not allowed to be declared variadic">, InGroup<Main>;
804def ext_noreturn_main : ExtWarn<
805  "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
806def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
807def err_constexpr_main : Error<
808  "'main' is not allowed to be declared %select{constexpr|consteval}0">;
809def err_deleted_main : Error<"'main' is not allowed to be deleted">;
810def err_mainlike_template_decl : Error<"%0 cannot be a template">;
811def err_main_returns_nonint : Error<"'main' must return 'int'">;
812def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
813    InGroup<MainReturnType>;
814def note_main_change_return_type : Note<"change return type to 'int'">;
815def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
816    "must be 0, 2, or 3">;
817def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
818    InGroup<Main>;
819def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
820    "parameter of 'main' (%select{argument count|argument array|environment|"
821    "platform-specific data}0) must be of type %1">;
822def warn_main_returns_bool_literal : Warning<"bool literal returned from "
823    "'main'">, InGroup<Main>;
824def err_main_global_variable :
825    Error<"main cannot be declared as global variable">;
826def warn_main_redefined : Warning<"variable named 'main' with external linkage "
827    "has undefined behavior">, InGroup<Main>;
828def ext_main_used : Extension<
829  "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
830
831/// parser diagnostics
832def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
833  InGroup<MissingDeclarations>;
834def err_no_declarators : Error<"declaration does not declare anything">;
835def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
836  InGroup<MissingDeclarations>;
837def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
838
839def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
840  "anonymous non-C-compatible type given name for linkage purposes "
841  "by %select{typedef|alias}0 declaration; "
842  "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
843def err_non_c_like_anon_struct_in_typedef : Error<
844  "anonymous non-C-compatible type given name for linkage purposes "
845  "by %select{typedef|alias}0 declaration after its linkage was computed; "
846  "add a tag name here to establish linkage prior to definition">;
847def err_typedef_changes_linkage : Error<
848  "unsupported: anonymous type given name for linkage purposes "
849  "by %select{typedef|alias}0 declaration after its linkage was computed; "
850  "add a tag name here to establish linkage prior to definition">;
851def note_non_c_like_anon_struct : Note<
852  "type is not C-compatible due to this "
853  "%select{base class|default member initializer|lambda expression|"
854  "friend declaration|member declaration}0">;
855def note_typedef_for_linkage_here : Note<
856  "type is given name %0 for linkage purposes by this "
857  "%select{typedef|alias}1 declaration">;
858
859def err_statically_allocated_object : Error<
860  "interface type cannot be statically allocated">;
861def err_object_cannot_be_passed_returned_by_value : Error<
862  "interface type %1 cannot be %select{returned|passed}0 by value"
863  "; did you forget * in %1?">;
864def err_parameters_retval_cannot_have_fp16_type : Error<
865  "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
866def err_opencl_half_load_store : Error<
867  "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
868  "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
869def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
870def err_opencl_half_declaration : Error<
871  "declaring variable of type %0 is not allowed">;
872def err_opencl_invalid_param : Error<
873  "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
874def err_opencl_invalid_return : Error<
875  "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
876def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
877def warn_pragma_options_align_reset_failed : Warning<
878  "#pragma options align=reset failed: %0">,
879  InGroup<IgnoredPragmas>;
880def err_pragma_options_align_mac68k_target_unsupported : Error<
881  "mac68k alignment pragma is not supported on this target">;
882def warn_pragma_pack_invalid_alignment : Warning<
883  "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
884  InGroup<IgnoredPragmas>;
885def err_pragma_pack_invalid_alignment : Error<
886  warn_pragma_pack_invalid_alignment.Text>;
887def warn_pragma_pack_non_default_at_include : Warning<
888  "non-default #pragma pack value changes the alignment of struct or union "
889  "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
890  DefaultIgnore;
891def warn_pragma_pack_modified_after_include : Warning<
892  "the current #pragma pack alignment value is modified in the included "
893  "file">, InGroup<PragmaPack>;
894def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
895  "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
896def note_pragma_pack_here : Note<
897  "previous '#pragma pack' directive that modifies alignment is here">;
898def note_pragma_pack_pop_instead_reset : Note<
899  "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
900// Follow the Microsoft implementation.
901def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
902def warn_pragma_pack_pop_identifier_and_alignment : Warning<
903  "specifying both a name and alignment to 'pop' is undefined">;
904def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
905  InGroup<IgnoredPragmas>;
906def err_pragma_fc_pp_scope : Error<
907  "'#pragma float_control push/pop' can only appear at file scope or namespace scope">;
908def err_pragma_fc_noprecise_requires_nofenv : Error<
909  "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
910def err_pragma_fc_except_requires_precise : Error<
911  "'#pragma float_control(except, on)' is illegal when precise is disabled">;
912def err_pragma_fc_noprecise_requires_noexcept : Error<
913  "'#pragma float_control(precise, off)' is illegal when except is enabled">;
914def err_pragma_fenv_requires_precise : Error<
915  "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
916def warn_cxx_ms_struct :
917  Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
918          "with base classes or virtual functions">,
919  DefaultError, InGroup<IncompatibleMSStruct>;
920def err_pragma_pack_identifer_not_supported : Error<
921  "specifying an identifier within `#pragma pack` is not supported on this target">;
922def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
923def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
924def err_invalid_super_scope : Error<"invalid use of '__super', "
925  "this keyword can only be used inside class or member function scope">;
926def err_super_in_lambda_unsupported : Error<
927  "use of '__super' inside a lambda is unsupported">;
928
929def warn_pragma_unused_undeclared_var : Warning<
930  "undeclared variable %0 used as an argument for '#pragma unused'">,
931  InGroup<IgnoredPragmas>;
932def warn_atl_uuid_deprecated : Warning<
933  "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
934  InGroup<DeprecatedDeclarations>;
935def warn_pragma_unused_expected_var_arg : Warning<
936  "only variables can be arguments to '#pragma unused'">,
937  InGroup<IgnoredPragmas>;
938def err_pragma_push_visibility_mismatch : Error<
939  "#pragma visibility push with no matching #pragma visibility pop">;
940def note_surrounding_namespace_ends_here : Note<
941  "surrounding namespace with visibility attribute ends here">;
942def err_pragma_pop_visibility_mismatch : Error<
943  "#pragma visibility pop with no matching #pragma visibility push">;
944def note_surrounding_namespace_starts_here : Note<
945  "surrounding namespace with visibility attribute starts here">;
946def err_pragma_loop_invalid_argument_type : Error<
947  "invalid argument of type %0; expected an integer type">;
948def err_pragma_loop_invalid_argument_value : Error<
949  "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
950def err_pragma_loop_compatibility : Error<
951  "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
952def err_pragma_loop_precedes_nonloop : Error<
953  "expected a for, while, or do-while loop to follow '%0'">;
954
955def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
956  "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
957  "those declarations">;
958def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
959  "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
960def err_pragma_attribute_invalid_matchers : Error<
961  "attribute %0 can't be applied to %1">;
962def err_pragma_attribute_stack_mismatch : Error<
963  "'#pragma clang attribute %select{%1.|}0pop' with no matching"
964  " '#pragma clang attribute %select{%1.|}0push'">;
965def warn_pragma_attribute_unused : Warning<
966  "unused attribute %0 in '#pragma clang attribute push' region">,
967  InGroup<PragmaClangAttribute>;
968def note_pragma_attribute_region_ends_here : Note<
969  "'#pragma clang attribute push' regions ends here">;
970def err_pragma_attribute_no_pop_eof : Error<"unterminated "
971  "'#pragma clang attribute push' at end of file">;
972def note_pragma_attribute_applied_decl_here : Note<
973  "when applied to this declaration">;
974def err_pragma_attr_attr_no_push : Error<
975  "'#pragma clang attribute' attribute with no matching "
976  "'#pragma clang attribute push'">;
977
978/// Objective-C parser diagnostics
979def err_duplicate_class_def : Error<
980  "duplicate interface definition for class %0">;
981def err_undef_superclass : Error<
982  "cannot find interface declaration for %0, superclass of %1">;
983def err_forward_superclass : Error<
984  "attempting to use the forward class %0 as superclass of %1">;
985def err_no_nsconstant_string_class : Error<
986  "cannot find interface declaration for %0">;
987def err_recursive_superclass : Error<
988  "trying to recursively use %0 as superclass of %1">;
989def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
990def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
991def warn_duplicate_protocol_def : Warning<
992  "duplicate protocol definition of %0 is ignored">,
993  InGroup<DiagGroup<"duplicate-protocol">>;
994def err_protocol_has_circular_dependency : Error<
995  "protocol has circular dependency">;
996def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
997def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
998def err_atprotocol_protocol : Error<
999  "@protocol is using a forward protocol declaration of %0">;
1000def warn_readonly_property : Warning<
1001  "attribute 'readonly' of property %0 restricts attribute "
1002  "'readwrite' of property inherited from %1">,
1003  InGroup<PropertyAttr>;
1004
1005def warn_property_attribute : Warning<
1006  "'%1' attribute on property %0 does not match the property inherited from %2">,
1007  InGroup<PropertyAttr>;
1008def warn_property_types_are_incompatible : Warning<
1009  "property type %0 is incompatible with type %1 inherited from %2">,
1010  InGroup<DiagGroup<"incompatible-property-type">>;
1011def warn_protocol_property_mismatch : Warning<
1012  "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
1013  "getter %1|with setter %1}0 was selected for synthesis">,
1014  InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
1015def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Text>;
1016def err_undef_interface : Error<"cannot find interface declaration for %0">;
1017def err_category_forward_interface : Error<
1018  "cannot define %select{category|class extension}0 for undefined class %1">;
1019def err_class_extension_after_impl : Error<
1020  "cannot declare class extension for %0 after class implementation">;
1021def note_implementation_declared : Note<
1022  "class implementation is declared here">;
1023def note_while_in_implementation : Note<
1024  "detected while default synthesizing properties in class implementation">;
1025def note_class_declared : Note<
1026  "class is declared here">;
1027def note_receiver_class_declared : Note<
1028  "receiver is instance of class declared here">;
1029def note_receiver_expr_here : Note<
1030  "receiver expression is here">;
1031def note_receiver_is_id : Note<
1032  "receiver is treated with 'id' type for purpose of method lookup">;
1033def note_suppressed_class_declare : Note<
1034  "class with specified objc_requires_property_definitions attribute is declared here">;
1035def err_objc_root_class_subclass : Error<
1036  "objc_root_class attribute may only be specified on a root class declaration">;
1037def err_restricted_superclass_mismatch : Error<
1038  "cannot subclass a class that was declared with the "
1039  "'objc_subclassing_restricted' attribute">;
1040def err_class_stub_subclassing_mismatch : Error<
1041  "'objc_class_stub' attribute cannot be specified on a class that does not "
1042  "have the 'objc_subclassing_restricted' attribute">;
1043def err_implementation_of_class_stub : Error<
1044  "cannot declare implementation of a class declared with the "
1045  "'objc_class_stub' attribute">;
1046def warn_objc_root_class_missing : Warning<
1047  "class %0 defined without specifying a base class">,
1048  InGroup<ObjCRootClass>;
1049def err_objc_runtime_visible_category : Error<
1050  "cannot implement a category for class %0 that is only visible via the "
1051  "Objective-C runtime">;
1052def err_objc_runtime_visible_subclass : Error<
1053  "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1054  "Objective-C runtime">;
1055def note_objc_needs_superclass : Note<
1056  "add a super class to fix this problem">;
1057def err_conflicting_super_class : Error<"conflicting super class name %0">;
1058def err_dup_implementation_class : Error<"reimplementation of class %0">;
1059def err_dup_implementation_category : Error<
1060  "reimplementation of category %1 for class %0">;
1061def err_conflicting_ivar_type : Error<
1062  "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1063def err_duplicate_ivar_declaration : Error<
1064  "instance variable is already declared">;
1065def warn_on_superclass_use : Warning<
1066  "class implementation may not have super class">;
1067def err_conflicting_ivar_bitwidth : Error<
1068  "instance variable %0 has conflicting bit-field width">;
1069def err_conflicting_ivar_name : Error<
1070  "conflicting instance variable names: %0 vs %1">;
1071def err_inconsistent_ivar_count : Error<
1072  "inconsistent number of instance variables specified">;
1073def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1074  InGroup<DiagGroup<"incomplete-implementation">>;
1075def warn_objc_boxing_invalid_utf8_string : Warning<
1076  "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1077  InGroup<ObjCBoxing>;
1078
1079def err_objc_non_runtime_protocol_in_protocol_expr : Error<
1080  "cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression">;
1081def err_objc_direct_on_protocol : Error<
1082  "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1083  "declared in an Objective-C protocol">;
1084def err_objc_direct_duplicate_decl : Error<
1085  "%select{|direct }0%select{method|property}1 declaration conflicts "
1086  "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1087def err_objc_direct_impl_decl_mismatch : Error<
1088  "direct method was declared in %select{the primary interface|an extension|a category}0 "
1089  "but is implemented in %select{the primary interface|a category|a different category}1">;
1090def err_objc_direct_missing_on_decl : Error<
1091  "direct method implementation was previously declared not direct">;
1092def err_objc_direct_on_override : Error<
1093  "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1094def err_objc_override_direct_method : Error<
1095  "cannot override a method that is declared direct by a superclass">;
1096def warn_objc_direct_ignored : Warning<
1097  "%0 attribute isn't implemented by this Objective-C runtime">,
1098  InGroup<IgnoredAttributes>;
1099def warn_objc_direct_property_ignored : Warning<
1100  "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1101  InGroup<IgnoredAttributes>;
1102def err_objc_direct_dynamic_property : Error<
1103  "direct property cannot be @dynamic">;
1104def err_objc_direct_protocol_conformance : Error<
1105  "%select{category %1|class extension}0 cannot conform to protocol %2 because "
1106  "of direct members declared in interface %3">;
1107def note_direct_member_here : Note<"direct member declared here">;
1108
1109def warn_conflicting_overriding_ret_types : Warning<
1110  "conflicting return type in "
1111  "declaration of %0%diff{: $ vs $|}1,2">,
1112  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1113
1114def warn_conflicting_ret_types : Warning<
1115  "conflicting return type in "
1116  "implementation of %0%diff{: $ vs $|}1,2">,
1117  InGroup<MismatchedReturnTypes>;
1118
1119def warn_conflicting_overriding_ret_type_modifiers : Warning<
1120  "conflicting distributed object modifiers on return type "
1121  "in declaration of %0">,
1122  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1123
1124def warn_conflicting_ret_type_modifiers : Warning<
1125  "conflicting distributed object modifiers on return type "
1126  "in implementation of %0">,
1127  InGroup<DistributedObjectModifiers>;
1128
1129def warn_non_covariant_overriding_ret_types : Warning<
1130  "conflicting return type in "
1131  "declaration of %0: %1 vs %2">,
1132  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1133
1134def warn_non_covariant_ret_types : Warning<
1135  "conflicting return type in "
1136  "implementation of %0: %1 vs %2">,
1137  InGroup<MethodSignatures>, DefaultIgnore;
1138
1139def warn_conflicting_overriding_param_types : Warning<
1140  "conflicting parameter types in "
1141  "declaration of %0%diff{: $ vs $|}1,2">,
1142  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1143
1144def warn_conflicting_param_types : Warning<
1145  "conflicting parameter types in "
1146  "implementation of %0%diff{: $ vs $|}1,2">,
1147  InGroup<MismatchedParameterTypes>;
1148
1149def warn_conflicting_param_modifiers : Warning<
1150  "conflicting distributed object modifiers on parameter type "
1151  "in implementation of %0">,
1152  InGroup<DistributedObjectModifiers>;
1153
1154def warn_conflicting_overriding_param_modifiers : Warning<
1155  "conflicting distributed object modifiers on parameter type "
1156  "in declaration of %0">,
1157  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1158
1159def warn_non_contravariant_overriding_param_types : Warning<
1160  "conflicting parameter types in "
1161  "declaration of %0: %1 vs %2">,
1162  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1163
1164def warn_non_contravariant_param_types : Warning<
1165  "conflicting parameter types in "
1166  "implementation of %0: %1 vs %2">,
1167  InGroup<MethodSignatures>, DefaultIgnore;
1168
1169def warn_conflicting_overriding_variadic :Warning<
1170  "conflicting variadic declaration of method and its "
1171  "implementation">,
1172  InGroup<OverridingMethodMismatch>, DefaultIgnore;
1173
1174def warn_conflicting_variadic :Warning<
1175  "conflicting variadic declaration of method and its "
1176  "implementation">;
1177
1178def warn_category_method_impl_match:Warning<
1179  "category is implementing a method which will also be implemented"
1180  " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1181
1182def warn_implements_nscopying : Warning<
1183"default assign attribute on property %0 which implements "
1184"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1185
1186def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1187  InGroup<ObjCMultipleMethodNames>;
1188def warn_strict_multiple_method_decl : Warning<
1189  "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1190def warn_accessor_property_type_mismatch : Warning<
1191  "type of property %0 does not match type of accessor %1">;
1192def note_conv_function_declared_at : Note<"type conversion function declared here">;
1193def note_method_declared_at : Note<"method %0 declared here">;
1194def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1195def note_property_attribute : Note<"property %0 is declared "
1196  "%select{deprecated|unavailable|partial}1 here">;
1197def err_setter_type_void : Error<"type of setter must be void">;
1198def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1199def warn_duplicate_method_decl :
1200  Warning<"multiple declarations of method %0 found and ignored">,
1201  InGroup<MethodDuplicate>, DefaultIgnore;
1202def warn_objc_cdirective_format_string :
1203  Warning<"using %0 directive in %select{NSString|CFString}1 "
1204          "which is being passed as a formatting argument to the formatting "
1205          "%select{method|CFfunction}2">,
1206  InGroup<ObjCCStringFormat>, DefaultIgnore;
1207def err_objc_var_decl_inclass :
1208    Error<"cannot declare variable inside @interface or @protocol">;
1209def err_missing_method_context : Error<
1210  "missing context for method declaration">;
1211def err_objc_property_attr_mutually_exclusive : Error<
1212  "property attributes '%0' and '%1' are mutually exclusive">;
1213def err_objc_property_requires_object : Error<
1214  "property with '%0' attribute must be of object type">;
1215def warn_objc_property_assign_on_object : Warning<
1216  "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1217  InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1218def warn_objc_property_no_assignment_attribute : Warning<
1219  "no 'assign', 'retain', or 'copy' attribute is specified - "
1220  "'assign' is assumed">,
1221  InGroup<ObjCPropertyNoAttribute>;
1222def warn_objc_isa_use : Warning<
1223  "direct access to Objective-C's isa is deprecated in favor of "
1224  "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1225def warn_objc_isa_assign : Warning<
1226  "assignment to Objective-C's isa is deprecated in favor of "
1227  "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1228def warn_objc_pointer_masking : Warning<
1229  "bitmasking for introspection of Objective-C object pointers is strongly "
1230  "discouraged">,
1231  InGroup<ObjCPointerIntrospect>;
1232def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
1233  InGroup<ObjCPointerIntrospectPerformSelector>;
1234def warn_objc_property_default_assign_on_object : Warning<
1235  "default property attribute 'assign' not appropriate for object">,
1236  InGroup<ObjCPropertyNoAttribute>;
1237def warn_property_attr_mismatch : Warning<
1238  "property attribute in class extension does not match the primary class">,
1239  InGroup<PropertyAttr>;
1240def warn_property_implicitly_mismatched : Warning <
1241  "primary property declaration is implicitly strong while redeclaration "
1242  "in class extension is weak">,
1243  InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1244def warn_objc_property_copy_missing_on_block : Warning<
1245    "'copy' attribute must be specified for the block property "
1246    "when -fobjc-gc-only is specified">;
1247def warn_objc_property_retain_of_block : Warning<
1248    "retain'ed block property does not copy the block "
1249    "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1250def warn_objc_readonly_property_has_setter : Warning<
1251    "setter cannot be specified for a readonly property">,
1252    InGroup<ObjCReadonlyPropertyHasSetter>;
1253def warn_atomic_property_rule : Warning<
1254  "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1255  "with a user defined %select{getter|setter}2">,
1256  InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1257def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1258  "synthesized, or both be user defined,or the property must be nonatomic">;
1259def err_atomic_property_nontrivial_assign_op : Error<
1260  "atomic property of reference type %0 cannot have non-trivial assignment"
1261  " operator">;
1262def warn_cocoa_naming_owned_rule : Warning<
1263  "property follows Cocoa naming"
1264  " convention for returning 'owned' objects">,
1265  InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1266def err_cocoa_naming_owned_rule : Error<
1267  "property follows Cocoa naming"
1268  " convention for returning 'owned' objects">;
1269def note_cocoa_naming_declare_family : Note<
1270  "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1271  "object">;
1272def warn_auto_synthesizing_protocol_property :Warning<
1273  "auto property synthesis will not synthesize property %0"
1274  " declared in protocol %1">,
1275  InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1276def note_add_synthesize_directive : Note<
1277  "add a '@synthesize' directive">;
1278def warn_no_autosynthesis_shared_ivar_property : Warning <
1279  "auto property synthesis will not synthesize property "
1280  "%0 because it cannot share an ivar with another synthesized property">,
1281  InGroup<ObjCNoPropertyAutoSynthesis>;
1282def warn_no_autosynthesis_property : Warning<
1283  "auto property synthesis will not synthesize property "
1284  "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1285  "via another property">,
1286  InGroup<ObjCNoPropertyAutoSynthesis>;
1287def warn_autosynthesis_property_in_superclass : Warning<
1288  "auto property synthesis will not synthesize property "
1289  "%0; it will be implemented by its superclass, use @dynamic to "
1290  "acknowledge intention">,
1291  InGroup<ObjCNoPropertyAutoSynthesis>;
1292def warn_autosynthesis_property_ivar_match :Warning<
1293  "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1294  "%2, not existing instance variable %3">,
1295  InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1296def warn_missing_explicit_synthesis : Warning <
1297  "auto property synthesis is synthesizing property not explicitly synthesized">,
1298  InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1299def warn_property_getter_owning_mismatch : Warning<
1300  "property declared as returning non-retained objects"
1301  "; getter returning retained objects">;
1302def warn_property_redecl_getter_mismatch : Warning<
1303  "getter name mismatch between property redeclaration (%1) and its original "
1304  "declaration (%0)">, InGroup<PropertyAttr>;
1305def err_property_setter_ambiguous_use : Error<
1306  "synthesized properties %0 and %1 both claim setter %2 -"
1307  " use of this setter will cause unexpected behavior">;
1308def warn_default_atomic_custom_getter_setter : Warning<
1309  "atomic by default property %0 has a user defined %select{getter|setter}1 "
1310  "(property should be marked 'atomic' if this is intended)">,
1311  InGroup<CustomAtomic>, DefaultIgnore;
1312def err_use_continuation_class : Error<
1313  "illegal redeclaration of property in class extension %0"
1314  " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1315def err_type_mismatch_continuation_class : Error<
1316  "type of property %0 in class extension does not match "
1317  "property type in primary class">;
1318def err_use_continuation_class_redeclaration_readwrite : Error<
1319  "illegal redeclaration of 'readwrite' property in class extension %0"
1320  " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1321  "'readonly' public property?)">;
1322def err_continuation_class : Error<"class extension has no primary class">;
1323def err_property_type : Error<"property cannot have array or function type %0">;
1324def err_missing_property_context : Error<
1325  "missing context for property implementation declaration">;
1326def err_bad_property_decl : Error<
1327  "property implementation must have its declaration in interface %0 or one of "
1328  "its extensions">;
1329def err_category_property : Error<
1330  "property declared in category %0 cannot be implemented in "
1331  "class implementation">;
1332def note_property_declare : Note<
1333  "property declared here">;
1334def note_protocol_property_declare : Note<
1335  "it could also be property "
1336  "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1337  "%1|with setter %1}0 declared here">;
1338def note_property_synthesize : Note<
1339  "property synthesized here">;
1340def err_synthesize_category_decl : Error<
1341  "@synthesize not allowed in a category's implementation">;
1342def err_synthesize_on_class_property : Error<
1343  "@synthesize not allowed on a class property %0">;
1344def err_missing_property_interface : Error<
1345  "property implementation in a category with no category declaration">;
1346def err_bad_category_property_decl : Error<
1347  "property implementation must have its declaration in the category %0">;
1348def err_bad_property_context : Error<
1349  "property implementation must be in a class or category implementation">;
1350def err_missing_property_ivar_decl : Error<
1351  "synthesized property %0 must either be named the same as a compatible"
1352  " instance variable or must explicitly name an instance variable">;
1353def err_arc_perform_selector_retains : Error<
1354  "performSelector names a selector which retains the object">;
1355def warn_arc_perform_selector_leaks : Warning<
1356  "performSelector may cause a leak because its selector is unknown">,
1357  InGroup<DiagGroup<"arc-performSelector-leaks">>;
1358def warn_dealloc_in_category : Warning<
1359"-dealloc is being overridden in a category">,
1360InGroup<DeallocInCategory>;
1361def err_gc_weak_property_strong_type : Error<
1362  "weak attribute declared on a __strong type property in GC mode">;
1363def warn_arc_repeated_use_of_weak : Warning <
1364  "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1365  "accessed multiple times in this %select{function|method|block|lambda}2 "
1366  "but may be unpredictably set to nil; assign to a strong variable to keep "
1367  "the object alive">,
1368  InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1369def warn_implicitly_retains_self : Warning <
1370  "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1371  "this is intended behavior">,
1372  InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1373def warn_arc_possible_repeated_use_of_weak : Warning <
1374  "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1375  "be accessed multiple times in this %select{function|method|block|lambda}2 "
1376  "and may be unpredictably set to nil; assign to a strong variable to keep "
1377  "the object alive">,
1378  InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1379def note_arc_weak_also_accessed_here : Note<
1380  "also accessed here">;
1381def err_incomplete_synthesized_property : Error<
1382  "cannot synthesize property %0 with incomplete type %1">;
1383
1384def err_property_ivar_type : Error<
1385  "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1386def err_property_accessor_type : Error<
1387  "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1388def err_ivar_in_superclass_use : Error<
1389  "property %0 attempting to use instance variable %1 declared in super class %2">;
1390def err_weak_property : Error<
1391  "existing instance variable %1 for __weak property %0 must be __weak">;
1392def err_strong_property : Error<
1393  "existing instance variable %1 for strong property %0 may not be __weak">;
1394def err_dynamic_property_ivar_decl : Error<
1395  "dynamic property cannot have instance variable specification">;
1396def err_duplicate_ivar_use : Error<
1397  "synthesized properties %0 and %1 both claim instance variable %2">;
1398def err_property_implemented : Error<"property %0 is already implemented">;
1399def warn_objc_missing_super_call : Warning<
1400  "method possibly missing a [super %0] call">,
1401  InGroup<ObjCMissingSuperCalls>;
1402def err_dealloc_bad_result_type : Error<
1403  "dealloc return type must be correctly specified as 'void' under ARC, "
1404  "instead of %0">;
1405def warn_undeclared_selector : Warning<
1406  "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1407def warn_undeclared_selector_with_typo : Warning<
1408  "undeclared selector %0; did you mean %1?">,
1409  InGroup<UndeclaredSelector>, DefaultIgnore;
1410def warn_implicit_atomic_property : Warning<
1411  "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1412def note_auto_readonly_iboutlet_fixup_suggest : Note<
1413  "property should be changed to be readwrite">;
1414def warn_auto_readonly_iboutlet_property : Warning<
1415  "readonly IBOutlet property %0 when auto-synthesized may "
1416  "not work correctly with 'nib' loader">,
1417  InGroup<DiagGroup<"readonly-iboutlet-property">>;
1418def warn_auto_implicit_atomic_property : Warning<
1419  "property is assumed atomic when auto-synthesizing the property">,
1420  InGroup<ImplicitAtomic>, DefaultIgnore;
1421def warn_unimplemented_selector:  Warning<
1422  "no method with selector %0 is implemented in this translation unit">,
1423  InGroup<Selector>, DefaultIgnore;
1424def warn_unimplemented_protocol_method : Warning<
1425  "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1426def warn_multiple_selectors: Warning<
1427  "several methods with selector %0 of mismatched types are found "
1428  "for the @selector expression">,
1429  InGroup<SelectorTypeMismatch>, DefaultIgnore;
1430def err_direct_selector_expression : Error<
1431  "@selector expression formed with direct selector %0">;
1432def warn_potentially_direct_selector_expression : Warning<
1433  "@selector expression formed with potentially direct selector %0">,
1434  InGroup<ObjCPotentiallyDirectSelector>;
1435def warn_strict_potentially_direct_selector_expression : Warning<
1436  warn_potentially_direct_selector_expression.Text>,
1437  InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1438
1439def err_objc_kindof_nonobject : Error<
1440  "'__kindof' specifier cannot be applied to non-object type %0">;
1441def err_objc_kindof_wrong_position : Error<
1442  "'__kindof' type specifier must precede the declarator">;
1443
1444def err_objc_method_unsupported_param_ret_type : Error<
1445  "%0 %select{parameter|return}1 type is unsupported; "
1446  "support for vector types for this target is introduced in %2">;
1447
1448def warn_messaging_unqualified_id : Warning<
1449  "messaging unqualified id">, DefaultIgnore,
1450  InGroup<DiagGroup<"objc-messaging-id">>;
1451def err_messaging_unqualified_id_with_direct_method : Error<
1452  "messaging unqualified id with a method that is possibly direct">;
1453def err_messaging_super_with_direct_method : Error<
1454  "messaging super with a direct method">;
1455def err_messaging_class_with_direct_method : Error<
1456  "messaging a Class with a method that is possibly direct">;
1457
1458// C++ declarations
1459def err_static_assert_expression_is_not_constant : Error<
1460  "static_assert expression is not an integral constant expression">;
1461def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
1462def err_static_assert_requirement_failed : Error<
1463  "static_assert failed due to requirement '%0'%select{ %2|}1">;
1464
1465def ext_inline_variable : ExtWarn<
1466  "inline variables are a C++17 extension">, InGroup<CXX17>;
1467def warn_cxx14_compat_inline_variable : Warning<
1468  "inline variables are incompatible with C++ standards before C++17">,
1469  DefaultIgnore, InGroup<CXXPre17Compat>;
1470
1471def warn_inline_namespace_reopened_noninline : Warning<
1472  "inline namespace reopened as a non-inline namespace">,
1473  InGroup<InlineNamespaceReopenedNoninline>;
1474def err_inline_namespace_mismatch : Error<
1475  "non-inline namespace cannot be reopened as inline">;
1476
1477def err_unexpected_friend : Error<
1478  "friends can only be classes or functions">;
1479def ext_enum_friend : ExtWarn<
1480  "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1481def warn_cxx98_compat_enum_friend : Warning<
1482  "befriending enumeration type %0 is incompatible with C++98">,
1483  InGroup<CXX98Compat>, DefaultIgnore;
1484def ext_nonclass_type_friend : ExtWarn<
1485  "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1486def warn_cxx98_compat_nonclass_type_friend : Warning<
1487  "non-class friend type %0 is incompatible with C++98">,
1488  InGroup<CXX98Compat>, DefaultIgnore;
1489def err_friend_is_member : Error<
1490  "friends cannot be members of the declaring class">;
1491def warn_cxx98_compat_friend_is_member : Warning<
1492  "friend declaration naming a member of the declaring class is incompatible "
1493  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1494def ext_unelaborated_friend_type : ExtWarn<
1495  "unelaborated friend declaration is a C++11 extension; specify "
1496  "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1497  InGroup<CXX11>;
1498def warn_cxx98_compat_unelaborated_friend_type : Warning<
1499  "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1500  "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1501def err_qualified_friend_no_match : Error<
1502  "friend declaration of %0 does not match any declaration in %1">;
1503def err_introducing_special_friend : Error<
1504  "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1505  " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1506  "as a friend">;
1507def err_tagless_friend_type_template : Error<
1508  "friend type templates must use an elaborated type">;
1509def err_no_matching_local_friend : Error<
1510  "no matching function found in local scope">;
1511def err_no_matching_local_friend_suggest : Error<
1512  "no matching function %0 found in local scope; did you mean %3?">;
1513def err_partial_specialization_friend : Error<
1514  "partial specialization cannot be declared as a friend">;
1515def err_qualified_friend_def : Error<
1516  "friend function definition cannot be qualified with '%0'">;
1517def err_friend_def_in_local_class : Error<
1518  "friend function cannot be defined in a local class">;
1519def err_friend_not_first_in_declaration : Error<
1520  "'friend' must appear first in a non-function declaration">;
1521def err_using_decl_friend : Error<
1522  "cannot befriend target of using declaration">;
1523def warn_template_qualified_friend_unsupported : Warning<
1524  "dependent nested name specifier '%0' for friend class declaration is "
1525  "not supported; turning off access control for %1">,
1526  InGroup<UnsupportedFriend>;
1527def warn_template_qualified_friend_ignored : Warning<
1528  "dependent nested name specifier '%0' for friend template declaration is "
1529  "not supported; ignoring this friend declaration">,
1530  InGroup<UnsupportedFriend>;
1531def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1532  "unqualified friend declaration referring to type outside of the nearest "
1533  "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1534  InGroup<MicrosoftUnqualifiedFriend>;
1535def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1536
1537def err_invalid_base_in_interface : Error<
1538  "interface type cannot inherit from "
1539  "%select{struct|non-public interface|class}0 %1">;
1540
1541def err_abstract_type_in_decl : Error<
1542  "%select{return|parameter|variable|field|instance variable|"
1543  "synthesized instance variable}0 type %1 is an abstract class">;
1544def err_allocation_of_abstract_type : Error<
1545  "allocating an object of abstract class type %0">;
1546def err_throw_abstract_type : Error<
1547  "cannot throw an object of abstract type %0">;
1548def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1549def err_capture_of_abstract_type : Error<
1550  "by-copy capture of value of abstract type %0">;
1551def err_capture_of_incomplete_or_sizeless_type : Error<
1552  "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1553def err_capture_default_non_local : Error<
1554  "non-local lambda expression cannot have a capture-default">;
1555
1556def err_multiple_final_overriders : Error<
1557  "virtual function %q0 has more than one final overrider in %1">;
1558def note_final_overrider : Note<"final overrider of %q0 in %1">;
1559
1560def err_type_defined_in_type_specifier : Error<
1561  "%0 cannot be defined in a type specifier">;
1562def err_type_defined_in_result_type : Error<
1563  "%0 cannot be defined in the result type of a function">;
1564def err_type_defined_in_param_type : Error<
1565  "%0 cannot be defined in a parameter type">;
1566def err_type_defined_in_alias_template : Error<
1567  "%0 cannot be defined in a type alias template">;
1568def err_type_defined_in_condition : Error<
1569  "%0 cannot be defined in a condition">;
1570def err_type_defined_in_enum : Error<
1571  "%0 cannot be defined in an enumeration">;
1572
1573def note_pure_virtual_function : Note<
1574  "unimplemented pure virtual method %0 in %1">;
1575
1576def note_pure_qualified_call_kext : Note<
1577  "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1578
1579def err_deleted_decl_not_first : Error<
1580  "deleted definition must be first declaration">;
1581
1582def err_deleted_override : Error<
1583  "deleted function %0 cannot override a non-deleted function">;
1584def err_non_deleted_override : Error<
1585  "non-deleted function %0 cannot override a deleted function">;
1586def err_consteval_override : Error<
1587  "consteval function %0 cannot override a non-consteval function">;
1588def err_non_consteval_override : Error<
1589  "non-consteval function %0 cannot override a consteval function">;
1590
1591def warn_weak_vtable : Warning<
1592  "%0 has no out-of-line virtual method definitions; its vtable will be "
1593  "emitted in every translation unit">,
1594  InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1595def warn_weak_template_vtable : Warning<
1596  "explicit template instantiation %0 will emit a vtable in every "
1597  "translation unit">,
1598  InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1599
1600def ext_using_undefined_std : ExtWarn<
1601  "using directive refers to implicitly-defined namespace 'std'">;
1602
1603// C++ exception specifications
1604def err_exception_spec_in_typedef : Error<
1605  "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1606def err_distant_exception_spec : Error<
1607  "exception specifications are not allowed beyond a single level "
1608  "of indirection">;
1609def err_incomplete_in_exception_spec : Error<
1610  "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1611  "in exception specification">;
1612def err_sizeless_in_exception_spec : Error<
1613  "%select{|reference to }0sizeless type %1 is not allowed "
1614  "in exception specification">;
1615def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Text>,
1616  InGroup<MicrosoftExceptionSpec>;
1617def err_rref_in_exception_spec : Error<
1618  "rvalue reference type %0 is not allowed in exception specification">;
1619def err_mismatched_exception_spec : Error<
1620  "exception specification in declaration does not match previous declaration">;
1621def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Text>,
1622  InGroup<MicrosoftExceptionSpec>;
1623def err_override_exception_spec : Error<
1624  "exception specification of overriding function is more lax than "
1625  "base version">;
1626def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Text>,
1627  InGroup<MicrosoftExceptionSpec>;
1628def err_incompatible_exception_specs : Error<
1629  "target exception specification is not superset of source">;
1630def warn_incompatible_exception_specs : Warning<
1631  err_incompatible_exception_specs.Text>, InGroup<IncompatibleExceptionSpec>;
1632def err_deep_exception_specs_differ : Error<
1633  "exception specifications of %select{return|argument}0 types differ">;
1634def warn_deep_exception_specs_differ : Warning<
1635  err_deep_exception_specs_differ.Text>, InGroup<IncompatibleExceptionSpec>;
1636def err_missing_exception_specification : Error<
1637  "%0 is missing exception specification '%1'">;
1638def ext_missing_exception_specification : ExtWarn<
1639  err_missing_exception_specification.Text>,
1640  InGroup<DiagGroup<"missing-exception-spec">>;
1641def ext_ms_missing_exception_specification : ExtWarn<
1642  err_missing_exception_specification.Text>,
1643  InGroup<MicrosoftExceptionSpec>;
1644def err_noexcept_needs_constant_expression : Error<
1645  "argument to noexcept specifier must be a constant expression">;
1646def err_exception_spec_not_parsed : Error<
1647  "exception specification is not available until end of class definition">;
1648def err_exception_spec_cycle : Error<
1649  "exception specification of %0 uses itself">;
1650def err_exception_spec_incomplete_type : Error<
1651  "exception specification needed for member of incomplete class %0">;
1652def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1653  "dynamic exception specifications with types are currently ignored in wasm">,
1654  InGroup<WebAssemblyExceptionSpec>;
1655
1656// C++ access checking
1657def err_class_redeclared_with_different_access : Error<
1658  "%0 redeclared with '%1' access">;
1659def err_access : Error<
1660  "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1661def ext_ms_using_declaration_inaccessible : ExtWarn<
1662  "using declaration referring to inaccessible member '%0' (which refers "
1663  "to accessible member '%1') is a Microsoft compatibility extension">,
1664    AccessControl, InGroup<MicrosoftUsingDecl>;
1665def err_access_ctor : Error<
1666  "calling a %select{private|protected}0 constructor of class %2">,
1667  AccessControl;
1668def ext_rvalue_to_reference_access_ctor : Extension<
1669  "C++98 requires an accessible copy constructor for class %2 when binding "
1670  "a reference to a temporary; was %select{private|protected}0">,
1671  AccessControl, InGroup<BindToTemporaryCopy>;
1672def err_access_base_ctor : Error<
1673  // The ERRORs represent other special members that aren't constructors, in
1674  // hopes that someone will bother noticing and reporting if they appear
1675  "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1676  "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1677  "|*ERROR*|}2constructor">, AccessControl;
1678def err_access_field_ctor : Error<
1679  // The ERRORs represent other special members that aren't constructors, in
1680  // hopes that someone will bother noticing and reporting if they appear
1681  "field of type %0 has %select{private|protected}2 "
1682  "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1683  AccessControl;
1684def err_access_friend_function : Error<
1685  "friend function %1 is a %select{private|protected}0 member of %3">,
1686  AccessControl;
1687
1688def err_access_dtor : Error<
1689  "calling a %select{private|protected}1 destructor of class %0">,
1690  AccessControl;
1691def err_access_dtor_base :
1692    Error<"base class %0 has %select{private|protected}1 destructor">,
1693    AccessControl;
1694def err_access_dtor_vbase :
1695    Error<"inherited virtual base class %1 has "
1696    "%select{private|protected}2 destructor">,
1697    AccessControl;
1698def err_access_dtor_temp :
1699    Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1700    AccessControl;
1701def err_access_dtor_exception :
1702    Error<"exception object of type %0 has %select{private|protected}1 "
1703          "destructor">, AccessControl;
1704def err_access_dtor_field :
1705    Error<"field of type %1 has %select{private|protected}2 destructor">,
1706    AccessControl;
1707def err_access_dtor_var :
1708    Error<"variable of type %1 has %select{private|protected}2 destructor">,
1709    AccessControl;
1710def err_access_dtor_ivar :
1711    Error<"instance variable of type %0 has %select{private|protected}1 "
1712          "destructor">,
1713    AccessControl;
1714def note_previous_access_declaration : Note<
1715  "previously declared '%1' here">;
1716def note_access_natural : Note<
1717  "%select{|implicitly }1declared %select{private|protected}0 here">;
1718def note_access_constrained_by_path : Note<
1719  "constrained by %select{|implicitly }1%select{private|protected}0"
1720  " inheritance here">;
1721def note_access_protected_restricted_noobject : Note<
1722  "must name member using the type of the current context %0">;
1723def note_access_protected_restricted_ctordtor : Note<
1724  "protected %select{constructor|destructor}0 can only be used to "
1725  "%select{construct|destroy}0 a base class subobject">;
1726def note_access_protected_restricted_object : Note<
1727  "can only access this member on an object of type %0">;
1728def warn_cxx98_compat_sfinae_access_control : Warning<
1729  "substitution failure due to access control is incompatible with C++98">,
1730  InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1731
1732// C++ name lookup
1733def err_incomplete_nested_name_spec : Error<
1734  "incomplete type %0 named in nested name specifier">;
1735def err_dependent_nested_name_spec : Error<
1736  "nested name specifier for a declaration cannot depend on a template "
1737  "parameter">;
1738def err_nested_name_member_ref_lookup_ambiguous : Error<
1739  "lookup of %0 in member access expression is ambiguous">;
1740def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1741  "lookup of %0 in member access expression is ambiguous; using member of %1">,
1742  InGroup<AmbigMemberTemplate>;
1743def note_ambig_member_ref_object_type : Note<
1744  "lookup in the object type %0 refers here">;
1745def note_ambig_member_ref_scope : Note<
1746  "lookup from the current scope refers here">;
1747def err_qualified_member_nonclass : Error<
1748  "qualified member access refers to a member in %0">;
1749def err_incomplete_member_access : Error<
1750  "member access into incomplete type %0">;
1751def err_incomplete_type : Error<
1752  "incomplete type %0 where a complete type is required">;
1753def warn_cxx98_compat_enum_nested_name_spec : Warning<
1754  "enumeration type in nested name specifier is incompatible with C++98">,
1755  InGroup<CXX98Compat>, DefaultIgnore;
1756def err_nested_name_spec_is_not_class : Error<
1757  "%0 cannot appear before '::' because it is not a class"
1758  "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1759def ext_nested_name_spec_is_enum : ExtWarn<
1760  "use of enumeration in a nested name specifier is a C++11 extension">,
1761  InGroup<CXX11>;
1762def err_out_of_line_qualified_id_type_names_constructor : Error<
1763  "qualified reference to %0 is a constructor name rather than a "
1764  "%select{template name|type}1 in this context">;
1765def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1766  "ISO C++ specifies that "
1767  "qualified reference to %0 is a constructor name rather than a "
1768  "%select{template name|type}1 in this context, despite preceding "
1769  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1770  InGroup<DiagGroup<"injected-class-name">>;
1771
1772// C++ class members
1773def err_storageclass_invalid_for_member : Error<
1774  "storage class specified for a member declaration">;
1775def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1776def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1777def ext_mutable_reference : ExtWarn<
1778  "'mutable' on a reference type is a Microsoft extension">,
1779  InGroup<MicrosoftMutableReference>;
1780def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1781def err_mutable_nonmember : Error<
1782  "'mutable' can only be applied to member variables">;
1783def err_virtual_in_union : Error<
1784  "unions cannot have virtual functions">;
1785def err_virtual_non_function : Error<
1786  "'virtual' can only appear on non-static member functions">;
1787def err_virtual_out_of_class : Error<
1788  "'virtual' can only be specified inside the class definition">;
1789def err_virtual_member_function_template : Error<
1790  "'virtual' cannot be specified on member function templates">;
1791def err_static_overrides_virtual : Error<
1792  "'static' member function %0 overrides a virtual function in a base class">;
1793def err_explicit_non_function : Error<
1794  "'explicit' can only appear on non-static member functions">;
1795def err_explicit_out_of_class : Error<
1796  "'explicit' can only be specified inside the class definition">;
1797def err_explicit_non_ctor_or_conv_function : Error<
1798  "'explicit' can only be applied to a constructor or conversion function">;
1799def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1800def err_static_out_of_line : Error<
1801  "'static' can only be specified inside the class definition">;
1802def ext_static_out_of_line : ExtWarn<
1803  err_static_out_of_line.Text>,
1804  InGroup<MicrosoftTemplate>;
1805def err_storage_class_for_static_member : Error<
1806  "static data member definition cannot specify a storage class">;
1807def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1808def err_not_integral_type_bitfield : Error<
1809  "bit-field %0 has non-integral type %1">;
1810def err_not_integral_type_anon_bitfield : Error<
1811  "anonymous bit-field has non-integral type %0">;
1812def err_anon_bitfield_qualifiers : Error<
1813  "anonymous bit-field cannot have qualifiers">;
1814def err_member_function_initialization : Error<
1815  "initializer on function does not look like a pure-specifier">;
1816def err_non_virtual_pure : Error<
1817  "%0 is not virtual and cannot be declared pure">;
1818def ext_pure_function_definition : ExtWarn<
1819  "function definition with pure-specifier is a Microsoft extension">,
1820  InGroup<MicrosoftPureDefinition>;
1821def err_qualified_member_of_unrelated : Error<
1822  "%q0 is not a member of class %1">;
1823
1824def err_member_function_call_bad_cvr : Error<
1825  "'this' argument to member function %0 has type %1, but function is not marked "
1826  "%select{const|restrict|const or restrict|volatile|const or volatile|"
1827  "volatile or restrict|const, volatile, or restrict}2">;
1828def err_member_function_call_bad_ref : Error<
1829  "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1830  "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1831def err_member_function_call_bad_type : Error<
1832  "cannot initialize object parameter of type %0 with an expression "
1833  "of type %1">;
1834
1835def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1836  "call to pure virtual member function %0 has undefined behavior; "
1837  "overrides of %0 in subclasses are not available in the "
1838  "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1839
1840def select_special_member_kind : TextSubstitution<
1841  "%select{default constructor|copy constructor|move constructor|"
1842  "copy assignment operator|move assignment operator|destructor}0">;
1843
1844def note_member_declared_at : Note<"member is declared here">;
1845def note_ivar_decl : Note<"instance variable is declared here">;
1846def note_bitfield_decl : Note<"bit-field is declared here">;
1847def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1848def note_member_synthesized_at : Note<
1849  "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
1850  "first required here">;
1851def note_comparison_synthesized_at : Note<
1852  "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
1853  "first required here">;
1854def err_missing_default_ctor : Error<
1855  "%select{constructor for %1 must explicitly initialize the|"
1856  "implicit default constructor for %1 must explicitly initialize the|"
1857  "cannot use constructor inherited from base class %4;}0 "
1858  "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1859  "does not have a default constructor">;
1860def note_due_to_dllexported_class : Note<
1861  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1862
1863def err_illegal_union_or_anon_struct_member : Error<
1864  "%select{anonymous struct|union}0 member %1 has a non-trivial "
1865  "%sub{select_special_member_kind}2">;
1866
1867def warn_frame_address : Warning<
1868  "calling '%0' with a nonzero argument is unsafe">,
1869  InGroup<FrameAddress>, DefaultIgnore;
1870
1871def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1872  "%select{anonymous struct|union}0 member %1 with a non-trivial "
1873  "%sub{select_special_member_kind}2 is incompatible with C++98">,
1874  InGroup<CXX98Compat>, DefaultIgnore;
1875
1876def note_nontrivial_virtual_dtor : Note<
1877  "destructor for %0 is not trivial because it is virtual">;
1878def note_nontrivial_has_virtual : Note<
1879  "because type %0 has a virtual %select{member function|base class}1">;
1880def note_nontrivial_no_def_ctor : Note<
1881  "because %select{base class of |field of |}0type %1 has no "
1882  "default constructor">;
1883def note_user_declared_ctor : Note<
1884  "implicit default constructor suppressed by user-declared constructor">;
1885def note_nontrivial_no_copy : Note<
1886  "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1887  "assignment operator|<<ERROR>>}2 can be used to "
1888  "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1889  "%select{base class|field|an object}0 of type %3">;
1890def note_nontrivial_user_provided : Note<
1891  "because %select{base class of |field of |}0type %1 has a user-provided "
1892  "%sub{select_special_member_kind}2">;
1893def note_nontrivial_default_member_init : Note<
1894  "because field %0 has an initializer">;
1895def note_nontrivial_param_type : Note<
1896  "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
1897def note_nontrivial_default_arg : Note<"because it has a default argument">;
1898def note_nontrivial_variadic : Note<"because it is a variadic function">;
1899def note_nontrivial_subobject : Note<
1900  "because the function selected to %select{construct|copy|move|copy|move|"
1901  "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
1902def note_nontrivial_objc_ownership : Note<
1903  "because type %0 has a member with %select{no|no|__strong|__weak|"
1904  "__autoreleasing}1 ownership">;
1905
1906/// Selector for a TagTypeKind value.
1907def select_tag_type_kind : TextSubstitution<
1908  "%select{struct|interface|union|class|enum}0">;
1909
1910def err_static_data_member_not_allowed_in_anon_struct : Error<
1911  "static data member %0 not allowed in anonymous "
1912  "%sub{select_tag_type_kind}1">;
1913def ext_static_data_member_in_union : ExtWarn<
1914  "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
1915def warn_cxx98_compat_static_data_member_in_union : Warning<
1916  "static data member %0 in union is incompatible with C++98">,
1917  InGroup<CXX98Compat>, DefaultIgnore;
1918def ext_union_member_of_reference_type : ExtWarn<
1919  "union member %0 has reference type %1, which is a Microsoft extension">,
1920  InGroup<MicrosoftUnionMemberReference>;
1921def err_union_member_of_reference_type : Error<
1922  "union member %0 has reference type %1">;
1923def ext_anonymous_struct_union_qualified : Extension<
1924  "anonymous %select{struct|union}0 cannot be '%1'">;
1925def err_different_return_type_for_overriding_virtual_function : Error<
1926  "virtual function %0 has a different return type "
1927  "%diff{($) than the function it overrides (which has return type $)|"
1928  "than the function it overrides}1,2">;
1929def note_overridden_virtual_function : Note<
1930  "overridden virtual function is here">;
1931def err_conflicting_overriding_cc_attributes : Error<
1932  "virtual function %0 has different calling convention attributes "
1933  "%diff{($) than the function it overrides (which has calling convention $)|"
1934  "than the function it overrides}1,2">;
1935def warn_overriding_method_missing_noescape : Warning<
1936  "parameter of overriding method should be annotated with "
1937  "__attribute__((noescape))">, InGroup<MissingNoEscape>;
1938def note_overridden_marked_noescape : Note<
1939  "parameter of overridden method is annotated with __attribute__((noescape))">;
1940def note_cat_conform_to_noescape_prot : Note<
1941  "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
1942
1943def err_covariant_return_inaccessible_base : Error<
1944  "invalid covariant return for virtual function: %1 is a "
1945  "%select{private|protected}2 base class of %0">, AccessControl;
1946def err_covariant_return_ambiguous_derived_to_base_conv : Error<
1947  "return type of virtual function %3 is not covariant with the return type of "
1948  "the function it overrides (ambiguous conversion from derived class "
1949  "%0 to base class %1:%2)">;
1950def err_covariant_return_not_derived : Error<
1951  "return type of virtual function %0 is not covariant with the return type of "
1952  "the function it overrides (%1 is not derived from %2)">;
1953def err_covariant_return_incomplete : Error<
1954  "return type of virtual function %0 is not covariant with the return type of "
1955  "the function it overrides (%1 is incomplete)">;
1956def err_covariant_return_type_different_qualifications : Error<
1957  "return type of virtual function %0 is not covariant with the return type of "
1958  "the function it overrides (%1 has different qualifiers than %2)">;
1959def err_covariant_return_type_class_type_more_qualified : Error<
1960  "return type of virtual function %0 is not covariant with the return type of "
1961  "the function it overrides (class type %1 is more qualified than class "
1962  "type %2">;
1963
1964// C++ implicit special member functions
1965def note_in_declaration_of_implicit_special_member : Note<
1966  "while declaring the implicit %sub{select_special_member_kind}1"
1967  " for %0">;
1968
1969// C++ constructors
1970def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
1971def err_invalid_qualified_constructor : Error<
1972  "'%0' qualifier is not allowed on a constructor">;
1973def err_ref_qualifier_constructor : Error<
1974  "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
1975
1976def err_constructor_return_type : Error<
1977  "constructor cannot have a return type">;
1978def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
1979def err_constructor_byvalue_arg : Error<
1980  "copy constructor must pass its first argument by reference">;
1981def warn_no_constructor_for_refconst : Warning<
1982  "%select{struct|interface|union|class|enum}0 %1 does not declare any "
1983  "constructor to initialize its non-modifiable members">;
1984def note_refconst_member_not_initialized : Note<
1985  "%select{const|reference}0 member %1 will never be initialized">;
1986def ext_ms_explicit_constructor_call : ExtWarn<
1987  "explicit constructor calls are a Microsoft extension">,
1988  InGroup<MicrosoftExplicitConstructorCall>;
1989
1990// C++ destructors
1991def err_destructor_not_member : Error<
1992  "destructor must be a non-static member function">;
1993def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
1994def err_invalid_qualified_destructor : Error<
1995  "'%0' qualifier is not allowed on a destructor">;
1996def err_ref_qualifier_destructor : Error<
1997  "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
1998def err_destructor_return_type : Error<"destructor cannot have a return type">;
1999def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
2000def err_destructor_with_params : Error<"destructor cannot have any parameters">;
2001def err_destructor_variadic : Error<"destructor cannot be variadic">;
2002def ext_destructor_typedef_name : ExtWarn<
2003  "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
2004  "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
2005def err_undeclared_destructor_name : Error<
2006  "undeclared identifier %0 in destructor name">;
2007def err_destructor_name : Error<
2008  "expected the class name after '~' to name the enclosing class">;
2009def err_destructor_name_nontype : Error<
2010  "identifier %0 after '~' in destructor name does not name a type">;
2011def err_destructor_expr_mismatch : Error<
2012  "identifier %0 in object destruction expression does not name the type "
2013  "%1 of the object being destroyed">;
2014def err_destructor_expr_nontype : Error<
2015  "identifier %0 in object destruction expression does not name a type">;
2016def err_destructor_expr_type_mismatch : Error<
2017  "destructor type %0 in object destruction expression does not match the "
2018  "type %1 of the object being destroyed">;
2019def note_destructor_type_here : Note<
2020  "type %0 found by destructor name lookup">;
2021def note_destructor_nontype_here : Note<
2022  "non-type declaration found by destructor name lookup">;
2023def ext_dtor_named_in_wrong_scope : Extension<
2024  "ISO C++ requires the name after '::~' to be found in the same scope as "
2025  "the name before '::~'">, InGroup<DtorName>;
2026def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
2027  "qualified destructor name only found in lexical scope; omit the qualifier "
2028  "to find this type name by unqualified lookup">, InGroup<DtorName>;
2029def ext_dtor_name_ambiguous : Extension<
2030  "ISO C++ considers this destructor name lookup to be ambiguous">,
2031  InGroup<DtorName>;
2032
2033def err_destroy_attr_on_non_static_var : Error<
2034  "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
2035  " variable with static or thread storage duration">;
2036
2037def err_destructor_template : Error<
2038  "destructor cannot be declared as a template">;
2039
2040// C++ initialization
2041def err_init_conversion_failed : Error<
2042  "cannot initialize %select{a variable|a parameter|template parameter|"
2043  "return object|statement expression result|an "
2044  "exception object|a member subobject|an array element|a new value|a value|a "
2045  "base class|a constructor delegation|a vector element|a block element|a "
2046  "block element|a complex element|a lambda capture|a compound literal "
2047  "initializer|a related result|a parameter of CF audited function}0 "
2048  "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2049  "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2050  "%select{|: different classes%diff{ ($ vs $)|}5,6"
2051  "|: different number of parameters (%5 vs %6)"
2052  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2053  "|: different return type%diff{ ($ vs $)|}5,6"
2054  "|: different qualifiers (%5 vs %6)"
2055  "|: different exception specifications}4">;
2056def note_forward_class_conversion : Note<"%0 is not defined, but forward "
2057  "declared here; conversion would be valid if it was derived from %1">;
2058
2059def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2060  "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2061def err_lvalue_reference_bind_to_initlist : Error<
2062  "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2063  "initializer list temporary">;
2064def err_lvalue_reference_bind_to_temporary : Error<
2065  "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2066  "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2067def err_lvalue_reference_bind_to_unrelated : Error<
2068  "%select{non-const|volatile}0 lvalue reference "
2069  "%diff{to type $ cannot bind to a value of unrelated type $|"
2070  "cannot bind to a value of unrelated type}1,2">;
2071def err_reference_bind_drops_quals : Error<
2072  "binding reference %diff{of type $ to value of type $|to value}0,1 "
2073  "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2074  "not permitted due to incompatible qualifiers}2">;
2075def err_reference_bind_failed : Error<
2076  "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2077  "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2078  "incompatible type}0,3">;
2079def err_reference_bind_temporary_addrspace : Error<
2080  "reference of type %0 cannot bind to a temporary object because of "
2081  "address space mismatch">;
2082def err_reference_bind_init_list : Error<
2083  "reference to type %0 cannot bind to an initializer list">;
2084def err_init_list_bad_dest_type : Error<
2085  "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2086  "list">;
2087def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2088  "aggregate initialization of type %0 with user-declared constructors "
2089  "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2090
2091def err_reference_bind_to_bitfield : Error<
2092  "%select{non-const|volatile}0 reference cannot bind to "
2093  "bit-field%select{| %1}2">;
2094def err_reference_bind_to_vector_element : Error<
2095  "%select{non-const|volatile}0 reference cannot bind to vector element">;
2096def err_reference_bind_to_matrix_element : Error<
2097  "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2098def err_reference_var_requires_init : Error<
2099  "declaration of reference variable %0 requires an initializer">;
2100def err_reference_without_init : Error<
2101  "reference to type %0 requires an initializer">;
2102def note_value_initialization_here : Note<
2103  "in value-initialization of type %0 here">;
2104def err_reference_has_multiple_inits : Error<
2105  "reference cannot be initialized with multiple values">;
2106def err_init_non_aggr_init_list : Error<
2107  "initialization of non-aggregate type %0 with an initializer list">;
2108def err_init_reference_member_uninitialized : Error<
2109  "reference member of type %0 uninitialized">;
2110def note_uninit_reference_member : Note<
2111  "uninitialized reference member is here">;
2112def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2113  InGroup<Uninitialized>;
2114def warn_base_class_is_uninit : Warning<
2115  "base class %0 is uninitialized when used here to access %q1">,
2116  InGroup<Uninitialized>;
2117def warn_reference_field_is_uninit : Warning<
2118  "reference %0 is not yet bound to a value when used here">,
2119  InGroup<Uninitialized>;
2120def note_uninit_in_this_constructor : Note<
2121  "during field initialization in %select{this|the implicit default}0 "
2122  "constructor">;
2123def warn_static_self_reference_in_init : Warning<
2124  "static variable %0 is suspiciously used within its own initialization">,
2125  InGroup<UninitializedStaticSelfInit>;
2126def warn_uninit_self_reference_in_init : Warning<
2127  "variable %0 is uninitialized when used within its own initialization">,
2128  InGroup<Uninitialized>;
2129def warn_uninit_self_reference_in_reference_init : Warning<
2130  "reference %0 is not yet bound to a value when used within its own"
2131  " initialization">,
2132  InGroup<Uninitialized>;
2133def warn_uninit_var : Warning<
2134  "variable %0 is uninitialized when %select{used here|captured by block}1">,
2135  InGroup<Uninitialized>, DefaultIgnore;
2136def warn_sometimes_uninit_var : Warning<
2137  "variable %0 is %select{used|captured}1 uninitialized whenever "
2138  "%select{'%3' condition is %select{true|false}4|"
2139  "'%3' loop %select{is entered|exits because its condition is false}4|"
2140  "'%3' loop %select{condition is true|exits because its condition is false}4|"
2141  "switch %3 is taken|"
2142  "its declaration is reached|"
2143  "%3 is called}2">,
2144  InGroup<UninitializedSometimes>, DefaultIgnore;
2145def warn_maybe_uninit_var : Warning<
2146  "variable %0 may be uninitialized when "
2147  "%select{used here|captured by block}1">,
2148  InGroup<UninitializedMaybe>, DefaultIgnore;
2149def note_var_declared_here : Note<"variable %0 is declared here">;
2150def note_uninit_var_use : Note<
2151  "%select{uninitialized use occurs|variable is captured by block}0 here">;
2152def warn_uninit_byref_blockvar_captured_by_block : Warning<
2153  "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2154  "block">, InGroup<Uninitialized>, DefaultIgnore;
2155def note_block_var_fixit_add_initialization : Note<
2156  "did you mean to use __block %0?">;
2157def note_in_omitted_aggregate_initializer : Note<
2158  "in implicit initialization of %select{"
2159  "array element %1 with omitted initializer|"
2160  "field %1 with omitted initializer|"
2161  "trailing array elements in runtime-sized array new}0">;
2162def note_in_reference_temporary_list_initializer : Note<
2163  "in initialization of temporary of type %0 created to "
2164  "list-initialize this reference">;
2165def note_var_fixit_add_initialization : Note<
2166  "initialize the variable %0 to silence this warning">;
2167def note_uninit_fixit_remove_cond : Note<
2168  "remove the %select{'%1' if its condition|condition if it}0 "
2169  "is always %select{false|true}2">;
2170def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2171def err_list_init_in_parens : Error<
2172  "cannot initialize %select{non-class|reference}0 type %1 with a "
2173  "parenthesized initializer list">;
2174
2175def warn_uninit_const_reference : Warning<
2176  "variable %0 is uninitialized when passed as a const reference argument "
2177  "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2178
2179def warn_unsequenced_mod_mod : Warning<
2180  "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2181def warn_unsequenced_mod_use : Warning<
2182  "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2183
2184def select_initialized_entity_kind : TextSubstitution<
2185  "%select{copying variable|copying parameter|initializing template parameter|"
2186  "returning object|initializing statement expression result|"
2187  "throwing object|copying member subobject|copying array element|"
2188  "allocating object|copying temporary|initializing base subobject|"
2189  "initializing vector element|capturing value}0">;
2190
2191def err_temp_copy_no_viable : Error<
2192  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2193def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2194  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2195  "C++98 requires a copy constructor when binding a reference to a temporary">,
2196  InGroup<BindToTemporaryCopy>;
2197def err_temp_copy_ambiguous : Error<
2198  "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2199  "of type %1">;
2200def err_temp_copy_deleted : Error<
2201  "%sub{select_initialized_entity_kind}0 of type %1 "
2202  "invokes deleted constructor">;
2203def err_temp_copy_incomplete : Error<
2204  "copying a temporary object of incomplete type %0">;
2205def warn_cxx98_compat_temp_copy : Warning<
2206  "%sub{select_initialized_entity_kind}1 "
2207  "of type %2 when binding a reference to a temporary would %select{invoke "
2208  "an inaccessible constructor|find no viable constructor|find ambiguous "
2209  "constructors|invoke a deleted constructor}0 in C++98">,
2210  InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2211def err_selected_explicit_constructor : Error<
2212  "chosen constructor is explicit in copy-initialization">;
2213def note_explicit_ctor_deduction_guide_here : Note<
2214  "explicit %select{constructor|deduction guide}0 declared here">;
2215
2216// C++11 decltype
2217def err_decltype_in_declarator : Error<
2218    "'decltype' cannot be used to name a declaration">;
2219
2220// C++11 auto
2221def warn_cxx98_compat_auto_type_specifier : Warning<
2222  "'auto' type specifier is incompatible with C++98">,
2223  InGroup<CXX98Compat>, DefaultIgnore;
2224def err_auto_variable_cannot_appear_in_own_initializer : Error<
2225  "variable %0 declared with deduced type %1 "
2226  "cannot appear in its own initializer">;
2227def err_binding_cannot_appear_in_own_initializer : Error<
2228  "binding %0 cannot appear in the initializer of its own "
2229  "decomposition declaration">;
2230def err_illegal_decl_array_of_auto : Error<
2231  "'%0' declared as array of %1">;
2232def err_new_array_of_auto : Error<
2233  "cannot allocate array of 'auto'">;
2234def err_auto_not_allowed : Error<
2235  "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2236  "use of "
2237  "%select{class template|function template|variable template|alias template|"
2238  "template template parameter|concept|template}2 %3 requires template "
2239  "arguments; argument deduction}0 not allowed "
2240  "%select{in function prototype"
2241  "|in non-static struct member|in struct member"
2242  "|in non-static union member|in union member"
2243  "|in non-static class member|in interface member"
2244  "|in exception declaration|in template parameter until C++17|in block literal"
2245  "|in template argument|in typedef|in type alias|in function return type"
2246  "|in conversion function type|here|in lambda parameter"
2247  "|in type allocated by 'new'|in K&R-style function parameter"
2248  "|in template parameter|in friend declaration|in function prototype that is "
2249  "not a function declaration|in requires expression parameter}1">;
2250def err_dependent_deduced_tst : Error<
2251  "typename specifier refers to "
2252  "%select{class template|function template|variable template|alias template|"
2253  "template template parameter|template}0 member in %1; "
2254  "argument deduction not allowed here">;
2255def err_deduced_tst : Error<
2256  "typename specifier refers to "
2257  "%select{class template|function template|variable template|alias template|"
2258  "template template parameter|template}0; argument deduction not allowed "
2259  "here">;
2260def err_auto_not_allowed_var_inst : Error<
2261  "'auto' variable template instantiation is not allowed">;
2262def err_auto_var_requires_init : Error<
2263  "declaration of variable %0 with deduced type %1 requires an initializer">;
2264def err_auto_new_requires_ctor_arg : Error<
2265  "new expression for type %0 requires a constructor argument">;
2266def ext_auto_new_list_init : Extension<
2267  "ISO C++ standards before C++17 do not allow new expression for "
2268  "type %0 to use list-initialization">, InGroup<CXX17>;
2269def err_auto_var_init_no_expression : Error<
2270  "initializer for variable %0 with type %1 is empty">;
2271def err_auto_var_init_multiple_expressions : Error<
2272  "initializer for variable %0 with type %1 contains multiple expressions">;
2273def err_auto_var_init_paren_braces : Error<
2274  "cannot deduce type for variable %1 with type %2 from "
2275  "%select{parenthesized|nested}0 initializer list">;
2276def err_auto_new_ctor_multiple_expressions : Error<
2277  "new expression for type %0 contains multiple constructor arguments">;
2278def err_auto_missing_trailing_return : Error<
2279  "'auto' return without trailing return type; deduced return types are a "
2280  "C++14 extension">;
2281def err_deduced_return_type : Error<
2282  "deduced return types are a C++14 extension">;
2283def err_trailing_return_without_auto : Error<
2284  "function with trailing return type must specify return type 'auto', not %0">;
2285def err_trailing_return_in_parens : Error<
2286  "trailing return type may not be nested within parentheses">;
2287def err_auto_var_deduction_failure : Error<
2288  "variable %0 with type %1 has incompatible initializer of type %2">;
2289def err_auto_var_deduction_failure_from_init_list : Error<
2290  "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2291def err_auto_new_deduction_failure : Error<
2292  "new expression for type %0 has incompatible constructor argument of type %1">;
2293def err_auto_inconsistent_deduction : Error<
2294  "deduced conflicting types %diff{($ vs $) |}0,1"
2295  "for initializer list element type">;
2296def err_auto_different_deductions : Error<
2297  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2298  "deduced as %1 in declaration of %2 and "
2299  "deduced as %3 in declaration of %4">;
2300def err_auto_non_deduced_not_alone : Error<
2301  "%select{function with deduced return type|"
2302  "declaration with trailing return type}0 "
2303  "must be the only declaration in its group">;
2304def err_implied_std_initializer_list_not_found : Error<
2305  "cannot deduce type of initializer list because std::initializer_list was "
2306  "not found; include <initializer_list>">;
2307def err_malformed_std_initializer_list : Error<
2308  "std::initializer_list must be a class template with a single type parameter">;
2309def err_auto_init_list_from_c : Error<
2310  "cannot use __auto_type with initializer list in C">;
2311def err_auto_bitfield : Error<
2312  "cannot pass bit-field as __auto_type initializer in C">;
2313
2314// C++1y decltype(auto) type
2315def err_decltype_auto_invalid : Error<
2316  "'decltype(auto)' not allowed here">;
2317def err_decltype_auto_cannot_be_combined : Error<
2318  "'decltype(auto)' cannot be combined with other type specifiers">;
2319def err_decltype_auto_function_declarator_not_declaration : Error<
2320  "'decltype(auto)' can only be used as a return type "
2321  "in a function declaration">;
2322def err_decltype_auto_compound_type : Error<
2323  "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2324def err_decltype_auto_initializer_list : Error<
2325  "cannot deduce 'decltype(auto)' from initializer list">;
2326
2327// C++17 deduced class template specialization types
2328def err_deduced_class_template_compound_type : Error<
2329  "cannot %select{form pointer to|form reference to|form array of|"
2330  "form function returning|use parentheses when declaring variable with}0 "
2331  "deduced class template specialization type">;
2332def err_deduced_non_class_template_specialization_type : Error<
2333  "%select{<error>|function template|variable template|alias template|"
2334  "template template parameter|concept|template}0 %1 requires template "
2335  "arguments; argument deduction only allowed for class templates">;
2336def err_deduced_class_template_ctor_ambiguous : Error<
2337  "ambiguous deduction for template arguments of %0">;
2338def err_deduced_class_template_ctor_no_viable : Error<
2339  "no viable constructor or deduction guide for deduction of "
2340  "template arguments of %0">;
2341def err_deduced_class_template_incomplete : Error<
2342  "template %0 has no definition and no %select{|viable }1deduction guides "
2343  "for deduction of template arguments">;
2344def err_deduced_class_template_deleted : Error<
2345  "class template argument deduction for %0 selected a deleted constructor">;
2346def err_deduced_class_template_explicit : Error<
2347  "class template argument deduction for %0 selected an explicit "
2348  "%select{constructor|deduction guide}1 for copy-list-initialization">;
2349def err_deduction_guide_no_trailing_return_type : Error<
2350  "deduction guide declaration without trailing return type">;
2351def err_deduction_guide_bad_trailing_return_type : Error<
2352  "deduced type %1 of deduction guide is not %select{|written as }2"
2353  "a specialization of template %0">;
2354def err_deduction_guide_with_complex_decl : Error<
2355  "cannot specify any part of a return type in the "
2356  "declaration of a deduction guide">;
2357def err_deduction_guide_invalid_specifier : Error<
2358  "deduction guide cannot be declared '%0'">;
2359def err_deduction_guide_name_not_class_template : Error<
2360  "cannot specify deduction guide for "
2361  "%select{<error>|function template|variable template|alias template|"
2362  "template template parameter|concept|dependent template name}0 %1">;
2363def err_deduction_guide_wrong_scope : Error<
2364  "deduction guide must be declared in the same scope as template %q0">;
2365def err_deduction_guide_defines_function : Error<
2366  "deduction guide cannot have a function definition">;
2367def err_deduction_guide_redeclared : Error<
2368  "redeclaration of deduction guide">;
2369def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2370  "%select{explicitly instantiated|explicitly specialized}0">;
2371def err_deduction_guide_template_not_deducible : Error<
2372  "deduction guide template contains "
2373  "%select{a template parameter|template parameters}0 that cannot be "
2374  "deduced">;
2375def err_deduction_guide_wrong_access : Error<
2376  "deduction guide has different access from the corresponding "
2377  "member template">;
2378def note_deduction_guide_template_access : Note<
2379  "member template declared %0 here">;
2380def note_deduction_guide_access : Note<
2381  "deduction guide declared %0 by intervening access specifier">;
2382def warn_cxx14_compat_class_template_argument_deduction : Warning<
2383  "class template argument deduction is incompatible with C++ standards "
2384  "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2385  InGroup<CXXPre17Compat>, DefaultIgnore;
2386def warn_ctad_maybe_unsupported : Warning<
2387  "%0 may not intend to support class template argument deduction">,
2388  InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2389def note_suppress_ctad_maybe_unsupported : Note<
2390  "add a deduction guide to suppress this warning">;
2391
2392
2393// C++14 deduced return types
2394def err_auto_fn_deduction_failure : Error<
2395  "cannot deduce return type %0 from returned value of type %1">;
2396def err_auto_fn_different_deductions : Error<
2397  "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2398  "deduced as %2 in earlier return statement">;
2399def err_auto_fn_used_before_defined : Error<
2400  "function %0 with deduced return type cannot be used before it is defined">;
2401def err_auto_fn_no_return_but_not_auto : Error<
2402  "cannot deduce return type %0 for function with no return statements">;
2403def err_auto_fn_return_void_but_not_auto : Error<
2404  "cannot deduce return type %0 from omitted return expression">;
2405def err_auto_fn_return_init_list : Error<
2406  "cannot deduce return type from initializer list">;
2407def err_auto_fn_virtual : Error<
2408  "function with deduced return type cannot be virtual">;
2409def warn_cxx11_compat_deduced_return_type : Warning<
2410  "return type deduction is incompatible with C++ standards before C++14">,
2411  InGroup<CXXPre14Compat>, DefaultIgnore;
2412
2413// C++11 override control
2414def override_keyword_only_allowed_on_virtual_member_functions : Error<
2415  "only virtual member functions can be marked '%0'">;
2416def override_keyword_hides_virtual_member_function : Error<
2417  "non-virtual member function marked '%0' hides virtual member "
2418  "%select{function|functions}1">;
2419def err_function_marked_override_not_overriding : Error<
2420  "%0 marked 'override' but does not override any member functions">;
2421def warn_destructor_marked_not_override_overriding : TextSubstitution <
2422  "%0 overrides a destructor but is not marked 'override'">;
2423def warn_function_marked_not_override_overriding : TextSubstitution <
2424  "%0 overrides a member function but is not marked 'override'">;
2425def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2426  "%sub{warn_destructor_marked_not_override_overriding}0">,
2427  InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2428def warn_inconsistent_function_marked_not_override_overriding : Warning <
2429  "%sub{warn_function_marked_not_override_overriding}0">,
2430  InGroup<CXX11WarnInconsistentOverrideMethod>;
2431def warn_suggest_destructor_marked_not_override_overriding : Warning <
2432  "%sub{warn_destructor_marked_not_override_overriding}0">,
2433  InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2434def warn_suggest_function_marked_not_override_overriding : Warning <
2435  "%sub{warn_function_marked_not_override_overriding}0">,
2436  InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2437def err_class_marked_final_used_as_base : Error<
2438  "base %0 is marked '%select{final|sealed}1'">;
2439def warn_abstract_final_class : Warning<
2440  "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2441def warn_final_dtor_non_final_class : Warning<
2442  "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2443  InGroup<FinalDtorNonFinalClass>;
2444def note_final_dtor_non_final_class_silence : Note<
2445  "mark %0 as '%select{final|sealed}1' to silence this warning">;
2446
2447// C++11 attributes
2448def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2449
2450// C++11 final
2451def err_final_function_overridden : Error<
2452  "declaration of %0 overrides a '%select{final|sealed}1' function">;
2453
2454// C++11 scoped enumerations
2455def err_enum_invalid_underlying : Error<
2456  "non-integral type %0 is an invalid underlying type">;
2457def err_enumerator_too_large : Error<
2458  "enumerator value is not representable in the underlying type %0">;
2459def ext_enumerator_too_large : Extension<
2460  "enumerator value is not representable in the underlying type %0">,
2461  InGroup<MicrosoftEnumValue>;
2462def err_enumerator_wrapped : Error<
2463  "enumerator value %0 is not representable in the underlying type %1">;
2464def err_enum_redeclare_type_mismatch : Error<
2465  "enumeration redeclared with different underlying type %0 (was %1)">;
2466def err_enum_redeclare_fixed_mismatch : Error<
2467  "enumeration previously declared with %select{non|}0fixed underlying type">;
2468def err_enum_redeclare_scoped_mismatch : Error<
2469  "enumeration previously declared as %select{un|}0scoped">;
2470def err_only_enums_have_underlying_types : Error<
2471  "only enumeration types have underlying types">;
2472def err_underlying_type_of_incomplete_enum : Error<
2473  "cannot determine underlying type of incomplete enumeration type %0">;
2474
2475// C++11 delegating constructors
2476def err_delegating_ctor : Error<
2477  "delegating constructors are permitted only in C++11">;
2478def warn_cxx98_compat_delegating_ctor : Warning<
2479  "delegating constructors are incompatible with C++98">,
2480  InGroup<CXX98Compat>, DefaultIgnore;
2481def err_delegating_initializer_alone : Error<
2482  "an initializer for a delegating constructor must appear alone">;
2483def warn_delegating_ctor_cycle : Warning<
2484  "constructor for %0 creates a delegation cycle">, DefaultError,
2485  InGroup<DelegatingCtorCycles>;
2486def note_it_delegates_to : Note<"it delegates to">;
2487def note_which_delegates_to : Note<"which delegates to">;
2488
2489// C++11 range-based for loop
2490def err_for_range_decl_must_be_var : Error<
2491  "for range declaration must declare a variable">;
2492def err_for_range_storage_class : Error<
2493  "loop variable %0 may not be declared %select{'extern'|'static'|"
2494  "'__private_extern__'|'auto'|'register'|'constexpr'|'thread_local'}1">;
2495def err_type_defined_in_for_range : Error<
2496  "types may not be defined in a for range declaration">;
2497def err_for_range_deduction_failure : Error<
2498  "cannot use type %0 as a range">;
2499def err_for_range_incomplete_type : Error<
2500  "cannot use incomplete type %0 as a range">;
2501def err_for_range_iter_deduction_failure : Error<
2502  "cannot use type %0 as an iterator">;
2503def ext_for_range_begin_end_types_differ : ExtWarn<
2504  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2505  InGroup<CXX17>;
2506def warn_for_range_begin_end_types_differ : Warning<
2507  "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2508  "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2509def note_in_for_range: Note<
2510  "when looking up '%select{begin|end}0' function for range expression "
2511  "of type %1">;
2512def err_for_range_invalid: Error<
2513  "invalid range expression of type %0; no viable '%select{begin|end}1' "
2514  "function available">;
2515def note_for_range_member_begin_end_ignored : Note<
2516  "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2517def err_range_on_array_parameter : Error<
2518  "cannot build range expression with array function parameter %0 since "
2519  "parameter with array type %1 is treated as pointer type %2">;
2520def err_for_range_dereference : Error<
2521  "invalid range expression of type %0; did you mean to dereference it "
2522  "with '*'?">;
2523def note_for_range_invalid_iterator : Note <
2524  "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2525def note_for_range_begin_end : Note<
2526  "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2527def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2528  "loop variable %0 "
2529  "%diff{of type $ binds to a temporary constructed from type $"
2530  "|binds to a temporary constructed from a different type}1,2">,
2531  InGroup<RangeLoopConstruct>, DefaultIgnore;
2532def note_use_type_or_non_reference : Note<
2533  "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2534def warn_for_range_ref_binds_ret_temp : Warning<
2535  "loop variable %0 binds to a temporary value produced by a range of type %1">,
2536  InGroup<RangeLoopBindReference>, DefaultIgnore;
2537def note_use_non_reference_type : Note<"use non-reference type %0">;
2538def warn_for_range_copy : Warning<
2539  "loop variable %0 creates a copy from type %1">,
2540  InGroup<RangeLoopConstruct>, DefaultIgnore;
2541def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2542def err_objc_for_range_init_stmt : Error<
2543  "initialization statement is not supported when iterating over Objective-C "
2544  "collection">;
2545
2546// C++11 constexpr
2547def warn_cxx98_compat_constexpr : Warning<
2548  "'constexpr' specifier is incompatible with C++98">,
2549  InGroup<CXX98Compat>, DefaultIgnore;
2550// FIXME: Maybe this should also go in -Wc++14-compat?
2551def warn_cxx14_compat_constexpr_not_const : Warning<
2552  "'constexpr' non-static member function will not be implicitly 'const' "
2553  "in C++14; add 'const' to avoid a change in behavior">,
2554  InGroup<DiagGroup<"constexpr-not-const">>;
2555def err_invalid_consteval_take_address : Error<
2556  "cannot take address of consteval function %0 outside"
2557  " of an immediate invocation">;
2558def err_invalid_consteval_call : Error<
2559  "call to consteval function %q0 is not a constant expression">;
2560def err_invalid_consteval_decl_kind : Error<
2561  "%0 cannot be declared consteval">;
2562def err_invalid_constexpr : Error<
2563  "%select{function parameter|typedef}0 "
2564  "cannot be %sub{select_constexpr_spec_kind}1">;
2565def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2566  "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2567def err_constexpr_tag : Error<
2568  "%select{class|struct|interface|union|enum}0 "
2569  "cannot be marked %sub{select_constexpr_spec_kind}1">;
2570def err_constexpr_dtor : Error<
2571  "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2572def err_constexpr_dtor_subobject : Error<
2573  "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2574  "%select{data member %2|base class %3}1 does not have a "
2575  "constexpr destructor">;
2576def note_constexpr_dtor_subobject : Note<
2577  "%select{data member %1|base class %2}0 declared here">;
2578def err_constexpr_wrong_decl_kind : Error<
2579  "%sub{select_constexpr_spec_kind}0 can only be used "
2580  "in %select{|variable and function|function|variable}0 declarations">;
2581def err_invalid_constexpr_var_decl : Error<
2582  "constexpr variable declaration must be a definition">;
2583def err_constexpr_static_mem_var_requires_init : Error<
2584  "declaration of constexpr static data member %0 requires an initializer">;
2585def err_constexpr_var_non_literal : Error<
2586  "constexpr variable cannot have non-literal type %0">;
2587def err_constexpr_var_requires_const_init : Error<
2588  "constexpr variable %0 must be initialized by a constant expression">;
2589def err_constexpr_var_requires_const_destruction : Error<
2590  "constexpr variable %0 must have constant destruction">;
2591def err_constexpr_redecl_mismatch : Error<
2592  "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2593  " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2594def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2595def warn_cxx17_compat_constexpr_virtual : Warning<
2596  "virtual constexpr functions are incompatible with "
2597  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2598def err_constexpr_virtual_base : Error<
2599  "constexpr %select{member function|constructor}0 not allowed in "
2600  "%select{struct|interface|class}1 with virtual base "
2601  "%plural{1:class|:classes}2">;
2602def note_non_literal_incomplete : Note<
2603  "incomplete type %0 is not a literal type">;
2604def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2605  "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2606def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2607def err_constexpr_non_literal_return : Error<
2608  "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2609def err_constexpr_non_literal_param : Error<
2610  "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2611  "not a literal type">;
2612def err_constexpr_body_invalid_stmt : Error<
2613  "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2614def ext_constexpr_body_invalid_stmt : ExtWarn<
2615  "use of this statement in a constexpr %select{function|constructor}0 "
2616  "is a C++14 extension">, InGroup<CXX14>;
2617def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2618  "use of this statement in a constexpr %select{function|constructor}0 "
2619  "is incompatible with C++ standards before C++14">,
2620  InGroup<CXXPre14Compat>, DefaultIgnore;
2621def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2622  "use of this statement in a constexpr %select{function|constructor}0 "
2623  "is a C++20 extension">, InGroup<CXX20>;
2624def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2625  "use of this statement in a constexpr %select{function|constructor}0 "
2626  "is incompatible with C++ standards before C++20">,
2627  InGroup<CXXPre20Compat>, DefaultIgnore;
2628def ext_constexpr_type_definition : ExtWarn<
2629  "type definition in a constexpr %select{function|constructor}0 "
2630  "is a C++14 extension">, InGroup<CXX14>;
2631def warn_cxx11_compat_constexpr_type_definition : Warning<
2632  "type definition in a constexpr %select{function|constructor}0 "
2633  "is incompatible with C++ standards before C++14">,
2634  InGroup<CXXPre14Compat>, DefaultIgnore;
2635def err_constexpr_vla : Error<
2636  "variably-modified type %0 cannot be used in a constexpr "
2637  "%select{function|constructor}1">;
2638def ext_constexpr_local_var : ExtWarn<
2639  "variable declaration in a constexpr %select{function|constructor}0 "
2640  "is a C++14 extension">, InGroup<CXX14>;
2641def warn_cxx11_compat_constexpr_local_var : Warning<
2642  "variable declaration in a constexpr %select{function|constructor}0 "
2643  "is incompatible with C++ standards before C++14">,
2644  InGroup<CXXPre14Compat>, DefaultIgnore;
2645def err_constexpr_local_var_static : Error<
2646  "%select{static|thread_local}1 variable not permitted in a constexpr "
2647  "%select{function|constructor}0">;
2648def err_constexpr_local_var_non_literal_type : Error<
2649  "variable of non-literal type %1 cannot be defined in a constexpr "
2650  "%select{function|constructor}0">;
2651def ext_constexpr_local_var_no_init : ExtWarn<
2652  "uninitialized variable in a constexpr %select{function|constructor}0 "
2653  "is a C++20 extension">, InGroup<CXX20>;
2654def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2655  "uninitialized variable in a constexpr %select{function|constructor}0 "
2656  "is incompatible with C++ standards before C++20">,
2657  InGroup<CXXPre20Compat>, DefaultIgnore;
2658def ext_constexpr_function_never_constant_expr : ExtWarn<
2659  "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2660  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2661def err_attr_cond_never_constant_expr : Error<
2662  "%0 attribute expression never produces a constant expression">;
2663def err_diagnose_if_invalid_diagnostic_type : Error<
2664  "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2665  "instead">;
2666def err_constexpr_body_no_return : Error<
2667  "no return statement in %select{constexpr|consteval}0 function">;
2668def err_constexpr_return_missing_expr : Error<
2669  "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2670def warn_cxx11_compat_constexpr_body_no_return : Warning<
2671  "constexpr function with no return statements is incompatible with C++ "
2672  "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2673def ext_constexpr_body_multiple_return : ExtWarn<
2674  "multiple return statements in constexpr function is a C++14 extension">,
2675  InGroup<CXX14>;
2676def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2677  "multiple return statements in constexpr function "
2678  "is incompatible with C++ standards before C++14">,
2679  InGroup<CXXPre14Compat>, DefaultIgnore;
2680def note_constexpr_body_previous_return : Note<
2681  "previous return statement is here">;
2682
2683// C++20 function try blocks in constexpr
2684def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2685  "function try block in constexpr %select{function|constructor}0 is "
2686  "a C++20 extension">, InGroup<CXX20>;
2687def warn_cxx17_compat_constexpr_function_try_block : Warning<
2688  "function try block in constexpr %select{function|constructor}0 is "
2689  "incompatible with C++ standards before C++20">,
2690  InGroup<CXXPre20Compat>, DefaultIgnore;
2691
2692def ext_constexpr_union_ctor_no_init : ExtWarn<
2693  "constexpr union constructor that does not initialize any member "
2694  "is a C++20 extension">, InGroup<CXX20>;
2695def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2696  "constexpr union constructor that does not initialize any member "
2697  "is incompatible with C++ standards before C++20">,
2698  InGroup<CXXPre20Compat>, DefaultIgnore;
2699def ext_constexpr_ctor_missing_init : ExtWarn<
2700  "constexpr constructor that does not initialize all members "
2701  "is a C++20 extension">, InGroup<CXX20>;
2702def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2703  "constexpr constructor that does not initialize all members "
2704  "is incompatible with C++ standards before C++20">,
2705  InGroup<CXXPre20Compat>, DefaultIgnore;
2706def note_constexpr_ctor_missing_init : Note<
2707  "member not initialized by constructor">;
2708def note_non_literal_no_constexpr_ctors : Note<
2709  "%0 is not literal because it is not an aggregate and has no constexpr "
2710  "constructors other than copy or move constructors">;
2711def note_non_literal_base_class : Note<
2712  "%0 is not literal because it has base class %1 of non-literal type">;
2713def note_non_literal_field : Note<
2714  "%0 is not literal because it has data member %1 of "
2715  "%select{non-literal|volatile}3 type %2">;
2716def note_non_literal_user_provided_dtor : Note<
2717  "%0 is not literal because it has a user-provided destructor">;
2718def note_non_literal_nontrivial_dtor : Note<
2719  "%0 is not literal because it has a non-trivial destructor">;
2720def note_non_literal_non_constexpr_dtor : Note<
2721  "%0 is not literal because its destructor is not constexpr">;
2722def note_non_literal_lambda : Note<
2723  "lambda closure types are non-literal types before C++17">;
2724def warn_private_extern : Warning<
2725  "use of __private_extern__ on a declaration may not produce external symbol "
2726  "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2727def note_private_extern : Note<
2728  "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2729
2730// C++ Concepts
2731def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2732  "concept declarations may only appear in global or namespace scope">;
2733def err_concept_no_parameters : Error<
2734  "concept template parameter list must have at least one parameter; explicit "
2735  "specialization of concepts is not allowed">;
2736def err_concept_extra_headers : Error<
2737  "extraneous template parameter list in concept definition">;
2738def err_concept_no_associated_constraints : Error<
2739  "concept cannot have associated constraints">;
2740def err_non_constant_constraint_expression : Error<
2741  "substitution into constraint expression resulted in a non-constant "
2742  "expression">;
2743def err_non_bool_atomic_constraint : Error<
2744  "atomic constraint must be of type 'bool' (found %0)">;
2745def err_template_arg_list_constraints_not_satisfied : Error<
2746  "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2747  "template template parameter|template}0 %1%2">;
2748def note_substituted_constraint_expr_is_ill_formed : Note<
2749  "because substituted constraint expression is ill-formed%0">;
2750def note_atomic_constraint_evaluated_to_false : Note<
2751  "%select{and|because}0 '%1' evaluated to false">;
2752def note_concept_specialization_constraint_evaluated_to_false : Note<
2753  "%select{and|because}0 '%1' evaluated to false">;
2754def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2755  "%select{and|because}0 %1 does not satisfy %2">;
2756def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2757  "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2758def err_constrained_virtual_method : Error<
2759  "virtual function cannot have a requires clause">;
2760def err_trailing_requires_clause_on_deduction_guide : Error<
2761  "deduction guide cannot have a requires clause">;
2762def err_reference_to_function_with_unsatisfied_constraints : Error<
2763  "invalid reference to function %0: constraints not satisfied">;
2764def err_requires_expr_local_parameter_default_argument : Error<
2765  "default arguments not allowed for parameters of a requires expression">;
2766def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2767  "constraint variable %0 cannot be used in an evaluated context">;
2768def note_expr_requirement_expr_substitution_error : Note<
2769  "%select{and|because}0 '%1' would be invalid: %2">;
2770def note_expr_requirement_expr_unknown_substitution_error : Note<
2771  "%select{and|because}0 '%1' would be invalid">;
2772def note_expr_requirement_noexcept_not_met : Note<
2773  "%select{and|because}0 '%1' may throw an exception">;
2774def note_expr_requirement_type_requirement_substitution_error : Note<
2775  "%select{and|because}0 '%1' would be invalid: %2">;
2776def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
2777  "%select{and|because}0 '%1' would be invalid">;
2778def note_expr_requirement_constraints_not_satisfied : Note<
2779  "%select{and|because}0 type constraint '%1' was not satisfied:">;
2780def note_expr_requirement_constraints_not_satisfied_simple : Note<
2781  "%select{and|because}0 %1 does not satisfy %2:">;
2782def note_type_requirement_substitution_error : Note<
2783  "%select{and|because}0 '%1' would be invalid: %2">;
2784def note_type_requirement_unknown_substitution_error : Note<
2785  "%select{and|because}0 '%1' would be invalid">;
2786def note_nested_requirement_substitution_error : Note<
2787  "%select{and|because}0 '%1' would be invalid: %2">;
2788def note_nested_requirement_unknown_substitution_error : Note<
2789  "%select{and|because}0 '%1' would be invalid">;
2790def note_ambiguous_atomic_constraints : Note<
2791  "similar constraint expressions not considered equivalent; constraint "
2792  "expressions cannot be considered equivalent unless they originate from the "
2793  "same concept">;
2794def note_ambiguous_atomic_constraints_similar_expression : Note<
2795  "similar constraint expression here">;
2796def err_unsupported_placeholder_constraint : Error<
2797  "constrained placeholder types other than simple 'auto' on non-type template "
2798  "parameters not supported yet">;
2799
2800def err_template_different_requires_clause : Error<
2801  "requires clause differs in template redeclaration">;
2802def err_template_different_type_constraint : Error<
2803  "type constraint differs in template redeclaration">;
2804def err_template_template_parameter_not_at_least_as_constrained : Error<
2805  "template template argument %0 is more constrained than template template "
2806  "parameter %1">;
2807
2808def err_type_constraint_non_type_concept : Error<
2809  "concept named in type constraint is not a type concept">;
2810def err_type_constraint_missing_arguments : Error<
2811  "%0 requires more than 1 template argument; provide the remaining arguments "
2812  "explicitly to use it here">;
2813def err_placeholder_constraints_not_satisfied : Error<
2814  "deduced type %0 does not satisfy %1">;
2815
2816// C++11 char16_t/char32_t
2817def warn_cxx98_compat_unicode_type : Warning<
2818  "'%0' type specifier is incompatible with C++98">,
2819  InGroup<CXX98Compat>, DefaultIgnore;
2820def warn_cxx17_compat_unicode_type : Warning<
2821  "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2822  InGroup<CXXPre20Compat>, DefaultIgnore;
2823
2824// __make_integer_seq
2825def err_integer_sequence_negative_length : Error<
2826  "integer sequences must have non-negative sequence length">;
2827def err_integer_sequence_integral_element_type : Error<
2828  "integer sequences must have integral element type">;
2829
2830// __type_pack_element
2831def err_type_pack_element_out_of_bounds : Error<
2832  "a parameter pack may not be accessed at an out of bounds index">;
2833
2834// Objective-C++
2835def err_objc_decls_may_only_appear_in_global_scope : Error<
2836  "Objective-C declarations may only appear in global scope">;
2837def warn_auto_var_is_id : Warning<
2838  "'auto' deduced as 'id' in declaration of %0">,
2839  InGroup<DiagGroup<"auto-var-id">>;
2840
2841// Attributes
2842def warn_nomerge_attribute_ignored_in_stmt: Warning<
2843  "%0 attribute is ignored because there exists no call expression inside the "
2844  "statement">,
2845  InGroup<IgnoredAttributes>;
2846
2847def err_musttail_needs_trivial_args : Error<
2848  "tail call requires that the return value, all parameters, and any "
2849  "temporaries created by the expression are trivially destructible">;
2850def err_musttail_needs_call : Error<
2851  "%0 attribute requires that the return value is the result of a function call"
2852  >;
2853def err_musttail_needs_prototype : Error<
2854  "%0 attribute requires that both caller and callee functions have a "
2855  "prototype">;
2856def note_musttail_fix_non_prototype : Note<
2857  "add 'void' to the parameter list to turn an old-style K&R function "
2858  "declaration into a prototype">;
2859def err_musttail_structors_forbidden : Error<"cannot perform a tail call "
2860  "%select{from|to}0 a %select{constructor|destructor}1">;
2861def note_musttail_structors_forbidden : Note<"target "
2862  "%select{constructor|destructor}0 is declared here">;
2863def err_musttail_forbidden_from_this_context : Error<
2864  "%0 attribute cannot be used from "
2865  "%select{a block|an Objective-C function|this context}1">;
2866def err_musttail_member_mismatch : Error<
2867  "%select{non-member|static member|non-static member}0 "
2868  "function cannot perform a tail call to "
2869  "%select{non-member|static member|non-static member|pointer-to-member}1 "
2870  "function%select{| %3}2">;
2871def note_musttail_callee_defined_here : Note<"%0 declared here">;
2872def note_tail_call_required : Note<"tail call required by %0 attribute here">;
2873def err_musttail_mismatch : Error<
2874  "cannot perform a tail call to function%select{| %1}0 because its signature "
2875  "is incompatible with the calling function">;
2876def note_musttail_mismatch : Note<
2877    "target function "
2878    "%select{is a member of different class%diff{ (expected $ but has $)|}1,2"
2879    "|has different number of parameters (expected %1 but has %2)"
2880    "|has type mismatch at %ordinal3 parameter"
2881    "%diff{ (expected $ but has $)|}1,2"
2882    "|has different return type%diff{ ($ expected but has $)|}1,2}0">;
2883def err_musttail_callconv_mismatch : Error<
2884  "cannot perform a tail call to function%select{| %1}0 because it uses an "
2885  "incompatible calling convention">;
2886def note_musttail_callconv_mismatch : Note<
2887  "target function has calling convention %1 (expected %0)">;
2888def err_musttail_scope : Error<
2889  "cannot perform a tail call from this return statement">;
2890def err_musttail_no_variadic : Error<
2891  "%0 attribute may not be used with variadic functions">;
2892
2893def err_nsobject_attribute : Error<
2894  "'NSObject' attribute is for pointer types only">;
2895def err_attributes_are_not_compatible : Error<
2896  "%0 and %1 attributes are not compatible">;
2897def err_attribute_invalid_argument : Error<
2898  "%select{a reference type|an array type|a non-vector or "
2899  "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
2900def err_attribute_wrong_number_arguments : Error<
2901  "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
2902  ":requires exactly %1 arguments}1">;
2903def err_attribute_too_many_arguments : Error<
2904  "%0 attribute takes no more than %1 argument%s1">;
2905def err_attribute_too_few_arguments : Error<
2906  "%0 attribute takes at least %1 argument%s1">;
2907def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
2908def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
2909def err_attribute_bad_neon_vector_size : Error<
2910  "Neon vector size must be 64 or 128 bits">;
2911def err_attribute_invalid_sve_type : Error<
2912  "%0 attribute applied to non-SVE type %1">;
2913def err_attribute_bad_sve_vector_size : Error<
2914  "invalid SVE vector size '%0', must match value set by "
2915  "'-msve-vector-bits' ('%1')">;
2916def err_attribute_arm_feature_sve_bits_unsupported : Error<
2917  "%0 is only supported when '-msve-vector-bits=<bits>' is specified with a "
2918  "value of 128, 256, 512, 1024 or 2048.">;
2919def err_attribute_requires_positive_integer : Error<
2920  "%0 attribute requires a %select{positive|non-negative}1 "
2921  "integral compile time constant expression">;
2922def err_attribute_requires_opencl_version : Error<
2923  "%0 attribute requires OpenCL version %1%select{| or above}2">;
2924def err_invalid_branch_protection_spec : Error<
2925  "invalid or misplaced branch protection specification '%0'">;
2926def warn_unsupported_target_attribute
2927    : Warning<"%select{unsupported|duplicate|unknown}0%select{| architecture|"
2928              " tune CPU}1 '%2' in the 'target' attribute string; 'target' "
2929              "attribute ignored">,
2930      InGroup<IgnoredAttributes>;
2931def err_attribute_unsupported
2932    : Error<"%0 attribute is not supported on targets missing %1;"
2933            " specify an appropriate -march= or -mcpu=">;
2934// The err_*_attribute_argument_not_int are separate because they're used by
2935// VerifyIntegerConstantExpression.
2936def err_aligned_attribute_argument_not_int : Error<
2937  "'aligned' attribute requires integer constant">;
2938def err_align_value_attribute_argument_not_int : Error<
2939  "'align_value' attribute requires integer constant">;
2940def err_alignas_attribute_wrong_decl_type : Error<
2941  "%0 attribute cannot be applied to a %select{function parameter|"
2942  "variable with 'register' storage class|'catch' variable|bit-field}1">;
2943def err_alignas_missing_on_definition : Error<
2944  "%0 must be specified on definition if it is specified on any declaration">;
2945def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
2946def err_alignas_mismatch : Error<
2947  "redeclaration has different alignment requirement (%1 vs %0)">;
2948def err_alignas_underaligned : Error<
2949  "requested alignment is less than minimum alignment of %1 for type %0">;
2950def err_attribute_sizeless_type : Error<
2951  "%0 attribute cannot be applied to sizeless type %1">;
2952def err_attribute_argument_n_type : Error<
2953  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
2954  "constant|a string|an identifier|a constant expression}2">;
2955def err_attribute_argument_type : Error<
2956  "%0 attribute requires %select{int or bool|an integer "
2957  "constant|a string|an identifier}1">;
2958def err_attribute_argument_out_of_range : Error<
2959  "%0 attribute requires integer constant between %1 and %2 inclusive">;
2960def err_init_priority_object_attr : Error<
2961  "can only use 'init_priority' attribute on file-scope definitions "
2962  "of objects of class type">;
2963def err_attribute_argument_out_of_bounds : Error<
2964  "%0 attribute parameter %1 is out of bounds">;
2965def err_attribute_only_once_per_parameter : Error<
2966  "%0 attribute can only be applied once per parameter">;
2967def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
2968def note_previous_uuid : Note<"previous uuid specified here">;
2969def warn_attribute_pointers_only : Warning<
2970  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
2971  InGroup<IgnoredAttributes>;
2972def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
2973def err_attribute_integers_only : Error<
2974  "%0 attribute argument may only refer to a function parameter of integer "
2975  "type">;
2976def warn_attribute_return_pointers_only : Warning<
2977  "%0 attribute only applies to return values that are pointers">,
2978  InGroup<IgnoredAttributes>;
2979def warn_attribute_return_pointers_refs_only : Warning<
2980  "%0 attribute only applies to return values that are pointers or references">,
2981  InGroup<IgnoredAttributes>;
2982def warn_attribute_pointer_or_reference_only : Warning<
2983  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
2984  InGroup<IgnoredAttributes>;
2985def err_attribute_no_member_pointers : Error<
2986  "%0 attribute cannot be used with pointers to members">;
2987def err_attribute_invalid_implicit_this_argument : Error<
2988  "%0 attribute is invalid for the implicit this argument">;
2989def err_ownership_type : Error<
2990  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
2991def err_ownership_returns_index_mismatch : Error<
2992  "'ownership_returns' attribute index does not match; here it is %0">;
2993def note_ownership_returns_index_mismatch : Note<
2994  "declared with index %0 here">;
2995def err_format_strftime_third_parameter : Error<
2996  "strftime format attribute requires 3rd parameter to be 0">;
2997def err_format_attribute_requires_variadic : Error<
2998  "format attribute requires variadic function">;
2999def err_format_attribute_not : Error<"format argument not %0">;
3000def err_format_attribute_result_not : Error<"function does not return %0">;
3001def err_format_attribute_implicit_this_format_string : Error<
3002  "format attribute cannot specify the implicit this argument as the format "
3003  "string">;
3004def err_callback_attribute_no_callee : Error<
3005  "'callback' attribute specifies no callback callee">;
3006def err_callback_attribute_invalid_callee : Error<
3007  "'callback' attribute specifies invalid callback callee">;
3008def err_callback_attribute_multiple : Error<
3009  "multiple 'callback' attributes specified">;
3010def err_callback_attribute_argument_unknown : Error<
3011  "'callback' attribute argument %0 is not a known function parameter">;
3012def err_callback_callee_no_function_type : Error<
3013  "'callback' attribute callee does not have function type">;
3014def err_callback_callee_is_variadic : Error<
3015  "'callback' attribute callee may not be variadic">;
3016def err_callback_implicit_this_not_available : Error<
3017  "'callback' argument at position %0 references unavailable implicit 'this'">;
3018def err_init_method_bad_return_type : Error<
3019  "init methods must return an object pointer type, not %0">;
3020def err_attribute_invalid_size : Error<
3021  "vector size not an integral multiple of component size">;
3022def err_attribute_zero_size : Error<"zero %0 size">;
3023def err_attribute_size_too_large : Error<"%0 size too large">;
3024def err_typecheck_sve_ambiguous : Error<
3025  "cannot combine fixed-length and sizeless SVE vectors in expression, result is ambiguous (%0 and %1)">;
3026def err_typecheck_sve_gnu_ambiguous : Error<
3027  "cannot combine GNU and SVE vectors in expression, result is ambiguous (%0 and %1)">;
3028def err_typecheck_vector_not_convertable_implict_truncation : Error<
3029   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
3030   " %2 as implicit conversion would cause truncation">;
3031def err_typecheck_vector_not_convertable : Error<
3032  "cannot convert between vector values of different size (%0 and %1)">;
3033def err_typecheck_vector_not_convertable_non_scalar : Error<
3034  "cannot convert between vector and non-scalar values (%0 and %1)">;
3035def err_typecheck_vector_lengths_not_equal : Error<
3036  "vector operands do not have the same number of elements (%0 and %1)">;
3037def warn_typecheck_vector_element_sizes_not_equal : Warning<
3038  "vector operands do not have the same elements sizes (%0 and %1)">,
3039  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
3040def err_ext_vector_component_exceeds_length : Error<
3041  "vector component access exceeds type %0">;
3042def err_ext_vector_component_name_illegal : Error<
3043  "illegal vector component name '%0'">;
3044def err_attribute_address_space_negative : Error<
3045  "address space is negative">;
3046def err_attribute_address_space_too_high : Error<
3047  "address space is larger than the maximum supported (%0)">;
3048def err_attribute_address_multiple_qualifiers : Error<
3049  "multiple address spaces specified for type">;
3050def warn_attribute_address_multiple_identical_qualifiers : Warning<
3051  "multiple identical address spaces specified for type">,
3052  InGroup<DuplicateDeclSpecifier>;
3053def err_attribute_not_clinkage : Error<
3054  "function type with %0 attribute must have C linkage">;
3055def err_function_decl_cmse_ns_call : Error<
3056  "functions may not be declared with 'cmse_nonsecure_call' attribute">;
3057def err_attribute_address_function_type : Error<
3058  "function type may not be qualified with an address space">;
3059def err_as_qualified_auto_decl : Error<
3060  "automatic variable qualified with an%select{| invalid}0 address space">;
3061def err_arg_with_address_space : Error<
3062  "parameter may not be qualified with an address space">;
3063def err_field_with_address_space : Error<
3064  "field may not be qualified with an address space">;
3065def err_compound_literal_with_address_space : Error<
3066  "compound literal in function scope may not be qualified with an address space">;
3067def err_address_space_mismatch_templ_inst : Error<
3068  "conflicting address space qualifiers are provided between types %0 and %1">;
3069def err_attr_objc_ownership_redundant : Error<
3070  "the type %0 is already explicitly ownership-qualified">;
3071def err_invalid_nsnumber_type : Error<
3072  "%0 is not a valid literal type for NSNumber">;
3073def err_objc_illegal_boxed_expression_type : Error<
3074  "illegal type %0 used in a boxed expression">;
3075def err_objc_non_trivially_copyable_boxed_expression_type : Error<
3076  "non-trivially copyable type %0 cannot be used in a boxed expression">;
3077def err_objc_incomplete_boxed_expression_type : Error<
3078  "incomplete type %0 used in a boxed expression">;
3079def err_undeclared_objc_literal_class : Error<
3080  "definition of class %0 must be available to use Objective-C "
3081  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
3082  "string literals}1">;
3083def err_undeclared_boxing_method : Error<
3084  "declaration of %0 is missing in %1 class">;
3085def err_objc_literal_method_sig : Error<
3086  "literal construction method %0 has incompatible signature">;
3087def note_objc_literal_method_param : Note<
3088  "%select{first|second|third}0 parameter has unexpected type %1 "
3089  "(should be %2)">;
3090def note_objc_literal_method_return : Note<
3091  "method returns unexpected type %0 (should be an object type)">;
3092def err_invalid_collection_element : Error<
3093  "collection element of type %0 is not an Objective-C object">;
3094def err_box_literal_collection : Error<
3095  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3096  "in a collection">;
3097def warn_objc_literal_comparison : Warning<
3098  "direct comparison of %select{an array literal|a dictionary literal|"
3099  "a numeric literal|a boxed expression|}0 has undefined behavior">,
3100  InGroup<ObjCLiteralComparison>;
3101def err_missing_atsign_prefix : Error<
3102  "%select{string|numeric}0 literal must be prefixed by '@'">;
3103def warn_objc_string_literal_comparison : Warning<
3104  "direct comparison of a string literal has undefined behavior">,
3105  InGroup<ObjCStringComparison>;
3106def warn_concatenated_literal_array_init : Warning<
3107  "suspicious concatenation of string literals in an array initialization; "
3108  "did you mean to separate the elements with a comma?">,
3109  InGroup<StringConcatation>, DefaultIgnore;
3110def warn_concatenated_nsarray_literal : Warning<
3111  "concatenated NSString literal for an NSArray expression - "
3112  "possibly missing a comma">,
3113  InGroup<ObjCStringConcatenation>;
3114def note_objc_literal_comparison_isequal : Note<
3115  "use 'isEqual:' instead">;
3116def warn_objc_collection_literal_element : Warning<
3117  "object of type %0 is not compatible with "
3118  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3119  InGroup<ObjCLiteralConversion>;
3120def warn_nsdictionary_duplicate_key : Warning<
3121  "duplicate key in dictionary literal">,
3122  InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3123def note_nsdictionary_duplicate_key_here : Note<
3124  "previous equal key is here">;
3125def err_swift_param_attr_not_swiftcall : Error<
3126  "'%0' parameter can only be used with swiftcall calling convention">;
3127def err_swift_indirect_result_not_first : Error<
3128  "'swift_indirect_result' parameters must be first parameters of function">;
3129def err_swift_error_result_not_after_swift_context : Error<
3130  "'swift_error_result' parameter must follow 'swift_context' parameter">;
3131def err_swift_abi_parameter_wrong_type : Error<
3132  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3133  "type here is %2">;
3134
3135def err_attribute_argument_invalid : Error<
3136  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3137  "min must not be greater than max}1">;
3138def err_attribute_argument_is_zero : Error<
3139  "%0 attribute must be greater than 0">;
3140def warn_attribute_argument_n_negative : Warning<
3141  "%0 attribute parameter %1 is negative and will be ignored">,
3142  InGroup<CudaCompat>;
3143def err_property_function_in_objc_container : Error<
3144  "use of Objective-C property in function nested in Objective-C "
3145  "container not supported, move function outside its container">;
3146
3147let CategoryName = "Cocoa API Issue" in {
3148def warn_objc_redundant_literal_use : Warning<
3149  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3150}
3151
3152def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3153  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3154
3155def err_aix_attr_unsupported_tls_model : Error<"TLS model '%0' is not yet supported on AIX">;
3156
3157def err_tls_var_aligned_over_maximum : Error<
3158  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3159  "alignment (%2) for a thread-local variable on this target">;
3160
3161def err_only_annotate_after_access_spec : Error<
3162  "access specifier can only have annotation attributes">;
3163
3164def err_attribute_section_invalid_for_target : Error<
3165  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3166def err_pragma_section_invalid_for_target : Error<
3167  "argument to #pragma section is not valid for this target: %0">;
3168def warn_attribute_section_drectve : Warning<
3169  "#pragma %0(\".drectve\") has undefined behavior, "
3170  "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3171def warn_mismatched_section : Warning<
3172  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3173def warn_attribute_section_on_redeclaration : Warning<
3174  "section attribute is specified on redeclared variable">, InGroup<Section>;
3175def err_mismatched_code_seg_base : Error<
3176  "derived class must specify the same code segment as its base classes">;
3177def err_mismatched_code_seg_override : Error<
3178  "overriding virtual function must specify the same code segment as its overridden function">;
3179def err_conflicting_codeseg_attribute : Error<
3180  "conflicting code segment specifiers">;
3181def warn_duplicate_codeseg_attribute : Warning<
3182  "duplicate code segment specifiers">, InGroup<Section>;
3183
3184def err_anonymous_property: Error<
3185  "anonymous property is not supported">;
3186def err_property_is_variably_modified : Error<
3187  "property %0 has a variably modified type">;
3188def err_no_accessor_for_property : Error<
3189  "no %select{getter|setter}0 defined for property %1">;
3190def err_cannot_find_suitable_accessor : Error<
3191  "cannot find suitable %select{getter|setter}0 for property %1">;
3192
3193def warn_alloca : Warning<
3194  "use of function %0 is discouraged; there is no way to check for failure but "
3195  "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3196  InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3197
3198def warn_alloca_align_alignof : Warning<
3199  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3200  InGroup<DiagGroup<"alloca-with-align-alignof">>;
3201
3202def err_alignment_too_small : Error<
3203  "requested alignment must be %0 or greater">;
3204def err_alignment_too_big : Error<
3205  "requested alignment must be %0 or smaller">;
3206def err_alignment_not_power_of_two : Error<
3207  "requested alignment is not a power of 2">;
3208def warn_alignment_not_power_of_two : Warning<
3209  err_alignment_not_power_of_two.Text>,
3210  InGroup<DiagGroup<"non-power-of-two-alignment">>;
3211def err_alignment_dependent_typedef_name : Error<
3212  "requested alignment is dependent but declaration is not dependent">;
3213
3214def warn_alignment_builtin_useless : Warning<
3215  "%select{aligning a value|the result of checking whether a value is aligned}0"
3216  " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3217def err_attribute_aligned_too_great : Error<
3218  "requested alignment must be %0 bytes or smaller">;
3219def warn_assume_aligned_too_great
3220    : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3221              "alignment assumed">,
3222      InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3223def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3224  "%q0 redeclared without %1 attribute: previous %1 ignored">,
3225  InGroup<MicrosoftInconsistentDllImport>;
3226def warn_redeclaration_without_import_attribute : Warning<
3227  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3228  InGroup<MicrosoftInconsistentDllImport>;
3229def warn_dllimport_dropped_from_inline_function : Warning<
3230  "%q0 redeclared inline; %1 attribute ignored">,
3231  InGroup<IgnoredAttributes>;
3232def warn_attribute_ignored : Warning<"%0 attribute ignored">,
3233  InGroup<IgnoredAttributes>;
3234def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3235  " exception specification; attribute ignored">,
3236  InGroup<IgnoredAttributes>;
3237def warn_attribute_ignored_on_non_definition :
3238  Warning<"%0 attribute ignored on a non-definition declaration">,
3239  InGroup<IgnoredAttributes>;
3240def warn_attribute_ignored_on_inline :
3241  Warning<"%0 attribute ignored on inline function">,
3242  InGroup<IgnoredAttributes>;
3243def warn_nocf_check_attribute_ignored :
3244  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3245  InGroup<IgnoredAttributes>;
3246def warn_attribute_after_definition_ignored : Warning<
3247  "attribute %0 after definition is ignored">,
3248   InGroup<IgnoredAttributes>;
3249def warn_attributes_likelihood_ifstmt_conflict
3250    : Warning<"conflicting attributes %0 are ignored">,
3251      InGroup<IgnoredAttributes>;
3252def warn_cxx11_gnu_attribute_on_type : Warning<
3253  "attribute %0 ignored, because it cannot be applied to a type">,
3254  InGroup<IgnoredAttributes>;
3255def warn_unhandled_ms_attribute_ignored : Warning<
3256  "__declspec attribute %0 is not supported">,
3257  InGroup<IgnoredAttributes>;
3258def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3259  "attribute %0 has no effect when annotating an infinite loop">,
3260   InGroup<IgnoredAttributes>;
3261def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3262  "annotating the infinite loop here">;
3263def warn_attribute_has_no_effect_on_if_constexpr : Warning<
3264  "attribute %0 has no effect when annotating an 'if constexpr' statement">,
3265   InGroup<IgnoredAttributes>;
3266def note_attribute_has_no_effect_on_if_constexpr_here : Note<
3267  "annotating the 'if constexpr' statement here">;
3268def err_decl_attribute_invalid_on_stmt : Error<
3269  "%0 attribute cannot be applied to a statement">;
3270def err_stmt_attribute_invalid_on_decl : Error<
3271  "%0 attribute cannot be applied to a declaration">;
3272def warn_declspec_attribute_ignored : Warning<
3273  "attribute %0 is ignored, place it after "
3274  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
3275  "type declaration">, InGroup<IgnoredAttributes>;
3276def warn_attribute_precede_definition : Warning<
3277  "attribute declaration must precede definition">,
3278  InGroup<IgnoredAttributes>;
3279def warn_attribute_void_function_method : Warning<
3280  "attribute %0 cannot be applied to "
3281  "%select{functions|Objective-C method}1 without return value">,
3282  InGroup<IgnoredAttributes>;
3283def warn_attribute_weak_on_field : Warning<
3284  "__weak attribute cannot be specified on a field declaration">,
3285  InGroup<IgnoredAttributes>;
3286def warn_gc_attribute_weak_on_local : Warning<
3287  "Objective-C GC does not allow weak variables on the stack">,
3288  InGroup<IgnoredAttributes>;
3289def warn_nsobject_attribute : Warning<
3290  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3291  InGroup<NSobjectAttribute>;
3292def warn_independentclass_attribute : Warning<
3293  "'objc_independent_class' attribute may be put on a typedef only; "
3294  "attribute is ignored">,
3295  InGroup<IndependentClassAttribute>;
3296def warn_ptr_independentclass_attribute : Warning<
3297  "'objc_independent_class' attribute may be put on Objective-C object "
3298  "pointer type only; attribute is ignored">,
3299  InGroup<IndependentClassAttribute>;
3300def warn_attribute_weak_on_local : Warning<
3301  "__weak attribute cannot be specified on an automatic variable when ARC "
3302  "is not enabled">,
3303  InGroup<IgnoredAttributes>;
3304def warn_weak_identifier_undeclared : Warning<
3305  "weak identifier %0 never declared">;
3306def warn_attribute_cmse_entry_static : Warning<
3307  "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3308  InGroup<IgnoredAttributes>;
3309def warn_cmse_nonsecure_union : Warning<
3310  "passing union across security boundary via %select{parameter %1|return value}0 "
3311  "may leak information">,
3312  InGroup<DiagGroup<"cmse-union-leak">>;
3313def err_attribute_weak_static : Error<
3314  "weak declaration cannot have internal linkage">;
3315def err_attribute_selectany_non_extern_data : Error<
3316  "'selectany' can only be applied to data items with external linkage">;
3317def err_declspec_thread_on_thread_variable : Error<
3318  "'__declspec(thread)' applied to variable that already has a "
3319  "thread-local storage specifier">;
3320def err_attribute_dll_not_extern : Error<
3321  "%q0 must have external linkage when declared %q1">;
3322def err_attribute_dll_thread_local : Error<
3323  "%q0 cannot be thread local when declared %q1">;
3324def err_attribute_dll_lambda : Error<
3325  "lambda cannot be declared %0">;
3326def warn_attribute_invalid_on_definition : Warning<
3327  "'%0' attribute cannot be specified on a definition">,
3328  InGroup<IgnoredAttributes>;
3329def err_attribute_dll_redeclaration : Error<
3330  "redeclaration of %q0 cannot add %q1 attribute">;
3331def warn_attribute_dll_redeclaration : Warning<
3332  "redeclaration of %q0 should not add %q1 attribute">,
3333  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3334def err_attribute_dllimport_function_definition : Error<
3335  "dllimport cannot be applied to non-inline function definition">;
3336def err_attribute_dll_deleted : Error<
3337  "attribute %q0 cannot be applied to a deleted function">;
3338def err_attribute_dllimport_data_definition : Error<
3339  "definition of dllimport data">;
3340def err_attribute_dllimport_static_field_definition : Error<
3341  "definition of dllimport static field not allowed">;
3342def warn_attribute_dllimport_static_field_definition : Warning<
3343  "definition of dllimport static field">,
3344  InGroup<DiagGroup<"dllimport-static-field-def">>;
3345def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3346  "explicit instantiation declaration should not be 'dllexport'">,
3347  InGroup<DiagGroup<"dllexport-explicit-instantiation-decl">>;
3348def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3349  "'dllexport' attribute ignored on explicit instantiation definition">,
3350  InGroup<IgnoredAttributes>;
3351def warn_invalid_initializer_from_system_header : Warning<
3352  "invalid constructor from class in system header, should not be explicit">,
3353  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3354def note_used_in_initialization_here : Note<"used in initialization here">;
3355def err_attribute_dll_member_of_dll_class : Error<
3356  "attribute %q0 cannot be applied to member of %q1 class">;
3357def warn_attribute_dll_instantiated_base_class : Warning<
3358  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3359  "base class template without dll attribute is not supported">,
3360  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3361def err_attribute_dll_ambiguous_default_ctor : Error<
3362  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3363def err_attribute_weakref_not_static : Error<
3364  "weakref declaration must have internal linkage">;
3365def err_attribute_weakref_not_global_context : Error<
3366  "weakref declaration of %0 must be in a global context">;
3367def err_attribute_weakref_without_alias : Error<
3368  "weakref declaration of %0 must also have an alias attribute">;
3369def err_alias_not_supported_on_darwin : Error <
3370  "aliases are not supported on darwin">;
3371def warn_attribute_wrong_decl_type_str : Warning<
3372  "%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
3373def err_attribute_wrong_decl_type_str : Error<
3374  warn_attribute_wrong_decl_type_str.Text>;
3375def warn_attribute_wrong_decl_type : Warning<
3376  "%0 attribute only applies to %select{"
3377  "functions"
3378  "|unions"
3379  "|variables and functions"
3380  "|functions and methods"
3381  "|functions, methods and blocks"
3382  "|functions, methods, and parameters"
3383  "|variables"
3384  "|variables and fields"
3385  "|variables, data members and tag types"
3386  "|types and namespaces"
3387  "|variables, functions and classes"
3388  "|kernel functions"
3389  "|non-K&R-style functions}1">,
3390  InGroup<IgnoredAttributes>;
3391def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
3392def warn_type_attribute_wrong_type : Warning<
3393  "'%0' only applies to %select{function|pointer|"
3394  "Objective-C object or block pointer}1 types; type here is %2">,
3395  InGroup<IgnoredAttributes>;
3396def warn_incomplete_encoded_type : Warning<
3397  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3398  InGroup<DiagGroup<"encode-type">>;
3399def warn_gnu_inline_attribute_requires_inline : Warning<
3400  "'gnu_inline' attribute requires function to be marked 'inline',"
3401  " attribute ignored">,
3402  InGroup<IgnoredAttributes>;
3403def warn_gnu_inline_cplusplus_without_extern : Warning<
3404  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3405  " available, this changed in Clang 10">,
3406  InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3407def err_attribute_vecreturn_only_vector_member : Error<
3408  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3409def err_attribute_vecreturn_only_pod_record : Error<
3410  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3411def err_cconv_change : Error<
3412  "function declared '%0' here was previously declared "
3413  "%select{'%2'|without calling convention}1">;
3414def warn_cconv_unsupported : Warning<
3415  "%0 calling convention is not supported %select{"
3416  // Use CallingConventionIgnoredReason Enum to specify these.
3417  "for this target"
3418  "|on variadic function"
3419  "|on constructor/destructor"
3420  "|on builtin function"
3421  "}1">,
3422  InGroup<IgnoredAttributes>;
3423def error_cconv_unsupported : Error<warn_cconv_unsupported.Text>;
3424def err_cconv_knr : Error<
3425  "function with no prototype cannot use the %0 calling convention">;
3426def warn_cconv_knr : Warning<
3427  err_cconv_knr.Text>,
3428  InGroup<DiagGroup<"missing-prototype-for-cc">>;
3429def err_cconv_varargs : Error<
3430  "variadic function cannot use %0 calling convention">;
3431def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3432  "attribute was previously declared "
3433  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3434def err_function_attribute_mismatch : Error<
3435  "function declared with %0 attribute "
3436  "was previously declared without the %0 attribute">;
3437def err_objc_precise_lifetime_bad_type : Error<
3438  "objc_precise_lifetime only applies to retainable types; type here is %0">;
3439def warn_objc_precise_lifetime_meaningless : Error<
3440  "objc_precise_lifetime is not meaningful for "
3441  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3442def err_invalid_pcs : Error<"invalid PCS type">;
3443def warn_attribute_not_on_decl : Warning<
3444  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3445def err_base_specifier_attribute : Error<
3446  "%0 attribute cannot be applied to a base specifier">;
3447def err_invalid_attribute_on_virtual_function : Error<
3448  "%0 attribute cannot be applied to virtual functions">;
3449def warn_declspec_allocator_nonpointer : Warning<
3450  "ignoring __declspec(allocator) because the function return type %0 is not "
3451  "a pointer or reference type">, InGroup<IgnoredAttributes>;
3452def err_cconv_incomplete_param_type : Error<
3453  "parameter %0 must have a complete type to use function %1 with the %2 "
3454  "calling convention">;
3455def err_attribute_output_parameter : Error<
3456  "attribute only applies to output parameters">;
3457
3458def ext_cannot_use_trivial_abi : ExtWarn<
3459  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3460def note_cannot_use_trivial_abi_reason : Note<
3461  "'trivial_abi' is disallowed on %0 because %select{"
3462  "its copy constructors and move constructors are all deleted|"
3463  "it is polymorphic|"
3464  "it has a base of a non-trivial class type|it has a virtual base|"
3465  "it has a __weak field|it has a field of a non-trivial class type}1">;
3466
3467// Availability attribute
3468def warn_availability_unknown_platform : Warning<
3469  "unknown platform %0 in availability macro">, InGroup<Availability>;
3470def warn_availability_version_ordering : Warning<
3471  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3472  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3473  "attribute ignored">, InGroup<Availability>;
3474def warn_mismatched_availability: Warning<
3475  "availability does not match previous declaration">, InGroup<Availability>;
3476def warn_mismatched_availability_override : Warning<
3477  "%select{|overriding }4method %select{introduced after|"
3478  "deprecated before|obsoleted before}0 "
3479  "%select{the protocol method it implements|overridden method}4 "
3480  "on %1 (%2 vs. %3)">, InGroup<Availability>;
3481def warn_mismatched_availability_override_unavail : Warning<
3482  "%select{|overriding }1method cannot be unavailable on %0 when "
3483  "%select{the protocol method it implements|its overridden method}1 is "
3484  "available">,
3485  InGroup<Availability>;
3486def warn_availability_on_static_initializer : Warning<
3487  "ignoring availability attribute %select{on '+load' method|"
3488  "with constructor attribute|with destructor attribute}0">,
3489  InGroup<Availability>;
3490def note_overridden_method : Note<
3491  "overridden method is here">;
3492def warn_availability_swift_unavailable_deprecated_only : Warning<
3493  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3494  InGroup<Availability>;
3495def note_protocol_method : Note<
3496  "protocol method is here">;
3497
3498def warn_unguarded_availability :
3499  Warning<"%0 is only available on %1 %2 or newer">,
3500  InGroup<UnguardedAvailability>, DefaultIgnore;
3501def warn_unguarded_availability_new :
3502  Warning<warn_unguarded_availability.Text>,
3503  InGroup<UnguardedAvailabilityNew>;
3504def note_decl_unguarded_availability_silence : Note<
3505  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3506def note_unguarded_available_silence : Note<
3507  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3508  " this warning">;
3509def warn_at_available_unchecked_use : Warning<
3510  "%select{@available|__builtin_available}0 does not guard availability here; "
3511  "use if (%select{@available|__builtin_available}0) instead">,
3512  InGroup<DiagGroup<"unsupported-availability-guard">>;
3513
3514// Thread Safety Attributes
3515def warn_thread_attribute_ignored : Warning<
3516  "ignoring %0 attribute because its argument is invalid">,
3517  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3518def warn_thread_attribute_not_on_non_static_member : Warning<
3519  "%0 attribute without capability arguments can only be applied to non-static "
3520  "methods of a class">,
3521  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3522def warn_thread_attribute_not_on_capability_member : Warning<
3523  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3524  "annotated with 'capability' or 'scoped_lockable' attribute">,
3525  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3526def warn_thread_attribute_argument_not_lockable : Warning<
3527  "%0 attribute requires arguments whose type is annotated "
3528  "with 'capability' attribute; type here is %1">,
3529  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3530def warn_thread_attribute_decl_not_lockable : Warning<
3531  "%0 attribute can only be applied in a context annotated "
3532  "with 'capability' attribute">,
3533  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3534def warn_thread_attribute_decl_not_pointer : Warning<
3535  "%0 only applies to pointer types; type here is %1">,
3536  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3537def err_attribute_argument_out_of_bounds_extra_info : Error<
3538  "%0 attribute parameter %1 is out of bounds: "
3539  "%plural{0:no parameters to index into|"
3540  "1:can only be 1, since there is one parameter|"
3541  ":must be between 1 and %2}2">;
3542
3543// Thread Safety Analysis
3544def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3545  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3546def warn_unlock_kind_mismatch : Warning<
3547  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3548  "%select{shared|exclusive}3 access">,
3549  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3550def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3551  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3552def warn_no_unlock : Warning<
3553  "%0 '%1' is still held at the end of function">,
3554  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3555def warn_expecting_locked : Warning<
3556  "expecting %0 '%1' to be held at the end of function">,
3557  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3558// FIXME: improve the error message about locks not in scope
3559def warn_lock_some_predecessors : Warning<
3560  "%0 '%1' is not held on every path through here">,
3561  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3562def warn_expecting_lock_held_on_loop : Warning<
3563  "expecting %0 '%1' to be held at start of each loop">,
3564  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3565def note_locked_here : Note<"%0 acquired here">;
3566def note_unlocked_here : Note<"%0 released here">;
3567def warn_lock_exclusive_and_shared : Warning<
3568  "%0 '%1' is acquired exclusively and shared in the same scope">,
3569  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3570def note_lock_exclusive_and_shared : Note<
3571  "the other acquisition of %0 '%1' is here">;
3572def warn_variable_requires_any_lock : Warning<
3573  "%select{reading|writing}1 variable %0 requires holding "
3574  "%select{any mutex|any mutex exclusively}1">,
3575  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3576def warn_var_deref_requires_any_lock : Warning<
3577  "%select{reading|writing}1 the value pointed to by %0 requires holding "
3578  "%select{any mutex|any mutex exclusively}1">,
3579  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3580def warn_fun_excludes_mutex : Warning<
3581  "cannot call function '%1' while %0 '%2' is held">,
3582  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3583def warn_cannot_resolve_lock : Warning<
3584  "cannot resolve lock expression">,
3585  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3586def warn_acquired_before : Warning<
3587  "%0 '%1' must be acquired before '%2'">,
3588  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3589def warn_acquired_before_after_cycle : Warning<
3590  "Cycle in acquired_before/after dependencies, starting with '%0'">,
3591  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3592
3593
3594// Thread safety warnings negative capabilities
3595def warn_acquire_requires_negative_cap : Warning<
3596  "acquiring %0 '%1' requires negative capability '%2'">,
3597  InGroup<ThreadSafetyNegative>, DefaultIgnore;
3598def warn_fun_requires_negative_cap : Warning<
3599  "calling function %0 requires negative capability '%1'">,
3600  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3601
3602// Thread safety warnings on pass by reference
3603def warn_guarded_pass_by_reference : Warning<
3604  "passing variable %1 by reference requires holding %0 "
3605  "%select{'%2'|'%2' exclusively}3">,
3606  InGroup<ThreadSafetyReference>, DefaultIgnore;
3607def warn_pt_guarded_pass_by_reference : Warning<
3608  "passing the value that %1 points to by reference requires holding %0 "
3609  "%select{'%2'|'%2' exclusively}3">,
3610  InGroup<ThreadSafetyReference>, DefaultIgnore;
3611
3612// Imprecise thread safety warnings
3613def warn_variable_requires_lock : Warning<
3614  "%select{reading|writing}3 variable %1 requires holding %0 "
3615  "%select{'%2'|'%2' exclusively}3">,
3616  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3617def warn_var_deref_requires_lock : Warning<
3618  "%select{reading|writing}3 the value pointed to by %1 requires "
3619  "holding %0 %select{'%2'|'%2' exclusively}3">,
3620  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3621def warn_fun_requires_lock : Warning<
3622  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3623  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3624
3625// Precise thread safety warnings
3626def warn_variable_requires_lock_precise :
3627  Warning<warn_variable_requires_lock.Text>,
3628  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3629def warn_var_deref_requires_lock_precise :
3630  Warning<warn_var_deref_requires_lock.Text>,
3631  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3632def warn_fun_requires_lock_precise :
3633  Warning<warn_fun_requires_lock.Text>,
3634  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3635def note_found_mutex_near_match : Note<"found near match '%0'">;
3636
3637// Verbose thread safety warnings
3638def warn_thread_safety_verbose : Warning<"thread safety verbose warning">,
3639  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3640def note_thread_warning_in_fun : Note<"thread warning in function %0">;
3641def note_guarded_by_declared_here : Note<"guarded_by declared here">;
3642
3643// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3644def warn_thread_safety_beta : Warning<"thread safety beta warning">,
3645  InGroup<ThreadSafetyBeta>, DefaultIgnore;
3646
3647// Consumed warnings
3648def warn_use_in_invalid_state : Warning<
3649  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3650  "state">, InGroup<Consumed>, DefaultIgnore;
3651def warn_use_of_temp_in_invalid_state : Warning<
3652  "invalid invocation of method '%0' on a temporary object while it is in the "
3653  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3654def warn_attr_on_unconsumable_class : Warning<
3655  "consumed analysis attribute is attached to member of class %0 which isn't "
3656  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3657def warn_return_typestate_for_unconsumable_type : Warning<
3658  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3659  DefaultIgnore;
3660def warn_return_typestate_mismatch : Warning<
3661  "return value not in expected state; expected '%0', observed '%1'">,
3662  InGroup<Consumed>, DefaultIgnore;
3663def warn_loop_state_mismatch : Warning<
3664  "state of variable '%0' must match at the entry and exit of loop">,
3665  InGroup<Consumed>, DefaultIgnore;
3666def warn_param_return_typestate_mismatch : Warning<
3667  "parameter '%0' not in expected state when the function returns: expected "
3668  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3669def warn_param_typestate_mismatch : Warning<
3670  "argument not in expected state; expected '%0', observed '%1'">,
3671  InGroup<Consumed>, DefaultIgnore;
3672
3673// no_sanitize attribute
3674def warn_unknown_sanitizer_ignored : Warning<
3675  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3676
3677def warn_impcast_vector_scalar : Warning<
3678  "implicit conversion turns vector to scalar: %0 to %1">,
3679  InGroup<Conversion>, DefaultIgnore;
3680def warn_impcast_complex_scalar : Warning<
3681  "implicit conversion discards imaginary component: %0 to %1">,
3682  InGroup<Conversion>, DefaultIgnore;
3683def err_impcast_complex_scalar : Error<
3684  "implicit conversion from %0 to %1 is not permitted in C++">;
3685def warn_impcast_float_precision : Warning<
3686  "implicit conversion loses floating-point precision: %0 to %1">,
3687  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3688def warn_impcast_float_result_precision : Warning<
3689  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3690  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3691def warn_impcast_double_promotion : Warning<
3692  "implicit conversion increases floating-point precision: %0 to %1">,
3693  InGroup<DoublePromotion>, DefaultIgnore;
3694def warn_impcast_integer_sign : Warning<
3695  "implicit conversion changes signedness: %0 to %1">,
3696  InGroup<SignConversion>, DefaultIgnore;
3697def warn_impcast_integer_sign_conditional : Warning<
3698  "operand of ? changes signedness: %0 to %1">,
3699  InGroup<SignConversion>, DefaultIgnore;
3700def warn_impcast_integer_precision : Warning<
3701  "implicit conversion loses integer precision: %0 to %1">,
3702  InGroup<ImplicitIntConversion>, DefaultIgnore;
3703def warn_impcast_high_order_zero_bits : Warning<
3704  "higher order bits are zeroes after implicit conversion">,
3705  InGroup<ImplicitIntConversion>, DefaultIgnore;
3706def warn_impcast_nonnegative_result : Warning<
3707  "the resulting value is always non-negative after implicit conversion">,
3708  InGroup<SignConversion>, DefaultIgnore;
3709def warn_impcast_integer_64_32 : Warning<
3710  "implicit conversion loses integer precision: %0 to %1">,
3711  InGroup<Shorten64To32>, DefaultIgnore;
3712def warn_impcast_integer_precision_constant : Warning<
3713  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3714  InGroup<ConstantConversion>;
3715def warn_impcast_bitfield_precision_constant : Warning<
3716  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3717  InGroup<BitFieldConstantConversion>;
3718def warn_impcast_constant_value_to_objc_bool : Warning<
3719  "implicit conversion from constant value %0 to 'BOOL'; "
3720  "the only well defined values for 'BOOL' are YES and NO">,
3721  InGroup<ObjCBoolConstantConversion>;
3722
3723def warn_impcast_fixed_point_range : Warning<
3724  "implicit conversion from %0 cannot fit within the range of values for %1">,
3725  InGroup<ImplicitFixedPointConversion>;
3726
3727def warn_impcast_literal_float_to_integer : Warning<
3728  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3729  InGroup<LiteralConversion>;
3730def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3731  "implicit conversion of out of range value from %0 to %1 is undefined">,
3732  InGroup<LiteralConversion>;
3733def warn_impcast_float_integer : Warning<
3734  "implicit conversion turns floating-point number into integer: %0 to %1">,
3735  InGroup<FloatConversion>, DefaultIgnore;
3736def warn_impcast_float_to_objc_signed_char_bool : Warning<
3737  "implicit conversion from floating-point type %0 to 'BOOL'">,
3738  InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
3739def warn_impcast_int_to_objc_signed_char_bool : Warning<
3740  "implicit conversion from integral type %0 to 'BOOL'">,
3741  InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
3742
3743// Implicit int -> float conversion precision loss warnings.
3744def warn_impcast_integer_float_precision : Warning<
3745  "implicit conversion from %0 to %1 may lose precision">,
3746  InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
3747def warn_impcast_integer_float_precision_constant : Warning<
3748  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3749  InGroup<ImplicitConstIntFloatConversion>;
3750
3751def warn_impcast_float_to_integer : Warning<
3752  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3753  InGroup<FloatOverflowConversion>, DefaultIgnore;
3754def warn_impcast_float_to_integer_out_of_range : Warning<
3755  "implicit conversion of out of range value from %0 to %1 is undefined">,
3756  InGroup<FloatOverflowConversion>, DefaultIgnore;
3757def warn_impcast_float_to_integer_zero : Warning<
3758  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3759  InGroup<FloatZeroConversion>, DefaultIgnore;
3760
3761def warn_impcast_string_literal_to_bool : Warning<
3762  "implicit conversion turns string literal into bool: %0 to %1">,
3763  InGroup<StringConversion>, DefaultIgnore;
3764def warn_impcast_different_enum_types : Warning<
3765  "implicit conversion from enumeration type %0 to different enumeration type "
3766  "%1">, InGroup<EnumConversion>;
3767def warn_impcast_bool_to_null_pointer : Warning<
3768    "initialization of pointer of type %0 to null from a constant boolean "
3769    "expression">, InGroup<BoolConversion>;
3770def warn_non_literal_null_pointer : Warning<
3771    "expression which evaluates to zero treated as a null pointer constant of "
3772    "type %0">, InGroup<NonLiteralNullConversion>;
3773def warn_pointer_compare : Warning<
3774    "comparing a pointer to a null character constant; did you mean "
3775    "to compare to %select{NULL|(void *)0}0?">,
3776    InGroup<DiagGroup<"pointer-compare">>;
3777def warn_impcast_null_pointer_to_integer : Warning<
3778    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
3779    InGroup<NullConversion>;
3780def warn_impcast_floating_point_to_bool : Warning<
3781    "implicit conversion turns floating-point number into bool: %0 to %1">,
3782    InGroup<ImplicitConversionFloatingPointToBool>;
3783def ext_ms_impcast_fn_obj : ExtWarn<
3784  "implicit conversion between pointer-to-function and pointer-to-object is a "
3785  "Microsoft extension">, InGroup<MicrosoftCast>;
3786
3787def warn_impcast_pointer_to_bool : Warning<
3788    "address of%select{| function| array}0 '%1' will always evaluate to "
3789    "'true'">,
3790    InGroup<PointerBoolConversion>;
3791def warn_cast_nonnull_to_bool : Warning<
3792    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
3793    "'true' on first encounter">,
3794    InGroup<PointerBoolConversion>;
3795def warn_this_bool_conversion : Warning<
3796  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
3797  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
3798def warn_address_of_reference_bool_conversion : Warning<
3799  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3800  "code; pointer may be assumed to always convert to true">,
3801  InGroup<UndefinedBoolConversion>;
3802
3803def warn_xor_used_as_pow : Warning<
3804  "result of '%0' is %1; did you mean exponentiation?">,
3805  InGroup<XorUsedAsPow>;
3806def warn_xor_used_as_pow_base_extra : Warning<
3807  "result of '%0' is %1; did you mean '%2' (%3)?">,
3808  InGroup<XorUsedAsPow>;
3809def warn_xor_used_as_pow_base : Warning<
3810  "result of '%0' is %1; did you mean '%2'?">,
3811  InGroup<XorUsedAsPow>;
3812def note_xor_used_as_pow_silence : Note<
3813  "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
3814
3815def warn_null_pointer_compare : Warning<
3816    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
3817    "equal to a null pointer is always %select{true|false}2">,
3818    InGroup<TautologicalPointerCompare>;
3819def warn_nonnull_expr_compare : Warning<
3820    "comparison of nonnull %select{function call|parameter}0 '%1' "
3821    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
3822    "encounter">,
3823    InGroup<TautologicalPointerCompare>;
3824def warn_this_null_compare : Warning<
3825  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
3826  "assumed to always evaluate to %select{true|false}0">,
3827  InGroup<TautologicalUndefinedCompare>;
3828def warn_address_of_reference_null_compare : Warning<
3829  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3830  "code; comparison may be assumed to always evaluate to "
3831  "%select{true|false}0">,
3832  InGroup<TautologicalUndefinedCompare>;
3833def note_reference_is_return_value : Note<"%0 returns a reference">;
3834
3835def note_pointer_declared_here : Note<
3836  "pointer %0 declared here">;
3837def warn_division_sizeof_ptr : Warning<
3838  "'%0' will return the size of the pointer, not the array itself">,
3839  InGroup<DiagGroup<"sizeof-pointer-div">>;
3840def warn_division_sizeof_array : Warning<
3841  "expression does not compute the number of elements in this array; element "
3842  "type is %0, not %1">,
3843  InGroup<DiagGroup<"sizeof-array-div">>;
3844
3845def note_function_warning_silence : Note<
3846    "prefix with the address-of operator to silence this warning">;
3847def note_function_to_function_call : Note<
3848    "suffix with parentheses to turn this into a function call">;
3849def warn_impcast_objective_c_literal_to_bool : Warning<
3850    "implicit boolean conversion of Objective-C object literal always "
3851    "evaluates to true">,
3852    InGroup<ObjCLiteralConversion>;
3853
3854def warn_cast_align : Warning<
3855  "cast from %0 to %1 increases required alignment from %2 to %3">,
3856  InGroup<CastAlign>, DefaultIgnore;
3857def warn_old_style_cast : Warning<
3858  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore;
3859
3860// Separate between casts to void* and non-void* pointers.
3861// Some APIs use (abuse) void* for something like a user context,
3862// and often that value is an integer even if it isn't a pointer itself.
3863// Having a separate warning flag allows users to control the warning
3864// for their workflow.
3865def warn_int_to_pointer_cast : Warning<
3866  "cast to %1 from smaller integer type %0">,
3867  InGroup<IntToPointerCast>;
3868def warn_int_to_void_pointer_cast : Warning<
3869  "cast to %1 from smaller integer type %0">,
3870  InGroup<IntToVoidPointerCast>;
3871def warn_pointer_to_int_cast : Warning<
3872  "cast to smaller integer type %1 from %0">,
3873  InGroup<PointerToIntCast>;
3874def warn_pointer_to_enum_cast : Warning<
3875  warn_pointer_to_int_cast.Text>,
3876  InGroup<PointerToEnumCast>;
3877def warn_void_pointer_to_int_cast : Warning<
3878  "cast to smaller integer type %1 from %0">,
3879  InGroup<VoidPointerToIntCast>;
3880def warn_void_pointer_to_enum_cast : Warning<
3881  warn_void_pointer_to_int_cast.Text>,
3882  InGroup<VoidPointerToEnumCast>;
3883
3884def warn_attribute_ignored_for_field_of_type : Warning<
3885  "%0 attribute ignored for field of type %1">,
3886  InGroup<IgnoredAttributes>;
3887def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
3888  "enums in the Microsoft ABI are signed integers by default; consider giving "
3889  "the enum %0 an unsigned underlying type to make this code portable">,
3890  InGroup<SignedEnumBitfield>, DefaultIgnore;
3891def warn_attribute_packed_for_bitfield : Warning<
3892  "'packed' attribute was ignored on bit-fields with single-byte alignment "
3893  "in older versions of GCC and Clang">,
3894  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
3895def warn_transparent_union_attribute_field_size_align : Warning<
3896  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
3897  "%select{alignment|size}0 of the first field in transparent union; "
3898  "transparent_union attribute ignored">,
3899  InGroup<IgnoredAttributes>;
3900def note_transparent_union_first_field_size_align : Note<
3901  "%select{alignment|size}0 of first field is %1 bits">;
3902def warn_transparent_union_attribute_not_definition : Warning<
3903  "transparent_union attribute can only be applied to a union definition; "
3904  "attribute ignored">,
3905  InGroup<IgnoredAttributes>;
3906def warn_transparent_union_attribute_floating : Warning<
3907  "first field of a transparent union cannot have %select{floating point|"
3908  "vector}0 type %1; transparent_union attribute ignored">,
3909  InGroup<IgnoredAttributes>;
3910def warn_transparent_union_attribute_zero_fields : Warning<
3911  "transparent union definition must contain at least one field; "
3912  "transparent_union attribute ignored">,
3913  InGroup<IgnoredAttributes>;
3914def warn_attribute_type_not_supported : Warning<
3915  "%0 attribute argument not supported: %1">,
3916  InGroup<IgnoredAttributes>;
3917def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
3918  InGroup<IgnoredAttributes>;
3919def warn_attribute_protected_visibility :
3920  Warning<"target does not support 'protected' visibility; using 'default'">,
3921  InGroup<DiagGroup<"unsupported-visibility">>;
3922def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
3923def note_previous_attribute : Note<"previous attribute is here">;
3924def note_conflicting_attribute : Note<"conflicting attribute is here">;
3925def note_attribute : Note<"attribute is here">;
3926def err_mismatched_ms_inheritance : Error<
3927  "inheritance model does not match %select{definition|previous declaration}0">;
3928def warn_ignored_ms_inheritance : Warning<
3929  "inheritance model ignored on %select{primary template|partial specialization}0">,
3930  InGroup<IgnoredAttributes>;
3931def note_previous_ms_inheritance : Note<
3932  "previous inheritance model specified here">;
3933def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
3934def err_mode_not_primitive : Error<
3935  "mode attribute only supported for integer and floating-point types">;
3936def err_mode_wrong_type : Error<
3937  "type of machine mode does not match type of base type">;
3938def warn_vector_mode_deprecated : Warning<
3939  "specifying vector types with the 'mode' attribute is deprecated; "
3940  "use the 'vector_size' attribute instead">,
3941  InGroup<DeprecatedAttributes>;
3942def err_complex_mode_vector_type : Error<
3943  "type of machine mode does not support base vector types">;
3944def err_enum_mode_vector_type : Error<
3945  "mode %0 is not supported for enumeration types">;
3946def warn_attribute_nonnull_no_pointers : Warning<
3947  "'nonnull' attribute applied to function with no pointer arguments">,
3948  InGroup<IgnoredAttributes>;
3949def warn_attribute_nonnull_parm_no_args : Warning<
3950  "'nonnull' attribute when used on parameters takes no arguments">,
3951  InGroup<IgnoredAttributes>;
3952def note_declared_nonnull : Note<
3953  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
3954def warn_attribute_sentinel_named_arguments : Warning<
3955  "'sentinel' attribute requires named arguments">,
3956  InGroup<IgnoredAttributes>;
3957def warn_attribute_sentinel_not_variadic : Warning<
3958  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
3959  InGroup<IgnoredAttributes>;
3960def err_attribute_sentinel_less_than_zero : Error<
3961  "'sentinel' parameter 1 less than zero">;
3962def err_attribute_sentinel_not_zero_or_one : Error<
3963  "'sentinel' parameter 2 not 0 or 1">;
3964def warn_cleanup_ext : Warning<
3965  "GCC does not allow the 'cleanup' attribute argument to be anything other "
3966  "than a simple identifier">,
3967  InGroup<GccCompat>;
3968def err_attribute_cleanup_arg_not_function : Error<
3969  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
3970def err_attribute_cleanup_func_must_take_one_arg : Error<
3971  "'cleanup' function %0 must take 1 parameter">;
3972def err_attribute_cleanup_func_arg_incompatible_type : Error<
3973  "'cleanup' function %0 parameter has "
3974  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
3975def err_attribute_regparm_wrong_platform : Error<
3976  "'regparm' is not valid on this platform">;
3977def err_attribute_regparm_invalid_number : Error<
3978  "'regparm' parameter must be between 0 and %0 inclusive">;
3979def err_attribute_not_supported_in_lang : Error<
3980  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
3981def err_attribute_not_supported_on_arch
3982    : Error<"%0 attribute is not supported on '%1'">;
3983def warn_gcc_ignores_type_attr : Warning<
3984  "GCC does not allow the %0 attribute to be written on a type">,
3985  InGroup<GccCompat>;
3986
3987// Clang-Specific Attributes
3988def warn_attribute_iboutlet : Warning<
3989  "%0 attribute can only be applied to instance variables or properties">,
3990  InGroup<IgnoredAttributes>;
3991def err_iboutletcollection_type : Error<
3992  "invalid type %0 as argument of iboutletcollection attribute">;
3993def err_iboutletcollection_builtintype : Error<
3994  "type argument of iboutletcollection attribute cannot be a builtin type">;
3995def warn_iboutlet_object_type : Warning<
3996  "%select{instance variable|property}2 with %0 attribute must "
3997  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
3998def warn_iboutletcollection_property_assign : Warning<
3999  "IBOutletCollection properties should be copy/strong and not assign">,
4000  InGroup<ObjCInvalidIBOutletProperty>;
4001
4002def err_attribute_overloadable_mismatch : Error<
4003  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
4004def note_attribute_overloadable_prev_overload : Note<
4005  "previous %select{unmarked |}0overload of function is here">;
4006def err_attribute_overloadable_no_prototype : Error<
4007  "'overloadable' function %0 must have a prototype">;
4008def err_attribute_overloadable_multiple_unmarked_overloads : Error<
4009  "at most one overload for a given name may lack the 'overloadable' "
4010  "attribute">;
4011def warn_attribute_no_builtin_invalid_builtin_name : Warning<
4012  "'%0' is not a valid builtin name for %1">,
4013  InGroup<DiagGroup<"invalid-no-builtin-names">>;
4014def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
4015  "empty %0 cannot be composed with named ones">;
4016def err_attribute_no_builtin_on_non_definition : Error<
4017  "%0 attribute is permitted on definitions only">;
4018def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
4019  "%0 attribute has no effect on defaulted or deleted functions">;
4020def warn_ns_attribute_wrong_return_type : Warning<
4021  "%0 attribute only applies to %select{functions|methods|properties}1 that "
4022  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
4023  InGroup<IgnoredAttributes>;
4024def err_ns_attribute_wrong_parameter_type : Error<
4025  "%0 attribute only applies to "
4026  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
4027def warn_ns_attribute_wrong_parameter_type : Warning<
4028  "%0 attribute only applies to "
4029  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
4030  InGroup<IgnoredAttributes>;
4031def warn_objc_requires_super_protocol : Warning<
4032  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
4033  InGroup<DiagGroup<"requires-super-attribute">>;
4034def note_protocol_decl : Note<
4035  "protocol is declared here">;
4036def note_protocol_decl_undefined : Note<
4037  "protocol %0 has no definition">;
4038def err_attribute_preferred_name_arg_invalid : Error<
4039  "argument %0 to 'preferred_name' attribute is not a typedef for "
4040  "a specialization of %1">;
4041def err_attribute_builtin_alias : Error<
4042  "%0 attribute can only be applied to a ARM or RISC-V builtin">;
4043
4044// called-once attribute diagnostics.
4045def err_called_once_attribute_wrong_type : Error<
4046  "'called_once' attribute only applies to function-like parameters">;
4047
4048def warn_completion_handler_never_called : Warning<
4049  "%select{|captured }1completion handler is never called">,
4050  InGroup<CompletionHandler>, DefaultIgnore;
4051def warn_called_once_never_called : Warning<
4052  "%select{|captured }1%0 parameter marked 'called_once' is never called">,
4053  InGroup<CalledOnceParameter>;
4054
4055def warn_completion_handler_never_called_when : Warning<
4056  "completion handler is never %select{used|called}1 when "
4057  "%select{taking true branch|taking false branch|"
4058  "handling this case|none of the cases applies|"
4059  "entering the loop|skipping the loop|taking one of the branches}2">,
4060  InGroup<CompletionHandler>, DefaultIgnore;
4061def warn_called_once_never_called_when : Warning<
4062  "%0 parameter marked 'called_once' is never %select{used|called}1 when "
4063  "%select{taking true branch|taking false branch|"
4064  "handling this case|none of the cases applies|"
4065  "entering the loop|skipping the loop|taking one of the branches}2">,
4066  InGroup<CalledOnceParameter>;
4067
4068def warn_completion_handler_called_twice : Warning<
4069  "completion handler is called twice">,
4070  InGroup<CompletionHandler>, DefaultIgnore;
4071def warn_called_once_gets_called_twice : Warning<
4072  "%0 parameter marked 'called_once' is called twice">,
4073  InGroup<CalledOnceParameter>;
4074def note_called_once_gets_called_twice : Note<
4075  "previous call is here%select{; set to nil to indicate "
4076  "it cannot be called afterwards|}0">;
4077
4078// objc_designated_initializer attribute diagnostics.
4079def warn_objc_designated_init_missing_super_call : Warning<
4080  "designated initializer missing a 'super' call to a designated initializer of the super class">,
4081  InGroup<ObjCDesignatedInit>;
4082def note_objc_designated_init_marked_here : Note<
4083  "method marked as designated initializer of the class here">;
4084def warn_objc_designated_init_non_super_designated_init_call : Warning<
4085  "designated initializer should only invoke a designated initializer on 'super'">,
4086  InGroup<ObjCDesignatedInit>;
4087def warn_objc_designated_init_non_designated_init_call : Warning<
4088  "designated initializer invoked a non-designated initializer">,
4089  InGroup<ObjCDesignatedInit>;
4090def warn_objc_secondary_init_super_init_call : Warning<
4091  "convenience initializer should not invoke an initializer on 'super'">,
4092  InGroup<ObjCDesignatedInit>;
4093def warn_objc_secondary_init_missing_init_call : Warning<
4094  "convenience initializer missing a 'self' call to another initializer">,
4095  InGroup<ObjCDesignatedInit>;
4096def warn_objc_implementation_missing_designated_init_override : Warning<
4097  "method override for the designated initializer of the superclass %objcinstance0 not found">,
4098  InGroup<ObjCDesignatedInit>;
4099def err_designated_init_attr_non_init : Error<
4100  "'objc_designated_initializer' attribute only applies to init methods "
4101  "of interface or class extension declarations">;
4102
4103// objc_bridge attribute diagnostics.
4104def err_objc_attr_not_id : Error<
4105  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
4106def err_objc_attr_typedef_not_id : Error<
4107  "parameter of %0 attribute must be 'id' when used on a typedef">;
4108def err_objc_attr_typedef_not_void_pointer : Error<
4109  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
4110def err_objc_cf_bridged_not_interface : Error<
4111  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
4112def err_objc_ns_bridged_invalid_cfobject : Error<
4113  "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
4114def warn_objc_invalid_bridge : Warning<
4115  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
4116def warn_objc_invalid_bridge_to_cf : Warning<
4117  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
4118
4119// objc_bridge_related attribute diagnostics.
4120def err_objc_bridged_related_invalid_class : Error<
4121  "could not find Objective-C class %0 to convert %1 to %2">;
4122def err_objc_bridged_related_invalid_class_name : Error<
4123  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
4124def err_objc_bridged_related_known_method : Error<
4125 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
4126 "method for this conversion">;
4127
4128def err_objc_attr_protocol_requires_definition : Error<
4129  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
4130
4131// Swift attributes.
4132def warn_attr_swift_name_function
4133  : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
4134    InGroup<SwiftNameAttribute>;
4135def warn_attr_swift_name_invalid_identifier
4136  : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4137    InGroup<SwiftNameAttribute>;
4138def warn_attr_swift_name_decl_kind
4139  : Warning<"%0 attribute cannot be applied to this declaration">,
4140    InGroup<SwiftNameAttribute>;
4141def warn_attr_swift_name_subscript_invalid_parameter
4142  : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4143        "have at least one parameter|"
4144        "have a 'self:' parameter}1">,
4145    InGroup<SwiftNameAttribute>;
4146def warn_attr_swift_name_missing_parameters
4147  : Warning<"%0 attribute is missing parameter label clause">,
4148    InGroup<SwiftNameAttribute>;
4149def warn_attr_swift_name_setter_parameters
4150  : Warning<"%0 attribute for setter must have one parameter for new value">,
4151    InGroup<SwiftNameAttribute>;
4152def warn_attr_swift_name_multiple_selfs
4153  : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4154    InGroup<SwiftNameAttribute>;
4155def warn_attr_swift_name_getter_parameters
4156  : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4157    InGroup<SwiftNameAttribute>;
4158def warn_attr_swift_name_subscript_setter_no_newValue
4159  : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4160    InGroup<SwiftNameAttribute>;
4161def warn_attr_swift_name_subscript_setter_multiple_newValues
4162  : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4163    InGroup<SwiftNameAttribute>;
4164def warn_attr_swift_name_subscript_getter_newValue
4165  : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4166    InGroup<SwiftNameAttribute>;
4167def warn_attr_swift_name_num_params
4168  : Warning<"too %select{few|many}0 parameters in the signature specified by "
4169            "the %1 attribute (expected %2; got %3)">,
4170    InGroup<SwiftNameAttribute>;
4171def warn_attr_swift_name_decl_missing_params
4172  : Warning<"%0 attribute cannot be applied to a %select{function|method}1 "
4173            "with no parameters">,
4174    InGroup<SwiftNameAttribute>;
4175
4176def err_attr_swift_error_no_error_parameter : Error<
4177  "%0 attribute can only be applied to a %select{function|method}1 with an "
4178  "error parameter">;
4179def err_attr_swift_error_return_type : Error<
4180  "%0 attribute with '%1' convention can only be applied to a "
4181  "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4182
4183def err_swift_async_no_access : Error<
4184  "first argument to 'swift_async' must be either 'none', 'swift_private', or "
4185  "'not_swift_private'">;
4186def err_swift_async_bad_block_type : Error<
4187  "'swift_async' completion handler parameter must have block type returning"
4188  " 'void', type here is %0">;
4189
4190def err_swift_async_error_without_swift_async : Error<
4191  "%0 attribute must be applied to a %select{function|method}1 annotated "
4192  "with non-'none' attribute 'swift_async'">;
4193def err_swift_async_error_no_error_parameter : Error<
4194  "%0 attribute with 'nonnull_error' convention can only be applied to a "
4195  "%select{function|method}1 with a completion handler with an error "
4196  "parameter">;
4197def err_swift_async_error_non_integral : Error<
4198  "%0 attribute with '%1' convention must have an integral-typed parameter "
4199  "in completion handler at index %2, type here is %3">;
4200
4201def warn_ignored_objc_externally_retained : Warning<
4202  "'objc_externally_retained' can only be applied to local variables "
4203  "%select{of retainable type|with strong ownership}0">,
4204  InGroup<IgnoredAttributes>;
4205
4206// Function Parameter Semantic Analysis.
4207def err_param_with_void_type : Error<"argument may not have 'void' type">;
4208def err_void_only_param : Error<
4209  "'void' must be the first and only parameter if specified">;
4210def err_void_param_qualified : Error<
4211  "'void' as parameter must not have type qualifiers">;
4212def err_ident_list_in_fn_declaration : Error<
4213  "a parameter list without types is only allowed in a function definition">;
4214def ext_param_not_declared : Extension<
4215  "parameter %0 was not declared, defaulting to type 'int'">;
4216def err_param_default_argument : Error<
4217  "C does not support default arguments">;
4218def err_param_default_argument_redefinition : Error<
4219  "redefinition of default argument">;
4220def ext_param_default_argument_redefinition : ExtWarn<
4221  err_param_default_argument_redefinition.Text>,
4222  InGroup<MicrosoftDefaultArgRedefinition>;
4223def err_param_default_argument_missing : Error<
4224  "missing default argument on parameter">;
4225def err_param_default_argument_missing_name : Error<
4226  "missing default argument on parameter %0">;
4227def err_param_default_argument_references_param : Error<
4228  "default argument references parameter %0">;
4229def err_param_default_argument_references_local : Error<
4230  "default argument references local variable %0 of enclosing function">;
4231def err_param_default_argument_references_this : Error<
4232  "default argument references 'this'">;
4233def err_param_default_argument_nonfunc : Error<
4234  "default arguments can only be specified for parameters in a function "
4235  "declaration">;
4236def err_param_default_argument_template_redecl : Error<
4237  "default arguments cannot be added to a function template that has already "
4238  "been declared">;
4239def err_param_default_argument_member_template_redecl : Error<
4240  "default arguments cannot be added to an out-of-line definition of a member "
4241  "of a %select{class template|class template partial specialization|nested "
4242  "class in a template}0">;
4243def err_param_default_argument_on_parameter_pack : Error<
4244  "parameter pack cannot have a default argument">;
4245def err_uninitialized_member_for_assign : Error<
4246  "cannot define the implicit copy assignment operator for %0, because "
4247  "non-static %select{reference|const}1 member %2 cannot use copy "
4248  "assignment operator">;
4249def err_uninitialized_member_in_ctor : Error<
4250  "%select{constructor for %1|"
4251  "implicit default constructor for %1|"
4252  "cannot use constructor inherited from %1:}0 must explicitly "
4253  "initialize the %select{reference|const}2 member %3">;
4254def err_default_arg_makes_ctor_special : Error<
4255  "addition of default argument on redeclaration makes this constructor a "
4256  "%select{default|copy|move}0 constructor">;
4257
4258def err_use_of_default_argument_to_function_declared_later : Error<
4259  "use of default argument to function %0 that is declared later in class %1">;
4260def note_default_argument_declared_here : Note<
4261  "default argument declared here">;
4262def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4263def note_recursive_default_argument_used_here : Note<
4264  "default argument used here">;
4265
4266def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4267  "%diff{promoted type $ of K&R function parameter is not compatible with the "
4268  "parameter type $|promoted type of K&R function parameter is not compatible "
4269  "with parameter type}0,1 declared in a previous prototype">,
4270  InGroup<KNRPromotedParameter>;
4271
4272
4273// C++ Overloading Semantic Analysis.
4274def err_ovl_diff_return_type : Error<
4275  "functions that differ only in their return type cannot be overloaded">;
4276def err_ovl_static_nonstatic_member : Error<
4277  "static and non-static member functions with the same parameter types "
4278  "cannot be overloaded">;
4279
4280let Deferrable = 1 in {
4281
4282def err_ovl_no_viable_function_in_call : Error<
4283  "no matching function for call to %0">;
4284def err_ovl_no_viable_member_function_in_call : Error<
4285  "no matching member function for call to %0">;
4286def err_ovl_ambiguous_call : Error<
4287  "call to %0 is ambiguous">;
4288def err_ovl_deleted_call : Error<"call to deleted function %0">;
4289def err_ovl_ambiguous_member_call : Error<
4290  "call to member function %0 is ambiguous">;
4291def err_ovl_deleted_member_call : Error<
4292  "call to deleted member function %0">;
4293def note_ovl_too_many_candidates : Note<
4294    "remaining %0 candidate%s0 omitted; "
4295    "pass -fshow-overloads=all to show them">;
4296
4297def select_ovl_candidate_kind : TextSubstitution<
4298  "%select{function|function|function (with reversed parameter order)|"
4299    "constructor|"
4300    "constructor (the implicit default constructor)|"
4301    "constructor (the implicit copy constructor)|"
4302    "constructor (the implicit move constructor)|"
4303    "function (the implicit copy assignment operator)|"
4304    "function (the implicit move assignment operator)|"
4305    "function (the implicit 'operator==' for this 'operator<=>)'|"
4306    "inherited constructor}0%select{| template| %2}1">;
4307
4308def note_ovl_candidate : Note<
4309    "candidate %sub{select_ovl_candidate_kind}0,1,3"
4310    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4311    "| has different number of parameters (expected %5 but has %6)"
4312    "| has type mismatch at %ordinal5 parameter"
4313    "%diff{ (expected $ but has $)|}6,7"
4314    "| has different return type%diff{ ($ expected but has $)|}5,6"
4315    "| has different qualifiers (expected %5 but found %6)"
4316    "| has different exception specification}4">;
4317
4318def note_ovl_candidate_explicit : Note<
4319    "explicit %select{constructor|conversion function|deduction guide}0 "
4320    "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4321def note_ovl_candidate_inherited_constructor : Note<
4322    "constructor from base class %0 inherited here">;
4323def note_ovl_candidate_inherited_constructor_slice : Note<
4324    "candidate %select{constructor|template}0 ignored: "
4325    "inherited constructor cannot be used to %select{copy|move}1 object">;
4326def note_ovl_candidate_illegal_constructor : Note<
4327    "candidate %select{constructor|template}0 ignored: "
4328    "instantiation %select{takes|would take}0 its own class type by value">;
4329def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4330    "candidate constructor ignored: cannot be used to construct an object "
4331    "in address space %0">;
4332def note_ovl_candidate_bad_deduction : Note<
4333    "candidate template ignored: failed template argument deduction">;
4334def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4335    "couldn't infer template argument %0">;
4336def note_ovl_candidate_incomplete_deduction_pack : Note<
4337    "candidate template ignored: "
4338    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4339    "expanded parameter in deduced argument pack %2">;
4340def note_ovl_candidate_inconsistent_deduction : Note<
4341    "candidate template ignored: deduced %select{conflicting types|"
4342    "conflicting values|conflicting templates|packs of different lengths}0 "
4343    "for parameter %1%diff{ ($ vs. $)|}2,3">;
4344def note_ovl_candidate_inconsistent_deduction_types : Note<
4345    "candidate template ignored: deduced values %diff{"
4346    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4347    "%1 and %3 of conflicting types for parameter %0}2,4">;
4348def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4349    "candidate template ignored: invalid explicitly-specified argument "
4350    "for template parameter %0">;
4351def note_ovl_candidate_unsatisfied_constraints : Note<
4352    "candidate template ignored: constraints not satisfied%0">;
4353def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4354    "candidate template ignored: invalid explicitly-specified argument "
4355    "for %ordinal0 template parameter">;
4356def note_ovl_candidate_instantiation_depth : Note<
4357    "candidate template ignored: substitution exceeded maximum template "
4358    "instantiation depth">;
4359def note_ovl_candidate_underqualified : Note<
4360    "candidate template ignored: cannot deduce a type for %0 that would "
4361    "make %2 equal %1">;
4362def note_ovl_candidate_substitution_failure : Note<
4363    "candidate template ignored: substitution failure%0%1">;
4364def note_ovl_candidate_disabled_by_enable_if : Note<
4365    "candidate template ignored: disabled by %0%1">;
4366def note_ovl_candidate_disabled_by_requirement : Note<
4367    "candidate template ignored: requirement '%0' was not satisfied%1">;
4368def note_ovl_candidate_has_pass_object_size_params: Note<
4369    "candidate address cannot be taken because parameter %0 has "
4370    "pass_object_size attribute">;
4371def err_diagnose_if_succeeded : Error<"%0">;
4372def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4373    ShowInSystemHeader;
4374def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4375    "candidate disabled: %0">;
4376def err_addrof_function_disabled_by_enable_if_attr : Error<
4377    "cannot take address of function %0 because it has one or more "
4378    "non-tautological enable_if conditions">;
4379def err_addrof_function_constraints_not_satisfied : Error<
4380    "cannot take address of function %0 because its constraints are not "
4381    "satisfied">;
4382def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4383    "candidate function made ineligible by enable_if">;
4384def note_ovl_candidate_deduced_mismatch : Note<
4385    "candidate template ignored: deduced type "
4386    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4387    "adjusted type $ of %select{|element of }4argument"
4388    "|of %select{|element of }4%ordinal0 parameter does not match "
4389    "adjusted type of %select{|element of }4argument}1,2%3">;
4390def note_ovl_candidate_non_deduced_mismatch : Note<
4391    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4392// This note is needed because the above note would sometimes print two
4393// different types with the same name.  Remove this note when the above note
4394// can handle that case properly.
4395def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4396    "candidate template ignored: could not match %q0 against %q1">;
4397
4398// Note that we don't treat templates differently for this diagnostic.
4399def note_ovl_candidate_arity : Note<"candidate "
4400    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4401    "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
4402    "%plural{1:was|:were}5 provided">;
4403
4404def note_ovl_candidate_arity_one : Note<"candidate "
4405    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4406    "%select{requires at least|allows at most single|requires single}3 "
4407    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4408
4409def note_ovl_candidate_deleted : Note<
4410    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4411    "%select{explicitly made unavailable|explicitly deleted|"
4412    "implicitly deleted}3">;
4413
4414// Giving the index of the bad argument really clutters this message, and
4415// it's relatively unimportant because 1) it's generally obvious which
4416// argument(s) are of the given object type and 2) the fix is usually
4417// to complete the type, which doesn't involve changes to the call line
4418// anyway.  If people complain, we can change it.
4419def note_ovl_candidate_bad_conv_incomplete : Note<
4420    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4421    "cannot convert argument of incomplete type "
4422    "%diff{$ to $|to parameter type}3,4 for "
4423    "%select{%ordinal6 argument|object argument}5"
4424    "%select{|; dereference the argument with *|"
4425    "; take the address of the argument with &|"
4426    "; remove *|"
4427    "; remove &}7">;
4428def note_ovl_candidate_bad_list_argument : Note<
4429    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4430    "cannot convert initializer list argument to %4">;
4431def note_ovl_candidate_bad_overload : Note<
4432    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4433    "no overload of %4 matching %3 for %ordinal5 argument">;
4434def note_ovl_candidate_bad_conv : Note<
4435    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4436    "no known conversion "
4437    "%diff{from $ to $|from argument type to parameter type}3,4 for "
4438    "%select{%ordinal6 argument|object argument}5"
4439    "%select{|; dereference the argument with *|"
4440    "; take the address of the argument with &|"
4441    "; remove *|"
4442    "; remove &}7">;
4443def note_ovl_candidate_bad_arc_conv : Note<
4444    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4445    "cannot implicitly convert argument "
4446    "%diff{of type $ to $|type to parameter type}3,4 for "
4447    "%select{%ordinal6 argument|object argument}5 under ARC">;
4448def note_ovl_candidate_bad_value_category : Note<
4449    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4450    "expects an %select{lvalue|rvalue}5 for "
4451    "%select{%ordinal4 argument|object argument}3">;
4452def note_ovl_candidate_bad_addrspace : Note<
4453    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4454    "cannot %select{pass pointer to|bind reference in}5 %3 "
4455    "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4456    "argument">;
4457def note_ovl_candidate_bad_addrspace_this : Note<
4458    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4459    "'this' object is in %3, but method expects object in %4">;
4460def note_ovl_candidate_bad_gc : Note<
4461    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4462    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4463    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4464def note_ovl_candidate_bad_ownership : Note<
4465    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4466    "%select{%ordinal7|'this'}6 argument (%3) has "
4467    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4468    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4469    "__autoreleasing}5 ownership">;
4470def note_ovl_candidate_bad_cvr_this : Note<
4471    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4472    "'this' argument has type %3, but method is not marked "
4473    "%select{const|restrict|const or restrict|volatile|const or volatile|"
4474    "volatile or restrict|const, volatile, or restrict}4">;
4475def note_ovl_candidate_bad_cvr : Note<
4476    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4477    "%ordinal5 argument (%3) would lose "
4478    "%select{const|restrict|const and restrict|volatile|const and volatile|"
4479    "volatile and restrict|const, volatile, and restrict}4 qualifier"
4480    "%select{||s||s|s|s}4">;
4481def note_ovl_candidate_bad_unaligned : Note<
4482    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4483    "%ordinal5 argument (%3) would lose __unaligned qualifier">;
4484def note_ovl_candidate_bad_base_to_derived_conv : Note<
4485    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4486    "cannot %select{convert from|convert from|bind}3 "
4487    "%select{base class pointer|superclass|base class object of type}3 %4 to "
4488    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4489    "%ordinal6 argument">;
4490def note_ovl_candidate_bad_target : Note<
4491    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4492    "call to "
4493    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4494    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4495def note_ovl_candidate_constraints_not_satisfied : Note<
4496    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4497    "not satisfied">;
4498def note_implicit_member_target_infer_collision : Note<
4499    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4500    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4501    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4502
4503def note_ambiguous_type_conversion: Note<
4504    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4505def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4506def err_ovl_no_viable_function_in_init : Error<
4507  "no matching constructor for initialization of %0">;
4508def err_ovl_no_conversion_in_cast : Error<
4509  "cannot convert %1 to %2 without a conversion operator">;
4510def err_ovl_no_viable_conversion_in_cast : Error<
4511  "no matching conversion for %select{|static_cast|reinterpret_cast|"
4512  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4513def err_ovl_ambiguous_conversion_in_cast : Error<
4514  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4515  "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4516def err_ovl_deleted_conversion_in_cast : Error<
4517  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4518  "functional-style cast|}0 from %1 to %2 uses deleted function">;
4519def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4520def err_ref_init_ambiguous : Error<
4521  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4522def err_ovl_deleted_init : Error<
4523  "call to deleted constructor of %0">;
4524def err_ovl_deleted_special_init : Error<
4525  "call to implicitly-deleted %select{default constructor|copy constructor|"
4526  "move constructor|copy assignment operator|move assignment operator|"
4527  "destructor|function}0 of %1">;
4528def err_ovl_ambiguous_oper_unary : Error<
4529  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4530def err_ovl_ambiguous_oper_binary : Error<
4531  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4532def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4533  "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4534  "and %2) to be ambiguous despite there being a unique best viable function"
4535  "%select{ with non-reversed arguments|}3">,
4536  InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4537def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4538  "ambiguity is between a regular call to this operator and a call with the "
4539  "argument order reversed">;
4540def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4541  "candidate function with non-reversed arguments">;
4542def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4543  "ambiguous candidate function with reversed arguments">;
4544def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4545def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4546def err_ovl_deleted_oper : Error<
4547  "overload resolution selected deleted operator '%0'">;
4548def err_ovl_deleted_special_oper : Error<
4549  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4550  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4551  "implicitly deleted">;
4552def err_ovl_deleted_comparison : Error<
4553  "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4554def err_ovl_rewrite_equalequal_not_bool : Error<
4555  "return type %0 of selected 'operator==' function for rewritten "
4556  "'%1' comparison is not 'bool'">;
4557def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4558  "ISO C++20 requires return type of selected 'operator==' function for "
4559  "rewritten '%1' comparison to be 'bool', not %0">,
4560  InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4561def err_ovl_no_viable_subscript :
4562    Error<"no viable overloaded operator[] for type %0">;
4563def err_ovl_no_oper :
4564    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4565def err_ovl_unresolvable : Error<
4566  "reference to %select{overloaded|multiversioned}1 function could not be "
4567  "resolved; did you mean to call it%select{| with no arguments}0?">;
4568def err_bound_member_function : Error<
4569  "reference to non-static member function must be called"
4570  "%select{|; did you mean to call it with no arguments?}0">;
4571def note_possible_target_of_call : Note<"possible target for call">;
4572
4573def err_ovl_no_viable_object_call : Error<
4574  "no matching function for call to object of type %0">;
4575def err_ovl_ambiguous_object_call : Error<
4576  "call to object of type %0 is ambiguous">;
4577def err_ovl_deleted_object_call : Error<
4578  "call to deleted function call operator in type %0">;
4579def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4580def err_member_call_without_object : Error<
4581  "call to non-static member function without an object argument">;
4582
4583// C++ Address of Overloaded Function
4584def err_addr_ovl_no_viable : Error<
4585  "address of overloaded function %0 does not match required type %1">;
4586def err_addr_ovl_ambiguous : Error<
4587  "address of overloaded function %0 is ambiguous">;
4588def err_addr_ovl_not_func_ptrref : Error<
4589  "address of overloaded function %0 cannot be converted to type %1">;
4590def err_addr_ovl_no_qualifier : Error<
4591  "cannot form member pointer of type %0 without '&' and class name">;
4592
4593} // let Deferrable
4594
4595// C++11 Literal Operators
4596def err_ovl_no_viable_literal_operator : Error<
4597  "no matching literal operator for call to %0"
4598  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4599  "%select{| or 'const char *'}4"
4600  "%select{|, and no matching literal operator template}5">;
4601
4602// C++ Template Declarations
4603def err_template_param_shadow : Error<
4604  "declaration of %0 shadows template parameter">;
4605def ext_template_param_shadow : ExtWarn<
4606  err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
4607def note_template_param_here : Note<"template parameter is declared here">;
4608def warn_template_export_unsupported : Warning<
4609  "exported templates are unsupported">;
4610def err_template_outside_namespace_or_class_scope : Error<
4611  "templates can only be declared in namespace or class scope">;
4612def err_template_inside_local_class : Error<
4613  "templates cannot be declared inside of a local class">;
4614def err_template_linkage : Error<"templates must have C++ linkage">;
4615def err_template_typedef : Error<"a typedef cannot be a template">;
4616def err_template_unnamed_class : Error<
4617  "cannot declare a class template with no name">;
4618def err_template_param_list_different_arity : Error<
4619  "%select{too few|too many}0 template parameters in template "
4620  "%select{|template parameter }1redeclaration">;
4621def note_template_param_list_different_arity : Note<
4622  "%select{too few|too many}0 template parameters in template template "
4623  "argument">;
4624def note_template_prev_declaration : Note<
4625  "previous template %select{declaration|template parameter}0 is here">;
4626def err_template_param_different_kind : Error<
4627  "template parameter has a different kind in template "
4628  "%select{|template parameter }0redeclaration">;
4629def note_template_param_different_kind : Note<
4630  "template parameter has a different kind in template argument">;
4631
4632def err_invalid_decl_specifier_in_nontype_parm : Error<
4633  "invalid declaration specifier in template non-type parameter">;
4634
4635def err_template_nontype_parm_different_type : Error<
4636  "template non-type parameter has a different type %0 in template "
4637  "%select{|template parameter }1redeclaration">;
4638
4639def note_template_nontype_parm_different_type : Note<
4640  "template non-type parameter has a different type %0 in template argument">;
4641def note_template_nontype_parm_prev_declaration : Note<
4642  "previous non-type template parameter with type %0 is here">;
4643def err_template_nontype_parm_bad_type : Error<
4644  "a non-type template parameter cannot have type %0">;
4645def err_template_nontype_parm_bad_structural_type : Error<
4646  "a non-type template parameter cannot have type %0 before C++20">;
4647def err_template_nontype_parm_incomplete : Error<
4648  "non-type template parameter has incomplete type %0">;
4649def err_template_nontype_parm_not_literal : Error<
4650  "non-type template parameter has non-literal type %0">;
4651def err_template_nontype_parm_rvalue_ref : Error<
4652  "non-type template parameter has rvalue reference type %0">;
4653def err_template_nontype_parm_not_structural : Error<
4654  "type %0 of non-type template parameter is not a structural type">;
4655def note_not_structural_non_public : Note<
4656  "%0 is not a structural type because it has a "
4657  "%select{non-static data member|base class}1 that is not public">;
4658def note_not_structural_mutable_field : Note<
4659  "%0 is not a structural type because it has a mutable "
4660  "non-static data member">;
4661def note_not_structural_rvalue_ref_field : Note<
4662  "%0 is not a structural type because it has a non-static data member "
4663  "of rvalue reference type">;
4664def note_not_structural_subobject : Note<
4665  "%0 is not a structural type because it has a "
4666  "%select{non-static data member|base class}1 of non-structural type %2">;
4667def warn_cxx17_compat_template_nontype_parm_type : Warning<
4668  "non-type template parameter of type %0 is incompatible with "
4669  "C++ standards before C++20">,
4670  DefaultIgnore, InGroup<CXXPre20Compat>;
4671def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
4672  "non-type template parameters declared with %0 are incompatible with C++ "
4673  "standards before C++17">,
4674  DefaultIgnore, InGroup<CXXPre17Compat>;
4675def err_template_param_default_arg_redefinition : Error<
4676  "template parameter redefines default argument">;
4677def note_template_param_prev_default_arg : Note<
4678  "previous default template argument defined here">;
4679def err_template_param_default_arg_missing : Error<
4680  "template parameter missing a default argument">;
4681def ext_template_parameter_default_in_function_template : ExtWarn<
4682  "default template arguments for a function template are a C++11 extension">,
4683  InGroup<CXX11>;
4684def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
4685  "default template arguments for a function template are incompatible with C++98">,
4686  InGroup<CXX98Compat>, DefaultIgnore;
4687def err_template_parameter_default_template_member : Error<
4688  "cannot add a default template argument to the definition of a member of a "
4689  "class template">;
4690def err_template_parameter_default_friend_template : Error<
4691  "default template argument not permitted on a friend template">;
4692def err_template_template_parm_no_parms : Error<
4693  "template template parameter must have its own template parameters">;
4694
4695def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
4696  InGroup<CXX14>;
4697def warn_cxx11_compat_variable_template : Warning<
4698  "variable templates are incompatible with C++ standards before C++14">,
4699  InGroup<CXXPre14Compat>, DefaultIgnore;
4700def err_template_variable_noparams : Error<
4701  "extraneous 'template<>' in declaration of variable %0">;
4702def err_template_member : Error<"member %0 declared as a template">;
4703def err_template_member_noparams : Error<
4704  "extraneous 'template<>' in declaration of member %0">;
4705def err_template_tag_noparams : Error<
4706  "extraneous 'template<>' in declaration of %0 %1">;
4707
4708def warn_cxx17_compat_adl_only_template_id : Warning<
4709  "use of function template name with no prior function template "
4710  "declaration in function call with explicit template arguments "
4711  "is incompatible with C++ standards before C++20">,
4712  InGroup<CXXPre20Compat>, DefaultIgnore;
4713def ext_adl_only_template_id : ExtWarn<
4714  "use of function template name with no prior declaration in function call "
4715  "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
4716
4717// C++ Template Argument Lists
4718def err_template_missing_args : Error<
4719  "use of "
4720  "%select{class template|function template|variable template|alias template|"
4721  "template template parameter|concept|template}0 %1 requires template "
4722  "arguments">;
4723def err_template_arg_list_different_arity : Error<
4724  "%select{too few|too many}0 template arguments for "
4725  "%select{class template|function template|variable template|alias template|"
4726  "template template parameter|concept|template}1 %2">;
4727def note_template_decl_here : Note<"template is declared here">;
4728def err_template_arg_must_be_type : Error<
4729  "template argument for template type parameter must be a type">;
4730def err_template_arg_must_be_type_suggest : Error<
4731  "template argument for template type parameter must be a type; "
4732  "did you forget 'typename'?">;
4733def ext_ms_template_type_arg_missing_typename : ExtWarn<
4734  "template argument for template type parameter must be a type; "
4735  "omitted 'typename' is a Microsoft extension">,
4736  InGroup<MicrosoftTemplate>;
4737def err_template_arg_must_be_expr : Error<
4738  "template argument for non-type template parameter must be an expression">;
4739def err_template_arg_nontype_ambig : Error<
4740  "template argument for non-type template parameter is treated as function type %0">;
4741def err_template_arg_must_be_template : Error<
4742  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
4743def ext_template_arg_local_type : ExtWarn<
4744  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
4745def ext_template_arg_unnamed_type : ExtWarn<
4746  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
4747def warn_cxx98_compat_template_arg_local_type : Warning<
4748  "local type %0 as template argument is incompatible with C++98">,
4749  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
4750def warn_cxx98_compat_template_arg_unnamed_type : Warning<
4751  "unnamed type as template argument is incompatible with C++98">,
4752  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
4753def note_template_unnamed_type_here : Note<
4754  "unnamed type used in template argument was declared here">;
4755def err_template_arg_overload_type : Error<
4756  "template argument is the type of an unresolved overloaded function">;
4757def err_template_arg_not_valid_template : Error<
4758  "template argument does not refer to a class or alias template, or template "
4759  "template parameter">;
4760def note_template_arg_refers_here_func : Note<
4761  "template argument refers to function template %0, here">;
4762def err_template_arg_template_params_mismatch : Error<
4763  "template template argument has different template parameters than its "
4764  "corresponding template template parameter">;
4765def err_template_arg_not_integral_or_enumeral : Error<
4766  "non-type template argument of type %0 must have an integral or enumeration"
4767  " type">;
4768def err_template_arg_not_ice : Error<
4769  "non-type template argument of type %0 is not an integral constant "
4770  "expression">;
4771def err_template_arg_not_address_constant : Error<
4772  "non-type template argument of type %0 is not a constant expression">;
4773def warn_cxx98_compat_template_arg_null : Warning<
4774  "use of null pointer as non-type template argument is incompatible with "
4775  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4776def err_template_arg_untyped_null_constant : Error<
4777  "null non-type template argument must be cast to template parameter type %0">;
4778def err_template_arg_wrongtype_null_constant : Error<
4779  "null non-type template argument of type %0 does not match template parameter "
4780  "of type %1">;
4781def err_non_type_template_parm_type_deduction_failure : Error<
4782  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
4783def err_deduced_non_type_template_arg_type_mismatch : Error<
4784  "deduced non-type template argument does not have the same type as the "
4785  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
4786def err_non_type_template_arg_subobject : Error<
4787  "non-type template argument refers to subobject '%0'">;
4788def err_non_type_template_arg_addr_label_diff : Error<
4789  "template argument / label address difference / what did you expect?">;
4790def err_non_type_template_arg_unsupported : Error<
4791  "sorry, non-type template argument of type %0 is not yet supported">;
4792def err_template_arg_not_convertible : Error<
4793  "non-type template argument of type %0 cannot be converted to a value "
4794  "of type %1">;
4795def warn_template_arg_negative : Warning<
4796  "non-type template argument with value '%0' converted to '%1' for unsigned "
4797  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4798def warn_template_arg_too_large : Warning<
4799  "non-type template argument value '%0' truncated to '%1' for "
4800  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4801def err_template_arg_no_ref_bind : Error<
4802  "non-type template parameter of reference type "
4803  "%diff{$ cannot bind to template argument of type $"
4804  "|cannot bind to template of incompatible argument type}0,1">;
4805def err_template_arg_ref_bind_ignores_quals : Error<
4806  "reference binding of non-type template parameter "
4807  "%diff{of type $ to template argument of type $|to template argument}0,1 "
4808  "ignores qualifiers">;
4809def err_template_arg_not_decl_ref : Error<
4810  "non-type template argument does not refer to any declaration">;
4811def err_template_arg_not_address_of : Error<
4812  "non-type template argument for template parameter of pointer type %0 must "
4813  "have its address taken">;
4814def err_template_arg_address_of_non_pointer : Error<
4815  "address taken in non-type template argument for template parameter of "
4816  "reference type %0">;
4817def err_template_arg_reference_var : Error<
4818  "non-type template argument of reference type %0 is not an object">;
4819def err_template_arg_field : Error<
4820  "non-type template argument refers to non-static data member %0">;
4821def err_template_arg_method : Error<
4822  "non-type template argument refers to non-static member function %0">;
4823def err_template_arg_object_no_linkage : Error<
4824  "non-type template argument refers to %select{function|object}0 %1 that "
4825  "does not have linkage">;
4826def warn_cxx98_compat_template_arg_object_internal : Warning<
4827  "non-type template argument referring to %select{function|object}0 %1 with "
4828  "internal linkage is incompatible with C++98">,
4829  InGroup<CXX98Compat>, DefaultIgnore;
4830def ext_template_arg_object_internal : ExtWarn<
4831  "non-type template argument referring to %select{function|object}0 %1 with "
4832  "internal linkage is a C++11 extension">, InGroup<CXX11>;
4833def err_template_arg_thread_local : Error<
4834  "non-type template argument refers to thread-local object">;
4835def note_template_arg_internal_object : Note<
4836  "non-type template argument refers to %select{function|object}0 here">;
4837def note_template_arg_refers_here : Note<
4838  "non-type template argument refers here">;
4839def err_template_arg_not_object_or_func : Error<
4840  "non-type template argument does not refer to an object or function">;
4841def err_template_arg_not_pointer_to_member_form : Error<
4842  "non-type template argument is not a pointer to member constant">;
4843def err_template_arg_member_ptr_base_derived_not_supported : Error<
4844  "sorry, non-type template argument of pointer-to-member type %1 that refers "
4845  "to member %q0 of a different class is not supported yet">;
4846def ext_template_arg_extra_parens : ExtWarn<
4847  "address non-type template argument cannot be surrounded by parentheses">;
4848def warn_cxx98_compat_template_arg_extra_parens : Warning<
4849  "redundant parentheses surrounding address non-type template argument are "
4850  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4851def err_pointer_to_member_type : Error<
4852  "invalid use of pointer to member type after %select{.*|->*}0">;
4853def err_pointer_to_member_call_drops_quals : Error<
4854  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
4855def err_pointer_to_member_oper_value_classify: Error<
4856  "pointer-to-member function type %0 can only be called on an "
4857  "%select{rvalue|lvalue}1">;
4858def ext_pointer_to_const_ref_member_on_rvalue : Extension<
4859  "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
4860  InGroup<CXX20>, SFINAEFailure;
4861def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
4862  "invoking a pointer to a 'const &' member function on an rvalue is "
4863  "incompatible with C++ standards before C++20">,
4864  InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
4865def ext_ms_deref_template_argument: ExtWarn<
4866  "non-type template argument containing a dereference operation is a "
4867  "Microsoft extension">, InGroup<MicrosoftTemplate>;
4868def ext_ms_delayed_template_argument: ExtWarn<
4869  "using the undeclared type %0 as a default template argument is a "
4870  "Microsoft extension">, InGroup<MicrosoftTemplate>;
4871def err_template_arg_deduced_incomplete_pack : Error<
4872  "deduced incomplete pack %0 for template parameter %1">;
4873
4874// C++ template specialization
4875def err_template_spec_unknown_kind : Error<
4876  "can only provide an explicit specialization for a class template, function "
4877  "template, variable template, or a member function, static data member, "
4878  "%select{or member class|member class, or member enumeration}0 of a "
4879  "class template">;
4880def note_specialized_entity : Note<
4881  "explicitly specialized declaration is here">;
4882def note_explicit_specialization_declared_here : Note<
4883  "explicit specialization declared here">;
4884def err_template_spec_decl_function_scope : Error<
4885  "explicit specialization of %0 in function scope">;
4886def err_template_spec_decl_friend : Error<
4887  "cannot declare an explicit specialization in a friend">;
4888def err_template_spec_redecl_out_of_scope : Error<
4889  "%select{class template|class template partial|variable template|"
4890  "variable template partial|function template|member "
4891  "function|static data member|member class|member enumeration}0 "
4892  "specialization of %1 not in %select{a namespace enclosing %2|"
4893  "class %2 or an enclosing namespace}3">;
4894def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
4895  "%select{class template|class template partial|variable template|"
4896  "variable template partial|function template|member "
4897  "function|static data member|member class|member enumeration}0 "
4898  "specialization of %1 not in %select{a namespace enclosing %2|"
4899  "class %2 or an enclosing namespace}3 "
4900  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
4901def err_template_spec_redecl_global_scope : Error<
4902  "%select{class template|class template partial|variable template|"
4903  "variable template partial|function template|member "
4904  "function|static data member|member class|member enumeration}0 "
4905  "specialization of %1 must occur at global scope">;
4906def err_spec_member_not_instantiated : Error<
4907  "specialization of member %q0 does not specialize an instantiated member">;
4908def note_specialized_decl : Note<"attempt to specialize declaration here">;
4909def err_specialization_after_instantiation : Error<
4910  "explicit specialization of %0 after instantiation">;
4911def note_instantiation_required_here : Note<
4912  "%select{implicit|explicit}0 instantiation first required here">;
4913def err_template_spec_friend : Error<
4914  "template specialization declaration cannot be a friend">;
4915def err_template_spec_default_arg : Error<
4916  "default argument not permitted on an explicit "
4917  "%select{instantiation|specialization}0 of function %1">;
4918def err_not_class_template_specialization : Error<
4919  "cannot specialize a %select{dependent template|template template "
4920  "parameter}0">;
4921def ext_explicit_specialization_storage_class : ExtWarn<
4922  "explicit specialization cannot have a storage class">;
4923def err_explicit_specialization_inconsistent_storage_class : Error<
4924  "explicit specialization has extraneous, inconsistent storage class "
4925  "'%select{none|extern|static|__private_extern__|auto|register}0'">;
4926def err_dependent_function_template_spec_no_match : Error<
4927  "no candidate function template was found for dependent"
4928  " friend function template specialization">;
4929def note_dependent_function_template_spec_discard_reason : Note<
4930  "candidate ignored: %select{not a function template"
4931  "|not a member of the enclosing namespace;"
4932  " did you mean to explicitly qualify the specialization?}0">;
4933
4934// C++ class template specializations and out-of-line definitions
4935def err_template_spec_needs_header : Error<
4936  "template specialization requires 'template<>'">;
4937def err_template_spec_needs_template_parameters : Error<
4938  "template specialization or definition requires a template parameter list "
4939  "corresponding to the nested type %0">;
4940def err_template_param_list_matches_nontemplate : Error<
4941  "template parameter list matching the non-templated nested type %0 should "
4942  "be empty ('template<>')">;
4943def err_alias_template_extra_headers : Error<
4944  "extraneous template parameter list in alias template declaration">;
4945def err_template_spec_extra_headers : Error<
4946  "extraneous template parameter list in template specialization or "
4947  "out-of-line template definition">;
4948def warn_template_spec_extra_headers : Warning<
4949  "extraneous template parameter list in template specialization">;
4950def note_explicit_template_spec_does_not_need_header : Note<
4951  "'template<>' header not required for explicitly-specialized class %0 "
4952  "declared here">;
4953def err_template_qualified_declarator_no_match : Error<
4954  "nested name specifier '%0' for declaration does not refer into a class, "
4955  "class template or class template partial specialization">;
4956def err_specialize_member_of_template : Error<
4957  "cannot specialize %select{|(with 'template<>') }0a member of an "
4958  "unspecialized template">;
4959
4960// C++ Class Template Partial Specialization
4961def err_default_arg_in_partial_spec : Error<
4962    "default template argument in a class template partial specialization">;
4963def err_dependent_non_type_arg_in_partial_spec : Error<
4964    "type of specialized non-type template argument depends on a template "
4965    "parameter of the partial specialization">;
4966def note_dependent_non_type_default_arg_in_partial_spec : Note<
4967    "template parameter is used in default argument declared here">;
4968def err_dependent_typed_non_type_arg_in_partial_spec : Error<
4969    "non-type template argument specializes a template parameter with "
4970    "dependent type %0">;
4971def err_partial_spec_args_match_primary_template : Error<
4972    "%select{class|variable}0 template partial specialization does not "
4973    "specialize any template argument; to %select{declare|define}1 the "
4974    "primary template, remove the template argument list">;
4975def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
4976    "%select{class|variable}0 template partial specialization is not "
4977    "more specialized than the primary template">, DefaultError,
4978    InGroup<DiagGroup<"invalid-partial-specialization">>;
4979def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
4980def ext_partial_specs_not_deducible : ExtWarn<
4981    "%select{class|variable}0 template partial specialization contains "
4982    "%select{a template parameter|template parameters}1 that cannot be "
4983    "deduced; this partial specialization will never be used">,
4984    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
4985def note_non_deducible_parameter : Note<
4986    "non-deducible template parameter %0">;
4987def err_partial_spec_ordering_ambiguous : Error<
4988    "ambiguous partial specializations of %0">;
4989def note_partial_spec_match : Note<"partial specialization matches %0">;
4990def err_partial_spec_redeclared : Error<
4991  "class template partial specialization %0 cannot be redeclared">;
4992def note_partial_specialization_declared_here : Note<
4993  "explicit specialization declared here">;
4994def note_prev_partial_spec_here : Note<
4995  "previous declaration of class template partial specialization %0 is here">;
4996def err_partial_spec_fully_specialized : Error<
4997  "partial specialization of %0 does not use any of its template parameters">;
4998
4999// C++ Variable Template Partial Specialization
5000def err_var_partial_spec_redeclared : Error<
5001  "variable template partial specialization %0 cannot be redefined">;
5002def note_var_prev_partial_spec_here : Note<
5003  "previous declaration of variable template partial specialization is here">;
5004def err_var_spec_no_template : Error<
5005  "no variable template matches%select{| partial}0 specialization">;
5006def err_var_spec_no_template_but_method : Error<
5007  "no variable template matches specialization; "
5008  "did you mean to use %0 as function template instead?">;
5009
5010// C++ Function template specializations
5011def err_function_template_spec_no_match : Error<
5012    "no function template matches function template specialization %0">;
5013def err_function_template_spec_ambiguous : Error<
5014    "function template specialization %0 ambiguously refers to more than one "
5015    "function template; explicitly specify%select{| additional}1 template "
5016    "arguments to identify a particular function template">;
5017def note_function_template_spec_matched : Note<
5018    "function template %q0 matches specialization %1">;
5019def err_function_template_partial_spec : Error<
5020    "function template partial specialization is not allowed">;
5021
5022// C++ Template Instantiation
5023def err_template_recursion_depth_exceeded : Error<
5024  "recursive template instantiation exceeded maximum depth of %0">,
5025  DefaultFatal, NoSFINAE;
5026def note_template_recursion_depth : Note<
5027  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
5028
5029def err_template_instantiate_within_definition : Error<
5030  "%select{implicit|explicit}0 instantiation of template %1 within its"
5031  " own definition">;
5032def err_template_instantiate_undefined : Error<
5033  "%select{implicit|explicit}0 instantiation of undefined template %1">;
5034def err_implicit_instantiate_member_undefined : Error<
5035  "implicit instantiation of undefined member %0">;
5036def note_template_class_instantiation_was_here : Note<
5037  "class template %0 was instantiated here">;
5038def note_template_class_explicit_specialization_was_here : Note<
5039  "class template %0 was explicitly specialized here">;
5040def note_template_class_instantiation_here : Note<
5041  "in instantiation of template class %q0 requested here">;
5042def note_template_member_class_here : Note<
5043  "in instantiation of member class %q0 requested here">;
5044def note_template_member_function_here : Note<
5045  "in instantiation of member function %q0 requested here">;
5046def note_function_template_spec_here : Note<
5047  "in instantiation of function template specialization %q0 requested here">;
5048def note_template_static_data_member_def_here : Note<
5049  "in instantiation of static data member %q0 requested here">;
5050def note_template_variable_def_here : Note<
5051  "in instantiation of variable template specialization %q0 requested here">;
5052def note_template_enum_def_here : Note<
5053  "in instantiation of enumeration %q0 requested here">;
5054def note_template_nsdmi_here : Note<
5055  "in instantiation of default member initializer %q0 requested here">;
5056def note_template_type_alias_instantiation_here : Note<
5057  "in instantiation of template type alias %0 requested here">;
5058def note_template_exception_spec_instantiation_here : Note<
5059  "in instantiation of exception specification for %0 requested here">;
5060def note_template_requirement_instantiation_here : Note<
5061  "in instantiation of requirement here">;
5062def warn_var_template_missing : Warning<"instantiation of variable %q0 "
5063  "required here, but no definition is available">,
5064  InGroup<UndefinedVarTemplate>;
5065def warn_func_template_missing : Warning<"instantiation of function %q0 "
5066  "required here, but no definition is available">,
5067  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
5068def note_forward_template_decl : Note<
5069  "forward declaration of template entity is here">;
5070def note_inst_declaration_hint : Note<"add an explicit instantiation "
5071  "declaration to suppress this warning if %q0 is explicitly instantiated in "
5072  "another translation unit">;
5073def note_evaluating_exception_spec_here : Note<
5074  "in evaluation of exception specification for %q0 needed here">;
5075
5076def note_default_arg_instantiation_here : Note<
5077  "in instantiation of default argument for '%0' required here">;
5078def note_default_function_arg_instantiation_here : Note<
5079  "in instantiation of default function argument expression "
5080  "for '%0' required here">;
5081def note_explicit_template_arg_substitution_here : Note<
5082  "while substituting explicitly-specified template arguments into function "
5083  "template %0 %1">;
5084def note_function_template_deduction_instantiation_here : Note<
5085  "while substituting deduced template arguments into function template %0 "
5086  "%1">;
5087def note_deduced_template_arg_substitution_here : Note<
5088  "during template argument deduction for %select{class|variable}0 template "
5089  "%select{partial specialization |}1%2 %3">;
5090def note_prior_template_arg_substitution : Note<
5091  "while substituting prior template arguments into %select{non-type|template}0"
5092  " template parameter%1 %2">;
5093def note_template_default_arg_checking : Note<
5094  "while checking a default template argument used here">;
5095def note_concept_specialization_here : Note<
5096  "while checking the satisfaction of concept '%0' requested here">;
5097def note_nested_requirement_here : Note<
5098  "while checking the satisfaction of nested requirement requested here">;
5099def note_checking_constraints_for_template_id_here : Note<
5100  "while checking constraint satisfaction for template '%0' required here">;
5101def note_checking_constraints_for_var_spec_id_here : Note<
5102  "while checking constraint satisfaction for variable template "
5103  "partial specialization '%0' required here">;
5104def note_checking_constraints_for_class_spec_id_here : Note<
5105  "while checking constraint satisfaction for class template partial "
5106  "specialization '%0' required here">;
5107def note_checking_constraints_for_function_here : Note<
5108  "while checking constraint satisfaction for function '%0' required here">;
5109def note_constraint_substitution_here : Note<
5110  "while substituting template arguments into constraint expression here">;
5111def note_constraint_normalization_here : Note<
5112  "while calculating associated constraint of template '%0' here">;
5113def note_parameter_mapping_substitution_here : Note<
5114  "while substituting into concept arguments here; substitution failures not "
5115  "allowed in concept arguments">;
5116def note_instantiation_contexts_suppressed : Note<
5117  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
5118  "see all)">;
5119
5120def err_field_instantiates_to_function : Error<
5121  "data member instantiated with function type %0">;
5122def err_variable_instantiates_to_function : Error<
5123  "%select{variable|static data member}0 instantiated with function type %1">;
5124def err_nested_name_spec_non_tag : Error<
5125  "type %0 cannot be used prior to '::' because it has no members">;
5126
5127def err_using_pack_expansion_empty : Error<
5128  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
5129
5130// C++ Explicit Instantiation
5131def err_explicit_instantiation_duplicate : Error<
5132    "duplicate explicit instantiation of %0">;
5133def ext_explicit_instantiation_duplicate : ExtWarn<
5134    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
5135    InGroup<MicrosoftTemplate>;
5136def note_previous_explicit_instantiation : Note<
5137    "previous explicit instantiation is here">;
5138def warn_explicit_instantiation_after_specialization : Warning<
5139  "explicit instantiation of %0 that occurs after an explicit "
5140  "specialization has no effect">,
5141  InGroup<DiagGroup<"instantiation-after-specialization">>;
5142def note_previous_template_specialization : Note<
5143    "previous template specialization is here">;
5144def err_explicit_instantiation_nontemplate_type : Error<
5145    "explicit instantiation of non-templated type %0">;
5146def note_nontemplate_decl_here : Note<
5147    "non-templated declaration is here">;
5148def err_explicit_instantiation_in_class : Error<
5149  "explicit instantiation of %0 in class scope">;
5150def err_explicit_instantiation_out_of_scope : Error<
5151  "explicit instantiation of %0 not in a namespace enclosing %1">;
5152def err_explicit_instantiation_must_be_global : Error<
5153  "explicit instantiation of %0 must occur at global scope">;
5154def warn_explicit_instantiation_out_of_scope_0x : Warning<
5155  "explicit instantiation of %0 not in a namespace enclosing %1">,
5156  InGroup<CXX11Compat>, DefaultIgnore;
5157def warn_explicit_instantiation_must_be_global_0x : Warning<
5158  "explicit instantiation of %0 must occur at global scope">,
5159  InGroup<CXX11Compat>, DefaultIgnore;
5160
5161def err_explicit_instantiation_requires_name : Error<
5162  "explicit instantiation declaration requires a name">;
5163def err_explicit_instantiation_of_typedef : Error<
5164  "explicit instantiation of typedef %0">;
5165def err_explicit_instantiation_storage_class : Error<
5166  "explicit instantiation cannot have a storage class">;
5167def err_explicit_instantiation_internal_linkage : Error<
5168  "explicit instantiation declaration of %0 with internal linkage">;
5169def err_explicit_instantiation_not_known : Error<
5170  "explicit instantiation of %0 does not refer to a function template, "
5171  "variable template, member function, member class, or static data member">;
5172def note_explicit_instantiation_here : Note<
5173  "explicit instantiation refers here">;
5174def err_explicit_instantiation_data_member_not_instantiated : Error<
5175  "explicit instantiation refers to static data member %q0 that is not an "
5176  "instantiation">;
5177def err_explicit_instantiation_member_function_not_instantiated : Error<
5178  "explicit instantiation refers to member function %q0 that is not an "
5179  "instantiation">;
5180def err_explicit_instantiation_ambiguous : Error<
5181  "partial ordering for explicit instantiation of %0 is ambiguous">;
5182def note_explicit_instantiation_candidate : Note<
5183  "explicit instantiation candidate function %q0 template here %1">;
5184def err_explicit_instantiation_inline : Error<
5185  "explicit instantiation cannot be 'inline'">;
5186def warn_explicit_instantiation_inline_0x : Warning<
5187  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5188  DefaultIgnore;
5189def err_explicit_instantiation_constexpr : Error<
5190  "explicit instantiation cannot be 'constexpr'">;
5191def ext_explicit_instantiation_without_qualified_id : Extension<
5192  "qualifier in explicit instantiation of %q0 requires a template-id "
5193  "(a typedef is not permitted)">;
5194def err_explicit_instantiation_without_template_id : Error<
5195  "explicit instantiation of %q0 must specify a template argument list">;
5196def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5197  "explicit instantiation of %q0 must occur in namespace %1">;
5198def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5199  "explicit instantiation of %q0 must occur in namespace %1">,
5200  InGroup<CXX11Compat>, DefaultIgnore;
5201def err_explicit_instantiation_undefined_member : Error<
5202  "explicit instantiation of undefined %select{member class|member function|"
5203  "static data member}0 %1 of class template %2">;
5204def err_explicit_instantiation_undefined_func_template : Error<
5205  "explicit instantiation of undefined function template %0">;
5206def err_explicit_instantiation_undefined_var_template : Error<
5207  "explicit instantiation of undefined variable template %q0">;
5208def err_explicit_instantiation_declaration_after_definition : Error<
5209  "explicit instantiation declaration (with 'extern') follows explicit "
5210  "instantiation definition (without 'extern')">;
5211def note_explicit_instantiation_definition_here : Note<
5212  "explicit instantiation definition is here">;
5213def err_invalid_var_template_spec_type : Error<"type %2 "
5214  "of %select{explicit instantiation|explicit specialization|"
5215  "partial specialization|redeclaration}0 of %1 does not match"
5216  " expected type %3">;
5217def err_mismatched_exception_spec_explicit_instantiation : Error<
5218  "exception specification in explicit instantiation does not match "
5219  "instantiated one">;
5220def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5221  err_mismatched_exception_spec_explicit_instantiation.Text>,
5222  InGroup<MicrosoftExceptionSpec>;
5223def err_explicit_instantiation_dependent : Error<
5224  "explicit instantiation has dependent template arguments">;
5225
5226// C++ typename-specifiers
5227def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5228def err_typename_nested_not_found_enable_if : Error<
5229  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5230  "this declaration">;
5231def err_typename_nested_not_found_requirement : Error<
5232  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5233  "declaration">;
5234def err_typename_nested_not_type : Error<
5235    "typename specifier refers to non-type member %0 in %1">;
5236def err_typename_not_type : Error<
5237    "typename specifier refers to non-type %0">;
5238def note_typename_member_refers_here : Note<
5239    "referenced member %0 is declared here">;
5240def note_typename_refers_here : Note<
5241    "referenced %0 is declared here">;
5242def err_typename_missing : Error<
5243  "missing 'typename' prior to dependent type name '%0%1'">;
5244def err_typename_missing_template : Error<
5245  "missing 'typename' prior to dependent type template name '%0%1'">;
5246def ext_typename_missing : ExtWarn<
5247  "missing 'typename' prior to dependent type name '%0%1'">,
5248  InGroup<DiagGroup<"typename-missing">>;
5249def ext_typename_outside_of_template : ExtWarn<
5250  "'typename' occurs outside of a template">, InGroup<CXX11>;
5251def warn_cxx98_compat_typename_outside_of_template : Warning<
5252  "use of 'typename' outside of a template is incompatible with C++98">,
5253  InGroup<CXX98Compat>, DefaultIgnore;
5254def err_typename_refers_to_using_value_decl : Error<
5255  "typename specifier refers to a dependent using declaration for a value "
5256  "%0 in %1">;
5257def note_using_value_decl_missing_typename : Note<
5258  "add 'typename' to treat this using declaration as a type">;
5259
5260def err_template_kw_refers_to_non_template : Error<
5261  "%0%select{| following the 'template' keyword}1 "
5262  "does not refer to a template">;
5263def note_template_kw_refers_to_non_template : Note<
5264  "declared as a non-template here">;
5265def err_template_kw_refers_to_dependent_non_template : Error<
5266  "%0%select{| following the 'template' keyword}1 "
5267  "cannot refer to a dependent template">;
5268def err_template_kw_refers_to_class_template : Error<
5269  "'%0%1' instantiated to a class template, not a function template">;
5270def note_referenced_class_template : Note<
5271  "class template declared here">;
5272def err_template_kw_missing : Error<
5273  "missing 'template' keyword prior to dependent template name '%0%1'">;
5274def ext_template_outside_of_template : ExtWarn<
5275  "'template' keyword outside of a template">, InGroup<CXX11>;
5276def warn_cxx98_compat_template_outside_of_template : Warning<
5277  "use of 'template' keyword outside of a template is incompatible with C++98">,
5278  InGroup<CXX98Compat>, DefaultIgnore;
5279
5280def err_non_type_template_in_nested_name_specifier : Error<
5281  "qualified name refers into a specialization of %select{function|variable}0 "
5282  "template %1">;
5283def err_template_id_not_a_type : Error<
5284  "template name refers to non-type template %0">;
5285def note_template_declared_here : Note<
5286  "%select{function template|class template|variable template"
5287  "|type alias template|template template parameter}0 "
5288  "%1 declared here">;
5289def err_template_expansion_into_fixed_list : Error<
5290  "pack expansion used as argument for non-pack parameter of %select{alias "
5291  "template|concept}0">;
5292def note_parameter_type : Note<
5293  "parameter of type %0 is declared here">;
5294
5295// C++11 Variadic Templates
5296def err_template_param_pack_default_arg : Error<
5297  "template parameter pack cannot have a default argument">;
5298def err_template_param_pack_must_be_last_template_parameter : Error<
5299  "template parameter pack must be the last template parameter">;
5300
5301def err_template_parameter_pack_non_pack : Error<
5302  "%select{template type|non-type template|template template}0 parameter"
5303  "%select{| pack}1 conflicts with previous %select{template type|"
5304  "non-type template|template template}0 parameter%select{ pack|}1">;
5305def note_template_parameter_pack_non_pack : Note<
5306  "%select{template type|non-type template|template template}0 parameter"
5307  "%select{| pack}1 does not match %select{template type|non-type template"
5308  "|template template}0 parameter%select{ pack|}1 in template argument">;
5309def note_template_parameter_pack_here : Note<
5310  "previous %select{template type|non-type template|template template}0 "
5311  "parameter%select{| pack}1 declared here">;
5312
5313def err_unexpanded_parameter_pack : Error<
5314  "%select{expression|base type|declaration type|data member type|bit-field "
5315  "size|static assertion|fixed underlying type|enumerator value|"
5316  "using declaration|friend declaration|qualifier|initializer|default argument|"
5317  "non-type template parameter type|exception type|partial specialization|"
5318  "__if_exists name|__if_not_exists name|lambda|block|type constraint|"
5319  "requirement|requires clause}0 "
5320  "contains%plural{0: an|:}1 unexpanded parameter pack"
5321  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5322
5323def err_pack_expansion_without_parameter_packs : Error<
5324  "pack expansion does not contain any unexpanded parameter packs">;
5325def err_pack_expansion_length_conflict : Error<
5326  "pack expansion contains parameter packs %0 and %1 that have different "
5327  "lengths (%2 vs. %3)">;
5328def err_pack_expansion_length_conflict_multilevel : Error<
5329  "pack expansion contains parameter pack %0 that has a different "
5330  "length (%1 vs. %2) from outer parameter packs">;
5331def err_pack_expansion_length_conflict_partial : Error<
5332  "pack expansion contains parameter pack %0 that has a different "
5333  "length (at least %1 vs. %2) from outer parameter packs">;
5334def err_pack_expansion_member_init : Error<
5335  "pack expansion for initialization of member %0">;
5336
5337def err_function_parameter_pack_without_parameter_packs : Error<
5338  "type %0 of function parameter pack does not contain any unexpanded "
5339  "parameter packs">;
5340def err_ellipsis_in_declarator_not_parameter : Error<
5341  "only function and template parameters can be parameter packs">;
5342
5343def err_sizeof_pack_no_pack_name : Error<
5344  "%0 does not refer to the name of a parameter pack">;
5345
5346def err_fold_expression_packs_both_sides : Error<
5347  "binary fold expression has unexpanded parameter packs in both operands">;
5348def err_fold_expression_empty : Error<
5349  "unary fold expression has empty expansion for operator '%0' "
5350  "with no fallback value">;
5351def err_fold_expression_bad_operand : Error<
5352  "expression not permitted as operand of fold expression">;
5353def err_fold_expression_limit_exceeded: Error<
5354  "instantiating fold expression with %0 arguments exceeded expression nesting "
5355  "limit of %1">, DefaultFatal, NoSFINAE;
5356
5357def err_unexpected_typedef : Error<
5358  "unexpected type name %0: expected expression">;
5359def err_unexpected_namespace : Error<
5360  "unexpected namespace name %0: expected expression">;
5361def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5362def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5363  "use of undeclared identifier %0; "
5364  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5365  InGroup<MicrosoftTemplate>;
5366def err_found_in_dependent_base : Error<
5367  "explicit qualification required to use member %0 from dependent base class">;
5368def ext_found_in_dependent_base : ExtWarn<"use of member %0 "
5369  "found via unqualified lookup into dependent bases of class templates is a "
5370  "Microsoft extension">, InGroup<MicrosoftTemplate>;
5371def err_found_later_in_class : Error<"member %0 used before its declaration">;
5372def ext_found_later_in_class : ExtWarn<
5373  "use of member %0 before its declaration is a Microsoft extension">,
5374  InGroup<MicrosoftTemplate>;
5375def note_dependent_member_use : Note<
5376  "must qualify identifier to find this declaration in dependent base class">;
5377def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5378    "visible in the template definition nor found by argument-dependent lookup">;
5379def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5380    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5381def err_undeclared_use : Error<"use of undeclared %0">;
5382def warn_deprecated : Warning<"%0 is deprecated">,
5383    InGroup<DeprecatedDeclarations>;
5384def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5385def warn_property_method_deprecated :
5386    Warning<"property access is using %0 method which is deprecated">,
5387    InGroup<DeprecatedDeclarations>;
5388def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5389    InGroup<DeprecatedDeclarations>;
5390def warn_deprecated_anonymous_namespace : Warning<
5391  "'deprecated' attribute on anonymous namespace ignored">,
5392  InGroup<IgnoredAttributes>;
5393def warn_deprecated_fwdclass_message : Warning<
5394    "%0 may be deprecated because the receiver type is unknown">,
5395    InGroup<DeprecatedDeclarations>;
5396def warn_deprecated_def : Warning<
5397  "implementing deprecated %select{method|class|category}0">,
5398  InGroup<DeprecatedImplementations>, DefaultIgnore;
5399def warn_unavailable_def : Warning<
5400  "implementing unavailable method">,
5401  InGroup<DeprecatedImplementations>, DefaultIgnore;
5402def err_unavailable : Error<"%0 is unavailable">;
5403def err_property_method_unavailable :
5404    Error<"property access is using %0 method which is unavailable">;
5405def err_unavailable_message : Error<"%0 is unavailable: %1">;
5406def warn_unavailable_fwdclass_message : Warning<
5407    "%0 may be unavailable because the receiver type is unknown">,
5408    InGroup<UnavailableDeclarations>;
5409def note_availability_specified_here : Note<
5410  "%0 has been explicitly marked "
5411  "%select{unavailable|deleted|deprecated}1 here">;
5412def note_partial_availability_specified_here : Note<
5413  "%0 has been marked as being introduced in %1 %2 here, "
5414  "but the deployment target is %1 %3">;
5415def note_implicitly_deleted : Note<
5416  "explicitly defaulted function was implicitly deleted here">;
5417def warn_not_enough_argument : Warning<
5418  "not enough variable arguments in %0 declaration to fit a sentinel">,
5419  InGroup<Sentinel>;
5420def warn_missing_sentinel : Warning <
5421  "missing sentinel in %select{function call|method dispatch|block call}0">,
5422  InGroup<Sentinel>;
5423def note_sentinel_here : Note<
5424  "%select{function|method|block}0 has been explicitly marked sentinel here">;
5425def warn_missing_prototype : Warning<
5426  "no previous prototype for function %0">,
5427  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5428def note_declaration_not_a_prototype : Note<
5429  "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5430  "to make it %select{a prototype for a zero-parameter function|one}0">;
5431def warn_strict_prototypes : Warning<
5432  "this %select{function declaration is not|block declaration is not|"
5433  "old-style function definition is not preceded by}0 a prototype">,
5434  InGroup<DiagGroup<"strict-prototypes">>, DefaultIgnore;
5435def warn_missing_variable_declarations : Warning<
5436  "no previous extern declaration for non-static variable %0">,
5437  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5438def note_static_for_internal_linkage : Note<
5439  "declare 'static' if the %select{variable|function}0 is not intended to be "
5440  "used outside of this translation unit">;
5441def err_static_data_member_reinitialization :
5442  Error<"static data member %0 already has an initializer">;
5443def err_redefinition : Error<"redefinition of %0">;
5444def err_alias_after_tentative :
5445  Error<"alias definition of %0 after tentative definition">;
5446def err_alias_is_definition :
5447  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5448def err_definition_of_implicitly_declared_member : Error<
5449  "definition of implicitly declared %select{default constructor|copy "
5450  "constructor|move constructor|copy assignment operator|move assignment "
5451  "operator|destructor|function}1">;
5452def err_definition_of_explicitly_defaulted_member : Error<
5453  "definition of explicitly defaulted %select{default constructor|copy "
5454  "constructor|move constructor|copy assignment operator|move assignment "
5455  "operator|destructor|function}0">;
5456def err_redefinition_extern_inline : Error<
5457  "redefinition of a 'extern inline' function %0 is not supported in "
5458  "%select{C99 mode|C++}1">;
5459def warn_attr_abi_tag_namespace : Warning<
5460  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5461  InGroup<IgnoredAttributes>;
5462def err_abi_tag_on_redeclaration : Error<
5463  "cannot add 'abi_tag' attribute in a redeclaration">;
5464def err_new_abi_tag_on_redeclaration : Error<
5465  "'abi_tag' %0 missing in original declaration">;
5466def note_use_ifdef_guards : Note<
5467  "unguarded header; consider using #ifdef guards or #pragma once">;
5468
5469def note_deleted_dtor_no_operator_delete : Note<
5470  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5471def note_deleted_special_member_class_subobject : Note<
5472  "%select{default constructor of|copy constructor of|move constructor of|"
5473  "copy assignment operator of|move assignment operator of|destructor of|"
5474  "constructor inherited by}0 "
5475  "%1 is implicitly deleted because "
5476  "%select{base class %3|%select{||||variant }4field %3}2 "
5477  "%select{has "
5478  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5479  "%select{%select{default constructor|copy constructor|move constructor|copy "
5480  "assignment operator|move assignment operator|destructor|"
5481  "%select{default|corresponding|default|default|default}4 constructor}0|"
5482  "destructor}5"
5483  "%select{||s||}4"
5484  "|is an ObjC pointer}6">;
5485def note_deleted_default_ctor_uninit_field : Note<
5486  "%select{default constructor of|constructor inherited by}0 "
5487  "%1 is implicitly deleted because field %2 of "
5488  "%select{reference|const-qualified}4 type %3 would not be initialized">;
5489def note_deleted_default_ctor_all_const : Note<
5490  "%select{default constructor of|constructor inherited by}0 "
5491  "%1 is implicitly deleted because all "
5492  "%select{data members|data members of an anonymous union member}2"
5493  " are const-qualified">;
5494def note_deleted_copy_ctor_rvalue_reference : Note<
5495  "copy constructor of %0 is implicitly deleted because field %1 is of "
5496  "rvalue reference type %2">;
5497def note_deleted_copy_user_declared_move : Note<
5498  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5499  " %1 has a user-declared move %select{constructor|assignment operator}2">;
5500def note_deleted_assign_field : Note<
5501  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5502  "because field %2 is of %select{reference|const-qualified}4 type %3">;
5503
5504// These should be errors.
5505def warn_undefined_internal : Warning<
5506  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5507  InGroup<DiagGroup<"undefined-internal">>;
5508def err_undefined_internal_type : Error<
5509  "%select{function|variable}0 %q1 is used but not defined in this "
5510  "translation unit, and cannot be defined in any other translation unit "
5511  "because its type does not have linkage">;
5512def ext_undefined_internal_type : Extension<
5513  "ISO C++ requires a definition in this translation unit for "
5514  "%select{function|variable}0 %q1 because its type does not have linkage">,
5515  InGroup<DiagGroup<"undefined-internal-type">>;
5516def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5517  InGroup<DiagGroup<"undefined-inline">>;
5518def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5519def note_used_here : Note<"used here">;
5520
5521def err_internal_linkage_redeclaration : Error<
5522  "'internal_linkage' attribute does not appear on the first declaration of %0">;
5523def warn_internal_linkage_local_storage : Warning<
5524  "'internal_linkage' attribute on a non-static local variable is ignored">,
5525  InGroup<IgnoredAttributes>;
5526
5527def ext_internal_in_extern_inline : ExtWarn<
5528  "static %select{function|variable}0 %1 is used in an inline function with "
5529  "external linkage">, InGroup<StaticInInline>;
5530def ext_internal_in_extern_inline_quiet : Extension<
5531  "static %select{function|variable}0 %1 is used in an inline function with "
5532  "external linkage">, InGroup<StaticInInline>;
5533def warn_static_local_in_extern_inline : Warning<
5534  "non-constant static local variable in inline function may be different "
5535  "in different files">, InGroup<StaticLocalInInline>;
5536def note_convert_inline_to_static : Note<
5537  "use 'static' to give inline function %0 internal linkage">;
5538
5539def ext_redefinition_of_typedef : ExtWarn<
5540  "redefinition of typedef %0 is a C11 feature">,
5541  InGroup<DiagGroup<"typedef-redefinition"> >;
5542def err_redefinition_variably_modified_typedef : Error<
5543  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5544
5545def err_inline_decl_follows_def : Error<
5546  "inline declaration of %0 follows non-inline definition">;
5547def err_inline_declaration_block_scope : Error<
5548  "inline declaration of %0 not allowed in block scope">;
5549def err_static_non_static : Error<
5550  "static declaration of %0 follows non-static declaration">;
5551def err_different_language_linkage : Error<
5552  "declaration of %0 has a different language linkage">;
5553def ext_retained_language_linkage : Extension<
5554  "friend function %0 retaining previous language linkage is an extension">,
5555  InGroup<DiagGroup<"retained-language-linkage">>;
5556def err_extern_c_global_conflict : Error<
5557  "declaration of %1 %select{with C language linkage|in global scope}0 "
5558  "conflicts with declaration %select{in global scope|with C language linkage}0">;
5559def note_extern_c_global_conflict : Note<
5560  "declared %select{in global scope|with C language linkage}0 here">;
5561def note_extern_c_begins_here : Note<
5562  "extern \"C\" language linkage specification begins here">;
5563def warn_weak_import : Warning <
5564  "an already-declared variable is made a weak_import declaration %0">;
5565def ext_static_non_static : Extension<
5566  "redeclaring non-static %0 as static is a Microsoft extension">,
5567  InGroup<MicrosoftRedeclareStatic>;
5568def err_non_static_static : Error<
5569  "non-static declaration of %0 follows static declaration">;
5570def err_extern_non_extern : Error<
5571  "extern declaration of %0 follows non-extern declaration">;
5572def err_non_extern_extern : Error<
5573  "non-extern declaration of %0 follows extern declaration">;
5574def err_non_thread_thread : Error<
5575  "non-thread-local declaration of %0 follows thread-local declaration">;
5576def err_thread_non_thread : Error<
5577  "thread-local declaration of %0 follows non-thread-local declaration">;
5578def err_thread_thread_different_kind : Error<
5579  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5580  "follows declaration with %select{dynamic|static}1 initialization">;
5581def err_mismatched_owning_module : Error<
5582  "declaration of %0 in %select{the global module|module %2}1 follows "
5583  "declaration in %select{the global module|module %4}3">;
5584def err_redefinition_different_type : Error<
5585  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5586def err_redefinition_different_kind : Error<
5587  "redefinition of %0 as different kind of symbol">;
5588def err_redefinition_different_namespace_alias : Error<
5589  "redefinition of %0 as an alias for a different namespace">;
5590def note_previous_namespace_alias : Note<
5591  "previously defined as an alias for %0">;
5592def warn_forward_class_redefinition : Warning<
5593  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5594  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5595def err_redefinition_different_typedef : Error<
5596  "%select{typedef|type alias|type alias template}0 "
5597  "redefinition with different types%diff{ ($ vs $)|}1,2">;
5598def err_tag_reference_non_tag : Error<
5599  "%select{non-struct type|non-class type|non-union type|non-enum "
5600  "type|typedef|type alias|template|type alias template|template "
5601  "template argument}1 %0 cannot be referenced with a "
5602  "%select{struct|interface|union|class|enum}2 specifier">;
5603def err_tag_reference_conflict : Error<
5604  "implicit declaration introduced by elaborated type conflicts with a "
5605  "%select{non-struct type|non-class type|non-union type|non-enum "
5606  "type|typedef|type alias|template|type alias template|template "
5607  "template argument}0 of the same name">;
5608def err_dependent_tag_decl : Error<
5609  "%select{declaration|definition}0 of "
5610  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5611def err_tag_definition_of_typedef : Error<
5612  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
5613def err_conflicting_types : Error<"conflicting types for %0">;
5614def err_different_pass_object_size_params : Error<
5615  "conflicting pass_object_size attributes on parameters">;
5616def err_late_asm_label_name : Error<
5617  "cannot apply asm label to %select{variable|function}0 after its first use">;
5618def err_different_asm_label : Error<"conflicting asm label">;
5619def err_nested_redefinition : Error<"nested redefinition of %0">;
5620def err_use_with_wrong_tag : Error<
5621  "use of %0 with tag type that does not match previous declaration">;
5622def warn_struct_class_tag_mismatch : Warning<
5623  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
5624  "declared as a %select{struct|interface|class}3%select{| template}1; "
5625  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5626  InGroup<MismatchedTags>, DefaultIgnore;
5627def warn_struct_class_previous_tag_mismatch : Warning<
5628  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
5629  "here but previously declared as "
5630  "%select{a struct|an interface|a class}3%select{| template}1; "
5631  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5632  InGroup<MismatchedTags>, DefaultIgnore;
5633def note_struct_class_suggestion : Note<
5634  "did you mean %select{struct|interface|class}0 here?">;
5635def ext_forward_ref_enum : Extension<
5636  "ISO C forbids forward references to 'enum' types">;
5637def err_forward_ref_enum : Error<
5638  "ISO C++ forbids forward references to 'enum' types">;
5639def ext_ms_forward_ref_enum : ExtWarn<
5640  "forward references to 'enum' types are a Microsoft extension">,
5641  InGroup<MicrosoftEnumForwardReference>;
5642def ext_forward_ref_enum_def : Extension<
5643  "redeclaration of already-defined enum %0 is a GNU extension">,
5644  InGroup<GNURedeclaredEnum>;
5645
5646def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
5647def err_duplicate_member : Error<"duplicate member %0">;
5648def err_misplaced_ivar : Error<
5649  "instance variables may not be placed in %select{categories|class extension}0">;
5650def warn_ivars_in_interface : Warning<
5651  "declaration of instance variables in the interface is deprecated">,
5652  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
5653def ext_enum_value_not_int : Extension<
5654  "ISO C restricts enumerator values to range of 'int' (%0 is too "
5655  "%select{small|large}1)">;
5656def ext_enum_too_large : ExtWarn<
5657  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
5658def ext_enumerator_increment_too_large : ExtWarn<
5659  "incremented enumerator value %0 is not representable in the "
5660  "largest integer type">, InGroup<EnumTooLarge>;
5661def warn_flag_enum_constant_out_of_range : Warning<
5662  "enumeration value %0 is out of range of flags in enumeration type %1">,
5663  InGroup<FlagEnum>;
5664
5665def err_vm_decl_in_file_scope : Error<
5666  "variably modified type declaration not allowed at file scope">;
5667def err_vm_decl_has_extern_linkage : Error<
5668  "variably modified type declaration cannot have 'extern' linkage">;
5669def err_typecheck_field_variable_size : Error<
5670  "fields must have a constant size: 'variable length array in structure' "
5671  "extension will never be supported">;
5672def err_vm_func_decl : Error<
5673  "function declaration cannot have variably modified type">;
5674def err_array_too_large : Error<
5675  "array is too large (%0 elements)">;
5676
5677def err_typecheck_negative_array_size : Error<"array size is negative">;
5678def warn_typecheck_function_qualifiers_ignored : Warning<
5679  "'%0' qualifier on function type %1 has no effect">,
5680  InGroup<IgnoredQualifiers>;
5681def warn_typecheck_function_qualifiers_unspecified : Warning<
5682  "'%0' qualifier on function type %1 has unspecified behavior">;
5683def warn_typecheck_reference_qualifiers : Warning<
5684  "'%0' qualifier on reference type %1 has no effect">,
5685  InGroup<IgnoredQualifiers>;
5686def err_typecheck_invalid_restrict_not_pointer : Error<
5687  "restrict requires a pointer or reference (%0 is invalid)">;
5688def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
5689  "restrict requires a pointer or reference">;
5690def err_typecheck_invalid_restrict_invalid_pointee : Error<
5691  "pointer to function type %0 may not be 'restrict' qualified">;
5692def ext_typecheck_zero_array_size : Extension<
5693  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
5694def err_typecheck_zero_array_size : Error<
5695  "zero-length arrays are not permitted in C++">;
5696def err_array_size_non_int : Error<"size of array has non-integer type %0">;
5697def err_init_element_not_constant : Error<
5698  "initializer element is not a compile-time constant">;
5699def ext_aggregate_init_not_constant : Extension<
5700  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
5701def err_local_cant_init : Error<
5702  "'__local' variable cannot have an initializer">;
5703def err_loader_uninitialized_cant_init
5704    : Error<"variable with 'loader_uninitialized' attribute cannot have an "
5705            "initializer">;
5706def err_loader_uninitialized_trivial_ctor
5707    : Error<"variable with 'loader_uninitialized' attribute must have a "
5708            "trivial default constructor">;
5709def err_loader_uninitialized_redeclaration
5710    : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
5711def err_loader_uninitialized_extern_decl
5712    : Error<"variable %0 cannot be declared both 'extern' and with the "
5713            "'loader_uninitialized' attribute">;
5714def err_block_extern_cant_init : Error<
5715  "'extern' variable cannot have an initializer">;
5716def warn_extern_init : Warning<"'extern' variable has an initializer">,
5717  InGroup<DiagGroup<"extern-initializer">>;
5718def err_variable_object_no_init : Error<
5719  "variable-sized object may not be initialized">;
5720def err_excess_initializers : Error<
5721  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
5722def ext_excess_initializers : ExtWarn<
5723  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
5724  InGroup<ExcessInitializers>;
5725def err_excess_initializers_for_sizeless_type : Error<
5726  "excess elements in initializer for indivisible sizeless type %0">;
5727def ext_excess_initializers_for_sizeless_type : ExtWarn<
5728  "excess elements in initializer for indivisible sizeless type %0">,
5729  InGroup<ExcessInitializers>;
5730def err_excess_initializers_in_char_array_initializer : Error<
5731  "excess elements in char array initializer">;
5732def ext_excess_initializers_in_char_array_initializer : ExtWarn<
5733  "excess elements in char array initializer">,
5734  InGroup<ExcessInitializers>;
5735def err_initializer_string_for_char_array_too_long : Error<
5736  "initializer-string for char array is too long">;
5737def ext_initializer_string_for_char_array_too_long : ExtWarn<
5738  "initializer-string for char array is too long">,
5739  InGroup<ExcessInitializers>;
5740def warn_missing_field_initializers : Warning<
5741  "missing field %0 initializer">,
5742  InGroup<MissingFieldInitializers>, DefaultIgnore;
5743def warn_braces_around_init : Warning<
5744  "braces around %select{scalar |}0initializer">,
5745  InGroup<DiagGroup<"braced-scalar-init">>;
5746def ext_many_braces_around_init : ExtWarn<
5747  "too many braces around %select{scalar |}0initializer">,
5748  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
5749def ext_complex_component_init : Extension<
5750  "complex initialization specifying real and imaginary components "
5751  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
5752def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
5753def err_empty_sizeless_initializer : Error<
5754  "initializer for sizeless type %0 cannot be empty">;
5755def warn_cxx98_compat_empty_scalar_initializer : Warning<
5756  "scalar initialized from empty initializer list is incompatible with C++98">,
5757  InGroup<CXX98Compat>, DefaultIgnore;
5758def warn_cxx98_compat_empty_sizeless_initializer : Warning<
5759  "initializing %0 from an empty initializer list is incompatible with C++98">,
5760  InGroup<CXX98Compat>, DefaultIgnore;
5761def warn_cxx98_compat_reference_list_init : Warning<
5762  "reference initialized from initializer list is incompatible with C++98">,
5763  InGroup<CXX98Compat>, DefaultIgnore;
5764def warn_cxx98_compat_initializer_list_init : Warning<
5765  "initialization of initializer_list object is incompatible with C++98">,
5766  InGroup<CXX98Compat>, DefaultIgnore;
5767def warn_cxx98_compat_ctor_list_init : Warning<
5768  "constructor call from initializer list is incompatible with C++98">,
5769  InGroup<CXX98Compat>, DefaultIgnore;
5770def err_illegal_initializer : Error<
5771  "illegal initializer (only variables can be initialized)">;
5772def err_illegal_initializer_type : Error<"illegal initializer type %0">;
5773def ext_init_list_type_narrowing : ExtWarn<
5774  "type %0 cannot be narrowed to %1 in initializer list">,
5775  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5776def ext_init_list_variable_narrowing : ExtWarn<
5777  "non-constant-expression cannot be narrowed from type %0 to %1 in "
5778  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5779def ext_init_list_constant_narrowing : ExtWarn<
5780  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
5781  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5782def warn_init_list_type_narrowing : Warning<
5783  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
5784  InGroup<CXX11Narrowing>, DefaultIgnore;
5785def warn_init_list_variable_narrowing : Warning<
5786  "non-constant-expression cannot be narrowed from type %0 to %1 in "
5787  "initializer list in C++11">,
5788  InGroup<CXX11Narrowing>, DefaultIgnore;
5789def warn_init_list_constant_narrowing : Warning<
5790  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
5791  "C++11">,
5792  InGroup<CXX11Narrowing>, DefaultIgnore;
5793def note_init_list_narrowing_silence : Note<
5794  "insert an explicit cast to silence this issue">;
5795def err_init_objc_class : Error<
5796  "cannot initialize Objective-C class type %0">;
5797def err_implicit_empty_initializer : Error<
5798  "initializer for aggregate with no elements requires explicit braces">;
5799def err_bitfield_has_negative_width : Error<
5800  "bit-field %0 has negative width (%1)">;
5801def err_anon_bitfield_has_negative_width : Error<
5802  "anonymous bit-field has negative width (%0)">;
5803def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
5804def err_bitfield_width_exceeds_type_width : Error<
5805  "width of bit-field %0 (%1 bits) exceeds %select{width|size}2 "
5806  "of its type (%3 bit%s3)">;
5807def err_anon_bitfield_width_exceeds_type_width : Error<
5808  "width of anonymous bit-field (%0 bits) exceeds %select{width|size}1 "
5809  "of its type (%2 bit%s2)">;
5810def err_incorrect_number_of_vector_initializers : Error<
5811  "number of elements must be either one or match the size of the vector">;
5812
5813// Used by C++ which allows bit-fields that are wider than the type.
5814def warn_bitfield_width_exceeds_type_width: Warning<
5815  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
5816  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
5817def err_bitfield_too_wide : Error<
5818  "%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
5819def warn_bitfield_too_small_for_enum : Warning<
5820  "bit-field %0 is not wide enough to store all enumerators of %1">,
5821  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5822def note_widen_bitfield : Note<
5823  "widen this field to %0 bits to store all values of %1">;
5824def warn_unsigned_bitfield_assigned_signed_enum : Warning<
5825  "assigning value of signed enum type %1 to unsigned bit-field %0; "
5826  "negative enumerators of enum %1 will be converted to positive values">,
5827  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5828def warn_signed_bitfield_enum_conversion : Warning<
5829  "signed bit-field %0 needs an extra bit to represent the largest positive "
5830  "enumerators of %1">,
5831  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5832def note_change_bitfield_sign : Note<
5833  "consider making the bitfield type %select{unsigned|signed}0">;
5834
5835def warn_missing_braces : Warning<
5836  "suggest braces around initialization of subobject">,
5837  InGroup<MissingBraces>, DefaultIgnore;
5838
5839def err_redefinition_of_label : Error<"redefinition of label %0">;
5840def err_undeclared_label_use : Error<"use of undeclared label %0">;
5841def err_goto_ms_asm_label : Error<
5842  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
5843def note_goto_ms_asm_label : Note<
5844  "inline assembly label %0 declared here">;
5845def warn_unused_label : Warning<"unused label %0">,
5846  InGroup<UnusedLabel>, DefaultIgnore;
5847
5848def err_continue_from_cond_var_init : Error<
5849  "cannot jump from this continue statement to the loop increment; "
5850  "jump bypasses initialization of loop condition variable">;
5851def err_goto_into_protected_scope : Error<
5852  "cannot jump from this goto statement to its label">;
5853def ext_goto_into_protected_scope : ExtWarn<
5854  "jump from this goto statement to its label is a Microsoft extension">,
5855  InGroup<MicrosoftGoto>;
5856def warn_cxx98_compat_goto_into_protected_scope : Warning<
5857  "jump from this goto statement to its label is incompatible with C++98">,
5858  InGroup<CXX98Compat>, DefaultIgnore;
5859def err_switch_into_protected_scope : Error<
5860  "cannot jump from switch statement to this case label">;
5861def warn_cxx98_compat_switch_into_protected_scope : Warning<
5862  "jump from switch statement to this case label is incompatible with C++98">,
5863  InGroup<CXX98Compat>, DefaultIgnore;
5864def err_indirect_goto_without_addrlabel : Error<
5865  "indirect goto in function with no address-of-label expressions">;
5866def err_indirect_goto_in_protected_scope : Error<
5867  "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
5868def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
5869  "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
5870  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5871def note_indirect_goto_target : Note<
5872  "possible target of %select{indirect|asm}0 goto statement">;
5873def note_protected_by_variable_init : Note<
5874  "jump bypasses variable initialization">;
5875def note_protected_by_variable_nontriv_destructor : Note<
5876  "jump bypasses variable with a non-trivial destructor">;
5877def note_protected_by_variable_non_pod : Note<
5878  "jump bypasses initialization of non-POD variable">;
5879def note_protected_by_cleanup : Note<
5880  "jump bypasses initialization of variable with __attribute__((cleanup))">;
5881def note_protected_by_vla_typedef : Note<
5882  "jump bypasses initialization of VLA typedef">;
5883def note_protected_by_vla_type_alias : Note<
5884  "jump bypasses initialization of VLA type alias">;
5885def note_protected_by_constexpr_if : Note<
5886  "jump enters controlled statement of constexpr if">;
5887def note_protected_by_if_available : Note<
5888  "jump enters controlled statement of if available">;
5889def note_protected_by_vla : Note<
5890  "jump bypasses initialization of variable length array">;
5891def note_protected_by_objc_fast_enumeration : Note<
5892  "jump enters Objective-C fast enumeration loop">;
5893def note_protected_by_objc_try : Note<
5894  "jump bypasses initialization of @try block">;
5895def note_protected_by_objc_catch : Note<
5896  "jump bypasses initialization of @catch block">;
5897def note_protected_by_objc_finally : Note<
5898  "jump bypasses initialization of @finally block">;
5899def note_protected_by_objc_synchronized : Note<
5900  "jump bypasses initialization of @synchronized block">;
5901def note_protected_by_objc_autoreleasepool : Note<
5902  "jump bypasses auto release push of @autoreleasepool block">;
5903def note_protected_by_cxx_try : Note<
5904  "jump bypasses initialization of try block">;
5905def note_protected_by_cxx_catch : Note<
5906  "jump bypasses initialization of catch block">;
5907def note_protected_by_seh_try : Note<
5908  "jump bypasses initialization of __try block">;
5909def note_protected_by_seh_except : Note<
5910  "jump bypasses initialization of __except block">;
5911def note_protected_by_seh_finally : Note<
5912  "jump bypasses initialization of __finally block">;
5913def note_protected_by___block : Note<
5914  "jump bypasses setup of __block variable">;
5915def note_protected_by_objc_strong_init : Note<
5916  "jump bypasses initialization of __strong variable">;
5917def note_protected_by_objc_weak_init : Note<
5918  "jump bypasses initialization of __weak variable">;
5919def note_protected_by_non_trivial_c_struct_init : Note<
5920  "jump bypasses initialization of variable of non-trivial C struct type">;
5921def note_enters_block_captures_cxx_obj : Note<
5922  "jump enters lifetime of block which captures a destructible C++ object">;
5923def note_enters_block_captures_strong : Note<
5924  "jump enters lifetime of block which strongly captures a variable">;
5925def note_enters_block_captures_weak : Note<
5926  "jump enters lifetime of block which weakly captures a variable">;
5927def note_enters_block_captures_non_trivial_c_struct : Note<
5928  "jump enters lifetime of block which captures a C struct that is non-trivial "
5929  "to destroy">;
5930def note_enters_compound_literal_scope : Note<
5931  "jump enters lifetime of a compound literal that is non-trivial to destruct">;
5932
5933def note_exits_cleanup : Note<
5934  "jump exits scope of variable with __attribute__((cleanup))">;
5935def note_exits_dtor : Note<
5936  "jump exits scope of variable with non-trivial destructor">;
5937def note_exits_temporary_dtor : Note<
5938  "jump exits scope of lifetime-extended temporary with non-trivial "
5939  "destructor">;
5940def note_exits___block : Note<
5941  "jump exits scope of __block variable">;
5942def note_exits_objc_try : Note<
5943  "jump exits @try block">;
5944def note_exits_objc_catch : Note<
5945  "jump exits @catch block">;
5946def note_exits_objc_finally : Note<
5947  "jump exits @finally block">;
5948def note_exits_objc_synchronized : Note<
5949  "jump exits @synchronized block">;
5950def note_exits_cxx_try : Note<
5951  "jump exits try block">;
5952def note_exits_cxx_catch : Note<
5953  "jump exits catch block">;
5954def note_exits_seh_try : Note<
5955  "jump exits __try block">;
5956def note_exits_seh_except : Note<
5957  "jump exits __except block">;
5958def note_exits_seh_finally : Note<
5959  "jump exits __finally block">;
5960def note_exits_objc_autoreleasepool : Note<
5961  "jump exits autoreleasepool block">;
5962def note_exits_objc_strong : Note<
5963  "jump exits scope of __strong variable">;
5964def note_exits_objc_weak : Note<
5965  "jump exits scope of __weak variable">;
5966def note_exits_block_captures_cxx_obj : Note<
5967  "jump exits lifetime of block which captures a destructible C++ object">;
5968def note_exits_block_captures_strong : Note<
5969  "jump exits lifetime of block which strongly captures a variable">;
5970def note_exits_block_captures_weak : Note<
5971  "jump exits lifetime of block which weakly captures a variable">;
5972def note_exits_block_captures_non_trivial_c_struct : Note<
5973  "jump exits lifetime of block which captures a C struct that is non-trivial "
5974  "to destroy">;
5975def note_exits_compound_literal_scope : Note<
5976  "jump exits lifetime of a compound literal that is non-trivial to destruct">;
5977
5978def err_func_returning_qualified_void : ExtWarn<
5979  "function cannot return qualified void type %0">,
5980  InGroup<DiagGroup<"qualified-void-return-type">>;
5981def err_func_returning_array_function : Error<
5982  "function cannot return %select{array|function}0 type %1">;
5983def err_field_declared_as_function : Error<"field %0 declared as a function">;
5984def err_field_incomplete_or_sizeless : Error<
5985  "field has %select{incomplete|sizeless}0 type %1">;
5986def ext_variable_sized_type_in_struct : ExtWarn<
5987  "field %0 with variable sized type %1 not at the end of a struct or class is"
5988  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
5989
5990def ext_c99_flexible_array_member : Extension<
5991  "flexible array members are a C99 feature">, InGroup<C99>;
5992def err_flexible_array_virtual_base : Error<
5993  "flexible array member %0 not allowed in "
5994  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
5995def err_flexible_array_empty_aggregate : Error<
5996  "flexible array member %0 not allowed in otherwise empty "
5997  "%select{struct|interface|union|class|enum}1">;
5998def err_flexible_array_has_nontrivial_dtor : Error<
5999  "flexible array member %0 of type %1 with non-trivial destruction">;
6000def ext_flexible_array_in_struct : Extension<
6001  "%0 may not be nested in a struct due to flexible array member">,
6002  InGroup<FlexibleArrayExtensions>;
6003def ext_flexible_array_in_array : Extension<
6004  "%0 may not be used as an array element due to flexible array member">,
6005  InGroup<FlexibleArrayExtensions>;
6006def err_flexible_array_init : Error<
6007  "initialization of flexible array member is not allowed">;
6008def ext_flexible_array_empty_aggregate_ms : Extension<
6009  "flexible array member %0 in otherwise empty "
6010  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
6011  InGroup<MicrosoftFlexibleArray>;
6012def err_flexible_array_union : Error<
6013  "flexible array member %0 in a union is not allowed">;
6014def ext_flexible_array_union_ms : Extension<
6015  "flexible array member %0 in a union is a Microsoft extension">,
6016  InGroup<MicrosoftFlexibleArray>;
6017def ext_flexible_array_empty_aggregate_gnu : Extension<
6018  "flexible array member %0 in otherwise empty "
6019  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
6020  InGroup<GNUEmptyStruct>;
6021def ext_flexible_array_union_gnu : Extension<
6022  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
6023
6024def err_flexible_array_not_at_end : Error<
6025  "flexible array member %0 with type %1 is not at the end of"
6026  " %select{struct|interface|union|class|enum}2">;
6027def err_objc_variable_sized_type_not_at_end : Error<
6028  "field %0 with variable sized type %1 is not at the end of class">;
6029def note_next_field_declaration : Note<
6030  "next field declaration is here">;
6031def note_next_ivar_declaration : Note<
6032  "next %select{instance variable declaration|synthesized instance variable}0"
6033  " is here">;
6034def err_synthesize_variable_sized_ivar : Error<
6035  "synthesized property with variable size type %0"
6036  " requires an existing instance variable">;
6037def err_flexible_array_arc_retainable : Error<
6038  "ARC forbids flexible array members with retainable object type">;
6039def warn_variable_sized_ivar_visibility : Warning<
6040  "field %0 with variable sized type %1 is not visible to subclasses and"
6041  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
6042def warn_superclass_variable_sized_type_not_at_end : Warning<
6043  "field %0 can overwrite instance variable %1 with variable sized type %2"
6044  " in superclass %3">, InGroup<ObjCFlexibleArray>;
6045
6046let CategoryName = "ARC Semantic Issue" in {
6047
6048// ARC-mode diagnostics.
6049
6050let CategoryName = "ARC Weak References" in {
6051
6052def err_arc_weak_no_runtime : Error<
6053  "cannot create __weak reference because the current deployment target "
6054  "does not support weak references">;
6055def err_arc_weak_disabled : Error<
6056  "cannot create __weak reference in file using manual reference counting">;
6057def err_synthesizing_arc_weak_property_disabled : Error<
6058  "cannot synthesize weak property in file using manual reference counting">;
6059def err_synthesizing_arc_weak_property_no_runtime : Error<
6060  "cannot synthesize weak property because the current deployment target "
6061  "does not support weak references">;
6062def err_arc_unsupported_weak_class : Error<
6063  "class is incompatible with __weak references">;
6064def err_arc_weak_unavailable_assign : Error<
6065  "assignment of a weak-unavailable object to a __weak object">;
6066def err_arc_weak_unavailable_property : Error<
6067  "synthesizing __weak instance variable of type %0, which does not "
6068  "support weak references">;
6069def note_implemented_by_class : Note<
6070  "when implemented by class %0">;
6071def err_arc_convesion_of_weak_unavailable : Error<
6072  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
6073  " a __weak object of type %2">;
6074
6075} // end "ARC Weak References" category
6076
6077let CategoryName = "ARC Restrictions" in {
6078
6079def err_unavailable_in_arc : Error<
6080  "%0 is unavailable in ARC">;
6081def note_arc_forbidden_type : Note<
6082  "declaration uses type that is ill-formed in ARC">;
6083def note_performs_forbidden_arc_conversion : Note<
6084  "inline function performs a conversion which is forbidden in ARC">;
6085def note_arc_init_returns_unrelated : Note<
6086  "init method must return a type related to its receiver type">;
6087def note_arc_weak_disabled : Note<
6088  "declaration uses __weak, but ARC is disabled">;
6089def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
6090  "the current deployment target does not support">;
6091def note_arc_field_with_ownership : Note<
6092  "field has non-trivial ownership qualification">;
6093
6094def err_arc_illegal_explicit_message : Error<
6095  "ARC forbids explicit message send of %0">;
6096def err_arc_unused_init_message : Error<
6097  "the result of a delegate init call must be immediately returned "
6098  "or assigned to 'self'">;
6099def err_arc_mismatched_cast : Error<
6100  "%select{implicit conversion|cast}0 of "
6101  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
6102  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
6103  " to %3 is disallowed with ARC">;
6104def err_arc_nolifetime_behavior : Error<
6105  "explicit ownership qualifier on cast result has no effect">;
6106def err_arc_objc_property_default_assign_on_object : Error<
6107  "ARC forbids synthesizing a property of an Objective-C object "
6108  "with unspecified ownership or storage attribute">;
6109def err_arc_illegal_selector : Error<
6110  "ARC forbids use of %0 in a @selector">;
6111def err_arc_illegal_method_def : Error<
6112  "ARC forbids %select{implementation|synthesis}0 of %1">;
6113def warn_arc_strong_pointer_objc_pointer : Warning<
6114  "method parameter of type %0 with no explicit ownership">,
6115  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
6116
6117} // end "ARC Restrictions" category
6118
6119def err_arc_lost_method_convention : Error<
6120  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
6121  "method, but its implementation doesn't match because %select{"
6122  "its result type is not an object pointer|"
6123  "its result type is unrelated to its receiver type}1">;
6124def note_arc_lost_method_convention : Note<"declaration in interface">;
6125def err_arc_gained_method_convention : Error<
6126  "method implementation does not match its declaration">;
6127def note_arc_gained_method_convention : Note<
6128  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
6129  "family because %select{its result type is not an object pointer|"
6130  "its result type is unrelated to its receiver type}1">;
6131def err_typecheck_arc_assign_self : Error<
6132  "cannot assign to 'self' outside of a method in the init family">;
6133def err_typecheck_arc_assign_self_class_method : Error<
6134  "cannot assign to 'self' in a class method">;
6135def err_typecheck_arr_assign_enumeration : Error<
6136  "fast enumeration variables cannot be modified in ARC by default; "
6137  "declare the variable __strong to allow this">;
6138def err_typecheck_arc_assign_externally_retained : Error<
6139  "variable declared with 'objc_externally_retained' "
6140  "cannot be modified in ARC">;
6141def warn_arc_retained_assign : Warning<
6142  "assigning retained object to %select{weak|unsafe_unretained}0 "
6143  "%select{property|variable}1"
6144  "; object will be released after assignment">,
6145  InGroup<ARCUnsafeRetainedAssign>;
6146def warn_arc_retained_property_assign : Warning<
6147  "assigning retained object to unsafe property"
6148  "; object will be released after assignment">,
6149  InGroup<ARCUnsafeRetainedAssign>;
6150def warn_arc_literal_assign : Warning<
6151  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
6152  " to a weak %select{property|variable}1"
6153  "; object will be released after assignment">,
6154  InGroup<ARCUnsafeRetainedAssign>;
6155def err_arc_new_array_without_ownership : Error<
6156  "'new' cannot allocate an array of %0 with no explicit ownership">;
6157def err_arc_autoreleasing_var : Error<
6158  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
6159  "__autoreleasing ownership">;
6160def err_arc_autoreleasing_capture : Error<
6161  "cannot capture __autoreleasing variable in a "
6162  "%select{block|lambda by copy}0">;
6163def err_arc_thread_ownership : Error<
6164  "thread-local variable has non-trivial ownership: type is %0">;
6165def err_arc_indirect_no_ownership : Error<
6166  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6167def err_arc_array_param_no_ownership : Error<
6168  "must explicitly describe intended ownership of an object array parameter">;
6169def err_arc_pseudo_dtor_inconstant_quals : Error<
6170  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6171  "type %1">;
6172def err_arc_init_method_unrelated_result_type : Error<
6173  "init methods must return a type related to the receiver type">;
6174def err_arc_nonlocal_writeback : Error<
6175  "passing address of %select{non-local|non-scalar}0 object to "
6176  "__autoreleasing parameter for write-back">;
6177def err_arc_method_not_found : Error<
6178  "no known %select{instance|class}1 method for selector %0">;
6179def err_arc_receiver_forward_class : Error<
6180  "receiver %0 for class message is a forward declaration">;
6181def err_arc_may_not_respond : Error<
6182  "no visible @interface for %0 declares the selector %1">;
6183def err_arc_receiver_forward_instance : Error<
6184  "receiver type %0 for instance message is a forward declaration">;
6185def warn_receiver_forward_instance : Warning<
6186  "receiver type %0 for instance message is a forward declaration">,
6187  InGroup<ForwardClassReceiver>, DefaultIgnore;
6188def err_arc_collection_forward : Error<
6189  "collection expression type %0 is a forward declaration">;
6190def err_arc_multiple_method_decl : Error<
6191  "multiple methods named %0 found with mismatched result, "
6192  "parameter type or attributes">;
6193def warn_arc_lifetime_result_type : Warning<
6194  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6195  "lifetime qualifier on return type is ignored">,
6196  InGroup<IgnoredQualifiers>;
6197
6198let CategoryName = "ARC Retain Cycle" in {
6199
6200def warn_arc_retain_cycle : Warning<
6201  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6202  InGroup<ARCRetainCycles>;
6203def note_arc_retain_cycle_owner : Note<
6204  "block will be retained by %select{the captured object|an object strongly "
6205  "retained by the captured object}0">;
6206
6207} // end "ARC Retain Cycle" category
6208
6209def warn_arc_object_memaccess : Warning<
6210  "%select{destination for|source of}0 this %1 call is a pointer to "
6211  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6212
6213let CategoryName = "ARC and @properties" in {
6214
6215def err_arc_strong_property_ownership : Error<
6216  "existing instance variable %1 for strong property %0 may not be "
6217  "%select{|__unsafe_unretained||__weak}2">;
6218def err_arc_assign_property_ownership : Error<
6219  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6220  "attribute must be __unsafe_unretained">;
6221def err_arc_inconsistent_property_ownership : Error<
6222  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6223  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6224
6225} // end "ARC and @properties" category
6226
6227def warn_block_capture_autoreleasing : Warning<
6228  "block captures an autoreleasing out-parameter, which may result in "
6229  "use-after-free bugs">,
6230  InGroup<BlockCaptureAutoReleasing>;
6231def note_declare_parameter_strong : Note<
6232  "declare the parameter __strong or capture a __block __strong variable to "
6233  "keep values alive across autorelease pools">;
6234
6235def err_arc_atomic_ownership : Error<
6236  "cannot perform atomic operation on a pointer to type %0: type has "
6237  "non-trivial ownership">;
6238
6239let CategoryName = "ARC Casting Rules" in {
6240
6241def err_arc_bridge_cast_incompatible : Error<
6242  "incompatible types casting %0 to %1 with a %select{__bridge|"
6243  "__bridge_transfer|__bridge_retained}2 cast">;
6244def err_arc_bridge_cast_wrong_kind : Error<
6245  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6246  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6247  "__bridge_transfer|__bridge_retained}4">;
6248def err_arc_cast_requires_bridge : Error<
6249  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6250  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6251  "requires a bridged cast">;
6252def note_arc_bridge : Note<
6253  "use __bridge to convert directly (no change in ownership)">;
6254def note_arc_cstyle_bridge : Note<
6255  "use __bridge with C-style cast to convert directly (no change in ownership)">;
6256def note_arc_bridge_transfer : Note<
6257  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6258  "ownership of a +1 %0 into ARC">;
6259def note_arc_cstyle_bridge_transfer : Note<
6260  "use __bridge_transfer with C-style cast to transfer "
6261  "ownership of a +1 %0 into ARC">;
6262def note_arc_bridge_retained : Note<
6263  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6264  "ARC object available as a +1 %0">;
6265def note_arc_cstyle_bridge_retained : Note<
6266  "use __bridge_retained with C-style cast to make an "
6267  "ARC object available as a +1 %0">;
6268
6269} // ARC Casting category
6270
6271} // ARC category name
6272
6273def err_flexible_array_init_needs_braces : Error<
6274  "flexible array requires brace-enclosed initializer">;
6275def err_illegal_decl_array_of_functions : Error<
6276  "'%0' declared as array of functions of type %1">;
6277def err_array_incomplete_or_sizeless_type : Error<
6278  "array has %select{incomplete|sizeless}0 element type %1">;
6279def err_illegal_message_expr_incomplete_type : Error<
6280  "Objective-C message has incomplete result type %0">;
6281def err_illegal_decl_array_of_references : Error<
6282  "'%0' declared as array of references of type %1">;
6283def err_decl_negative_array_size : Error<
6284  "'%0' declared as an array with a negative size">;
6285def err_array_static_outside_prototype : Error<
6286  "%0 used in array declarator outside of function prototype">;
6287def err_array_static_not_outermost : Error<
6288  "%0 used in non-outermost array type derivation">;
6289def err_array_star_outside_prototype : Error<
6290  "star modifier used outside of function prototype">;
6291def err_illegal_decl_pointer_to_reference : Error<
6292  "'%0' declared as a pointer to a reference of type %1">;
6293def err_illegal_decl_mempointer_to_reference : Error<
6294  "'%0' declared as a member pointer to a reference of type %1">;
6295def err_illegal_decl_mempointer_to_void : Error<
6296  "'%0' declared as a member pointer to void">;
6297def err_illegal_decl_mempointer_in_nonclass : Error<
6298  "'%0' does not point into a class">;
6299def err_mempointer_in_nonclass_type : Error<
6300  "member pointer refers into non-class type %0">;
6301def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6302def err_nonfunction_block_type : Error<
6303  "block pointer to non-function type is invalid">;
6304def err_return_block_has_expr : Error<"void block should not return a value">;
6305def err_block_return_missing_expr : Error<
6306  "non-void block should return a value">;
6307def err_func_def_incomplete_result : Error<
6308  "incomplete result type %0 in function definition">;
6309def err_atomic_specifier_bad_type
6310    : Error<"_Atomic cannot be applied to "
6311            "%select{incomplete |array |function |reference |atomic |qualified "
6312            "|sizeless ||integer }0type "
6313            "%1 %select{|||||||which is not trivially copyable|}0">;
6314
6315// Expressions.
6316def ext_sizeof_alignof_function_type : Extension<
6317  "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6318def ext_sizeof_alignof_void_type : Extension<
6319  "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6320def err_opencl_sizeof_alignof_type : Error<
6321  "invalid application of '%0' to a void type">;
6322def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6323  "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6324def err_sizeof_alignof_function_type : Error<
6325  "invalid application of '%0' to a function type">;
6326def err_openmp_default_simd_align_expr : Error<
6327  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6328def err_sizeof_alignof_typeof_bitfield : Error<
6329  "invalid application of '%select{sizeof|alignof|typeof}0' to bit-field">;
6330def err_alignof_member_of_incomplete_type : Error<
6331  "invalid application of 'alignof' to a field of a class still being defined">;
6332def err_vecstep_non_scalar_vector_type : Error<
6333  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6334def err_offsetof_incomplete_type : Error<
6335  "offsetof of incomplete type %0">;
6336def err_offsetof_record_type : Error<
6337  "offsetof requires struct, union, or class type, %0 invalid">;
6338def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6339def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6340  InGroup<InvalidOffsetof>;
6341def ext_offsetof_non_standardlayout_type : ExtWarn<
6342  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6343def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6344def err_offsetof_field_of_virtual_base : Error<
6345  "invalid application of 'offsetof' to a field of a virtual base">;
6346def warn_sub_ptr_zero_size_types : Warning<
6347  "subtraction of pointers to type %0 of zero size has undefined behavior">,
6348  InGroup<PointerArith>;
6349def warn_pointer_arith_null_ptr : Warning<
6350  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6351  InGroup<NullPointerArithmetic>, DefaultIgnore;
6352def warn_gnu_null_ptr_arith : Warning<
6353  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6354  InGroup<NullPointerArithmetic>, DefaultIgnore;
6355
6356def warn_floatingpoint_eq : Warning<
6357  "comparing floating point with == or != is unsafe">,
6358  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6359
6360def warn_remainder_division_by_zero : Warning<
6361  "%select{remainder|division}0 by zero is undefined">,
6362  InGroup<DivZero>;
6363def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6364  InGroup<DiagGroup<"shift-negative-value">>;
6365def warn_shift_negative : Warning<"shift count is negative">,
6366  InGroup<DiagGroup<"shift-count-negative">>;
6367def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6368  InGroup<DiagGroup<"shift-count-overflow">>;
6369def warn_shift_result_gt_typewidth : Warning<
6370  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6371  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6372def warn_shift_result_sets_sign_bit : Warning<
6373  "signed shift result (%0) sets the sign bit of the shift expression's "
6374  "type (%1) and becomes negative">,
6375  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6376
6377def warn_precedence_bitwise_rel : Warning<
6378  "%0 has lower precedence than %1; %1 will be evaluated first">,
6379  InGroup<Parentheses>;
6380def note_precedence_bitwise_first : Note<
6381  "place parentheses around the %0 expression to evaluate it first">;
6382def note_precedence_silence : Note<
6383  "place parentheses around the '%0' expression to silence this warning">;
6384
6385def warn_precedence_conditional : Warning<
6386  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6387  InGroup<Parentheses>;
6388def warn_precedence_bitwise_conditional : Warning<
6389  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6390  InGroup<BitwiseConditionalParentheses>;
6391def note_precedence_conditional_first : Note<
6392  "place parentheses around the '?:' expression to evaluate it first">;
6393
6394def warn_enum_constant_in_bool_context : Warning<
6395  "converting the enum constant to a boolean">,
6396  InGroup<IntInBoolContext>, DefaultIgnore;
6397def warn_left_shift_in_bool_context : Warning<
6398  "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6399  InGroup<IntInBoolContext>, DefaultIgnore;
6400def warn_logical_instead_of_bitwise : Warning<
6401  "use of logical '%0' with constant operand">,
6402  InGroup<DiagGroup<"constant-logical-operand">>;
6403def note_logical_instead_of_bitwise_change_operator : Note<
6404  "use '%0' for a bitwise operation">;
6405def note_logical_instead_of_bitwise_remove_constant : Note<
6406  "remove constant to silence this warning">;
6407
6408def warn_bitwise_op_in_bitwise_op : Warning<
6409  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6410
6411def warn_logical_and_in_logical_or : Warning<
6412  "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6413
6414def warn_overloaded_shift_in_comparison :Warning<
6415  "overloaded operator %select{>>|<<}0 has higher precedence than "
6416  "comparison operator">,
6417  InGroup<OverloadedShiftOpParentheses>;
6418def note_evaluate_comparison_first :Note<
6419  "place parentheses around comparison expression to evaluate it first">;
6420
6421def note_concatenated_string_literal_silence :Note<
6422  "place parentheses around the string literal to silence warning">;
6423
6424def warn_addition_in_bitshift : Warning<
6425  "operator '%0' has lower precedence than '%1'; "
6426  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6427
6428def warn_self_assignment_builtin : Warning<
6429  "explicitly assigning value of variable of type %0 to itself">,
6430  InGroup<SelfAssignment>, DefaultIgnore;
6431def warn_self_assignment_overloaded : Warning<
6432  "explicitly assigning value of variable of type %0 to itself">,
6433  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6434def warn_self_move : Warning<
6435  "explicitly moving variable of type %0 to itself">,
6436  InGroup<SelfMove>, DefaultIgnore;
6437
6438def warn_redundant_move_on_return : Warning<
6439  "redundant move in return statement">,
6440  InGroup<RedundantMove>, DefaultIgnore;
6441def warn_pessimizing_move_on_return : Warning<
6442  "moving a local object in a return statement prevents copy elision">,
6443  InGroup<PessimizingMove>, DefaultIgnore;
6444def warn_pessimizing_move_on_initialization : Warning<
6445  "moving a temporary object prevents copy elision">,
6446  InGroup<PessimizingMove>, DefaultIgnore;
6447def note_remove_move : Note<"remove std::move call here">;
6448
6449def warn_return_std_move : Warning<
6450  "local variable %0 will be copied despite being %select{returned|thrown}1 by name">,
6451  InGroup<ReturnStdMove>, DefaultIgnore;
6452def note_add_std_move : Note<
6453  "call 'std::move' explicitly to avoid copying">;
6454
6455def warn_string_plus_int : Warning<
6456  "adding %0 to a string does not append to the string">,
6457  InGroup<StringPlusInt>;
6458def warn_string_plus_char : Warning<
6459  "adding %0 to a string pointer does not append to the string">,
6460  InGroup<StringPlusChar>;
6461def note_string_plus_scalar_silence : Note<
6462  "use array indexing to silence this warning">;
6463
6464def warn_sizeof_array_param : Warning<
6465  "sizeof on array function parameter will return size of %0 instead of %1">,
6466  InGroup<SizeofArrayArgument>;
6467
6468def warn_sizeof_array_decay : Warning<
6469  "sizeof on pointer operation will return size of %0 instead of %1">,
6470  InGroup<SizeofArrayDecay>;
6471
6472def err_sizeof_nonfragile_interface : Error<
6473  "application of '%select{alignof|sizeof}1' to interface %0 is "
6474  "not supported on this architecture and platform">;
6475def err_atdef_nonfragile_interface : Error<
6476  "use of @defs is not supported on this architecture and platform">;
6477def err_subscript_nonfragile_interface : Error<
6478  "subscript requires size of interface %0, which is not constant for "
6479  "this architecture and platform">;
6480
6481def err_arithmetic_nonfragile_interface : Error<
6482  "arithmetic on pointer to interface %0, which is not a constant size for "
6483  "this architecture and platform">;
6484
6485def warn_deprecated_comma_subscript : Warning<
6486  "top-level comma expression in array subscript is deprecated">,
6487  InGroup<DeprecatedCommaSubscript>;
6488
6489def ext_subscript_non_lvalue : Extension<
6490  "ISO C90 does not allow subscripting non-lvalue array">;
6491def err_typecheck_subscript_value : Error<
6492  "subscripted value is not an array, pointer, or vector">;
6493def err_typecheck_subscript_not_integer : Error<
6494  "array subscript is not an integer">;
6495def err_subscript_function_type : Error<
6496  "subscript of pointer to function type %0">;
6497def err_subscript_incomplete_or_sizeless_type : Error<
6498  "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6499def err_dereference_incomplete_type : Error<
6500  "dereference of pointer to incomplete type %0">;
6501def ext_gnu_subscript_void_type : Extension<
6502  "subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
6503def err_typecheck_member_reference_struct_union : Error<
6504  "member reference base type %0 is not a structure or union">;
6505def err_typecheck_member_reference_ivar : Error<
6506  "%0 does not have a member named %1">;
6507def err_arc_weak_ivar_access : Error<
6508  "dereferencing a __weak pointer is not allowed due to possible "
6509  "null value caused by race condition, assign it to strong variable first">;
6510def err_typecheck_member_reference_arrow : Error<
6511  "member reference type %0 is not a pointer">;
6512def err_typecheck_member_reference_suggestion : Error<
6513  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6514def note_typecheck_member_reference_suggestion : Note<
6515  "did you mean to use '.' instead?">;
6516def note_member_reference_arrow_from_operator_arrow : Note<
6517  "'->' applied to return value of the operator->() declared here">;
6518def err_typecheck_member_reference_type : Error<
6519  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6520def err_typecheck_member_reference_unknown : Error<
6521  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6522def err_member_reference_needs_call : Error<
6523  "base of member reference is a function; perhaps you meant to call "
6524  "it%select{| with no arguments}0?">;
6525def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6526  InGroup<CharSubscript>, DefaultIgnore;
6527
6528def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6529def err_no_member : Error<"no member named %0 in %1">;
6530def err_no_member_overloaded_arrow : Error<
6531  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6532
6533def err_member_not_yet_instantiated : Error<
6534  "no member %0 in %1; it has not yet been instantiated">;
6535def note_non_instantiated_member_here : Note<
6536  "not-yet-instantiated member is declared here">;
6537
6538def err_enumerator_does_not_exist : Error<
6539  "enumerator %0 does not exist in instantiation of %1">;
6540def note_enum_specialized_here : Note<
6541  "enum %0 was explicitly specialized here">;
6542
6543def err_specialization_not_primary_template : Error<
6544  "cannot reference member of primary template because deduced class "
6545  "template specialization %0 is %select{instantiated from a partial|"
6546  "an explicit}1 specialization">;
6547
6548def err_member_redeclared : Error<"class member cannot be redeclared">;
6549def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6550  InGroup<RedeclaredClassMember>;
6551def err_member_redeclared_in_instantiation : Error<
6552  "multiple overloads of %0 instantiate to the same signature %1">;
6553def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6554def err_member_def_undefined_record : Error<
6555  "out-of-line definition of %0 from class %1 without definition">;
6556def err_member_decl_does_not_match : Error<
6557  "out-of-line %select{declaration|definition}2 of %0 "
6558  "does not match any declaration in %1">;
6559def err_friend_decl_with_def_arg_must_be_def : Error<
6560  "friend declaration specifying a default argument must be a definition">;
6561def err_friend_decl_with_def_arg_redeclared : Error<
6562  "friend declaration specifying a default argument must be the only declaration">;
6563def err_friend_decl_does_not_match : Error<
6564  "friend declaration of %0 does not match any declaration in %1">;
6565def err_member_decl_does_not_match_suggest : Error<
6566  "out-of-line %select{declaration|definition}2 of %0 "
6567  "does not match any declaration in %1; did you mean %3?">;
6568def err_member_def_does_not_match_ret_type : Error<
6569  "return type of out-of-line definition of %q0 differs from "
6570  "that in the declaration">;
6571def err_nonstatic_member_out_of_line : Error<
6572  "non-static data member defined out-of-line">;
6573def err_qualified_typedef_declarator : Error<
6574  "typedef declarator cannot be qualified">;
6575def err_qualified_param_declarator : Error<
6576  "parameter declarator cannot be qualified">;
6577def ext_out_of_line_declaration : ExtWarn<
6578  "out-of-line declaration of a member must be a definition">,
6579  InGroup<OutOfLineDeclaration>, DefaultError;
6580def err_member_extra_qualification : Error<
6581  "extra qualification on member %0">;
6582def warn_member_extra_qualification : Warning<
6583  err_member_extra_qualification.Text>, InGroup<MicrosoftExtraQualification>;
6584def warn_namespace_member_extra_qualification : Warning<
6585  "extra qualification on member %0">,
6586  InGroup<DiagGroup<"extra-qualification">>;
6587def err_member_qualification : Error<
6588  "non-friend class member %0 cannot have a qualified name">;
6589def note_member_def_close_match : Note<"member declaration nearly matches">;
6590def note_member_def_close_const_match : Note<
6591  "member declaration does not match because "
6592  "it %select{is|is not}0 const qualified">;
6593def note_member_def_close_param_match : Note<
6594  "type of %ordinal0 parameter of member declaration does not match definition"
6595  "%diff{ ($ vs $)|}1,2">;
6596def note_local_decl_close_match : Note<"local declaration nearly matches">;
6597def note_local_decl_close_param_match : Note<
6598  "type of %ordinal0 parameter of local declaration does not match definition"
6599  "%diff{ ($ vs $)|}1,2">;
6600def err_typecheck_ivar_variable_size : Error<
6601  "instance variables must have a constant size">;
6602def err_ivar_reference_type : Error<
6603  "instance variables cannot be of reference type">;
6604def err_typecheck_illegal_increment_decrement : Error<
6605  "cannot %select{decrement|increment}1 value of type %0">;
6606def err_typecheck_expect_int : Error<
6607  "used type %0 where integer is required">;
6608def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
6609  "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
6610def err_typecheck_pointer_arith_function_type : Error<
6611  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
6612  "function type%select{|s}2 %1%select{| and %3}2">;
6613def err_typecheck_pointer_arith_void_type : Error<
6614  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
6615def err_typecheck_decl_incomplete_type : Error<
6616  "variable has incomplete type %0">;
6617def ext_typecheck_decl_incomplete_type : ExtWarn<
6618  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
6619  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
6620def err_tentative_def_incomplete_type : Error<
6621  "tentative definition has type %0 that is never completed">;
6622def warn_tentative_incomplete_array : Warning<
6623  "tentative array definition assumed to have one element">;
6624def err_typecheck_incomplete_array_needs_initializer : Error<
6625  "definition of variable with array type needs an explicit size "
6626  "or an initializer">;
6627def err_array_init_not_init_list : Error<
6628  "array initializer must be an initializer "
6629  "list%select{| or string literal| or wide string literal}0">;
6630def err_array_init_narrow_string_into_wchar : Error<
6631  "initializing wide char array with non-wide string literal">;
6632def err_array_init_wide_string_into_char : Error<
6633  "initializing char array with wide string literal">;
6634def err_array_init_incompat_wide_string_into_wchar : Error<
6635  "initializing wide char array with incompatible wide string literal">;
6636def err_array_init_plain_string_into_char8_t : Error<
6637  "initializing 'char8_t' array with plain string literal">;
6638def note_array_init_plain_string_into_char8_t : Note<
6639  "add 'u8' prefix to form a 'char8_t' string literal">;
6640def err_array_init_utf8_string_into_char : Error<
6641  "%select{|ISO C++20 does not permit }0initialization of char array with "
6642  "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">;
6643def warn_cxx20_compat_utf8_string : Warning<
6644  "type of UTF-8 string literal will change from array of const char to "
6645  "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
6646def note_cxx20_compat_utf8_string_remove_u8 : Note<
6647  "remove 'u8' prefix to avoid a change of behavior; "
6648  "Clang encodes unprefixed narrow string literals as UTF-8">;
6649def err_array_init_different_type : Error<
6650  "cannot initialize array %diff{of type $ with array of type $|"
6651  "with different type of array}0,1">;
6652def err_array_init_non_constant_array : Error<
6653  "cannot initialize array %diff{of type $ with non-constant array of type $|"
6654  "with different type of array}0,1">;
6655def ext_array_init_copy : Extension<
6656  "initialization of an array "
6657  "%diff{of type $ from a compound literal of type $|"
6658  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
6659// This is intentionally not disabled by -Wno-gnu.
6660def ext_array_init_parens : ExtWarn<
6661  "parenthesized initialization of a member array is a GNU extension">,
6662  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
6663def warn_deprecated_string_literal_conversion : Warning<
6664  "conversion from string literal to %0 is deprecated">,
6665  InGroup<CXX11CompatDeprecatedWritableStr>;
6666def ext_deprecated_string_literal_conversion : ExtWarn<
6667  "ISO C++11 does not allow conversion from string literal to %0">,
6668  InGroup<WritableStrings>, SFINAEFailure;
6669def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
6670def err_typecheck_sclass_fscope : Error<
6671  "illegal storage class on file-scoped variable">;
6672def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
6673  InGroup<MissingDeclarations>;
6674def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
6675  "of a type">, InGroup<MissingDeclarations>;
6676def err_standalone_class_nested_name_specifier : Error<
6677  "forward declaration of %select{class|struct|interface|union|enum}0 cannot "
6678  "have a nested name specifier">;
6679def err_typecheck_sclass_func : Error<"illegal storage class on function">;
6680def err_static_block_func : Error<
6681  "function declared in block scope cannot have 'static' storage class">;
6682def err_typecheck_address_of : Error<"address of %select{bit-field"
6683  "|vector element|property expression|register variable|matrix element}0 requested">;
6684def ext_typecheck_addrof_void : Extension<
6685  "ISO C forbids taking the address of an expression of type 'void'">;
6686def err_unqualified_pointer_member_function : Error<
6687  "must explicitly qualify name of member function when taking its address">;
6688def err_invalid_form_pointer_member_function : Error<
6689  "cannot create a non-constant pointer to member function">;
6690def err_address_of_function_with_pass_object_size_params: Error<
6691  "cannot take address of function %0 because parameter %1 has "
6692  "pass_object_size attribute">;
6693def err_parens_pointer_member_function : Error<
6694  "cannot parenthesize the name of a method when forming a member pointer">;
6695def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
6696  "extra '&' taking address of overloaded function">;
6697def err_typecheck_invalid_lvalue_addrof : Error<
6698  "cannot take the address of an rvalue of type %0">;
6699def ext_typecheck_addrof_temporary : ExtWarn<
6700  "taking the address of a temporary object of type %0">,
6701  InGroup<AddressOfTemporary>, DefaultError;
6702def err_typecheck_addrof_temporary : Error<
6703  "taking the address of a temporary object of type %0">;
6704def err_typecheck_addrof_dtor : Error<
6705  "taking the address of a destructor">;
6706def err_typecheck_unary_expr : Error<
6707  "invalid argument type %0 to unary expression">;
6708def err_typecheck_indirection_requires_pointer : Error<
6709  "indirection requires pointer operand (%0 invalid)">;
6710def ext_typecheck_indirection_through_void_pointer : ExtWarn<
6711  "ISO C++ does not allow indirection on operand of type %0">,
6712  InGroup<DiagGroup<"void-ptr-dereference">>;
6713def warn_indirection_through_null : Warning<
6714  "indirection of non-volatile null pointer will be deleted, not trap">,
6715  InGroup<NullDereference>;
6716def warn_binding_null_to_reference : Warning<
6717  "binding dereferenced null pointer to reference has undefined behavior">,
6718  InGroup<NullDereference>;
6719def note_indirection_through_null : Note<
6720  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
6721def warn_pointer_indirection_from_incompatible_type : Warning<
6722  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
6723  "behavior">,
6724  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6725def warn_taking_address_of_packed_member : Warning<
6726  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
6727  InGroup<DiagGroup<"address-of-packed-member">>;
6728def warn_param_mismatched_alignment : Warning<
6729  "passing %0-byte aligned argument to %1-byte aligned parameter %2 of %3 may result in an unaligned pointer access">,
6730  InGroup<DiagGroup<"align-mismatch">>;
6731
6732def err_objc_object_assignment : Error<
6733  "cannot assign to class object (%0 invalid)">;
6734def err_typecheck_invalid_operands : Error<
6735  "invalid operands to binary expression (%0 and %1)">;
6736def note_typecheck_invalid_operands_converted : Note<
6737  "%select{first|second}0 operand was implicitly converted to type %1">;
6738def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
6739  "logical expression with vector %select{type %1 and non-vector type %2|types"
6740  " %1 and %2}0 is only supported in C++">;
6741def err_typecheck_sub_ptr_compatible : Error<
6742  "%diff{$ and $ are not pointers to compatible types|"
6743  "pointers to incompatible types}0,1">;
6744def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
6745  "ordered comparison between pointer and integer (%0 and %1)">;
6746def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
6747  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
6748def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
6749  "ordered comparison between pointer and zero (%0 and %1)">;
6750def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
6751  "three-way comparison between pointer and zero">;
6752def ext_typecheck_compare_complete_incomplete_pointers : Extension<
6753  "pointer comparisons before C11 "
6754  "need to be between two complete or two incomplete types; "
6755  "%0 is %select{|in}2complete and "
6756  "%1 is %select{|in}3complete">,
6757  InGroup<C11>;
6758def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
6759  "ordered comparison of function pointers (%0 and %1)">,
6760  InGroup<DiagGroup<"ordered-compare-function-pointers">>;
6761def ext_typecheck_comparison_of_fptr_to_void : Extension<
6762  "equality comparison between function pointer and void pointer (%0 and %1)">;
6763def err_typecheck_comparison_of_fptr_to_void : Error<
6764  "equality comparison between function pointer and void pointer (%0 and %1)">;
6765def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
6766  "comparison between pointer and integer (%0 and %1)">,
6767  InGroup<DiagGroup<"pointer-integer-compare">>;
6768def err_typecheck_comparison_of_pointer_integer : Error<
6769  "comparison between pointer and integer (%0 and %1)">;
6770def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
6771  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
6772  InGroup<CompareDistinctPointerType>;
6773def ext_typecheck_cond_incompatible_operands : ExtWarn<
6774  "incompatible operand types (%0 and %1)">;
6775def err_cond_voidptr_arc : Error <
6776  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
6777  "in ARC mode">;
6778def err_typecheck_comparison_of_distinct_pointers : Error<
6779  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
6780def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
6781  "%select{comparison between %diff{ ($ and $)|}0,1"
6782  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
6783  "|conditional operator with the second and third operands of type "
6784  "%diff{ ($ and $)|}0,1}2"
6785  " which are pointers to non-overlapping address spaces">;
6786
6787def select_arith_conv_kind : TextSubstitution<
6788  "%select{arithmetic between|bitwise operation between|comparison of|"
6789  "conditional expression between|compound assignment of}0">;
6790def warn_arith_conv_enum_float : Warning<
6791  "%sub{select_arith_conv_kind}0 "
6792  "%select{floating-point|enumeration}1 type %2 "
6793  "%plural{2:with|4:from|:and}0 "
6794  "%select{enumeration|floating-point}1 type %3">,
6795  InGroup<EnumFloatConversion>, DefaultIgnore;
6796def warn_arith_conv_enum_float_cxx20 : Warning<
6797  "%sub{select_arith_conv_kind}0 "
6798  "%select{floating-point|enumeration}1 type %2 "
6799  "%plural{2:with|4:from|:and}0 "
6800  "%select{enumeration|floating-point}1 type %3 is deprecated">,
6801  InGroup<DeprecatedEnumFloatConversion>;
6802def warn_arith_conv_mixed_enum_types : Warning<
6803  "%sub{select_arith_conv_kind}0 "
6804  "different enumeration types%diff{ ($ and $)|}1,2">,
6805  InGroup<EnumEnumConversion>, DefaultIgnore;
6806def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
6807  "%sub{select_arith_conv_kind}0 "
6808  "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
6809  InGroup<DeprecatedEnumEnumConversion>;
6810def warn_arith_conv_mixed_anon_enum_types : Warning<
6811  warn_arith_conv_mixed_enum_types.Text>,
6812  InGroup<AnonEnumEnumConversion>, DefaultIgnore;
6813def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
6814  warn_arith_conv_mixed_enum_types_cxx20.Text>,
6815  InGroup<DeprecatedAnonEnumEnumConversion>;
6816def warn_conditional_mixed_enum_types : Warning<
6817  warn_arith_conv_mixed_enum_types.Text>,
6818  InGroup<EnumCompareConditional>, DefaultIgnore;
6819def warn_conditional_mixed_enum_types_cxx20 : Warning<
6820  warn_arith_conv_mixed_enum_types_cxx20.Text>,
6821  InGroup<DeprecatedEnumCompareConditional>;
6822def warn_comparison_mixed_enum_types : Warning<
6823  warn_arith_conv_mixed_enum_types.Text>,
6824  InGroup<EnumCompare>;
6825def warn_comparison_mixed_enum_types_cxx20 : Warning<
6826  warn_arith_conv_mixed_enum_types_cxx20.Text>,
6827  InGroup<DeprecatedEnumCompare>;
6828def warn_comparison_of_mixed_enum_types_switch : Warning<
6829  "comparison of different enumeration types in switch statement"
6830  "%diff{ ($ and $)|}0,1">,
6831  InGroup<EnumCompareSwitch>;
6832
6833def err_typecheck_assign_const : Error<
6834  "%select{"
6835  "cannot assign to return value because function %1 returns a const value|"
6836  "cannot assign to variable %1 with const-qualified type %2|"
6837  "cannot assign to %select{non-|}1static data member %2 "
6838  "with const-qualified type %3|"
6839  "cannot assign to non-static data member within const member function %1|"
6840  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
6841  "with %select{|nested }3const-qualified data member %4|"
6842  "read-only variable is not assignable}0">;
6843
6844def note_typecheck_assign_const : Note<
6845  "%select{"
6846  "function %1 which returns const-qualified type %2 declared here|"
6847  "variable %1 declared const here|"
6848  "%select{non-|}1static data member %2 declared const here|"
6849  "member function %q1 is declared const here|"
6850  "%select{|nested }1data member %2 declared const here}0">;
6851
6852def warn_unsigned_always_true_comparison : Warning<
6853  "result of comparison of %select{%3|unsigned expression}0 %2 "
6854  "%select{unsigned expression|%3}0 is always %4">,
6855  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
6856def warn_unsigned_char_always_true_comparison : Warning<
6857  "result of comparison of %select{%3|char expression}0 %2 "
6858  "%select{char expression|%3}0 is always %4, since char is interpreted as "
6859  "unsigned">, InGroup<TautologicalUnsignedCharZeroCompare>, DefaultIgnore;
6860def warn_unsigned_enum_always_true_comparison : Warning<
6861  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
6862  "%select{unsigned enum expression|%3}0 is always %4">,
6863  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
6864def warn_tautological_constant_compare : Warning<
6865  "result of comparison %select{%3|%1}0 %2 "
6866  "%select{%1|%3}0 is always %4">,
6867  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
6868def warn_tautological_compare_objc_bool : Warning<
6869  "result of comparison of constant %0 with expression of type 'BOOL'"
6870  " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
6871  InGroup<TautologicalObjCBoolCompare>;
6872def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
6873def warn_tautological_compare_value_range : Warning<
6874  "result of comparison of "
6875  "%select{%4|%sub{subst_int_range}1,2}0 %3 "
6876  "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
6877  InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
6878
6879def warn_mixed_sign_comparison : Warning<
6880  "comparison of integers of different signs: %0 and %1">,
6881  InGroup<SignCompare>, DefaultIgnore;
6882def warn_out_of_range_compare : Warning<
6883  "result of comparison of %select{constant %0|true|false}1 with "
6884  "%select{expression of type %2|boolean expression}3 is always %4">,
6885  InGroup<TautologicalOutOfRangeCompare>;
6886def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
6887  InGroup<TautologicalConstantCompare>;
6888def warn_integer_constants_in_conditional_always_true : Warning<
6889  "converting the result of '?:' with integer constants to a boolean always "
6890  "evaluates to 'true'">,
6891  InGroup<TautologicalConstantCompare>;
6892def warn_left_shift_always : Warning<
6893  "converting the result of '<<' to a boolean always evaluates "
6894  "to %select{false|true}0">,
6895  InGroup<TautologicalConstantCompare>;
6896def warn_null_in_arithmetic_operation : Warning<
6897  "use of NULL in arithmetic operation">,
6898  InGroup<NullArithmetic>;
6899def warn_null_in_comparison_operation : Warning<
6900  "comparison between NULL and non-pointer "
6901  "%select{(%1 and NULL)|(NULL and %1)}0">,
6902  InGroup<NullArithmetic>;
6903def err_shift_rhs_only_vector : Error<
6904  "requested shift is a vector of type %0 but the first operand is not a "
6905  "vector (%1)">;
6906
6907def warn_logical_not_on_lhs_of_check : Warning<
6908  "logical not is only applied to the left hand side of this "
6909  "%select{comparison|bitwise operator}0">,
6910  InGroup<LogicalNotParentheses>;
6911def note_logical_not_fix : Note<
6912  "add parentheses after the '!' to evaluate the "
6913  "%select{comparison|bitwise operator}0 first">;
6914def note_logical_not_silence_with_parens : Note<
6915  "add parentheses around left hand side expression to silence this warning">;
6916
6917def err_invalid_this_use : Error<
6918  "invalid use of 'this' outside of a non-static member function">;
6919def err_this_static_member_func : Error<
6920  "'this' cannot be%select{| implicitly}0 used in a static member function "
6921  "declaration">;
6922def err_invalid_member_use_in_static_method : Error<
6923  "invalid use of member %0 in static member function">;
6924def err_invalid_qualified_function_type : Error<
6925  "%select{non-member function|static member function|deduction guide}0 "
6926  "%select{of type %2 |}1cannot have '%3' qualifier">;
6927def err_compound_qualified_function_type : Error<
6928  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
6929  "cannot have '%3' qualifier">;
6930def err_qualified_function_typeid : Error<
6931  "type operand %0 of 'typeid' cannot have '%1' qualifier">;
6932
6933def err_ref_qualifier_overload : Error<
6934  "cannot overload a member function %select{without a ref-qualifier|with "
6935  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
6936  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
6937
6938def err_invalid_non_static_member_use : Error<
6939  "invalid use of non-static data member %0">;
6940def err_nested_non_static_member_use : Error<
6941  "%select{call to non-static member function|use of non-static data member}0 "
6942  "%2 of %1 from nested type %3">;
6943def warn_cxx98_compat_non_static_member_use : Warning<
6944  "use of non-static data member %0 in an unevaluated context is "
6945  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6946def err_invalid_incomplete_type_use : Error<
6947  "invalid use of incomplete type %0">;
6948def err_builtin_func_cast_more_than_one_arg : Error<
6949  "function-style cast to a builtin type can only take one argument">;
6950def err_value_init_for_array_type : Error<
6951  "array types cannot be value-initialized">;
6952def err_init_for_function_type : Error<
6953  "cannot create object of function type %0">;
6954def warn_format_nonliteral_noargs : Warning<
6955  "format string is not a string literal (potentially insecure)">,
6956  InGroup<FormatSecurity>;
6957def warn_format_nonliteral : Warning<
6958  "format string is not a string literal">,
6959  InGroup<FormatNonLiteral>, DefaultIgnore;
6960
6961def err_unexpected_interface : Error<
6962  "unexpected interface name %0: expected expression">;
6963def err_ref_non_value : Error<"%0 does not refer to a value">;
6964def err_ref_vm_type : Error<
6965  "cannot refer to declaration with a variably modified type inside block">;
6966def err_ref_flexarray_type : Error<
6967  "cannot refer to declaration of structure variable with flexible array member "
6968  "inside block">;
6969def err_ref_array_type : Error<
6970  "cannot refer to declaration with an array type inside block">;
6971def err_property_not_found : Error<
6972  "property %0 not found on object of type %1">;
6973def err_invalid_property_name : Error<
6974  "%0 is not a valid property name (accessing an object of type %1)">;
6975def err_getter_not_found : Error<
6976  "no getter method for read from property">;
6977def err_objc_subscript_method_not_found : Error<
6978  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
6979  "found on object of type %0">;
6980def err_objc_subscript_index_type : Error<
6981  "method index parameter type %0 is not integral type">;
6982def err_objc_subscript_key_type : Error<
6983  "method key parameter type %0 is not object type">;
6984def err_objc_subscript_dic_object_type : Error<
6985  "method object parameter type %0 is not object type">;
6986def err_objc_subscript_object_type : Error<
6987  "cannot assign to this %select{dictionary|array}1 because assigning method's "
6988  "2nd parameter of type %0 is not an Objective-C pointer type">;
6989def err_objc_subscript_base_type : Error<
6990  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
6991def err_objc_multiple_subscript_type_conversion : Error<
6992  "indexing expression is invalid because subscript type %0 has "
6993  "multiple type conversion functions">;
6994def err_objc_subscript_type_conversion : Error<
6995  "indexing expression is invalid because subscript type %0 is not an integral"
6996  " or Objective-C pointer type">;
6997def err_objc_subscript_pointer : Error<
6998  "indexing expression is invalid because subscript type %0 is not an"
6999  " Objective-C pointer">;
7000def err_objc_indexing_method_result_type : Error<
7001  "method for accessing %select{dictionary|array}1 element must have Objective-C"
7002  " object return type instead of %0">;
7003def err_objc_index_incomplete_class_type : Error<
7004  "Objective-C index expression has incomplete class type %0">;
7005def err_illegal_container_subscripting_op : Error<
7006  "illegal operation on Objective-C container subscripting">;
7007def err_property_not_found_forward_class : Error<
7008  "property %0 cannot be found in forward class object %1">;
7009def err_property_not_as_forward_class : Error<
7010  "property %0 refers to an incomplete Objective-C class %1 "
7011  "(with no @interface available)">;
7012def note_forward_class : Note<
7013  "forward declaration of class here">;
7014def err_duplicate_property : Error<
7015  "property has a previous declaration">;
7016def ext_gnu_void_ptr : Extension<
7017  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
7018  InGroup<PointerArith>;
7019def ext_gnu_ptr_func_arith : Extension<
7020  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
7021  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
7022  InGroup<PointerArith>;
7023def err_readonly_message_assignment : Error<
7024  "assigning to 'readonly' return result of an Objective-C message not allowed">;
7025def ext_integer_increment_complex : Extension<
7026  "ISO C does not support '++'/'--' on complex integer type %0">;
7027def ext_integer_complement_complex : Extension<
7028  "ISO C does not support '~' for complex conjugation of %0">;
7029def err_nosetter_property_assignment : Error<
7030  "%select{assignment to readonly property|"
7031  "no setter method %1 for assignment to property}0">;
7032def err_nosetter_property_incdec : Error<
7033  "%select{%select{increment|decrement}1 of readonly property|"
7034  "no setter method %2 for %select{increment|decrement}1 of property}0">;
7035def err_nogetter_property_compound_assignment : Error<
7036  "a getter method is needed to perform a compound assignment on a property">;
7037def err_nogetter_property_incdec : Error<
7038  "no getter method %1 for %select{increment|decrement}0 of property">;
7039def err_no_subobject_property_setting : Error<
7040  "expression is not assignable">;
7041def err_qualified_objc_access : Error<
7042  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
7043
7044def ext_freestanding_complex : Extension<
7045  "complex numbers are an extension in a freestanding C99 implementation">;
7046
7047// FIXME: Remove when we support imaginary.
7048def err_imaginary_not_supported : Error<"imaginary types are not supported">;
7049
7050// Obj-c expressions
7051def warn_root_inst_method_not_found : Warning<
7052  "instance method %0 is being used on 'Class' which is not in the root class">,
7053  InGroup<MethodAccess>;
7054def warn_class_method_not_found : Warning<
7055  "class method %objcclass0 not found (return type defaults to 'id')">,
7056  InGroup<MethodAccess>;
7057def warn_instance_method_on_class_found : Warning<
7058  "instance method %0 found instead of class method %1">,
7059  InGroup<MethodAccess>;
7060def warn_inst_method_not_found : Warning<
7061  "instance method %objcinstance0 not found (return type defaults to 'id')">,
7062  InGroup<MethodAccess>;
7063def warn_instance_method_not_found_with_typo : Warning<
7064  "instance method %objcinstance0 not found (return type defaults to 'id')"
7065  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
7066def warn_class_method_not_found_with_typo : Warning<
7067  "class method %objcclass0 not found (return type defaults to 'id')"
7068  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
7069def err_method_not_found_with_typo : Error<
7070  "%select{instance|class}1 method %0 not found "
7071  "; did you mean %2?">;
7072def err_no_super_class_message : Error<
7073  "no @interface declaration found in class messaging of %0">;
7074def err_root_class_cannot_use_super : Error<
7075  "%0 cannot use 'super' because it is a root class">;
7076def err_invalid_receiver_to_message_super : Error<
7077  "'super' is only valid in a method body">;
7078def err_invalid_receiver_class_message : Error<
7079  "receiver type %0 is not an Objective-C class">;
7080def err_missing_open_square_message_send : Error<
7081  "missing '[' at start of message send expression">;
7082def warn_bad_receiver_type : Warning<
7083  "receiver type %0 is not 'id' or interface pointer, consider "
7084  "casting it to 'id'">,InGroup<ObjCReceiver>;
7085def err_bad_receiver_type : Error<"bad receiver type %0">;
7086def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
7087def err_unknown_receiver_suggest : Error<
7088  "unknown receiver %0; did you mean %1?">;
7089def err_objc_throw_expects_object : Error<
7090  "@throw requires an Objective-C object type (%0 invalid)">;
7091def err_objc_synchronized_expects_object : Error<
7092  "@synchronized requires an Objective-C object type (%0 invalid)">;
7093def err_rethrow_used_outside_catch : Error<
7094  "@throw (rethrow) used outside of a @catch block">;
7095def err_attribute_multiple_objc_gc : Error<
7096  "multiple garbage collection attributes specified for type">;
7097def err_catch_param_not_objc_type : Error<
7098  "@catch parameter is not a pointer to an interface type">;
7099def err_illegal_qualifiers_on_catch_parm : Error<
7100  "illegal qualifiers on @catch parameter">;
7101def err_storage_spec_on_catch_parm : Error<
7102  "@catch parameter cannot have storage specifier '%0'">;
7103def warn_register_objc_catch_parm : Warning<
7104  "'register' storage specifier on @catch parameter will be ignored">;
7105def err_qualified_objc_catch_parm : Error<
7106  "@catch parameter declarator cannot be qualified">;
7107def warn_objc_pointer_cxx_catch_fragile : Warning<
7108  "cannot catch an exception thrown with @throw in C++ in the non-unified "
7109  "exception model">, InGroup<ObjCNonUnifiedException>;
7110def err_objc_object_catch : Error<
7111  "cannot catch an Objective-C object by value">;
7112def err_incomplete_type_objc_at_encode : Error<
7113  "'@encode' of incomplete type %0">;
7114def warn_objc_circular_container : Warning<
7115  "adding %0 to %1 might cause circular dependency in container">,
7116  InGroup<DiagGroup<"objc-circular-container">>;
7117def note_objc_circular_container_declared_here : Note<"%0 declared here">;
7118def warn_objc_unsafe_perform_selector : Warning<
7119  "%0 is incompatible with selectors that return a "
7120  "%select{struct|union|vector}1 type">,
7121  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
7122def note_objc_unsafe_perform_selector_method_declared_here :  Note<
7123  "method %0 that returns %1 declared here">;
7124def err_attribute_arm_builtin_alias : Error<
7125  "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
7126def err_attribute_arm_mve_polymorphism : Error<
7127  "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
7128
7129def warn_setter_getter_impl_required : Warning<
7130  "property %0 requires method %1 to be defined - "
7131  "use @synthesize, @dynamic or provide a method implementation "
7132  "in this class implementation">,
7133  InGroup<ObjCPropertyImpl>;
7134def warn_setter_getter_impl_required_in_category : Warning<
7135  "property %0 requires method %1 to be defined - "
7136  "use @dynamic or provide a method implementation in this category">,
7137  InGroup<ObjCPropertyImpl>;
7138def note_parameter_named_here : Note<
7139  "passing argument to parameter %0 here">;
7140def note_parameter_here : Note<
7141  "passing argument to parameter here">;
7142def note_method_return_type_change : Note<
7143  "compiler has implicitly changed method %0 return type">;
7144
7145def warn_impl_required_for_class_property : Warning<
7146  "class property %0 requires method %1 to be defined - "
7147  "use @dynamic or provide a method implementation "
7148  "in this class implementation">,
7149  InGroup<ObjCPropertyImpl>;
7150def warn_impl_required_in_category_for_class_property : Warning<
7151  "class property %0 requires method %1 to be defined - "
7152  "use @dynamic or provide a method implementation in this category">,
7153  InGroup<ObjCPropertyImpl>;
7154
7155// C++ casts
7156// These messages adhere to the TryCast pattern: %0 is an int specifying the
7157// cast type, %1 is the source type, %2 is the destination type.
7158def err_bad_reinterpret_cast_overload : Error<
7159  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
7160
7161def warn_reinterpret_different_from_static : Warning<
7162  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
7163  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
7164  "'static_cast'">, InGroup<ReinterpretBaseClass>;
7165def note_reinterpret_updowncast_use_static: Note<
7166  "use 'static_cast' to adjust the pointer correctly while "
7167  "%select{upcasting|downcasting}0">;
7168
7169def err_bad_static_cast_overload : Error<
7170  "address of overloaded function %0 cannot be static_cast to type %1">;
7171
7172def err_bad_cstyle_cast_overload : Error<
7173  "address of overloaded function %0 cannot be cast to type %1">;
7174
7175
7176def err_bad_cxx_cast_generic : Error<
7177  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7178  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7179def err_bad_cxx_cast_unrelated_class : Error<
7180  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7181  "functional-style cast|}0 from %1 to %2, which are not related by "
7182  "inheritance, is not allowed">;
7183def note_type_incomplete : Note<"%0 is incomplete">;
7184def err_bad_cxx_cast_rvalue : Error<
7185  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7186  "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7187def err_bad_cxx_cast_bitfield : Error<
7188  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7189  "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7190def err_bad_cxx_cast_qualifiers_away : Error<
7191  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7192  "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7193def err_bad_cxx_cast_addr_space_mismatch : Error<
7194  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7195  "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7196  " spaces">;
7197def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7198  "ISO C++ does not allow "
7199  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7200  "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
7201  "even though the source and destination types are unrelated">,
7202  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
7203def err_bad_const_cast_dest : Error<
7204  "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
7205  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
7206def ext_cast_fn_obj : Extension<
7207  "cast between pointer-to-function and pointer-to-object is an extension">;
7208def ext_ms_cast_fn_obj : ExtWarn<
7209  "static_cast between pointer-to-function and pointer-to-object is a "
7210  "Microsoft extension">, InGroup<MicrosoftCast>;
7211def warn_cxx98_compat_cast_fn_obj : Warning<
7212  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
7213  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7214def err_bad_reinterpret_cast_small_int : Error<
7215  "cast from pointer to smaller type %2 loses information">;
7216def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
7217  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7218  "to scalar %2 of different size">;
7219def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
7220  "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
7221  "to vector %2 of different size">;
7222def err_bad_cxx_cast_vector_to_vector_different_size : Error<
7223  "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7224  "to vector %2 of different size">;
7225def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
7226  "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
7227  "changes address space of nested pointers">,
7228  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7229def err_bad_lvalue_to_rvalue_cast : Error<
7230  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
7231  "not compatible">;
7232def err_bad_rvalue_to_rvalue_cast : Error<
7233  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
7234  "not compatible">;
7235def err_bad_static_cast_pointer_nonpointer : Error<
7236  "cannot cast from type %1 to pointer type %2">;
7237def err_bad_static_cast_member_pointer_nonmp : Error<
7238  "cannot cast from type %1 to member pointer type %2">;
7239def err_bad_cxx_cast_member_pointer_size : Error<
7240  "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
7241  "type %1 to member pointer type %2 of different size">;
7242def err_bad_reinterpret_cast_reference : Error<
7243  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
7244def warn_undefined_reinterpret_cast : Warning<
7245  "reinterpret_cast from %0 to %1 has undefined behavior">,
7246  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7247
7248// These messages don't adhere to the pattern.
7249// FIXME: Display the path somehow better.
7250def err_ambiguous_base_to_derived_cast : Error<
7251  "ambiguous cast from base %0 to derived %1:%2">;
7252def err_static_downcast_via_virtual : Error<
7253  "cannot cast %0 to %1 via virtual base %2">;
7254def err_downcast_from_inaccessible_base : Error<
7255  "cannot cast %select{private|protected}2 base class %1 to %0">;
7256def err_upcast_to_inaccessible_base : Error<
7257  "cannot cast %0 to its %select{private|protected}2 base class %1">;
7258def err_bad_dynamic_cast_not_ref_or_ptr : Error<
7259  "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
7260def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
7261def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
7262def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
7263def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
7264
7265// Other C++ expressions
7266def err_need_header_before_typeid : Error<
7267  "you need to include <typeinfo> before using the 'typeid' operator">;
7268def err_need_header_before_ms_uuidof : Error<
7269  "you need to include <guiddef.h> before using the '__uuidof' operator">;
7270def err_need_header_before_placement_new : Error<
7271  "no matching %0 function for non-allocating placement new expression; "
7272  "include <new>">;
7273def err_ms___leave_not_in___try : Error<
7274  "'__leave' statement not in __try block">;
7275def err_uuidof_without_guid : Error<
7276  "cannot call operator __uuidof on a type with no GUID">;
7277def err_uuidof_with_multiple_guids : Error<
7278  "cannot call operator __uuidof on a type with multiple GUIDs">;
7279def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
7280def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
7281def err_static_illegal_in_new : Error<
7282  "the 'static' modifier for the array size is not legal in new expressions">;
7283def err_array_new_needs_size : Error<
7284  "array size must be specified in new expression with no initializer">;
7285def err_bad_new_type : Error<
7286  "cannot allocate %select{function|reference}1 type %0 with new">;
7287def err_new_incomplete_or_sizeless_type : Error<
7288  "allocation of %select{incomplete|sizeless}0 type %1">;
7289def err_new_array_nonconst : Error<
7290  "only the first dimension of an allocated array may have dynamic size">;
7291def err_new_array_size_unknown_from_init : Error<
7292  "cannot determine allocated array size from initializer">;
7293def err_new_array_init_args : Error<
7294  "array 'new' cannot have initialization arguments">;
7295def ext_new_paren_array_nonconst : ExtWarn<
7296  "when type is in parentheses, array cannot have dynamic size">;
7297def err_placement_new_non_placement_delete : Error<
7298  "'new' expression with placement arguments refers to non-placement "
7299  "'operator delete'">;
7300def err_array_size_not_integral : Error<
7301  "array size expression must have integral or %select{|unscoped }0"
7302  "enumeration type, not %1">;
7303def err_array_size_incomplete_type : Error<
7304  "array size expression has incomplete class type %0">;
7305def err_array_size_explicit_conversion : Error<
7306  "array size expression of type %0 requires explicit conversion to type %1">;
7307def note_array_size_conversion : Note<
7308  "conversion to %select{integral|enumeration}0 type %1 declared here">;
7309def err_array_size_ambiguous_conversion : Error<
7310  "ambiguous conversion of array size expression of type %0 to an integral or "
7311  "enumeration type">;
7312def ext_array_size_conversion : Extension<
7313  "implicit conversion from array size expression of type %0 to "
7314  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7315  InGroup<CXX11>;
7316def warn_cxx98_compat_array_size_conversion : Warning<
7317  "implicit conversion from array size expression of type %0 to "
7318  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7319  InGroup<CXX98CompatPedantic>, DefaultIgnore;
7320def err_address_space_qualified_new : Error<
7321  "'new' cannot allocate objects of type %0 in address space '%1'">;
7322def err_address_space_qualified_delete : Error<
7323  "'delete' cannot delete objects of type %0 in address space '%1'">;
7324
7325def err_default_init_const : Error<
7326  "default initialization of an object of const type %0"
7327  "%select{| without a user-provided default constructor}1">;
7328def ext_default_init_const : ExtWarn<
7329  "default initialization of an object of const type %0"
7330  "%select{| without a user-provided default constructor}1 "
7331  "is a Microsoft extension">,
7332  InGroup<MicrosoftConstInit>;
7333def err_delete_operand : Error<"cannot delete expression of type %0">;
7334def ext_delete_void_ptr_operand : ExtWarn<
7335  "cannot delete expression with pointer-to-'void' type %0">,
7336  InGroup<DeleteIncomplete>;
7337def err_ambiguous_delete_operand : Error<
7338  "ambiguous conversion of delete expression of type %0 to a pointer">;
7339def warn_delete_incomplete : Warning<
7340  "deleting pointer to incomplete type %0 may cause undefined behavior">,
7341  InGroup<DeleteIncomplete>;
7342def err_delete_incomplete_class_type : Error<
7343  "deleting incomplete class type %0; no conversions to pointer type">;
7344def err_delete_explicit_conversion : Error<
7345  "converting delete expression from type %0 to type %1 invokes an explicit "
7346  "conversion function">;
7347def note_delete_conversion : Note<"conversion to pointer type %0">;
7348def warn_delete_array_type : Warning<
7349  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7350def warn_mismatched_delete_new : Warning<
7351  "'delete%select{|[]}0' applied to a pointer that was allocated with "
7352  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7353  InGroup<DiagGroup<"mismatched-new-delete">>;
7354def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7355def err_no_suitable_delete_member_function_found : Error<
7356  "no suitable member %0 in %1">;
7357def err_ambiguous_suitable_delete_member_function_found : Error<
7358  "multiple suitable %0 functions in %1">;
7359def warn_ambiguous_suitable_delete_function_found : Warning<
7360  "multiple suitable %0 functions for %1; no 'operator delete' function "
7361  "will be invoked if initialization throws an exception">,
7362  InGroup<DiagGroup<"ambiguous-delete">>;
7363def note_member_declared_here : Note<
7364  "member %0 declared here">;
7365def note_member_first_declared_here : Note<
7366  "member %0 first declared here">;
7367def warn_bitwise_negation_bool : Warning<
7368  "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7369  "did you mean logical negation?">,
7370  InGroup<DiagGroup<"bool-operation">>;
7371def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7372def warn_increment_bool : Warning<
7373  "incrementing expression of type bool is deprecated and "
7374  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7375def ext_increment_bool : ExtWarn<
7376  "ISO C++17 does not allow incrementing expression of type bool">,
7377  DefaultError, InGroup<IncrementBool>;
7378def err_increment_decrement_enum : Error<
7379  "cannot %select{decrement|increment}0 expression of enum type %1">;
7380
7381def warn_deprecated_increment_decrement_volatile : Warning<
7382  "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7383  "is deprecated">, InGroup<DeprecatedVolatile>;
7384def warn_deprecated_simple_assign_volatile : Warning<
7385  "use of result of assignment to object of volatile-qualified type %0 "
7386  "is deprecated">, InGroup<DeprecatedVolatile>;
7387def warn_deprecated_compound_assign_volatile : Warning<
7388  "compound assignment to object of volatile-qualified type %0 is deprecated">,
7389  InGroup<DeprecatedVolatile>;
7390def warn_deprecated_volatile_return : Warning<
7391  "volatile-qualified return type %0 is deprecated">,
7392  InGroup<DeprecatedVolatile>;
7393def warn_deprecated_volatile_param : Warning<
7394  "volatile-qualified parameter type %0 is deprecated">,
7395  InGroup<DeprecatedVolatile>;
7396def warn_deprecated_volatile_structured_binding : Warning<
7397  "volatile qualifier in structured binding declaration is deprecated">,
7398  InGroup<DeprecatedVolatile>;
7399
7400def err_catch_incomplete_ptr : Error<
7401  "cannot catch pointer to incomplete type %0">;
7402def err_catch_incomplete_ref : Error<
7403  "cannot catch reference to incomplete type %0">;
7404def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7405def err_catch_sizeless : Error<
7406  "cannot catch %select{|reference to }0sizeless type %1">;
7407def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7408def err_catch_variably_modified : Error<
7409  "cannot catch variably modified type %0">;
7410def err_qualified_catch_declarator : Error<
7411  "exception declarator cannot be qualified">;
7412def err_early_catch_all : Error<"catch-all handler must come last">;
7413def err_bad_memptr_rhs : Error<
7414  "right hand operand to %0 has non-pointer-to-member type %1">;
7415def err_bad_memptr_lhs : Error<
7416  "left hand operand to %0 must be a %select{|pointer to }1class "
7417  "compatible with the right hand operand, but is %2">;
7418def err_memptr_incomplete : Error<
7419  "member pointer has incomplete base type %0">;
7420def warn_exception_caught_by_earlier_handler : Warning<
7421  "exception of type %0 will be caught by earlier handler">,
7422  InGroup<Exceptions>;
7423def note_previous_exception_handler : Note<"for type %0">;
7424def err_exceptions_disabled : Error<
7425  "cannot use '%0' with exceptions disabled">;
7426def err_objc_exceptions_disabled : Error<
7427  "cannot use '%0' with Objective-C exceptions disabled">;
7428def warn_throw_in_noexcept_func : Warning<
7429  "%0 has a non-throwing exception specification but can still throw">,
7430  InGroup<Exceptions>;
7431def note_throw_in_dtor : Note<
7432  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7433  "non-throwing}1 exception specification">;
7434def note_throw_in_function : Note<"function declared non-throwing here">;
7435def err_seh_try_outside_functions : Error<
7436  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7437def err_mixing_cxx_try_seh_try : Error<
7438  "cannot use C++ 'try' in the same function as SEH '__try'">;
7439def err_seh_try_unsupported : Error<
7440  "SEH '__try' is not supported on this target">;
7441def note_conflicting_try_here : Note<
7442  "conflicting %0 here">;
7443def warn_jump_out_of_seh_finally : Warning<
7444  "jump out of __finally block has undefined behavior">,
7445  InGroup<DiagGroup<"jump-seh-finally">>;
7446def warn_non_virtual_dtor : Warning<
7447  "%0 has virtual functions but non-virtual destructor">,
7448  InGroup<NonVirtualDtor>, DefaultIgnore;
7449def warn_delete_non_virtual_dtor : Warning<
7450  "%select{delete|destructor}0 called on non-final %1 that has "
7451  "virtual functions but non-virtual destructor">,
7452  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7453def note_delete_non_virtual : Note<
7454  "qualify call to silence this warning">;
7455def warn_delete_abstract_non_virtual_dtor : Warning<
7456  "%select{delete|destructor}0 called on %1 that is abstract but has "
7457  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7458def warn_overloaded_virtual : Warning<
7459  "%q0 hides overloaded virtual %select{function|functions}1">,
7460  InGroup<OverloadedVirtual>, DefaultIgnore;
7461def note_hidden_overloaded_virtual_declared_here : Note<
7462  "hidden overloaded virtual function %q0 declared here"
7463  "%select{|: different classes%diff{ ($ vs $)|}2,3"
7464  "|: different number of parameters (%2 vs %3)"
7465  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7466  "|: different return type%diff{ ($ vs $)|}2,3"
7467  "|: different qualifiers (%2 vs %3)"
7468  "|: different exception specifications}1">;
7469def warn_using_directive_in_header : Warning<
7470  "using namespace directive in global context in header">,
7471  InGroup<HeaderHygiene>, DefaultIgnore;
7472def warn_overaligned_type : Warning<
7473  "type %0 requires %1 bytes of alignment and the default allocator only "
7474  "guarantees %2 bytes">,
7475  InGroup<OveralignedType>, DefaultIgnore;
7476def err_aligned_allocation_unavailable : Error<
7477  "aligned %select{allocation|deallocation}0 function of type '%1' is "
7478  "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
7479def note_silence_aligned_allocation_unavailable : Note<
7480  "if you supply your own aligned allocation functions, use "
7481  "-faligned-allocation to silence this diagnostic">;
7482
7483def err_conditional_void_nonvoid : Error<
7484  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7485  "is of type %0">;
7486def err_conditional_ambiguous : Error<
7487  "conditional expression is ambiguous; "
7488  "%diff{$ can be converted to $ and vice versa|"
7489  "types can be convert to each other}0,1">;
7490def err_conditional_ambiguous_ovl : Error<
7491  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7492  "can be converted to several common types">;
7493def err_conditional_vector_size : Error<
7494  "vector condition type %0 and result type %1 do not have the same number "
7495  "of elements">;
7496def err_conditional_vector_element_size : Error<
7497  "vector condition type %0 and result type %1 do not have elements of the "
7498  "same size">;
7499def err_conditional_vector_has_void : Error<
7500  "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7501def err_conditional_vector_operand_type
7502    : Error<"enumeration type %0 is not allowed in a vector conditional">;
7503def err_conditional_vector_cond_result_mismatch
7504    : Error<"cannot mix vectors and extended vectors in a vector conditional">;
7505def err_conditional_vector_mismatched
7506    : Error<"vector operands to the vector conditional must be the same type "
7507            "%diff{($ and $)|}0,1}">;
7508
7509def err_throw_incomplete : Error<
7510  "cannot throw object of incomplete type %0">;
7511def err_throw_incomplete_ptr : Error<
7512  "cannot throw pointer to object of incomplete type %0">;
7513def err_throw_sizeless : Error<
7514  "cannot throw object of sizeless type %0">;
7515def warn_throw_underaligned_obj : Warning<
7516  "underaligned exception object thrown">,
7517  InGroup<UnderalignedExceptionObject>;
7518def note_throw_underaligned_obj : Note<
7519  "required alignment of type %0 (%1 bytes) is larger than the supported "
7520  "alignment of C++ exception objects on this target (%2 bytes)">;
7521def err_return_in_constructor_handler : Error<
7522  "return in the catch of a function try block of a constructor is illegal">;
7523def warn_cdtor_function_try_handler_mem_expr : Warning<
7524  "cannot refer to a non-static member from the handler of a "
7525  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
7526
7527let CategoryName = "Lambda Issue" in {
7528  def err_capture_more_than_once : Error<
7529    "%0 can appear only once in a capture list">;
7530  def err_reference_capture_with_reference_default : Error<
7531    "'&' cannot precede a capture when the capture default is '&'">;
7532  def err_copy_capture_with_copy_default : Error<
7533    "'&' must precede a capture when the capture default is '='">;
7534  def err_capture_does_not_name_variable : Error<
7535    "%0 in capture list does not name a variable">;
7536  def err_capture_non_automatic_variable : Error<
7537    "%0 cannot be captured because it does not have automatic storage "
7538    "duration">;
7539  def err_this_capture : Error<
7540    "'this' cannot be %select{implicitly |}0captured in this context">;
7541  def note_lambda_this_capture_fixit : Note<
7542    "explicitly capture 'this'">;
7543  def err_lambda_capture_anonymous_var : Error<
7544    "unnamed variable cannot be implicitly captured in a lambda expression">;
7545  def err_lambda_capture_flexarray_type : Error<
7546    "variable %0 with flexible array member cannot be captured in "
7547    "a lambda expression">;
7548  def err_lambda_impcap : Error<
7549    "variable %0 cannot be implicitly captured in a lambda with no "
7550    "capture-default specified">;
7551  def note_lambda_variable_capture_fixit : Note<
7552    "capture %0 by %select{value|reference}1">;
7553  def note_lambda_default_capture_fixit : Note<
7554    "default capture by %select{value|reference}0">;
7555  def note_lambda_decl : Note<"lambda expression begins here">;
7556  def err_lambda_unevaluated_operand : Error<
7557    "lambda expression in an unevaluated operand">;
7558  def err_lambda_in_constant_expression : Error<
7559    "a lambda expression may not appear inside of a constant expression">;
7560  def err_lambda_in_invalid_context : Error<
7561    "a lambda expression cannot appear in this context">;
7562  def err_lambda_return_init_list : Error<
7563    "cannot deduce lambda return type from initializer list">;
7564  def err_lambda_capture_default_arg : Error<
7565    "lambda expression in default argument cannot capture any entity">;
7566  def err_lambda_incomplete_result : Error<
7567    "incomplete result type %0 in lambda expression">;
7568  def err_noreturn_lambda_has_return_expr : Error<
7569    "lambda declared 'noreturn' should not return">;
7570  def warn_maybe_falloff_nonvoid_lambda : Warning<
7571    "non-void lambda does not return a value in all control paths">,
7572    InGroup<ReturnType>;
7573  def warn_falloff_nonvoid_lambda : Warning<
7574    "non-void lambda does not return a value">,
7575    InGroup<ReturnType>;
7576  def err_access_lambda_capture : Error<
7577    // The ERRORs represent other special members that aren't constructors, in
7578    // hopes that someone will bother noticing and reporting if they appear
7579    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
7580    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
7581    AccessControl;
7582  def note_lambda_to_block_conv : Note<
7583    "implicit capture of lambda object due to conversion to block pointer "
7584    "here">;
7585  def note_var_explicitly_captured_here : Note<"variable %0 is"
7586    "%select{| explicitly}1 captured here">;
7587
7588  // C++14 lambda init-captures.
7589  def warn_cxx11_compat_init_capture : Warning<
7590    "initialized lambda captures are incompatible with C++ standards "
7591    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
7592  def ext_init_capture : ExtWarn<
7593    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
7594  def err_init_capture_no_expression : Error<
7595    "initializer missing for lambda capture %0">;
7596  def err_init_capture_multiple_expressions : Error<
7597    "initializer for lambda capture %0 contains multiple expressions">;
7598  def err_init_capture_paren_braces : Error<
7599    "cannot deduce type for lambda capture %1 from "
7600    "%select{parenthesized|nested}0 initializer list">;
7601  def err_init_capture_deduction_failure : Error<
7602    "cannot deduce type for lambda capture %0 from initializer of type %2">;
7603  def err_init_capture_deduction_failure_from_init_list : Error<
7604    "cannot deduce type for lambda capture %0 from initializer list">;
7605  def warn_cxx17_compat_init_capture_pack : Warning<
7606    "initialized lambda capture packs are incompatible with C++ standards "
7607    "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7608  def ext_init_capture_pack : ExtWarn<
7609    "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
7610
7611  // C++14 generic lambdas.
7612  def warn_cxx11_compat_generic_lambda : Warning<
7613    "generic lambdas are incompatible with C++11">,
7614    InGroup<CXXPre14Compat>, DefaultIgnore;
7615
7616  // C++17 '*this' captures.
7617  def warn_cxx14_compat_star_this_lambda_capture : Warning<
7618    "by value capture of '*this' is incompatible with C++ standards before C++17">,
7619     InGroup<CXXPre17Compat>, DefaultIgnore;
7620  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
7621    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
7622
7623  // C++17 parameter shadows capture
7624  def err_parameter_shadow_capture : Error<
7625    "a lambda parameter cannot shadow an explicitly captured entity">;
7626
7627  // C++20 [=, this] captures.
7628  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
7629    "explicit capture of 'this' with a capture default of '=' is incompatible "
7630    "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7631  def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
7632    "explicit capture of 'this' with a capture default of '=' "
7633    "is a C++20 extension">, InGroup<CXX20>;
7634  def warn_deprecated_this_capture : Warning<
7635    "implicit capture of 'this' with a capture default of '=' is deprecated">,
7636    InGroup<DeprecatedThisCapture>, DefaultIgnore;
7637  def note_deprecated_this_capture : Note<
7638    "add an explicit capture of 'this' to capture '*this' by reference">;
7639
7640  // C++20 default constructible / assignable lambdas.
7641  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
7642    "%select{default construction|assignment}0 of lambda is incompatible with "
7643    "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7644}
7645
7646def err_return_in_captured_stmt : Error<
7647  "cannot return from %0">;
7648def err_capture_block_variable : Error<
7649  "__block variable %0 cannot be captured in a "
7650  "%select{lambda expression|captured statement}1">;
7651
7652def err_operator_arrow_circular : Error<
7653  "circular pointer delegation detected">;
7654def err_operator_arrow_depth_exceeded : Error<
7655  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
7656  "'operator->' calls">;
7657def note_operator_arrow_here : Note<
7658  "'operator->' declared here produces an object of type %0">;
7659def note_operator_arrows_suppressed : Note<
7660  "(skipping %0 'operator->'%s0 in backtrace)">;
7661def note_operator_arrow_depth : Note<
7662  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
7663
7664def err_pseudo_dtor_base_not_scalar : Error<
7665  "object expression of non-scalar type %0 cannot be used in a "
7666  "pseudo-destructor expression">;
7667def ext_pseudo_dtor_on_void : ExtWarn<
7668  "pseudo-destructors on type void are a Microsoft extension">,
7669  InGroup<MicrosoftVoidPseudoDtor>;
7670def err_pseudo_dtor_type_mismatch : Error<
7671  "the type of object expression "
7672  "%diff{($) does not match the type being destroyed ($)|"
7673  "does not match the type being destroyed}0,1 "
7674  "in pseudo-destructor expression">;
7675def err_pseudo_dtor_call_with_args : Error<
7676  "call to pseudo-destructor cannot have any arguments">;
7677def err_dtor_expr_without_call : Error<
7678  "reference to %select{destructor|pseudo-destructor}0 must be called"
7679  "%select{|; did you mean to call it with no arguments?}1">;
7680def err_pseudo_dtor_destructor_non_type : Error<
7681  "%0 does not refer to a type name in pseudo-destructor expression; expected "
7682  "the name of type %1">;
7683def err_invalid_use_of_function_type : Error<
7684  "a function type is not allowed here">;
7685def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
7686def err_typecheck_bool_condition : Error<
7687  "value of type %0 is not contextually convertible to 'bool'">;
7688def err_typecheck_ambiguous_condition : Error<
7689  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
7690def err_typecheck_nonviable_condition : Error<
7691  "no viable conversion%select{%diff{ from $ to $|}1,2|"
7692  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
7693def err_typecheck_nonviable_condition_incomplete : Error<
7694  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
7695def err_typecheck_deleted_function : Error<
7696  "conversion function %diff{from $ to $|between types}0,1 "
7697  "invokes a deleted function">;
7698
7699def err_expected_class_or_namespace : Error<"%0 is not a class"
7700  "%select{ or namespace|, namespace, or enumeration}1">;
7701def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
7702  "because namespace %1 does not enclose namespace %2">;
7703def err_invalid_declarator_global_scope : Error<
7704  "definition or redeclaration of %0 cannot name the global scope">;
7705def err_invalid_declarator_in_function : Error<
7706  "definition or redeclaration of %0 not allowed inside a function">;
7707def err_invalid_declarator_in_block : Error<
7708  "definition or redeclaration of %0 not allowed inside a block">;
7709def err_not_tag_in_scope : Error<
7710  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
7711
7712def err_no_typeid_with_fno_rtti : Error<
7713  "use of typeid requires -frtti">;
7714def err_no_dynamic_cast_with_fno_rtti : Error<
7715  "use of dynamic_cast requires -frtti">;
7716def warn_no_dynamic_cast_with_rtti_disabled: Warning<
7717  "dynamic_cast will not work since RTTI data is disabled by "
7718  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7719def warn_no_typeid_with_rtti_disabled: Warning<
7720  "typeid will not work since RTTI data is disabled by "
7721  "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7722
7723def err_cannot_form_pointer_to_member_of_reference_type : Error<
7724  "cannot form a pointer-to-member to member %0 of reference type %1">;
7725def err_incomplete_object_call : Error<
7726  "incomplete type in call to object of type %0">;
7727
7728def warn_condition_is_assignment : Warning<"using the result of an "
7729  "assignment as a condition without parentheses">,
7730  InGroup<Parentheses>;
7731def warn_free_nonheap_object
7732  : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
7733    InGroup<FreeNonHeapObject>;
7734
7735// Completely identical except off by default.
7736def warn_condition_is_idiomatic_assignment : Warning<"using the result "
7737  "of an assignment as a condition without parentheses">,
7738  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
7739def note_condition_assign_to_comparison : Note<
7740  "use '==' to turn this assignment into an equality comparison">;
7741def note_condition_or_assign_to_comparison : Note<
7742  "use '!=' to turn this compound assignment into an inequality comparison">;
7743def note_condition_assign_silence : Note<
7744  "place parentheses around the assignment to silence this warning">;
7745
7746def warn_equality_with_extra_parens : Warning<"equality comparison with "
7747  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
7748def note_equality_comparison_to_assign : Note<
7749  "use '=' to turn this equality comparison into an assignment">;
7750def note_equality_comparison_silence : Note<
7751  "remove extraneous parentheses around the comparison to silence this warning">;
7752
7753// assignment related diagnostics (also for argument passing, returning, etc).
7754// In most of these diagnostics the %2 is a value from the
7755// Sema::AssignmentAction enumeration
7756def err_typecheck_convert_incompatible : Error<
7757  "%select{%diff{assigning to $ from incompatible type $|"
7758  "assigning to type from incompatible type}0,1"
7759  "|%diff{passing $ to parameter of incompatible type $|"
7760  "passing type to parameter of incompatible type}0,1"
7761  "|%diff{returning $ from a function with incompatible result type $|"
7762  "returning type from a function with incompatible result type}0,1"
7763  "|%diff{converting $ to incompatible type $|"
7764  "converting type to incompatible type}0,1"
7765  "|%diff{initializing $ with an expression of incompatible type $|"
7766  "initializing type with an expression of incompatible type}0,1"
7767  "|%diff{sending $ to parameter of incompatible type $|"
7768  "sending type to parameter of incompatible type}0,1"
7769  "|%diff{casting $ to incompatible type $|"
7770  "casting type to incompatible type}0,1}2"
7771  "%select{|; dereference with *|"
7772  "; take the address with &|"
7773  "; remove *|"
7774  "; remove &}3"
7775  "%select{|: different classes%diff{ ($ vs $)|}5,6"
7776  "|: different number of parameters (%5 vs %6)"
7777  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
7778  "|: different return type%diff{ ($ vs $)|}5,6"
7779  "|: different qualifiers (%5 vs %6)"
7780  "|: different exception specifications}4">;
7781def err_typecheck_missing_return_type_incompatible : Error<
7782  "%diff{return type $ must match previous return type $|"
7783  "return type must match previous return type}0,1 when %select{block "
7784  "literal|lambda expression}2 has unspecified explicit return type">;
7785
7786def note_incomplete_class_and_qualified_id : Note<
7787  "conformance of forward class %0 to protocol %1 can not be confirmed">;
7788def warn_incompatible_qualified_id : Warning<
7789  "%select{%diff{assigning to $ from incompatible type $|"
7790  "assigning to type from incompatible type}0,1"
7791  "|%diff{passing $ to parameter of incompatible type $|"
7792  "passing type to parameter of incompatible type}0,1"
7793  "|%diff{returning $ from a function with incompatible result type $|"
7794  "returning type from a function with incompatible result type}0,1"
7795  "|%diff{converting $ to incompatible type $|"
7796  "converting type to incompatible type}0,1"
7797  "|%diff{initializing $ with an expression of incompatible type $|"
7798  "initializing type with an expression of incompatible type}0,1"
7799  "|%diff{sending $ to parameter of incompatible type $|"
7800  "sending type to parameter of incompatible type}0,1"
7801  "|%diff{casting $ to incompatible type $|"
7802  "casting type to incompatible type}0,1}2">;
7803def err_incompatible_qualified_id : Error<
7804  "%select{%diff{assigning to $ from incompatible type $|"
7805  "assigning to type from incompatible type}0,1"
7806  "|%diff{passing $ to parameter of incompatible type $|"
7807  "passing type to parameter of incompatible type}0,1"
7808  "|%diff{returning $ from a function with incompatible result type $|"
7809  "returning type from a function with incompatible result type}0,1"
7810  "|%diff{converting $ to incompatible type $|"
7811  "converting type to incompatible type}0,1"
7812  "|%diff{initializing $ with an expression of incompatible type $|"
7813  "initializing type with an expression of incompatible type}0,1"
7814  "|%diff{sending $ to parameter of incompatible type $|"
7815  "sending type to parameter of incompatible type}0,1"
7816  "|%diff{casting $ to incompatible type $|"
7817  "casting type to incompatible type}0,1}2">;
7818def ext_typecheck_convert_pointer_int : ExtWarn<
7819  "incompatible pointer to integer conversion "
7820  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7821  "|%diff{passing $ to parameter of type $|"
7822  "passing to parameter of different type}0,1"
7823  "|%diff{returning $ from a function with result type $|"
7824  "returning from function with different return type}0,1"
7825  "|%diff{converting $ to type $|converting between types}0,1"
7826  "|%diff{initializing $ with an expression of type $|"
7827  "initializing with expression of different type}0,1"
7828  "|%diff{sending $ to parameter of type $|"
7829  "sending to parameter of different type}0,1"
7830  "|%diff{casting $ to type $|casting between types}0,1}2"
7831  "%select{|; dereference with *|"
7832  "; take the address with &|"
7833  "; remove *|"
7834  "; remove &}3">,
7835  InGroup<IntConversion>;
7836def err_typecheck_convert_pointer_int : Error<
7837  "incompatible pointer to integer conversion "
7838  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7839  "|%diff{passing $ to parameter of type $|"
7840  "passing to parameter of different type}0,1"
7841  "|%diff{returning $ from a function with result type $|"
7842  "returning from function with different return type}0,1"
7843  "|%diff{converting $ to type $|converting between types}0,1"
7844  "|%diff{initializing $ with an expression of type $|"
7845  "initializing with expression of different type}0,1"
7846  "|%diff{sending $ to parameter of type $|"
7847  "sending to parameter of different type}0,1"
7848  "|%diff{casting $ to type $|casting between types}0,1}2"
7849  "%select{|; dereference with *|"
7850  "; take the address with &|"
7851  "; remove *|"
7852  "; remove &}3">;
7853def ext_typecheck_convert_int_pointer : ExtWarn<
7854  "incompatible integer to pointer conversion "
7855  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7856  "|%diff{passing $ to parameter of type $|"
7857  "passing to parameter of different type}0,1"
7858  "|%diff{returning $ from a function with result type $|"
7859  "returning from function with different return type}0,1"
7860  "|%diff{converting $ to type $|converting between types}0,1"
7861  "|%diff{initializing $ with an expression of type $|"
7862  "initializing with expression of different type}0,1"
7863  "|%diff{sending $ to parameter of type $|"
7864  "sending to parameter of different type}0,1"
7865  "|%diff{casting $ to type $|casting between types}0,1}2"
7866  "%select{|; dereference with *|"
7867  "; take the address with &|"
7868  "; remove *|"
7869  "; remove &}3">,
7870  InGroup<IntConversion>, SFINAEFailure;
7871def err_typecheck_convert_int_pointer : Error<
7872  "incompatible integer to pointer conversion "
7873  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7874  "|%diff{passing $ to parameter of type $|"
7875  "passing to parameter of different type}0,1"
7876  "|%diff{returning $ from a function with result type $|"
7877  "returning from function with different return type}0,1"
7878  "|%diff{converting $ to type $|converting between types}0,1"
7879  "|%diff{initializing $ with an expression of type $|"
7880  "initializing with expression of different type}0,1"
7881  "|%diff{sending $ to parameter of type $|"
7882  "sending to parameter of different type}0,1"
7883  "|%diff{casting $ to type $|casting between types}0,1}2"
7884  "%select{|; dereference with *|"
7885  "; take the address with &|"
7886  "; remove *|"
7887  "; remove &}3">;
7888def ext_typecheck_convert_pointer_void_func : Extension<
7889  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7890  "|%diff{passing $ to parameter of type $|"
7891  "passing to parameter of different type}0,1"
7892  "|%diff{returning $ from a function with result type $|"
7893  "returning from function with different return type}0,1"
7894  "|%diff{converting $ to type $|converting between types}0,1"
7895  "|%diff{initializing $ with an expression of type $|"
7896  "initializing with expression of different type}0,1"
7897  "|%diff{sending $ to parameter of type $|"
7898  "sending to parameter of different type}0,1"
7899  "|%diff{casting $ to type $|casting between types}0,1}2"
7900  " converts between void pointer and function pointer">;
7901def err_typecheck_convert_pointer_void_func : Error<
7902  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7903  "|%diff{passing $ to parameter of type $|"
7904  "passing to parameter of different type}0,1"
7905  "|%diff{returning $ from a function with result type $|"
7906  "returning from function with different return type}0,1"
7907  "|%diff{converting $ to type $|converting between types}0,1"
7908  "|%diff{initializing $ with an expression of type $|"
7909  "initializing with expression of different type}0,1"
7910  "|%diff{sending $ to parameter of type $|"
7911  "sending to parameter of different type}0,1"
7912  "|%diff{casting $ to type $|casting between types}0,1}2"
7913  " converts between void pointer and function pointer">;
7914def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
7915  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7916  "|%diff{passing $ to parameter of type $|"
7917  "passing to parameter of different type}0,1"
7918  "|%diff{returning $ from a function with result type $|"
7919  "returning from function with different return type}0,1"
7920  "|%diff{converting $ to type $|converting between types}0,1"
7921  "|%diff{initializing $ with an expression of type $|"
7922  "initializing with expression of different type}0,1"
7923  "|%diff{sending $ to parameter of type $|"
7924  "sending to parameter of different type}0,1"
7925  "|%diff{casting $ to type $|casting between types}0,1}2"
7926  " converts between pointers to integer types %select{with different sign|"
7927  "where one is of the unique plain 'char' type and the other is not}3">,
7928  InGroup<DiagGroup<"pointer-sign">>;
7929def err_typecheck_convert_incompatible_pointer_sign :
7930  Error<ext_typecheck_convert_incompatible_pointer_sign.Text>;
7931def ext_typecheck_convert_incompatible_pointer : ExtWarn<
7932  "incompatible pointer types "
7933  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7934  "|%diff{passing $ to parameter of type $|"
7935  "passing to parameter of different type}0,1"
7936  "|%diff{returning $ from a function with result type $|"
7937  "returning from function with different return type}0,1"
7938  "|%diff{converting $ to type $|converting between types}0,1"
7939  "|%diff{initializing $ with an expression of type $|"
7940  "initializing with expression of different type}0,1"
7941  "|%diff{sending $ to parameter of type $|"
7942  "sending to parameter of different type}0,1"
7943  "|%diff{casting $ to type $|casting between types}0,1}2"
7944  "%select{|; dereference with *|"
7945  "; take the address with &|"
7946  "; remove *|"
7947  "; remove &}3">,
7948  InGroup<IncompatiblePointerTypes>;
7949def err_typecheck_convert_incompatible_pointer : Error<
7950  "incompatible pointer types "
7951  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7952  "|%diff{passing $ to parameter of type $|"
7953  "passing to parameter of different type}0,1"
7954  "|%diff{returning $ from a function with result type $|"
7955  "returning from function with different return type}0,1"
7956  "|%diff{converting $ to type $|converting between types}0,1"
7957  "|%diff{initializing $ with an expression of type $|"
7958  "initializing with expression of different type}0,1"
7959  "|%diff{sending $ to parameter of type $|"
7960  "sending to parameter of different type}0,1"
7961  "|%diff{casting $ to type $|casting between types}0,1}2"
7962  "%select{|; dereference with *|"
7963  "; take the address with &|"
7964  "; remove *|"
7965  "; remove &}3">;
7966def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
7967  "incompatible function pointer types "
7968  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7969  "|%diff{passing $ to parameter of type $|"
7970  "passing to parameter of different type}0,1"
7971  "|%diff{returning $ from a function with result type $|"
7972  "returning from function with different return type}0,1"
7973  "|%diff{converting $ to type $|converting between types}0,1"
7974  "|%diff{initializing $ with an expression of type $|"
7975  "initializing with expression of different type}0,1"
7976  "|%diff{sending $ to parameter of type $|"
7977  "sending to parameter of different type}0,1"
7978  "|%diff{casting $ to type $|casting between types}0,1}2"
7979  "%select{|; dereference with *|"
7980  "; take the address with &|"
7981  "; remove *|"
7982  "; remove &}3">,
7983  InGroup<IncompatibleFunctionPointerTypes>;
7984def err_typecheck_convert_incompatible_function_pointer : Error<
7985  "incompatible function pointer types "
7986  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7987  "|%diff{passing $ to parameter of type $|"
7988  "passing to parameter of different type}0,1"
7989  "|%diff{returning $ from a function with result type $|"
7990  "returning from function with different return type}0,1"
7991  "|%diff{converting $ to type $|converting between types}0,1"
7992  "|%diff{initializing $ with an expression of type $|"
7993  "initializing with expression of different type}0,1"
7994  "|%diff{sending $ to parameter of type $|"
7995  "sending to parameter of different type}0,1"
7996  "|%diff{casting $ to type $|casting between types}0,1}2"
7997  "%select{|; dereference with *|"
7998  "; take the address with &|"
7999  "; remove *|"
8000  "; remove &}3">;
8001def ext_typecheck_convert_discards_qualifiers : ExtWarn<
8002  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8003  "|%diff{passing $ to parameter of type $|"
8004  "passing to parameter of different type}0,1"
8005  "|%diff{returning $ from a function with result type $|"
8006  "returning from function with different return type}0,1"
8007  "|%diff{converting $ to type $|converting between types}0,1"
8008  "|%diff{initializing $ with an expression of type $|"
8009  "initializing with expression of different type}0,1"
8010  "|%diff{sending $ to parameter of type $|"
8011  "sending to parameter of different type}0,1"
8012  "|%diff{casting $ to type $|casting between types}0,1}2"
8013  " discards qualifiers">,
8014  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8015def err_typecheck_convert_discards_qualifiers : Error<
8016  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8017  "|%diff{passing $ to parameter of type $|"
8018  "passing to parameter of different type}0,1"
8019  "|%diff{returning $ from a function with result type $|"
8020  "returning from function with different return type}0,1"
8021  "|%diff{converting $ to type $|converting between types}0,1"
8022  "|%diff{initializing $ with an expression of type $|"
8023  "initializing with expression of different type}0,1"
8024  "|%diff{sending $ to parameter of type $|"
8025  "sending to parameter of different type}0,1"
8026  "|%diff{casting $ to type $|casting between types}0,1}2"
8027  " discards qualifiers">;
8028def ext_nested_pointer_qualifier_mismatch : ExtWarn<
8029  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8030  "|%diff{passing $ to parameter of type $|"
8031  "passing to parameter of different type}0,1"
8032  "|%diff{returning $ from a function with result type $|"
8033  "returning from function with different return type}0,1"
8034  "|%diff{converting $ to type $|converting between types}0,1"
8035  "|%diff{initializing $ with an expression of type $|"
8036  "initializing with expression of different type}0,1"
8037  "|%diff{sending $ to parameter of type $|"
8038  "sending to parameter of different type}0,1"
8039  "|%diff{casting $ to type $|casting between types}0,1}2"
8040  " discards qualifiers in nested pointer types">,
8041  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8042def err_nested_pointer_qualifier_mismatch : Error<
8043  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8044  "|%diff{passing $ to parameter of type $|"
8045  "passing to parameter of different type}0,1"
8046  "|%diff{returning $ from a function with result type $|"
8047  "returning from function with different return type}0,1"
8048  "|%diff{converting $ to type $|converting between types}0,1"
8049  "|%diff{initializing $ with an expression of type $|"
8050  "initializing with expression of different type}0,1"
8051  "|%diff{sending $ to parameter of type $|"
8052  "sending to parameter of different type}0,1"
8053  "|%diff{casting $ to type $|casting between types}0,1}2"
8054  " discards qualifiers in nested pointer types">;
8055def warn_incompatible_vectors : Warning<
8056  "incompatible vector types "
8057  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8058  "|%diff{passing $ to parameter of type $|"
8059  "passing to parameter of different type}0,1"
8060  "|%diff{returning $ from a function with result type $|"
8061  "returning from function with different return type}0,1"
8062  "|%diff{converting $ to type $|converting between types}0,1"
8063  "|%diff{initializing $ with an expression of type $|"
8064  "initializing with expression of different type}0,1"
8065  "|%diff{sending $ to parameter of type $|"
8066  "sending to parameter of different type}0,1"
8067  "|%diff{casting $ to type $|casting between types}0,1}2">,
8068  InGroup<VectorConversion>, DefaultIgnore;
8069def err_incompatible_vectors : Error<
8070  "incompatible vector types "
8071  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8072  "|%diff{passing $ to parameter of type $|"
8073  "passing to parameter of different type}0,1"
8074  "|%diff{returning $ from a function with result type $|"
8075  "returning from function with different return type}0,1"
8076  "|%diff{converting $ to type $|converting between types}0,1"
8077  "|%diff{initializing $ with an expression of type $|"
8078  "initializing with expression of different type}0,1"
8079  "|%diff{sending $ to parameter of type $|"
8080  "sending to parameter of different type}0,1"
8081  "|%diff{casting $ to type $|casting between types}0,1}2">;
8082def err_int_to_block_pointer : Error<
8083  "invalid block pointer conversion "
8084  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8085  "|%diff{passing $ to parameter of type $|"
8086  "passing to parameter of different type}0,1"
8087  "|%diff{returning $ from a function with result type $|"
8088  "returning from function with different return type}0,1"
8089  "|%diff{converting $ to type $|converting between types}0,1"
8090  "|%diff{initializing $ with an expression of type $|"
8091  "initializing with expression of different type}0,1"
8092  "|%diff{sending $ to parameter of type $|"
8093  "sending to parameter of different type}0,1"
8094  "|%diff{casting $ to type $|casting between types}0,1}2">;
8095def err_typecheck_convert_incompatible_block_pointer : Error<
8096  "incompatible block pointer types "
8097  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8098  "|%diff{passing $ to parameter of type $|"
8099  "passing to parameter of different type}0,1"
8100  "|%diff{returning $ from a function with result type $|"
8101  "returning from function with different return type}0,1"
8102  "|%diff{converting $ to type $|converting between types}0,1"
8103  "|%diff{initializing $ with an expression of type $|"
8104  "initializing with expression of different type}0,1"
8105  "|%diff{sending $ to parameter of type $|"
8106  "sending to parameter of different type}0,1"
8107  "|%diff{casting $ to type $|casting between types}0,1}2">;
8108def err_typecheck_incompatible_address_space : Error<
8109  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8110  "|%diff{passing $ to parameter of type $|"
8111  "passing to parameter of different type}0,1"
8112  "|%diff{returning $ from a function with result type $|"
8113  "returning from function with different return type}0,1"
8114  "|%diff{converting $ to type $|converting between types}0,1"
8115  "|%diff{initializing $ with an expression of type $|"
8116  "initializing with expression of different type}0,1"
8117  "|%diff{sending $ to parameter of type $|"
8118  "sending to parameter of different type}0,1"
8119  "|%diff{casting $ to type $|casting between types}0,1}2"
8120  " changes address space of pointer">;
8121def err_typecheck_incompatible_nested_address_space : Error<
8122  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8123  "|%diff{passing $ to parameter of type $|"
8124  "passing to parameter of different type}0,1"
8125  "|%diff{returning $ from a function with result type $|"
8126  "returning from function with different return type}0,1"
8127  "|%diff{converting $ to type $|converting between types}0,1"
8128  "|%diff{initializing $ with an expression of type $|"
8129  "initializing with expression of different type}0,1"
8130  "|%diff{sending $ to parameter of type $|"
8131  "sending to parameter of different type}0,1"
8132  "|%diff{casting $ to type $|casting between types}0,1}2"
8133  " changes address space of nested pointer">;
8134def err_typecheck_incompatible_ownership : Error<
8135  "%select{%diff{assigning $ to $|assigning to different types}1,0"
8136  "|%diff{passing $ to parameter of type $|"
8137  "passing to parameter of different type}0,1"
8138  "|%diff{returning $ from a function with result type $|"
8139  "returning from function with different return type}0,1"
8140  "|%diff{converting $ to type $|converting between types}0,1"
8141  "|%diff{initializing $ with an expression of type $|"
8142  "initializing with expression of different type}0,1"
8143  "|%diff{sending $ to parameter of type $|"
8144  "sending to parameter of different type}0,1"
8145  "|%diff{casting $ to type $|casting between types}0,1}2"
8146  " changes retain/release properties of pointer">;
8147def err_typecheck_comparison_of_distinct_blocks : Error<
8148  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
8149
8150def err_typecheck_array_not_modifiable_lvalue : Error<
8151  "array type %0 is not assignable">;
8152def err_typecheck_non_object_not_modifiable_lvalue : Error<
8153  "non-object type %0 is not assignable">;
8154def err_typecheck_expression_not_modifiable_lvalue : Error<
8155  "expression is not assignable">;
8156def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
8157  "incomplete type %0 is not assignable">;
8158def err_typecheck_lvalue_casts_not_supported : Error<
8159  "assignment to cast is illegal, lvalue casts are not supported">;
8160
8161def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
8162  "vector is not assignable (contains duplicate components)">;
8163def err_block_decl_ref_not_modifiable_lvalue : Error<
8164  "variable is not assignable (missing __block type specifier)">;
8165def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8166  "cannot assign to a variable captured by copy in a non-mutable lambda">;
8167def err_typecheck_call_not_function : Error<
8168  "called object type %0 is not a function or function pointer">;
8169def err_call_incomplete_return : Error<
8170  "calling function with incomplete return type %0">;
8171def err_call_function_incomplete_return : Error<
8172  "calling %0 with incomplete return type %1">;
8173def err_call_incomplete_argument : Error<
8174  "argument type %0 is incomplete">;
8175def err_typecheck_call_too_few_args : Error<
8176  "too few %select{|||execution configuration }0arguments to "
8177  "%select{function|block|method|kernel function}0 call, "
8178  "expected %1, have %2">;
8179def err_typecheck_call_too_few_args_one : Error<
8180  "too few %select{|||execution configuration }0arguments to "
8181  "%select{function|block|method|kernel function}0 call, "
8182  "single argument %1 was not specified">;
8183def err_typecheck_call_too_few_args_at_least : Error<
8184  "too few %select{|||execution configuration }0arguments to "
8185  "%select{function|block|method|kernel function}0 call, "
8186  "expected at least %1, have %2">;
8187def err_typecheck_call_too_few_args_at_least_one : Error<
8188  "too few %select{|||execution configuration }0arguments to "
8189  "%select{function|block|method|kernel function}0 call, "
8190  "at least argument %1 must be specified">;
8191def err_typecheck_call_too_few_args_suggest : Error<
8192  "too few %select{|||execution configuration }0arguments to "
8193  "%select{function|block|method|kernel function}0 call, "
8194  "expected %1, have %2; did you mean %3?">;
8195def err_typecheck_call_too_few_args_at_least_suggest : Error<
8196  "too few %select{|||execution configuration }0arguments to "
8197  "%select{function|block|method|kernel function}0 call, "
8198  "expected at least %1, have %2; did you mean %3?">;
8199def err_typecheck_call_too_many_args : Error<
8200  "too many %select{|||execution configuration }0arguments to "
8201  "%select{function|block|method|kernel function}0 call, "
8202  "expected %1, have %2">;
8203def err_typecheck_call_too_many_args_one : Error<
8204  "too many %select{|||execution configuration }0arguments to "
8205  "%select{function|block|method|kernel function}0 call, "
8206  "expected single argument %1, have %2 arguments">;
8207def err_typecheck_call_too_many_args_at_most : Error<
8208  "too many %select{|||execution configuration }0arguments to "
8209  "%select{function|block|method|kernel function}0 call, "
8210  "expected at most %1, have %2">;
8211def err_typecheck_call_too_many_args_at_most_one : Error<
8212  "too many %select{|||execution configuration }0arguments to "
8213  "%select{function|block|method|kernel function}0 call, "
8214  "expected at most single argument %1, have %2 arguments">;
8215def err_typecheck_call_too_many_args_suggest : Error<
8216  "too many %select{|||execution configuration }0arguments to "
8217  "%select{function|block|method|kernel function}0 call, "
8218  "expected %1, have %2; did you mean %3?">;
8219def err_typecheck_call_too_many_args_at_most_suggest : Error<
8220  "too many %select{|||execution configuration }0arguments to "
8221  "%select{function|block|method|kernel function}0 call, "
8222  "expected at most %1, have %2; did you mean %3?">;
8223
8224def err_arc_typecheck_convert_incompatible_pointer : Error<
8225  "incompatible pointer types passing retainable parameter of type %0"
8226  "to a CF function expecting %1 type">;
8227
8228def err_builtin_fn_use : Error<"builtin functions must be directly called">;
8229
8230def warn_call_wrong_number_of_arguments : Warning<
8231  "too %select{few|many}0 arguments in call to %1">;
8232def err_atomic_builtin_must_be_pointer : Error<
8233  "address argument to atomic builtin must be a pointer (%0 invalid)">;
8234def err_atomic_builtin_must_be_pointer_intptr : Error<
8235  "address argument to atomic builtin must be a pointer to integer or pointer"
8236  " (%0 invalid)">;
8237def err_atomic_builtin_cannot_be_const : Error<
8238  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
8239def err_atomic_builtin_must_be_pointer_intfltptr : Error<
8240  "address argument to atomic builtin must be a pointer to integer,"
8241  " floating-point or pointer (%0 invalid)">;
8242def err_atomic_builtin_pointer_size : Error<
8243  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
8244  "type (%0 invalid)">;
8245def err_atomic_exclusive_builtin_pointer_size : Error<
8246  "address argument to load or store exclusive builtin must be a pointer to"
8247  " 1,2,4 or 8 byte type (%0 invalid)">;
8248def err_atomic_builtin_ext_int_size : Error<
8249  "Atomic memory operand must have a power-of-two size">;
8250def err_atomic_builtin_ext_int_prohibit : Error<
8251  "argument to atomic builtin of type '_ExtInt' is not supported">;
8252def err_atomic_op_needs_atomic : Error<
8253  "address argument to atomic operation must be a pointer to _Atomic "
8254  "type (%0 invalid)">;
8255def err_atomic_op_needs_non_const_atomic : Error<
8256  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
8257  "type (%1 invalid)">;
8258def err_atomic_op_needs_non_const_pointer : Error<
8259  "address argument to atomic operation must be a pointer to non-const "
8260  "type (%0 invalid)">;
8261def err_atomic_op_needs_trivial_copy : Error<
8262  "address argument to atomic operation must be a pointer to a "
8263  "trivially-copyable type (%0 invalid)">;
8264def err_atomic_op_needs_atomic_int_ptr_or_fp : Error<
8265  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8266  "integer, pointer or supported floating point type (%1 invalid)">;
8267def err_atomic_op_needs_atomic_int_or_ptr : Error<
8268  "address argument to atomic operation must be a pointer to %select{|atomic }0"
8269  "integer or pointer (%1 invalid)">;
8270def err_atomic_op_needs_atomic_int : Error<
8271  "address argument to atomic operation must be a pointer to "
8272  "%select{|atomic }0integer (%1 invalid)">;
8273def warn_atomic_op_has_invalid_memory_order : Warning<
8274  "memory order argument to atomic operation is invalid">,
8275  InGroup<DiagGroup<"atomic-memory-ordering">>;
8276def err_atomic_op_has_invalid_synch_scope : Error<
8277  "synchronization scope argument to atomic operation is invalid">;
8278def warn_atomic_implicit_seq_cst : Warning<
8279  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
8280  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
8281
8282def err_overflow_builtin_must_be_int : Error<
8283  "operand argument to overflow builtin must be an integer (%0 invalid)">;
8284def err_overflow_builtin_must_be_ptr_int : Error<
8285  "result argument to overflow builtin must be a pointer "
8286  "to a non-const integer (%0 invalid)">;
8287def err_overflow_builtin_ext_int_max_size : Error<
8288  "__builtin_mul_overflow does not support signed _ExtInt operands of more "
8289  "than %0 bits">;
8290
8291def err_atomic_load_store_uses_lib : Error<
8292  "atomic %select{load|store}0 requires runtime support that is not "
8293  "available for this target">;
8294
8295def err_nontemporal_builtin_must_be_pointer : Error<
8296  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
8297def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
8298  "address argument to nontemporal builtin must be a pointer to integer, float, "
8299  "pointer, or a vector of such types (%0 invalid)">;
8300
8301def err_deleted_function_use : Error<"attempt to use a deleted function">;
8302def err_deleted_inherited_ctor_use : Error<
8303  "constructor inherited by %0 from base class %1 is implicitly deleted">;
8304
8305def note_called_by : Note<"called by %0">;
8306def err_kern_type_not_void_return : Error<
8307  "kernel function type %0 must have void return type">;
8308def err_kern_is_nonstatic_method : Error<
8309  "kernel function %0 must be a free function or static member function">;
8310def err_config_scalar_return : Error<
8311  "CUDA special function '%0' must have scalar return type">;
8312def err_kern_call_not_global_function : Error<
8313  "kernel call to non-global function %0">;
8314def err_global_call_not_config : Error<
8315  "call to global function %0 not configured">;
8316def err_ref_bad_target : Error<
8317  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8318  "%select{function|variable}1 %2 in %select{__device__|__global__|__host__|__host__ __device__}3 function">;
8319def err_ref_bad_target_global_initializer : Error<
8320  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8321  "function %1 in global initializer">;
8322def err_capture_bad_target : Error<
8323  "capture host variable %0 by reference in device or host device lambda function">;
8324def err_capture_bad_target_this_ptr : Error<
8325  "capture host side class data member by this pointer in device or host device lambda function">;
8326def warn_kern_is_method : Extension<
8327  "kernel function %0 is a member function; this may not be accepted by nvcc">,
8328  InGroup<CudaCompat>;
8329def warn_kern_is_inline : Warning<
8330  "ignored 'inline' attribute on kernel function %0">,
8331  InGroup<CudaCompat>;
8332def err_variadic_device_fn : Error<
8333  "CUDA device code does not support variadic functions">;
8334def err_va_arg_in_device : Error<
8335  "CUDA device code does not support va_arg">;
8336def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
8337def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8338  "constexpr function %0 without __host__ or __device__ attributes cannot "
8339  "overload __device__ function with same signature.  Add a __host__ "
8340  "attribute, or build with -fno-cuda-host-device-constexpr.">;
8341def note_cuda_conflicting_device_function_declared_here : Note<
8342  "conflicting __device__ function declared here">;
8343def err_cuda_device_exceptions : Error<
8344  "cannot use '%0' in "
8345  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8346def err_dynamic_var_init : Error<
8347    "dynamic initialization is not supported for "
8348    "__device__, __constant__, __shared__, and __managed__ variables.">;
8349def err_shared_var_init : Error<
8350    "initialization is not supported for __shared__ variables.">;
8351def err_cuda_vla : Error<
8352    "cannot use variable-length arrays in "
8353    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8354def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8355def err_cuda_host_shared : Error<
8356    "__shared__ local variables not allowed in "
8357    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8358def err_cuda_nonstatic_constdev: Error<"__constant__, __device__, and "
8359    "__managed__ are not allowed on non-static local variables">;
8360def err_cuda_ovl_target : Error<
8361  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8362  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8363def note_cuda_ovl_candidate_target_mismatch : Note<
8364    "candidate template ignored: target attributes do not match">;
8365
8366def err_cuda_device_builtin_surftex_cls_template : Error<
8367    "illegal device builtin %select{surface|texture}0 reference "
8368    "class template %1 declared here">;
8369def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8370    "%0 needs to have exactly %1 template parameters">;
8371def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8372    "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8373    "%select{a type|an integer or enum value}2">;
8374
8375def err_cuda_device_builtin_surftex_ref_decl : Error<
8376    "illegal device builtin %select{surface|texture}0 reference "
8377    "type %1 declared here">;
8378def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8379    "%0 needs to be instantiated from a class template with proper "
8380    "template arguments">;
8381
8382def err_hip_invalid_args_builtin_mangled_name : Error<
8383    "invalid argument: symbol must be a device-side function or global variable">;
8384
8385def warn_non_pod_vararg_with_format_string : Warning<
8386  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8387  "%select{function|block|method|constructor}2; expected type from format "
8388  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8389// The arguments to this diagnostic should match the warning above.
8390def err_cannot_pass_objc_interface_to_vararg_format : Error<
8391  "cannot pass object with interface type %1 by value to variadic "
8392  "%select{function|block|method|constructor}2; expected type from format "
8393  "string was %3">;
8394def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8395  "cannot pass non-trivial C object of type %0 by value to variadic "
8396  "%select{function|block|method|constructor}1">;
8397
8398
8399def err_cannot_pass_objc_interface_to_vararg : Error<
8400  "cannot pass object with interface type %0 by value through variadic "
8401  "%select{function|block|method|constructor}1">;
8402def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8403  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8404  " %select{function|block|method|constructor}2; call will abort at runtime">,
8405  InGroup<NonPODVarargs>, DefaultError;
8406def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8407  "passing object of trivial but non-POD type %0 through variadic"
8408  " %select{function|block|method|constructor}1 is incompatible with C++98">,
8409  InGroup<CXX98Compat>, DefaultIgnore;
8410def warn_pass_class_arg_to_vararg : Warning<
8411  "passing object of class type %0 through variadic "
8412  "%select{function|block|method|constructor}1"
8413  "%select{|; did you mean to call '%3'?}2">,
8414  InGroup<ClassVarargs>, DefaultIgnore;
8415def err_cannot_pass_to_vararg : Error<
8416  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8417  "%select{function|block|method|constructor}2">;
8418def err_cannot_pass_to_vararg_format : Error<
8419  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8420  "%select{function|block|method|constructor}2; expected type from format "
8421  "string was %3">;
8422
8423def err_typecheck_call_invalid_ordered_compare : Error<
8424  "ordered compare requires two args of floating point type"
8425  "%diff{ ($ and $)|}0,1">;
8426def err_typecheck_call_invalid_unary_fp : Error<
8427  "floating point classification requires argument of floating point type "
8428  "(passed in %0)">;
8429def err_typecheck_cond_expect_int_float : Error<
8430  "used type %0 where integer or floating point type is required">;
8431def err_typecheck_cond_expect_scalar : Error<
8432  "used type %0 where arithmetic or pointer type is required">;
8433def err_typecheck_cond_expect_nonfloat : Error<
8434  "used type %0 where floating point type is not allowed">;
8435def ext_typecheck_cond_one_void : Extension<
8436  "C99 forbids conditional expressions with only one void side">;
8437def err_typecheck_cast_to_incomplete : Error<
8438  "cast to incomplete type %0">;
8439def ext_typecheck_cast_nonscalar : Extension<
8440  "C99 forbids casting nonscalar type %0 to the same type">;
8441def ext_typecheck_cast_to_union : Extension<
8442  "cast to union type is a GNU extension">,
8443  InGroup<GNUUnionCast>;
8444def err_typecheck_cast_to_union_no_type : Error<
8445  "cast to union type from type %0 not present in union">;
8446def err_cast_pointer_from_non_pointer_int : Error<
8447  "operand of type %0 cannot be cast to a pointer type">;
8448def warn_cast_pointer_from_sel : Warning<
8449  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8450  InGroup<SelTypeCast>;
8451def warn_function_def_in_objc_container : Warning<
8452  "function definition inside an Objective-C container is deprecated">,
8453  InGroup<FunctionDefInObjCContainer>;
8454def err_typecheck_call_requires_real_fp : Error<
8455  "argument type %0 is not a real floating point type">;
8456def err_typecheck_call_different_arg_types : Error<
8457  "arguments are of different types%diff{ ($ vs $)|}0,1">;
8458
8459def warn_cast_calling_conv : Warning<
8460  "cast between incompatible calling conventions '%0' and '%1'; "
8461  "calls through this pointer may abort at runtime">,
8462  InGroup<DiagGroup<"cast-calling-convention">>;
8463def note_change_calling_conv_fixit : Note<
8464  "consider defining %0 with the '%1' calling convention">;
8465def warn_bad_function_cast : Warning<
8466  "cast from function call of type %0 to non-matching type %1">,
8467  InGroup<BadFunctionCast>, DefaultIgnore;
8468def warn_cast_function_type : Warning<
8469  "cast %diff{from $ to $ |}0,1converts to incompatible function type">,
8470  InGroup<CastFunctionType>, DefaultIgnore;
8471def err_cast_pointer_to_non_pointer_int : Error<
8472  "pointer cannot be cast to type %0">;
8473def err_cast_to_bfloat16 : Error<"cannot type-cast to __bf16">;
8474def err_cast_from_bfloat16 : Error<"cannot type-cast from __bf16">;
8475def err_typecheck_expect_scalar_operand : Error<
8476  "operand of type %0 where arithmetic or pointer type is required">;
8477def err_typecheck_cond_incompatible_operands : Error<
8478  "incompatible operand types%diff{ ($ and $)|}0,1">;
8479def err_cast_selector_expr : Error<
8480  "cannot type cast @selector expression">;
8481def ext_typecheck_cond_incompatible_pointers : ExtWarn<
8482  "pointer type mismatch%diff{ ($ and $)|}0,1">,
8483  InGroup<DiagGroup<"pointer-type-mismatch">>;
8484def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
8485  "pointer/integer type mismatch in conditional expression"
8486  "%diff{ ($ and $)|}0,1">,
8487  InGroup<DiagGroup<"conditional-type-mismatch">>;
8488def err_typecheck_choose_expr_requires_constant : Error<
8489  "'__builtin_choose_expr' requires a constant expression">;
8490def warn_unused_expr : Warning<"expression result unused">,
8491  InGroup<UnusedValue>;
8492def warn_unused_voidptr : Warning<
8493  "expression result unused; should this cast be to 'void'?">,
8494  InGroup<UnusedValue>;
8495def warn_unused_property_expr : Warning<
8496 "property access result unused - getters should not be used for side effects">,
8497  InGroup<UnusedGetterReturnValue>;
8498def warn_unused_container_subscript_expr : Warning<
8499 "container access result unused - container access should not be used for side effects">,
8500  InGroup<UnusedValue>;
8501def warn_unused_call : Warning<
8502  "ignoring return value of function declared with %0 attribute">,
8503  InGroup<UnusedValue>;
8504def warn_unused_constructor : Warning<
8505  "ignoring temporary created by a constructor declared with %0 attribute">,
8506  InGroup<UnusedValue>;
8507def warn_unused_constructor_msg : Warning<
8508  "ignoring temporary created by a constructor declared with %0 attribute: %1">,
8509  InGroup<UnusedValue>;
8510def warn_side_effects_unevaluated_context : Warning<
8511  "expression with side effects has no effect in an unevaluated context">,
8512  InGroup<UnevaluatedExpression>;
8513def warn_side_effects_typeid : Warning<
8514  "expression with side effects will be evaluated despite being used as an "
8515  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
8516def warn_unused_result : Warning<
8517  "ignoring return value of function declared with %0 attribute">,
8518  InGroup<UnusedResult>;
8519def warn_unused_result_msg : Warning<
8520  "ignoring return value of function declared with %0 attribute: %1">,
8521  InGroup<UnusedResult>;
8522def warn_unused_volatile : Warning<
8523  "expression result unused; assign into a variable to force a volatile load">,
8524  InGroup<DiagGroup<"unused-volatile-lvalue">>;
8525
8526def ext_cxx14_attr : Extension<
8527  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
8528def ext_cxx17_attr : Extension<
8529  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17>;
8530def ext_cxx20_attr : Extension<
8531  "use of the %0 attribute is a C++20 extension">, InGroup<CXX20>;
8532
8533def warn_unused_comparison : Warning<
8534  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
8535  InGroup<UnusedComparison>;
8536def note_inequality_comparison_to_or_assign : Note<
8537  "use '|=' to turn this inequality comparison into an or-assignment">;
8538
8539def err_incomplete_type_used_in_type_trait_expr : Error<
8540  "incomplete type %0 used in type trait expression">;
8541
8542// C++20 constinit and require_constant_initialization attribute
8543def warn_cxx20_compat_constinit : Warning<
8544  "'constinit' specifier is incompatible with C++ standards before C++20">,
8545  InGroup<CXX20Compat>, DefaultIgnore;
8546def err_constinit_local_variable : Error<
8547  "local variable cannot be declared 'constinit'">;
8548def err_require_constant_init_failed : Error<
8549  "variable does not have a constant initializer">;
8550def note_declared_required_constant_init_here : Note<
8551  "required by %select{'require_constant_initialization' attribute|"
8552  "'constinit' specifier}0 here">;
8553def ext_constinit_missing : ExtWarn<
8554  "'constinit' specifier missing on initializing declaration of %0">,
8555  InGroup<DiagGroup<"missing-constinit">>;
8556def note_constinit_specified_here : Note<"variable declared constinit here">;
8557def err_constinit_added_too_late : Error<
8558  "'constinit' specifier added after initialization of variable">;
8559def warn_require_const_init_added_too_late : Warning<
8560  "'require_constant_initialization' attribute added after initialization "
8561  "of variable">, InGroup<IgnoredAttributes>;
8562def note_constinit_missing_here : Note<
8563  "add the "
8564  "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
8565  "to the initializing declaration here">;
8566
8567def err_dimension_expr_not_constant_integer : Error<
8568  "dimension expression does not evaluate to a constant unsigned int">;
8569
8570def err_typecheck_cond_incompatible_operands_null : Error<
8571  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
8572def ext_empty_struct_union : Extension<
8573  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
8574def ext_no_named_members_in_struct_union : Extension<
8575  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
8576def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
8577  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8578  InGroup<CXXCompat>, DefaultIgnore;
8579def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
8580  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8581  InGroup<ExternCCompat>;
8582def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
8583  "volatile qualifiers|const qualifier|volatile qualifier}2">,
8584  InGroup<CastQual>, DefaultIgnore;
8585def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
8586  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
8587def warn_redefine_extname_not_applied : Warning<
8588  "#pragma redefine_extname is applicable to external C declarations only; "
8589  "not applied to %select{function|variable}0 %1">,
8590  InGroup<Pragmas>;
8591} // End of general sema category.
8592
8593// inline asm.
8594let CategoryName = "Inline Assembly Issue" in {
8595  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
8596  def err_asm_invalid_output_constraint : Error<
8597    "invalid output constraint '%0' in asm">;
8598  def err_asm_invalid_lvalue_in_input : Error<
8599    "invalid lvalue in asm input for constraint '%0'">;
8600  def err_asm_invalid_input_constraint : Error<
8601    "invalid input constraint '%0' in asm">;
8602  def err_asm_tying_incompatible_types : Error<
8603    "unsupported inline asm: input with type "
8604    "%diff{$ matching output with type $|}0,1">;
8605  def err_asm_unexpected_constraint_alternatives : Error<
8606    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
8607  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
8608  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
8609  def err_asm_unwind_and_goto : Error<"unwind clobber can't be used with asm goto">;
8610  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
8611    "global register variables on this target">;
8612  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
8613    "match variable size">;
8614  def err_asm_bad_register_type : Error<"bad type for named register variable">;
8615  def err_asm_invalid_input_size : Error<
8616    "invalid input size for constraint '%0'">;
8617  def err_asm_invalid_output_size : Error<
8618    "invalid output size for constraint '%0'">;
8619  def err_invalid_asm_cast_lvalue : Error<
8620    "invalid use of a cast in a inline asm context requiring an lvalue: "
8621    "remove the cast or build with -fheinous-gnu-extensions">;
8622  def err_invalid_asm_value_for_constraint
8623      : Error <"value '%0' out of range for constraint '%1'">;
8624  def err_asm_non_addr_value_in_memory_constraint : Error <
8625    "reference to a %select{bit-field|vector element|global register variable}0"
8626    " in asm %select{input|output}1 with a memory constraint '%2'">;
8627  def err_asm_input_duplicate_match : Error<
8628    "more than one input constraint matches the same output '%0'">;
8629
8630  def warn_asm_label_on_auto_decl : Warning<
8631    "ignored asm label '%0' on automatic variable">;
8632  def warn_invalid_asm_cast_lvalue : Warning<
8633    "invalid use of a cast in an inline asm context requiring an lvalue: "
8634    "accepted due to -fheinous-gnu-extensions, but clang may remove support "
8635    "for this in the future">;
8636  def warn_asm_mismatched_size_modifier : Warning<
8637    "value size does not match register size specified by the constraint "
8638    "and modifier">,
8639    InGroup<ASMOperandWidths>;
8640
8641  def note_asm_missing_constraint_modifier : Note<
8642    "use constraint modifier \"%0\"">;
8643  def note_asm_input_duplicate_first : Note<
8644    "constraint '%0' is already present here">;
8645 def error_duplicate_asm_operand_name : Error<
8646    "duplicate use of asm operand name \"%0\"">;
8647 def note_duplicate_asm_operand_name : Note<
8648    "asm operand name \"%0\" first referenced here">;
8649}
8650
8651  def error_inoutput_conflict_with_clobber : Error<
8652    "asm-specifier for input or output variable conflicts with asm"
8653    " clobber list">;
8654
8655let CategoryName = "Semantic Issue" in {
8656
8657def err_invalid_conversion_between_matrixes : Error<
8658  "conversion between matrix types%diff{ $ and $|}0,1 of different size is not allowed">;
8659
8660def err_invalid_conversion_between_matrix_and_type : Error<
8661  "conversion between matrix type %0 and incompatible type %1 is not allowed">;
8662
8663def err_invalid_conversion_between_vectors : Error<
8664  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
8665  "size">;
8666def err_invalid_conversion_between_vector_and_integer : Error<
8667  "invalid conversion between vector type %0 and integer type %1 "
8668  "of different size">;
8669
8670def err_opencl_function_pointer : Error<
8671  "%select{pointers|references}0 to functions are not allowed">;
8672
8673def err_opencl_taking_address_capture : Error<
8674  "taking address of a capture is not allowed">;
8675
8676def err_invalid_conversion_between_vector_and_scalar : Error<
8677  "invalid conversion between vector type %0 and scalar type %1">;
8678
8679// C++ member initializers.
8680def err_only_constructors_take_base_inits : Error<
8681  "only constructors take base initializers">;
8682
8683def err_multiple_mem_initialization : Error <
8684  "multiple initializations given for non-static member %0">;
8685def err_multiple_mem_union_initialization : Error <
8686  "initializing multiple members of union">;
8687def err_multiple_base_initialization : Error <
8688  "multiple initializations given for base %0">;
8689
8690def err_mem_init_not_member_or_class : Error<
8691  "member initializer %0 does not name a non-static data member or base "
8692  "class">;
8693
8694def warn_initializer_out_of_order : Warning<
8695  "%select{field|base class}0 %1 will be initialized after "
8696  "%select{field|base}2 %3">,
8697  InGroup<ReorderCtor>, DefaultIgnore;
8698
8699def warn_some_initializers_out_of_order : Warning<
8700  "initializer order does not match the declaration order">,
8701  InGroup<ReorderCtor>, DefaultIgnore;
8702
8703def note_initializer_out_of_order : Note<
8704  "%select{field|base class}0 %1 will be initialized after "
8705  "%select{field|base}2 %3">;
8706
8707def warn_abstract_vbase_init_ignored : Warning<
8708  "initializer for virtual base class %0 of abstract class %1 "
8709  "will never be used">,
8710  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
8711
8712def err_base_init_does_not_name_class : Error<
8713  "constructor initializer %0 does not name a class">;
8714def err_base_init_direct_and_virtual : Error<
8715  "base class initializer %0 names both a direct base class and an "
8716  "inherited virtual base class">;
8717def err_not_direct_base_or_virtual : Error<
8718  "type %0 is not a direct or virtual base of %1">;
8719
8720def err_in_class_initializer_non_const : Error<
8721  "non-const static data member must be initialized out of line">;
8722def err_in_class_initializer_volatile : Error<
8723  "static const volatile data member must be initialized out of line">;
8724def err_in_class_initializer_bad_type : Error<
8725  "static data member of type %0 must be initialized out of line">;
8726def ext_in_class_initializer_float_type : ExtWarn<
8727  "in-class initializer for static data member of type %0 is a GNU extension">,
8728  InGroup<GNUStaticFloatInit>;
8729def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
8730  "in-class initializer for static data member of type %0 requires "
8731  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
8732def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
8733def err_in_class_initializer_literal_type : Error<
8734  "in-class initializer for static data member of type %0 requires "
8735  "'constexpr' specifier">;
8736def err_in_class_initializer_non_constant : Error<
8737  "in-class initializer for static data member is not a constant expression">;
8738def err_default_member_initializer_not_yet_parsed : Error<
8739  "default member initializer for %1 needed within definition of enclosing "
8740  "class %0 outside of member functions">;
8741def note_default_member_initializer_not_yet_parsed : Note<
8742  "default member initializer declared here">;
8743def err_default_member_initializer_cycle
8744    : Error<"default member initializer for %0 uses itself">;
8745
8746def ext_in_class_initializer_non_constant : Extension<
8747  "in-class initializer for static data member is not a constant expression; "
8748  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
8749
8750def err_thread_dynamic_init : Error<
8751  "initializer for thread-local variable must be a constant expression">;
8752def err_thread_nontrivial_dtor : Error<
8753  "type of thread-local variable has non-trivial destruction">;
8754def note_use_thread_local : Note<
8755  "use 'thread_local' to allow this">;
8756
8757// C++ anonymous unions and GNU anonymous structs/unions
8758def ext_anonymous_union : Extension<
8759  "anonymous unions are a C11 extension">, InGroup<C11>;
8760def ext_gnu_anonymous_struct : Extension<
8761  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
8762def ext_c11_anonymous_struct : Extension<
8763  "anonymous structs are a C11 extension">, InGroup<C11>;
8764def err_anonymous_union_not_static : Error<
8765  "anonymous unions at namespace or global scope must be declared 'static'">;
8766def err_anonymous_union_with_storage_spec : Error<
8767  "anonymous union at class scope must not have a storage specifier">;
8768def err_anonymous_struct_not_member : Error<
8769  "anonymous %select{structs|structs and classes}0 must be "
8770  "%select{struct or union|class}0 members">;
8771def err_anonymous_record_member_redecl : Error<
8772  "member of anonymous %select{struct|union}0 redeclares %1">;
8773def err_anonymous_record_with_type : Error<
8774  "types cannot be declared in an anonymous %select{struct|union}0">;
8775def ext_anonymous_record_with_type : Extension<
8776  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
8777  "extension">, InGroup<MicrosoftAnonTag>;
8778def ext_anonymous_record_with_anonymous_type : Extension<
8779  "anonymous types declared in an anonymous %select{struct|union}0 "
8780  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
8781def err_anonymous_record_with_function : Error<
8782  "functions cannot be declared in an anonymous %select{struct|union}0">;
8783def err_anonymous_record_with_static : Error<
8784  "static members cannot be declared in an anonymous %select{struct|union}0">;
8785def err_anonymous_record_bad_member : Error<
8786  "anonymous %select{struct|union}0 can only contain non-static data members">;
8787def err_anonymous_record_nonpublic_member : Error<
8788  "anonymous %select{struct|union}0 cannot contain a "
8789  "%select{private|protected}1 data member">;
8790def ext_ms_anonymous_record : ExtWarn<
8791  "anonymous %select{structs|unions}0 are a Microsoft extension">,
8792  InGroup<MicrosoftAnonTag>;
8793
8794// C++ local classes
8795def err_reference_to_local_in_enclosing_context : Error<
8796  "reference to local %select{variable|binding}1 %0 declared in enclosing "
8797  "%select{%3|block literal|lambda expression|context}2">;
8798
8799def err_static_data_member_not_allowed_in_local_class : Error<
8800  "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
8801
8802// C++ derived classes
8803def err_base_clause_on_union : Error<"unions cannot have base classes">;
8804def err_base_must_be_class : Error<"base specifier must name a class">;
8805def err_union_as_base_class : Error<"unions cannot be base classes">;
8806def err_circular_inheritance : Error<
8807  "circular inheritance between %0 and %1">;
8808def err_base_class_has_flexible_array_member : Error<
8809  "base class %0 has a flexible array member">;
8810def err_incomplete_base_class : Error<"base class has incomplete type">;
8811def err_duplicate_base_class : Error<
8812  "base class %0 specified more than once as a direct base class">;
8813def warn_inaccessible_base_class : Warning<
8814  "direct base %0 is inaccessible due to ambiguity:%1">,
8815  InGroup<DiagGroup<"inaccessible-base">>;
8816// FIXME: better way to display derivation?  Pass entire thing into diagclient?
8817def err_ambiguous_derived_to_base_conv : Error<
8818  "ambiguous conversion from derived class %0 to base class %1:%2">;
8819def err_ambiguous_memptr_conv : Error<
8820  "ambiguous conversion from pointer to member of %select{base|derived}0 "
8821  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
8822def ext_ms_ambiguous_direct_base : ExtWarn<
8823  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
8824  InGroup<MicrosoftInaccessibleBase>;
8825
8826def err_memptr_conv_via_virtual : Error<
8827  "conversion from pointer to member of class %0 to pointer to member "
8828  "of class %1 via virtual base %2 is not allowed">;
8829
8830// C++ member name lookup
8831def err_ambiguous_member_multiple_subobjects : Error<
8832  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
8833def err_ambiguous_member_multiple_subobject_types : Error<
8834  "member %0 found in multiple base classes of different types">;
8835def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
8836def note_ambiguous_member_type_found : Note<
8837  "member type %0 found by ambiguous name lookup">;
8838def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
8839def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
8840def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
8841  "declaration in a different namespace">;
8842def note_hidden_tag : Note<"type declaration hidden">;
8843def note_hiding_object : Note<"declaration hides type">;
8844
8845// C++ operator overloading
8846def err_operator_overload_needs_class_or_enum : Error<
8847  "overloaded %0 must have at least one parameter of class "
8848  "or enumeration type">;
8849
8850def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
8851def err_operator_overload_static : Error<
8852  "overloaded %0 cannot be a static member function">;
8853def err_operator_overload_default_arg : Error<
8854  "parameter of overloaded %0 cannot have a default argument">;
8855def err_operator_overload_must_be : Error<
8856  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
8857  "(has %1 parameter%s1)">;
8858
8859def err_operator_overload_must_be_member : Error<
8860  "overloaded %0 must be a non-static member function">;
8861def err_operator_overload_post_incdec_must_be_int : Error<
8862  "parameter of overloaded post-%select{increment|decrement}1 operator must "
8863  "have type 'int' (not %0)">;
8864
8865// C++ allocation and deallocation functions.
8866def err_operator_new_delete_declared_in_namespace : Error<
8867  "%0 cannot be declared inside a namespace">;
8868def err_operator_new_delete_declared_static : Error<
8869  "%0 cannot be declared static in global scope">;
8870def ext_operator_new_delete_declared_inline : ExtWarn<
8871  "replacement function %0 cannot be declared 'inline'">,
8872  InGroup<DiagGroup<"inline-new-delete">>;
8873def err_operator_new_delete_invalid_result_type : Error<
8874  "%0 must return type %1">;
8875def err_operator_new_delete_dependent_result_type : Error<
8876  "%0 cannot have a dependent return type; use %1 instead">;
8877def err_operator_new_delete_too_few_parameters : Error<
8878  "%0 must have at least one parameter">;
8879def err_operator_new_delete_template_too_few_parameters : Error<
8880  "%0 template must have at least two parameters">;
8881def warn_operator_new_returns_null : Warning<
8882  "%0 should not return a null pointer unless it is declared 'throw()'"
8883  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
8884
8885def err_operator_new_dependent_param_type : Error<
8886  "%0 cannot take a dependent type as first parameter; "
8887  "use size_t (%1) instead">;
8888def err_operator_new_param_type : Error<
8889  "%0 takes type size_t (%1) as first parameter">;
8890def err_operator_new_default_arg: Error<
8891  "parameter of %0 cannot have a default argument">;
8892def err_operator_delete_dependent_param_type : Error<
8893  "%0 cannot take a dependent type as first parameter; use %1 instead">;
8894def err_operator_delete_param_type : Error<
8895  "first parameter of %0 must have type %1">;
8896def err_destroying_operator_delete_not_usual : Error<
8897  "destroying operator delete can have only an optional size and optional "
8898  "alignment parameter">;
8899def note_implicit_delete_this_in_destructor_here : Note<
8900  "while checking implicit 'delete this' for virtual destructor">;
8901def err_builtin_operator_new_delete_not_usual : Error<
8902  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
8903  "selects non-usual %select{allocation|deallocation}0 function">;
8904def note_non_usual_function_declared_here : Note<
8905  "non-usual %0 declared here">;
8906
8907// C++ literal operators
8908def err_literal_operator_outside_namespace : Error<
8909  "literal operator %0 must be in a namespace or global scope">;
8910def err_literal_operator_id_outside_namespace : Error<
8911  "non-namespace scope '%0' cannot have a literal operator member">;
8912def err_literal_operator_default_argument : Error<
8913  "literal operator cannot have a default argument">;
8914def err_literal_operator_bad_param_count : Error<
8915  "non-template literal operator must have one or two parameters">;
8916def err_literal_operator_invalid_param : Error<
8917  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
8918def err_literal_operator_param : Error<
8919  "invalid literal operator parameter type %0, did you mean %1?">;
8920def err_literal_operator_template_with_params : Error<
8921  "literal operator template cannot have any parameters">;
8922def err_literal_operator_template : Error<
8923  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
8924def err_literal_operator_extern_c : Error<
8925  "literal operator must have C++ linkage">;
8926def ext_string_literal_operator_template : ExtWarn<
8927  "string literal operator templates are a GNU extension">,
8928  InGroup<GNUStringLiteralOperatorTemplate>;
8929def warn_user_literal_reserved : Warning<
8930  "user-defined literal suffixes not starting with '_' are reserved"
8931  "%select{; no literal will invoke this operator|}0">,
8932  InGroup<UserDefinedLiterals>;
8933
8934// C++ conversion functions
8935def err_conv_function_not_member : Error<
8936  "conversion function must be a non-static member function">;
8937def err_conv_function_return_type : Error<
8938  "conversion function cannot have a return type">;
8939def err_conv_function_with_params : Error<
8940  "conversion function cannot have any parameters">;
8941def err_conv_function_variadic : Error<
8942  "conversion function cannot be variadic">;
8943def err_conv_function_to_array : Error<
8944  "conversion function cannot convert to an array type">;
8945def err_conv_function_to_function : Error<
8946  "conversion function cannot convert to a function type">;
8947def err_conv_function_with_complex_decl : Error<
8948  "cannot specify any part of a return type in the "
8949  "declaration of a conversion function"
8950  "%select{"
8951  "; put the complete type after 'operator'|"
8952  "; use a typedef to declare a conversion to %1|"
8953  "; use an alias template to declare a conversion to %1|"
8954  "}0">;
8955def err_conv_function_redeclared : Error<
8956  "conversion function cannot be redeclared">;
8957def warn_conv_to_self_not_used : Warning<
8958  "conversion function converting %0 to itself will never be used">,
8959  InGroup<ClassConversion>;
8960def warn_conv_to_base_not_used : Warning<
8961  "conversion function converting %0 to its base class %1 will never be used">,
8962  InGroup<ClassConversion>;
8963def warn_conv_to_void_not_used : Warning<
8964  "conversion function converting %0 to %1 will never be used">,
8965  InGroup<ClassConversion>;
8966
8967def warn_not_compound_assign : Warning<
8968  "use of unary operator that may be intended as compound assignment (%0=)">;
8969
8970// C++11 explicit conversion operators
8971def ext_explicit_conversion_functions : ExtWarn<
8972  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
8973def warn_cxx98_compat_explicit_conversion_functions : Warning<
8974  "explicit conversion functions are incompatible with C++98">,
8975  InGroup<CXX98Compat>, DefaultIgnore;
8976
8977// C++11 defaulted functions
8978def err_defaulted_special_member_params : Error<
8979  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8980  "have default arguments">;
8981def err_defaulted_special_member_variadic : Error<
8982  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8983  "be variadic">;
8984def err_defaulted_special_member_return_type : Error<
8985  "explicitly-defaulted %select{copy|move}0 assignment operator must "
8986  "return %1">;
8987def err_defaulted_special_member_quals : Error<
8988  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
8989  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
8990def err_defaulted_special_member_volatile_param : Error<
8991  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
8992  "may not be volatile">;
8993def err_defaulted_special_member_move_const_param : Error<
8994  "the parameter for an explicitly-defaulted move "
8995  "%select{constructor|assignment operator}0 may not be const">;
8996def err_defaulted_special_member_copy_const_param : Error<
8997  "the parameter for this explicitly-defaulted copy "
8998  "%select{constructor|assignment operator}0 is const, but a member or base "
8999  "requires it to be non-const">;
9000def err_defaulted_copy_assign_not_ref : Error<
9001  "the parameter for an explicitly-defaulted copy assignment operator must be an "
9002  "lvalue reference type">;
9003def err_incorrect_defaulted_constexpr : Error<
9004  "defaulted definition of %sub{select_special_member_kind}0 "
9005  "is not constexpr">;
9006def err_incorrect_defaulted_consteval : Error<
9007  "defaulted declaration of %sub{select_special_member_kind}0 "
9008  "cannot be consteval because implicit definition is not constexpr">;
9009def warn_defaulted_method_deleted : Warning<
9010  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
9011  "deleted">, InGroup<DefaultedFunctionDeleted>;
9012def err_out_of_line_default_deletes : Error<
9013  "defaulting this %sub{select_special_member_kind}0 "
9014  "would delete it after its first declaration">;
9015def note_deleted_type_mismatch : Note<
9016  "function is implicitly deleted because its declared type does not match "
9017  "the type of an implicit %sub{select_special_member_kind}0">;
9018def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
9019  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
9020  "different from the implicit type is incompatible with C++ standards before "
9021  "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9022def warn_vbase_moved_multiple_times : Warning<
9023  "defaulted move assignment operator of %0 will move assign virtual base "
9024  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
9025def note_vbase_moved_here : Note<
9026  "%select{%1 is a virtual base class of base class %2 declared here|"
9027  "virtual base class %1 declared here}0">;
9028
9029// C++20 defaulted comparisons
9030// This corresponds to values of Sema::DefaultedComparisonKind.
9031def select_defaulted_comparison_kind : TextSubstitution<
9032  "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
9033  "operator">;
9034def ext_defaulted_comparison : ExtWarn<
9035  "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
9036def warn_cxx17_compat_defaulted_comparison : Warning<
9037  "defaulted comparison operators are incompatible with C++ standards "
9038  "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9039def err_defaulted_comparison_template : Error<
9040  "comparison operator template cannot be defaulted">;
9041def err_defaulted_comparison_out_of_class : Error<
9042  "%sub{select_defaulted_comparison_kind}0 can only be defaulted in a class "
9043  "definition">;
9044def err_defaulted_comparison_param : Error<
9045  "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
9046  "; found %1, expected %2%select{| or %4}3">;
9047def err_defaulted_comparison_param_mismatch : Error<
9048  "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
9049  "must have the same type%diff{ (found $ vs $)|}1,2">;
9050def err_defaulted_comparison_non_const : Error<
9051  "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
9052  "const-qualified">;
9053def err_defaulted_comparison_return_type_not_bool : Error<
9054  "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9055  "must be 'bool', not %1">;
9056def err_defaulted_comparison_deduced_return_type_not_auto : Error<
9057  "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9058  "must be 'auto', not %1">;
9059def warn_defaulted_comparison_deleted : Warning<
9060  "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
9061  "deleted">, InGroup<DefaultedFunctionDeleted>;
9062def err_non_first_default_compare_deletes : Error<
9063  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
9064  "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
9065  "would delete it after its first declaration">;
9066def note_defaulted_comparison_union : Note<
9067  "defaulted %0 is implicitly deleted because "
9068  "%2 is a %select{union-like class|union}1 with variant members">;
9069def note_defaulted_comparison_reference_member : Note<
9070  "defaulted %0 is implicitly deleted because "
9071  "class %1 has a reference member">;
9072def note_defaulted_comparison_ambiguous : Note<
9073  "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
9074  "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
9075def note_defaulted_comparison_inaccessible : Note<
9076  "defaulted %0 is implicitly deleted because it would invoke a "
9077  "%select{private|protected}3 %4%select{ member of %6|"
9078  " member of %6 to compare member %2| to compare base class %2}1">;
9079def note_defaulted_comparison_calls_deleted : Note<
9080  "defaulted %0 is implicitly deleted because it would invoke a deleted "
9081  "comparison function%select{| for member %2| for base class %2}1">;
9082def note_defaulted_comparison_no_viable_function : Note<
9083  "defaulted %0 is implicitly deleted because there is no viable three-way "
9084  "comparison function for%select{| member| base class}1 %2">;
9085def note_defaulted_comparison_no_viable_function_synthesized : Note<
9086  "three-way comparison cannot be synthesized because there is no viable "
9087  "function for %select{'=='|'<'}0 comparison">;
9088def note_defaulted_comparison_not_rewritten_callee : Note<
9089  "defaulted %0 is implicitly deleted because this non-rewritten comparison "
9090  "function would be the best match for the comparison">;
9091def note_defaulted_comparison_cannot_deduce : Note<
9092  "return type of defaulted 'operator<=>' cannot be deduced because "
9093  "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
9094  "is not a standard comparison category type">;
9095def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
9096  "return type of defaulted 'operator<=>' cannot be deduced because "
9097  "three-way comparison for %select{|member|base class}0 %1 "
9098  "has a deduced return type and is not yet defined">;
9099def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
9100  "%select{|member|base class}0 %1 declared here">;
9101def note_defaulted_comparison_cannot_deduce_callee : Note<
9102  "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
9103def err_incorrect_defaulted_comparison_constexpr : Error<
9104  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9105  "three-way comparison operator}0 "
9106  "cannot be declared %select{constexpr|consteval}2 because "
9107  "%select{it|the corresponding implicit 'operator=='}0 "
9108  "invokes a non-constexpr comparison function">;
9109def note_defaulted_comparison_not_constexpr : Note<
9110  "non-constexpr comparison function would be used to compare "
9111  "%select{|member %1|base class %1}0">;
9112def note_defaulted_comparison_not_constexpr_here : Note<
9113  "non-constexpr comparison function declared here">;
9114def note_in_declaration_of_implicit_equality_comparison : Note<
9115  "while declaring the corresponding implicit 'operator==' "
9116  "for this defaulted 'operator<=>'">;
9117
9118def ext_implicit_exception_spec_mismatch : ExtWarn<
9119  "function previously declared with an %select{explicit|implicit}0 exception "
9120  "specification redeclared with an %select{implicit|explicit}0 exception "
9121  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
9122
9123def warn_ptr_arith_precedes_bounds : Warning<
9124  "the pointer decremented by %0 refers before the beginning of the array">,
9125  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9126def warn_ptr_arith_exceeds_bounds : Warning<
9127  "the pointer incremented by %0 refers past the end of the array (that "
9128  "contains %1 element%s2)">,
9129  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9130def warn_array_index_precedes_bounds : Warning<
9131  "array index %0 is before the beginning of the array">,
9132  InGroup<ArrayBounds>;
9133def warn_array_index_exceeds_bounds : Warning<
9134  "array index %0 is past the end of the array (which contains %1 "
9135  "element%s2)">, InGroup<ArrayBounds>;
9136def note_array_declared_here : Note<
9137  "array %0 declared here">;
9138
9139def warn_printf_insufficient_data_args : Warning<
9140  "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
9141def warn_printf_data_arg_not_used : Warning<
9142  "data argument not used by format string">, InGroup<FormatExtraArgs>;
9143def warn_format_invalid_conversion : Warning<
9144  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
9145def warn_printf_incomplete_specifier : Warning<
9146  "incomplete format specifier">, InGroup<Format>;
9147def warn_missing_format_string : Warning<
9148  "format string missing">, InGroup<Format>;
9149def warn_scanf_nonzero_width : Warning<
9150  "zero field width in scanf format string is unused">,
9151  InGroup<Format>;
9152def warn_format_conversion_argument_type_mismatch : Warning<
9153  "format specifies type %0 but the argument has "
9154  "%select{type|underlying type}2 %1">,
9155  InGroup<Format>;
9156def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
9157  warn_format_conversion_argument_type_mismatch.Text>,
9158  InGroup<FormatPedantic>;
9159def warn_format_conversion_argument_type_mismatch_confusion : Warning<
9160  warn_format_conversion_argument_type_mismatch.Text>,
9161  InGroup<FormatTypeConfusion>, DefaultIgnore;
9162def warn_format_argument_needs_cast : Warning<
9163  "%select{values of type|enum values with underlying type}2 '%0' should not "
9164  "be used as format arguments; add an explicit cast to %1 instead">,
9165  InGroup<Format>;
9166def warn_format_argument_needs_cast_pedantic : Warning<
9167  warn_format_argument_needs_cast.Text>,
9168  InGroup<FormatPedantic>, DefaultIgnore;
9169def warn_printf_positional_arg_exceeds_data_args : Warning <
9170  "data argument position '%0' exceeds the number of data arguments (%1)">,
9171  InGroup<Format>;
9172def warn_format_zero_positional_specifier : Warning<
9173  "position arguments in format strings start counting at 1 (not 0)">,
9174  InGroup<Format>;
9175def warn_format_invalid_positional_specifier : Warning<
9176  "invalid position specified for %select{field width|field precision}0">,
9177  InGroup<Format>;
9178def warn_format_mix_positional_nonpositional_args : Warning<
9179  "cannot mix positional and non-positional arguments in format string">,
9180  InGroup<Format>;
9181def warn_static_array_too_small : Warning<
9182  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
9183  " callee requires at least %1">,
9184  InGroup<ArrayBounds>;
9185def note_callee_static_array : Note<
9186  "callee declares array parameter as static here">;
9187def warn_empty_format_string : Warning<
9188  "format string is empty">, InGroup<FormatZeroLength>;
9189def warn_format_string_is_wide_literal : Warning<
9190  "format string should not be a wide string">, InGroup<Format>;
9191def warn_printf_format_string_contains_null_char : Warning<
9192  "format string contains '\\0' within the string body">, InGroup<Format>;
9193def warn_printf_format_string_not_null_terminated : Warning<
9194  "format string is not null-terminated">, InGroup<Format>;
9195def warn_printf_asterisk_missing_arg : Warning<
9196  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
9197  InGroup<Format>;
9198def warn_printf_asterisk_wrong_type : Warning<
9199  "field %select{width|precision}0 should have type %1, but argument has type %2">,
9200  InGroup<Format>;
9201def warn_printf_nonsensical_optional_amount: Warning<
9202  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
9203  InGroup<Format>;
9204def warn_printf_nonsensical_flag: Warning<
9205  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
9206  InGroup<Format>;
9207def warn_format_nonsensical_length: Warning<
9208  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
9209  InGroup<Format>;
9210def warn_format_non_standard_positional_arg: Warning<
9211  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
9212def warn_format_non_standard: Warning<
9213  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
9214  InGroup<FormatNonStandard>, DefaultIgnore;
9215def warn_format_non_standard_conversion_spec: Warning<
9216  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
9217  InGroup<FormatNonStandard>, DefaultIgnore;
9218def err_invalid_mask_type_size : Error<
9219  "mask type size must be between 1-byte and 8-bytes">;
9220def warn_format_invalid_annotation : Warning<
9221  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
9222  InGroup<Format>;
9223def warn_format_P_no_precision : Warning<
9224  "using '%%P' format specifier without precision">,
9225  InGroup<Format>;
9226def warn_printf_ignored_flag: Warning<
9227  "flag '%0' is ignored when flag '%1' is present">,
9228  InGroup<Format>;
9229def warn_printf_empty_objc_flag: Warning<
9230  "missing object format flag">,
9231  InGroup<Format>;
9232def warn_printf_ObjCflags_without_ObjCConversion: Warning<
9233  "object format flags cannot be used with '%0' conversion specifier">,
9234  InGroup<Format>;
9235def warn_printf_invalid_objc_flag: Warning<
9236    "'%0' is not a valid object format flag">,
9237    InGroup<Format>;
9238def warn_scanf_scanlist_incomplete : Warning<
9239  "no closing ']' for '%%[' in scanf format string">,
9240  InGroup<Format>;
9241def warn_format_bool_as_character : Warning<
9242  "using '%0' format specifier, but argument has boolean value">,
9243  InGroup<Format>;
9244def note_format_string_defined : Note<"format string is defined here">;
9245def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
9246def note_printf_c_str: Note<"did you mean to call the %0 method?">;
9247def note_format_security_fixit: Note<
9248  "treat the string as an argument to avoid this">;
9249
9250def warn_null_arg : Warning<
9251  "null passed to a callee that requires a non-null argument">,
9252  InGroup<NonNull>;
9253def warn_null_ret : Warning<
9254  "null returned from %select{function|method}0 that requires a non-null return value">,
9255  InGroup<NonNull>;
9256
9257def err_lifetimebound_no_object_param : Error<
9258  "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
9259  "function has no implicit object parameter">;
9260def err_lifetimebound_ctor_dtor : Error<
9261  "'lifetimebound' attribute cannot be applied to a "
9262  "%select{constructor|destructor}0">;
9263
9264// CHECK: returning address/reference of stack memory
9265def warn_ret_stack_addr_ref : Warning<
9266  "%select{address of|reference to}0 stack memory associated with "
9267  "%select{local variable|parameter}2 %1 returned">,
9268  InGroup<ReturnStackAddress>;
9269def warn_ret_local_temp_addr_ref : Warning<
9270  "returning %select{address of|reference to}0 local temporary object">,
9271  InGroup<ReturnStackAddress>;
9272def warn_ret_addr_label : Warning<
9273  "returning address of label, which is local">,
9274  InGroup<ReturnStackAddress>;
9275def err_ret_local_block : Error<
9276  "returning block that lives on the local stack">;
9277def note_local_var_initializer : Note<
9278  "%select{via initialization of|binding reference}0 variable "
9279  "%select{%2 |}1here">;
9280def note_lambda_capture_initializer : Note<
9281  "%select{implicitly |}2captured%select{| by reference}3"
9282  "%select{%select{ due to use|}2 here|"
9283  " via initialization of lambda capture %0}1">;
9284def note_init_with_default_member_initalizer : Note<
9285  "initializing field %0 with default member initializer">;
9286
9287// Check for initializing a member variable with the address or a reference to
9288// a constructor parameter.
9289def warn_bind_ref_member_to_parameter : Warning<
9290  "binding reference member %0 to stack allocated "
9291  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9292def warn_init_ptr_member_to_parameter_addr : Warning<
9293  "initializing pointer member %0 with the stack address of "
9294  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9295def note_ref_or_ptr_member_declared_here : Note<
9296  "%select{reference|pointer}0 member declared here">;
9297
9298def err_dangling_member : Error<
9299  "%select{reference|backing array for 'std::initializer_list'}2 "
9300  "%select{|subobject of }1member %0 "
9301  "%select{binds to|is}2 a temporary object "
9302  "whose lifetime would be shorter than the lifetime of "
9303  "the constructed object">;
9304def warn_dangling_member : Warning<
9305  "%select{reference|backing array for 'std::initializer_list'}2 "
9306  "%select{|subobject of }1member %0 "
9307  "%select{binds to|is}2 a temporary object "
9308  "whose lifetime is shorter than the lifetime of the constructed object">,
9309  InGroup<DanglingField>;
9310def warn_dangling_lifetime_pointer_member : Warning<
9311  "initializing pointer member %0 to point to a temporary object "
9312  "whose lifetime is shorter than the lifetime of the constructed object">,
9313  InGroup<DanglingGsl>;
9314def note_lifetime_extending_member_declared_here : Note<
9315  "%select{%select{reference|'std::initializer_list'}0 member|"
9316  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
9317  "declared here">;
9318def warn_dangling_variable : Warning<
9319  "%select{temporary %select{whose address is used as value of|"
9320  "%select{|implicitly }2bound to}4 "
9321  "%select{%select{|reference }4member of local variable|"
9322  "local %select{variable|reference}4}1|"
9323  "array backing "
9324  "%select{initializer list subobject of local variable|"
9325  "local initializer list}1}0 "
9326  "%select{%3 |}2will be destroyed at the end of the full-expression">,
9327  InGroup<Dangling>;
9328def warn_new_dangling_reference : Warning<
9329  "temporary bound to reference member of allocated object "
9330  "will be destroyed at the end of the full-expression">,
9331  InGroup<DanglingField>;
9332def warn_dangling_lifetime_pointer : Warning<
9333  "object backing the pointer "
9334  "will be destroyed at the end of the full-expression">,
9335  InGroup<DanglingGsl>;
9336def warn_new_dangling_initializer_list : Warning<
9337  "array backing "
9338  "%select{initializer list subobject of the allocated object|"
9339  "the allocated initializer list}0 "
9340  "will be destroyed at the end of the full-expression">,
9341  InGroup<DanglingInitializerList>;
9342def warn_unsupported_lifetime_extension : Warning<
9343  "sorry, lifetime extension of "
9344  "%select{temporary|backing array of initializer list}0 created "
9345  "by aggregate initialization using default member initializer "
9346  "is not supported; lifetime of %select{temporary|backing array}0 "
9347  "will end at the end of the full-expression">, InGroup<Dangling>;
9348
9349// For non-floating point, expressions of the form x == x or x != x
9350// should result in a warning, since these always evaluate to a constant.
9351// Array comparisons have similar warnings
9352def warn_comparison_always : Warning<
9353  "%select{self-|array }0comparison always evaluates to "
9354  "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9355  InGroup<TautologicalCompare>;
9356def warn_comparison_bitwise_always : Warning<
9357  "bitwise comparison always evaluates to %select{false|true}0">,
9358  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9359def warn_comparison_bitwise_or : Warning<
9360  "bitwise or with non-zero value always evaluates to true">,
9361  InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9362def warn_tautological_overlap_comparison : Warning<
9363  "overlapping comparisons always evaluate to %select{false|true}0">,
9364  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9365def warn_depr_array_comparison : Warning<
9366  "comparison between two arrays is deprecated; "
9367  "to compare array addresses, use unary '+' to decay operands to pointers">,
9368  InGroup<DeprecatedArrayCompare>;
9369
9370def warn_stringcompare : Warning<
9371  "result of comparison against %select{a string literal|@encode}0 is "
9372  "unspecified (use an explicit string comparison function instead)">,
9373  InGroup<StringCompare>;
9374
9375def warn_identity_field_assign : Warning<
9376  "assigning %select{field|instance variable}0 to itself">,
9377  InGroup<SelfAssignmentField>;
9378
9379// Type safety attributes
9380def err_type_tag_for_datatype_not_ice : Error<
9381  "'type_tag_for_datatype' attribute requires the initializer to be "
9382  "an %select{integer|integral}0 constant expression">;
9383def err_type_tag_for_datatype_too_large : Error<
9384  "'type_tag_for_datatype' attribute requires the initializer to be "
9385  "an %select{integer|integral}0 constant expression "
9386  "that can be represented by a 64 bit integer">;
9387def err_tag_index_out_of_range : Error<
9388  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
9389def warn_type_tag_for_datatype_wrong_kind : Warning<
9390  "this type tag was not designed to be used with this function">,
9391  InGroup<TypeSafety>;
9392def warn_type_safety_type_mismatch : Warning<
9393  "argument type %0 doesn't match specified %1 type tag "
9394  "%select{that requires %3|}2">, InGroup<TypeSafety>;
9395def warn_type_safety_null_pointer_required : Warning<
9396  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
9397
9398// Generic selections.
9399def err_assoc_type_incomplete : Error<
9400  "type %0 in generic association incomplete">;
9401def err_assoc_type_nonobject : Error<
9402  "type %0 in generic association not an object type">;
9403def err_assoc_type_variably_modified : Error<
9404  "type %0 in generic association is a variably modified type">;
9405def err_assoc_compatible_types : Error<
9406  "type %0 in generic association compatible with previously specified type %1">;
9407def note_compat_assoc : Note<
9408  "compatible type %0 specified here">;
9409def err_generic_sel_no_match : Error<
9410  "controlling expression type %0 not compatible with any generic association type">;
9411def err_generic_sel_multi_match : Error<
9412  "controlling expression type %0 compatible with %1 generic association types">;
9413
9414
9415// Blocks
9416def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
9417  " or %select{pick a deployment target that supports them|for OpenCL 2.0}0">;
9418def err_block_returning_array_function : Error<
9419  "block cannot return %select{array|function}0 type %1">;
9420
9421// Builtin annotation
9422def err_builtin_annotation_first_arg : Error<
9423  "first argument to __builtin_annotation must be an integer">;
9424def err_builtin_annotation_second_arg : Error<
9425  "second argument to __builtin_annotation must be a non-wide string constant">;
9426def err_msvc_annotation_wide_str : Error<
9427  "arguments to __annotation must be wide string constants">;
9428
9429// CFString checking
9430def err_cfstring_literal_not_string_constant : Error<
9431  "CFString literal is not a string constant">;
9432def warn_cfstring_truncated : Warning<
9433  "input conversion stopped due to an input byte that does not "
9434  "belong to the input codeset UTF-8">,
9435  InGroup<DiagGroup<"CFString-literal">>;
9436
9437// os_log checking
9438// TODO: separate diagnostic for os_trace()
9439def err_os_log_format_not_string_constant : Error<
9440  "os_log() format argument is not a string constant">;
9441def err_os_log_argument_too_big : Error<
9442  "os_log() argument %0 is too big (%1 bytes, max %2)">;
9443def warn_os_log_format_narg : Error<
9444 "os_log() '%%n' format specifier is not allowed">, DefaultError;
9445
9446// Statements.
9447def err_continue_not_in_loop : Error<
9448  "'continue' statement not in loop statement">;
9449def err_break_not_in_loop_or_switch : Error<
9450  "'break' statement not in loop or switch statement">;
9451def warn_loop_ctrl_binds_to_inner : Warning<
9452  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
9453  InGroup<GccCompat>;
9454def warn_break_binds_to_switch : Warning<
9455  "'break' is bound to loop, GCC binds it to switch">,
9456  InGroup<GccCompat>;
9457def err_default_not_in_switch : Error<
9458  "'default' statement not in switch statement">;
9459def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
9460def warn_bool_switch_condition : Warning<
9461  "switch condition has boolean value">, InGroup<SwitchBool>;
9462def warn_case_value_overflow : Warning<
9463  "overflow converting case value to switch condition type (%0 to %1)">,
9464  InGroup<Switch>;
9465def err_duplicate_case : Error<"duplicate case value '%0'">;
9466def err_duplicate_case_differing_expr : Error<
9467  "duplicate case value: '%0' and '%1' both equal '%2'">;
9468def warn_case_empty_range : Warning<"empty case range specified">;
9469def warn_missing_case_for_condition :
9470  Warning<"no case matching constant switch condition '%0'">;
9471
9472def warn_def_missing_case : Warning<"%plural{"
9473  "1:enumeration value %1 not explicitly handled in switch|"
9474  "2:enumeration values %1 and %2 not explicitly handled in switch|"
9475  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
9476  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
9477  InGroup<SwitchEnum>, DefaultIgnore;
9478
9479def warn_missing_case : Warning<"%plural{"
9480  "1:enumeration value %1 not handled in switch|"
9481  "2:enumeration values %1 and %2 not handled in switch|"
9482  "3:enumeration values %1, %2, and %3 not handled in switch|"
9483  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
9484  InGroup<Switch>;
9485
9486def warn_unannotated_fallthrough : Warning<
9487  "unannotated fall-through between switch labels">,
9488  InGroup<ImplicitFallthrough>, DefaultIgnore;
9489def warn_unannotated_fallthrough_per_function : Warning<
9490  "unannotated fall-through between switch labels in partly-annotated "
9491  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
9492def note_insert_fallthrough_fixit : Note<
9493  "insert '%0;' to silence this warning">;
9494def note_insert_break_fixit : Note<
9495  "insert 'break;' to avoid fall-through">;
9496def err_fallthrough_attr_wrong_target : Error<
9497  "%0 attribute is only allowed on empty statements">;
9498def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
9499def err_fallthrough_attr_outside_switch : Error<
9500  "fallthrough annotation is outside switch statement">;
9501def err_fallthrough_attr_invalid_placement : Error<
9502  "fallthrough annotation does not directly precede switch label">;
9503def warn_fallthrough_attr_unreachable : Warning<
9504  "fallthrough annotation in unreachable code">,
9505  InGroup<ImplicitFallthrough>, DefaultIgnore;
9506
9507def warn_unreachable_default : Warning<
9508  "default label in switch which covers all enumeration values">,
9509  InGroup<CoveredSwitchDefault>, DefaultIgnore;
9510def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
9511  InGroup<Switch>;
9512def warn_not_in_enum_assignment : Warning<"integer constant not in range "
9513  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
9514def err_typecheck_statement_requires_scalar : Error<
9515  "statement requires expression of scalar type (%0 invalid)">;
9516def err_typecheck_statement_requires_integer : Error<
9517  "statement requires expression of integer type (%0 invalid)">;
9518def err_multiple_default_labels_defined : Error<
9519  "multiple default labels in one switch">;
9520def err_switch_multiple_conversions : Error<
9521  "multiple conversions from switch condition type %0 to an integral or "
9522  "enumeration type">;
9523def note_switch_conversion : Note<
9524  "conversion to %select{integral|enumeration}0 type %1">;
9525def err_switch_explicit_conversion : Error<
9526  "switch condition type %0 requires explicit conversion to %1">;
9527def err_switch_incomplete_class_type : Error<
9528  "switch condition has incomplete class type %0">;
9529
9530def warn_empty_if_body : Warning<
9531  "if statement has empty body">, InGroup<EmptyBody>;
9532def warn_empty_for_body : Warning<
9533  "for loop has empty body">, InGroup<EmptyBody>;
9534def warn_empty_range_based_for_body : Warning<
9535  "range-based for loop has empty body">, InGroup<EmptyBody>;
9536def warn_empty_while_body : Warning<
9537  "while loop has empty body">, InGroup<EmptyBody>;
9538def warn_empty_switch_body : Warning<
9539  "switch statement has empty body">, InGroup<EmptyBody>;
9540def note_empty_body_on_separate_line : Note<
9541  "put the semicolon on a separate line to silence this warning">;
9542
9543def err_va_start_captured_stmt : Error<
9544  "'va_start' cannot be used in a captured statement">;
9545def err_va_start_outside_function : Error<
9546  "'va_start' cannot be used outside a function">;
9547def err_va_start_fixed_function : Error<
9548  "'va_start' used in function with fixed args">;
9549def err_va_start_used_in_wrong_abi_function : Error<
9550  "'va_start' used in %select{System V|Win64}0 ABI function">;
9551def err_ms_va_start_used_in_sysv_function : Error<
9552  "'__builtin_ms_va_start' used in System V ABI function">;
9553def warn_second_arg_of_va_start_not_last_named_param : Warning<
9554  "second argument to 'va_start' is not the last named parameter">,
9555  InGroup<Varargs>;
9556def warn_va_start_type_is_undefined : Warning<
9557  "passing %select{an object that undergoes default argument promotion|"
9558  "an object of reference type|a parameter declared with the 'register' "
9559  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
9560def err_first_argument_to_va_arg_not_of_type_va_list : Error<
9561  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
9562def err_second_parameter_to_va_arg_incomplete: Error<
9563  "second argument to 'va_arg' is of incomplete type %0">;
9564def err_second_parameter_to_va_arg_abstract: Error<
9565  "second argument to 'va_arg' is of abstract type %0">;
9566def warn_second_parameter_to_va_arg_not_pod : Warning<
9567  "second argument to 'va_arg' is of non-POD type %0">,
9568  InGroup<NonPODVarargs>, DefaultError;
9569def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
9570  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
9571  InGroup<NonPODVarargs>, DefaultError;
9572def warn_second_parameter_to_va_arg_never_compatible : Warning<
9573  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
9574  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
9575
9576def warn_return_missing_expr : Warning<
9577  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9578  InGroup<ReturnType>;
9579def ext_return_missing_expr : ExtWarn<
9580  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9581  InGroup<ReturnType>;
9582def ext_return_has_expr : ExtWarn<
9583  "%select{void function|void method|constructor|destructor}1 %0 "
9584  "should not return a value">,
9585  DefaultError, InGroup<ReturnType>;
9586def ext_return_has_void_expr : Extension<
9587  "void %select{function|method|block}1 %0 should not return void expression">;
9588def err_return_init_list : Error<
9589  "%select{void function|void method|constructor|destructor}1 %0 "
9590  "must not return a value">;
9591def err_ctor_dtor_returns_void : Error<
9592  "%select{constructor|destructor}1 %0 must not return void expression">;
9593def warn_noreturn_function_has_return_expr : Warning<
9594  "function %0 declared 'noreturn' should not return">,
9595  InGroup<InvalidNoreturn>;
9596def warn_falloff_noreturn_function : Warning<
9597  "function declared 'noreturn' should not return">,
9598  InGroup<InvalidNoreturn>;
9599def err_noreturn_block_has_return_expr : Error<
9600  "block declared 'noreturn' should not return">;
9601def err_noreturn_missing_on_first_decl : Error<
9602  "function declared '[[noreturn]]' after its first declaration">;
9603def note_noreturn_missing_first_decl : Note<
9604  "declaration missing '[[noreturn]]' attribute is here">;
9605def err_carries_dependency_missing_on_first_decl : Error<
9606  "%select{function|parameter}0 declared '[[carries_dependency]]' "
9607  "after its first declaration">;
9608def note_carries_dependency_missing_first_decl : Note<
9609  "declaration missing '[[carries_dependency]]' attribute is here">;
9610def err_carries_dependency_param_not_function_decl : Error<
9611  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
9612  "declaration or lambda">;
9613def err_block_on_nonlocal : Error<
9614  "__block attribute not allowed, only allowed on local variables">;
9615def err_block_on_vm : Error<
9616  "__block attribute not allowed on declaration with a variably modified type">;
9617def err_sizeless_nonlocal : Error<
9618  "non-local variable with sizeless type %0">;
9619
9620def err_vec_builtin_non_vector : Error<
9621 "first two arguments to %0 must be vectors">;
9622def err_vec_builtin_incompatible_vector : Error<
9623  "first two arguments to %0 must have the same type">;
9624def err_vsx_builtin_nonconstant_argument : Error<
9625  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
9626
9627def err_shufflevector_nonconstant_argument : Error<
9628  "index for __builtin_shufflevector must be a constant integer">;
9629def err_shufflevector_argument_too_large : Error<
9630  "index for __builtin_shufflevector must be less than the total number "
9631  "of vector elements">;
9632
9633def err_convertvector_non_vector : Error<
9634  "first argument to __builtin_convertvector must be a vector">;
9635def err_convertvector_non_vector_type : Error<
9636  "second argument to __builtin_convertvector must be a vector type">;
9637def err_convertvector_incompatible_vector : Error<
9638  "first two arguments to __builtin_convertvector must have the same number of elements">;
9639
9640def err_first_argument_to_cwsc_not_call : Error<
9641  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
9642def err_first_argument_to_cwsc_block_call : Error<
9643  "first argument to __builtin_call_with_static_chain must not be a block call">;
9644def err_first_argument_to_cwsc_builtin_call : Error<
9645  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
9646def err_first_argument_to_cwsc_pdtor_call : Error<
9647  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
9648def err_second_argument_to_cwsc_not_pointer : Error<
9649  "second argument to __builtin_call_with_static_chain must be of pointer type">;
9650
9651def err_vector_incorrect_num_initializers : Error<
9652  "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
9653def err_altivec_empty_initializer : Error<"expected initializer">;
9654
9655def err_invalid_neon_type_code : Error<
9656  "incompatible constant for this __builtin_neon function">;
9657def err_argument_invalid_range : Error<
9658  "argument value %0 is outside the valid range [%1, %2]">;
9659def warn_argument_invalid_range : Warning<
9660  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
9661  InGroup<DiagGroup<"argument-outside-range">>;
9662def err_argument_not_multiple : Error<
9663  "argument should be a multiple of %0">;
9664def err_argument_not_power_of_2 : Error<
9665  "argument should be a power of 2">;
9666def err_argument_not_shifted_byte : Error<
9667  "argument should be an 8-bit value shifted by a multiple of 8 bits">;
9668def err_argument_not_shifted_byte_or_xxff : Error<
9669  "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
9670def err_rotation_argument_to_cadd
9671    : Error<"argument should be the value 90 or 270">;
9672def err_rotation_argument_to_cmla
9673    : Error<"argument should be the value 0, 90, 180 or 270">;
9674def warn_neon_vector_initializer_non_portable : Warning<
9675  "vector initializers are not compatible with NEON intrinsics in big endian "
9676  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
9677def note_neon_vector_initializer_non_portable : Note<
9678  "consider using vld1_%0%1() to initialize a vector from memory, or "
9679  "vcreate_%0%1() to initialize from an integer constant">;
9680def note_neon_vector_initializer_non_portable_q : Note<
9681  "consider using vld1q_%0%1() to initialize a vector from memory, or "
9682  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
9683  "constants">;
9684def err_systemz_invalid_tabort_code : Error<
9685  "invalid transaction abort code">;
9686def err_64_bit_builtin_32_bit_tgt : Error<
9687  "this builtin is only available on 64-bit targets">;
9688def err_32_bit_builtin_64_bit_tgt : Error<
9689  "this builtin is only available on 32-bit targets">;
9690def err_builtin_x64_aarch64_only : Error<
9691  "this builtin is only available on x86-64 and aarch64 targets">;
9692def err_mips_builtin_requires_dsp : Error<
9693  "this builtin requires 'dsp' ASE, please use -mdsp">;
9694def err_mips_builtin_requires_dspr2 : Error<
9695  "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
9696def err_mips_builtin_requires_msa : Error<
9697  "this builtin requires 'msa' ASE, please use -mmsa">;
9698def err_ppc_builtin_only_on_pwr7 : Error<
9699  "this builtin is only valid on POWER7 or later CPUs">;
9700def err_ppc_invalid_use_mma_type : Error<
9701  "invalid use of PPC MMA type">;
9702def err_x86_builtin_invalid_rounding : Error<
9703  "invalid rounding argument">;
9704def err_x86_builtin_invalid_scale : Error<
9705  "scale argument must be 1, 2, 4, or 8">;
9706def err_x86_builtin_tile_arg_duplicate : Error<
9707  "tile arguments must refer to different tiles">;
9708
9709def err_builtin_target_unsupported : Error<
9710  "builtin is not supported on this target">;
9711def err_builtin_longjmp_unsupported : Error<
9712  "__builtin_longjmp is not supported for the current target">;
9713def err_builtin_setjmp_unsupported : Error<
9714  "__builtin_setjmp is not supported for the current target">;
9715
9716def err_builtin_longjmp_invalid_val : Error<
9717  "argument to __builtin_longjmp must be a constant 1">;
9718def err_builtin_requires_language : Error<"'%0' is only available in %1">;
9719
9720def err_constant_integer_arg_type : Error<
9721  "argument to %0 must be a constant integer">;
9722
9723def ext_mixed_decls_code : Extension<
9724  "ISO C90 forbids mixing declarations and code">,
9725  InGroup<DiagGroup<"declaration-after-statement">>;
9726
9727def err_non_local_variable_decl_in_for : Error<
9728  "declaration of non-local variable in 'for' loop">;
9729def err_non_variable_decl_in_for : Error<
9730  "non-variable declaration in 'for' loop">;
9731def err_toomany_element_decls : Error<
9732  "only one element declaration is allowed">;
9733def err_selector_element_not_lvalue : Error<
9734  "selector element is not a valid lvalue">;
9735def err_selector_element_type : Error<
9736  "selector element type %0 is not a valid object">;
9737def err_selector_element_const_type : Error<
9738  "selector element of type %0 cannot be a constant lvalue expression">;
9739def err_collection_expr_type : Error<
9740  "the type %0 is not a pointer to a fast-enumerable object">;
9741def warn_collection_expr_type : Warning<
9742  "collection expression type %0 may not respond to %1">;
9743
9744def err_invalid_conversion_between_ext_vectors : Error<
9745  "invalid conversion between ext-vector type %0 and %1">;
9746
9747def warn_duplicate_attribute_exact : Warning<
9748  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
9749
9750def warn_duplicate_attribute : Warning<
9751  "attribute %0 is already applied with different arguments">,
9752  InGroup<IgnoredAttributes>;
9753
9754def warn_sync_fetch_and_nand_semantics_change : Warning<
9755  "the semantics of this intrinsic changed with GCC "
9756  "version 4.4 - the newer semantics are provided here">,
9757  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
9758
9759// Type
9760def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
9761  InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
9762def warn_receiver_forward_class : Warning<
9763  "receiver %0 is a forward class and corresponding @interface may not exist">,
9764  InGroup<ForwardClassReceiver>;
9765def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
9766def ext_missing_declspec : ExtWarn<
9767  "declaration specifier missing, defaulting to 'int'">;
9768def ext_missing_type_specifier : ExtWarn<
9769  "type specifier missing, defaults to 'int'">,
9770  InGroup<ImplicitInt>;
9771def err_decimal_unsupported : Error<
9772  "GNU decimal type extension not supported">;
9773def err_missing_type_specifier : Error<
9774  "C++ requires a type specifier for all declarations">;
9775def err_objc_array_of_interfaces : Error<
9776  "array of interface %0 is invalid (probably should be an array of pointers)">;
9777def ext_c99_array_usage : Extension<
9778  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9779  "feature">, InGroup<C99>;
9780def err_c99_array_usage_cxx : Error<
9781  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9782  "feature, not permitted in C++">;
9783def err_type_unsupported : Error<
9784  "%0 is not supported on this target">;
9785def err_nsconsumed_attribute_mismatch : Error<
9786  "overriding method has mismatched ns_consumed attribute on its"
9787  " parameter">;
9788def err_nsreturns_retained_attribute_mismatch : Error<
9789  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
9790  " attributes">;
9791def err_nserrordomain_invalid_decl : Error<
9792  "domain argument %select{|%1 }0does not refer to global constant">;
9793def err_nserrordomain_wrong_type : Error<
9794  "domain argument %0 does not point to an NSString or CFString constant">;
9795
9796def warn_nsconsumed_attribute_mismatch : Warning<
9797  err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
9798def warn_nsreturns_retained_attribute_mismatch : Warning<
9799  err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
9800
9801def note_getter_unavailable : Note<
9802  "or because setter is declared here, but no getter method %0 is found">;
9803def err_invalid_protocol_qualifiers : Error<
9804  "invalid protocol qualifiers on non-ObjC type">;
9805def warn_ivar_use_hidden : Warning<
9806  "local declaration of %0 hides instance variable">,
9807   InGroup<ShadowIvar>;
9808def warn_direct_initialize_call : Warning<
9809  "explicit call to +initialize results in duplicate call to +initialize">,
9810   InGroup<ExplicitInitializeCall>;
9811def warn_direct_super_initialize_call : Warning<
9812  "explicit call to [super initialize] should only be in implementation "
9813  "of +initialize">,
9814   InGroup<ExplicitInitializeCall>;
9815def err_ivar_use_in_class_method : Error<
9816  "instance variable %0 accessed in class method">;
9817def err_private_ivar_access : Error<"instance variable %0 is private">,
9818  AccessControl;
9819def err_protected_ivar_access : Error<"instance variable %0 is protected">,
9820  AccessControl;
9821def warn_maynot_respond : Warning<"%0 may not respond to %1">;
9822def ext_typecheck_base_super : Warning<
9823  "method parameter type "
9824  "%diff{$ does not match super class method parameter type $|"
9825  "does not match super class method parameter type}0,1">,
9826   InGroup<SuperSubClassMismatch>, DefaultIgnore;
9827def warn_missing_method_return_type : Warning<
9828  "method has no return type specified; defaults to 'id'">,
9829  InGroup<MissingMethodReturnType>, DefaultIgnore;
9830def warn_direct_ivar_access : Warning<"instance variable %0 is being "
9831  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
9832
9833// Spell-checking diagnostics
9834def err_unknown_typename : Error<
9835  "unknown type name %0">;
9836def err_unknown_type_or_class_name_suggest : Error<
9837  "unknown %select{type|class}1 name %0; did you mean %2?">;
9838def err_unknown_typename_suggest : Error<
9839  "unknown type name %0; did you mean %1?">;
9840def err_unknown_nested_typename_suggest : Error<
9841  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
9842def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
9843def err_undeclared_use_suggest : Error<
9844  "use of undeclared %0; did you mean %1?">;
9845def err_undeclared_var_use_suggest : Error<
9846  "use of undeclared identifier %0; did you mean %1?">;
9847def err_no_template : Error<"no template named %0">;
9848def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
9849def err_no_member_template : Error<"no template named %0 in %1">;
9850def err_no_member_template_suggest : Error<
9851  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
9852def err_non_template_in_template_id : Error<
9853  "%0 does not name a template but is followed by template arguments">;
9854def err_non_template_in_template_id_suggest : Error<
9855  "%0 does not name a template but is followed by template arguments; "
9856  "did you mean %1?">;
9857def err_non_template_in_member_template_id_suggest : Error<
9858  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
9859def note_non_template_in_template_id_found : Note<
9860  "non-template declaration found by name lookup">;
9861def err_mem_init_not_member_or_class_suggest : Error<
9862  "initializer %0 does not name a non-static data member or base "
9863  "class; did you mean the %select{base class|member}1 %2?">;
9864def err_field_designator_unknown_suggest : Error<
9865  "field designator %0 does not refer to any field in type %1; did you mean "
9866  "%2?">;
9867def err_typecheck_member_reference_ivar_suggest : Error<
9868  "%0 does not have a member named %1; did you mean %2?">;
9869def err_property_not_found_suggest : Error<
9870  "property %0 not found on object of type %1; did you mean %2?">;
9871def err_class_property_found : Error<
9872  "property %0 is a class property; did you mean to access it with class '%1'?">;
9873def err_ivar_access_using_property_syntax_suggest : Error<
9874  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
9875def warn_property_access_suggest : Warning<
9876"property %0 not found on object of type %1; did you mean to access property %2?">,
9877InGroup<PropertyAccessDotSyntax>;
9878def err_property_found_suggest : Error<
9879  "property %0 found on object of type %1; did you mean to access "
9880  "it with the \".\" operator?">;
9881def err_undef_interface_suggest : Error<
9882  "cannot find interface declaration for %0; did you mean %1?">;
9883def warn_undef_interface_suggest : Warning<
9884  "cannot find interface declaration for %0; did you mean %1?">;
9885def err_undef_superclass_suggest : Error<
9886  "cannot find interface declaration for %0, superclass of %1; did you mean "
9887  "%2?">;
9888def err_undeclared_protocol_suggest : Error<
9889  "cannot find protocol declaration for %0; did you mean %1?">;
9890def note_base_class_specified_here : Note<
9891  "base class %0 specified here">;
9892def err_using_directive_suggest : Error<
9893  "no namespace named %0; did you mean %1?">;
9894def err_using_directive_member_suggest : Error<
9895  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
9896def note_namespace_defined_here : Note<"namespace %0 defined here">;
9897def err_sizeof_pack_no_pack_name_suggest : Error<
9898  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
9899def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
9900
9901def err_uncasted_use_of_unknown_any : Error<
9902  "%0 has unknown type; cast it to its declared type to use it">;
9903def err_uncasted_call_of_unknown_any : Error<
9904  "%0 has unknown return type; cast the call to its declared return type">;
9905def err_uncasted_send_to_unknown_any_method : Error<
9906  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
9907  "message send to the method's return type">;
9908def err_unsupported_unknown_any_decl : Error<
9909  "%0 has unknown type, which is not supported for this kind of declaration">;
9910def err_unsupported_unknown_any_expr : Error<
9911  "unsupported expression with unknown type">;
9912def err_unsupported_unknown_any_call : Error<
9913  "call to unsupported expression with unknown type">;
9914def err_unknown_any_addrof : Error<
9915  "the address of a declaration with unknown type "
9916  "can only be cast to a pointer type">;
9917def err_unknown_any_addrof_call : Error<
9918  "address-of operator cannot be applied to a call to a function with "
9919  "unknown return type">;
9920def err_unknown_any_var_function_type : Error<
9921  "variable %0 with unknown type cannot be given a function type">;
9922def err_unknown_any_function : Error<
9923  "function %0 with unknown type must be given a function type">;
9924
9925def err_filter_expression_integral : Error<
9926  "filter expression has non-integral type %0">;
9927
9928def err_non_asm_stmt_in_naked_function : Error<
9929  "non-ASM statement in naked function is not supported">;
9930def err_asm_naked_this_ref : Error<
9931  "'this' pointer references not allowed in naked functions">;
9932def err_asm_naked_parm_ref : Error<
9933  "parameter references not allowed in naked functions">;
9934
9935// OpenCL warnings and errors.
9936def err_invalid_astype_of_different_size : Error<
9937  "invalid reinterpretation: sizes of %0 and %1 must match">;
9938def err_static_kernel : Error<
9939  "kernel functions cannot be declared static">;
9940def err_method_kernel : Error<
9941  "kernel functions cannot be class members">;
9942def err_template_kernel : Error<
9943  "kernel functions cannot be used in a template declaration, instantiation or specialization">;
9944def err_opencl_ptrptr_kernel_param : Error<
9945  "kernel parameter cannot be declared as a pointer to a pointer">;
9946def err_kernel_arg_address_space : Error<
9947  "pointer arguments to kernel functions must reside in '__global', "
9948  "'__constant' or '__local' address space">;
9949def err_opencl_ext_vector_component_invalid_length : Error<
9950  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
9951def err_opencl_function_variable : Error<
9952  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
9953def err_opencl_addrspace_scope : Error<
9954  "variables in the %0 address space can only be declared in the outermost "
9955  "scope of a kernel function">;
9956def err_static_function_scope : Error<
9957  "variables in function scope cannot be declared static">;
9958def err_opencl_bitfields : Error<
9959  "bit-fields are not supported in OpenCL">;
9960def err_opencl_vla : Error<
9961  "variable length arrays are not supported in OpenCL">;
9962def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
9963    "scalar operand type has greater rank than the type of the vector "
9964    "element. (%0 and %1)">;
9965def err_bad_kernel_param_type : Error<
9966  "%0 cannot be used as the type of a kernel parameter">;
9967def err_opencl_implicit_function_decl : Error<
9968  "implicit declaration of function %0 is invalid in OpenCL">;
9969def err_record_with_pointers_kernel_param : Error<
9970  "%select{struct|union}0 kernel parameters may not contain pointers">;
9971def note_within_field_of_type : Note<
9972  "within field of type %0 declared here">;
9973def note_illegal_field_declared_here : Note<
9974  "field of illegal %select{type|pointer type}0 %1 declared here">;
9975def err_opencl_type_struct_or_union_field : Error<
9976  "the %0 type cannot be used to declare a structure or union field">;
9977def err_event_t_addr_space_qual : Error<
9978  "the event_t type can only be used with __private address space qualifier">;
9979def err_expected_kernel_void_return_type : Error<
9980  "kernel must have void return type">;
9981def err_sampler_initializer_not_integer : Error<
9982  "sampler_t initialization requires 32-bit integer, not %0">;
9983def warn_sampler_initializer_invalid_bits : Warning<
9984  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
9985def err_sampler_argument_required : Error<
9986  "sampler_t variable required - got %0">;
9987def err_wrong_sampler_addressspace: Error<
9988  "sampler type cannot be used with the __local and __global address space qualifiers">;
9989def err_opencl_nonconst_global_sampler : Error<
9990  "global sampler requires a const or constant address space qualifier">;
9991def err_opencl_cast_non_zero_to_event_t : Error<
9992  "cannot cast non-zero value '%0' to 'event_t'">;
9993def err_opencl_global_invalid_addr_space : Error<
9994  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
9995def err_missing_actual_pipe_type : Error<
9996  "missing actual type specifier for pipe">;
9997def err_reference_pipe_type : Error <
9998  "pipes packet types cannot be of reference type">;
9999def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
10000def err_opencl_kernel_attr :
10001  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
10002def err_opencl_return_value_with_address_space : Error<
10003  "return value cannot be qualified with address space">;
10004def err_opencl_constant_no_init : Error<
10005  "variable in constant address space must be initialized">;
10006def err_opencl_atomic_init: Error<
10007  "atomic variable can be %select{assigned|initialized}0 to a variable only "
10008  "in global address space">;
10009def err_opencl_implicit_vector_conversion : Error<
10010  "implicit conversions between vector types (%0 and %1) are not permitted">;
10011def err_opencl_invalid_type_array : Error<
10012  "array of %0 type is invalid in OpenCL">;
10013def err_opencl_ternary_with_block : Error<
10014  "block type cannot be used as expression in ternary expression in OpenCL">;
10015def err_opencl_pointer_to_type : Error<
10016  "pointer to type %0 is invalid in OpenCL">;
10017def err_opencl_type_can_only_be_used_as_function_parameter : Error <
10018  "type %0 can only be used as a function parameter in OpenCL">;
10019def err_opencl_type_not_found : Error<
10020  "%0 type %1 not found; include the base header with -finclude-default-header">;
10021def warn_opencl_attr_deprecated_ignored : Warning <
10022  "%0 attribute is deprecated and ignored in OpenCL version %1">,
10023  InGroup<IgnoredAttributes>;
10024def err_opencl_variadic_function : Error<
10025  "invalid prototype, variadic arguments are not allowed in OpenCL">;
10026def err_opencl_requires_extension : Error<
10027  "use of %select{type|declaration}0 %1 requires %2 support">;
10028def ext_opencl_double_without_pragma : Extension<
10029  "Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is"
10030  " supported">;
10031def err_opencl_double_requires_extension :  Error<
10032    "use of type 'double' requires %select{cl_khr_fp64|cl_khr_fp64 and __opencl_c_fp64}0 support">;
10033def warn_opencl_generic_address_space_arg : Warning<
10034  "passing non-generic address space pointer to %0"
10035  " may cause dynamic conversion affecting performance">,
10036  InGroup<Conversion>, DefaultIgnore;
10037
10038// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
10039def err_opencl_builtin_pipe_first_arg : Error<
10040  "first argument to %0 must be a pipe type">;
10041def err_opencl_builtin_pipe_arg_num : Error<
10042  "invalid number of arguments to function: %0">;
10043def err_opencl_builtin_pipe_invalid_arg : Error<
10044  "invalid argument type to function %0 (expecting %1 having %2)">;
10045def err_opencl_builtin_pipe_invalid_access_modifier : Error<
10046  "invalid pipe access modifier (expecting %0)">;
10047
10048// OpenCL access qualifier
10049def err_opencl_invalid_access_qualifier : Error<
10050  "access qualifier can only be used for pipe and image type">;
10051def err_opencl_invalid_read_write : Error<
10052  "access qualifier %0 can not be used for %1 %select{|prior to OpenCL version 2.0}2">;
10053def err_opencl_multiple_access_qualifiers : Error<
10054  "multiple access qualifiers">;
10055def note_opencl_typedef_access_qualifier : Note<
10056  "previously declared '%0' here">;
10057
10058// OpenCL v2.0 s6.12.5 Blocks restrictions
10059def err_opencl_block_storage_type : Error<
10060  "the __block storage type is not permitted">;
10061def err_opencl_invalid_block_declaration : Error<
10062  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
10063def err_opencl_extern_block_declaration : Error<
10064  "invalid block variable declaration - using 'extern' storage class is disallowed">;
10065def err_opencl_block_ref_block : Error<
10066  "cannot refer to a block inside block">;
10067
10068// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
10069def err_opencl_builtin_to_addr_invalid_arg : Error<
10070  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
10071
10072// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
10073def err_opencl_enqueue_kernel_incorrect_args : Error<
10074  "illegal call to enqueue_kernel, incorrect argument types">;
10075def err_opencl_enqueue_kernel_local_size_args : Error<
10076  "mismatch in number of block parameters and local size arguments passed">;
10077def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
10078  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
10079def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
10080  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
10081def err_opencl_enqueue_kernel_blocks_no_args : Error<
10082  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
10083
10084def err_opencl_builtin_expected_type : Error<
10085  "illegal call to %0, expected %1 argument type">;
10086
10087// OpenCL v3.0 s6.3.7 - Vector Components
10088def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
10089  "vector component name '%0' is an OpenCL C version 3.0 feature">,
10090  InGroup<OpenCLUnsupportedRGBA>;
10091
10092def err_openclcxx_placement_new : Error<
10093  "use of placement new requires explicit declaration">;
10094
10095// MIG routine annotations.
10096def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
10097  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
10098  InGroup<IgnoredAttributes>;
10099} // end of sema category
10100
10101let CategoryName = "OpenMP Issue" in {
10102// OpenMP support.
10103def err_omp_expected_var_arg : Error<
10104  "%0 is not a global variable, static local variable or static data member">;
10105def err_omp_expected_var_arg_suggest : Error<
10106  "%0 is not a global variable, static local variable or static data member; "
10107  "did you mean %1">;
10108def err_omp_global_var_arg : Error<
10109  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
10110def err_omp_ref_type_arg : Error<
10111  "arguments of '#pragma omp %0' cannot be of reference type %1">;
10112def err_omp_region_not_file_context : Error<
10113  "directive must be at file or namespace scope">;
10114def err_omp_var_scope : Error<
10115  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
10116def err_omp_var_used : Error<
10117  "'#pragma omp %0' must precede all references to variable %q1">;
10118def err_omp_var_thread_local : Error<
10119  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
10120def err_omp_private_incomplete_type : Error<
10121  "a private variable with incomplete type %0">;
10122def err_omp_firstprivate_incomplete_type : Error<
10123  "a firstprivate variable with incomplete type %0">;
10124def err_omp_lastprivate_incomplete_type : Error<
10125  "a lastprivate variable with incomplete type %0">;
10126def err_omp_reduction_incomplete_type : Error<
10127  "a reduction list item with incomplete type %0">;
10128def err_omp_unexpected_clause_value : Error<
10129  "expected %0 in OpenMP clause '%1'">;
10130def err_omp_expected_var_name_member_expr : Error<
10131  "expected variable name%select{| or data member of current class}0">;
10132def err_omp_expected_var_name_member_expr_or_array_item : Error<
10133  "expected variable name%select{|, data member of current class}0, array element or array section">;
10134def err_omp_expected_addressable_lvalue_or_array_item : Error<
10135  "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">;
10136def err_omp_expected_named_var_member_or_array_expression: Error<
10137  "expected expression containing only member accesses and/or array sections based on named variables">;
10138def err_omp_bit_fields_forbidden_in_clause : Error<
10139  "bit fields cannot be used to specify storage in a '%0' clause">;
10140def err_array_section_does_not_specify_contiguous_storage : Error<
10141  "array section does not specify contiguous storage">;
10142def err_array_section_does_not_specify_length : Error<
10143  "array section does not specify length for outermost dimension">;
10144def err_omp_union_type_not_allowed : Error<
10145  "mapping of union members is not allowed">;
10146def err_omp_expected_access_to_data_field : Error<
10147  "expected access to data field">;
10148def err_omp_multiple_array_items_in_map_clause : Error<
10149  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
10150def err_omp_duplicate_map_type_modifier : Error<
10151  "same map type modifier has been specified more than once">;
10152def err_omp_duplicate_motion_modifier : Error<
10153  "same motion modifier has been specified more than once">;
10154def err_omp_pointer_mapped_along_with_derived_section : Error<
10155  "pointer cannot be mapped along with a section derived from itself">;
10156def err_omp_original_storage_is_shared_and_does_not_contain : Error<
10157  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
10158def err_omp_same_pointer_dereferenced : Error<
10159  "same pointer dereferenced in multiple different ways in map clause expressions">;
10160def note_omp_task_predetermined_firstprivate_here : Note<
10161  "predetermined as a firstprivate in a task construct here">;
10162def err_omp_threadprivate_incomplete_type : Error<
10163  "threadprivate variable with incomplete type %0">;
10164def err_omp_no_dsa_for_variable : Error<
10165  "variable %0 must have explicitly specified data sharing attributes">;
10166def err_omp_defaultmap_no_attr_for_variable : Error<
10167  "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
10168def note_omp_default_dsa_none : Note<
10169  "explicit data sharing attribute requested here">;
10170def note_omp_defaultmap_attr_none : Note<
10171  "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
10172def err_omp_wrong_dsa : Error<
10173  "%0 variable cannot be %1">;
10174def err_omp_variably_modified_type_not_supported : Error<
10175  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
10176def note_omp_explicit_dsa : Note<
10177  "defined as %0">;
10178def note_omp_predetermined_dsa : Note<
10179  "%select{static data member is predetermined as shared|"
10180  "variable with static storage duration is predetermined as shared|"
10181  "loop iteration variable is predetermined as private|"
10182  "loop iteration variable is predetermined as linear|"
10183  "loop iteration variable is predetermined as lastprivate|"
10184  "constant variable is predetermined as shared|"
10185  "global variable is predetermined as shared|"
10186  "non-shared variable in a task construct is predetermined as firstprivate|"
10187  "variable with automatic storage duration is predetermined as private}0"
10188  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
10189def note_omp_implicit_dsa : Note<
10190  "implicitly determined as %0">;
10191def err_omp_loop_var_dsa : Error<
10192  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
10193def err_omp_not_for : Error<
10194  "%select{statement after '#pragma omp %1' must be a for loop|"
10195  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
10196def note_omp_collapse_ordered_expr : Note<
10197  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
10198def err_omp_negative_expression_in_clause : Error<
10199  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
10200def err_omp_not_integral : Error<
10201  "expression must have integral or unscoped enumeration "
10202  "type, not %0">;
10203def err_omp_threadprivate_in_target : Error<
10204  "threadprivate variables cannot be used in target constructs">;
10205def err_omp_incomplete_type : Error<
10206  "expression has incomplete class type %0">;
10207def err_omp_explicit_conversion : Error<
10208  "expression requires explicit conversion from %0 to %1">;
10209def note_omp_conversion_here : Note<
10210  "conversion to %select{integral|enumeration}0 type %1 declared here">;
10211def err_omp_ambiguous_conversion : Error<
10212  "ambiguous conversion from type %0 to an integral or unscoped "
10213  "enumeration type">;
10214def err_omp_iterator_not_integral_or_pointer : Error<
10215  "expected integral or pointer type as the iterator-type, not %0">;
10216def err_omp_iterator_step_not_integral : Error<
10217  "iterator step expression %0 is not the integral expression">;
10218def err_omp_iterator_step_constant_zero : Error<
10219  "iterator step expression %0 evaluates to 0">;
10220def err_omp_required_access : Error<
10221  "%0 variable must be %1">;
10222def err_omp_const_variable : Error<
10223  "const-qualified variable cannot be %0">;
10224def err_omp_const_not_mutable_variable : Error<
10225  "const-qualified variable without mutable fields cannot be %0">;
10226def err_omp_const_list_item : Error<
10227  "const-qualified list item cannot be %0">;
10228def err_omp_linear_incomplete_type : Error<
10229  "a linear variable with incomplete type %0">;
10230def err_omp_linear_expected_int_or_ptr : Error<
10231  "argument of a linear clause should be of integral or pointer "
10232  "type, not %0">;
10233def warn_omp_linear_step_zero : Warning<
10234  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
10235  InGroup<OpenMPClauses>;
10236def warn_omp_alignment_not_power_of_two : Warning<
10237  "aligned clause will be ignored because the requested alignment is not a power of 2">,
10238  InGroup<OpenMPClauses>;
10239def err_omp_invalid_target_decl : Error<
10240  "%0 used in declare target directive is not a variable or a function name">;
10241def err_omp_declare_target_to_and_link : Error<
10242  "%0 must not appear in both clauses 'to' and 'link'">;
10243def warn_omp_not_in_target_context : Warning<
10244  "declaration is not declared in any declare target region">,
10245  InGroup<OpenMPTarget>;
10246def err_omp_function_in_link_clause : Error<
10247  "function name is not allowed in 'link' clause">;
10248def err_omp_aligned_expected_array_or_ptr : Error<
10249  "argument of aligned clause should be array"
10250  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
10251  ", not %0">;
10252def err_omp_used_in_clause_twice : Error<
10253  "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
10254def err_omp_local_var_in_threadprivate_init : Error<
10255  "variable with local storage in initial value of threadprivate variable">;
10256def err_omp_loop_not_canonical_init : Error<
10257  "initialization clause of OpenMP for loop is not in canonical form "
10258  "('var = init' or 'T var = init')">;
10259def ext_omp_loop_not_canonical_init : ExtWarn<
10260  "initialization clause of OpenMP for loop is not in canonical form "
10261  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
10262def err_omp_loop_not_canonical_cond : Error<
10263  "condition of OpenMP for loop must be a relational comparison "
10264  "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
10265def err_omp_loop_not_canonical_incr : Error<
10266  "increment clause of OpenMP for loop must perform simple addition "
10267  "or subtraction on loop variable %0">;
10268def err_omp_loop_variable_type : Error<
10269  "variable must be of integer or %select{pointer|random access iterator}0 type">;
10270def err_omp_loop_incr_not_compatible : Error<
10271  "increment expression must cause %0 to %select{decrease|increase}1 "
10272  "on each iteration of OpenMP for loop">;
10273def note_omp_loop_cond_requres_compatible_incr : Note<
10274  "loop step is expected to be %select{negative|positive}0 due to this condition">;
10275def err_omp_loop_diff_cxx : Error<
10276  "could not calculate number of iterations calling 'operator-' with "
10277  "upper and lower loop bounds">;
10278def err_omp_loop_cannot_use_stmt : Error<
10279  "'%0' statement cannot be used in OpenMP for loop">;
10280def err_omp_simd_region_cannot_use_stmt : Error<
10281  "'%0' statement cannot be used in OpenMP simd region">;
10282def warn_omp_loop_64_bit_var : Warning<
10283  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
10284  InGroup<OpenMPLoopForm>;
10285def err_omp_unknown_reduction_identifier : Error<
10286  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
10287  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10288def err_omp_not_resolved_reduction_identifier : Error<
10289  "unable to resolve declare reduction construct for type %0">;
10290def err_omp_reduction_ref_type_arg : Error<
10291  "argument of OpenMP clause '%0' must reference the same object in all threads">;
10292def err_omp_clause_not_arithmetic_type_arg : Error<
10293  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
10294def err_omp_clause_floating_type_arg : Error<
10295  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
10296def err_omp_once_referenced : Error<
10297  "variable can appear only once in OpenMP '%0' clause">;
10298def err_omp_once_referenced_in_target_update : Error<
10299  "variable can appear only once in OpenMP 'target update' construct">;
10300def note_omp_referenced : Note<
10301  "previously referenced here">;
10302def err_omp_reduction_in_task : Error<
10303  "reduction variables may not be accessed in an explicit task">;
10304def err_omp_reduction_id_not_compatible : Error<
10305  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
10306def err_omp_reduction_identifier_mismatch : Error<
10307  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
10308def note_omp_previous_reduction_identifier : Note<
10309  "previously marked as task_reduction with different reduction operation">;
10310def err_omp_prohibited_region : Error<
10311  "region cannot be%select{| closely}0 nested inside '%1' region"
10312  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
10313  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
10314  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
10315  "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
10316  "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
10317def err_omp_prohibited_region_simd : Error<
10318  "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
10319def err_omp_prohibited_region_atomic : Error<
10320  "OpenMP constructs may not be nested inside an atomic region">;
10321def err_omp_prohibited_region_critical_same_name : Error<
10322  "cannot nest 'critical' regions having the same name %0">;
10323def note_omp_previous_critical_region : Note<
10324  "previous 'critical' region starts here">;
10325def err_omp_several_directives_in_region : Error<
10326  "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
10327def note_omp_previous_directive : Note<
10328  "previous '%0' directive used here">;
10329def err_omp_sections_not_compound_stmt : Error<
10330  "the statement for '#pragma omp sections' must be a compound statement">;
10331def err_omp_parallel_sections_not_compound_stmt : Error<
10332  "the statement for '#pragma omp parallel sections' must be a compound statement">;
10333def err_omp_orphaned_section_directive : Error<
10334  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
10335  " must be closely nested to a sections region%select{|, not a %1 region}0">;
10336def err_omp_sections_substmt_not_section : Error<
10337  "statement in 'omp sections' directive must be enclosed into a section region">;
10338def err_omp_parallel_sections_substmt_not_section : Error<
10339  "statement in 'omp parallel sections' directive must be enclosed into a section region">;
10340def err_omp_parallel_reduction_in_task_firstprivate : Error<
10341  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
10342def err_omp_atomic_read_not_expression_statement : Error<
10343  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
10344  " where v and x are both lvalue expressions with scalar type">;
10345def note_omp_atomic_read_write: Note<
10346  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
10347def err_omp_atomic_write_not_expression_statement : Error<
10348  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
10349  " where x is a lvalue expression with scalar type">;
10350def err_omp_atomic_update_not_expression_statement : Error<
10351  "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',"
10352  " where x is an lvalue expression with scalar type">;
10353def err_omp_atomic_not_expression_statement : Error<
10354  "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',"
10355  " where x is an lvalue expression with scalar type">;
10356def note_omp_atomic_update: Note<
10357  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
10358  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
10359  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
10360def err_omp_atomic_capture_not_expression_statement : Error<
10361  "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',"
10362  " where x and v are both lvalue expressions with scalar type">;
10363def err_omp_atomic_capture_not_compound_statement : Error<
10364  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
10365  " '{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;}',"
10366  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
10367  " where x is an lvalue expression with scalar type">;
10368def note_omp_atomic_capture: Note<
10369  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
10370def err_omp_atomic_several_clauses : Error<
10371  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">;
10372def err_omp_several_mem_order_clauses : Error<
10373  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
10374def err_omp_atomic_incompatible_mem_order_clause : Error<
10375  "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
10376def note_omp_previous_mem_order_clause : Note<
10377  "'%0' clause used here">;
10378def err_omp_target_contains_not_only_teams : Error<
10379  "target construct with nested teams region contains statements outside of the teams construct">;
10380def note_omp_nested_teams_construct_here : Note<
10381  "nested teams construct here">;
10382def note_omp_nested_statement_here : Note<
10383  "%select{statement|directive}0 outside teams construct here">;
10384def err_omp_single_copyprivate_with_nowait : Error<
10385  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
10386def note_omp_nowait_clause_here : Note<
10387  "'nowait' clause is here">;
10388def err_omp_single_decl_in_declare_simd_variant : Error<
10389  "single declaration is expected after 'declare %select{simd|variant}0' directive">;
10390def err_omp_function_expected : Error<
10391  "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
10392def err_omp_wrong_cancel_region : Error<
10393  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
10394def err_omp_parent_cancel_region_nowait : Error<
10395  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
10396def err_omp_parent_cancel_region_ordered : Error<
10397  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
10398def 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">;
10399def 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">;
10400def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
10401def err_omp_mapper_wrong_type : Error<
10402  "mapper type must be of struct, union or class type">;
10403def err_omp_declare_mapper_wrong_var : Error<
10404  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
10405def err_omp_declare_mapper_redefinition : Error<
10406  "redefinition of user-defined mapper for type %0 with name %1">;
10407def err_omp_invalid_mapper: Error<
10408  "cannot find a valid user-defined mapper for type %0 with name %1">;
10409def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
10410def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
10411def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
10412def err_omp_typecheck_section_value : Error<
10413  "subscripted value is not an array or pointer">;
10414def err_omp_typecheck_section_not_integer : Error<
10415  "array section %select{lower bound|length}0 is not an integer">;
10416def err_omp_typecheck_shaping_not_integer : Error<
10417  "array shaping operation dimension is not an integer">;
10418def err_omp_shaping_dimension_not_positive : Error<
10419  "array shaping dimension is evaluated to a non-positive value %0">;
10420def err_omp_section_function_type : Error<
10421  "section of pointer to function type %0">;
10422def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
10423  InGroup<CharSubscript>, DefaultIgnore;
10424def err_omp_section_incomplete_type : Error<
10425  "section of pointer to incomplete type %0">;
10426def err_omp_section_not_subset_of_array : Error<
10427  "array section must be a subset of the original array">;
10428def err_omp_section_length_negative : Error<
10429  "section length is evaluated to a negative value %0">;
10430def err_omp_section_stride_non_positive : Error<
10431  "section stride is evaluated to a non-positive value %0">;
10432def err_omp_section_length_undefined : Error<
10433  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
10434def err_omp_wrong_linear_modifier : Error<
10435  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
10436def err_omp_wrong_linear_modifier_non_reference : Error<
10437  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
10438def err_omp_wrong_simdlen_safelen_values : Error<
10439  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
10440def err_omp_wrong_if_directive_name_modifier : Error<
10441  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
10442def err_omp_no_more_if_clause : Error<
10443  "no more 'if' clause is allowed">;
10444def err_omp_unnamed_if_clause : Error<
10445  "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
10446def note_omp_previous_named_if_clause : Note<
10447  "previous clause with directive name modifier specified here">;
10448def err_omp_ordered_directive_with_param : Error<
10449  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
10450def err_omp_ordered_directive_without_param : Error<
10451  "'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter">;
10452def note_omp_ordered_param : Note<
10453  "'ordered' clause%select{| with specified parameter}0">;
10454def err_omp_expected_base_var_name : Error<
10455  "expected variable name as a base of the array %select{subscript|section}0">;
10456def err_omp_map_shared_storage : Error<
10457  "variable already marked as mapped in current construct">;
10458def err_omp_invalid_map_type_for_directive : Error<
10459  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
10460def err_omp_no_clause_for_directive : Error<
10461  "expected at least one %0 clause for '#pragma omp %1'">;
10462def err_omp_threadprivate_in_clause : Error<
10463  "threadprivate variables are not allowed in '%0' clause">;
10464def err_omp_wrong_ordered_loop_count : Error<
10465  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
10466def note_collapse_loop_count : Note<
10467  "parameter of the 'collapse' clause">;
10468def err_omp_clauses_mutually_exclusive : Error<
10469  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
10470def note_omp_previous_clause : Note<
10471  "'%0' clause is specified here">;
10472def err_omp_hint_clause_no_name : Error<
10473  "the name of the construct must be specified in presence of 'hint' clause">;
10474def err_omp_critical_with_hint : Error<
10475  "constructs with the same name must have a 'hint' clause with the same value">;
10476def note_omp_critical_hint_here : Note<
10477  "%select{|previous }0'hint' clause with value '%1'">;
10478def note_omp_critical_no_hint : Note<
10479  "%select{|previous }0directive with no 'hint' clause specified">;
10480def err_omp_depend_clause_thread_simd : Error<
10481  "'depend' clauses cannot be mixed with '%0' clause">;
10482def err_omp_depend_sink_expected_loop_iteration : Error<
10483  "expected%select{| %1}0 loop iteration variable">;
10484def err_omp_depend_sink_unexpected_expr : Error<
10485  "unexpected expression: number of expressions is larger than the number of associated loops">;
10486def err_omp_depend_sink_expected_plus_minus : Error<
10487  "expected '+' or '-' operation">;
10488def err_omp_depend_sink_source_not_allowed : Error<
10489  "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
10490def err_omp_depend_zero_length_array_section_not_allowed : Error<
10491  "zero-length array section is not allowed in 'depend' clause">;
10492def err_omp_depend_sink_source_with_modifier : Error<
10493  "depend modifier cannot be used with 'sink' or 'source' depend type">;
10494def err_omp_depend_modifier_not_iterator : Error<
10495  "expected iterator specification as depend modifier">;
10496def err_omp_linear_ordered : Error<
10497  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
10498def err_omp_unexpected_schedule_modifier : Error<
10499  "modifier '%0' cannot be used along with modifier '%1'">;
10500def err_omp_schedule_nonmonotonic_static : Error<
10501  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
10502def err_omp_simple_clause_incompatible_with_ordered : Error<
10503  "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
10504def err_omp_ordered_simd : Error<
10505  "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
10506def err_omp_variable_in_given_clause_and_dsa : Error<
10507  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
10508def err_omp_param_or_this_in_clause : Error<
10509  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
10510def err_omp_expected_uniform_param : Error<
10511  "expected a reference to a parameter specified in a 'uniform' clause">;
10512def err_omp_expected_int_param : Error<
10513  "expected a reference to an integer-typed parameter">;
10514def err_omp_at_least_one_motion_clause_required : Error<
10515  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
10516def err_omp_usedeviceptr_not_a_pointer : Error<
10517  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
10518def err_omp_argument_type_isdeviceptr : Error <
10519  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
10520def warn_omp_nesting_simd : Warning<
10521  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
10522  InGroup<SourceUsesOpenMP>;
10523def err_omp_orphaned_device_directive : Error<
10524  "orphaned 'omp %0' directives are prohibited"
10525  "; perhaps you forget to enclose the directive into a "
10526  "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
10527def err_omp_reduction_non_addressable_expression : Error<
10528  "expected addressable reduction item for the task-based directives">;
10529def err_omp_reduction_with_nogroup : Error<
10530  "'reduction' clause cannot be used with 'nogroup' clause">;
10531def err_omp_reduction_vla_unsupported : Error<
10532  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
10533def err_omp_linear_distribute_var_non_loop_iteration : Error<
10534  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
10535def warn_omp_non_trivial_type_mapped : Warning<
10536  "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
10537  InGroup<OpenMPMapping>;
10538def err_omp_requires_clause_redeclaration : Error <
10539  "Only one %0 clause can appear on a requires directive in a single translation unit">;
10540def note_omp_requires_previous_clause : Note <
10541  "%0 clause previously used here">;
10542def err_omp_directive_before_requires : Error <
10543  "'%0' region encountered before requires directive with '%1' clause">;
10544def note_omp_requires_encountered_directive : Note <
10545  "'%0' previously encountered here">;
10546def err_omp_invalid_scope : Error <
10547  "'#pragma omp %0' directive must appear only in file scope">;
10548def note_omp_invalid_length_on_this_ptr_mapping : Note <
10549  "expected length on mapping of 'this' array section expression to be '1'">;
10550def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
10551  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
10552def note_omp_invalid_subscript_on_this_ptr_map : Note <
10553  "expected 'this' subscript expression on map clause to be 'this[0]'">;
10554def err_omp_invalid_map_this_expr : Error <
10555  "invalid 'this' expression on 'map' clause">;
10556def err_omp_implied_type_not_found : Error<
10557  "'%0' type not found; include <omp.h>">;
10558def err_omp_expected_omp_depend_t_lvalue : Error<
10559  "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
10560def err_omp_depobj_expected : Error<
10561  "expected depobj expression">;
10562def err_omp_depobj_single_clause_expected : Error<
10563  "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
10564def err_omp_scan_single_clause_expected : Error<
10565  "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
10566def err_omp_inclusive_exclusive_not_reduction : Error<
10567  "the list item must appear in 'reduction' clause with the 'inscan' modifier "
10568  "of the parent directive">;
10569def err_omp_reduction_not_inclusive_exclusive : Error<
10570  "the inscan reduction list item must appear as a list item in an 'inclusive' or"
10571  " 'exclusive' clause on an inner 'omp scan' directive">;
10572def err_omp_wrong_inscan_reduction : Error<
10573  "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
10574  " 'omp parallel for', or 'omp parallel for simd' directive">;
10575def err_omp_inscan_reduction_expected : Error<
10576  "expected 'reduction' clause with the 'inscan' modifier">;
10577def note_omp_previous_inscan_reduction : Note<
10578  "'reduction' clause with 'inscan' modifier is used here">;
10579def err_omp_expected_predefined_allocator : Error<
10580  "expected one of the predefined allocators for the variables with the static "
10581  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
10582  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
10583  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
10584def warn_omp_used_different_allocator : Warning<
10585  "allocate directive specifies %select{default|'%1'}0 allocator while "
10586  "previously used %select{default|'%3'}2">,
10587  InGroup<OpenMPClauses>;
10588def note_omp_previous_allocator : Note<
10589  "previous allocator is specified here">;
10590def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
10591  "inside of the target region; provide an 'allocator' clause or use 'requires'"
10592  " directive with the 'dynamic_allocators' clause">;
10593def err_expected_allocator_expression : Error<"expected an allocator expression "
10594  "inside of the target region; provide an allocator expression or use 'requires'"
10595  " directive with the 'dynamic_allocators' clause">;
10596def warn_omp_allocate_thread_on_task_target_directive : Warning<
10597  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
10598  InGroup<OpenMPClauses>;
10599def err_omp_expected_private_copy_for_allocate : Error<
10600  "the referenced item is not found in any private clause on the same directive">;
10601def err_omp_stmt_depends_on_loop_counter : Error<
10602  "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
10603def err_omp_invariant_dependency : Error<
10604  "expected loop invariant expression">;
10605def err_omp_invariant_or_linear_dependency : Error<
10606  "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
10607def err_omp_wrong_dependency_iterator_type : Error<
10608  "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
10609def err_device_unsupported_type
10610    : Error<"%0 requires %select{|%2 bit size}1 %3 type support, but device "
10611            "'%4' does not support it">;
10612def err_omp_lambda_capture_in_declare_target_not_to : Error<
10613  "variable captured in declare target region must appear in a to clause">;
10614def err_omp_device_type_mismatch : Error<
10615  "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
10616def err_omp_wrong_device_function_call : Error<
10617  "function with 'device_type(%0)' is not available on %select{device|host}1">;
10618def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
10619def warn_omp_declare_target_after_first_use : Warning<
10620  "declaration marked as declare target after first use, it may lead to incorrect results">,
10621  InGroup<OpenMPTarget>;
10622def err_omp_declare_variant_incompat_attributes : Error<
10623  "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
10624def warn_omp_declare_variant_score_not_constant
10625    : Warning<"score expressions in the OpenMP context selector need to be "
10626              "constant; %0 is not and will be ignored">,
10627      InGroup<SourceUsesOpenMP>;
10628def err_omp_declare_variant_user_condition_not_constant
10629    : Error<"the user condition in the OpenMP context selector needs to be "
10630            "constant; %0 is not">;
10631def warn_omp_declare_variant_after_used : Warning<
10632  "'#pragma omp declare variant' cannot be applied for function after first "
10633  "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
10634def warn_omp_declare_variant_after_emitted : Warning<
10635  "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
10636  " the original function might be used">, InGroup<SourceUsesOpenMP>;
10637def err_omp_declare_variant_doesnt_support : Error<
10638  "'#pragma omp declare variant' does not "
10639  "support %select{function templates|virtual functions|"
10640  "deduced return types|constructors|destructors|deleted functions|"
10641  "defaulted functions|constexpr functions|consteval function}0">;
10642def err_omp_declare_variant_diff : Error<
10643  "function with '#pragma omp declare variant' has a different %select{calling convention"
10644  "|return type|constexpr specification|inline specification|storage class|"
10645  "linkage}0">;
10646def err_omp_declare_variant_incompat_types : Error<
10647  "variant in '#pragma omp declare variant' with type %0 is incompatible with type %1"
10648  >;
10649def warn_omp_declare_variant_marked_as_declare_variant : Warning<
10650  "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
10651  >, InGroup<SourceUsesOpenMP>;
10652def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
10653def err_omp_one_defaultmap_each_category: Error<
10654  "at most one defaultmap clause for each variable-category can appear on the directive">;
10655def err_omp_lastprivate_conditional_non_scalar : Error<
10656  "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
10657  >;
10658def err_omp_flush_order_clause_and_list : Error<
10659  "'flush' directive with memory order clause '%0' cannot have the list">;
10660def note_omp_flush_order_clause_here : Note<
10661  "memory order clause '%0' is specified here">;
10662def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
10663  "expected addressable lvalue in '%0' clause">;
10664def err_omp_var_expected : Error<
10665  "expected variable of the '%0' type%select{|, not %2}1">;
10666def warn_unknown_declare_variant_isa_trait
10667    : Warning<"isa trait '%0' is not known to the current target; verify the "
10668              "spelling or consider restricting the context selector with the "
10669              "'arch' selector further">,
10670      InGroup<SourceUsesOpenMP>;
10671def err_omp_non_pointer_type_array_shaping_base : Error<
10672  "expected expression with a pointer to a complete type as a base of an array "
10673  "shaping operation">;
10674def err_omp_reduction_task_not_parallel_or_worksharing : Error<
10675  "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
10676  " worksharing constructs">;
10677def err_omp_expected_array_alloctraits : Error<
10678  "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
10679def err_omp_predefined_allocator_with_traits : Error<
10680  "predefined allocator cannot have traits specified">;
10681def note_omp_predefined_allocator : Note<
10682  "predefined trait '%0' used here">;
10683def err_omp_nonpredefined_allocator_without_traits : Error<
10684  "non-predefined allocator must have traits specified">;
10685def err_omp_allocator_used_in_clauses : Error<
10686  "allocators used in 'uses_allocators' clause cannot appear in other "
10687  "data-sharing or data-mapping attribute clauses">;
10688def err_omp_allocator_not_in_uses_allocators : Error<
10689  "allocator must be specified in the 'uses_allocators' clause">;
10690def note_omp_protected_structured_block
10691    : Note<"jump bypasses OpenMP structured block">;
10692def note_omp_exits_structured_block
10693    : Note<"jump exits scope of OpenMP structured block">;
10694def err_omp_interop_variable_expected : Error<
10695  "expected%select{| non-const}0 variable of type 'omp_interop_t'">;
10696def err_omp_interop_variable_wrong_type : Error<
10697  "interop variable must be of type 'omp_interop_t'">;
10698def err_omp_interop_prefer_type : Error<
10699  "prefer_list item must be a string literal or constant integral "
10700  "expression">;
10701def err_omp_interop_bad_depend_clause : Error<
10702  "'depend' clause requires the 'targetsync' interop type">;
10703def err_omp_interop_var_multiple_actions : Error<
10704  "interop variable %0 used in multiple action clauses">;
10705def err_omp_dispatch_statement_call
10706    : Error<"statement after '#pragma omp dispatch' must be a direct call"
10707            " to a target function or an assignment to one">;
10708} // end of OpenMP category
10709
10710let CategoryName = "Related Result Type Issue" in {
10711// Objective-C related result type compatibility
10712def warn_related_result_type_compatibility_class : Warning<
10713  "method is expected to return an instance of its class type "
10714  "%diff{$, but is declared to return $|"
10715  ", but is declared to return different type}0,1">;
10716def warn_related_result_type_compatibility_protocol : Warning<
10717  "protocol method is expected to return an instance of the implementing "
10718  "class, but is declared to return %0">;
10719def note_related_result_type_family : Note<
10720  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
10721  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
10722  "self}1' method family%select{| and is expected to return an instance of its "
10723  "class type}0">;
10724def note_related_result_type_overridden : Note<
10725  "overridden method returns an instance of its class type">;
10726def note_related_result_type_inferred : Note<
10727  "%select{class|instance}0 method %1 is assumed to return an instance of "
10728  "its receiver type (%2)">;
10729def note_related_result_type_explicit : Note<
10730  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
10731  "%select{| and is expected to return an instance of its class type}0">;
10732def err_invalid_type_for_program_scope_var : Error<
10733  "the %0 type cannot be used to declare a program scope variable">;
10734
10735}
10736
10737let CategoryName = "Modules Issue" in {
10738def err_module_decl_in_module_map_module : Error<
10739  "'module' declaration found while building module from module map">;
10740def err_module_decl_in_header_module : Error<
10741  "'module' declaration found while building header unit">;
10742def err_module_interface_implementation_mismatch : Error<
10743  "missing 'export' specifier in module declaration while "
10744  "building module interface">;
10745def err_current_module_name_mismatch : Error<
10746  "module name '%0' specified on command line does not match name of module">;
10747def err_module_redefinition : Error<
10748  "redefinition of module '%0'">;
10749def note_prev_module_definition : Note<"previously defined here">;
10750def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
10751def err_module_not_defined : Error<
10752  "definition of module '%0' is not available; use -fmodule-file= to specify "
10753  "path to precompiled module interface">;
10754def err_module_redeclaration : Error<
10755  "translation unit contains multiple module declarations">;
10756def note_prev_module_declaration : Note<"previous module declaration is here">;
10757def err_module_declaration_missing : Error<
10758  "missing 'export module' declaration in module interface unit">;
10759def err_module_declaration_missing_after_global_module_introducer : Error<
10760  "missing 'module' declaration at end of global module fragment "
10761  "introduced here">;
10762def err_module_private_specialization : Error<
10763  "%select{template|partial|member}0 specialization cannot be "
10764  "declared __module_private__">;
10765def err_module_private_local : Error<
10766  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
10767  "__module_private__">;
10768def err_module_private_local_class : Error<
10769  "local %select{struct|interface|union|class|enum}0 cannot be declared "
10770  "__module_private__">;
10771def err_module_unimported_use : Error<
10772  "%select{declaration|definition|default argument|"
10773  "explicit specialization|partial specialization}0 of %1 must be imported "
10774  "from module '%2' before it is required">;
10775def err_module_unimported_use_header : Error<
10776  "%select{missing '#include'|missing '#include %3'}2; "
10777  "%select{||default argument of |explicit specialization of |"
10778  "partial specialization of }0%1 must be "
10779  "%select{declared|defined|defined|declared|declared}0 "
10780  "before it is used">;
10781def err_module_unimported_use_multiple : Error<
10782  "%select{declaration|definition|default argument|"
10783  "explicit specialization|partial specialization}0 of %1 must be imported "
10784  "from one of the following modules before it is required:%2">;
10785def note_unreachable_entity : Note<
10786  "%select{declaration|definition|default argument declared|"
10787  "explicit specialization declared|partial specialization declared}0 here "
10788  "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
10789def ext_module_import_in_extern_c : ExtWarn<
10790  "import of C++ module '%0' appears within extern \"C\" language linkage "
10791  "specification">, DefaultError,
10792  InGroup<DiagGroup<"module-import-in-extern-c">>;
10793def err_module_import_not_at_top_level_fatal : Error<
10794  "import of module '%0' appears within %1">, DefaultFatal;
10795def ext_module_import_not_at_top_level_noop : ExtWarn<
10796  "redundant #include of module '%0' appears within %1">, DefaultError,
10797  InGroup<DiagGroup<"modules-import-nested-redundant">>;
10798def note_module_import_not_at_top_level : Note<"%0 begins here">;
10799def err_module_self_import : Error<
10800  "import of module '%0' appears within same top-level module '%1'">;
10801def err_module_import_in_implementation : Error<
10802  "@import of module '%0' in implementation of '%1'; use #import">;
10803
10804// C++ Modules
10805def err_module_decl_not_at_start : Error<
10806  "module declaration must occur at the start of the translation unit">;
10807def note_global_module_introducer_missing : Note<
10808  "add 'module;' to the start of the file to introduce a "
10809  "global module fragment">;
10810def err_export_within_anonymous_namespace : Error<
10811  "export declaration appears within anonymous namespace">;
10812def note_anonymous_namespace : Note<"anonymous namespace begins here">;
10813def ext_export_no_name_block : ExtWarn<
10814  "ISO C++20 does not permit %select{an empty|a static_assert}0 declaration "
10815  "to appear in an export block">, InGroup<ExportUnnamed>;
10816def ext_export_no_names : ExtWarn<
10817  "ISO C++20 does not permit a declaration that does not introduce any names "
10818  "to be exported">, InGroup<ExportUnnamed>;
10819def note_export : Note<"export block begins here">;
10820def err_export_no_name : Error<
10821  "%select{empty|static_assert|asm}0 declaration cannot be exported">;
10822def ext_export_using_directive : ExtWarn<
10823  "ISO C++20 does not permit using directive to be exported">,
10824  InGroup<DiagGroup<"export-using-directive">>;
10825def err_export_within_export : Error<
10826  "export declaration appears within another export declaration">;
10827def err_export_internal : Error<
10828  "declaration of %0 with internal linkage cannot be exported">;
10829def err_export_using_internal : Error<
10830  "using declaration referring to %0 with internal linkage cannot be exported">;
10831def err_export_not_in_module_interface : Error<
10832  "export declaration can only be used within a module interface unit"
10833  "%select{ after the module declaration|}0">;
10834def err_export_in_private_module_fragment : Error<
10835  "export declaration cannot be used in a private module fragment">;
10836def note_private_module_fragment : Note<
10837  "private module fragment begins here">;
10838def err_private_module_fragment_not_module : Error<
10839  "private module fragment declaration with no preceding module declaration">;
10840def err_private_module_fragment_redefined : Error<
10841  "private module fragment redefined">;
10842def err_private_module_fragment_not_module_interface : Error<
10843  "private module fragment in module implementation unit">;
10844def note_not_module_interface_add_export : Note<
10845  "add 'export' here if this is intended to be a module interface unit">;
10846
10847def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
10848  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
10849  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
10850def note_equivalent_internal_linkage_decl : Note<
10851  "declared here%select{ in module '%1'|}0">;
10852
10853def note_redefinition_modules_same_file : Note<
10854  "'%0' included multiple times, additional include site in header from module '%1'">;
10855def note_redefinition_include_same_file : Note<
10856  "'%0' included multiple times, additional include site here">;
10857}
10858
10859let CategoryName = "Coroutines Issue" in {
10860def err_return_in_coroutine : Error<
10861  "return statement not allowed in coroutine; did you mean 'co_return'?">;
10862def note_declared_coroutine_here : Note<
10863  "function is a coroutine due to use of '%0' here">;
10864def err_coroutine_objc_method : Error<
10865  "Objective-C methods as coroutines are not yet supported">;
10866def err_coroutine_unevaluated_context : Error<
10867  "'%0' cannot be used in an unevaluated context">;
10868def err_coroutine_within_handler : Error<
10869  "'%0' cannot be used in the handler of a try block">;
10870def err_coroutine_outside_function : Error<
10871  "'%0' cannot be used outside a function">;
10872def err_coroutine_invalid_func_context : Error<
10873  "'%1' cannot be used in %select{a constructor|a destructor"
10874  "|the 'main' function|a constexpr function"
10875  "|a function with a deduced return type|a varargs function"
10876  "|a consteval function}0">;
10877def err_implied_coroutine_type_not_found : Error<
10878  "%0 type was not found; include <experimental/coroutine> before defining "
10879  "a coroutine">;
10880def err_implicit_coroutine_std_nothrow_type_not_found : Error<
10881  "std::nothrow was not found; include <new> before defining a coroutine which "
10882  "uses get_return_object_on_allocation_failure()">;
10883def err_malformed_std_nothrow : Error<
10884  "std::nothrow must be a valid variable declaration">;
10885def err_malformed_std_coroutine_handle : Error<
10886  "std::experimental::coroutine_handle must be a class template">;
10887def err_coroutine_handle_missing_member : Error<
10888  "std::experimental::coroutine_handle missing a member named '%0'">;
10889def err_malformed_std_coroutine_traits : Error<
10890  "'std::experimental::coroutine_traits' must be a class template">;
10891def err_implied_std_coroutine_traits_promise_type_not_found : Error<
10892  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
10893def err_implied_std_coroutine_traits_promise_type_not_class : Error<
10894  "this function cannot be a coroutine: %0 is not a class">;
10895def err_coroutine_promise_type_incomplete : Error<
10896  "this function cannot be a coroutine: %0 is an incomplete type">;
10897def err_coroutine_type_missing_specialization : Error<
10898  "this function cannot be a coroutine: missing definition of "
10899  "specialization %0">;
10900def err_coroutine_promise_incompatible_return_functions : Error<
10901  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
10902def err_coroutine_promise_requires_return_function : Error<
10903  "the coroutine promise type %0 must declare either 'return_value' or 'return_void'">;
10904def note_coroutine_promise_implicit_await_transform_required_here : Note<
10905  "call to 'await_transform' implicitly required by 'co_await' here">;
10906def note_coroutine_promise_suspend_implicitly_required : Note<
10907  "call to '%select{initial_suspend|final_suspend}0' implicitly "
10908  "required by the %select{initial suspend point|final suspend point}0">;
10909def err_coroutine_promise_unhandled_exception_required : Error<
10910  "%0 is required to declare the member 'unhandled_exception()'">;
10911def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
10912  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
10913  InGroup<CoroutineMissingUnhandledException>;
10914def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
10915  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
10916def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
10917  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
10918def err_coroutine_promise_new_requires_nothrow : Error<
10919  "%0 is required to have a non-throwing noexcept specification when the promise "
10920   "type declares 'get_return_object_on_allocation_failure()'">;
10921def note_coroutine_promise_call_implicitly_required : Note<
10922  "call to %0 implicitly required by coroutine function here">;
10923def err_await_suspend_invalid_return_type : Error<
10924  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
10925>;
10926def note_await_ready_no_bool_conversion : Note<
10927  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
10928>;
10929def warn_coroutine_handle_address_invalid_return_type : Warning <
10930  "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">,
10931  InGroup<Coroutine>;
10932def err_coroutine_promise_final_suspend_requires_nothrow : Error<
10933  "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
10934>;
10935def note_coroutine_function_declare_noexcept : Note<
10936  "must be declared with 'noexcept'"
10937>;
10938} // end of coroutines issue category
10939
10940let CategoryName = "Documentation Issue" in {
10941def warn_not_a_doxygen_trailing_member_comment : Warning<
10942  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
10943} // end of documentation issue category
10944
10945let CategoryName = "Nullability Issue" in {
10946
10947def warn_mismatched_nullability_attr : Warning<
10948  "nullability specifier %0 conflicts with existing specifier %1">,
10949  InGroup<Nullability>;
10950
10951def warn_nullability_declspec : Warning<
10952  "nullability specifier %0 cannot be applied "
10953  "to non-pointer type %1; did you mean to apply the specifier to the "
10954  "%select{pointer|block pointer|member pointer|function pointer|"
10955  "member function pointer}2?">,
10956  InGroup<NullabilityDeclSpec>,
10957  DefaultError;
10958
10959def note_nullability_here : Note<"%0 specified here">;
10960
10961def err_nullability_nonpointer : Error<
10962  "nullability specifier %0 cannot be applied to non-pointer type %1">;
10963
10964def warn_nullability_lost : Warning<
10965  "implicit conversion from nullable pointer %0 to non-nullable pointer "
10966  "type %1">,
10967  InGroup<NullableToNonNullConversion>, DefaultIgnore;
10968def warn_zero_as_null_pointer_constant : Warning<
10969  "zero as null pointer constant">,
10970  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
10971
10972def err_nullability_cs_multilevel : Error<
10973  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
10974def note_nullability_type_specifier : Note<
10975  "use nullability type specifier %0 to affect the innermost "
10976  "pointer type of %1">;
10977
10978def warn_null_resettable_setter : Warning<
10979  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
10980  InGroup<Nullability>;
10981
10982def warn_nullability_missing : Warning<
10983  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
10984  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
10985  InGroup<NullabilityCompleteness>;
10986def warn_nullability_missing_array : Warning<
10987  "array parameter is missing a nullability type specifier (_Nonnull, "
10988  "_Nullable, or _Null_unspecified)">,
10989  InGroup<NullabilityCompletenessOnArrays>;
10990def note_nullability_fix_it : Note<
10991  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
10992  "%select{pointer|block pointer|member pointer|array parameter}1 "
10993  "%select{should never be null|may be null|should not declare nullability}0">;
10994
10995def warn_nullability_inferred_on_nested_type : Warning<
10996  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
10997  "deprecated">,
10998  InGroup<NullabilityInferredOnNestedType>;
10999
11000def err_objc_type_arg_explicit_nullability : Error<
11001  "type argument %0 cannot explicitly specify nullability">;
11002
11003def err_objc_type_param_bound_explicit_nullability : Error<
11004  "type parameter %0 bound %1 cannot explicitly specify nullability">;
11005
11006}
11007
11008let CategoryName = "Generics Issue" in {
11009
11010def err_objc_type_param_bound_nonobject : Error<
11011  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
11012
11013def err_objc_type_param_bound_missing_pointer : Error<
11014  "missing '*' in type bound %0 for type parameter %1">;
11015def err_objc_type_param_bound_qualified : Error<
11016  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
11017
11018def err_objc_type_param_redecl : Error<
11019  "redeclaration of type parameter %0">;
11020
11021def err_objc_type_param_arity_mismatch : Error<
11022  "%select{forward class declaration|class definition|category|extension}0 has "
11023  "too %select{few|many}1 type parameters (expected %2, have %3)">;
11024
11025def err_objc_type_param_bound_conflict : Error<
11026  "type bound %0 for type parameter %1 conflicts with "
11027  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
11028
11029def err_objc_type_param_variance_conflict : Error<
11030  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
11031  "%select{in|co|contra}2variant type parameter %3">;
11032
11033def note_objc_type_param_here : Note<"type parameter %0 declared here">;
11034
11035def err_objc_type_param_bound_missing : Error<
11036  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
11037
11038def err_objc_parameterized_category_nonclass : Error<
11039  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
11040  "parameters">;
11041
11042def err_objc_parameterized_forward_class : Error<
11043  "forward declaration of non-parameterized class %0 cannot have type "
11044  "parameters">;
11045
11046def err_objc_parameterized_forward_class_first : Error<
11047  "class %0 previously declared with type parameters">;
11048
11049def err_objc_type_arg_missing_star : Error<
11050  "type argument %0 must be a pointer (requires a '*')">;
11051def err_objc_type_arg_qualified : Error<
11052  "type argument %0 cannot be qualified with '%1'">;
11053
11054def err_objc_type_arg_missing : Error<
11055  "no type or protocol named %0">;
11056
11057def err_objc_type_args_and_protocols : Error<
11058  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
11059  "%select{protocol|type}0 (%2)">;
11060
11061def err_objc_type_args_non_class : Error<
11062  "type arguments cannot be applied to non-class type %0">;
11063
11064def err_objc_type_args_non_parameterized_class : Error<
11065  "type arguments cannot be applied to non-parameterized class %0">;
11066
11067def err_objc_type_args_specialized_class : Error<
11068  "type arguments cannot be applied to already-specialized class type %0">;
11069
11070def err_objc_type_args_wrong_arity : Error<
11071  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
11072}
11073
11074def err_objc_type_arg_not_id_compatible : Error<
11075  "type argument %0 is neither an Objective-C object nor a block type">;
11076
11077def err_objc_type_arg_does_not_match_bound : Error<
11078  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
11079
11080def warn_objc_redundant_qualified_class_type : Warning<
11081  "parameterized class %0 already conforms to the protocols listed; did you "
11082  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
11083
11084def warn_block_literal_attributes_on_omitted_return_type : Warning<
11085  "attribute %0 ignored, because it cannot be applied to omitted return type">,
11086  InGroup<IgnoredAttributes>;
11087
11088def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
11089  "'%0' qualifier on omitted return type %1 has no effect">,
11090  InGroup<IgnoredQualifiers>;
11091
11092def warn_shadow_field : Warning<
11093  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
11094  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
11095def note_shadow_field : Note<"declared here">;
11096
11097def err_multiversion_required_in_redecl : Error<
11098  "function declaration is missing %select{'target'|'cpu_specific' or "
11099  "'cpu_dispatch'}0 attribute in a multiversioned function">;
11100def note_multiversioning_caused_here : Note<
11101  "function multiversioning caused by this declaration">;
11102def err_multiversion_after_used : Error<
11103  "function declaration cannot become a multiversioned function after first "
11104  "usage">;
11105def err_bad_multiversion_option : Error<
11106  "function multiversioning doesn't support %select{feature|architecture}0 "
11107  "'%1'">;
11108def err_multiversion_duplicate : Error<
11109  "multiversioned function redeclarations require identical target attributes">;
11110def err_multiversion_noproto : Error<
11111  "multiversioned function must have a prototype">;
11112def err_multiversion_disallowed_other_attr : Error<
11113  "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioning cannot be combined"
11114  " with attribute %1">;
11115def err_multiversion_mismatched_attrs
11116    : Error<"attributes on multiversioned functions must all match, attribute "
11117            "%0 %select{is missing|has different arguments}1">;
11118def err_multiversion_diff : Error<
11119  "multiversioned function declaration has a different %select{calling convention"
11120  "|return type|constexpr specification|inline specification|storage class|"
11121  "linkage}0">;
11122def err_multiversion_doesnt_support : Error<
11123  "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioned functions do not "
11124  "yet support %select{function templates|virtual functions|"
11125  "deduced return types|constructors|destructors|deleted functions|"
11126  "defaulted functions|constexpr functions|consteval function}1">;
11127def err_multiversion_not_allowed_on_main : Error<
11128  "'main' cannot be a multiversioned function">;
11129def err_multiversion_not_supported : Error<
11130 "function multiversioning is not supported on the current target">;
11131def err_multiversion_types_mixed : Error<
11132  "multiversioning attributes cannot be combined">;
11133def err_cpu_dispatch_mismatch : Error<
11134 "'cpu_dispatch' function redeclared with different CPUs">;
11135def err_cpu_specific_multiple_defs : Error<
11136 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
11137def warn_multiversion_duplicate_entries : Warning<
11138 "CPU list contains duplicate entries; attribute ignored">,
11139  InGroup<FunctionMultiVersioning>;
11140def warn_dispatch_body_ignored : Warning<
11141  "body of cpu_dispatch function will be ignored">,
11142  InGroup<FunctionMultiVersioning>;
11143
11144// three-way comparison operator diagnostics
11145def err_implied_comparison_category_type_not_found : Error<
11146  "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
11147  "because type '%0' was not found; include <compare>">;
11148def err_spaceship_argument_narrowing : Error<
11149  "argument to 'operator<=>' "
11150  "%select{cannot be narrowed from type %1 to %2|"
11151  "evaluates to %1, which cannot be narrowed to type %2}0">;
11152def err_std_compare_type_not_supported : Error<
11153  "standard library implementation of %0 is not supported; "
11154   "%select{member '%2' does not have expected form|"
11155   "member '%2' is missing|"
11156   "the type is not trivially copyable|"
11157   "the type does not have the expected form}1">;
11158def note_rewriting_operator_as_spaceship : Note<
11159  "while rewriting comparison as call to 'operator<=>' declared here">;
11160def err_three_way_vector_comparison : Error<
11161  "three-way comparison between vectors is not supported">;
11162
11163// Memory Tagging Extensions (MTE) diagnostics
11164def err_memtag_arg_null_or_pointer : Error<
11165  "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
11166def err_memtag_any2arg_pointer : Error<
11167  "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
11168def err_memtag_arg_must_be_pointer : Error<
11169  "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
11170def err_memtag_arg_must_be_integer : Error<
11171  "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
11172
11173def warn_dereference_of_noderef_type : Warning<
11174  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
11175def warn_dereference_of_noderef_type_no_decl : Warning<
11176  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
11177def warn_noderef_on_non_pointer_or_array : Warning<
11178  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
11179def warn_noderef_to_dereferenceable_pointer : Warning<
11180  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
11181
11182def err_builtin_launder_invalid_arg : Error<
11183  "%select{non-pointer|function pointer|void pointer}0 argument to "
11184  "'__builtin_launder' is not allowed">;
11185
11186def err_builtin_matrix_disabled: Error<
11187  "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
11188def err_matrix_index_not_integer: Error<
11189  "matrix %select{row|column}0 index is not an integer">;
11190def err_matrix_index_outside_range: Error<
11191  "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
11192def err_matrix_incomplete_index: Error<
11193  "single subscript expressions are not allowed for matrix values">;
11194def err_matrix_separate_incomplete_index: Error<
11195  "matrix row and column subscripts cannot be separated by any expression">;
11196def err_matrix_subscript_comma: Error<
11197  "comma expressions are not allowed as indices in matrix subscript expressions">;
11198def err_builtin_matrix_arg: Error<"1st argument must be a matrix">;
11199def err_builtin_matrix_scalar_unsigned_arg: Error<
11200  "%0 argument must be a constant unsigned integer expression">;
11201def err_builtin_matrix_pointer_arg: Error<
11202  "%ordinal0 argument must be a pointer to a valid matrix element type">;
11203def err_builtin_matrix_pointer_arg_mismatch: Error<
11204  "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
11205def err_builtin_matrix_store_to_const: Error<
11206  "cannot store matrix to read-only pointer">;
11207def err_builtin_matrix_stride_too_small: Error<
11208  "stride must be greater or equal to the number of rows">;
11209def err_builtin_matrix_invalid_dimension: Error<
11210  "%0 dimension is outside the allowed range [1, %1]">;
11211
11212def warn_mismatched_import : Warning<
11213  "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
11214  "previous declaration">,
11215  InGroup<IgnoredAttributes>;
11216def warn_import_on_definition : Warning<
11217  "import %select{module|name}0 cannot be applied to a function with a definition">,
11218  InGroup<IgnoredAttributes>;
11219
11220def err_preserve_field_info_not_field : Error<
11221  "__builtin_preserve_field_info argument %0 not a field access">;
11222def err_preserve_field_info_not_const: Error<
11223  "__builtin_preserve_field_info argument %0 not a constant">;
11224def err_btf_type_id_not_const: Error<
11225  "__builtin_btf_type_id argument %0 not a constant">;
11226def err_preserve_type_info_invalid : Error<
11227  "__builtin_preserve_type_info argument %0 invalid">;
11228def err_preserve_type_info_not_const: Error<
11229  "__builtin_preserve_type_info argument %0 not a constant">;
11230def err_preserve_enum_value_invalid : Error<
11231  "__builtin_preserve_enum_value argument %0 invalid">;
11232def err_preserve_enum_value_not_const: Error<
11233  "__builtin_preserve_enum_value argument %0 not a constant">;
11234
11235def err_bit_cast_non_trivially_copyable : Error<
11236  "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
11237def err_bit_cast_type_size_mismatch : Error<
11238  "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
11239
11240// SYCL-specific diagnostics
11241def warn_sycl_kernel_num_of_template_params : Warning<
11242  "'sycl_kernel' attribute only applies to a function template with at least"
11243  " two template parameters">, InGroup<IgnoredAttributes>;
11244def warn_sycl_kernel_invalid_template_param_type : Warning<
11245  "template parameter of a function template with the 'sycl_kernel' attribute"
11246  " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
11247def warn_sycl_kernel_num_of_function_params : Warning<
11248  "function template with 'sycl_kernel' attribute must have a single parameter">,
11249  InGroup<IgnoredAttributes>;
11250def warn_sycl_kernel_return_type : Warning<
11251  "function template with 'sycl_kernel' attribute must have a 'void' return type">,
11252  InGroup<IgnoredAttributes>;
11253
11254def err_ext_int_bad_size : Error<"%select{signed|unsigned}0 _ExtInt must "
11255                                 "have a bit size of at least %select{2|1}0">;
11256def err_ext_int_max_size : Error<"%select{signed|unsigned}0 _ExtInt of bit "
11257                                 "sizes greater than %1 not supported">;
11258
11259// errors of expect.with.probability
11260def err_probability_not_constant_float : Error<
11261   "probability argument to __builtin_expect_with_probability must be constant "
11262   "floating-point expression">;
11263def err_probability_out_of_range : Error<
11264   "probability argument to __builtin_expect_with_probability is outside the "
11265   "range [0.0, 1.0]">;
11266
11267// TCB warnings
11268def err_tcb_conflicting_attributes : Error<
11269  "attributes '%0(\"%2\")' and '%1(\"%2\")' are mutually exclusive">;
11270def warn_tcb_enforcement_violation : Warning<
11271  "calling %0 is a violation of trusted computing base '%1'">,
11272  InGroup<DiagGroup<"tcb-enforcement">>;
11273
11274// RISC-V builtin required extension warning
11275def err_riscv_builtin_requires_extension : Error<
11276  "builtin requires '%0' extension support to be enabled">;
11277def err_riscv_builtin_invalid_lmul : Error<
11278  "LMUL argument must be in the range [0,3] or [5,7]">;
11279} // end of sema component.
11280